[comp.windows.x] xgen Patch Enables execve

jans@tekgvs.LABS.TEK.COM (Jan Steinman) (07/12/89)

xgen, the X Windows application generator recently posted to comp.sources.x, is 
a neat idea, in spite of the problems of its youth.  I'd like to see some neat 
xgen scripts and patches posted!

This patch allows xgen scripts to be read from stdin.  This allows you to have 
stand-alone applications by having as the first line in an xgen script:

	#!/usr/bin/xgen

(or where ever the xgen binary is hiding.)  If the xgen script is then made 
executable, simply typing the script name to the shell will invoke the script, 
just as if it were a shell script.  Following is a context diff, which should 
work with Larry Wall's "patch" program:

*** parse_applica.c.orig	Tue Jul 11 16:31:30 1989
--- parse_applica.c	Tue Jul 11 16:33:10 1989
***************
*** 19,30
  	struct shell *app_shell;
  	struct shell *parse_shell();
  
! 
! 	/* open file input in command line*/
! 	if (NULL == (fp1 = fopen( file, "r")))
! 	{
! 		fprintf(stderr, "Error: Can't find input file %s\n", file) ;
! 		exit(-1) ;
  	}
  
  	for(;;)

--- 19,30 -----
  	struct shell *app_shell;
  	struct shell *parse_shell();
  
! /* 890711-jans@tekgvs.LABS.TEK.COM: if no file is specified, use stdin. */
! 	if (strcmp(file, "")) fp1 = fopen (file, "r");
! 	    else fp1 = stdin;
! 	if (fp1 == NULL ) {
! 	  fprintf(stderr, "Error: Can't find input file %s\n", file) ;
! 	  exit (2); /* ENOENT */
  	}
  
  	for(;;)

							   Jan Steinman - N7JDB
						  Electronic Systems Laboratory
					Box 500, MS 50-370, Beaverton, OR 97077
						(w)503/627-5881 (h)503/657-7703