[unix-pc.sources] Shcc Patch 3

john@hcr.UUCP (John R. MacMillan) (02/18/89)

This is patch 3 for shcc, and no, you didn't miss patch 2.  I've
applied the diffs Roger Florkowski posted, and called them patch 2.
If my psychic powers failed me in the first sentence, and you did miss
Roger's diffs, drop me a note, and I'll send them to you.

Fixed in this patch:
- changed my address in the ReadMe and man page.  Please use that
  address (john@chance.UUCP or ...!{utcsri,utzoo}!hcr!chance!john)
  instead of the address this patch was posted from.
- shcc -c foo/bar.c now creates bar.o instead of foo/bar.o
- instead of exiting with some obscure constants when interrupted,
  shcc now exits with 100 + signal.  This isn't what the real cc
  does either, but what the heck.

Feed me to patch.

*** OLD/ReadMe	Thu Feb 16 23:10:55 1989
--- ReadMe	Thu Feb 16 23:37:41 1989
***************
*** 80,88
  
  Suggestions to:
  
! john%mystic@math.waterloo.edu
! ...!watmath!mystic!john
! 
! until 1989, at which point I'll be elsewhere.
! {utcsri,utzoo}!hcr!chance!john
! if I had to guess.

--- 80,84 -----
  
  Suggestions to:
  
! john@chance.UUCP (if your mailer read maps)
! ...!{utcsri,utzoo}!hcr!chance!john (if not)
*** OLD/load.c	Fri Feb 17 00:02:55 1989
--- load.c	Fri Feb 17 00:13:35 1989
***************
*** 3,8
   *
   * Modification History:
   *
   * Release 1.1.1.2	88/12/20
   *	Clean up warnings from gcc(1)
   *

--- 3,11 -----
   *
   * Modification History:
   *
+  * Release 1.1.1.3	89/02/16
+  *	Roger Florkowski's changes
+  *
   * Release 1.1.1.2	88/12/20
   *	Clean up warnings from gcc(1)
   *
***************
*** 11,17
   */
  
  #ifndef	lint
! static char *SCCS = "@(#)load.c	1.1.1.2	89/02/16";
  #endif
  
  #include "shcc.h"

--- 14,20 -----
   */
  
  #ifndef	lint
! static char *SCCS = "@(#)load.c	1.1.1.3	89/02/17";
  #endif
  
  #include "shcc.h"
*** OLD/options.c	Thu Feb 16 23:09:44 1989
--- options.c	Thu Feb 16 23:41:28 1989
***************
*** 4,9
   * Modification History:
   *
   *
   * Release 1.1.1.3	88/12/20
   *	Clean up warnings from gcc(1)
   *

--- 4,15 -----
   * Modification History:
   *
   *
+  * Release 1.1.1.5	89/02/16
+  *	Fix so shcc -c foo/bar.c produces bar.o not foo/bar.o
+  *
+  * Release 1.1.1.4	89/02/16
+  *	Roger Florkowski's changes
+  *
   * Release 1.1.1.3	88/12/20
   *	Clean up warnings from gcc(1)
   *
***************
*** 19,25
   */
  
  #ifndef	lint
! static char *SCCS = "@(#)options.c	1.1.1.3	89/02/16";
  #endif
  
  #include "shcc.h"

--- 25,31 -----
   */
  
  #ifndef	lint
! static char *SCCS = "@(#)options.c	1.1.1.5	89/02/16";
  #endif
  
  #include "shcc.h"
***************
*** 32,37
  {
  	int	opt, processor;
  	char	*p, passchar;
  	char	**AddArg();
  	void	AddLdArg(), ParseWargs();
  	extern	char	*stralloc(), *suffix(); 

--- 38,44 -----
  {
  	int	opt, processor;
  	char	*p, passchar;
+ 	char	*ofile;
  	char	**AddArg();
  	void	AddLdArg(), ParseWargs();
  	extern	char	*stralloc(), *suffix(); 
***************
*** 39,45
  	extern	char	*optarg;
  	extern	int	optind, opterr, optopt;
  	extern	int	getopt(), printf(), strlen(), atoi();
! 	extern	char	*strchr(), *strcpy();
  	extern	int	execv();
  
  	/*

--- 46,52 -----
  	extern	char	*optarg;
  	extern	int	optind, opterr, optopt;
  	extern	int	getopt(), printf(), strlen(), atoi();
! 	extern	char	*strchr(), *strcpy(), *strrchr();
  	extern	int	execv();
  
  	/*
***************
*** 247,253
  		while((optind < argc) && (*argv[optind] != '-')) {
  			files = AddArg( argv[optind], files, &numfiles,
  					&maxfiles );
! 			p = suffix( files[numfiles-1] );
  			if( p && !*(p+1) && (*p == 'c' || *p == 's') ) {
  				p = stralloc( strlen(files[numfiles-1]) );
  				(void) strcpy( p, files[numfiles-1] );

--- 254,264 -----
  		while((optind < argc) && (*argv[optind] != '-')) {
  			files = AddArg( argv[optind], files, &numfiles,
  					&maxfiles );
! 			if ((ofile = strrchr(files[numfiles-1], '/')) == NULL)
! 				ofile = files[numfiles-1];
! 			else
! 				ofile++;
! 			p = suffix( ofile );
  			if( p && !*(p+1) && (*p == 'c' || *p == 's') ) {
  				p = stralloc( strlen(ofile) );
  				(void) strcpy( p, ofile );
***************
*** 249,256
  					&maxfiles );
  			p = suffix( files[numfiles-1] );
  			if( p && !*(p+1) && (*p == 'c' || *p == 's') ) {
! 				p = stralloc( strlen(files[numfiles-1]) );
! 				(void) strcpy( p, files[numfiles-1] );
  				ldinargv = AddArg( p, ldinargv, &ldinargc,
  						&ldinmax );
  				p = suffix( p );

--- 260,267 -----
  				ofile++;
  			p = suffix( ofile );
  			if( p && !*(p+1) && (*p == 'c' || *p == 's') ) {
! 				p = stralloc( strlen(ofile) );
! 				(void) strcpy( p, ofile );
  				ldinargv = AddArg( p, ldinargv, &ldinargc,
  						&ldinmax );
  				p = suffix( p );
*** OLD/passes.c	Thu Feb 16 23:09:53 1989
--- passes.c	Thu Feb 16 23:42:17 1989
***************
*** 4,9
   *
   * Modification History:
   *
   * Release 1.1.1.1	88/12/20
   *	Clean up warnings from gcc(1)
   *

--- 4,15 -----
   *
   * Modification History:
   *
+  * Release 1.1.1.3	89/02/16
+  *	Fix so shcc -c foo/bar.c produces bar.o not foo/bar.o
+  *
+  * Release 1.1.1.2	89/02/16
+  *	Roger Florkowski's changes
+  *
   * Release 1.1.1.1	88/12/20
   *	Clean up warnings from gcc(1)
   *
***************
*** 12,18
   */
  
  #ifndef	lint
! static char *SCCS = "@(#)passes.c	1.1.1.1	89/02/16";
  #endif
  
  #include "shcc.h"

--- 18,24 -----
   */
  
  #ifndef	lint
! static char *SCCS = "@(#)passes.c	1.1.1.3	89/02/16";
  #endif
  
  #include "shcc.h"
***************
*** 227,233
  char	*file;
  {
  	int	reqdpasses;
! 	char	*sfx, *tmpas, *path;
  	extern	char	*suffix(), *stralloc();
  	extern	int	callsys();
  	extern	int	strlen(), printf();

--- 233,239 -----
  char	*file;
  {
  	int	reqdpasses;
! 	char	*sfx, *tmpas, *path, *p;
  	extern	char	*suffix(), *stralloc();
  	extern	int	callsys();
  	extern	int	strlen(), printf();
***************
*** 231,237
  	extern	char	*suffix(), *stralloc();
  	extern	int	callsys();
  	extern	int	strlen(), printf();
! 	extern	char	*strcpy(), *strcat();
  
  	tmpas = NULL;
  	sfx = suffix( file );

--- 237,243 -----
  	extern	char	*suffix(), *stralloc();
  	extern	int	callsys();
  	extern	int	strlen(), printf();
! 	extern	char	*strcpy(), *strcat(), *strrchr();
  
  	tmpas = NULL;
  	sfx = suffix( file );
***************
*** 260,265
  
  	if( numfiles > 1 )
  		(void) printf( "%s:\n", file );
  
  	if( reqdpasses & PREPROCESS ) {
  		if( verbose )

--- 266,274 -----
  
  	if( numfiles > 1 )
  		(void) printf( "%s:\n", file );
+ 
+ 	if( (p = strrchr( file, '/' )) != NULL )
+ 		file = p + 1;
  
  	if( reqdpasses & PREPROCESS ) {
  		if( verbose )
*** OLD/shcc.c	Fri Feb 17 00:02:52 1989
--- shcc.c	Fri Feb 17 00:13:28 1989
***************
*** 6,11
   *
   * Modification History:
   *
   * Release 1.1.1.2	88/12/20
   *	Clean up warnings from gcc(1)
   *

--- 6,17 -----
   *
   * Modification History:
   *
+  * Release 1.1.1.4	89/02/16
+  *	Change signal handling to something less bogus
+  *
+  * Release 1.1.1.3	89/02/16
+  *	Roger Florkowski's changes
+  *
   * Release 1.1.1.2	88/12/20
   *	Clean up warnings from gcc(1)
   *
***************
*** 18,24
   */
  
  #ifndef	lint
! static char *SCCS = "@(#)shcc.c	1.1.1.2	89/02/16";
  #endif
  
  #include "shcc.h"

--- 24,30 -----
   */
  
  #ifndef	lint
! static char *SCCS = "@(#)shcc.c	1.1.1.4	89/02/17";
  #endif
  
  #include "shcc.h"
***************
*** 390,396
  
  	CleanUp();
  
! 	exit( (signum == SIGINT) ? INTEXIT : TERMEXIT );
  
  	/*NOTREACHED*/
  }

--- 396,402 -----
  
  	CleanUp();
  
! 	exit( 100 + signum );
  
  	/*NOTREACHED*/
  }
*** OLD/shcc.h	Fri Feb 17 00:02:53 1989
--- shcc.h	Fri Feb 17 00:13:32 1989
***************
*** 3,8
   *
   * Modification History:
   *
   * Release 1.1.1.1	88/11/07
   *	Change warning associated with -p and shared libs, add warnings
   *	for -n and -N with shared libs

--- 3,11 -----
   *
   * Modification History:
   *
+  * Release 1.1.1.2	89/02/16
+  *	Change signal handling to something less bogus
+  *
   * Release 1.1.1.1	88/11/07
   *	Change warning associated with -p and shared libs, add warnings
   *	for -n and -N with shared libs
***************
*** 34,42
  
  #define	SOFTWARE	0
  #define	DEFAULTCPU	68010
- 
- #define	INTEXIT		228
- #define	TERMEXIT	100
  
  #define	warn	(void) printf
  

--- 37,42 -----
  
  #define	SOFTWARE	0
  #define	DEFAULTCPU	68010
  
  #define	warn	(void) printf
  
*** OLD/shcc.man	Thu Feb 16 23:11:33 1989
--- shcc.man	Fri Feb 17 00:15:34 1989
***************
*** 1,5
  ."
! ." shcc.man	88/11/07
  ."
  .if \*(Nu .ds Nu "SHCC
  .if \*(Nm .ds Nm "Shcc

--- 1,5 -----
  ."
! ." shcc.man	89/02/16
  ."
  .if \*(Nu .ds Nu "SHCC
  .if \*(Nm .ds Nm "Shcc
***************
*** 155,161
  .B \-h
  is used to save the ifile:
  .in +1i
! .B "$ cc \-h my.ifile \-o foobar foo.c bar.c"
  .in -1i
  Subsequent times, this may be used to \*(Lqquickly\*(Rq create foobar:
  .in +1i

--- 155,161 -----
  .B \-h
  is used to save the ifile:
  .in +1i
! .B "$ \*(Nl \-h my.ifile \-o foobar foo.c bar.c"
  .in -1i
  Subsequent times, this may be used to \*(Lqquickly\*(Rq create foobar:
  .in +1i
***************
*** 159,165
  .in -1i
  Subsequent times, this may be used to \*(Lqquickly\*(Rq create foobar:
  .in +1i
! .B "$ cc \-q \-h my.ifile \-o foobar foo.c bar.c"
  .SH FILES
  .nf
  file.c                       input file

--- 159,165 -----
  .in -1i
  Subsequent times, this may be used to \*(Lqquickly\*(Rq create foobar:
  .in +1i
! .B "$ \*(Nl \-q \-h my.ifile \-o foobar foo.c bar.c"
  .SH FILES
  .nf
  file.c                       input file
***************
*** 217,227
  .SH AUTHOR
  John R. MacMillan, currently hanging out at
  .sp
! \&...!watmath!mystic!john
! .br
! or
! .br
! john%mystic@math.waterloo.edu
  .sp
  until 1989, when I won't be.  If I had to guess for after that, I'd say:
  .br

--- 217,223 -----
  .SH AUTHOR
  John R. MacMillan, currently hanging out at
  .sp
! john@chance.UUCP
  .sp
  if your mailer reads the maps, or
  .sp
***************
*** 223,228
  .br
  john%mystic@math.waterloo.edu
  .sp
! until 1989, when I won't be.  If I had to guess for after that, I'd say:
! .br
! {utcsri,utzoo}!hcr!chance!john

--- 219,226 -----
  .sp
  john@chance.UUCP
  .sp
! if your mailer reads the maps, or
! .sp
! \&...!{utcsri,utzoo}!hcr!chance!john
! .sp
! if not.

-- 
John R. MacMillan		Wasn't me she was foolin' 'cause she knew
HCR Corporation			what she was doin' when she told me how to
{utzoo,utcsri}!hcr!john		awk this way  --  Ahosmith