Hi!
I hope this is the right list for sending tftpd-patches - if not, please point
me in the right direction...
I experienced quite strange problems when trying to use tftp-hpa in newer
Cygwin versions. It simply isn't able to parse its command line correctly
because it seems to use another optind variable than getopt().
When you try to start it with something like
tftpd.exe -s /mypath
it complains about "too much -s directories". After some debugging, I
found,
that this code in main()
--- SNIP ---
dirs = xmalloc((argc-optind+1)*sizeof(char *));
for ( ndirs = 0 ; optind != argc ; optind++ )
dirs[ndirs++] = argv[optind];
--- SNAP ---
sees the wrong value for optind. The attached trivial patch resolves this
problem for me and is also the suggested way to use getopt according to the
man page.
Therefore it should definitely not harm (also not for Linux) to include it in
HEAD.
TIA for applying this patch!
--
Bye,
Gernot Hillier
CT SE 2
Siemens AG, Mch P
Hi! Gernot Hillier wrote:> I experienced quite strange problems when trying to use tftp-hpa in newer > Cygwin versions. It simply isn't able to parse its command line correctly > because it seems to use another optind variable than getopt().[...]> The attached trivial patch resolves this problem for me and is also the > suggested way to use getopt according to the man page.Sorry for self-replying, but it seems like my patch was filtered... Here is it inline: diff -ur tftp-hpa-0.35/tftpd/tftpd.c tftp-hpa-0.35.new/tftpd/tftpd.c --- tftp-hpa-0.35/tftpd/tftpd.c 2004-01-08 21:48:30.000000000 +0100 +++ tftp-hpa-0.35.new/tftpd/tftpd.c 2004-08-19 16:07:02.343750000 +0200 @@ -257,6 +257,8 @@ struct options *opt; struct sockaddr_in myaddr; struct sockaddr_in bindaddr; + extern char *optarg; + extern int optind, opterr, optopt; int n; int fd = 0; int standalone = 0; /* Standalone (listen) mode */ Please apply... -- Bye, Gernot Hillier CT SE 2 Siemens AG, Mch P