[3228] | 1 | /* alias.h -- structure definitions. */
|
---|
| 2 |
|
---|
| 3 | /* Copyright (C) 1987,1991 Free Software Foundation, Inc.
|
---|
| 4 |
|
---|
| 5 | This file is part of GNU Bash, the Bourne Again SHell.
|
---|
| 6 |
|
---|
| 7 | Bash is free software; you can redistribute it and/or modify it
|
---|
| 8 | under the terms of the GNU General Public License as published by
|
---|
| 9 | the Free Software Foundation; either version 1, or (at your option)
|
---|
| 10 | any later version.
|
---|
| 11 |
|
---|
| 12 | Bash is distributed in the hope that it will be useful, but WITHOUT
|
---|
| 13 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
---|
| 14 | or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
|
---|
| 15 | License for more details.
|
---|
| 16 |
|
---|
| 17 | You should have received a copy of the GNU General Public License
|
---|
| 18 | along with Bash; see the file COPYING. If not, write to the Free
|
---|
| 19 | Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. */
|
---|
| 20 |
|
---|
| 21 | #if !defined (_ALIAS_H_)
|
---|
| 22 | #define _ALIAS_H_
|
---|
| 23 |
|
---|
| 24 | #include "stdc.h"
|
---|
| 25 |
|
---|
| 26 | #include "hashlib.h"
|
---|
| 27 |
|
---|
| 28 | typedef struct alias {
|
---|
| 29 | char *name;
|
---|
| 30 | char *value;
|
---|
| 31 | char flags;
|
---|
| 32 | } alias_t;
|
---|
| 33 |
|
---|
| 34 | /* Values for `flags' member of struct alias. */
|
---|
| 35 | #define AL_EXPANDNEXT 0x1
|
---|
| 36 | #define AL_BEINGEXPANDED 0x2
|
---|
| 37 |
|
---|
| 38 | /* The list of known aliases. */
|
---|
| 39 | extern HASH_TABLE *aliases;
|
---|
| 40 |
|
---|
| 41 | extern void initialize_aliases __P((void));
|
---|
| 42 |
|
---|
| 43 | /* Scan the list of aliases looking for one with NAME. Return NULL
|
---|
| 44 | if the alias doesn't exist, else a pointer to the alias. */
|
---|
| 45 | extern alias_t *find_alias __P((char *));
|
---|
| 46 |
|
---|
| 47 | /* Return the value of the alias for NAME, or NULL if there is none. */
|
---|
| 48 | extern char *get_alias_value __P((char *));
|
---|
| 49 |
|
---|
| 50 | /* Make a new alias from NAME and VALUE. If NAME can be found,
|
---|
| 51 | then replace its value. */
|
---|
| 52 | extern void add_alias __P((char *, char *));
|
---|
| 53 |
|
---|
| 54 | /* Remove the alias with name NAME from the alias list. Returns
|
---|
| 55 | the index of the removed alias, or -1 if the alias didn't exist. */
|
---|
| 56 | extern int remove_alias __P((char *));
|
---|
| 57 |
|
---|
| 58 | /* Remove all aliases. */
|
---|
| 59 | extern void delete_all_aliases __P((void));
|
---|
| 60 |
|
---|
| 61 | /* Return an array of all defined aliases. */
|
---|
| 62 | extern alias_t **all_aliases __P((void));
|
---|
| 63 |
|
---|
| 64 | /* Expand a single word for aliases. */
|
---|
| 65 | extern char *alias_expand_word __P((char *));
|
---|
| 66 |
|
---|
| 67 | /* Return a new line, with any aliases expanded. */
|
---|
| 68 | extern char *alias_expand __P((char *));
|
---|
| 69 |
|
---|
| 70 | #endif /* _ALIAS_H_ */
|
---|