From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from postman.osf.org ([130.105.1.152]) by hawkwind.utcs.toronto.edu with SMTP id <2702>; Tue, 16 Jun 1992 09:34:58 -0400 Received: from earth.osf.org by postman.osf.org (5.64+/OSF 1.0) id AA27208; Tue, 16 Jun 92 09:33:33 -0400 Received: by earth.osf.org (5.64/4.7) id AA21285; Tue, 16 Jun 92 09:33:32 -0400 Date: Tue, 16 Jun 1992 09:33:32 -0400 From: rsalz@osf.org Message-Id: <9206161333.AA21285@earth.osf.org> To: rc@hawkwind.utcs.toronto.edu Subject: Adding -s to rc Cc: boyd@prl.dec.com 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());