xref: /onnv-gate/usr/src/lib/krb5/ss/ss_internal.h (revision 0:68f95e015346)
1*0Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"
2*0Sstevel@tonic-gate 
3*0Sstevel@tonic-gate /*
4*0Sstevel@tonic-gate  * Copyright 1987, 1988 by MIT Student Information Processing Board
5*0Sstevel@tonic-gate  *
6*0Sstevel@tonic-gate  * For copyright information, see copyright.h.
7*0Sstevel@tonic-gate  */
8*0Sstevel@tonic-gate 
9*0Sstevel@tonic-gate #ifndef _ss_ss_internal_h
10*0Sstevel@tonic-gate #define _ss_ss_internal_h __FILE__
11*0Sstevel@tonic-gate #include <stdio.h>
12*0Sstevel@tonic-gate #include <string.h>
13*0Sstevel@tonic-gate #include <unistd.h>
14*0Sstevel@tonic-gate #ifdef HAVE_STDLIB_H
15*0Sstevel@tonic-gate #include <stdlib.h>
16*0Sstevel@tonic-gate #endif
17*0Sstevel@tonic-gate 
18*0Sstevel@tonic-gate #ifdef __STDC__
19*0Sstevel@tonic-gate 
20*0Sstevel@tonic-gate #define PROTOTYPE(p) p
21*0Sstevel@tonic-gate typedef void * pointer;
22*0Sstevel@tonic-gate 
23*0Sstevel@tonic-gate #else
24*0Sstevel@tonic-gate 
25*0Sstevel@tonic-gate #define const
26*0Sstevel@tonic-gate #define volatile
27*0Sstevel@tonic-gate #define PROTOTYPE(p) ()
28*0Sstevel@tonic-gate typedef char * pointer;
29*0Sstevel@tonic-gate 
30*0Sstevel@tonic-gate #endif /* not __STDC__ */
31*0Sstevel@tonic-gate 
32*0Sstevel@tonic-gate #include <ss/ss.h>
33*0Sstevel@tonic-gate 
34*0Sstevel@tonic-gate #if defined(__GNUC__)
35*0Sstevel@tonic-gate #define LOCAL_ALLOC(x) __builtin_alloca(x)
36*0Sstevel@tonic-gate #define LOCAL_FREE(x)
37*0Sstevel@tonic-gate #else
38*0Sstevel@tonic-gate #if defined(vax)
39*0Sstevel@tonic-gate #define LOCAL_ALLOC(x) alloca(x)
40*0Sstevel@tonic-gate #define LOCAL_FREE(x)
41*0Sstevel@tonic-gate extern pointer alloca PROTOTYPE((unsigned));
42*0Sstevel@tonic-gate #else
43*0Sstevel@tonic-gate #if defined(__HIGHC__)	/* Barf! */
44*0Sstevel@tonic-gate pragma on(alloca);
45*0Sstevel@tonic-gate #define LOCAL_ALLOC(x) alloca(x)
46*0Sstevel@tonic-gate #define LOCAL_FREE(x)
47*0Sstevel@tonic-gate extern pointer alloca PROTOTYPE((unsigned));
48*0Sstevel@tonic-gate #else
49*0Sstevel@tonic-gate /* no alloca? */
50*0Sstevel@tonic-gate #define LOCAL_ALLOC(x) malloc(x)
51*0Sstevel@tonic-gate #define LOCAL_FREE(x) free(x)
52*0Sstevel@tonic-gate #endif
53*0Sstevel@tonic-gate #endif
54*0Sstevel@tonic-gate #endif				/* LOCAL_ALLOC stuff */
55*0Sstevel@tonic-gate 
56*0Sstevel@tonic-gate typedef char BOOL;
57*0Sstevel@tonic-gate 
58*0Sstevel@tonic-gate typedef struct _ss_abbrev_entry {
59*0Sstevel@tonic-gate     char *name;			/* abbrev name */
60*0Sstevel@tonic-gate     char **abbrev;		/* new tokens to insert */
61*0Sstevel@tonic-gate     unsigned int beginning_of_line : 1;
62*0Sstevel@tonic-gate } ss_abbrev_entry;
63*0Sstevel@tonic-gate 
64*0Sstevel@tonic-gate typedef struct _ss_abbrev_list {
65*0Sstevel@tonic-gate     int n_abbrevs;
66*0Sstevel@tonic-gate     ss_abbrev_entry *first_abbrev;
67*0Sstevel@tonic-gate } ss_abbrev_list;
68*0Sstevel@tonic-gate 
69*0Sstevel@tonic-gate typedef struct {
70*0Sstevel@tonic-gate /*    char *path; */
71*0Sstevel@tonic-gate     ss_abbrev_list abbrevs[127];
72*0Sstevel@tonic-gate } ss_abbrev_info;
73*0Sstevel@tonic-gate 
74*0Sstevel@tonic-gate typedef struct _ss_data {	/* init values */
75*0Sstevel@tonic-gate     /* this subsystem */
76*0Sstevel@tonic-gate     char *subsystem_name;
77*0Sstevel@tonic-gate     char *subsystem_version;
78*0Sstevel@tonic-gate     /* current request info */
79*0Sstevel@tonic-gate     int argc;
80*0Sstevel@tonic-gate     char **argv;		/* arg list */
81*0Sstevel@tonic-gate     char const *current_request; /* primary name */
82*0Sstevel@tonic-gate     /* info directory for 'help' */
83*0Sstevel@tonic-gate     char **info_dirs;
84*0Sstevel@tonic-gate     /* to be extracted by subroutines */
85*0Sstevel@tonic-gate     pointer info_ptr;		/* (void *) NULL */
86*0Sstevel@tonic-gate     /* for ss_listen processing */
87*0Sstevel@tonic-gate     char *prompt;
88*0Sstevel@tonic-gate     ss_request_table **rqt_tables;
89*0Sstevel@tonic-gate     ss_abbrev_info *abbrev_info;
90*0Sstevel@tonic-gate     struct {
91*0Sstevel@tonic-gate 	unsigned int  escape_disabled : 1,
92*0Sstevel@tonic-gate 		      abbrevs_disabled : 1;
93*0Sstevel@tonic-gate     } flags;
94*0Sstevel@tonic-gate     /* to get out */
95*0Sstevel@tonic-gate     int abort;			/* exit subsystem */
96*0Sstevel@tonic-gate     int exit_status;
97*0Sstevel@tonic-gate } ss_data;
98*0Sstevel@tonic-gate 
99*0Sstevel@tonic-gate #define CURRENT_SS_VERSION 1
100*0Sstevel@tonic-gate 
101*0Sstevel@tonic-gate #define	ss_info(sci_idx)	(_ss_table[sci_idx])
102*0Sstevel@tonic-gate #define	ss_current_request(sci_idx,code_ptr)	\
103*0Sstevel@tonic-gate      (*code_ptr=0,ss_info(sci_idx)->current_request)
104*0Sstevel@tonic-gate void ss_unknown_function();
105*0Sstevel@tonic-gate void ss_delete_info_dir();
106*0Sstevel@tonic-gate int ss_execute_line();
107*0Sstevel@tonic-gate char **ss_parse();
108*0Sstevel@tonic-gate ss_abbrev_info *ss_abbrev_initialize PROTOTYPE((char *, int *));
109*0Sstevel@tonic-gate void ss_page_stdin();
110*0Sstevel@tonic-gate 
111*0Sstevel@tonic-gate extern ss_data **_ss_table;
112*0Sstevel@tonic-gate extern char *ss_et_msgs[];
113*0Sstevel@tonic-gate 
114*0Sstevel@tonic-gate #ifndef HAVE_STDLIB_H
115*0Sstevel@tonic-gate extern pointer malloc PROTOTYPE((unsigned));
116*0Sstevel@tonic-gate extern pointer realloc PROTOTYPE((pointer, unsigned));
117*0Sstevel@tonic-gate extern pointer calloc PROTOTYPE((unsigned, unsigned));
118*0Sstevel@tonic-gate #endif
119*0Sstevel@tonic-gate 
120*0Sstevel@tonic-gate #ifdef USE_SIGPROCMASK
121*0Sstevel@tonic-gate /* fake sigmask, sigblock, sigsetmask */
122*0Sstevel@tonic-gate #include <signal.h>
123*0Sstevel@tonic-gate #define sigmask(x) (1L<<(x)-1)
124*0Sstevel@tonic-gate #define sigsetmask(x) sigprocmask(SIG_SETMASK,&x,NULL)
125*0Sstevel@tonic-gate static int _fake_sigstore;
126*0Sstevel@tonic-gate #define sigblock(x) (_fake_sigstore=x,sigprocmask(SIG_BLOCK,&_fake_sigstore,0))
127*0Sstevel@tonic-gate #endif
128*0Sstevel@tonic-gate #endif /* _ss_internal_h */
129