diff options
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 c851287..d6ae730 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') { |