Allowed lower case severity names with -abort_on, -return_with, -report_about

This commit is contained in:
Thomas Schmitt 2011-07-31 09:44:41 +00:00
parent 076d5ad8b0
commit 7df497747d
4 changed files with 28 additions and 10 deletions

View File

@ -36,18 +36,24 @@
/* Option -abort_on */
int Xorriso_option_abort_on(struct XorrisO *xorriso, char *severity, int flag)
int Xorriso_option_abort_on(struct XorrisO *xorriso, char *in_severity,
int flag)
{
int ret, sev;
char severity[20], *official;
Xorriso__to_upper(in_severity, severity, (int) sizeof(severity), 0);
ret= Xorriso__text_to_sev(severity, &sev, 0);
if(ret<=0) {
sprintf(xorriso->info_text, "-abort_on: Not a known severity name : ");
Text_shellsafe(severity, xorriso->info_text, 1);
Text_shellsafe(in_severity, xorriso->info_text, 1);
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
return(ret);
}
if(Sfile_str(xorriso->abort_on_text,severity,0)<=0)
ret= Xorriso__sev_to_text(sev, &official, 0);
if(ret <= 0)
official= severity;
if(Sfile_str(xorriso->abort_on_text, official, 0) <= 0)
return(-1);
xorriso->abort_on_severity= sev;
xorriso->abort_on_is_default= 0;

View File

@ -452,19 +452,24 @@ int Xorriso_option_unregister_filter(struct XorrisO *xorriso, char *name,
/* Option -report_about */
int Xorriso_option_report_about(struct XorrisO *xorriso, char *severity,
int Xorriso_option_report_about(struct XorrisO *xorriso, char *in_severity,
int flag)
{
int ret, sev;
char severity[20], *official;
Xorriso__to_upper(in_severity, severity, (int) sizeof(severity), 0);
ret= Xorriso__text_to_sev(severity, &sev, 0);
if(ret<=0) {
sprintf(xorriso->info_text, "-report_about: Not a known severity name : ");
Text_shellsafe(severity, xorriso->info_text, 1);
Text_shellsafe(in_severity, xorriso->info_text, 1);
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "WARNING", 0);
return(ret);
}
if(Sfile_str(xorriso->report_about_text,severity,0)<=0)
ret= Xorriso__sev_to_text(sev, &official, 0);
if(ret <= 0)
official= severity;
if(Sfile_str(xorriso->report_about_text, official, 0) <= 0)
return(-1);
xorriso->report_about_severity= sev;
return(1);
@ -472,26 +477,31 @@ int Xorriso_option_report_about(struct XorrisO *xorriso, char *severity,
/* Option -return_with */
int Xorriso_option_return_with(struct XorrisO *xorriso, char *severity,
int Xorriso_option_return_with(struct XorrisO *xorriso, char *in_severity,
int exit_value, int flag)
{
int ret, sev;
char severity[20], *official;
Xorriso__to_upper(in_severity, severity, (int) sizeof(severity), 0);
ret= Xorriso__text_to_sev(severity, &sev, 0);
if(ret<=0) {
sprintf(xorriso->info_text,
"-return_with: Not a known severity name : ");
Text_shellsafe(severity, xorriso->info_text, 1);
Text_shellsafe(in_severity, xorriso->info_text, 1);
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
return(ret);
}
ret= Xorriso__sev_to_text(sev, &official, 0);
if(ret <= 0)
official= severity;
if(exit_value && (exit_value < 32 || exit_value > 63)) {
sprintf(xorriso->info_text,
"-return_with: Not an allowed exit_value. Use 0, or 32 to 63.");
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
return(0);
}
if(Sfile_str(xorriso->return_with_text,severity,0)<=0)
if(Sfile_str(xorriso->return_with_text, official, 0) <= 0)
return(-1);
xorriso->return_with_severity= sev;
xorriso->return_with_value= exit_value;

View File

@ -1 +1 @@
#define Xorriso_timestamP "2011.07.31.091836"
#define Xorriso_timestamP "2011.07.31.094422"

View File

@ -55,6 +55,8 @@ int Xorriso_graft_in(struct XorrisO *xorriso, void *boss_iter,
int Xorriso__text_to_sev(char *severity_name, int *severity_number,int flag);
int Xorriso__sev_to_text(int severity, char **severity_name, int flag);
/* @param flag bit0=report about output drive
bit1=short report form
bit2=do not try to read ISO heads