diff options
author | peter <peter@FreeBSD.org> | 1996-09-01 10:22:36 +0000 |
---|---|---|
committer | peter <peter@FreeBSD.org> | 1996-09-01 10:22:36 +0000 |
commit | 5195be912eb257c05a0c97e561e72f01af2583ff (patch) | |
tree | e47ab3981b495c675a987dd1e943d1f4c823f314 /bin/sh/options.c | |
parent | 2fc7d7d1fa299368ccdddede67b31695266698bd (diff) | |
download | FreeBSD-src-5195be912eb257c05a0c97e561e72f01af2583ff.zip FreeBSD-src-5195be912eb257c05a0c97e561e72f01af2583ff.tar.gz |
Merge of 4.4-Lite2 sh source, plus some gcc -Wall cleaning. This is a
merge of parallel duplicate work by Steve Price and myself. :-]
There are some changes to the build that are my fault... mkinit.c was
trying (poorly) to duplicate some of the work that make(1) is designed to
do. The Makefile hackery is my fault too, the depend list was incomplete
because of some explicit OBJS+= entries, so mkdep wasn't picking up their
source file #includes.
This closes a pile of /bin/sh PR's, but not all of them..
Submitted by: Steve Price <steve@bonsai.hiwaay.net>, peter
Diffstat (limited to 'bin/sh/options.c')
-rw-r--r-- | bin/sh/options.c | 59 |
1 files changed, 39 insertions, 20 deletions
diff --git a/bin/sh/options.c b/bin/sh/options.c index 5613302..095c7a9 100644 --- a/bin/sh/options.c +++ b/bin/sh/options.c @@ -33,13 +33,17 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: options.c,v 1.5 1995/10/01 15:11:42 joerg Exp $ + * $Id: options.c,v 1.6 1995/10/09 17:56:32 joerg Exp $ */ #ifndef lint -static char sccsid[] = "@(#)options.c 8.1 (Berkeley) 5/31/93"; +static char sccsid[] = "@(#)options.c 8.2 (Berkeley) 5/4/95"; #endif /* not lint */ +#include <signal.h> +#include <unistd.h> +#include <stdlib.h> + #include "shell.h" #define DEFINE_OPTIONS #include "options.h" @@ -54,6 +58,9 @@ static char sccsid[] = "@(#)options.c 8.1 (Berkeley) 5/31/93"; #include "memalloc.h" #include "error.h" #include "mystring.h" +#ifndef NO_HISTORY +#include "myhistedit.h" +#endif char *arg0; /* value of $0 */ struct shparam shellparam; /* current positional parameters */ @@ -64,16 +71,9 @@ char *optptr; /* used by nextopt */ char *minusc; /* argument to -c option */ -#ifdef __STDC__ -STATIC void options(int); -STATIC void setoption(int, int); -STATIC void minus_o(char *, int); -#else -STATIC void options(); -STATIC void setoption(); -STATIC void minus_o(); -#endif - +STATIC void options __P((int)); +STATIC void minus_o __P((char *, int)); +STATIC void setoption __P((int, int)); /* @@ -82,8 +82,9 @@ STATIC void minus_o(); void procargs(argc, argv) + int argc; char **argv; - { +{ int i; argptr = argv; @@ -119,9 +120,13 @@ procargs(argc, argv) } -optschanged() { +void +optschanged() +{ setinteractive(iflag); +#ifndef NO_HISTORY histedit(); +#endif setjobctl(mflag); } @@ -131,7 +136,9 @@ optschanged() { */ STATIC void -options(cmdline) { +options(cmdline) + int cmdline; +{ register char *p; int val; int c; @@ -142,14 +149,14 @@ options(cmdline) { argptr++; if ((c = *p++) == '-') { val = 1; - if (p[0] == '\0' || p[0] == '-' && p[1] == '\0') { + if (p[0] == '\0' || (p[0] == '-' && p[1] == '\0')) { if (!cmdline) { /* "-" means turn off -x and -v */ if (p[0] == '\0') xflag = vflag = 0; /* "--" means reset params */ else if (*argptr == NULL) - setparam(argptr); + setparam(argptr); } break; /* "-" or "--" terminates options */ } @@ -293,7 +300,11 @@ freeparam(param) * The shift builtin command. */ -shiftcmd(argc, argv) char **argv; { +int +shiftcmd(argc, argv) + int argc; + char **argv; +{ int n; char **ap1, **ap2; @@ -321,7 +332,11 @@ shiftcmd(argc, argv) char **argv; { * The set command builtin. */ -setcmd(argc, argv) char **argv; { +int +setcmd(argc, argv) + int argc; + char **argv; +{ if (argc == 1) return showvarscmd(argc, argv); INTOFF; @@ -342,7 +357,11 @@ setcmd(argc, argv) char **argv; { * then it's the first time getopts has been called. */ -getoptscmd(argc, argv) char **argv; { +int +getoptscmd(argc, argv) + int argc; + char **argv; +{ register char *p, *q; char c; char s[10]; |