X-Git-Url: http://git.harvie.cz/?a=blobdiff_plain;f=demos%2Farguments1.c;h=a892c3a24eddfadb7269c44550f448315c814ba0;hb=6e567bcce620b5312125f920e88c68a1404e71bf;hp=6cd7bedb9c33136d31fe78218f05b2d76b9c5115;hpb=04a13a6fec5593523e15bd3567c573b7749b2609;p=svn%2FCll1h%2F.git diff --git a/demos/arguments1.c b/demos/arguments1.c index 6cd7bed..a892c3a 100644 --- a/demos/arguments1.c +++ b/demos/arguments1.c @@ -1,24 +1,30 @@ #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; + Define_str(ptr); - arguments + if_args then { - thisargument(ptr); - if(*ptr=='-') then + for_args { - printf("Command line switch: -%c ",ptr[1]); - nextargument(ptr); - printf("followed by: %s\n",ptr); + ptr=this_arg; + if (ptr[0]=='-') then + { + printf("Command line switch: -%c ",ptr[1]); + if (next_arg) then + { + echo("followed by: ",next_arg); + skip_one; + } + print(""); + } + else + print("Standalone argument: ",ptr); } - else - printf("Simple argument: %s \n",ptr); } else - puts("Bleeeeh, no arguments supplied... :-("); + print("Bleeeeh, no arguments supplied... :-("); }