562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
|
** Return the tail of a command: the basename of the putative executable (which
** could be quoted when containing spaces) and the following arguments.
*/
const char *command_tail(const char *z){
const char *zTail = z;
char chQuote = 0;
if( !zTail ) return 0;
while( z[0] && (!fossil_isspace(z[0]) ||
chQuote) ){
if( z[0]=='"' || z[0]=='\'' ){
if( chQuote && chQuote==z[0] )
chQuote = 0;
else chQuote = z[0];
}
if( fossil_isdirsep(z[0]) ) zTail = &z[1];
z++;
}
return zTail;
}
|
|
<
<
|
<
|
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
|
** Return the tail of a command: the basename of the putative executable (which
** could be quoted when containing spaces) and the following arguments.
*/
const char *command_tail(const char *z){
const char *zTail = z;
char chQuote = 0;
if( !zTail ) return 0;
while( z[0] && (!fossil_isspace(z[0]) || chQuote) ){
if( z[0]=='"' || z[0]=='\'' ){
chQuote = (chQuote==z[0]) ? 0 : z[0];
}
if( fossil_isdirsep(z[0]) ) zTail = &z[1];
z++;
}
return zTail;
}
|