1 /*
2  * sqsh_alias.h - Routines for manipulating command aliases
3  *
4  * Copyright (C) 1995, 1996 by Scott C. Gray
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program. If not, write to the Free Software
18  * Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
19  *
20  * You may contact the author :
21  *   e-mail:  gray@voicenet.com
22  *            grays@xtend-tech.com
23  *            gray@xenotropic.com
24  */
25 #ifndef sqsh_alias_h_included
26 #define sqsh_alias_h_included
27 #include "sqsh_varbuf.h"
28 #include "sqsh_avl.h"
29 
30 /*
31  * The following structure defines an alias to a command in sqsh. In
32  * reality, an alias is not directly tied to a command. It simply
33  * describes a method for replacing the first word in a line of text
34  * with another word.
35  */
36 typedef struct aliasnode_st {
37 	char   *an_name ;        /* Name of the alias */
38 	char   *an_body ;        /* The body of the alias to be expanded */
39 } aliasnode_t ;
40 
41 typedef struct alias_st {
42 	avl_t  *alias_entries ;  /* AVL Tree of alias_t's */
43 } alias_t ;
44 
45 /*-- Prototypes --*/
46 alias_t* alias_create    _ANSI_ARGS(( void )) ;
47 int      alias_add       _ANSI_ARGS(( alias_t*, char*, char* )) ;
48 int      alias_remove    _ANSI_ARGS(( alias_t*, char* )) ;
49 int      alias_expand    _ANSI_ARGS(( alias_t*, char*, varbuf_t* )) ;
50 int      alias_test      _ANSI_ARGS(( alias_t*, char* )) ;
51 int      alias_destroy   _ANSI_ARGS(( alias_t* )) ;
52 
53 #endif /* sqsh_alias_h_included */
54