j.logsdon@lancaster.ac.uk wrote:
1 A simple program like:
program t(Input,Output); var s:string[20]; begin read(s); writeln(s); end.
when compiled (and it works) still gives a message:
/usr/local/lib/gcc-lib/i686-pc-linux-gnu/2.95.2/libgpc.a(randfile.o): In function `do_seek': /home/elug/pascal-wochenende-20000729/gcc-2.95.2/gcc/p/rts/randfile.c:327: the `llseek' function may be dangerous; use `lseek64' instead.
I may be running this at the weekend (RH 6.2 but gpc --version gives 2.95.2 19991024 (release) rather than anything like 20000729) but is this possibly an installation problem?
This problem was fixed ~ Sep 13. If the warning occurs with a newer release, please report it.
Otherwise, you can ignore the warning unless you plan to work with files > 2GB on a 32 bit system.
2 Is there a way of taking the command line arguments into a program? eg for a program foo.pas that compiles to a.out, I want to access argument 1 as 'something' in:
./a.out something
Is the whole command line available (like $0)?
Under Unix, there's no such thing as the "whole command line" as under Dos, because the shell breaks it up into "words", does filename globbing etc. You can access the arguments with ParamCount and ParamStr (see the example in the manual reference under "ParamCount"). In the example above, ParamStr (1) will contain "something". GetOpt is a more comfortable way to parse typical options. So often, you will want to use GetOpt for the options, and ParamStr for the remaining arguments (file names etc.). GetOptDemo does this as well.
ParamStr (0), BTW, contains the name the program was invoked as (like $0 does in shell scripts).
I saw the demo getopt but when I tried to compile this, I was told that it couldn't find GPC (from uses GPC). Does this mean that I haven't installed it properly? gpc is in the default place (/usr/local/bin/gpc etc)
Please give the `--automake' switch when using any units. If it still doesn't work, it's probably a slight installation problem -- please report the full error message and the output of running `gpc --print-file-name=units'.
Frank