support@UCI-750A.ARPA (07/31/84)
From: Support Group (agent: Richard Johnson) <support@UCI-750A.ARPA> Description: Leave doesn't work if you specify the time using the "+" syntax. When the bug causing this is fixed, it gives a bogus error message. Repeat-By: Type "leave +1". You'll never see the warning. Fix: Diff listing follows: (We install all bug fixes so that compiling with "-DUCI" is needed to compile them in. Ignore the ifdef's.) *** bk_leave.c Thu Mar 31 11:57:12 1983 --- leave.c Fri Jul 20 19:10:06 1984 *************** *** 1,4 static char *sccsid = "@(#)leave.c 4.3 (Berkeley) 3/31/83"; #include <stdio.h> #include <signal.h> /* --- 1,12 ----- static char *sccsid = "@(#)leave.c 4.3 (Berkeley) 3/31/83"; + /* UCICHANGES (enabled via -DUCI): + + 0) Fri Jul 20 19:08:21 1984 Sources (agent: Richard Johnson) + Leave doesn't ever print a message if you use the "+nnnn" syntax. + Even if it did, then it would give a bogus error. + (ucb/leave.c) + + */ #include <stdio.h> #include <signal.h> /* *************** *** 32,37 if (buff[0] == '\n') exit(0); if (buff[0] == '+') { diff = atoi(buff+1); doalarm(diff); --- 40,48 ----- if (buff[0] == '\n') exit(0); + #ifdef UCI + strcpy(origlogin,getlogin()); + #endif UCI if (buff[0] == '+') { diff = atoi(buff+1); doalarm(diff); *************** *** 35,40 if (buff[0] == '+') { diff = atoi(buff+1); doalarm(diff); } if (buff[0] < '0' || buff[0] > '9') { printf("usage: %s [hhmm]\n",argv[0]); --- 46,54 ----- if (buff[0] == '+') { diff = atoi(buff+1); doalarm(diff); + #ifdef UCI + exit(0); + #endif UCI } if (buff[0] < '0' || buff[0] > '9') { printf("usage: %s [hhmm]\n",argv[0]); *************** *** 40,45 printf("usage: %s [hhmm]\n",argv[0]); exit(1); } strcpy(origlogin,getlogin()); tod = atoi(buff); --- 54,60 ----- printf("usage: %s [hhmm]\n",argv[0]); exit(1); } + #ifndef UCI strcpy(origlogin,getlogin()); #endif UCI *************** *** 41,46 exit(1); } strcpy(origlogin,getlogin()); tod = atoi(buff); hours = tod / 100; --- 56,62 ----- } #ifndef UCI strcpy(origlogin,getlogin()); + #endif UCI tod = atoi(buff); hours = tod / 100;
ado@elsie.UUCP (08/03/84)
Before we leave the subject, here are our local changes to the "leave.c" source as distributed with 4.1BSD. 1. A mildly sexist comment has been removed. 2. You are reminded of when you want to leave, rather than of when you have to leave. 3. You can use a command like leave 1700 go to the bank to get a reminder of both when to leave and why. Lines from the current source file follow. #ifdef OLDVERSION static char *sccsid = "@(#)leave.c 4.1 (Berkeley) 10/1/80"; #include <stdio.h> /* * leave [hhmm] * * Reminds you when you have to leave. * Leave prompts for input and goes away if you hit return. * It nags you like a mother hen. */ #else static char sccsid[] = "@(#)leave.c 1.3"; #include <stdio.h> /* * leave [hhmm [reminder ...]] * * Reminds you when you want to leave. * Leave prompts for input and goes away if you hit return. * It nags you. */ int argcsaved; char ** argvsaved; #endif . . . #ifdef OLDVERSION if (argc < 2) { printf("When do you have to leave? "); fflush(stdout); buff[read(0,buff,sizeof buff)] = 0; } else { strcpy(buff,argv[1]); } #else #include <ctype.h> if (argc < 2) { register char * cp; static char * fakeargv[1]; argcsaved = 0; printf("When do you want to leave? "); fflush(stdout); buff[read(0,buff,sizeof buff)] = 0; for (cp = buff; *cp != '\0'; ++cp) if (!isdigit(*cp)) { argcsaved = 1; argvsaved = fakeargv; fakeargv[0] = cp + 1; break; } } else { strcpy(buff,argv[1]); argcsaved = argc - 2; argvsaved = argv + 2; } #endif . . . #ifdef OLDVERSION printf("usage: %s [hhmm]\n",argv[0]); #else printf("usage: %s [hhmm [reminder ...]]\n",argv[0]); #endif . . . #ifdef OLDVERSION printf("usage: %s [hhmm]\n",argv[0]); #else printf("usage: %s [hhmm [reminder ...]]\n",argv[0]); #endif . . . #ifdef OLDVERSION msg1 = "You have to leave in 5 minutes"; #else msg1 = "You want to leave in 5 minutes"; #endif . . . #ifdef OLDVERSION printf("%s\n",msg); #else printf("%s",msg); if (argcsaved > 0) { register argnum; printf("--"); for (argnum = 0; argnum < argcsaved; ++argnum) { printf("%s",argvsaved[argnum]); if (argnum != argcsaved - 1) printf(" "); } } printf("\n"); #endif And here are lines from the current manual page file: leave \- remind you when you want to leave .ig leave \- remind you when you have to leave .. .SH SYNOPSIS .B leave [ hhmm [ reminder ... ] ] .ig [ hhmm ] .. .SH DESCRIPTION .I Leave waits until the specified time, then reminds you that you want to leave. .ig have to leave. .. . . . .PP If you give a .IR reminder , it is made part of the message. .PP If no argument is given, .I leave prompts with "When do you want to leave?". A reply of newline causes .ig have to leave?". A reply of newline causes .. -- ...decvax!allegra!umcp-cs!elsie!ado (301) 496-5688 (DEC, VAX and Elsie are Digital Equipment Corp. and Borden's trademarks)