arnold@mathcs.emory.edu (Arnold D. Robbins {EUCC}) (07/18/89)
Subject: learn has null pointer bugs Index: /usr/src/usr.bin/learn/copy.c 4.3BSD Description: On a machine that doesn't allow dereferencing null pointers (say, a Sun 4), learn will die fairly early into the sequence of lessons in "learn vi." Repeat-By: Install learn on a Sun 4. In deference to the UCB folks, I don't know if the Tahoe version still has this problem or not. Fix: Apply the following context diff to the file copy.c in the learn source directory. *** copy.c.orig Thu May 15 20:59:10 1986 --- copy.c Mon Jul 17 17:30:59 1989 *************** *** 49,55 **** } r = wordb(s, t); /* t = first token, r = rest */ p = action(t); /* p = token class */ ! if (*p == ONCE) { /* some actions done only once per script */ if (wrong && !review) { /* we are on 2nd time */ scopy(fin, NULL); continue; --- 49,55 ---- } r = wordb(s, t); /* t = first token, r = rest */ p = action(t); /* p = token class */ ! if (p && *p == ONCE) { /* some actions done only once per script */ if (wrong && !review) { /* we are on 2nd time */ scopy(fin, NULL); continue; *************** *** 265,271 **** if (c == '\n') break; if (c == EOF) { ! fflush(fo); return; } if (fo != NULL) --- 265,272 ---- if (c == '\n') break; if (c == EOF) { ! if (fo != NULL) ! fflush(fo); return; } if (fo != NULL) *************** *** 281,287 **** } if (c == '#') ungetc(c, fi); ! fflush(fo); } cmp(r) /* compare two files for status; #cmp f1 f2 [ firstnlinesonly ] */ --- 282,289 ---- } if (c == '#') ungetc(c, fi); ! if (fo != NULL) ! fflush(fo); } cmp(r) /* compare two files for status; #cmp f1 f2 [ firstnlinesonly ] */ -- Arnold Robbins -- Emory University Computing Center | Unix is a Registered DOMAIN: arnold@unix.cc.emory.edu | Bell of AT&T Trademark UUCP: gatech!emoryu1!arnold PHONE: +1 404 727-7636 | Laboratories. BITNET: arnold@emoryu1 FAX: +1 404 727-2599 | -- Donn Seeley