alias.c (193221) | alias.c (200956) |
---|---|
1/*- 2 * Copyright (c) 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * This code is derived from software contributed to Berkeley by 6 * Kenneth Almquist. 7 * 8 * Redistribution and use in source and binary forms, with or without --- 22 unchanged lines hidden (view full) --- 31 */ 32 33#ifndef lint 34#if 0 35static char sccsid[] = "@(#)alias.c 8.3 (Berkeley) 5/4/95"; 36#endif 37#endif /* not lint */ 38#include <sys/cdefs.h> | 1/*- 2 * Copyright (c) 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * This code is derived from software contributed to Berkeley by 6 * Kenneth Almquist. 7 * 8 * Redistribution and use in source and binary forms, with or without --- 22 unchanged lines hidden (view full) --- 31 */ 32 33#ifndef lint 34#if 0 35static char sccsid[] = "@(#)alias.c 8.3 (Berkeley) 5/4/95"; 36#endif 37#endif /* not lint */ 38#include <sys/cdefs.h> |
39__FBSDID("$FreeBSD: head/bin/sh/alias.c 193221 2009-06-01 10:50:17Z rse $"); | 39__FBSDID("$FreeBSD: head/bin/sh/alias.c 200956 2009-12-24 18:41:14Z jilles $"); |
40 41#include <stdlib.h> 42#include "shell.h" 43#include "output.h" 44#include "error.h" 45#include "memalloc.h" 46#include "mystring.h" 47#include "alias.h" 48#include "options.h" /* XXX for argptr (should remove?) */ 49 50#define ATABSIZE 39 51 52STATIC struct alias *atab[ATABSIZE]; 53STATIC int aliases; 54 | 40 41#include <stdlib.h> 42#include "shell.h" 43#include "output.h" 44#include "error.h" 45#include "memalloc.h" 46#include "mystring.h" 47#include "alias.h" 48#include "options.h" /* XXX for argptr (should remove?) */ 49 50#define ATABSIZE 39 51 52STATIC struct alias *atab[ATABSIZE]; 53STATIC int aliases; 54 |
55STATIC void setalias(char *, char *); | 55STATIC void setalias(const char *, const char *); |
56STATIC int unalias(const char *); 57STATIC struct alias **hashalias(const char *); 58 59STATIC 60void | 56STATIC int unalias(const char *); 57STATIC struct alias **hashalias(const char *); 58 59STATIC 60void |
61setalias(char *name, char *val) | 61setalias(const char *name, const char *val) |
62{ 63 struct alias *ap, **app; 64 65 app = hashalias(name); 66 for (ap = *app; ap; ap = ap->next) { 67 if (equal(name, ap->name)) { 68 INTOFF; 69 ckfree(ap->val); --- 101 unchanged lines hidden (view full) --- 171 ckfree(tmp); 172 } 173 } 174 aliases = 0; 175 INTON; 176} 177 178struct alias * | 62{ 63 struct alias *ap, **app; 64 65 app = hashalias(name); 66 for (ap = *app; ap; ap = ap->next) { 67 if (equal(name, ap->name)) { 68 INTOFF; 69 ckfree(ap->val); --- 101 unchanged lines hidden (view full) --- 171 ckfree(tmp); 172 } 173 } 174 aliases = 0; 175 INTON; 176} 177 178struct alias * |
179lookupalias(char *name, int check) | 179lookupalias(const char *name, int check) |
180{ 181 struct alias *ap = *hashalias(name); 182 183 for (; ap; ap = ap->next) { 184 if (equal(name, ap->name)) { 185 if (check && (ap->flag & ALIASINUSE)) 186 return (NULL); 187 return (ap); --- 101 unchanged lines hidden --- | 180{ 181 struct alias *ap = *hashalias(name); 182 183 for (; ap; ap = ap->next) { 184 if (equal(name, ap->name)) { 185 if (check && (ap->flag & ALIASINUSE)) 186 return (NULL); 187 return (ap); --- 101 unchanged lines hidden --- |