Article View: comp.sys.sun
Article #9936Re: at and atrun
From: Jim Easton
Date: Fri, 30 Dec 1988 06:57
Date: Fri, 30 Dec 1988 06:57
49 lines
2200 bytes
2200 bytes
felix@ai.sri.com (Francois Felix INGRAND) writes:
> I have a problem running at and atrun on our sun3 under Sun UNIX 4.2
> Release 3.5
>
> the script is never executed, and when I run atrun by hand, I get an error:
> like this one:
> 88.334.0000.09: bad spool header
> 88.335.1105.48: bad spool header
We had the same problem with atrun.
The cause of its not working is a bug in fscanf. There were 4 read
statements in atrun as follows;
/*
* Grab the 4-line header out of the spoolfile.
*/
if (
(fscanf(infile,"# owner: %127s%*[^\n]\n",owner) != 1) ||
(fscanf(infile,"# jobname: %127s%*[^\n]\n",jobname) != 1) ||
(fscanf(infile,"# shell: %3s%*[^\n]\n",shell) != 1) ||
(fscanf(infile,"# notify by mail: %3s%*[^\n]\n",mailvar) != 1)
) {
fprintf(stderr, "%s: bad spool header\n", spoolfile);
exit(1);
}
The intent was to read a string from the line and then flush the line to
the line feed however there was nothing to flush (ie. the next character
was a <LF> and it did not flush it. The next read got the line feed
instead of the next line as it was meant to and it declared an error.
Since we don't have the source for fscanf our fix was to remove the flush
- as follows;
/*
* Grab the 4-line header out of the spoolfile.
*/
if ( /* UofA001 */
(fscanf(infile,"# owner: %127s\n",owner) != 1) ||
(fscanf(infile,"# jobname: %127s\n",jobname) != 1) ||
(fscanf(infile,"# shell: %3s\n",shell) != 1) ||
(fscanf(infile,"# notify by mail: %3s\n",mailvar) != 1)
) {
fprintf(stderr, "%s: bad spool header\n", spoolfile);
exit(1);
}
Jim Easton (..!alberta!jim)
Technical Details
Message-ID:
<1913@pembina.UUCP>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!watmath!clyde!att!ucbvax!husc6!rice!sun-spots-requestReferences:
<8812012002.AA16630@cowell.ai.sri.com>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!watmath!clyde!att!ucbvax!husc6!rice!sun-spots-request From: jim@alberta.uucp (Jim Easton) Newsgroups: comp.sys.sun Subject: Re: at and atrun Message-ID: <1913@pembina.UUCP> Date: 30 Dec 88 06:57:47 GMT References: <8812012002.AA16630@cowell.ai.sri.com> Sender: usenet@rice.edu Organization: STC Technology Limited, London Road, Harlow, Essex, UK Lines: 49 Approved: Sun-Spots@rice.edu Original-Date: 19 Dec 88 19:56:03 GMT X-Sun-Spots-Digest: Volume 7, Issue 79, message 10 of 11