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