diff options
author | Peter Wemm <peter@FreeBSD.org> | 1996-09-01 10:22:36 +0000 |
---|---|---|
committer | Peter Wemm <peter@FreeBSD.org> | 1996-09-01 10:22:36 +0000 |
commit | aa9caaf65748ace0f3cd08c2deaf3ef3048d6e4d (patch) | |
tree | e47ab3981b495c675a987dd1e943d1f4c823f314 /bin/sh/alias.c | |
parent | eaed89032e2fd68793cbfe677ce15e06b46b11dd (diff) | |
download | src-aa9caaf65748ace0f3cd08c2deaf3ef3048d6e4d.tar.gz src-aa9caaf65748ace0f3cd08c2deaf3ef3048d6e4d.zip |
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
Notes
Notes:
svn path=/head/; revision=17987
Diffstat (limited to 'bin/sh/alias.c')
-rw-r--r-- | bin/sh/alias.c | 25 |
1 files changed, 17 insertions, 8 deletions
diff --git a/bin/sh/alias.c b/bin/sh/alias.c index c851287a4643..d6ae73021a79 100644 --- a/bin/sh/alias.c +++ b/bin/sh/alias.c @@ -33,13 +33,14 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: alias.c,v 1.2 1994/09/24 02:57:20 davidg Exp $ + * $Id: alias.c,v 1.3 1995/05/30 00:07:10 rgrimes Exp $ */ #ifndef lint -static char sccsid[] = "@(#)alias.c 8.1 (Berkeley) 5/31/93"; +static char sccsid[] = "@(#)alias.c 8.3 (Berkeley) 5/4/95"; #endif /* not lint */ +#include <stdlib.h> #include "shell.h" #include "input.h" #include "output.h" @@ -53,12 +54,15 @@ static char sccsid[] = "@(#)alias.c 8.1 (Berkeley) 5/31/93"; struct alias *atab[ATABSIZE]; +STATIC void setalias __P((char *, char *)); +STATIC int unalias __P((char *)); STATIC struct alias **hashalias __P((char *)); STATIC +void setalias(name, val) char *name, *val; - { +{ struct alias *ap, **app; app = hashalias(name); @@ -98,7 +102,7 @@ setalias(name, val) { int len = strlen(val); ap->val = ckmalloc(len + 2); - bcopy(val, ap->val, len); + memcpy(ap->val, val, len); ap->val[len] = ' '; /* fluff */ ap->val[len+1] = '\0'; } @@ -173,7 +177,8 @@ rmaliases() { struct alias * lookupalias(name, check) char *name; - { + int check; +{ struct alias *ap = *hashalias(name); for (; ap; ap = ap->next) { @@ -190,9 +195,11 @@ lookupalias(name, check) /* * TODO - sort output */ +int aliascmd(argc, argv) + int argc; char **argv; - { +{ char *n, *v; int ret = 0; struct alias *ap; @@ -207,7 +214,7 @@ aliascmd(argc, argv) } return (0); } - while (n = *++argv) { + while ((n = *++argv) != NULL) { if ((v = strchr(n+1, '=')) == NULL) /* n+1: funny ksh stuff */ if ((ap = lookupalias(n, 0)) == NULL) { outfmt(out2, "alias: %s not found\n", n); @@ -223,9 +230,11 @@ aliascmd(argc, argv) return (ret); } +int unaliascmd(argc, argv) + int argc; char **argv; - { +{ int i; while ((i = nextopt("a")) != '\0') { |