X-Git-Url: https://git.harvie.cz/?a=blobdiff_plain;f=demos%2Farguments1.c;h=552e983b69d7f084926917b1afd7f7f9c803392a;hb=49df11dfb79a408ff31ebadd42c16cd5d71d6a7f;hp=6cd7bedb9c33136d31fe78218f05b2d76b9c5115;hpb=04a13a6fec5593523e15bd3567c573b7749b2609;p=svn%2FCll1h%2F.git diff --git a/demos/arguments1.c b/demos/arguments1.c index 6cd7bed..552e983 100644 --- a/demos/arguments1.c +++ b/demos/arguments1.c @@ -1,24 +1,27 @@ #include "cll1.h" -//try$ make arguments1 -//try$ ./arguments1 -x xxx yyyy -c cccc +/* try to run: ./arguments1 -x xxx yyyy -c cccc */ program { - char *ptr; - - arguments + if_args { - thisargument(ptr); - if(*ptr=='-') then + for_args { - printf("Command line switch: -%c ",ptr[1]); - nextargument(ptr); - printf("followed by: %s\n",ptr); + if this_arg[0] == '-') + { + printf("Command line switch: -%c ",ptr[1]); + if (next_arg) then + { + echo("followed by: ",next_arg); + skip_next; + } + print(""); + } + else + print("Standalone argument: ",ptr); } - else - printf("Simple argument: %s \n",ptr); } else - puts("Bleeeeh, no arguments supplied... :-("); + print("Bleeeeh, no arguments supplied... :-("); }