What's up with the command line argument parser?
| orchid% pike -M ~/pike/lib/modules -D FOO=17 -e 'werror("%O\n",FOO)'; echo | Pike: Couldn't find script to execute | ("/home/mirar/pike/longlongint/FOO=17") | orchid% pike -M ~/pike/lib/modules -DFOO=17 -e 'werror("%O\n",FOO)'; echo | -:3:Undefined identifier "FOO". | Compilation failed.
You are not allowed a space after -M. This behaviour is the same as in 7.2.
/ Marcus Comstedt (ACROSS) (Hail Ilpalazzo!)
Previous text:
2003-03-30 15:07: Subject: args
What's up with the command line argument parser?
| orchid% pike -M ~/pike/lib/modules -D FOO=17 -e 'werror("%O\n",FOO)'; echo | Pike: Couldn't find script to execute | ("/home/mirar/pike/longlongint/FOO=17") | orchid% pike -M ~/pike/lib/modules -DFOO=17 -e 'werror("%O\n",FOO)'; echo | -:3:Undefined identifier "FOO". | Compilation failed.
/ Mirar
Which is not to say it's a particularly good behaviour of course. :)
/ Marcus Comstedt (ACROSS) (Hail Ilpalazzo!)
Previous text:
2003-03-30 15:10: Subject: args
You are not allowed a space after -M. This behaviour is the same as in 7.2.
/ Marcus Comstedt (ACROSS) (Hail Ilpalazzo!)
So if I have a single -M, it eats two more arguments before it starts to parse again?
Note the difference:
orchid% pike ~/pike/lib/modules -D FOO=17 -e 'werror("%O\n",FOO)'; echo Pike: Couldn't find script to execute ("/home/mirar/pike/lib/modules")
I have a clear memory of the possibility of doing "-M ~/...", but I might be wrong.
/ Mirar
Previous text:
2003-03-30 15:10: Subject: args
You are not allowed a space after -M. This behaviour is the same as in 7.2.
/ Marcus Comstedt (ACROSS) (Hail Ilpalazzo!)
I'm not sure what happens actually. If I run the Getopt functions manually in Hilfe, the -M seems to be parsed correctly regardless of whether there is a space there or not. So I assume it's Getopt.get_args() that does something funky. However, I don't understand the use of get_args in the master, it doesn't work at all if I try the same statement in Hilfe:
Pike v7.4 release 17 running Hilfe v3.5 (Incremental Pike Frontend)
Getopt.find_all_options(({"pike","-M","hej","grunk","hopp"}),({({"m",Getopt.HAS_ARG,({"-M","--mp"}),0,0})}),1);
(1) Result: ({ /* 1 element */ ({ /* 2 elements */ "m", "hej" }) })
Getopt.find_all_options(({"pike","-Mhej","grunk","hopp"}),({({"m",Getopt.HAS_ARG,({"-M","--mp"}),0,0})}),1);
(2) Result: ({ /* 1 element */ ({ /* 2 elements */ "m", "hej" }) })
Getopt.get_args(({"pike","-M","hej","grunk","hopp"}),1);
Unknown option -M. pelix:~%
/ Marcus Comstedt (ACROSS) (Hail Ilpalazzo!)
Previous text:
2003-03-30 15:13: Subject: args
So if I have a single -M, it eats two more arguments before it starts to parse again?
Note the difference:
orchid% pike ~/pike/lib/modules -D FOO=17 -e 'werror("%O\n",FOO)'; echo Pike: Couldn't find script to execute ("/home/mirar/pike/lib/modules")
I have a clear memory of the possibility of doing "-M ~/...", but I might be wrong.
/ Mirar
Ah, now I see. It's the C code that is responsible for parsing away the -D flags that isn't up to snuff. If you type
pike -DFOO=17 -M ~/pike/lib/modules -e 'werror("%O\n",FOO)' ; echo
then it works.
/ Marcus Comstedt (ACROSS) (Hail Ilpalazzo!)
Previous text:
2003-03-30 15:07: Subject: args
What's up with the command line argument parser?
| orchid% pike -M ~/pike/lib/modules -D FOO=17 -e 'werror("%O\n",FOO)'; echo | Pike: Couldn't find script to execute | ("/home/mirar/pike/longlongint/FOO=17") | orchid% pike -M ~/pike/lib/modules -DFOO=17 -e 'werror("%O\n",FOO)'; echo | -:3:Undefined identifier "FOO". | Compilation failed.
/ Mirar
pike-devel@lists.lysator.liu.se