[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Wput



   Herr (?) Fritsch:

   I think that your program needs some work.

   As VMS lacks a UNIX-like shell, I normally try to build these kinds
of programs on a UNIX system first, and then adapt the config.h from
there to VMS.  On a Tru64 UNIX system (DEC/Compaq/HP Alpha), using the
normal (non-GNU) C compiler.  The configure script did not do well:

urt# CC=cc ./configure
[...]
checking for library containing getopt_long... no
configure: error: "You need to get libgnugetopt or a newer GNU libc."

   As you're supplying getopt/*.*, this test is really not useful.

   To get that far, I had to comment out this line:

      CFLAGS="${CFLAGS} -Wall"

Not everyone uses GCC, and not every other C compiler likes "-Wall".

   I gave up on that method and started with the existing config.h.

   You should be able to find copies of the files I changed under:

      http://www.antinode.org/ftp/wput/v0r5/
      ftp://ftp.antinode.org/wput/v0r5/

   Some comments follow.

      General

   Not everyone has tabs set for four spaces, so mixing spaces with tabs
(or using tabs at all) for indentation can produce ugly results.  Bytes
are cheap.  Expand the tabs.

   The LIST action hangs for a while, then times out:

      ==> LIST ...  cc.r.reply: >226<
      done.
      Error: recv() timed out. No data received
      Receive-Warning: read() timed out. Read '' so far.
      Length: 8,292

I didn't try to fix it.

      WPUT.H   

   Some older C preprocessors require the "#" in a directive to be in
column 1.  I changed the indentation to accomodate this.

   I added some VMS conditionality for the header includes, and for the
"rc" file specifications.

   I restored some of the deleted members of the fileinfo structure, for
reasons explained below.

      WPUT.C

   Having header files named the same as system header files is asking
for trouble.  I changed "socket.h" to "wpsocket.h", and, for
consistency, "socket.c" to "wpsocket.c".

   I added VMS conditionality for "-b" (and fork()).

   By default, the VMS linker is not case sensitive with regard to
global names, thus Abort() looks like abort().  I changed it to
wpAbort().

   You're welcome to choose better names.  Just avoid existing ones.

      UTILS.H

   I didn't really fix the excess isspace()/ISSPACE stuff, but I did
make it conditional.  See config.h_vms.

      UTILS.C

   Some older C preprocessors don't understand C++ comments ("//").

   Who doesn't have isspace() and basename()?  In my neighborhood,
isspace() is in ctype.h, and it's normally in-lined or macro-ized, so
it's normally at least as fast as anything you can write.  If VMS has
basename(), there's not much of an excuse for anyone else not having it.

      WPSOCKET.C (was SOCKET.C)

   Various type casts to calm the compiler.  Why does printip() want an
unsigned char instead of a char?  Most likely, printip() should be
changed to want plain char, and these new type casts should be removed. 
Or something else different from what I did.

   Made "int addrlen" "size_t addrlen", and so on.  It's a standard.

      QUEUE.C

   More type casts for printip().

      MEMDBG.C

   VMS conditionality for the header includes.  Type casts.

      FTP.H

   Matched declaration of Wget ftp_parse_ls().

      FTP.C

   Moved functions add_directory(), fileinfo_free(),
fileinfo_find_file(), and find_directory() into here from ftp-ls.c.

   Changed some messages so I could tell which of the "failed"
diagnostics was which.  Unique messages are good.  Duplicate messages
are bad.

   Changed the status test for SYST to work with more systems.

   Changed the code to keep the programmer from having to count the
characters in "WINDOWS_NT", usv.

   Restructured, and added functions read_whole_line() and nextchr() to
allow a near-standard Wget ftp-ls.c to work with Wput.  The main-stream
Wget ftp-ls.c does a bad job with some VMS FTP servers, so I prefer my
own code for this.

   Still more type casts for printip().

   Disabled unnecessary "do_type(TYPE_A)" before LIST.

   Changed the status test for LIST results, so that some success was
possible.

      FTP-LS.C

   Substituted my code from Wget, with a little WPUT conditionality.  It
was easier to put the missing structure members back in than to change
the code in ftp-ls.c.

   As the number of "#if[n]def WPUT" directives is small, you might be
able to persuade the Wget developers to put them in for you, so if or
when that code improves, you could just drop it in.

      WGET.H

   Macros and function declarations to let a near-normal Wget ftp-ls.c
work in Wput.

      URL.H

   Empty header file to satisfy Wget ftp-ls.c.


   When you get to work on large files, my advice is to stop thinking
about "int64", and start thinking about "off_t", which may be a 32- or
64-bit value, depending on the OS and/or compiler options and/or macro
definitions.

   My VMS DESCRIP.MMS (like a "make" file) is still quite crude.  The
VMS-specific code for Wget is more than enough for Wput.  If you get
Wput into better shape, I can clean that stuff up a bit more, and send
it along.

   Let me know if you have any questions, or when Wput 0.6 is ready.

------------------------------------------------------------------------

   Steven M. Schweda               (+1) 651-699-9818
   382 South Warwick Street        sms@antinode.org
   Saint Paul  MN  55105-2547