xref: /illumos-gate/usr/src/lib/krb5/ss/ss_internal.h (revision 0b16192f)
17c478bd9Sstevel@tonic-gate /*
27c478bd9Sstevel@tonic-gate  * Copyright 1987, 1988 by MIT Student Information Processing Board
37c478bd9Sstevel@tonic-gate  *
47c478bd9Sstevel@tonic-gate  * For copyright information, see copyright.h.
57c478bd9Sstevel@tonic-gate  */
67c478bd9Sstevel@tonic-gate 
76d084746S /*
86d084746S  * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
96d084746S  * Use is subject to license terms.
106d084746S  */
116d084746S 
126d084746S 
137c478bd9Sstevel@tonic-gate #ifndef _ss_ss_internal_h
147c478bd9Sstevel@tonic-gate #define _ss_ss_internal_h __FILE__
157c478bd9Sstevel@tonic-gate #include <stdio.h>
167c478bd9Sstevel@tonic-gate #include <string.h>
177c478bd9Sstevel@tonic-gate #include <unistd.h>
187c478bd9Sstevel@tonic-gate #ifdef HAVE_STDLIB_H
197c478bd9Sstevel@tonic-gate #include <stdlib.h>
207c478bd9Sstevel@tonic-gate #endif
217c478bd9Sstevel@tonic-gate 
227c478bd9Sstevel@tonic-gate typedef void * pointer;
237c478bd9Sstevel@tonic-gate 
247c478bd9Sstevel@tonic-gate #include <ss/ss.h>
257c478bd9Sstevel@tonic-gate 
267c478bd9Sstevel@tonic-gate #if defined(__GNUC__)
277c478bd9Sstevel@tonic-gate #define LOCAL_ALLOC(x) __builtin_alloca(x)
287c478bd9Sstevel@tonic-gate #define LOCAL_FREE(x)
297c478bd9Sstevel@tonic-gate #else
307c478bd9Sstevel@tonic-gate #if defined(vax)
317c478bd9Sstevel@tonic-gate #define LOCAL_ALLOC(x) alloca(x)
327c478bd9Sstevel@tonic-gate #define LOCAL_FREE(x)
3356a424ccSmp extern pointer alloca (unsigned);
347c478bd9Sstevel@tonic-gate #else
357c478bd9Sstevel@tonic-gate #if defined(__HIGHC__)	/* Barf! */
367c478bd9Sstevel@tonic-gate pragma on(alloca);
377c478bd9Sstevel@tonic-gate #define LOCAL_ALLOC(x) alloca(x)
387c478bd9Sstevel@tonic-gate #define LOCAL_FREE(x)
3956a424ccSmp extern pointer alloca (unsigned);
407c478bd9Sstevel@tonic-gate #else
417c478bd9Sstevel@tonic-gate /* no alloca? */
427c478bd9Sstevel@tonic-gate #define LOCAL_ALLOC(x) malloc(x)
437c478bd9Sstevel@tonic-gate #define LOCAL_FREE(x) free(x)
447c478bd9Sstevel@tonic-gate #endif
457c478bd9Sstevel@tonic-gate #endif
467c478bd9Sstevel@tonic-gate #endif				/* LOCAL_ALLOC stuff */
477c478bd9Sstevel@tonic-gate 
487c478bd9Sstevel@tonic-gate typedef char BOOL;
497c478bd9Sstevel@tonic-gate 
507c478bd9Sstevel@tonic-gate typedef struct _ss_abbrev_entry {
517c478bd9Sstevel@tonic-gate     char *name;			/* abbrev name */
527c478bd9Sstevel@tonic-gate     char **abbrev;		/* new tokens to insert */
537c478bd9Sstevel@tonic-gate     unsigned int beginning_of_line : 1;
547c478bd9Sstevel@tonic-gate } ss_abbrev_entry;
557c478bd9Sstevel@tonic-gate 
567c478bd9Sstevel@tonic-gate typedef struct _ss_abbrev_list {
577c478bd9Sstevel@tonic-gate     int n_abbrevs;
587c478bd9Sstevel@tonic-gate     ss_abbrev_entry *first_abbrev;
597c478bd9Sstevel@tonic-gate } ss_abbrev_list;
607c478bd9Sstevel@tonic-gate 
617c478bd9Sstevel@tonic-gate typedef struct {
627c478bd9Sstevel@tonic-gate /*    char *path; */
637c478bd9Sstevel@tonic-gate     ss_abbrev_list abbrevs[127];
647c478bd9Sstevel@tonic-gate } ss_abbrev_info;
657c478bd9Sstevel@tonic-gate 
667c478bd9Sstevel@tonic-gate typedef struct _ss_data {	/* init values */
677c478bd9Sstevel@tonic-gate     /* this subsystem */
687c478bd9Sstevel@tonic-gate     char *subsystem_name;
697c478bd9Sstevel@tonic-gate     char *subsystem_version;
707c478bd9Sstevel@tonic-gate     /* current request info */
717c478bd9Sstevel@tonic-gate     int argc;
727c478bd9Sstevel@tonic-gate     char **argv;		/* arg list */
737c478bd9Sstevel@tonic-gate     char const *current_request; /* primary name */
747c478bd9Sstevel@tonic-gate     /* info directory for 'help' */
757c478bd9Sstevel@tonic-gate     char **info_dirs;
767c478bd9Sstevel@tonic-gate     /* to be extracted by subroutines */
777c478bd9Sstevel@tonic-gate     pointer info_ptr;		/* (void *) NULL */
787c478bd9Sstevel@tonic-gate     /* for ss_listen processing */
797c478bd9Sstevel@tonic-gate     char *prompt;
807c478bd9Sstevel@tonic-gate     ss_request_table **rqt_tables;
817c478bd9Sstevel@tonic-gate     ss_abbrev_info *abbrev_info;
827c478bd9Sstevel@tonic-gate     struct {
837c478bd9Sstevel@tonic-gate 	unsigned int  escape_disabled : 1,
847c478bd9Sstevel@tonic-gate 		      abbrevs_disabled : 1;
857c478bd9Sstevel@tonic-gate     } flags;
867c478bd9Sstevel@tonic-gate     /* to get out */
877c478bd9Sstevel@tonic-gate     int abort;			/* exit subsystem */
887c478bd9Sstevel@tonic-gate     int exit_status;
897c478bd9Sstevel@tonic-gate } ss_data;
907c478bd9Sstevel@tonic-gate 
917c478bd9Sstevel@tonic-gate #define CURRENT_SS_VERSION 1
927c478bd9Sstevel@tonic-gate 
937c478bd9Sstevel@tonic-gate #define	ss_info(sci_idx)	(_ss_table[sci_idx])
947c478bd9Sstevel@tonic-gate #define	ss_current_request(sci_idx,code_ptr)	\
957c478bd9Sstevel@tonic-gate      (*code_ptr=0,ss_info(sci_idx)->current_request)
967c478bd9Sstevel@tonic-gate void ss_unknown_function();
977c478bd9Sstevel@tonic-gate void ss_delete_info_dir();
986d084746S /* Solaris Kerberos */
996d084746S int ss_parse (int, char *, int *, char ***, int);
10056a424ccSmp ss_abbrev_info *ss_abbrev_initialize (char *, int *);
101*0b16192fSToomas Soome void ss_page_stdin (void) __NORETURN;
10256a424ccSmp int ss_pager_create (void);
10356a424ccSmp void ss_self_identify __SS_PROTO;
10456a424ccSmp void ss_subsystem_name __SS_PROTO;
10556a424ccSmp void ss_subsystem_version __SS_PROTO;
10656a424ccSmp void ss_unimplemented __SS_PROTO;
1077c478bd9Sstevel@tonic-gate 
1087c478bd9Sstevel@tonic-gate extern ss_data **_ss_table;
1097c478bd9Sstevel@tonic-gate extern char *ss_et_msgs[];
1107c478bd9Sstevel@tonic-gate 
1117c478bd9Sstevel@tonic-gate #ifndef HAVE_STDLIB_H
11256a424ccSmp extern pointer malloc (unsigned);
11356a424ccSmp extern pointer realloc (pointer, unsigned);
11456a424ccSmp extern pointer calloc (unsigned, unsigned);
1157c478bd9Sstevel@tonic-gate #endif
1167c478bd9Sstevel@tonic-gate 
11756a424ccSmp #if defined(USE_SIGPROCMASK) && !defined(POSIX_SIGNALS)
1187c478bd9Sstevel@tonic-gate /* fake sigmask, sigblock, sigsetmask */
1197c478bd9Sstevel@tonic-gate #include <signal.h>
12056a424ccSmp #ifdef sigmask
12156a424ccSmp #undef sigmask
12256a424ccSmp #endif
1237c478bd9Sstevel@tonic-gate #define sigmask(x) (1L<<(x)-1)
1247c478bd9Sstevel@tonic-gate #define sigsetmask(x) sigprocmask(SIG_SETMASK,&x,NULL)
1257c478bd9Sstevel@tonic-gate static int _fake_sigstore;
1267c478bd9Sstevel@tonic-gate #define sigblock(x) (_fake_sigstore=x,sigprocmask(SIG_BLOCK,&_fake_sigstore,0))
1277c478bd9Sstevel@tonic-gate #endif
1287c478bd9Sstevel@tonic-gate #endif /* _ss_internal_h */
129