From 91835c151fd48fd03bfe74133b8214486af18c12 Mon Sep 17 00:00:00 2001 From: Theodore Ts'o Date: Sun, 30 Mar 2003 22:26:13 -0500 Subject: [PATCH] Change compile_et to generate header files that use instead of , so the current version of the header file is used. Add a --build-tree option to compile_et to make sure that it uses the et_?.awk files from the build tree. Remove legacy support for varargs.h, K&R C, and pre-POSIX signal support. Also fixed gcc -Wall nits. --- lib/et/ChangeLog | 15 +++++++++++++ lib/et/com_err.c | 44 ++------------------------------------ lib/et/com_err.h | 39 ++++++++++++++++----------------- lib/et/com_err.texinfo | 37 -------------------------------- lib/et/compile_et.sh.in | 5 +++++ lib/et/error_message.c | 12 +++-------- lib/et/error_table.h | 8 ------- lib/et/et_h.awk | 2 +- lib/et/init_et.c | 11 ---------- lib/et/internal.h | 4 ---- lib/ext2fs/ChangeLog | 4 ++++ lib/ext2fs/Makefile.in | 2 +- lib/ss/ChangeLog | 9 ++++++++ lib/ss/Makefile.in | 4 ++-- lib/ss/ct_c.awk | 4 ---- lib/ss/error.c | 33 +--------------------------- lib/ss/get_readline.c | 13 +++++++---- lib/ss/invocation.c | 7 +++--- lib/ss/list_rqs.c | 14 +----------- lib/ss/listen.c | 31 +-------------------------- lib/ss/pager.c | 20 ++++++----------- lib/ss/prompt.c | 11 ---------- lib/ss/request_tbl.c | 2 +- lib/ss/requests.c | 17 +++++++-------- lib/ss/ss.h | 28 ++---------------------- lib/ss/ss_internal.h | 57 +++++++++---------------------------------------- 26 files changed, 102 insertions(+), 331 deletions(-) diff --git a/lib/et/ChangeLog b/lib/et/ChangeLog index 4df0b49..52334a3 100644 --- a/lib/et/ChangeLog +++ b/lib/et/ChangeLog @@ -1,3 +1,18 @@ +2003-03-30 Theodore Ts'o + + * et_h.awk (char_shift): Use the com_err.h file in et/com_err.h, + since /usr/include/com_err.h may not exist, and if it + does, it might be the wrong one. + + * compile_et.sh.in: Add --build-tree option which forces the use + of the et_?.awk files in the build tree. + + * error_table.h, error_message.c, com_err.c, internal.h, + init_et.c, com_err.h: Remove STDC legacy #define's. + + * com_err.texinfo: Remove references to K&R C support, and to + potential problems that are no longer relevant. + 2003-03-19 Theodore Ts'o * com_err.h, error_table.h: Move definition of the error_table diff --git a/lib/et/com_err.c b/lib/et/com_err.c index 9637b04..76fdc78 100644 --- a/lib/et/com_err.c +++ b/lib/et/com_err.c @@ -16,22 +16,9 @@ #include "error_table.h" #include "internal.h" -#if !defined(__STDC__) && !defined(STDARG_PROTOTYPES) -#include -#define VARARGS -#endif - static void -#ifdef __STDC__ - default_com_err_proc (const char *whoami, errcode_t code, const - char *fmt, va_list args) -#else - default_com_err_proc (whoami, code, fmt, args) - const char *whoami; - errcode_t code; - const char *fmt; - va_list args; -#endif +default_com_err_proc (const char *whoami, errcode_t code, const + char *fmt, va_list args) { if (whoami) { fputs(whoami, stderr); @@ -49,52 +36,25 @@ static void fflush(stderr); } -#ifdef __STDC__ typedef void (*errf) (const char *, errcode_t, const char *, va_list); -#else -typedef void (*errf) (); -#endif errf com_err_hook = default_com_err_proc; -#ifdef __STDC__ void com_err_va (const char *whoami, errcode_t code, const char *fmt, va_list args) -#else -void com_err_va (whoami, code, fmt, args) - const char *whoami; - errcode_t code; - const char *fmt; - va_list args; -#endif { (*com_err_hook) (whoami, code, fmt, args); } -#ifndef VARARGS void com_err (const char *whoami, errcode_t code, const char *fmt, ...) { -#else -void com_err (va_alist) - va_dcl -{ - const char *whoami, *fmt; - errcode_t code; -#endif va_list pvar; if (!com_err_hook) com_err_hook = default_com_err_proc; -#ifdef VARARGS - va_start (pvar); - whoami = va_arg (pvar, const char *); - code = va_arg (pvar, errcode_t); - fmt = va_arg (pvar, const char *); -#else va_start(pvar, fmt); -#endif com_err_va (whoami, code, fmt, pvar); va_end(pvar); } diff --git a/lib/et/com_err.h b/lib/et/com_err.h index 5c3fd94..94c6098 100644 --- a/lib/et/com_err.h +++ b/lib/et/com_err.h @@ -10,37 +10,34 @@ #ifndef __COM_ERR_H +#include + typedef long errcode_t; struct error_table { char const * const * msgs; - unsigned long base; + long base; unsigned int n_msgs; }; -#ifdef __STDC__ -#include +struct et_list; -/* ANSI C -- use prototypes etc */ -void com_err (const char *, long, const char *, ...); -void com_err_va (const char *whoami, errcode_t code, const char *fmt, +extern void com_err (const char *, long, const char *, ...); +extern void com_err_va (const char *whoami, errcode_t code, const char *fmt, va_list args); -char const *error_message (long); +extern char const *error_message (long); extern void (*com_err_hook) (const char *, long, const char *, va_list); -void (*set_com_err_hook (void (*) (const char *, long, const char *, va_list))) - (const char *, long, const char *, va_list); -void (*reset_com_err_hook (void)) (const char *, long, const char *, va_list); -int init_error_table(const char * const *msgs, int base, int count); -#else -/* no prototypes */ -void com_err (); -void com_err_va (); -char *error_message (); -extern void (*com_err_hook) (); -void (*set_com_err_hook ()) (); -void (*reset_com_err_hook ()) (); -int init_error_table(); -#endif +extern void (*set_com_err_hook (void (*) (const char *, long, + const char *, va_list))) + (const char *, long, const char *, va_list); +extern void (*reset_com_err_hook (void)) (const char *, long, + const char *, va_list); +extern int init_error_table(const char * const *msgs, int base, int count); + +extern errcode_t add_error_table(const struct error_table * et); +extern errcode_t remove_error_table(const struct error_table * et); +extern void add_to_error_table(struct et_list *new_table); + #define __COM_ERR_H #endif /* ! defined(__COM_ERR_H) */ diff --git a/lib/et/com_err.texinfo b/lib/et/com_err.texinfo index 1bf5713..5607281 100644 --- a/lib/et/com_err.texinfo +++ b/lib/et/com_err.texinfo @@ -256,14 +256,6 @@ included in the source of a module which wishes to reference the error codes defined; the object module generated from the C code may be linked in to a program which wishes to use the printed forms of the error codes. -This translator accepts a @kbd{-language @var{lang}} argument, which -determines for which language (or language variant) the output should be -written. At the moment, @var{lang} is currently limited to @kbd{ANSI-C} -and @kbd{K&R-C}, and some abbreviated forms of each. Eventually, this will -be extended to include some support for C++. The default is currently -@kbd{K&R-C}, though the generated sources will have ANSI-C code -conditionalized on the symbol @t{__STDC__}. - @node Run-time support routines, Coding Conventions, The error-table compiler, Top @section Run-time support routines @@ -523,35 +515,6 @@ error-table compiler. The files @samp{libcom_err.a}, installed for use; @samp{com_err.3} and @samp{compile_et.1} can also be installed as manual pages. -Potential problems: - -@itemize @bullet - -@item Use of @code{strcasecmp}, a routine provided in BSD for -case-insensitive string comparisons. If an equivalent routine is -available, you can modify @code{CFLAGS} in the makefile to define -@code{strcasecmp} to the name of that routine. - -@item Compilers that defined @code{__STDC__} without providing the header -file @code{}. One such example is Metaware's High ``C'' -compiler, as provided at Project Athena on the IBM RT/PC workstation; if -@code{__HIGHC__} is defined, it is assumed that @code{} is not -available, and therefore @code{} must be used. If the symbol -@code{VARARGS} is defined (e.g., in the makefile), @code{} will -be used. - -@item If your linker rejects symbols that are simultaneously defined in two -library files, edit @samp{Makefile} to remove @samp{perror.c} from the -library. This file contains a version of @cite{perror(3)} which calls -@code{com_err} instead of calling @code{write} directly. - -@end itemize - -As I do not have access to non-BSD systems, there are probably -bugs present that may interfere with building or using this package on -other systems. If they are reported to me, they can probably be fixed for -the next version. - @node Bug Reports, Acknowledgements, Building and Installation, Top @section Bug Reports diff --git a/lib/et/compile_et.sh.in b/lib/et/compile_et.sh.in index ad445fa..0e7634c 100644 --- a/lib/et/compile_et.sh.in +++ b/lib/et/compile_et.sh.in @@ -5,6 +5,11 @@ AWK=@AWK@ DIR="${DIR-@datadir@/et}" ET_DIR="@ET_DIR@" +if test "$1" = "--build-tree" ; then + shift; + DIR="$ET_DIR" +fi + if test "x$1" = x ; then echo "Usage: compile_et file" exit 1 diff --git a/lib/et/error_message.c b/lib/et/error_message.c index 3668c45..9326308 100644 --- a/lib/et/error_message.c +++ b/lib/et/error_message.c @@ -17,6 +17,7 @@ */ #include +#include #include #include #include "com_err.h" @@ -28,12 +29,7 @@ static char buffer[25]; struct et_list * _et_list = (struct et_list *) NULL; -#ifdef __STDC__ const char * error_message (errcode_t code) -#else -const char * error_message (code) - errcode_t code; -#endif { int offset; struct et_list *et; @@ -90,8 +86,7 @@ oops: /* * New interface provided by krb5's com_err library */ -errcode_t add_error_table(et) - const struct error_table * et; +errcode_t add_error_table(const struct error_table * et) { struct et_list *el = _et_list; @@ -114,8 +109,7 @@ errcode_t add_error_table(et) /* * New interface provided by krb5's com_err library */ -errcode_t remove_error_table(et) - const struct error_table * et; +errcode_t remove_error_table(const struct error_table * et) { struct et_list *el = _et_list; struct et_list *el2 = 0; diff --git a/lib/et/error_table.h b/lib/et/error_table.h index 36348e9..4f10991 100644 --- a/lib/et/error_table.h +++ b/lib/et/error_table.h @@ -13,10 +13,6 @@ */ #ifndef _ET_H -/* Are we using ANSI C? */ -#ifndef __STDC__ -#define const -#endif struct et_list { struct et_list *next; @@ -27,11 +23,7 @@ extern struct et_list * _et_list; #define ERRCODE_RANGE 8 /* # of bits to shift table number */ #define BITS_PER_CHAR 6 /* # bits to shift per character in name */ -#ifdef __STDC__ extern const char *error_table_name(errcode_t num); -#else -extern const char *error_table_name(); -#endif #define _ET_H #endif diff --git a/lib/et/et_h.awk b/lib/et/et_h.awk index e8da3ac..a52c141 100644 --- a/lib/et/et_h.awk +++ b/lib/et/et_h.awk @@ -119,7 +119,7 @@ c2n["_"]=63 print " * This file is automatically generated; please do not edit it." > outfile print " */" > outfile print "" > outfile - print "#include " > outfile + print "#include " > outfile print "" > outfile } diff --git a/lib/et/init_et.c b/lib/et/init_et.c index 606afc6..0e30730 100644 --- a/lib/et/init_et.c +++ b/lib/et/init_et.c @@ -24,10 +24,6 @@ #include "com_err.h" #include "error_table.h" -#ifndef __STDC__ -#define const -#endif - struct foobar { struct et_list etl; struct error_table et; @@ -35,14 +31,7 @@ struct foobar { extern struct et_list * _et_list; -#ifdef __STDC__ int init_error_table(const char * const *msgs, int base, int count) -#else -int init_error_table(msgs, base, count) - const char * const * msgs; - int base; - int count; -#endif { struct foobar * new_et; diff --git a/lib/et/internal.h b/lib/et/internal.h index b6c2775..d16f373 100644 --- a/lib/et/internal.h +++ b/lib/et/internal.h @@ -10,10 +10,6 @@ * this software for any purpose. It is provided "as is" without * express or implied warranty. */ -#ifndef __STDC__ -#undef const -#define const -#endif #include diff --git a/lib/ext2fs/ChangeLog b/lib/ext2fs/ChangeLog index b9c997c..110a668 100644 --- a/lib/ext2fs/ChangeLog +++ b/lib/ext2fs/ChangeLog @@ -1,3 +1,7 @@ +2003-03-30 Theodore Ts'o + + * Makefile.in: Use the compile_et --build-tree option. + 2003-03-14 Theodore Ts'o * getsize.c: Add support for Apple Darwin's ioctl to get the hard diff --git a/lib/ext2fs/Makefile.in b/lib/ext2fs/Makefile.in index b9432ea..7573429 100644 --- a/lib/ext2fs/Makefile.in +++ b/lib/ext2fs/Makefile.in @@ -168,7 +168,7 @@ BSDLIB_INSTALL_DIR = $(root_libdir) @ELF_CMT@ $(CC) $(ALL_CFLAGS) -fPIC -o elfshared/$*.o -c $< @BSDLIB_CMT@ $(CC) $(ALL_CFLAGS) -fpic -o pic/$*.o -c $< -COMPILE_ET=../et/compile_et +COMPILE_ET=../et/compile_et --build-tree DISTFILES= Makefile *.c *.h image diff --git a/lib/ss/ChangeLog b/lib/ss/ChangeLog index fc6e6b5..fe59b6a 100644 --- a/lib/ss/ChangeLog +++ b/lib/ss/ChangeLog @@ -1,3 +1,12 @@ +2003-03-30 Theodore Ts'o + + * pager.c, listen.c, requests.c, list_rqs.c, ct_c.awk, prompt.c, + error.c, request_tbl.c, ss_internal.h, invocation.c, ss.h, + get_readline.c: Remove old support for K&R C and Varargs. + Fix gcc -Wall nits. + + * Makefile.in: Use the compile_et --build-tree option. + 2003-03-16 Theodore Ts'o * mk_cmds.1, Makefile.in: Add (bare-bone) man page diff --git a/lib/ss/Makefile.in b/lib/ss/Makefile.in index 70ad3fe..9dc5cfd 100644 --- a/lib/ss/Makefile.in +++ b/lib/ss/Makefile.in @@ -38,13 +38,13 @@ BSDLIB_MYDIR = ss BSDLIB_INSTALL_DIR = $(root_libdir) TAGS=etags -COMPILE_ET=../et/compile_et +COMPILE_ET=../et/compile_et --build-tree MK_CMDS=_SS_DIR_OVERRIDE=. ./mk_cmds # -I.. is so that ss/ss_err.h works # -I$(srcdir)/.. is so that ss/ss.h works # -I$(srcdir)/../et is so com_err.h works -XTRA_CFLAGS=-DPOSIX_SIGNALS -I$(srcdir)/../et +XTRA_CFLAGS= -I$(srcdir)/../et .c.o: $(CC) $(ALL_CFLAGS) -c $< diff --git a/lib/ss/ct_c.awk b/lib/ss/ct_c.awk index ef74145..a4424c8 100644 --- a/lib/ss/ct_c.awk +++ b/lib/ss/ct_c.awk @@ -4,10 +4,6 @@ rootname, rootname > outfile print "#include " > outfile print "" >outfile - print "#ifndef __STDC__" > outfile - print "#define const" > outfile - print "#endif" > outfile - print "" > outfile } /^BOR$/ { diff --git a/lib/ss/error.c b/lib/ss/error.c index 26f5ae7..14c0570 100644 --- a/lib/ss/error.c +++ b/lib/ss/error.c @@ -14,28 +14,11 @@ #include -/* - * I'm assuming that com_err.h includes varargs.h, which it does - * (right now). There really ought to be a way for me to include the - * file without worrying about whether com_err.h includes it or not, - * but varargs.h doesn't define anything that I can use as a flag, and - * gcc will lose if I try to include it twice and redefine stuff. - */ -#if !defined(__STDC__) || !defined(ibm032) || !defined(NeXT) -#define ss_error ss_error_external -#endif - #include #include "ss_internal.h" -#ifdef HAVE_STDARG_H #include -#else -#include -#endif -#undef ss_error - char * ss_name(sci_idx) int sci_idx; { @@ -74,26 +57,12 @@ char * ss_name(sci_idx) } } -#ifdef HAVE_STDARG_H void ss_error (int sci_idx, long code, const char * fmt, ...) -#else -void ss_error (va_alist) - va_dcl -#endif { register char *whoami; va_list pvar; -#ifndef HAVE_STDARG_H - int sci_idx; - long code; - char * fmt; - va_start (pvar); - sci_idx = va_arg (pvar, int); - code = va_arg (pvar, long); - fmt = va_arg (pvar, char *); -#else + va_start (pvar, fmt); -#endif whoami = ss_name (sci_idx); com_err_va (whoami, code, fmt, pvar); free (whoami); diff --git a/lib/ss/get_readline.c b/lib/ss/get_readline.c index 2ec5ac2..55b8b47 100644 --- a/lib/ss/get_readline.c +++ b/lib/ss/get_readline.c @@ -49,10 +49,15 @@ void ss_get_readline(int sci_idx) return; info->readline_handle = handle; - info->readline = dlsym(handle, "readline"); - info->add_history = dlsym(handle, "add_history"); - info->redisplay = dlsym(handle, "rl_forced_update_display"); - info->rl_completion_matches = dlsym(handle, "rl_completion_matches"); + info->readline = (char *(*)(const char *)) + dlsym(handle, "readline"); + info->add_history = (void (*)(const char *)) + dlsym(handle, "add_history"); + info->redisplay = (void (*)(void)) + dlsym(handle, "rl_forced_update_display"); + info->rl_completion_matches = (char **(*)(const char *, + char *(*)(const char *, int))) + dlsym(handle, "rl_completion_matches"); if ((t = dlsym(handle, "rl_readline_name")) != NULL) *t = info->subsystem_name; if ((completion_func = diff --git a/lib/ss/invocation.c b/lib/ss/invocation.c index 748886f..074706f 100644 --- a/lib/ss/invocation.c +++ b/lib/ss/invocation.c @@ -30,7 +30,6 @@ int ss_create_invocation(subsystem_name, version_string, info_ptr, register int sci_idx; register ss_data *new_table; register ss_data **table; - void *handle; *code_ptr = 0; table = _ss_table; @@ -92,13 +91,13 @@ ss_delete_invocation(sci_idx) t = ss_info(sci_idx); free(t->prompt); - free((char *)t->rqt_tables); + free(t->rqt_tables); while(t->info_dirs[0] != (char *)NULL) ss_delete_info_dir(sci_idx, t->info_dirs[0], &ignored_code); - free((char *)t->info_dirs); + free(t->info_dirs); #if defined(HAVE_DLOPEN) && defined(SHARED_ELF_LIB) if (t->readline_shutdown) (*t->readline_shutdown)(t); #endif - free((char *)t); + free(t); } diff --git a/lib/ss/list_rqs.c b/lib/ss/list_rqs.c index 8c4e846..b1fc5ed 100644 --- a/lib/ss/list_rqs.c +++ b/lib/ss/list_rqs.c @@ -41,12 +41,8 @@ void ss_list_requests(argc, argv, sci_idx, info_ptr) char buffer[BUFSIZ]; FILE *output; int fd; -#ifdef POSIX_SIGNALS sigset_t omask, igmask; -#else - int mask; -#endif - sigret_t (*func) PROTOTYPE((int)); + sigret_t (*func)(int); #ifndef NO_FORK int waitb; #endif @@ -54,21 +50,13 @@ void ss_list_requests(argc, argv, sci_idx, info_ptr) DONT_USE(argc); DONT_USE(argv); -#ifdef POSIX_SIGNALS sigemptyset(&igmask); sigaddset(&igmask, SIGINT); sigprocmask(SIG_BLOCK, &igmask, &omask); -#else - mask = sigblock(sigmask(SIGINT)); -#endif func = signal(SIGINT, SIG_IGN); fd = ss_pager_create(); output = fdopen(fd, "w"); -#ifdef POSIX_SIGNALS sigprocmask(SIG_SETMASK, &omask, (sigset_t *) 0); -#else - sigsetmask(mask); -#endif fprintf (output, "Available %s requests:\n\n", ss_info (sci_idx) -> subsystem_name); diff --git a/lib/ss/listen.c b/lib/ss/listen.c index 0731418..784af44 100644 --- a/lib/ss/listen.c +++ b/lib/ss/listen.c @@ -21,14 +21,6 @@ #include #include #include -#ifdef BSD -#include -#endif - -#ifndef lint -static char const rcs_id[] = - "$Header$"; -#endif typedef void sigret_t; @@ -38,16 +30,6 @@ static sigret_t (*sig_cont)(int); static sigret_t print_prompt(int sig) { -#ifdef BSD - /* put input into a reasonable mode */ - struct sgttyb ttyb; - if (ioctl(fileno(stdin), TIOCGETP, &ttyb) != -1) { - if (ttyb.sg_flags & (CBREAK|RAW)) { - ttyb.sg_flags &= ~(CBREAK|RAW); - (void) ioctl(0, TIOCSETP, &ttyb); - } - } -#endif if (current_info->redisplay) (*current_info->redisplay)(); else { @@ -69,11 +51,7 @@ int ss_listen (int sci_idx) ss_data *info; sigret_t (*sig_int)(int), (*old_sig_cont)(int); char input[BUFSIZ]; -#ifdef POSIX_SIGNALS sigset_t omask, igmask; -#else - int mask; -#endif int code; jmp_buf old_jmpb; ss_data *old_info = current_info; @@ -82,21 +60,14 @@ int ss_listen (int sci_idx) current_info = info = ss_info(sci_idx); sig_cont = (sigret_t (*)(int)) 0; info->abort = 0; -#ifdef POSIX_SIGNALS sigemptyset(&igmask); sigaddset(&igmask, SIGINT); sigprocmask(SIG_BLOCK, &igmask, &omask); -#else - mask = sigblock(sigmask(SIGINT)); -#endif memcpy(old_jmpb, listen_jmpb, sizeof(jmp_buf)); sig_int = signal(SIGINT, listen_int_handler); setjmp(listen_jmpb); -#ifdef POSIX_SIGNALS sigprocmask(SIG_SETMASK, &omask, (sigset_t *) 0); -#else - (void) sigsetmask(mask); -#endif + while(!info->abort) { old_sig_cont = sig_cont; sig_cont = signal(SIGCONT, print_prompt); diff --git a/lib/ss/pager.c b/lib/ss/pager.c index 979ae5d..ba28f97 100644 --- a/lib/ss/pager.c +++ b/lib/ss/pager.c @@ -42,7 +42,7 @@ extern char *getenv PROTOTYPE((const char *)); */ #ifndef NO_FORK -int ss_pager_create(NOARGS) +int ss_pager_create(void) { int filedes[2]; @@ -80,22 +80,14 @@ int ss_pager_create() void ss_page_stdin() { int i; + sigset_t mask; + for (i = 3; i < 32; i++) (void) close(i); (void) signal(SIGINT, SIG_DFL); - { -#ifdef POSIX_SIGNALS - sigset_t mask; - - sigprocmask(SIG_BLOCK, 0, &mask); - sigdelset(&mask, SIGINT); - sigprocmask(SIG_SETMASK, &mask, 0); -#else - int mask = sigblock(0); - mask &= ~sigmask(SIGINT); - sigsetmask(mask); -#endif - } + sigprocmask(SIG_BLOCK, 0, &mask); + sigdelset(&mask, SIGINT); + sigprocmask(SIG_SETMASK, &mask, 0); if (_ss_pager_name == (char *)NULL) { if ((_ss_pager_name = getenv("PAGER")) == (char *)NULL) _ss_pager_name = MORE; diff --git a/lib/ss/prompt.c b/lib/ss/prompt.c index 90a35ec..6fe4263 100644 --- a/lib/ss/prompt.c +++ b/lib/ss/prompt.c @@ -19,23 +19,12 @@ #include #include "ss_internal.h" -#ifdef __STDC__ void ss_set_prompt(int sci_idx, char *new_prompt) -#else -void ss_set_prompt(sci_idx, new_prompt) - int sci_idx; - char *new_prompt; -#endif { ss_info(sci_idx)->prompt = new_prompt; } -#ifdef __STDC__ char *ss_get_prompt(int sci_idx) -#else -char *ss_get_prompt(sci_idx) - int sci_idx; -#endif { return(ss_info(sci_idx)->prompt); } diff --git a/lib/ss/request_tbl.c b/lib/ss/request_tbl.c index 68b0a49..4027af8 100644 --- a/lib/ss/request_tbl.c +++ b/lib/ss/request_tbl.c @@ -33,7 +33,7 @@ void ss_add_request_table(sci_idx, rqtbl_ptr, position, code_ptr) ; /* size == C subscript of NULL == #elements */ size += 2; /* new element, and NULL */ - info->rqt_tables = (ssrt **)realloc((char *)info->rqt_tables, + info->rqt_tables = (ssrt **)realloc(info->rqt_tables, (unsigned)size*sizeof(ssrt)); if (info->rqt_tables == (ssrt **)NULL) { *code_ptr = errno; diff --git a/lib/ss/requests.c b/lib/ss/requests.c index 56e429b..7f1805d 100644 --- a/lib/ss/requests.c +++ b/lib/ss/requests.c @@ -16,18 +16,14 @@ #include #include "ss_internal.h" -#ifdef __STDC__ #define DECLARE(name) void name(int argc,const char * const *argv, \ int sci_idx, void *infop) -#else -#define DECLARE(name) void name(argc,argv,sci_idx,infop) \ - int argc,sci_idx;char **argv;void *infop; -#endif /* * ss_self_identify -- assigned by default to the "." request */ -DECLARE(ss_self_identify) +void ss_self_identify(int argc,const char * const *argv, + int sci_idx, void *infop) { register ss_data *info = ss_info(sci_idx); printf("%s version %s\n", info->subsystem_name, @@ -37,7 +33,8 @@ DECLARE(ss_self_identify) /* * ss_subsystem_name -- print name of subsystem */ -DECLARE(ss_subsystem_name) +void ss_subsystem_name(int argc,const char * const *argv, + int sci_idx, void *infop) { printf("%s\n", ss_info(sci_idx)->subsystem_name); } @@ -45,7 +42,8 @@ DECLARE(ss_subsystem_name) /* * ss_subsystem_version -- print version of subsystem */ -DECLARE(ss_subsystem_version) +void ss_subsystem_version(int argc,const char * const *argv, + int sci_idx, void *infop) { printf("%s\n", ss_info(sci_idx)->subsystem_version); } @@ -54,7 +52,8 @@ DECLARE(ss_subsystem_version) * ss_unimplemented -- routine not implemented (should be * set up as (dont_list,dont_summarize)) */ -DECLARE(ss_unimplemented) +void ss_unimplemented(int argc,const char * const *argv, + int sci_idx, void *infop) { ss_perror(sci_idx, SS_ET_UNIMPLEMENTED, ""); } diff --git a/lib/ss/ss.h b/lib/ss/ss.h index 805e1f1..90a268a 100644 --- a/lib/ss/ss.h +++ b/lib/ss/ss.h @@ -25,13 +25,8 @@ #include -#ifdef __STDC__ #define __SS_CONST const #define __SS_PROTO (int, const char * const *, int, void *) -#else -#define __SS_CONST -#define __SS_PROTO () -#endif typedef __SS_CONST struct _ss_request_entry { __SS_CONST char * __SS_CONST *command_names; /* whatever */ @@ -63,7 +58,7 @@ void ss_help __SS_PROTO; #if 0 char *ss_current_request(); /* This is actually a macro */ #endif -#ifdef __STDC__ + char *ss_name(int sci_idx); void ss_error (int, long, char const *, ...); void ss_perror (int, long, char const *); @@ -86,25 +81,6 @@ void ss_unimplemented(int argc, const char * const *argv, void ss_set_prompt(int sci_idx, char *new_prompt); char *ss_get_prompt(int sci_idx); void ss_get_readline(int sci_idx); -#else -char *ss_name(); -void ss_error (); -void ss_perror (); -int ss_create_invocation(); -void ss_delete_invocation(); -int ss_listen(); -int ss_execute_line(); -void ss_add_request_table(); -void ss_delete_request_table(); -void ss_abort_subsystem(); -void ss_quit(); -void ss_self_identify(); -void ss_subsystem_name(); -void ss_subsystem_version(); -void ss_unimplemented(); -void ss_set_prompt; -char *ss_get_prompt; -void ss_get_readline(); -#endif + extern ss_request_table ss_std_requests; #endif /* _ss_h */ diff --git a/lib/ss/ss_internal.h b/lib/ss/ss_internal.h index ce84477..48afdbd 100644 --- a/lib/ss/ss_internal.h +++ b/lib/ss/ss_internal.h @@ -17,46 +17,11 @@ #include #include -#ifdef __STDC__ - -#define NOARGS void #define PROTOTYPE(p) p typedef void * pointer; -#else - -#define NOARGS -#define const -#define volatile -#define PROTOTYPE(p) () -typedef char * pointer; - -#endif /* not __STDC__ */ - #include "ss.h" -#if defined(__GNUC__) -#define LOCAL_ALLOC(x) __builtin_alloca(x) -#define LOCAL_FREE(x) -#else -#if defined(vax) -#define LOCAL_ALLOC(x) alloca(x) -#define LOCAL_FREE(x) -extern pointer alloca PROTOTYPE((unsigned)); -#else -#if defined(__HIGHC__) /* Barf! */ -pragma on(alloca); -#define LOCAL_ALLOC(x) alloca(x) -#define LOCAL_FREE(x) -extern pointer alloca PROTOTYPE((unsigned)); -#else -/* no alloca? */ -#define LOCAL_ALLOC(x) malloc(x) -#define LOCAL_FREE(x) free(x) -#endif -#endif -#endif /* LOCAL_ALLOC stuff */ - typedef char BOOL; typedef struct _ss_abbrev_entry { @@ -102,7 +67,7 @@ typedef struct _ss_data { /* init values */ void (*readline_shutdown)(struct _ss_data *info); char *(*readline)(const char *); void (*add_history)(const char *); - void (*redisplay)(); + void (*redisplay)(void); char **(*rl_completion_matches)(const char *, char *(*completer)(const char *, int)); /* to get out */ @@ -115,17 +80,15 @@ typedef struct _ss_data { /* init values */ #define ss_info(sci_idx) (_ss_table[sci_idx]) #define ss_current_request(sci_idx,code_ptr) \ (*code_ptr=0,ss_info(sci_idx)->current_request) -void ss_add_info_dir PROTOTYPE((int sci_idx, char *info_dir, - int *code_ptr)); -void ss_delete_info_dir PROTOTYPE((int sci_idx, char *info_dir, - int *code_ptr)); -int ss_execute_line PROTOTYPE((int sci_idx, char *line_ptr)); -char **ss_parse PROTOTYPE((int sci_idx, char *line_ptr, int *argc_ptr)); -ss_abbrev_info *ss_abbrev_initialize PROTOTYPE((char *, int *)); -void ss_page_stdin(NOARGS); -void ss_list_requests PROTOTYPE((int, char const * const *, int, pointer)); -int ss_execute_command PROTOTYPE((int sci_idx, char *argv[])); -int ss_pager_create(NOARGS); +void ss_add_info_dir (int sci_idx, char *info_dir, int *code_ptr); +void ss_delete_info_dir (int sci_idx, char *info_dir, int *code_ptr); +int ss_execute_line(int sci_idx, char *line_ptr); +char **ss_parse(int sci_idx, char *line_ptr, int *argc_ptr); +ss_abbrev_info *ss_abbrev_initialize(char *, int *); +void ss_page_stdin(void); +void ss_list_requests(int, char const * const *, int, pointer); +int ss_execute_command(int sci_idx, char *argv[]); +int ss_pager_create(void); char **ss_rl_completion(const char *text, int start, int end); extern ss_data **_ss_table; -- 1.8.3.1