Path: utzoo!attcan!uunet!lll-winken!lll-tis!ames!mailrus!tut.cis.ohio-state.edu!bloom-beacon!mit-eddie!killer!vector!rpp386!jfh From: jfh@rpp386.Dallas.TX.US (The Beach Bum) Newsgroups: comp.sources.bugs Subject: Patch for uumailclean (c.s.unix v15i089) Summary: bug-fix for long system names Message-ID: <8215@rpp386.Dallas.TX.US> Date: 22 Oct 88 13:21:54 GMT Organization: River Parishes Programming, Dallas TX Lines: 57 This patch corrects a problem where a 7 character system name would prevent the work file from being found. The troublesome while() loop was waiting until after the terminating character had been copied to stop copying the file name. If the work file name was FILNAMELEN characters long, then copying stopped after the last legitimate character was copied when `--n' went to 0. The while() has been re-written to stop *before* the seperating character or after FILENAMELEN characters have been copied. Since the last character which was placed in d[] is legitimate, we don't go back to the d[-1]'th element to terminate the string, we just go ahead and add the '\0' to the end of the existing string. *** orig/uumailclean.c --- uumailclean.c ************** *** 368,375 n = FILENAMELEN - 1; do { *d++ = *s; ! } while (*s != '\0' && *s != ' ' && *s++ != '\n' && --n); ! d[-1] = '\0'; DEBUG(5, "dfile set to %s\n", dfile); if (fgets(buf, BUFSIZ, fp) == NULL) { --- 368,375 ----- n = FILENAMELEN - 1; do { *d++ = *s; ! } while (*++s != '\0' && *s != ' ' && *s != '\n' && --n); ! *d = '\0'; DEBUG(5, "dfile set to %s\n", dfile); if (fgets(buf, BUFSIZ, fp) == NULL) { ************** *** 385,392 n = FILENAMELEN - 1; do { *d++ = *s; ! } while (*s != '\0' && *s != ' ' && *s++ != '\n' && --n); ! d[-1] = '\0'; DEBUG(5, "xfile set to %s\n", xfile); fclose(fp); --- 385,392 ----- n = FILENAMELEN - 1; do { *d++ = *s; ! } while (*++s != '\0' && *s != ' ' && *s != '\n' && --n); ! *d = '\0'; DEBUG(5, "xfile set to %s\n", xfile); fclose(fp); -- John F. Haugh II +----Make believe quote of the week---- VoiceNet: (214) 250-3311 Data: -6272 | Nancy Reagan on Richard Stallman: InterNet: jfh@rpp386.Dallas.TX.US | "Just say `Gno'" UucpNet : !killer!rpp386!jfh +--------------------------------------