Here I've listed the changes I've made to rinetd since version 0.61.
I've split it into three categories: General changes, bug fixes and RISC OS
related changes. I hope I didn't forget anything. :-)

B = bug fix
C = general change
R = RISC OS specific change

0.61 -> 0.62
------------
R  all RISC OS specific changes are enclosed in #ifdef __riscos__ and
   #ifndef __riscos__ compiler options, so there should be no problem
   in compiling it with Linux and/or Win32
R  added include files necessary for RISC OS
R  added prototype necessary for RISC OS
R  renamed log() to logtofile() as log() on RISC OS refers always to the
   mathematical log() function during linking
R  RISC OS stores its configuration files not in /etc, but in a path
   which is called "Choices:", changed that as well
C  commented out Sleep() as nobody ever used it
C  fixed a few prototypes (one was there twice, another caused a warning)
C  added some casts in order to avoid compiler warnings
B  INADDR_ANY was assigned to saddr.sin_port and 0 was assigned to
   saddr.sin_addr.s_addr one time, this should have been the other way
   round; I have fixed that, it didn't do any harm as INADDR_ANY is
   defined to 0 anyway, but it's wrong nonetheless
R  used FIONONBLOCK instead of FIONBIO as RISC OS works better with its
   own FIOSLEEPTW; so FIONONBLOCK gets defined to either one, depending
   whether you compile on RISC OS or not
R  we want to close down "properly" in RISC OS on any termination,
   therefore added the term signal handler to SIGABRT and SIGINT as well;
   changed the term() function to do some more tidying up, especially
   releasing the memory when using USE_RMA.
C  changed occurances of -1 to INVALID_SOCKET where appropriate
B  added patternBad() test to deny rules as well, not just allow rules
C  due to some weird bug with strtok on RISC OS (or some side effect of
   getservbyname() ) you can't call getservbyname in between two strtok()
   calls where the second uses 0 as first argument; therefore I have
   moved the strtok() calls up and done the checking later on; no
   functional difference, just code re-ordering
C  removed some unnecessary code, such as setting a variable x to value y
   inside an if-statement which checked already that x == y
B  when conf_file can't be opened, one time the correct error message
   gets displayed, the second time a "low on memory" message gets
   displayed which is wrong, I have fixed that
B  in the "regular forwarding rule" part of readConfiguration() there
   was a big problem: in the normal case it worked, but as soon as
   something went wrong with one forwarding rule, the sync between all
   the se...[] arrays was lost; this is due to the continue statement
   which is wrong as it doesn't increase the i (we're in a while and not
   a for loop here); I changed that to "goto cont;" with a label "cont:"
   at the end, just for doing "i++" and initialising the rules for the
   next server socket
B  configuration file wasn't closed after the second reading pass; I
   have fixed that
C  the log file now doesn't stay open all the time, it gets opened just
   when something gets written to it and closed immediately afterwards;
   this is because you can't look at open files on RISC OS, so whenever
   rinetd would be running you couldn't investiagate the log file;
   works now and I don't think this has a speed penalty on Linux anyway;
   therefore removed closing of log file in term() as it is done already
   after the last writing
R  when defined USE_RMA, RISC OS can use another way of claiming and
   releasing memory instead of malloc() and free() (you'll need another
   two files to compile it then, available only in the source code
   archive for the RISC OS version as it would confuse Linux and Windows
   people ;-)
C  added GPL header to the source code files
C  added a few debugging functions, enabled by defining DEBUG, otherwise
   not seen by the compiler
C  added global flag "silent" in order to _not_ print messages to stderr
   if this flag is set, made configure file option "silent" available as
   well; therefore changed all fprintf's to sprintf's and subsequently
   calling errlog() which decides whether to print or write to log
R  removed the reference to the man page in the help string (for RISC OS
   only) as RISC OS doesn't have man pages
B  return after call to refuse() for the deny rules was missing in
   handleAccept(), thus connecting anyway.
B  safeRealloc() was missing free() for old buffer, thus creating memory
   leak.
B  when using the sockaddr_in structure, it has to be initialized with 0
   before using. There's one problem if you call bind() with a
   non-0.0.0.0 IP address and the padding sin_zero's aren't zeroed, then
   the bind() will return with EADDRNOTAVAIL. This is true for all BSD
   derived TCP/IP stacks (RISC OS is such a one, Linux not). It's
   documented in W. Richard Stevens' "Unix Network Programming, Volume 2"
   and "TCP/IP Illustrated, volume 2" books. I've fixed that by calling
   memset() before the first use.
C  changed constant 1024 in handleCloseFromLocal(), handleCloseFromRemote()
   and openLocalFd() to bufferSpace, so you'll need only to change the
   define bufferSpace in order to get rinetd working with another buffer
   size
C  made config file parsing more robust with additional error messages
   when no server could be set up for whatever reason
C  added "starting", "restarting" and "stopping" messages to log file
C  moved increasing of statistic counter coBytesInput[i] from
   handleRemoteRead to handleLocalWrite as I think you can count only
   the bytes that are already successfully redirected, not just those that
   are read by one end
R  changed the RISC OS code to use the SO_LINGER code as well and not the
   SO_SNDLOWAT code; if problems occur, we might have to redo this change
C  added option "dontlognormal" so that done-local-closed and
   done-remote-closed aren't logged anymore, but only the non-normal
   occurences like accept-failed, not-allowed, etc.

reFds[i] & loFds[i] status			accept(), socket(), other
---------------------------------------------	------------------------------
li_onoff == 0; li_linger == 0; no SO_SNDLOWAT	9, 24
li_onoff == 1; li_linger == 0; no SO_SNDLOWAT	9, 24, image broken after load
li_onoff == 1; li_linger != 0; no SO_SNDLOWAT	9, 24, image broken after load
li_onoff == 0; li_linger == 0; SO_SNDLOWAT	24
li_onoff == 1; li_linger == 0; SO_SNDLOWAT	
li_onoff == 1; li_linger != 0; SO_SNDLOWAT	

-- 
Stefan Bellon * <mailto:sbellon@sbellon.de> * <http://www.sbellon.de/>
