New API call Xorriso__severity_cmp()
This commit is contained in:
parent
fd61288ada
commit
47376c601f
@ -118,6 +118,7 @@ Xorriso__dispose_words;
|
||||
Xorriso__get_patch_level_text;
|
||||
Xorriso__is_compatible;
|
||||
Xorriso__preset_signal_behavior;
|
||||
Xorriso__severity_cmp;
|
||||
Xorriso__version;
|
||||
Xorriso_change_is_pending;
|
||||
Xorriso_destroy;
|
||||
|
@ -377,6 +377,25 @@ int Xorriso__text_to_sev(char *severity_name, int *severity_number, int flag)
|
||||
}
|
||||
|
||||
|
||||
int Xorriso__severity_cmp(char *sev1, char *sev2)
|
||||
{
|
||||
int s1= 0x7fffffff, s2= 0x7fffffff, ret;
|
||||
char *default_sev= "FATAL";
|
||||
|
||||
ret= Xorriso__text_to_sev(sev1, &s1, 0);
|
||||
if(ret <= 0)
|
||||
Xorriso__text_to_sev(default_sev, &s1, 0);
|
||||
ret= Xorriso__text_to_sev(sev2, &s2, 0);
|
||||
if(ret <= 0)
|
||||
Xorriso__text_to_sev(default_sev, &s2, 0);
|
||||
if(s1 < s2)
|
||||
return -1;
|
||||
if(s1 > s2)
|
||||
return(1);
|
||||
return(0);
|
||||
}
|
||||
|
||||
|
||||
/* @param flag bit0= report libisofs error text
|
||||
bit1= victim is disk_path
|
||||
bit2= do not inquire libisofs, report msg_text and min_severity
|
||||
|
@ -1734,7 +1734,7 @@ next_command:;
|
||||
struct Xorriso_lsT *info_list,
|
||||
int *line_count, int flag);
|
||||
int pargc, pflag, max_words;
|
||||
char **pargv= NULL, *pline, *prefix, *separators;
|
||||
char **pargv= NULL, *pline, *prefix, *separators, *sev1, *sev2;
|
||||
|
||||
(*idx)++;
|
||||
if(strcmp(arg1, "push") == 0) {
|
||||
@ -1805,6 +1805,19 @@ next_command:;
|
||||
for(i= 0; i < pargc; i++)
|
||||
fprintf(stderr, "xorriso_test: argv[%d]= '%s'\n", i, pargv[i]);
|
||||
Xorriso__dispose_words(&pargc, &pargv);
|
||||
} else if(strcmp(arg1, "severity_cmp") == 0) {
|
||||
(*idx)+= 2;
|
||||
sev1= "FATAL";
|
||||
if(*idx - 2 < argc)
|
||||
sev1= argv[*idx - 2];
|
||||
sev2= "FATAL";
|
||||
if(*idx - 1 < argc)
|
||||
sev2= argv[*idx - 1];
|
||||
ret= Xorriso__severity_cmp(sev1, sev2);
|
||||
fprintf(stderr,
|
||||
"xorriso_test: Xorriso__severity_cmp(\"%s\", \"%s\")= %d\n",
|
||||
sev1, sev2, ret);
|
||||
|
||||
} else {
|
||||
fprintf(stderr, "xorriso -test: unknwon mode: %s\n", arg1);
|
||||
}
|
||||
|
@ -524,10 +524,21 @@ int Xorriso_set_problem_status(struct XorrisO *xorriso, char *severity,
|
||||
int flag);
|
||||
|
||||
|
||||
/* The next two functions are part of Xorriso_eval_problem_status().
|
||||
/* The next three functions are part of Xorriso_eval_problem_status().
|
||||
You may use them to build an own advisor function.
|
||||
*/
|
||||
|
||||
/** Compare two severity texts for their severeness.
|
||||
@since 1.2.6
|
||||
@param sev1 First severity text to compare
|
||||
@param sev2 Second severity text to compare
|
||||
@return -1 sev1 is less severe than sev2
|
||||
0 sev1 is equally severe to sev2
|
||||
1 sev1 is more severe than sev2
|
||||
*/
|
||||
int Xorriso__severity_cmp(char *sev1, char *sev2);
|
||||
|
||||
|
||||
/** Obtain the current problem status of the xorriso handle.
|
||||
@param xorriso The environment handle
|
||||
@param severity The severity text matching the current problem status
|
||||
|
@ -1 +1 @@
|
||||
#define Xorriso_timestamP "2012.10.03.124152"
|
||||
#define Xorriso_timestamP "2012.10.14.190352"
|
||||
|
Loading…
Reference in New Issue
Block a user