[comp.os.minix] Clam Scripts - especially WAIT

inf2007@vax.rz.uni-wuerzburg.dbp.de (inf2007) (09/29/89)

Newsgroups: comp.os.minix
Subject: Re: Clam Scripts - especially  WAIT
Date: 20 Sep 89 08:54:51 GMT
Organization: University of Wuerzburg, W-Germany

(Sorry if this is a double posting- I'm not shure posting form 'unwue' works)

Jim Burnes <jburnes@PNET02.GRYPHON.COM> writes:
>Am I mistaken that Clam scripts are not supported....no wait...Clam scripts
>dont support flow control.  Doenst this limit Clam quite a bit?
>
>J . Burnes

Yes, scripts are not supported, but probably clam will then not further fit in
64K. The missing wait is simple to add. I have this done for Version 1.3b and
have sent these and other diffs to wtoomey but not heard from him. Here is
a patch for builtin.c and for job.c. It adds wait and messages if
a process is terminated by signal.
Because the patch was originated for the first Version, the line numbers don't
fit. -> Messages about line offset.

Robert Regn		regn@uniwue.uucp
or			regn@uni-wuerzburg.dbp.de
or			uunet!unido!uniwue!regn

These diffs are relative to 1.3 with patch #1 from 24 Aug 89

#! /bin/sh
# This is a shell archive.  Remove anything before this line, then unpack
# it by saving it into a file and typing "sh file".  To overwrite existing
# files, type "sh file -c".  You can also feed this as standard input via
# unshar, or by typing "sh <file", e.g..  If this archive is complete, you
# will see the following message at the end:
#		"End of shell archive."
# Contents:  builtin1.c.cdif job.c.cdif
# Wrapped by regn@sunray on Thu Sep 28 15:51:30 1989
PATH=/bin:/usr/bin:/usr/ucb ; export PATH
if test -f 'builtin1.c.cdif' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'builtin1.c.cdif'\"
else
echo shar: Extracting \"'builtin1.c.cdif'\" \(1372 characters\)
sed "s/^X//" >'builtin1.c.cdif' <<'END_OF_FILE'
X*** builtin1.c.ori	Mon Sep 11 14:41:41 1989
X--- builtin1.c	Mon Sep 11 14:31:56 1989
X***************
X*** 648,654 ****
X  	   BSD 4.x . However, they don't work under non-BSD Unixes,so they
X  	   have been excluded by Ifdefs	*/
X  
X- #ifdef JOB
X  static
X  void Wait(argc,argv,infd,outfd,errfd,ifil,ofil,efil,appnd,bckgnd,piped)
X    int argc,infd,outfd,errfd;
X--- 648,653 ----
X***************
X*** 656,663 ****
X--- 655,676 ----
X    bool appnd,bckgnd,piped;
X  {
X  /* may not be implemented */
X+ 	int status;
X+ 	int oldsig, wait_int ();	/* What's the type for oldsig ?? */
X+ 	oldsig = signal (SIGINT, wait_int);
X+ 	setdown();
X+ 	while ( wait(&status) != -1 )
X+ 		;	/* wait for all childs */
X+ 	resetsh();
X+ 	signal (SIGINT, oldsig);
X  }
X  
X+ static int wait_int()
X+ {
X+ 	printf ("wait: interrupted\n");
X+ }
X+ 
X+ #ifdef JOB
X  static
X  void suspend(argc,argv,infd,outfd,errfd,ifil,ofil,efil,appnd,bckgnd,piped)
X    int argc,infd,outfd,errfd;
X***************
X*** 1217,1225 ****
X      return(bg);
X    if (!strcmp(name,"stop"))
X      return(stop);
X!   if (!strcmp(name,"wait"))
X!     return(Wait);
X! #endif
X  #ifdef SCRIPT
X    if (!strcmp(name,"case"))
X      return(Case);
X--- 1231,1239 ----
X      return(bg);
X    if (!strcmp(name,"stop"))
X      return(stop);
X! #endif
X!   if (!strcmp(name,"wait"))
X!     return(Wait);
X  #ifdef SCRIPT
X    if (!strcmp(name,"case"))
X      return(Case);
END_OF_FILE
if test 1372 -ne `wc -c <'builtin1.c.cdif'`; then
    echo shar: \"'builtin1.c.cdif'\" unpacked with wrong size!
fi
# end of 'builtin1.c.cdif'
fi
if test -f 'job.c.cdif' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'job.c.cdif'\"
else
echo shar: Extracting \"'job.c.cdif'\" \(2080 characters\)
sed "s/^X//" >'job.c.cdif' <<'END_OF_FILE'
X*** job.c.ori	Mon Sep 11 14:44:33 1989
X--- job.c	Mon Sep 11 16:33:22 1989
X***************
X*** 22,32 ****
X  #include "header.h"
X  
X- #ifdef JOB
X  static char *siglist[] = { "Done","Hangup","Interrupt","Quit","Illegal Instruction",
X  "Trace/BPT Trap","IOT Trap","EMT Trap","Floating Point Exception","Killed",
X  "Bus Error","Sementation Violation","Bad System Call","Broken Pipe","Done",
X! "Terminated","Urgent Socket Condition","Stopped (signal)","Stopped","Continue",
X  "Child Status Change","Stopped (tty input)","Stopped (tty output)","I/O",
X! "Cpu Time Limit","File Size Limit","Virtual Time Alarm","Profile Alarm" };
X  
X  struct job *jtop=NULL,*exitop,*currentjob;
X--- 22,36 ----
X  #include "header.h"
X  
X  static char *siglist[] = { "Done","Hangup","Interrupt","Quit","Illegal Instruction",
X  "Trace/BPT Trap","IOT Trap","EMT Trap","Floating Point Exception","Killed",
X  "Bus Error","Sementation Violation","Bad System Call","Broken Pipe","Done",
X! "Terminated"
X! # ifdef JOB
X! ,"Urgent Socket Condition","Stopped (signal)","Stopped","Continue",
X  "Child Status Change","Stopped (tty input)","Stopped (tty output)","I/O",
X! "Cpu Time Limit","File Size Limit","Virtual Time Alarm","Profile Alarm"
X! # endif
X!  };
X  
X+ #ifdef JOB
X  struct job *jtop=NULL,*exitop,*currentjob;
X***************
X*** 326,335 ****
X  # else
X    int status;
X  
X! /* very temporary. Must use att job control algorilla */
X!   while ((wpid=wait(&status))!=pid && wpid!=-1)
X!     /* update list */;
X!   return(status);
X  
X  # endif
X  #else
X--- 330,358 ----
X  # else
X    int status;
X+   char *message;
X  
X! /* use exactly the same code as for ATT */
X!   do	{
X! 	wpid = wait(&status);
X! 	if (status & 0xff) 
X! 		{message=siglist[status &0x7f];
X! 		if (wpid != pid)
X! 			printf("%d ",wpid);
X! 		if (status &0200)
X! 			printf("%s (core dumped)\n",message);
X! 		else
X! 			printf("%s\n",message);
X! 		}
X! # ifdef chatter
X! 	else
X! 	      {
X! 		if (wpid != pid)
X! 			printf("%d: Exit %d\n", wpid, status >>8);
X! 	      }
X! # endif
X  
X+ 	} while (wpid != pid && wpid!=-1);
X+ 
X+   return(status);
X  # endif
X  #else
END_OF_FILE
if test 2080 -ne `wc -c <'job.c.cdif'`; then
    echo shar: \"'job.c.cdif'\" unpacked with wrong size!
fi
# end of 'job.c.cdif'
fi
echo shar: End of shell archive.
exit 0