rc-list - mailing list for the rc(1) shell
 help / color / mirror / Atom feed
* Adding -s to rc
@ 1992-06-16 13:33 rsalz
  0 siblings, 0 replies; only message in thread
From: rsalz @ 1992-06-16 13:33 UTC (permalink / raw)
  To: rc; +Cc: boyd

The following patch adds -s to rc1.4.
Thanks to John Mackin for pointing me to Boyd who made the change in 1.2
*** main.c.orig	Mon Jun 15 14:50:20 1992
--- main.c	Tue Jun 16 09:32:32 1992
***************
*** 3,9 ****
  #include "rc.h"
  
  bool dashdee, dashee, dashvee, dashex, dashell, dasheye,
! 	dashen, dashpee, interactive;
  int rc_pid;
  
  static bool dashoh;
--- 3,9 ----
  #include "rc.h"
  
  bool dashdee, dashee, dashvee, dashex, dashell, dasheye,
! 	dashen, dashess, dashpee, interactive;
  int rc_pid;
  
  static bool dashoh;
***************
*** 19,25 ****
  	dollarzero = argv[0];
  	rc_pid = getpid();
  	dashell = (*argv[0] == '-'); /* Unix tradition */
! 	while ((c = rc_getopt(argc, argv, "nolpeivdxc:")) != -1)
  		switch (c) {
  		case 'l':
  			dashell = TRUE;
--- 19,25 ----
  	dollarzero = argv[0];
  	rc_pid = getpid();
  	dashell = (*argv[0] == '-'); /* Unix tradition */
! 	while ((c = rc_getopt(argc, argv, "nolpeivdxsc:")) != -1)
  		switch (c) {
  		case 'l':
  			dashell = TRUE;
***************
*** 39,44 ****
--- 39,48 ----
  		case 'd':
  			dashdee = TRUE;
  			break;
+ 		case 's':
+ 			/* backwards compatibility with sh(1) and csh(1) */
+ 			dashess = dasheye = interactive = TRUE;
+ 			break;
  		case 'c':
  			dashsee[0] = rc_optarg;
  			goto quitopts;
***************
*** 78,87 ****
  	null[0] = NULL;
  	starassign(dollarzero, null, FALSE); /* assign $0 to $* */
  	inithandler();
! 	if (dashsee[0] != NULL) {	/* input from the -c flag? */
  		if (*argv != NULL)
  			starassign(dollarzero, argv, FALSE);
! 		pushstring(dashsee, TRUE);
  	} else if (*argv != NULL) {	/* else from a file? */
  		b_dot(--argv);
  		rc_exit(getstatus());
--- 82,94 ----
  	null[0] = NULL;
  	starassign(dollarzero, null, FALSE); /* assign $0 to $* */
  	inithandler();
! 	if (dashsee[0] != NULL || dashess) {	/* input from -c or -s? */
  		if (*argv != NULL)
  			starassign(dollarzero, argv, FALSE);
! 		if (dashess)
! 			pushfd(0);
! 		else
! 			pushstring(dashsee, TRUE);
  	} else if (*argv != NULL) {	/* else from a file? */
  		b_dot(--argv);
  		rc_exit(getstatus());


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~1992-06-16 13:34 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1992-06-16 13:33 Adding -s to rc rsalz

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).