[comp.os.minix] "at" under Minix-386

grundy@rtf.bt.co.uk (Martin Grundy) (05/21/91)

Hi all...

Back in March, I saw a posting from Tony Falcone
(afalcone@mbunix.mitre.org) with the same subject line.

He was having problems with "at" under Minix-386, creating enormous files
in /usr/spool/at and not getting anything scheduled.

Well I got the same thing, but I have found the problem.  Since I cannot
remember seeing any follow-up to Tony's posting, I am posting this.

The problem possibly has something to do with differences in the way the
bcc and ack compilers treat chars.

"at" does a popen() on the command 'pwd' and reads the stream to find out
the current directory.  It does this by the standard method:-

	while ((c = getc(pin)) != EOF) {
		putc(c, fp);
	}

With c declared as a char, although the input reaches end-of-file, the
value returned is still not equal to EOF and output to the script file
never ends, hence the megabytes in /usr/spool/at.

A solution is to declare c as an int.  A cdiff follows (for what it's
worth).

------------------------------------------------------------
*** at.c	Tue May 21 14:35:28 1991
--- at.c.orig	Tue May 21 14:32:52 1991
***************
*** 15,22 ****
  int argc;
  char **argv, **envp;
  {
!   int c, i, count, ltim, year, getltim(), getlday(), lday = NODAY;
!   char buf[10], job[30], *dp, *sp;
    struct tm *p, *localtime();
    long clock;
    FILE *fp, *pin, *popen();
--- 15,22 ----
  int argc;
  char **argv, **envp;
  {
!   int i, count, ltim, year, getltim(), getlday(), lday = NODAY;
!   char c, buf[10], job[30], *dp, *sp;
    struct tm *p, *localtime();
    long clock;
    FILE *fp, *pin, *popen();


------------------------------------------------------------
Martin Grundy                     |  email: grundy@rtf.bt.co.uk
British Telecom Customer Systems  |
Hyperion House                    |  phone: +44 273 762102
96-99 Queens Road                 |  fax:   +44 273 722038 or
Brighton BN1 3XF.                 |         +44 273 762071 (netfax)