jesup@steinmetz.UUCP (08/31/87)
I've been modifying dcp (which was posted recently) to compile under the Lattice compiler on the Amiga, and have run across a couple of bugs. The most serious is in the system-independant code, in file dcpxfer.c. There is a line that looks like this: if (isupper(*cp)) tolower(*cp); If the problem isn't obvious, the line should read: *cp = tolower(*cp); Luckily, Lattice will tell you things like 'statement has no effect', as it did here. There are quite a few unused variables in the system-independant stuff, as well as functions that should be declared as void, but these don't affect the functioning of the code. The only other real problem is that dcp.h (and I believe 1 other file) have 'extern char *index'. This is fine until you add '#define index(s,r) strchr((s),(r))' to host.h. If the externs are needed, put them in host.h, or use '#ifndef index'. In the Amiga code, there are a number of problems. One routine (getone, in mlib.c) has a variable (line) that should be static. Actually, the entire routine can be replaced with a call to fgetc. Many of the files include a Aztec-specific file, functions.h. At least #ifdef it. Also, the host.h file includes ctype.h and errno.h, which is fine until something that includes host.h includes them as well. The dir routines have a structure (DIR) that includes a FileInfoBlock. The problem is that the structure is malloced, which may return a non-longword aligned block (only word alignment is needed on a 68000). It is safer to use AllocMem and FreeMem, as they guarantee long-word alignment (actually double-longword). In general, the code could use some linting. Lastly, I suspect the serial routines will be too slow for anything over 1200 baud (maybe 2400). THe best way to get speed out of the serial device is to read and write multiple characters at a time, not 1 at a time. You can query the serial device as to how many characters it has waiting. It would also be nice if it read serial speed, etc, out of preferences if possible. It looks like a good package, with a few rough edges for everyone to work on smoothing. My thanks to the author for a good job done. Once I have tested the Lattice version, I'll release diff's (w/ the fixes above), and send them to the Amiga version maintainer. Randell Jesup jesup@steinmetz.UUCP (uunet!steinmetz!jesup) jesup@lunge.UUCP (hopefully soon :-) jesup@ge-crd.arpa -- Randell Jesup (Please use one of these paths for mail) jesup@steinmetz.UUCP (uunet!steinmetz!jesup) jesup@ge-crd.ARPA
jesup@steinmetz.UUCP (09/02/87)
>The most serious is in the system-independant code, in file dcpxfer.c. >There is a line that looks like this: > if (isupper(*cp)) tolower(*cp); >If the problem isn't obvious, the line should read: > *cp = tolower(*cp); >Luckily, Lattice will tell you things like 'statement has no effect', >as it did here. It has been pointed out to me that K&R says tolower is undefined for non-uppercase characters, even if many implementations allow it for any character. Therefor, the line should be: if (isupper(*cp)) *cp = tolower(*cp); Thanks for the correction. -- Randell Jesup (Please use one of these paths for mail) jesup@steinmetz.UUCP (uunet!steinmetz!jesup) jesup@ge-crd.ARPA
jesup@steinmetz.steinmetz.UUCP (Randell Jesup) (09/03/87)
I have found 2 more serious bugs in dcp (uupc), in the system-independant code. First, in dcp.c, in dcpmain, there is a statement case 'G': if ( strcmp( Rmtname, "any" ) != SAME) state = 'Y'; else state = 'I'; This causes sysend to be calledfor each line in the systems file until it reaches the system you want to call (uupc -ssystem). Calling sysend before opening the serial port, at least on the Amiga, can have fatal results. The meaning of the conditional should be flipped, to ==. Second, in mail.c, there is a #define exit return The only place it is used is in the routine finis(), which is called in such a way that it is obviously assumed not to return. I kludged it by putting a return after every call to finis(), but I doubt that that's correct. Any comments/help? -- Randell Jesup (Please use one of these paths for mail) jesup@steinmetz.UUCP (uunet!steinmetz!jesup) jesup@ge-crd.ARPA