comparison lib-src/=timer.c @ 1751:fac61b478a41

Also, write a newline after the token.
author Michael I. Bushnell <mib@gnu.org>
date Fri, 08 Jan 1993 21:12:58 +0000
parents 2a92e870a448
children f149ad4ad9d4
comparison
equal deleted inserted replaced
1750:2a92e870a448 1751:fac61b478a41
62 /* check entry format */ 62 /* check entry format */
63 for (p = str; *p && *p != FS; p++) 63 for (p = str; *p && *p != FS; p++)
64 continue; 64 continue;
65 if (!*p) 65 if (!*p)
66 { 66 {
67 fprintf (stderr, "%s: bad input format: %s", pname, str); 67 fprintf (stderr, "%s: bad input format: %s\n", pname, str);
68 return; 68 return;
69 } 69 }
70 *p++ = 0; 70 *p++ = 0;
71 71
72 /* allocate an event slot */ 72 /* allocate an event slot */
99 99
100 /* Don't allow users to schedule events in past time. */ 100 /* Don't allow users to schedule events in past time. */
101 ep->reply_at = get_date (str, NULL); 101 ep->reply_at = get_date (str, NULL);
102 if (ep->reply_at - time (&now) < 0) 102 if (ep->reply_at - time (&now) < 0)
103 { 103 {
104 fprintf (stderr, "%s: bad time spec: %s%c%s", pname, str, FS, p); 104 fprintf (stderr, "%s: bad time spec: %s%c%s\n", pname, str, FS, p);
105 return; 105 return;
106 } 106 }
107 107
108 /* save the event description */ 108 /* save the event description */
109 ep->token = (char *) malloc ((unsigned) strlen (p) + 1); 109 ep->token = (char *) malloc ((unsigned) strlen (p) + 1);
110 if (! ep->token) 110 if (! ep->token)
111 { 111 {
112 fprintf (stderr, "%s: malloc %s: %s%c%s", 112 fprintf (stderr, "%s: malloc %s: %s%c%s\n",
113 pname, sys_errlist[errno], str, FS, p); 113 pname, sys_errlist[errno], str, FS, p);
114 return; 114 return;
115 } 115 }
116 116
117 strcpy (ep->token, p); 117 strcpy (ep->token, p);
229 getevent (); 229 getevent ();
230 break; 230 break;
231 case SIGTERM: 231 case SIGTERM:
232 fprintf (stderr, "Events still queued:\n"); 232 fprintf (stderr, "Events still queued:\n");
233 for (ep = events; ep < events + num_events; ep++) 233 for (ep = events; ep < events + num_events; ep++)
234 fprintf (stderr, "%d = %ld @ %s", 234 fprintf (stderr, "%d = %ld @ %s\n",
235 ep - events, ep->reply_at, ep->token); 235 ep - events, ep->reply_at, ep->token);
236 exit (0); 236 exit (0);
237 break; 237 break;
238 } 238 }
239 239