diff options
author | Alexandre Oliva <oliva@adacore.com> | 2020-01-16 03:58:50 -0300 |
---|---|---|
committer | Alexandre Oliva <oliva@gnu.org> | 2020-01-23 16:45:24 -0300 |
commit | 18193e8f005320db5ce47067f076680bef7d7532 (patch) | |
tree | caa4f39f59f59d4c4f89fd24c6dc30bac50793f6 | |
parent | f9e84b31df2a5dd911de86c9f1177a9d8c8ea49d (diff) | |
download | gcc-18193e8f005320db5ce47067f076680bef7d7532.zip gcc-18193e8f005320db5ce47067f076680bef7d7532.tar.gz gcc-18193e8f005320db5ce47067f076680bef7d7532.tar.bz2 |
[libiberty] output empty args as a pair of quotes
writeargv writes out empty arguments in a way that expandargv skips
them instead of preserving them. Fixed by writing out a pair of
quotes for them.
for libiberty/ChangeLog
* argv.c (writeargv): Output empty args as "".
-rw-r--r-- | libiberty/ChangeLog | 4 | ||||
-rw-r--r-- | libiberty/argv.c | 8 |
2 files changed, 12 insertions, 0 deletions
diff --git a/libiberty/ChangeLog b/libiberty/ChangeLog index c2bab93..17903ea 100644 --- a/libiberty/ChangeLog +++ b/libiberty/ChangeLog @@ -1,3 +1,7 @@ +2020-01-23 Alexandre Oliva <oliva@adacore.com> + + * argv.c (writeargv): Output empty args as "". + 2020-01-01 Jakub Jelinek <jakub@redhat.com> Update copyright years. diff --git a/libiberty/argv.c b/libiberty/argv.c index 8c9794d..6a72208 100644 --- a/libiberty/argv.c +++ b/libiberty/argv.c @@ -327,6 +327,14 @@ writeargv (char * const *argv, FILE *f) arg++; } + /* Write out a pair of quotes for an empty argument. */ + if (arg == *argv) + if (EOF == fputs ("\"\"", f)) + { + status = 1; + goto done; + } + if (EOF == fputc ('\n', f)) { status = 1; |