xref: /onnv-gate/usr/src/lib/krb5/ss/ss_internal.h (revision 8093:d2fc11f7c4e7)
10Sstevel@tonic-gate /*
20Sstevel@tonic-gate  * Copyright 1987, 1988 by MIT Student Information Processing Board
30Sstevel@tonic-gate  *
40Sstevel@tonic-gate  * For copyright information, see copyright.h.
50Sstevel@tonic-gate  */
60Sstevel@tonic-gate 
7*8093SMark.Phalan@Sun.COM /*
8*8093SMark.Phalan@Sun.COM  * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
9*8093SMark.Phalan@Sun.COM  * Use is subject to license terms.
10*8093SMark.Phalan@Sun.COM  */
11*8093SMark.Phalan@Sun.COM 
12*8093SMark.Phalan@Sun.COM 
130Sstevel@tonic-gate #ifndef _ss_ss_internal_h
140Sstevel@tonic-gate #define _ss_ss_internal_h __FILE__
150Sstevel@tonic-gate #include <stdio.h>
160Sstevel@tonic-gate #include <string.h>
170Sstevel@tonic-gate #include <unistd.h>
180Sstevel@tonic-gate #ifdef HAVE_STDLIB_H
190Sstevel@tonic-gate #include <stdlib.h>
200Sstevel@tonic-gate #endif
210Sstevel@tonic-gate 
220Sstevel@tonic-gate typedef void * pointer;
230Sstevel@tonic-gate 
240Sstevel@tonic-gate #include <ss/ss.h>
250Sstevel@tonic-gate 
260Sstevel@tonic-gate #if defined(__GNUC__)
270Sstevel@tonic-gate #define LOCAL_ALLOC(x) __builtin_alloca(x)
280Sstevel@tonic-gate #define LOCAL_FREE(x)
290Sstevel@tonic-gate #else
300Sstevel@tonic-gate #if defined(vax)
310Sstevel@tonic-gate #define LOCAL_ALLOC(x) alloca(x)
320Sstevel@tonic-gate #define LOCAL_FREE(x)
332881Smp153739 extern pointer alloca (unsigned);
340Sstevel@tonic-gate #else
350Sstevel@tonic-gate #if defined(__HIGHC__)	/* Barf! */
360Sstevel@tonic-gate pragma on(alloca);
370Sstevel@tonic-gate #define LOCAL_ALLOC(x) alloca(x)
380Sstevel@tonic-gate #define LOCAL_FREE(x)
392881Smp153739 extern pointer alloca (unsigned);
400Sstevel@tonic-gate #else
410Sstevel@tonic-gate /* no alloca? */
420Sstevel@tonic-gate #define LOCAL_ALLOC(x) malloc(x)
430Sstevel@tonic-gate #define LOCAL_FREE(x) free(x)
440Sstevel@tonic-gate #endif
450Sstevel@tonic-gate #endif
460Sstevel@tonic-gate #endif				/* LOCAL_ALLOC stuff */
470Sstevel@tonic-gate 
480Sstevel@tonic-gate typedef char BOOL;
490Sstevel@tonic-gate 
500Sstevel@tonic-gate typedef struct _ss_abbrev_entry {
510Sstevel@tonic-gate     char *name;			/* abbrev name */
520Sstevel@tonic-gate     char **abbrev;		/* new tokens to insert */
530Sstevel@tonic-gate     unsigned int beginning_of_line : 1;
540Sstevel@tonic-gate } ss_abbrev_entry;
550Sstevel@tonic-gate 
560Sstevel@tonic-gate typedef struct _ss_abbrev_list {
570Sstevel@tonic-gate     int n_abbrevs;
580Sstevel@tonic-gate     ss_abbrev_entry *first_abbrev;
590Sstevel@tonic-gate } ss_abbrev_list;
600Sstevel@tonic-gate 
610Sstevel@tonic-gate typedef struct {
620Sstevel@tonic-gate /*    char *path; */
630Sstevel@tonic-gate     ss_abbrev_list abbrevs[127];
640Sstevel@tonic-gate } ss_abbrev_info;
650Sstevel@tonic-gate 
660Sstevel@tonic-gate typedef struct _ss_data {	/* init values */
670Sstevel@tonic-gate     /* this subsystem */
680Sstevel@tonic-gate     char *subsystem_name;
690Sstevel@tonic-gate     char *subsystem_version;
700Sstevel@tonic-gate     /* current request info */
710Sstevel@tonic-gate     int argc;
720Sstevel@tonic-gate     char **argv;		/* arg list */
730Sstevel@tonic-gate     char const *current_request; /* primary name */
740Sstevel@tonic-gate     /* info directory for 'help' */
750Sstevel@tonic-gate     char **info_dirs;
760Sstevel@tonic-gate     /* to be extracted by subroutines */
770Sstevel@tonic-gate     pointer info_ptr;		/* (void *) NULL */
780Sstevel@tonic-gate     /* for ss_listen processing */
790Sstevel@tonic-gate     char *prompt;
800Sstevel@tonic-gate     ss_request_table **rqt_tables;
810Sstevel@tonic-gate     ss_abbrev_info *abbrev_info;
820Sstevel@tonic-gate     struct {
830Sstevel@tonic-gate 	unsigned int  escape_disabled : 1,
840Sstevel@tonic-gate 		      abbrevs_disabled : 1;
850Sstevel@tonic-gate     } flags;
860Sstevel@tonic-gate     /* to get out */
870Sstevel@tonic-gate     int abort;			/* exit subsystem */
880Sstevel@tonic-gate     int exit_status;
890Sstevel@tonic-gate } ss_data;
900Sstevel@tonic-gate 
910Sstevel@tonic-gate #define CURRENT_SS_VERSION 1
920Sstevel@tonic-gate 
930Sstevel@tonic-gate #define	ss_info(sci_idx)	(_ss_table[sci_idx])
940Sstevel@tonic-gate #define	ss_current_request(sci_idx,code_ptr)	\
950Sstevel@tonic-gate      (*code_ptr=0,ss_info(sci_idx)->current_request)
960Sstevel@tonic-gate void ss_unknown_function();
970Sstevel@tonic-gate void ss_delete_info_dir();
98*8093SMark.Phalan@Sun.COM /* Solaris Kerberos */
99*8093SMark.Phalan@Sun.COM int ss_parse (int, char *, int *, char ***, int);
1002881Smp153739 ss_abbrev_info *ss_abbrev_initialize (char *, int *);
1012881Smp153739 void ss_page_stdin (void);
1022881Smp153739 int ss_pager_create (void);
1032881Smp153739 void ss_self_identify __SS_PROTO;
1042881Smp153739 void ss_subsystem_name __SS_PROTO;
1052881Smp153739 void ss_subsystem_version __SS_PROTO;
1062881Smp153739 void ss_unimplemented __SS_PROTO;
1070Sstevel@tonic-gate 
1080Sstevel@tonic-gate extern ss_data **_ss_table;
1090Sstevel@tonic-gate extern char *ss_et_msgs[];
1100Sstevel@tonic-gate 
1110Sstevel@tonic-gate #ifndef HAVE_STDLIB_H
1122881Smp153739 extern pointer malloc (unsigned);
1132881Smp153739 extern pointer realloc (pointer, unsigned);
1142881Smp153739 extern pointer calloc (unsigned, unsigned);
1150Sstevel@tonic-gate #endif
1160Sstevel@tonic-gate 
1172881Smp153739 #if defined(USE_SIGPROCMASK) && !defined(POSIX_SIGNALS)
1180Sstevel@tonic-gate /* fake sigmask, sigblock, sigsetmask */
1190Sstevel@tonic-gate #include <signal.h>
1202881Smp153739 #ifdef sigmask
1212881Smp153739 #undef sigmask
1222881Smp153739 #endif
1230Sstevel@tonic-gate #define sigmask(x) (1L<<(x)-1)
1240Sstevel@tonic-gate #define sigsetmask(x) sigprocmask(SIG_SETMASK,&x,NULL)
1250Sstevel@tonic-gate static int _fake_sigstore;
1260Sstevel@tonic-gate #define sigblock(x) (_fake_sigstore=x,sigprocmask(SIG_BLOCK,&_fake_sigstore,0))
1270Sstevel@tonic-gate #endif
1280Sstevel@tonic-gate #endif /* _ss_internal_h */
129