[comp.os.minix] Patch for cron.c

simmy@ocean.ocean.fsu.edu (Simmule Turner) (09/26/89)

>From: SCHREINER%iravcl.ira.uka.de@RELAY.CS.NET
>Subject: minor fixes of your cron

Hello,
here are some fixes of your recently posted cron version. I run it on 
MINIX ST 1.1.

 o	Malloc(3) wasn't defined as char *, so the compiler thinks it is
	an int and ....
 o	Unnecessary varible eleminated.
 o	A long was given to alarm(2) which gets an word from the stack.
	This word is every time zero. The cast corrects this.
 o	The next three diffs belonged together. At the end of my last
	crontab line i had an additional '\n'. This confuses cron,
	because of fgets(3) returns a line with the single character '\n'
	and strtok(3) returns this '\n' as a token ( which is ok ). The
	simples way to eleminate this was to delete all '\n'`s at the
	end of the lines. This made it necessary to add '\n'`s in the
	printf's.


	Ralf Wenk	using a friends account

--------------------- CUT HERE ------------------------------------------
echo x - cron.diff
gres '^X' '' > cron.diff << '/'
X4a5,7
X>  * Version 1.5a  Ralf Wenk	last update:	Sat Aug 26 15:40:59 1989
X>  *	Little fixes.
X>  *
X85a89
X> extern char *malloc();
X92,96c96,100
X< 	int status, pid;
X< 	long clock;
X< 
X< 	status=fork();
X< 	if ( status == -1 )
X---
X> 	int pid;
X> 	long clock;
X> 
X> 	pid = fork();
X> 	if ( pid == -1 )
X101,102c105
X< 
X< 	if (status > 0)
X---
X>         else if ( pid > 0)
X133c136
X< 		alarm(60 - clock % 60);
X---
X> 		alarm(( unsigned )(60 - clock % 60));
X165c168
X<                    fprintf(cronlog,"%02d/%02d-%02d:%02d  %s",
X---
X>                    fprintf(cronlog,"%02d/%02d-%02d:%02d  %s\n",
X270a274,278
X>              if ( crontab[pos+len-1] == '\n' )
X>              {
X>              	len--;
X>              	crontab[pos+len] = '\0';
X>              }
X330c338
X< 	    printf("%s\t%s\t%s\t%s\t%s\t%s",
X---
X> 	    printf("%s\t%s\t%s\t%s\t%s\t%s\n",
X
/

--
Simmule Turner        |Arpa: simmy@nu.cs.fsu.edu        | "Wait until it is 
Florida State Univ    |Uucp: gatech!nu.cs.fsu.edu!simmy |  finished, it will
444 OSB               | Cis: 70651,67       Genie:simmy |  be great"        
Tallahassee, FL 32306 | Tel: +1 904 644 1573            |             simmy