New API calls Xorriso_parse_line() and Xorriso__dispose_words()

This commit is contained in:
2012-09-08 17:38:36 +00:00
parent e0201c478f
commit 9b1b770c1b
6 changed files with 180 additions and 30 deletions

View File

@ -1,7 +1,7 @@
/* xorriso - creates, loads, manipulates and burns ISO 9660 filesystem images.
Copyright 2007-2010 Thomas Schmitt, <scdbackup@gmx.net>
Copyright 2007-2012 Thomas Schmitt, <scdbackup@gmx.net>
Provided under GPL version 2 or later.
@ -638,8 +638,8 @@ int Sfile_destroy_argv(int *argc, char ***argv, int flag)
}
int Sfile_make_argv(char *progname, char *line, int *argc, char ***argv,
int flag)
int Sfile_sep_make_argv(char *progname, char *line, char *separators,
int max_words, int *argc, char ***argv, int flag)
/*
bit0= read progname as first argument from line
bit1= just release argument list argv and return
@ -682,12 +682,26 @@ int Sfile_make_argv(char *progname, char *line, int *argc, char ***argv,
if(pass==0) maxl= 0;
}
while(*(++cpt)!=0){
if(isspace(*cpt)) continue;
if(*separators) {
if(strchr(separators, *cpt) != NULL)
continue;
} else if(isspace(*cpt))
continue;
start= cpt;
buf[0]= 0;
cpt--;
if(max_words > 0 && argzaehl >= max_words && *cpt != 0) {
/* take uninterpreted up to the end */
cpt+= strlen(cpt) - 1;
}
while(*(++cpt)!=0) {
if(isspace(*cpt)) break;
if(*separators) {
if(strchr(separators, *cpt) != NULL)
break;
} else if(isspace(*cpt))
break;
if(*cpt=='"'){
l= cpt-start; bufl= strlen(buf);
if(l>0) {
@ -794,6 +808,13 @@ ex:
}
int Sfile_make_argv(char *progname, char *line, int *argc, char ***argv,
int flag)
{
return Sfile_sep_make_argv(progname, line, "", 0, argc, argv, flag);
}
/* @param flag bit0= append */
int Sfile_str(char target[SfileadrL], char *source, int flag)
{