diff options
author | Dan Nicholson <dbn.lists@gmail.com> | 2008-03-27 08:49:46 -0700 |
---|---|---|
committer | Dan Nicholson <dbn.lists@gmail.com> | 2008-03-27 08:51:33 -0700 |
commit | fcae0e737240308c2376f0611f453c7e14091b20 (patch) | |
tree | 0f81c8a6f7c3c1d15a4adff53803f1e51c302815 /test | |
parent | d55f0b7020724189b2b290abb5ee3bbb03b21117 (diff) |
Support removing last string from strarg
Added the strarg_pop() function for removing the last string from the
array. It would be nicer if an arbitrary name or index could be removed,
but that probably requires a linked list. This should be good enough for
our purposes.
Diffstat (limited to 'test')
-rw-r--r-- | test/tstrarg.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/test/tstrarg.c b/test/tstrarg.c index 2945536..7eef722 100644 --- a/test/tstrarg.c +++ b/test/tstrarg.c @@ -32,6 +32,14 @@ int main(int argc, char *argv[]) else printf("Didn't find \"barf\" in test\n"); + printf("Removing last two elements\n"); + test = strarg_pop(test, &num); + test = strarg_pop(test, &num); + + printf("Contents of test strarg\n"); + for (n = 0; n < num; n++) + printf("Arg %d: %s\n", n, test[n]); + strarg_free(test, num); return 0; |