xref: /titanic_51/usr/src/lib/libshell/common/include/regress.h (revision 3e14f97f673e8a630f076077de35afdd43dc1587)
134f9b3eeSRoland Mainz /***********************************************************************
234f9b3eeSRoland Mainz *                                                                      *
334f9b3eeSRoland Mainz *               This software is part of the ast package               *
4*3e14f97fSRoger A. Faulkner *          Copyright (c) 1982-2010 AT&T Intellectual Property          *
534f9b3eeSRoland Mainz *                      and is licensed under the                       *
634f9b3eeSRoland Mainz *                  Common Public License, Version 1.0                  *
734f9b3eeSRoland Mainz *                    by AT&T Intellectual Property                     *
834f9b3eeSRoland Mainz *                                                                      *
934f9b3eeSRoland Mainz *                A copy of the License is available at                 *
1034f9b3eeSRoland Mainz *            http://www.opensource.org/licenses/cpl1.0.txt             *
1134f9b3eeSRoland Mainz *         (with md5 checksum 059e8cd6165cb4c31e351f2b69388fd9)         *
1234f9b3eeSRoland Mainz *                                                                      *
1334f9b3eeSRoland Mainz *              Information and Software Systems Research               *
1434f9b3eeSRoland Mainz *                            AT&T Research                             *
1534f9b3eeSRoland Mainz *                           Florham Park NJ                            *
1634f9b3eeSRoland Mainz *                                                                      *
1734f9b3eeSRoland Mainz *                  David Korn <dgk@research.att.com>                   *
1834f9b3eeSRoland Mainz *                                                                      *
1934f9b3eeSRoland Mainz ***********************************************************************/
2034f9b3eeSRoland Mainz #pragma prototyped
2134f9b3eeSRoland Mainz /*
2234f9b3eeSRoland Mainz  * David Korn
2334f9b3eeSRoland Mainz  * AT&T Labs
2434f9b3eeSRoland Mainz  *
2534f9b3eeSRoland Mainz  * Shell interface private definitions
2634f9b3eeSRoland Mainz  *
2734f9b3eeSRoland Mainz  */
2834f9b3eeSRoland Mainz 
2934f9b3eeSRoland Mainz #ifndef _REGRESS_H
3034f9b3eeSRoland Mainz #define _REGRESS_H		1
3134f9b3eeSRoland Mainz 
3234f9b3eeSRoland Mainz #if SHOPT_REGRESS
3334f9b3eeSRoland Mainz 
3434f9b3eeSRoland Mainz typedef struct Regress_s
3534f9b3eeSRoland Mainz {
3634f9b3eeSRoland Mainz 	Shopt_t	options;
3734f9b3eeSRoland Mainz } Regress_t;
3834f9b3eeSRoland Mainz 
3934f9b3eeSRoland Mainz #define sh_isregress(r)		is_option(&sh.regress->options,r)
4034f9b3eeSRoland Mainz #define sh_onregress(r)		on_option(&sh.regress->options,r)
4134f9b3eeSRoland Mainz #define sh_offregress(r)	off_option(&sh.regress->options,r)
4234f9b3eeSRoland Mainz 
4334f9b3eeSRoland Mainz #define REGRESS(r,i,f)		do { if (sh_isregress(REGRESS_##r)) sh_regress(REGRESS_##r, i, sfprints f, __LINE__, __FILE__); } while (0)
4434f9b3eeSRoland Mainz 
4534f9b3eeSRoland Mainz #define REGRESS_egid		1
4634f9b3eeSRoland Mainz #define REGRESS_euid		2
4734f9b3eeSRoland Mainz #define REGRESS_p_suid		3
4834f9b3eeSRoland Mainz #define REGRESS_source		4
4934f9b3eeSRoland Mainz #define REGRESS_etc		5
5034f9b3eeSRoland Mainz 
5134f9b3eeSRoland Mainz #undef	SHOPT_P_SUID
5234f9b3eeSRoland Mainz #define SHOPT_P_SUID		sh_regress_p_suid(__LINE__, __FILE__)
5334f9b3eeSRoland Mainz 
5434f9b3eeSRoland Mainz extern int			b___regress__(int, char**, void*);
5534f9b3eeSRoland Mainz extern void			sh_regress_init(Shell_t*);
5634f9b3eeSRoland Mainz extern void			sh_regress(unsigned int, const char*, const char*, unsigned int, const char*);
5734f9b3eeSRoland Mainz extern uid_t			sh_regress_p_suid(unsigned int, const char*);
5834f9b3eeSRoland Mainz extern char*			sh_regress_etc(const char*, unsigned int, const char*);
5934f9b3eeSRoland Mainz 
6034f9b3eeSRoland Mainz #else
6134f9b3eeSRoland Mainz 
6234f9b3eeSRoland Mainz #define REGRESS(r,i,f)
6334f9b3eeSRoland Mainz 
6434f9b3eeSRoland Mainz #endif /* SHOPT_REGRESS */
6534f9b3eeSRoland Mainz 
6634f9b3eeSRoland Mainz #endif /* _REGRESS_H */
67