home *** CD-ROM | disk | FTP | other *** search
/ High Voltage Shareware / high1.zip / high1 / DIR24 / BASH_112.ZIP / BASH-112.TAR / bash-1.12 / alias.h < prev    next >
C/C++ Source or Header  |  1991-07-07  |  2KB  |  65 lines

  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, 675 Mass Ave, Cambridge, MA 02139, USA. */
  20.  
  21. #if !defined (_ALIAS_)
  22. #define _ALIAS_
  23.  
  24. extern char *xmalloc (), *malloc ();
  25.  
  26. #ifndef whitespace
  27. #define whitespace(c) (((c) == ' ') || ((c) == '\t'))
  28. #endif
  29.  
  30. #ifndef savestring
  31. #define savestring(x) (char *)strcpy (xmalloc (1 + strlen (x)), (x))
  32. #endif
  33.  
  34. typedef struct {
  35.   char *name;
  36.   char *value;
  37. } ASSOC;
  38.  
  39. #ifndef NULL
  40. #define NULL 0x0
  41. #endif
  42.  
  43. /* The list of known aliases. */
  44. extern ASSOC **aliases;
  45.  
  46. /* Scan the list of aliases looking for one with NAME.  Return NULL
  47.    if the alias doesn't exist, else a pointer to the assoc. */
  48. extern ASSOC *find_alias ();
  49.  
  50. /* Return the value of the alias for NAME, or NULL if there is none. */
  51. extern char *get_alias_value ();
  52.  
  53. /* Make a new alias from NAME and VALUE.  If NAME can be found,
  54.    then replace its value. */
  55. extern void add_alias ();
  56.  
  57. /* Remove the alias with name NAME from the alias list.  Returns
  58.    the index of the removed alias, or -1 if the alias didn't exist. */
  59. extern int remove_alias ();
  60.  
  61. /* Return a new line, with any aliases substituted. */
  62. extern char *alias_substitute ();
  63.  
  64. #endif /* _ALIAS_ */
  65.