xref: /titanic_41/usr/src/lib/libshell/common/include/regress.h (revision dfbb3a42fe4d6d7c50b9f750f514f8c7b66e4ed9)
1 /***********************************************************************
2 *                                                                      *
3 *               This software is part of the ast package               *
4 *          Copyright (c) 1982-2010 AT&T Intellectual Property          *
5 *                      and is licensed under the                       *
6 *                  Common Public License, Version 1.0                  *
7 *                    by AT&T Intellectual Property                     *
8 *                                                                      *
9 *                A copy of the License is available at                 *
10 *            http://www.opensource.org/licenses/cpl1.0.txt             *
11 *         (with md5 checksum 059e8cd6165cb4c31e351f2b69388fd9)         *
12 *                                                                      *
13 *              Information and Software Systems Research               *
14 *                            AT&T Research                             *
15 *                           Florham Park NJ                            *
16 *                                                                      *
17 *                  David Korn <dgk@research.att.com>                   *
18 *                                                                      *
19 ***********************************************************************/
20 #pragma prototyped
21 /*
22  * David Korn
23  * AT&T Labs
24  *
25  * Shell interface private definitions
26  *
27  */
28 
29 #ifndef _REGRESS_H
30 #define _REGRESS_H		1
31 
32 #if SHOPT_REGRESS
33 
34 typedef struct Regress_s
35 {
36 	Shopt_t	options;
37 } Regress_t;
38 
39 #define sh_isregress(r)		is_option(&sh.regress->options,r)
40 #define sh_onregress(r)		on_option(&sh.regress->options,r)
41 #define sh_offregress(r)	off_option(&sh.regress->options,r)
42 
43 #define REGRESS(r,i,f)		do { if (sh_isregress(REGRESS_##r)) sh_regress(REGRESS_##r, i, sfprints f, __LINE__, __FILE__); } while (0)
44 
45 #define REGRESS_egid		1
46 #define REGRESS_euid		2
47 #define REGRESS_p_suid		3
48 #define REGRESS_source		4
49 #define REGRESS_etc		5
50 
51 #undef	SHOPT_P_SUID
52 #define SHOPT_P_SUID		sh_regress_p_suid(__LINE__, __FILE__)
53 
54 extern int			b___regress__(int, char**, void*);
55 extern void			sh_regress_init(Shell_t*);
56 extern void			sh_regress(unsigned int, const char*, const char*, unsigned int, const char*);
57 extern uid_t			sh_regress_p_suid(unsigned int, const char*);
58 extern char*			sh_regress_etc(const char*, unsigned int, const char*);
59 
60 #else
61 
62 #define REGRESS(r,i,f)
63 
64 #endif /* SHOPT_REGRESS */
65 
66 #endif /* _REGRESS_H */
67