X-Git-Url: http://git.harvie.cz/?a=blobdiff_plain;f=demos%2Farguments2.c;h=63276cf49b97efa2a6b73aa2918716feba484376;hb=6a60bc82e8b8e6cccd0d4c2214a1f291662215f0;hp=3982e16fe7ba7879c478d50d6babb0e2effb4d5a;hpb=30628092e1e87a9273d018bb5547f7dba0afd430;p=svn%2FCll1h%2F.git diff --git a/demos/arguments2.c b/demos/arguments2.c index 3982e16..63276cf 100644 --- a/demos/arguments2.c +++ b/demos/arguments2.c @@ -1,18 +1,27 @@ #include "cll1.h" -//try$ make arguments2 -//try$ ./arguments2 -f xxx yyyy -? +//try to run: ./arguments2 -f reload yyyy -? program { - char *ptr; - - arguments + if_args then { - argument("-?") printf("This is just help!\n"); - else argument("-f") { nextargument(ptr) printf("Forced argument: %s\n",ptr); } - else { thisargument(ptr); printf("Simple argument: %s \n",ptr); } + for_args + { + if_arg ("-?") then + print("This is just help!"); + else if_arg ("-f") then + { + if (next_arg) then + { + print("Forced argument: ",next_arg); + skip_one; + } + } + else + print("Normal argument: ",this_arg); + } } else - puts("Bleeeeh, no arguments supplied... :-("); + print("Bleeeeh, no arguments supplied... :-("); }