From 4979f7302784da624a75d82a7db0e11a5ac84ce0 Mon Sep 17 00:00:00 2001 From: Scott Hannahs Date: Mon, 12 Feb 2024 11:34:47 -0500 Subject: [PATCH] Allow \ to replace \b to represent blanks in file names. Makes transcripts compatible with shell calls --- argcargv.c | 10 +++++++++- code.c | 3 ++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/argcargv.c b/argcargv.c index d78ca47..0e58fc5 100644 --- a/argcargv.c +++ b/argcargv.c @@ -45,6 +45,7 @@ acav_parse( ACAV *acav, char *line, char **argv[] ) { int ac; int state; + char * pline = line; if ( acav == NULL ) { if ( acavg == NULL ) { @@ -60,7 +61,6 @@ acav_parse( ACAV *acav, char *line, char **argv[] ) for ( ; *line != '\0'; line++ ) { switch ( *line ) { - case ' ' : case '\t' : case '\n' : if ( state == ACV_WORD ) { @@ -68,6 +68,14 @@ acav_parse( ACAV *acav, char *line, char **argv[] ) state = ACV_WHITE; } break; + case ' ' : + if ( ( line == pline ) || ( *(line-1) != '\\') ) { + if ( state == ACV_WORD ) { + *line = '\0'; + state = ACV_WHITE; + } + break; + } default : if ( state == ACV_WHITE ) { acav->acv_argv[ ac++ ] = line; diff --git a/code.c b/code.c index eb0319b..8d41b59 100644 --- a/code.c +++ b/code.c @@ -34,7 +34,7 @@ encode( char *line ) case ' ' : *temp = '\\'; temp++; - *temp = 'b'; + *temp = ' '; break; case '\t' : *temp = '\\'; @@ -96,6 +96,7 @@ decode( char *line ) *temp = '\t'; break; case 'b': + case ' ': *temp = ' '; break; case 'r':