1 /* @(#)abbrev.h	1.19 15/10/23 Copyright 1985-2015 J. Schilling */
2 /*
3  *	Copyright (c) 1985-2015 J. Schilling
4  */
5 /*
6  * The contents of this file are subject to the terms of the
7  * Common Development and Distribution License, Version 1.0 only
8  * (the "License").  You may not use this file except in compliance
9  * with the License.
10  *
11  * See the file CDDL.Schily.txt in this distribution for details.
12  * A copy of the CDDL is also available via the Internet at
13  * http://www.opensource.org/licenses/cddl1.txt
14  *
15  * When distributing Covered Code, include this CDDL HEADER in each
16  * file and include the License file CDDL.Schily.txt from this distribution.
17  */
18 
19 typedef int abidx_t;
20 
21 #ifdef	BOURNE_SHELL
22 #define	FILE_p		int
23 #else
24 #define	FILE_p		FILE *
25 #endif
26 
27 
28 #define	ABTABS		2	/* .globals & .locals			   */
29 
30 #define	GLOBAL_AB	0	/* The idx for the '.globals' abbrev./aliases */
31 #define	LOCAL_AB	1	/* The idx for the '.locals' abbrev./aliases */
32 
33 /*
34  * Function flags:
35  */
36 #define	AB_NOFLAG	0	/* No flags				*/
37 #define	AB_BEGIN	1	/* A begin only abbreviation		*/
38 #define	AB_POP		2	/* POP rather than permanently delete	*/
39 #define	AB_POPALL	4	/* POP all definitions for an alias	*/
40 #define	AB_PERSIST	8	/* Dump persistent, not pushed values	*/
41 #define	AB_ALL		16	/* Dump all values			*/
42 #define	AB_HISTORY	32	/* Enter entry in command line history	*/
43 #define	AB_INTR		64	/* Loops are interruptable via ^C	*/
44 #define	AB_POSIX	128	/* Output in POSIX "name=value" format	*/
45 #define	AB_PARSE	256	/* Output "alias name=value"		*/
46 #define	AB_PGLOBAL	512	/* Add "-g" with output from AB_PARSE	*/
47 #define	AB_PLOCAL	1024	/* Add "-l" with output from AB_PARSE	*/
48 
49 extern	uid_t	ab_getaltowner	__PR((abidx_t tab));
50 extern	char	*ab_getaltoname	__PR((abidx_t tab));
51 extern	void	ab_setaltowner	__PR((abidx_t tab, char *uname));
52 extern	void	ab_read		__PR((abidx_t tab, char *fname));
53 extern	void	ab_sname	__PR((abidx_t tab, char *fname));
54 extern	char	*ab_gname	__PR((abidx_t tab));
55 extern	void	ab_use		__PR((abidx_t tab, char *fname));
56 extern	void	ab_close	__PR((abidx_t tab));
57 extern	BOOL	ab_insert	__PR((abidx_t tab, char *name, char *val,
58 								int aflags));
59 extern	BOOL	ab_push		__PR((abidx_t tab, char *name, char *val,
60 								int aflags));
61 extern	BOOL	ab_delete	__PR((abidx_t tab, char *name, int aflags));
62 extern	void	ab_deleteall	__PR((abidx_t tab, int aflags));
63 extern	char	*ab_value	__PR((abidx_t tab, char *name, void **seen,
64 								int aflags));
65 extern	void	ab_dump		__PR((abidx_t tab, FILE_p file, int aflags));
66 extern	BOOL	ab_list		__PR((abidx_t tab, char *pattern, FILE_p file,
67 								int aflags));
68