Command-line arguments: Difference between revisions
Content added Content deleted
Not a robot (talk | contribs) (Add CLU) |
|||
Line 523: | Line 523: | ||
<lang Clojure>(dorun (map println *command-line-args*))</lang> |
<lang Clojure>(dorun (map println *command-line-args*))</lang> |
||
=={{header|CLU}}== |
|||
While it is not part of the language standard as specified in the reference manual, |
|||
[[Portable CLU]] includes a library function <code>get_argv</code> which returns |
|||
all the arguments in order. |
|||
Note that unlike C, the program name itself is not included in the list of arguments. |
|||
<lang clu>% This program needs to be merged with PCLU's "useful.lib", |
|||
% where get_argv lives. |
|||
% |
|||
% pclu -merge $CLUHOME/lib/useful.lib -compile cmdline.clu |
|||
start_up = proc () |
|||
po: stream := stream$primary_output() |
|||
args: sequence[string] := get_argv() |
|||
for arg: string in sequence[string]$elements(args) do |
|||
stream$putl(po, "arg: " || arg) |
|||
end |
|||
end start_up</lang> |
|||
{{out}} |
|||
<pre>$ ./cmdline -c "alpha beta" -h "gamma" |
|||
arg: -c |
|||
arg: alpha beta |
|||
arg: -h |
|||
arg: gamma</pre> |
|||
=={{header|COBOL}}== |
=={{header|COBOL}}== |