xref: /titanic_44/usr/src/lib/krb5/ss/ss_internal.h (revision 4e5fbfeda6c7dee3dd62538723087263e6de8e18)
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 typedef void * pointer;
19 
20 #include <ss/ss.h>
21 
22 #if defined(__GNUC__)
23 #define LOCAL_ALLOC(x) __builtin_alloca(x)
24 #define LOCAL_FREE(x)
25 #else
26 #if defined(vax)
27 #define LOCAL_ALLOC(x) alloca(x)
28 #define LOCAL_FREE(x)
29 extern pointer alloca (unsigned);
30 #else
31 #if defined(__HIGHC__)	/* Barf! */
32 pragma on(alloca);
33 #define LOCAL_ALLOC(x) alloca(x)
34 #define LOCAL_FREE(x)
35 extern pointer alloca (unsigned);
36 #else
37 /* no alloca? */
38 #define LOCAL_ALLOC(x) malloc(x)
39 #define LOCAL_FREE(x) free(x)
40 #endif
41 #endif
42 #endif				/* LOCAL_ALLOC stuff */
43 
44 typedef char BOOL;
45 
46 typedef struct _ss_abbrev_entry {
47     char *name;			/* abbrev name */
48     char **abbrev;		/* new tokens to insert */
49     unsigned int beginning_of_line : 1;
50 } ss_abbrev_entry;
51 
52 typedef struct _ss_abbrev_list {
53     int n_abbrevs;
54     ss_abbrev_entry *first_abbrev;
55 } ss_abbrev_list;
56 
57 typedef struct {
58 /*    char *path; */
59     ss_abbrev_list abbrevs[127];
60 } ss_abbrev_info;
61 
62 typedef struct _ss_data {	/* init values */
63     /* this subsystem */
64     char *subsystem_name;
65     char *subsystem_version;
66     /* current request info */
67     int argc;
68     char **argv;		/* arg list */
69     char const *current_request; /* primary name */
70     /* info directory for 'help' */
71     char **info_dirs;
72     /* to be extracted by subroutines */
73     pointer info_ptr;		/* (void *) NULL */
74     /* for ss_listen processing */
75     char *prompt;
76     ss_request_table **rqt_tables;
77     ss_abbrev_info *abbrev_info;
78     struct {
79 	unsigned int  escape_disabled : 1,
80 		      abbrevs_disabled : 1;
81     } flags;
82     /* to get out */
83     int abort;			/* exit subsystem */
84     int exit_status;
85 } ss_data;
86 
87 #define CURRENT_SS_VERSION 1
88 
89 #define	ss_info(sci_idx)	(_ss_table[sci_idx])
90 #define	ss_current_request(sci_idx,code_ptr)	\
91      (*code_ptr=0,ss_info(sci_idx)->current_request)
92 void ss_unknown_function();
93 void ss_delete_info_dir();
94 char **ss_parse (int, char *, int *);
95 ss_abbrev_info *ss_abbrev_initialize (char *, int *);
96 void ss_page_stdin (void);
97 int ss_pager_create (void);
98 void ss_self_identify __SS_PROTO;
99 void ss_subsystem_name __SS_PROTO;
100 void ss_subsystem_version __SS_PROTO;
101 void ss_unimplemented __SS_PROTO;
102 
103 extern ss_data **_ss_table;
104 extern char *ss_et_msgs[];
105 
106 #ifndef HAVE_STDLIB_H
107 extern pointer malloc (unsigned);
108 extern pointer realloc (pointer, unsigned);
109 extern pointer calloc (unsigned, unsigned);
110 #endif
111 
112 #if defined(USE_SIGPROCMASK) && !defined(POSIX_SIGNALS)
113 /* fake sigmask, sigblock, sigsetmask */
114 #include <signal.h>
115 #ifdef sigmask
116 #undef sigmask
117 #endif
118 #define sigmask(x) (1L<<(x)-1)
119 #define sigsetmask(x) sigprocmask(SIG_SETMASK,&x,NULL)
120 static int _fake_sigstore;
121 #define sigblock(x) (_fake_sigstore=x,sigprocmask(SIG_BLOCK,&_fake_sigstore,0))
122 #endif
123 #endif /* _ss_internal_h */
124