From b6ea75cfc9712b77a0886c4348d6fb519641e40e Mon Sep 17 00:00:00 2001 From: Karl Ramm Date: Mon, 21 Jan 2008 03:11:44 +0000 Subject: de K&Rify, fix prototypes --- zwgc/X_driver.c | 59 ++++++++-------- zwgc/X_driver.h | 7 +- zwgc/X_fonts.c | 66 +++++++++--------- zwgc/X_fonts.h | 4 +- zwgc/X_gram.c | 66 +++++++++--------- zwgc/X_gram.h | 14 ++-- zwgc/buffer.c | 10 +-- zwgc/buffer.h | 6 +- zwgc/character_class.c | 4 +- zwgc/character_class.h | 2 +- zwgc/dictionary.c | 36 +++++----- zwgc/dictionary.h | 19 ++--- zwgc/eval.c | 14 ++-- zwgc/eval.h | 4 +- zwgc/exec.c | 105 ++++++++++++++-------------- zwgc/exec.h | 2 +- zwgc/file.c | 10 ++- zwgc/file.h | 2 +- zwgc/formatter.c | 53 +++++++------- zwgc/formatter.h | 9 ++- zwgc/lexer.c | 31 +++++---- zwgc/lexer.h | 4 +- zwgc/main.c | 66 ++++++++++-------- zwgc/main.h | 2 +- zwgc/mux.c | 21 +++--- zwgc/mux.h | 6 +- zwgc/new_string.c | 26 +++---- zwgc/new_string.h | 12 ++-- zwgc/node.c | 44 ++++++------ zwgc/node.h | 14 ++-- zwgc/notice.c | 39 +++++------ zwgc/notice.h | 11 +-- zwgc/parser.h | 4 +- zwgc/parser.y | 15 ++-- zwgc/port.c | 162 +++++++++++++++++++++---------------------- zwgc/port.h | 40 +++++------ zwgc/regexp.c | 6 +- zwgc/regexp.h | 2 +- zwgc/standard_ports.c | 47 ++++++------- zwgc/string_dictionary_aux.c | 22 +++--- zwgc/string_dictionary_aux.h | 7 +- zwgc/subscriptions.c | 78 +++++++++++---------- zwgc/subscriptions.h | 10 +-- zwgc/substitute.c | 12 ++-- zwgc/substitute.h | 2 +- zwgc/text_operations.c | 36 +++++----- zwgc/text_operations.h | 15 ++-- zwgc/tty_filter.c | 62 +++++++++-------- zwgc/variables.c | 35 +++++----- zwgc/variables.h | 12 ++-- zwgc/xcut.c | 61 ++++++++-------- zwgc/xerror.c | 14 ++-- zwgc/xerror.h | 4 +- zwgc/xmark.c | 60 +++++++++------- zwgc/xmark.h | 13 ++-- zwgc/xrevstack.c | 50 ++++++------- zwgc/xrevstack.h | 10 +-- zwgc/xselect.c | 51 +++++++------- zwgc/xselect.h | 14 ++-- zwgc/xshow.c | 64 ++++++++--------- zwgc/zephyr.c | 18 ++--- zwgc/zephyr.h | 6 +- 62 files changed, 870 insertions(+), 830 deletions(-) (limited to 'zwgc') diff --git a/zwgc/X_driver.c b/zwgc/X_driver.c index 925a05b..2577966 100644 --- a/zwgc/X_driver.c +++ b/zwgc/X_driver.c @@ -27,6 +27,7 @@ static const char rcsid_X_driver_c[] = "$Id$"; #ifndef X_DISPLAY_MISSING +#include "new_string.h" #include "X_driver.h" #include #include "new_memory.h" @@ -84,8 +85,8 @@ static XrmDatabase x_resources = NULL; * returns -1. */ -static int convert_string_to_bool(text) - string text; +static int +convert_string_to_bool(string text) { if (!strcasecmp("yes", text) || !strcasecmp("y", text) || !strcasecmp("true", text) || !strcasecmp("t", text) || @@ -103,9 +104,9 @@ static int convert_string_to_bool(text) * */ -char *get_string_resource(name, class) - string name; - string class; +char * +get_string_resource(string name, + string class) { string full_name, full_class; int status; @@ -134,10 +135,10 @@ char *get_string_resource(name, class) * */ -int get_bool_resource(name, class, default_value) - string name; - string class; - int default_value; +int +get_bool_resource(string name, + string class, + int default_value) { int result; char *temp; @@ -165,9 +166,9 @@ static unsigned_long_dictionary color_dict = NULL; * trip each time. */ -unsigned long x_string_to_color(name,def) - char *name; - unsigned long def; +unsigned long +x_string_to_color(char *name, + unsigned long def) { unsigned_long_dictionary_binding *binding; int exists; @@ -236,14 +237,13 @@ static XrmOptionDescRec cmd_options[] = { * */ -int open_display_and_load_resources(pargc, argv) - int *pargc; - char **argv; +int +open_display_and_load_resources(int *pargc, + char **argv) { XrmDatabase temp_db1, temp_db2, temp_db3; char *filename, *res, *xdef; char dbasename[128]; - extern char *getenv(); /* Initialize X resource manager: */ XrmInitialize(); @@ -316,11 +316,9 @@ int open_display_and_load_resources(pargc, argv) * */ -int X_driver_ioerror(display) -Display *display; +int +X_driver_ioerror(Display *display) { - extern void finalize_zephyr(); - ERROR2("X IO error on display '%s'--exiting\n", DisplayString(display)); finalize_zephyr(); exit(1); @@ -331,14 +329,12 @@ Display *display; /* */ /****************************************************************************/ -extern void x_get_input(); - /*ARGSUSED*/ -int X_driver_init(drivername, notfirst, pargc, argv) - char *drivername; - char notfirst; - int *pargc; - char **argv; +int +X_driver_init(char *drivername, + char notfirst, + int *pargc, + char **argv) { string temp; int sync; @@ -373,12 +369,13 @@ int X_driver_init(drivername, notfirst, pargc, argv) x_gram_init(dpy); xicccmInitAtoms(dpy); - mux_add_input_source(ConnectionNumber(dpy), x_get_input, dpy); + mux_add_input_source(ConnectionNumber(dpy), (void(*)(void *))x_get_input, dpy); return(0); } -void X_driver_reset() +void +X_driver_reset(void) { } @@ -388,8 +385,8 @@ void X_driver_reset() /* */ /****************************************************************************/ -char *X_driver(text) - string text; +char * +X_driver(string text) { string text_copy; desctype *desc; diff --git a/zwgc/X_driver.h b/zwgc/X_driver.h index ec2492f..b32562e 100644 --- a/zwgc/X_driver.h +++ b/zwgc/X_driver.h @@ -19,9 +19,12 @@ #include +#include "new_string.h" + extern Display *dpy; -extern char *get_string_resource(); -extern int get_bool_resource(); +extern char *get_string_resource(string, string); +extern int get_bool_resource(string, string, int); +extern unsigned long x_string_to_color(char *, unsigned long); #endif diff --git a/zwgc/X_fonts.c b/zwgc/X_fonts.c index 9358383..95e21d5 100644 --- a/zwgc/X_fonts.c +++ b/zwgc/X_fonts.c @@ -51,11 +51,9 @@ static pointer_dictionary fidst_dict = NULL; static string face_to_string[] = { "roman", "bold", "italic", "bolditalic" }; static string size_to_string[] = { "small", "medium", "large" }; -extern char *get_string_resources(); - -static char *get_family(style,substyle) - char *style; - char *substyle; +static char * +get_family(char *style, + char *substyle) { char *desc; pointer_dictionary_binding *binding; @@ -87,10 +85,10 @@ static char *get_family(style,substyle) } } -static char *get_specific_fontname(family,size,face) - char *family; - int size; - int face; +static char * +get_specific_fontname(char *family, + int size, + int face) { char *desc; pointer_dictionary_binding *binding; @@ -127,8 +125,8 @@ static char *get_specific_fontname(family,size,face) * that I know that Font us really an unsigned long. */ static char hexdigits[] = {"0123456789ABCDEF"}; -static char *Font_to_hex(num) - Font num; +static char * +Font_to_hex(Font num) { char *temp; int i; @@ -142,8 +140,8 @@ static char *Font_to_hex(num) return(temp); } -void add_fid(font) - XFontStruct *font; +void +add_fid(XFontStruct *font) { char *fidstr; @@ -161,8 +159,8 @@ void add_fid(font) } /* requires that the font already be cached. */ -XFontStruct *get_fontst_from_fid(fid) - Font fid; +XFontStruct * +get_fontst_from_fid(Font fid) { char *fidstr; pointer_dictionary_binding *binding; @@ -184,9 +182,9 @@ XFontStruct *get_fontst_from_fid(fid) #endif } -static XFontStruct *get_fontst(dpy,fontname) - Display *dpy; - char *fontname; +static XFontStruct * +get_fontst(Display *dpy, + char *fontname) { pointer_dictionary_binding *binding; int exists; @@ -209,10 +207,10 @@ static XFontStruct *get_fontst(dpy,fontname) } } -static char *get_fontname(family,size,face) - char *family; - int size; - int face; +static char * +get_fontname(char *family, + int size, + int face) { char *fontname; @@ -223,12 +221,12 @@ static char *get_fontname(family,size,face) return(fontname); } -static XFontStruct *complete_get_fontst(dpy,style,substyle,size,face) - Display *dpy; - string style; - string substyle; - int size; - int face; +static XFontStruct * +complete_get_fontst(Display *dpy, + string style, + string substyle, + int size, + int face) { char *family,*fontname; XFontStruct *fontst; @@ -249,12 +247,12 @@ static XFontStruct *complete_get_fontst(dpy,style,substyle,size,face) * Effects: unknown */ -XFontStruct *get_font(dpy,style,substyle,size,face) - Display *dpy; - string style; - string substyle; - int size; - int face; +XFontStruct * +get_font(Display *dpy, + string style, + string substyle, + int size, + int face) { char *family,*fontname; XFontStruct *fontst; diff --git a/zwgc/X_fonts.h b/zwgc/X_fonts.h index 9a0a2f9..62469c8 100644 --- a/zwgc/X_fonts.h +++ b/zwgc/X_fonts.h @@ -41,7 +41,7 @@ * specified by default.medium.roman is used. <<<>>> */ -extern XFontStruct *get_font(); -extern XFontStruct *get_fontst_from_fid(); +extern XFontStruct *get_font(Display *, string, string, int, int); +extern XFontStruct *get_fontst_from_fid(Font); #endif diff --git a/zwgc/X_gram.c b/zwgc/X_gram.c index d5879b3..96e8fb1 100644 --- a/zwgc/X_gram.c +++ b/zwgc/X_gram.c @@ -37,8 +37,6 @@ static const char rcsid_X_gram_c[] = "$Id$"; extern XContext desc_context; extern char *app_instance; -extern unsigned long x_string_to_color(); -extern char *getenv(); /* * @@ -89,14 +87,14 @@ static Atom net_wm_window_type_utility = None; */ /*ARGSUSED*/ -void x_set_icccm_hints(dpy,w,name,icon_name,psizehints,pwmhints,main_window) - Display *dpy; - Window w; - char *name; - char *icon_name; - XSizeHints *psizehints; - XWMHints *pwmhints; - Window main_window; +void +x_set_icccm_hints(Display *dpy, + Window w, + char *name, + char *icon_name, + XSizeHints *psizehints, + XWMHints *pwmhints, + Window main_window) { XStoreName(dpy,w,name); XSetIconName(dpy,w,icon_name); @@ -113,8 +111,8 @@ void x_set_icccm_hints(dpy,w,name,icon_name,psizehints,pwmhints,main_window) XSetWMProtocols(dpy,w,&XA_WM_DELETE_WINDOW,1); } -void x_gram_init(dpy) - Display *dpy; +void +x_gram_init(Display *dpy) { char *temp; XSizeHints sizehints; @@ -261,8 +259,9 @@ void x_gram_init(dpy) } } -int x_calc_gravity(xalign, yalign) - int xalign, yalign; +int +x_calc_gravity(int xalign, + int yalign) { if (yalign > 0) { /* North */ return (xalign > 0) ? NorthWestGravity @@ -279,21 +278,22 @@ int x_calc_gravity(xalign, yalign) } } -void x_gram_create(dpy, gram, xalign, yalign, xpos, ypos, xsize, ysize, - beepcount) - Display *dpy; - x_gram *gram; - int xalign, yalign; - int xpos, ypos; - int xsize, ysize; - int beepcount; +void +x_gram_create(Display *dpy, + x_gram *gram, + int xalign, + int yalign, + int xpos, + int ypos, + int xsize, + int ysize, + int beepcount) { Window w; XSizeHints sizehints; XWMHints wmhints; XSetWindowAttributes attributes; unsigned long all_desktops = 0xFFFFFFFF; - extern void x_get_input(); /* * Adjust xpos, ypos based on the alignments xalign, yalign and the sizes: @@ -397,11 +397,11 @@ void x_gram_create(dpy, gram, xalign, yalign, xpos, ypos, xsize, ysize, x_get_input(dpy); } -void x_gram_draw(dpy, w, gram, region) - Display *dpy; - Window w; - x_gram *gram; - Region region; +void +x_gram_draw(Display *dpy, + Window w, + x_gram *gram, + Region region) { int i; GC gc; @@ -493,11 +493,11 @@ void x_gram_draw(dpy, w, gram, region) XFreeGC(dpy,gc); } -void x_gram_expose(dpy,w,gram,event) - Display *dpy; - Window w; - x_gram *gram; - XExposeEvent *event; +void +x_gram_expose(Display *dpy, + Window w, + x_gram *gram, + XExposeEvent *event) { static Region region; static int partregion; diff --git a/zwgc/X_gram.h b/zwgc/X_gram.h index 33623f1..5d3f5d0 100644 --- a/zwgc/X_gram.h +++ b/zwgc/X_gram.h @@ -18,8 +18,11 @@ #define x_gram_TYPE #include +#include #include +#include "formatter.h" + typedef struct _xblock { unsigned long fgcolor; Font fid; @@ -73,10 +76,11 @@ typedef struct _xlinedesc { #define CENTERALIGN 1 #define RIGHTALIGN 2 -extern void x_gram_init(); -extern void x_gram_create(); -extern void x_gram_expose(); -extern void xshow(); -extern void xcut(); +extern void x_gram_init(Display *); +extern void x_gram_create(Display *, x_gram *, int, int, int, int, int, int, int); +extern void x_gram_expose(Display *, Window, x_gram *, XExposeEvent *); +extern void xshow(Display *, desctype *, int, int); +extern void xcut(Display *, XEvent *, XContext); +extern void x_get_input(Display *); #endif diff --git a/zwgc/buffer.c b/zwgc/buffer.c index 4b46c22..8c047af 100644 --- a/zwgc/buffer.c +++ b/zwgc/buffer.c @@ -24,12 +24,14 @@ static const char rcsid_buffer_c[] = "$Id$"; static char *buffer = 0; -string buffer_to_string() +string +buffer_to_string(void) { return(buffer); } -void clear_buffer() +void +clear_buffer(void) { if (buffer) free(buffer); @@ -37,8 +39,8 @@ void clear_buffer() buffer = string_Copy(""); } -void append_buffer(str) - char *str; +void +append_buffer(char *str) { buffer = string_Concat2(buffer, str); } diff --git a/zwgc/buffer.h b/zwgc/buffer.h index 8b9e5b2..db3f2ea 100644 --- a/zwgc/buffer.h +++ b/zwgc/buffer.h @@ -19,8 +19,8 @@ #include "new_string.h" -extern string buffer_to_string(); -extern void clear_buffer(); -extern void append_buffer(); +extern string buffer_to_string(void); +extern void clear_buffer(void); +extern void append_buffer(char *); #endif diff --git a/zwgc/character_class.c b/zwgc/character_class.c index f14e600..a11aa86 100644 --- a/zwgc/character_class.c +++ b/zwgc/character_class.c @@ -29,8 +29,8 @@ static const char rcsid_character_class_c[] = "$Id$"; static character_class cache; /* character_class */ -char * string_to_character_class(str) - string str; +char * +string_to_character_class(string str) { int i; diff --git a/zwgc/character_class.h b/zwgc/character_class.h index 1ead477..050b282 100644 --- a/zwgc/character_class.h +++ b/zwgc/character_class.h @@ -23,6 +23,6 @@ typedef char character_class[NUMBER_OF_CHARACTERS]; -extern /* character_class */ char * string_to_character_class(); +extern /* character_class */ char * string_to_character_class(string); #endif diff --git a/zwgc/dictionary.c b/zwgc/dictionary.c index c30d73f..f6a3c74 100644 --- a/zwgc/dictionary.c +++ b/zwgc/dictionary.c @@ -66,8 +66,8 @@ static const char rcsid_dictionary_c[] = "$Id$"; * that size is a prime number. */ -TYPE_T_dictionary TYPE_T_dictionary_Create(size) - int size; +TYPE_T_dictionary +TYPE_T_dictionary_Create(int size) { int i; TYPE_T_dictionary result; @@ -94,8 +94,8 @@ TYPE_T_dictionary TYPE_T_dictionary_Create(size) * TYPE_T_dictionary_Enumerate. */ -void TYPE_T_dictionary_Destroy(d) - TYPE_T_dictionary d; +void +TYPE_T_dictionary_Destroy(TYPE_T_dictionary d) { int i; TYPE_T_dictionary_binding *binding_ptr, *new_binding_ptr; @@ -124,9 +124,8 @@ void TYPE_T_dictionary_Destroy(d) * writable by proc. */ -void TYPE_T_dictionary_Enumerate(d, proc) - TYPE_T_dictionary d; - void (*proc)(/* TYPE_T_dictionary_binding *b */); +void TYPE_T_dictionary_Enumerate(TYPE_T_dictionary d, + void (*proc)(TYPE_T_dictionary_binding *)) { int i; TYPE_T_dictionary_binding *binding_ptr; @@ -149,8 +148,8 @@ void TYPE_T_dictionary_Enumerate(d, proc) * keys over the table's slots. */ -static unsigned int dictionary__hash(s) - char *s; +static unsigned int +dictionary__hash(char *s) { unsigned int result = 0; @@ -174,9 +173,9 @@ static unsigned int dictionary__hash(s) * Note the access restrictions on bindings... */ -TYPE_T_dictionary_binding *TYPE_T_dictionary_Lookup(d, key) - TYPE_T_dictionary d; - char *key; +TYPE_T_dictionary_binding * +TYPE_T_dictionary_Lookup(TYPE_T_dictionary d, + char *key) { TYPE_T_dictionary_binding *binding_ptr; @@ -206,10 +205,10 @@ TYPE_T_dictionary_binding *TYPE_T_dictionary_Lookup(d, key) * in this case. */ -TYPE_T_dictionary_binding *TYPE_T_dictionary_Define(d, key, already_existed) - TYPE_T_dictionary d; - char *key; - int *already_existed; +TYPE_T_dictionary_binding * +TYPE_T_dictionary_Define(TYPE_T_dictionary d, + char *key, + int *already_existed) { TYPE_T_dictionary_binding **ptr_to_the_slot, *binding_ptr; @@ -245,9 +244,8 @@ TYPE_T_dictionary_binding *TYPE_T_dictionary_Define(d, key, already_existed) * before making this call. */ -void TYPE_T_dictionary_Delete(d, b) - TYPE_T_dictionary d; - TYPE_T_dictionary_binding *b; +void TYPE_T_dictionary_Delete(TYPE_T_dictionary d, + TYPE_T_dictionary_binding *b) { TYPE_T_dictionary_binding **ptr_to_binding_ptr; diff --git a/zwgc/dictionary.h b/zwgc/dictionary.h index b9d9312..d3f77be 100644 --- a/zwgc/dictionary.h +++ b/zwgc/dictionary.h @@ -37,7 +37,7 @@ typedef struct _TYPE_T_dictionary { /* PRIVATE */ * that size is a prime number. */ -extern TYPE_T_dictionary TYPE_T_dictionary_Create(/* int size */); +extern TYPE_T_dictionary TYPE_T_dictionary_Create(int); /* * void TYPE_T_dictionary_Destroy(TYPE_T_dictionary d): @@ -50,10 +50,11 @@ extern TYPE_T_dictionary TYPE_T_dictionary_Create(/* int size */); * TYPE_T_dictionary_Enumerate. */ -extern void TYPE_T_dictionary_Destroy(/* TYPE_T_dictionary d */); +extern void TYPE_T_dictionary_Destroy(TYPE_T_dictionary); /* - * void TYPE_T_dictionary_Enumerate(TYPE_T_dictionary d; void (*proc)()): + * void TYPE_T_dictionary_Enumerate(TYPE_T_dictionary d; + * void (*proc)(TYPE_T_dictionary_binding *b)): * Requires: proc is a void procedure taking 1 argument, a * TYPE_T_dictionary_binding pointer, which does not * make any calls using dictionary d. @@ -63,8 +64,7 @@ extern void TYPE_T_dictionary_Destroy(/* TYPE_T_dictionary d */); * writable by proc. */ -extern void TYPE_T_dictionary_Enumerate(/* TYPE_T_dictionary d, - void (*proc)() */); +extern void TYPE_T_dictionary_Enumerate(TYPE_T_dictionary, void (*)(TYPE_T_dictionary_binding *)); /* * TYPE_T_dictionary_binding *TYPE_T_dictionary_Lookup(TYPE_T_dictionary d, @@ -74,7 +74,8 @@ extern void TYPE_T_dictionary_Enumerate(/* TYPE_T_dictionary d, * Note the access restrictions on bindings... */ -extern TYPE_T_dictionary_binding *TYPE_T_dictionary_Lookup(/* d, key */); +extern TYPE_T_dictionary_binding *TYPE_T_dictionary_Lookup(TYPE_T_dictionary, + char *); /* * TYPE_T_dictionary_binding *TYPE_T_dictionary_Define(TYPE_T_dictionary d, @@ -92,7 +93,8 @@ extern TYPE_T_dictionary_binding *TYPE_T_dictionary_Lookup(/* d, key */); * in this case. */ -extern TYPE_T_dictionary_binding *TYPE_T_dictionary_Define(); +extern TYPE_T_dictionary_binding *TYPE_T_dictionary_Define(TYPE_T_dictionary, + char *, int *); /* * void TYPE_T_dictionary_Delete(TYPE_T_dictionary d, @@ -104,6 +106,7 @@ extern TYPE_T_dictionary_binding *TYPE_T_dictionary_Define(); * before making this call. */ -extern void TYPE_T_dictionary_Delete(); +extern void TYPE_T_dictionary_Delete(TYPE_T_dictionary, + TYPE_T_dictionary_binding *); #endif diff --git a/zwgc/eval.c b/zwgc/eval.c index 0bf8d1c..33c4140 100644 --- a/zwgc/eval.c +++ b/zwgc/eval.c @@ -33,6 +33,7 @@ static const char rcsid_eval_c[] = "$Id$"; #include "port.h" #include "buffer.h" #include "regexp.h" +#include "formatter.h" #include "text_operations.h" #include "zwgc.h" #include "variables.h" @@ -65,8 +66,8 @@ static const char rcsid_eval_c[] = "$Id$"; * eventually. */ -static string bool_to_string(bool) - int bool; +static string +bool_to_string(int bool) { return(bool ? string_Copy("TRUE") : string_Copy("FALSE")); } @@ -79,8 +80,8 @@ static string bool_to_string(bool) * NULL is defined to have the boolean value true. */ -int eval_bool_expr(expr) - Node *expr; +int +eval_bool_expr(Node *expr) { string temp; int result; @@ -110,15 +111,14 @@ int eval_bool_expr(expr) * eventually. */ -string eval_expr(expr) - Node *expr; +string +eval_expr(Node *expr) { int opcode = expr->opcode; int bool_result; string first, second; char *result; string *text_ptr; - char *getenv(); /* UNIX get environment variable function */ /* * Dispatch based on the opcode of the top node in the expression: diff --git a/zwgc/eval.h b/zwgc/eval.h index d664794..427f713 100644 --- a/zwgc/eval.h +++ b/zwgc/eval.h @@ -28,7 +28,7 @@ * eventually. */ -extern string eval_expr(); +extern string eval_expr(Node *); /* * int eval_bool_expr(Node *expr) @@ -38,6 +38,6 @@ extern string eval_expr(); * NULL is defined to have the boolean value true. */ -extern int eval_bool_expr(); +extern int eval_bool_expr(Node *); #endif diff --git a/zwgc/exec.c b/zwgc/exec.c index 1bf8f72..f24bcb8 100644 --- a/zwgc/exec.c +++ b/zwgc/exec.c @@ -27,15 +27,16 @@ static const char rcsid_exec_c[] = "$Id$"; #include #include "new_memory.h" +#include "node.h" #include "exec.h" #include "eval.h" -#include "node.h" #include "buffer.h" #include "port.h" #include "variables.h" #include "notice.h" -static int exec_subtree(), exec_fields(); +static int exec_subtree(Node *); +static int exec_fields(Node *); /****************************************************************************/ /* */ @@ -43,8 +44,8 @@ static int exec_subtree(), exec_fields(); /* */ /****************************************************************************/ -static string eval_exprlist_to_string(exprlist) - Node *exprlist; +static string +eval_exprlist_to_string(Node *exprlist) { string result = string_Copy(""); string temp; @@ -64,8 +65,8 @@ static string eval_exprlist_to_string(exprlist) return(result); } -static char **eval_exprlist_to_args(exprlist) - Node *exprlist; +static char ** +eval_exprlist_to_args(Node *exprlist) { char **result = (char **)malloc(sizeof(char *)); int argc = 0; @@ -80,8 +81,8 @@ static char **eval_exprlist_to_args(exprlist) return(result); } -static void free_args(args) - char **args; +static void +free_args(char **args) { char **p; @@ -103,28 +104,28 @@ static void free_args(args) #define EXIT 2 /*ARGSUSED*/ -static int exec_noop(node) - Node *node; +static int +exec_noop(Node *node) { return(NOBREAK); } /*ARGSUSED*/ -static int exec_break(node) - Node *node; +static int +exec_break(Node *node) { return(BREAK); } /*ARGSUSED*/ -static int exec_exit(node) - Node *node; +static int +exec_exit(Node *node) { return(EXIT); } -static int exec_set(node) - Node *node; +static int +exec_set(Node *node) { var_set_variable_then_free_value(node->d.nodes.first->d.string_constant, eval_expr(node->d.nodes.second)); @@ -132,8 +133,8 @@ static int exec_set(node) return(NOBREAK); } -static int exec_execport(node) - Node *node; +static int +exec_execport(Node *node) { string name = eval_expr(node->d.nodes.first); char **argv = eval_exprlist_to_args(node->d.nodes.second); @@ -145,8 +146,8 @@ static int exec_execport(node) return(NOBREAK); } -static int exec_appendport(node) - Node *node; +static int +exec_appendport(Node *node) { string name, filename; @@ -160,8 +161,8 @@ static int exec_appendport(node) return(NOBREAK); } -static int exec_inputport(node) - Node *node; +static int +exec_inputport(Node *node) { string name, filename; @@ -175,8 +176,8 @@ static int exec_inputport(node) return(NOBREAK); } -static int exec_outputport(node) - Node *node; +static int +exec_outputport(Node *node) { string name, filename; @@ -190,8 +191,8 @@ static int exec_outputport(node) return(NOBREAK); } -static int exec_closeinput(node) - Node *node; +static int +exec_closeinput(Node *node) { string name; @@ -202,8 +203,8 @@ static int exec_closeinput(node) return(NOBREAK); } -static int exec_closeoutput(node) - Node *node; +static int +exec_closeoutput(Node *node) { string name; @@ -214,8 +215,8 @@ static int exec_closeoutput(node) return(NOBREAK); } -static int exec_closeport(node) - Node *node; +static int +exec_closeport(Node *node) { string name; @@ -227,8 +228,8 @@ static int exec_closeport(node) return(NOBREAK); } -static int exec_put(node) - Node *node; +static int +exec_put(Node *node) { string name, temp; @@ -249,8 +250,8 @@ static int exec_put(node) return(NOBREAK); } -static int exec_print(node) - Node *node; +static int +exec_print(Node *node) { string temp; @@ -262,16 +263,16 @@ static int exec_print(node) } /*ARGSUSED*/ -static int exec_clearbuf(node) - Node *node; +static int +exec_clearbuf(Node *node) { clear_buffer(); return(NOBREAK); } -static int exec_case(node) - Node *node; +static int +exec_case(Node *node) { string constant,temp; Node *match, *cond; @@ -300,8 +301,8 @@ static int exec_case(node) return(NOBREAK); } -static int exec_while(node) - Node *node; +static int +exec_while(Node *node) { int continue_code = NOBREAK; @@ -317,8 +318,8 @@ static int exec_while(node) return(continue_code); } -static int exec_if(node) - Node *node; +static int +exec_if(Node *node) { Node *conds; @@ -329,8 +330,8 @@ static int exec_if(node) return(NOBREAK); } -static int exec_exec(node) - Node *node; +static int +exec_exec(Node *node) { int pid; char **argv = eval_exprlist_to_args(node->d.nodes.first); @@ -351,7 +352,7 @@ static int exec_exec(node) } static struct _Opstuff { - int (*exec)(); + int (*exec)(Node *); } const opstuff[] = { { exec_noop }, /* string_constant */ { exec_noop }, /* varref */ @@ -412,8 +413,8 @@ static struct _Opstuff { { exec_noop }, /* default */ }; -static int exec_subtree(node) - Node *node; +static int +exec_subtree(Node *node) { int retval = NOBREAK; @@ -432,8 +433,8 @@ static char *notice_fields; static int notice_fields_length = 0; static int number_of_fields = 0; -static int exec_fields(node) - Node *node; +static int +exec_fields(Node *node) { for (node=node->d.nodes.first; node; node=node->next) { var_set_variable_then_free_value(node->d.string_constant, @@ -448,9 +449,9 @@ static int exec_fields(node) return(NOBREAK); } -void exec_process_packet(program, notice) - Node *program; - ZNotice_t *notice; +void +exec_process_packet(Node *program, + ZNotice_t *notice) { notice_fields = notice->z_message; notice_fields_length = notice->z_message_len; diff --git a/zwgc/exec.h b/zwgc/exec.h index 7eebc20..db691dd 100644 --- a/zwgc/exec.h +++ b/zwgc/exec.h @@ -17,6 +17,6 @@ #ifndef exec_MODULE #define exec_MODULE -extern void exec_process_packet(); +extern void exec_process_packet(Node *, ZNotice_t *); #endif diff --git a/zwgc/file.c b/zwgc/file.c index 1f3fc62..b3ba8fa 100644 --- a/zwgc/file.c +++ b/zwgc/file.c @@ -38,10 +38,9 @@ static const char rcsid_file_c[] = "$Id$"; * if necessary. */ -char *get_home_directory() +char *get_home_directory(void) { char *result; - char *getenv(); struct passwd *passwd_entry; if (result = getenv("HOME")) @@ -57,10 +56,9 @@ char *get_home_directory() * */ -FILE *locate_file(override_filename, home_dir_filename, fallback_filename) - char *override_filename; - char *home_dir_filename; - char *fallback_filename; +FILE *locate_file(char *override_filename, + char *home_dir_filename, + char *fallback_filename) { char *filename; FILE *result; diff --git a/zwgc/file.h b/zwgc/file.h index b0aff1f..3f185bf 100644 --- a/zwgc/file.h +++ b/zwgc/file.h @@ -19,6 +19,6 @@ #include -extern FILE *locate_file(); +extern FILE *locate_file(char *, char *, char *); #endif diff --git a/zwgc/formatter.c b/zwgc/formatter.c index c900c9f..923268e 100644 --- a/zwgc/formatter.c +++ b/zwgc/formatter.c @@ -30,7 +30,8 @@ static const char rcsid_formatter_c[] = "$Id$"; #define const #endif -static int pure_text_length(), env_length(); +static int pure_text_length(char *, char); +static int env_length(char *); #ifdef notdef static character_class atsign_set = { /* '@' = 0x40 */ @@ -171,17 +172,17 @@ static char brackets[]="()<>[]{}@"; static char *openbracket[]={"@<","@<","@[","@[","@{","@{","@(","@(","@("}; static char *closebracket[]={">",">","]","]","}","}",")",")",")"}; -static int not_contains(str, set) - string str; - const character_class set; +static int +not_contains(string str, + const character_class set) { while (*str && ! set[*str]) str++; return (! *str); } -static int pure_text_length(text,terminator) - char *text; - char terminator; +static int +pure_text_length(char *text, + char terminator) { int len=0; @@ -205,8 +206,8 @@ static int pure_text_length(text,terminator) } } -static char otherside(opener) -char opener; +static char +otherside(char opener) { switch (opener) { case '(': @@ -227,9 +228,8 @@ char opener; /* the char * that str points to is free'd by this function. * if you want to keep it, save it yourself */ -string verbatim(str, bracketsonly) - string str; - int bracketsonly; +string +verbatim(string str, int bracketsonly) { char *temp,*temp2; int bracketnum,len; @@ -306,8 +306,8 @@ string verbatim(str, bracketsonly) or the default terminator \0. The text will not be modified, and @@ will be counted twice */ -string protect(str) - string str; +string +protect(string str) { string temp,temp2,temp3; int len,templen; @@ -375,8 +375,8 @@ string protect(str) /* str points to a string. return value is another string which is the original with all styles removed. */ -string stylestrip(str) - string str; +string +stylestrip(string str) { int templen = 0, otherchar; char *temp = (char *) malloc(string_Length(str) + 1); @@ -418,8 +418,8 @@ string stylestrip(str) return(temp); } -void free_desc(desc) - desctype *desc; +void +free_desc(desctype *desc) { desctype *next_desc; @@ -434,8 +434,8 @@ void free_desc(desc) /* text points to beginning of possible env name. return value is length of env name, not including @ or opener, or -1 if not a possible env name. */ -static int env_length(text) - char *text; +static int +env_length(char *text) { int len=0; @@ -454,9 +454,9 @@ static int env_length(text) length of string, up to but not including the passed terminator or the default terminators \0 \n @. This can modify text, and 0 is a valid return value. */ -static int text_length(text,terminator) - char *text; - char terminator; +static int +text_length(char *text, + char terminator) { int len=0; @@ -482,9 +482,10 @@ static int text_length(text,terminator) /* parses str into a desc linked list. Returns number of strings and newlines in *pstr and *pnl */ -desctype *disp_get_cmds(str,pstr,pnl) -char *str; -int *pstr,*pnl; +desctype * +disp_get_cmds(char *str, + int *pstr, + int *pnl) { desctype *desc,*here; int len; diff --git a/zwgc/formatter.h b/zwgc/formatter.h index 0a76687..d2cf0f0 100644 --- a/zwgc/formatter.h +++ b/zwgc/formatter.h @@ -14,6 +14,8 @@ #include +#include "new_string.h" + #ifndef formatter_MODULE #define formatter_MODULE @@ -32,7 +34,10 @@ typedef struct _desctype { ENV, STR, END. Undefined for EOF */ } desctype; -extern desctype *disp_get_cmds(); -extern void free_desc(); +extern desctype *disp_get_cmds(char *, int *, int *); +extern void free_desc(desctype *); +extern string protect(string); +extern string verbatim(string, int); +extern string stylestrip(string); #endif diff --git a/zwgc/lexer.c b/zwgc/lexer.c index 16e04e6..7e32086 100644 --- a/zwgc/lexer.c +++ b/zwgc/lexer.c @@ -64,7 +64,8 @@ static FILE *input_file; static int pushback = -1; -static char input() +static char +input(void) { int c; @@ -85,8 +86,8 @@ static char input() return(c); } -static void unput(c) - int c; +static void +unput(int c) { #ifdef DEBUG if (pushback != -1) { @@ -171,8 +172,8 @@ static struct keyword_info keywords[] = { * a file. Resets current line # to 1. */ -void lex_open(file) - FILE *file; +void +lex_open(FILE *file) { /* * Initialize I/O: @@ -219,7 +220,8 @@ void lex_open(file) #define is_octal_digit(c) (((c)>='0') && ((c)<='7')) -static char eat_escape_code() +static char +eat_escape_code(void) { int c, coded_char; @@ -269,8 +271,8 @@ static char eat_escape_code() * string we are eating started on. */ -static char *eat_string(starting_line) - int starting_line; +static char * +eat_string(int starting_line) { int c; char buffer[500]; @@ -343,8 +345,8 @@ static char *eat_string(starting_line) * instead of doing the above, we just eat the "endshow" & return 0. */ -static char *eat_show_line(test_for_endshow) - int test_for_endshow; +static char * +eat_show_line(int test_for_endshow) { int c; int saw_escape_code = 0; @@ -408,8 +410,8 @@ static char *eat_show_line(test_for_endshow) * messages. */ -static char *eat_til_endshow(start_line_no) - int start_line_no; +static char * +eat_til_endshow(int start_line_no) { register int c; string text_so_far = string_Copy(""); @@ -453,7 +455,8 @@ static char *eat_til_endshow(start_line_no) * returned. */ -static int handle_show() +static int +handle_show(void) { int c; int start_line_no = yylineno; @@ -483,7 +486,7 @@ static int handle_show() * yylex - performs as per. the yacc manual's requirements */ -int yylex() +int yylex(void) { register int c, last_char; register char *ptr; diff --git a/zwgc/lexer.h b/zwgc/lexer.h index fd76e8f..0cda2b4 100644 --- a/zwgc/lexer.h +++ b/zwgc/lexer.h @@ -48,12 +48,12 @@ extern int yylineno; * a file. Resets current line # to 1. */ -extern void lex_open(/* FILE *file */); +extern void lex_open(FILE *); /* * yylex - performs as per. the yacc manual's requirements */ -extern int yylex(); +/* extern int yylex(); */ #endif diff --git a/zwgc/main.c b/zwgc/main.c index 52b9e7a..3568443 100644 --- a/zwgc/main.c +++ b/zwgc/main.c @@ -40,10 +40,13 @@ static const char rcsid_main_c[] = "$Id$"; #include "variables.h" #include "main.h" -extern void notice_handler(); -static void process_notice(), setup_signals(), detach(), signal_exit(); +void notice_handler(ZNotice_t *); +static void process_notice(ZNotice_t *, char *); +static void setup_signals(int); +static void detach(void); +static void signal_exit(int); #ifdef HAVE_ARES -static void notice_callback(); +static void notice_callback(void *, int, struct hostent *); #endif /* @@ -105,7 +108,8 @@ static struct _Node *program = NULL; * <<<>>> */ -static void fake_startup_packet() +static void +fake_startup_packet(void) { ZNotice_t notice; struct timezone tz; @@ -122,7 +126,7 @@ static void fake_startup_packet() notice.z_default_format = "Zwgc mark II version $version now running...\n"; notice.z_recipient = ""; notice.z_sender = "ZWGC"; - gettimeofday(¬ice.z_time,&tz); + Z_gettimeofday(¬ice.z_time, &tz); notice.z_port = 0; notice.z_kind = ACKED; notice.z_auth = ZAUTH_YES; @@ -134,7 +138,8 @@ static void fake_startup_packet() process_notice(¬ice, NULL); } -static void read_in_description_file() +static void +read_in_description_file(void) { FILE *input_file; char defdesc[128]; @@ -163,7 +168,8 @@ static void read_in_description_file() * program with error code 1. */ -void usage() +void +usage(void) { #ifdef DEBUG fprintf(stderr, "\ @@ -185,7 +191,8 @@ zwgc: usage: zwgc [-f ] [-subfile ]\n\ * <<<>>> */ -static void run_initprogs() +static void +run_initprogs(void) { /* * This code stolen from old zwgc: yuck. Clean up & fix. <<<>>> @@ -214,9 +221,9 @@ static void run_initprogs() * main -- the program entry point. Does parsing & top level control. */ -int main(argc, argv) - int argc; - char **argv; +int +main(int argc, + char **argv) { char **new; register char **current; @@ -321,8 +328,8 @@ int main(argc, argv) #define USER_SUPPRESS "SUPPRESS" #define USER_UNSUPPRESS "UNSUPPRESS" -void notice_handler(notice) - ZNotice_t *notice; +void +notice_handler(ZNotice_t *notice) { struct hostent *fromhost = NULL; @@ -343,10 +350,10 @@ void notice_handler(notice) } #ifdef HAVE_ARES -static void notice_callback(arg, status, fromhost) - void *arg; - int status; - struct hostent *fromhost; +static void +notice_callback(void *arg, + int status, + struct hostent *fromhost) { ZNotice_t *notice = (ZNotice_t *) arg; @@ -356,9 +363,9 @@ static void notice_callback(arg, status, fromhost) } #endif -static void process_notice(notice, hostname) - ZNotice_t *notice; - char *hostname; +static void +process_notice(ZNotice_t *notice, + char *hostname) { char *control_opcode; @@ -400,7 +407,7 @@ static void process_notice(notice, hostname) free(instance); free(recipient); } else if (!strcasecmp(control_opcode, USER_EXIT)) { - signal_exit(); + signal_exit(0); } else printf("zwgc: unknown control opcode %s.\n", control_opcode); @@ -434,21 +441,22 @@ static void process_notice(notice, hostname) * */ -static void signal_exit() +static void +signal_exit(int ignored) { mux_end_loop_p = 1; } /* clean up ALL the waiting children, in case we get hit with multiple SIGCHLD's at once, and don't process in time. */ -static RETSIGTYPE signal_child() +static RETSIGTYPE +signal_child(int ignored) { #ifdef HAVE_WAITPID int status; #else union wait status; #endif - extern int errno; int pid, old_errno = errno; do { @@ -462,13 +470,14 @@ static RETSIGTYPE signal_child() } /* rewrite the wgfile in case it has gone away */ -static RETSIGTYPE signal_usr1() +static RETSIGTYPE +signal_usr1(int ignored) { write_wgfile(); } -static void setup_signals(dofork) - int dofork; +static void +setup_signals(int dofork) { #ifdef _POSIX_VERSION struct sigaction sa; @@ -525,7 +534,8 @@ static void setup_signals(dofork) /* detach() taken from old zwgc, with lots of stuff ripped out */ -static void detach() +static void +detach(void) { /* detach from terminal and fork. */ register int i; diff --git a/zwgc/main.h b/zwgc/main.h index 7b6405d..3d6ea05 100644 --- a/zwgc/main.h +++ b/zwgc/main.h @@ -33,7 +33,7 @@ extern char *location_override; * program with error code 1. */ -extern void usage(); +extern void usage(void); /* USRDESC points to a file (relative to user's homedir) which has a user's description file */ diff --git a/zwgc/mux.c b/zwgc/mux.c index 0e37ebc..341e6e6 100644 --- a/zwgc/mux.c +++ b/zwgc/mux.c @@ -62,10 +62,10 @@ static int max_source = -1; */ static fd_set input_sources; -static void (*input_handler[MAX_SOURCES])(); +static void (*input_handler[MAX_SOURCES])(void *); static pointer input_handler_arg[MAX_SOURCES]; -static int check_tty(); +static int check_tty(void); /* * void mux_init() @@ -74,7 +74,8 @@ static int check_tty(); * any other mux call. */ -void mux_init() +void +mux_init(void) { int i; @@ -96,10 +97,10 @@ void mux_init() * argument arg. */ -void mux_add_input_source(descriptor, handler, arg) - int descriptor; - void (*handler)(); - pointer arg; +void +mux_add_input_source(int descriptor, + void (*handler)(void *), + pointer arg) { #ifdef DEBUG if(descriptor < 0 || descriptor >= MAX_SOURCES) @@ -128,7 +129,8 @@ void mux_add_input_source(descriptor, handler, arg) * true, we return. */ -void mux_loop() +void +mux_loop(void) { int i, nfds; fd_set inputs, outputs; @@ -203,7 +205,8 @@ void mux_loop() } } -static int check_tty() +static int +check_tty(void) { register int result; int pgrp; diff --git a/zwgc/mux.h b/zwgc/mux.h index 3654a3f..230f9df 100644 --- a/zwgc/mux.h +++ b/zwgc/mux.h @@ -38,7 +38,7 @@ extern int mux_end_loop_p; * any other mux call. */ -extern void mux_init(); +extern void mux_init(void); /* * void mux_add_input_source(int descriptior; void (*handler)(); void *arg) @@ -50,7 +50,7 @@ extern void mux_init(); * argument arg. */ -extern void mux_add_input_source(); +extern void mux_add_input_source(int, void (*)(void *), void *); /* * void mux_loop() @@ -67,6 +67,6 @@ extern void mux_add_input_source(); * true, we return. */ -extern void mux_loop(); +extern void mux_loop(void); #endif diff --git a/zwgc/new_string.c b/zwgc/new_string.c index 98aa02b..906a2b9 100644 --- a/zwgc/new_string.c +++ b/zwgc/new_string.c @@ -56,9 +56,7 @@ typedef char *string; * string_Copy("foo"). */ -string string__CreateFromData(data, length) - char *data; - int length; +string string__CreateFromData(char *data, int length) { string result; @@ -79,8 +77,8 @@ string string__CreateFromData(data, length) * freed eventually. */ -string string__Copy(s) - string s; +string +string__Copy(string s) { int length; string result; @@ -103,8 +101,9 @@ string string__Copy(s) * returns string_Copy("abcdef"). */ -string string__Concat(a, b) - string a, b; +string +string__Concat(string a, + string b) { string result; int a_length, b_size, result_size; @@ -133,8 +132,9 @@ string string__Concat(a, b) * only faster. I.e., uses realloc instead of malloc+memcpy. */ -string string__Concat2(a, b) - string a, b; +string +string__Concat2(string a, + string b) { int a_length = string_Length(a); int b_size = string_Length(b)+1; @@ -159,8 +159,8 @@ string string__Concat2(a, b) * S is returned as a convenience. */ -string string_Downcase(s) - string s; +string +string_Downcase(string s) { char *ptr; @@ -181,8 +181,8 @@ string string_Downcase(s) * S is returned as a convenience. */ -string string_Upcase(s) - string s; +string +string_Upcase(string s) { char *ptr; diff --git a/zwgc/new_string.h b/zwgc/new_string.h index 2ad7851..ea10105 100644 --- a/zwgc/new_string.h +++ b/zwgc/new_string.h @@ -51,7 +51,7 @@ typedef char *string; * string_Copy("foo"). */ -extern string string__CreateFromData(); +extern string string__CreateFromData(char *, int); #ifdef DEBUG_MEMORY #define string_CreateFromData(data,length) (set_module(__FILE__,__LINE__),\ string__CreateFromData(data,length)) @@ -65,7 +65,7 @@ extern string string__CreateFromData(); * freed eventually. */ -extern string string__Copy(/* string s */); +extern string string__Copy(string); #ifdef DEBUG_MEMORY #define string_Copy(data) (set_module(__FILE__,__LINE__),\ string__Copy(data)) @@ -81,7 +81,7 @@ extern string string__Copy(/* string s */); * returns string_Copy("abcdef"). */ -extern string string__Concat(/* string a, b */); +extern string string__Concat(string, string); #ifdef DEBUG_MEMORY #define string_Concat(a,b) (set_module(__FILE__,__LINE__),\ string__Concat(a,b)) @@ -101,7 +101,7 @@ extern string string__Concat(/* string a, b */); * only faster. I.e., uses realloc instead of malloc+bcopy. */ -extern string string__Concat2(/* string a, b */); +extern string string__Concat2(string, string); #ifdef DEBUG_MEMORY #define string_Concat2(a,b) (set_module(__FILE__,__LINE__),\ string__Concat2(a,b)) @@ -118,7 +118,7 @@ extern string string__Concat2(/* string a, b */); * S is returned as a convenience. */ -extern string string_Downcase(); +extern string string_Downcase(string); /* * string string_Upcase(string s): @@ -129,6 +129,6 @@ extern string string_Downcase(); * S is returned as a convenience. */ -extern string string_Upcase(); +extern string string_Upcase(string); #endif diff --git a/zwgc/node.c b/zwgc/node.c index f3603d3..f04225e 100644 --- a/zwgc/node.c +++ b/zwgc/node.c @@ -60,8 +60,8 @@ static int last_node_in_current_bunch_used = -1; * string on the heap when node_DestroyAllNodes is called. */ -static Node *node_create(opcode) - int opcode; +static Node * +node_create(int opcode) { Node *result; @@ -102,7 +102,8 @@ static Node *node_create(opcode) * */ -void node_DestroyAllNodes() +void +node_DestroyAllNodes(void) { struct _bunch_of_nodes *next_bunch; int i, last_node_used_in_this_bunch; @@ -132,9 +133,9 @@ void node_DestroyAllNodes() /* */ /****************************************************************************/ -Node *node_create_string_constant(opcode, text) - int opcode; - string text; +Node * +node_create_string_constant(int opcode, + string text) { Node *n; @@ -143,8 +144,8 @@ Node *node_create_string_constant(opcode, text) return(n); } -Node *node_create_noary(opcode) - int opcode; +Node * +node_create_noary(int opcode) { Node *n; @@ -152,9 +153,9 @@ Node *node_create_noary(opcode) return(n); } -Node *node_create_unary(opcode, arg) - int opcode; - Node *arg; +Node * +node_create_unary(int opcode, + Node *arg) { Node *n; @@ -163,10 +164,10 @@ Node *node_create_unary(opcode, arg) return(n); } -Node *node_create_binary(opcode, first_arg, second_arg) - int opcode; - Node *first_arg; - Node *second_arg; +Node * +node_create_binary(int opcode, + Node *first_arg, + Node *second_arg) { Node *n; @@ -191,8 +192,8 @@ Node *node_create_binary(opcode, first_arg, second_arg) * the address of the (previously) last node. */ -Node *reverse_list_of_nodes(list) - Node *list; +Node * +reverse_list_of_nodes(Node *list) { Node *next_node; Node *head = NULL; @@ -220,9 +221,9 @@ Node *reverse_list_of_nodes(list) #ifdef DEBUG -static void print_stuff(node, format_string) - Node *node; - string format_string; +static void +print_stuff(Node *node, + string format_string) { char c; @@ -311,8 +312,7 @@ static string how_to_print[] = { "match %1\n%2", "default\n%2" }; -void node_display(node) - Node *node; +void node_display(Node *node) { int opcode = LAST_EXPR_OPCODE + 1; diff --git a/zwgc/node.h b/zwgc/node.h index 4fdf678..556719b 100644 --- a/zwgc/node.h +++ b/zwgc/node.h @@ -100,13 +100,13 @@ typedef struct _Node { /* Function externs */ -extern void node_DestroyAllNodes(); +extern void node_DestroyAllNodes(void); -extern Node *node_create_string_constant(); +extern Node *node_create_string_constant(int, string); -extern Node *node_create_noary(); -extern Node *node_create_unary(); -extern Node *node_create_binary(); +extern Node *node_create_noary(int); +extern Node *node_create_unary(int, Node *); +extern Node *node_create_binary(int, Node *, Node *); /* * Node *reverse_list_of_nodes(Node *list) @@ -117,10 +117,10 @@ extern Node *node_create_binary(); * the address of the (previously) last node. */ -extern Node *reverse_list_of_nodes(); +extern Node *reverse_list_of_nodes(Node *); #ifdef DEBUG -extern void node_display(); +extern void node_display(Node *); #endif #endif diff --git a/zwgc/notice.c b/zwgc/notice.c index 4e09167..b3a660c 100644 --- a/zwgc/notice.c +++ b/zwgc/notice.c @@ -38,9 +38,9 @@ static const char rcsid_notice_c[] = "$Id$"; * Effects: Returns the # of nulls in data[0]..data[length-1] */ -int count_nulls(data, length) - char *data; - int length; +int +count_nulls(char *data, + int length) { int count = 0; @@ -66,9 +66,9 @@ int count_nulls(data, length) * remain. (this is the case when *length_p == 0) */ -string get_next_field(data_p, length_p) - char **data_p; - int *length_p; +string +get_next_field(char **data_p, + int *length_p) { char *data = *data_p; int length = *length_p; @@ -98,10 +98,9 @@ string get_next_field(data_p, length_p) * "" is returned. */ -string get_field(data, length, num) - char *data; - int length; - int num; +string get_field(char *data, + int length, + int num) { /* * While num>1 and there are fields left, skip a field & decrement num: @@ -132,9 +131,9 @@ string get_field(data, length, num) * be freed. */ -string convert_nulls_to_newlines(data, length) - char *data; - int length; +string +convert_nulls_to_newlines(char *data, + int length) { char *result, *ptr; char c; @@ -158,8 +157,8 @@ string convert_nulls_to_newlines(data, length) * eventually. */ -static string z_kind_to_ascii(z_kind) - ZNotice_Kind_t z_kind; +static string +z_kind_to_ascii(ZNotice_Kind_t z_kind) { string result; @@ -217,8 +216,8 @@ static string z_kind_to_ascii(z_kind) * eventually. */ -static string z_auth_to_ascii(z_auth) - int z_auth; +static string +z_auth_to_ascii(int z_auth) { string result; @@ -249,9 +248,9 @@ static string z_auth_to_ascii(z_auth) * Effects: */ -char *decode_notice(notice, hostname) - ZNotice_t *notice; - char *hostname; +char * +decode_notice(ZNotice_t *notice, + char *hostname) { char *temp; string time, notyear, year, date_string, time_string; diff --git a/zwgc/notice.h b/zwgc/notice.h index 7a9faf5..ad6635d 100644 --- a/zwgc/notice.h +++ b/zwgc/notice.h @@ -17,6 +17,7 @@ #ifndef notice_MODULE #define notice_MODULE +#include #include "new_string.h" /* @@ -25,7 +26,7 @@ * Effects: Returns the # of nulls in data[0]..data[length-1] */ -extern int count_nulls(); +extern int count_nulls(char *, int); /* * string get_next_field(char **data_p, int *length_p) @@ -42,7 +43,7 @@ extern int count_nulls(); * remain. (this is the case when *length_p == 0) */ -extern string get_next_field(); +extern string get_next_field(char **, int *); /* * string get_field(char *data, int length, int num) @@ -55,7 +56,7 @@ extern string get_next_field(); * "" is returned. */ -extern string get_field(); +extern string get_field(char *, int, int); /* * string convert_nulls_to_newlines(data, length) @@ -66,9 +67,9 @@ extern string get_field(); * be freed. */ -extern string convert_nulls_to_newlines(); +extern string convert_nulls_to_newlines(char *, int); -extern char *decode_notice(); +extern char *decode_notice(ZNotice_t *, char *); #endif diff --git a/zwgc/parser.h b/zwgc/parser.h index 8e0d5f6..92724dd 100644 --- a/zwgc/parser.h +++ b/zwgc/parser.h @@ -31,7 +31,7 @@ * is reported to the user via stderr. */ -extern void report_parse_error(); +extern void report_parse_error(char *, int); /* * struct _Node *parse_file(FILE *input_file) @@ -49,6 +49,6 @@ extern void report_parse_error(); * is closed before this routine returns. */ -extern struct _Node *parse_file(); +extern struct _Node *parse_file(FILE *); #endif diff --git a/zwgc/parser.y b/zwgc/parser.y index 6f53985..30f4088 100644 --- a/zwgc/parser.y +++ b/zwgc/parser.y @@ -31,7 +31,7 @@ static const char rcsid_parser_y[] = "$Id$"; #include "node.h" #include "zwgc.h" -static void yyerror(); +static void yyerror(char *); /* * the_program - local variable used to communicate the program's node @@ -320,9 +320,9 @@ static int error_occured = 0; * is reported to the user via stderr. */ -void report_parse_error(error_message, line_number) - char *error_message; - int line_number; +void +report_parse_error(char *error_message, + int line_number) { if (error_occured) return; @@ -338,8 +338,7 @@ void report_parse_error(error_message, line_number) * stack overflow errors. */ -static void yyerror(message) - char *message; +static void yyerror(char *message) { report_parse_error(message, yylineno); } @@ -360,8 +359,8 @@ static void yyerror(message) * is closed before this routine returns. */ -struct _Node *parse_file(input_file) - FILE *input_file; +struct _Node * +parse_file(FILE *input_file) { the_program = NULL; error_occured = 0; diff --git a/zwgc/port.c b/zwgc/port.c index 0244dac..55d6274 100644 --- a/zwgc/port.c +++ b/zwgc/port.c @@ -37,10 +37,10 @@ static const char rcsid_port_c[] = "$Id$"; /* */ /****************************************************************************/ -static string port_get(p) - port *p; +static string +port_get(port *p) { - char *(*get_proc)(); + char *(*get_proc)(port *, char **); char *error = NULL; char *result; @@ -65,12 +65,12 @@ static string port_get(p) return(result); } -static void port_put(p, data, length) - port *p; - char *data; - int length; +static void +port_put(port *p, + char *data, + int length) { - char *(*put_proc)(); + char *(*put_proc)(port *, char *, int); char *error; if (p->status & OUTPUT_CLOSED) { @@ -91,10 +91,10 @@ static void port_put(p, data, length) var_set_variable("error", error); } -static void port_close_input(p) - port *p; +static void +port_close_input(port *p) { - char *(*close_input_proc)(); + char *(*close_input_proc)(port *); char *error; if (p->status & INPUT_CLOSED) @@ -109,10 +109,10 @@ static void port_close_input(p) var_set_variable("error", error); } -static void port_close_output(p) - port *p; +static void +port_close_output(port *p) { - char *(*close_output_proc)(); + char *(*close_output_proc)(port *); char *error; if (p->status & OUTPUT_CLOSED) @@ -146,14 +146,15 @@ static port_dictionary port_dict = NULL; * any other port call is made. */ -static void close_port_from_binding(b) - port_dictionary_binding *b; +static void +close_port_from_binding(port_dictionary_binding *b) { port_close_input(&(b->value)); port_close_output(&(b->value)); } -void init_ports() +void +init_ports(void) { if (port_dict) { port_dictionary_Enumerate(port_dict, close_port_from_binding); @@ -176,8 +177,8 @@ void init_ports() * various fields correctly. */ -static port *create_named_port(name) - string name; +static port * +create_named_port(string name) { int already_exists; port_dictionary_binding *binding; @@ -200,8 +201,8 @@ static port *create_named_port(name) * it. Otherwise returns NULL. */ -static port *get_named_port(name) - string name; +static port * +get_named_port(string name) { port_dictionary_binding *binding; @@ -230,8 +231,8 @@ static port *get_named_port(name) * on the heap & must be eventually freed. */ -string read_from_port(name) - string name; +string +read_from_port(string name) { port *p; @@ -253,10 +254,10 @@ string read_from_port(name) * occurs, $error is set to the error message. */ -void write_on_port(name, text, length) - string name; - char *text; - int length; +void +write_on_port(string name, + char *text, + int length) { port *p; @@ -280,8 +281,8 @@ void write_on_port(name, text, length) * occurs, $error is set to the error message. */ -void close_port_input(name) - string name; +void +close_port_input(string name) { port_dictionary_binding *binding; @@ -306,8 +307,8 @@ void close_port_input(name) * occurs, $error is set to the error message. */ -void close_port_output(name) - string name; +void +close_port_output(string name) { port_dictionary_binding *binding; @@ -326,9 +327,9 @@ void close_port_output(name) /* */ /****************************************************************************/ -static string get_file(p, error_p) - port *p; - char **error_p; +static string +get_file(port *p, + char **error_p) { char buffer[10000]; /* <<<>>> */ @@ -352,10 +353,10 @@ static string get_file(p, error_p) return(string_Copy(buffer)); } -static char *put_file(p, text, length) - port *p; - string text; - int length; +static char * +put_file(port *p, + string text, + int length) { if (!p->data.file.output_connector) return(NULL); @@ -370,8 +371,8 @@ static char *put_file(p, text, length) return(NULL); } -static char *close_file_input(p) - port *p; +static char * +close_file_input(port *p) { errno = 0; if (p->data.file.input_connector) { @@ -385,8 +386,8 @@ static char *close_file_input(p) return(NULL); } -static char *close_file_output(p) - port *p; +static char * +close_file_output(port *p) { errno = 0; if (p->data.file.output_connector) { @@ -400,10 +401,9 @@ static char *close_file_output(p) return(NULL); } -void create_port_from_files(name, input, output) - string name; - FILE *input; - FILE *output; +void create_port_from_files(string name, + FILE *input, + FILE *output) { port *p = create_named_port(name); @@ -434,9 +434,9 @@ void create_port_from_files(name, input, output) /* */ /****************************************************************************/ -void create_subprocess_port(name, argv) - string name; - char **argv; +void +create_subprocess_port(string name, + char **argv) { int pid; int to_child_descriptors[2]; @@ -477,9 +477,9 @@ void create_subprocess_port(name, argv) create_port_from_files(name, in, out); } -void create_file_append_port(name, filename) - string name; - string filename; +void +create_file_append_port(string name, + string filename) { FILE *out; int oumask; @@ -497,9 +497,9 @@ void create_file_append_port(name, filename) create_port_from_files(name, 0, out); } -void create_file_input_port(name, filename) - string name; - string filename; +void +create_file_input_port(string name, + string filename) { FILE *in; @@ -513,9 +513,9 @@ void create_file_input_port(name, filename) create_port_from_files(name, in, 0); } -void create_file_output_port(name, filename) - string name; - string filename; +void +create_file_output_port(string name, + string filename) { FILE *out; int oumask; @@ -539,9 +539,9 @@ void create_file_output_port(name, filename) /* */ /****************************************************************************/ -static string get_filter(p, error_p) - port *p; - char **error_p; +static string +get_filter(port *p, + char **error_p) { string result; @@ -555,10 +555,10 @@ static string get_filter(p, error_p) return(result); } -static char *put_filter(p, text, length) - port *p; - string text; - int length; +static char * +put_filter(port *p, + string text, + int length) { string input; string output; @@ -573,8 +573,8 @@ static char *put_filter(p, text, length) return(NULL); } -static char *close_filter_input(p) - port *p; +static char * +close_filter_input(port *p) { while (!string_stack_empty(p->data.filter.waiting_packets)) string_stack_pop(p->data.filter.waiting_packets); @@ -583,15 +583,15 @@ static char *close_filter_input(p) } /*ARGSUSED*/ -static char *close_filter_output(p) - port *p; +static char * +close_filter_output(port *p) { return(NULL); } -void create_port_from_filter(name, filter) - string name; - string (*filter)(); +void +create_port_from_filter(string name, + string (*filter)(string)) { port *p = create_named_port(name); @@ -610,10 +610,10 @@ void create_port_from_filter(name, filter) /* */ /****************************************************************************/ -static char *put_output(p, text, length) - port *p; - string text; - int length; +static char * +put_output(port *p, + string text, + int length) { string input; char *error; @@ -625,15 +625,15 @@ static char *put_output(p, text, length) } /*ARGSUSED*/ -static char *close_output(p) - port *p; +static char * +close_output(port *p) { return(NULL); } -void create_port_from_output_proc(name, output) - string name; - char *(*output)(); +void +create_port_from_output_proc(string name, + char *(*output)(string)) { #ifdef SABER /* Yes, it's another ANSI incompatiblity */ port *p; diff --git a/zwgc/port.h b/zwgc/port.h index 0cf4591..d7da9d3 100644 --- a/zwgc/port.h +++ b/zwgc/port.h @@ -28,18 +28,18 @@ union port__data { } file; struct { string_stack waiting_packets; - string (*filter)(); + string (*filter)(string); } filter; struct { - char *(*output)(); + char *(*output)(string); } output; }; -typedef struct { /* PRIVATE */ - char *(*get)(); - char *(*put)(); - char *(*close_input)(); - char *(*close_output)(); +typedef struct port__struct { /* PRIVATE */ + char *(*get)(struct port__struct *, char **); + char *(*put)(struct port__struct *, char *, int); + char *(*close_input)(struct port__struct *); + char *(*close_output)(struct port__struct *); #define INPUT_CLOSED 0x1 #define OUTPUT_CLOSED 0x2 #define PORT_CLOSED 0x3 @@ -54,7 +54,7 @@ typedef struct { /* PRIVATE */ * any other port call is made. */ -extern void init_ports(); +extern void init_ports(void); /* * string read_from_port(string name) @@ -68,7 +68,7 @@ extern void init_ports(); * on the heap & must be eventually freed. */ -extern string read_from_port(); +extern string read_from_port(string); /* * void write_on_port(string name, char *text, int length) @@ -80,7 +80,7 @@ extern string read_from_port(); * occurs, $error is set to the error message. */ -extern void write_on_port(); +extern void write_on_port(string, char *, int); /* * void close_port_input(string name) @@ -94,7 +94,7 @@ extern void write_on_port(); * occurs, $error is set to the error message. */ -extern void close_port_input(); +extern void close_port_input(string); /* * void close_port_output(string name) @@ -108,17 +108,17 @@ extern void close_port_input(); * occurs, $error is set to the error message. */ -extern void close_port_output(); +extern void close_port_output(string); -extern void create_subprocess_port(); -extern void create_file_append_port(); -extern void create_file_input_port(); -extern void create_file_output_port(); -extern void create_port_from_filter(); -extern void create_port_from_output_proc(); +extern void create_subprocess_port(string, char **); +extern void create_file_append_port(string, string); +extern void create_file_input_port(string, string); +extern void create_file_output_port(string, string); +extern void create_port_from_filter(string, string (*)(string)); +extern void create_port_from_output_proc(string, char *(*)(string)); -extern void init_standard_ports(); -extern void create_port_from_files(); +extern void init_standard_ports(int *, char **); +extern void create_port_from_files(string, FILE *, FILE *); #endif diff --git a/zwgc/regexp.c b/zwgc/regexp.c index d3a2cb5..a9314ab 100644 --- a/zwgc/regexp.c +++ b/zwgc/regexp.c @@ -20,9 +20,9 @@ static const char rcsid_regexp_c[] = "$Id$"; #include "regexp.h" -int ed_regexp_match_p(test_string, pattern) - string test_string; - string pattern; +int +ed_regexp_match_p(string test_string, + string pattern) { regex_t RE; int retval; diff --git a/zwgc/regexp.h b/zwgc/regexp.h index 2429998..d5efcc2 100644 --- a/zwgc/regexp.h +++ b/zwgc/regexp.h @@ -19,6 +19,6 @@ #include "new_string.h" -extern int ed_regexp_match_p(); +extern int ed_regexp_match_p(string, string); #endif diff --git a/zwgc/standard_ports.c b/zwgc/standard_ports.c index 526e02c..f679f4e 100644 --- a/zwgc/standard_ports.c +++ b/zwgc/standard_ports.c @@ -32,22 +32,22 @@ static const char rcsid_standard_ports_c[] = "$Id$"; #include "main.h" #include -extern string tty_filter(); -extern int tty_filter_init(); +extern char *tty_filter(string, int); +extern int tty_filter_init(char *, char, int *, char **); #ifndef X_DISPLAY_MISSING -extern char *X_driver(); -extern int X_driver_init(); +extern char *X_driver(string); +extern int X_driver_init(char *, char, int *, char **); #endif -extern void usage(); +extern void usage(void); /* * */ -char *plain_driver(input) - string input; +char * +plain_driver(string input) { string processed_input = tty_filter(input, 0); @@ -61,8 +61,8 @@ char *plain_driver(input) * */ -char *tty_driver(input) - string input; +char * +tty_driver(string input) { string processed_input = tty_filter(input, 1); @@ -76,8 +76,8 @@ char *tty_driver(input) * */ -string noop_filter(input) - string input; +string +noop_filter(string input) { return(input); } @@ -86,8 +86,8 @@ string noop_filter(input) * */ -string plain_filter(input) - string input; +string +plain_filter(string input) { return(tty_filter(input, 0)); } @@ -96,8 +96,8 @@ string plain_filter(input) * */ -string fancy_filter(input) - string input; +string +fancy_filter(string input) { return(tty_filter(input, 1)); } @@ -118,13 +118,13 @@ static struct standard_port_info { #define DISABLED 2 int port_setup_status; - int (*port_init)(); + int (*port_init)(char *, char, int *, char **); #define INPUT_DESC 0 #define OUTPUT_DESC 1 #define FILTER 2 #define OUTPUT_PROC 3 int type; - char *(*function)(); + char *(*function)(string); int setup_arg; } standard_port_info_table[] = { #ifndef X_DISPLAY_MISSING @@ -148,8 +148,8 @@ static struct standard_port_info { * <<<>>> */ -static struct standard_port_info *get_standard_port_info(port_name) - string port_name; +static struct standard_port_info * +get_standard_port_info(string port_name) { struct standard_port_info *p; @@ -169,8 +169,8 @@ static struct standard_port_info *get_standard_port_info(port_name) * returns -1. */ -static int boolean_value_of(text) - string text; +static int +boolean_value_of(string text) { if (!text) return(-1); /* not set */ @@ -190,9 +190,8 @@ static int boolean_value_of(text) * */ -void init_standard_ports(pargc, argv) - int *pargc; - char **argv; +void init_standard_ports(int *pargc, + char **argv) { struct standard_port_info *p; string first_working_port = ""; diff --git a/zwgc/string_dictionary_aux.c b/zwgc/string_dictionary_aux.c index b2786ff..daee49c 100644 --- a/zwgc/string_dictionary_aux.c +++ b/zwgc/string_dictionary_aux.c @@ -43,10 +43,10 @@ static char rcsid_string_dictionary_aux_c[] = "$Id$"; * heap. */ -void string__dictionary_Set(d, key, value) - string_dictionary d; - string key; - string value; +void +string__dictionary_Set(string_dictionary d, + string key, + string value) { string_dictionary_binding *binding; int already_exists; @@ -67,9 +67,9 @@ void string__dictionary_Set(d, key, value) * disappear later if key is rebound. */ -char *string_dictionary_Fetch(d, key) - string_dictionary d; - string key; +char * +string_dictionary_Fetch(string_dictionary d, + string key) { string_dictionary_binding *binding; @@ -87,14 +87,14 @@ char *string_dictionary_Fetch(d, key) * all value's in the dictionary. */ -static void free_value_of_binding(b) - string_dictionary_binding *b; +static void +free_value_of_binding(string_dictionary_binding *b) { free(b->value); } -void string_dictionary_SafeDestroy(d) - string_dictionary d; +void +string_dictionary_SafeDestroy(string_dictionary d) { string_dictionary_Enumerate(d, free_value_of_binding); string_dictionary_Destroy(d); diff --git a/zwgc/string_dictionary_aux.h b/zwgc/string_dictionary_aux.h index 84fac33..e058721 100644 --- a/zwgc/string_dictionary_aux.h +++ b/zwgc/string_dictionary_aux.h @@ -25,7 +25,7 @@ * heap. */ -extern void string__dictionary_Set(); +extern void string__dictionary_Set(string_dictionary, string, string); #ifdef DEBUG_MEMORY #define string_dictionary_Set(a,b,c) (set_module(__FILE__,__LINE__),\ string__dictionary_Set(a,b,c)) @@ -42,7 +42,8 @@ extern void string__dictionary_Set(); * disappear later if key is rebound. */ -extern char *string_dictionary_Fetch(); +extern char *string_dictionary_Fetch(string_dictionary, + string); /* * void string_dictionary_SafeDestroy(string_dictionary d) @@ -51,6 +52,6 @@ extern char *string_dictionary_Fetch(); * all value's in the dictionary. */ -extern void string_dictionary_SafeDestroy(); +extern void string_dictionary_SafeDestroy(string_dictionary); #endif diff --git a/zwgc/subscriptions.c b/zwgc/subscriptions.c index e72963e..cfe932e 100644 --- a/zwgc/subscriptions.c +++ b/zwgc/subscriptions.c @@ -44,15 +44,16 @@ static char rcsid_subscriptions_c[] = "$Id$"; */ static int_dictionary puntable_addresses_dict = 0; -static void init_puntable_dict() +static void +init_puntable_dict(void) { puntable_addresses_dict = int_dictionary_Create(33); } -static string address_to_string(class, instance, recipient) - string class; - string instance; - string recipient; +static string +address_to_string(string class, + string instance, + string recipient) { string result; @@ -75,10 +76,9 @@ static string address_to_string(class, instance, recipient) return(result); } -int puntable_address_p(class, instance, recipient) - string class; - string instance; - string recipient; +int puntable_address_p(string class, + string instance, + string recipient) { string temp; @@ -95,10 +95,9 @@ int puntable_address_p(class, instance, recipient) return(0); } -void punt(class, instance, recipient) - string class; - string instance; - string recipient; +void punt(string class, + string instance, + string recipient) { string temp; @@ -110,10 +109,9 @@ void punt(class, instance, recipient) free(temp); } -void unpunt(class, instance, recipient) - string class; - string instance; - string recipient; +void unpunt(string class, + string instance, + string recipient) { string temp; int_dictionary_binding *binding; @@ -146,9 +144,9 @@ static ZSubscription_t subscription_list[BATCH_SIZE]; static int unsubscription_list_size = 0; static ZSubscription_t unsubscription_list[BATCH_SIZE]; -static void free_subscription_list(list, number_of_elements) - ZSubscription_t *list; - int number_of_elements; +static void +free_subscription_list(ZSubscription_t *list, + int number_of_elements) { int i; @@ -159,7 +157,8 @@ static void free_subscription_list(list, number_of_elements) } } -static void flush_subscriptions() +static void +flush_subscriptions(void) { TRAP(ZSubscribeTo(subscription_list,subscription_list_size, 0), "while subscribing"); @@ -168,7 +167,8 @@ static void flush_subscriptions() subscription_list_size = 0; } -static void flush_unsubscriptions() +static void +flush_unsubscriptions(void) { if (unsubscription_list_size) TRAP(ZUnsubscribeTo(unsubscription_list, unsubscription_list_size, 0), @@ -178,10 +178,10 @@ static void flush_unsubscriptions() unsubscription_list_size = 0; } -static void subscribe(class, instance, recipient) - string class; - string instance; - string recipient; +static void +subscribe(string class, + string instance, + string recipient) { subscription_list[subscription_list_size].zsub_class = string_Copy(class); subscription_list[subscription_list_size].zsub_classinst= string_Copy(instance); @@ -191,10 +191,10 @@ static void subscribe(class, instance, recipient) flush_subscriptions(); } -static void unsubscribe(class, instance, recipient) - string class; - string instance; - string recipient; +static void +unsubscribe(string class, + string instance, + string recipient) { unsubscription_list[unsubscription_list_size].zsub_class = string_Copy(class); unsubscription_list[unsubscription_list_size].zsub_classinst @@ -219,7 +219,8 @@ static void unsubscribe(class, instance, recipient) char ourhost[MAXHOSTNAMELEN],ourhostcanon[MAXHOSTNAMELEN]; -static void inithosts() +static void +inithosts(void) { struct hostent *hent; if (gethostname(ourhost, sizeof(ourhost)-1) == -1) { @@ -236,8 +237,8 @@ static void inithosts() return; } -static void macro_sub(str) - char *str; +static void +macro_sub(char *str) { static int initedhosts = 0; @@ -256,8 +257,8 @@ static void macro_sub(str) #define UNSUBSCRIBE_CHARACTER '!' #define PUNT_CHARACTER '-' -static void load_subscriptions_from_file(file) - FILE *file; +static void +load_subscriptions_from_file(FILE *file) { char line[BUFSIZ]; char class_buffer[BUFSIZ], instance[BUFSIZ], recipient[BUFSIZ]; @@ -319,7 +320,8 @@ static void load_subscriptions_from_file(file) #define DEFSUBS "/dev/null" -static void load_subscriptions() +static void +load_subscriptions(void) { FILE *subscriptions_file; @@ -343,7 +345,7 @@ int zwgc_active = 0; static ZSubscription_t *saved_subscriptions = NULL; static int number_of_saved_subscriptions; -void zwgc_shutdown() +void zwgc_shutdown(void) { if (!zwgc_active) return; @@ -367,7 +369,7 @@ void zwgc_shutdown() zwgc_active = 0; } -void zwgc_startup() +void zwgc_startup(void) { if (zwgc_active) return; diff --git a/zwgc/subscriptions.h b/zwgc/subscriptions.h index 88f52c2..91cb360 100644 --- a/zwgc/subscriptions.h +++ b/zwgc/subscriptions.h @@ -19,11 +19,11 @@ extern int zwgc_active; -extern int puntable_address_p(/* string class, instance, recipient */); -extern void punt(); -extern void unpunt(); -extern void zwgc_shutdown(); -extern void zwgc_startup(); +extern int puntable_address_p(string, string, string); +extern void punt(string, string, string); +extern void unpunt(string, string, string); +extern void zwgc_shutdown(void); +extern void zwgc_startup(void); #define USRSUBS ".zephyr.subs" diff --git a/zwgc/substitute.c b/zwgc/substitute.c index ebbd913..d50614c 100644 --- a/zwgc/substitute.c +++ b/zwgc/substitute.c @@ -38,9 +38,9 @@ static char rcsid_substitute_c[] = "$Id$"; * The returned string must not be freed. */ -static string eat_dollar_sign_stuff(lookup, text_ptr) - string (*lookup)(); - string *text_ptr; /* Input/Output parameter */ +static string +eat_dollar_sign_stuff(string (*lookup)(string), + string *text_ptr) /* Input/Output parameter */ { char c; char closing_brace = 0; @@ -132,9 +132,9 @@ static string eat_dollar_sign_stuff(lookup, text_ptr) * modified in any way or freed. */ -string substitute(lookup, text) - string (*lookup)(); - string text; +string +substitute(string (*lookup)(string), + string text) { string result_so_far = string_Copy(""); char *p, *temp; diff --git a/zwgc/substitute.h b/zwgc/substitute.h index 5c0bb55..925454a 100644 --- a/zwgc/substitute.h +++ b/zwgc/substitute.h @@ -40,6 +40,6 @@ * modified in any way or freed. */ -extern string substitute(); +extern string substitute(string (*)(string), string); #endif diff --git a/zwgc/text_operations.c b/zwgc/text_operations.c index b5b791a..34f0d4c 100644 --- a/zwgc/text_operations.c +++ b/zwgc/text_operations.c @@ -23,9 +23,9 @@ static const char rcsid_text_operations_c[] = "$Id$"; #include "text_operations.h" #include "char_stack.h" -string lany(text_ptr, str) - string *text_ptr; - string str; +string +lany(string *text_ptr, + string str) { string result, whats_left; char *p = *text_ptr; @@ -40,9 +40,9 @@ string lany(text_ptr, str) return(result); } -string lbreak(text_ptr, set) - string *text_ptr; - character_class set; +string +lbreak(string *text_ptr, + const character_class set) { string result, whats_left; char *p = *text_ptr; @@ -57,9 +57,9 @@ string lbreak(text_ptr, set) return(result); } -string lspan(text_ptr, set) - string *text_ptr; - character_class set; +string +lspan(string *text_ptr, + character_class set) { string result, whats_left; char *p = *text_ptr; @@ -74,9 +74,9 @@ string lspan(text_ptr, set) return(result); } -string rany(text_ptr, str) - string *text_ptr; - string str; +string +rany(string *text_ptr, + string str) { string result, whats_left; string text = *text_ptr; @@ -92,9 +92,9 @@ string rany(text_ptr, str) return(result); } -string rbreak(text_ptr, set) - string *text_ptr; - character_class set; +string +rbreak(string *text_ptr, + character_class set) { string result, whats_left; string text = *text_ptr; @@ -110,9 +110,9 @@ string rbreak(text_ptr, set) return(result); } -string rspan(text_ptr, set) - string *text_ptr; - character_class set; +string +rspan(string *text_ptr, + character_class set) { string result, whats_left; string text = *text_ptr; diff --git a/zwgc/text_operations.h b/zwgc/text_operations.h index 960e2ab..0e1c152 100644 --- a/zwgc/text_operations.h +++ b/zwgc/text_operations.h @@ -19,14 +19,11 @@ #include "character_class.h" -extern string protect(); -extern string verbatim(); -extern string stylestrip(); -extern string lany(); -extern string lbreak(); -extern string lspan(); -extern string rany(); -extern string rbreak(); -extern string rspan(); +extern string lany(string *, string); +extern string lbreak(string *, const character_class); +extern string lspan(string *, character_class); +extern string rany(string *, string); +extern string rbreak(string *, character_class); +extern string rspan(string *, character_class); #endif diff --git a/zwgc/tty_filter.c b/zwgc/tty_filter.c index 72a6747..f2b6024 100644 --- a/zwgc/tty_filter.c +++ b/zwgc/tty_filter.c @@ -24,6 +24,10 @@ static const char rcsid_tty_filter_c[] = "$Id$"; /* The tty & plain filters: */ /* */ /****************************************************************************/ +#define HAVE_TERMCAP_H +#ifdef HAVE_TERMCAP_H +#include +#endif #include "new_memory.h" #include "new_string.h" @@ -33,7 +37,7 @@ static const char rcsid_tty_filter_c[] = "$Id$"; #include "error.h" /***************************************************************************/ - +#ifndef HAVE_TERMCAP_H extern int tgetent(); extern char *tgetstr(),*getenv(); #ifdef linux @@ -42,6 +46,7 @@ extern speed_t ospeed; extern short ospeed; #endif char PC; +#endif /* Dictionary naming convention: @@ -76,19 +81,18 @@ static char code_buf[10240], *code_buf_pos = code_buf, *code; *code_buf_pos++ = 0, TD_SET(k, code)) static int -tty_outc(c) - int c; +tty_outc(int c) { *code_buf_pos++ = c; return 0; } /* ARGSUSED */ -int tty_filter_init(drivername, notfirst, pargc, argv) -char *drivername; -char notfirst; -int *pargc; -char **argv; +int +tty_filter_init(char *drivername, + char notfirst, + int *pargc, + char **argv) { static char st_buf[128]; char tc_buf[1024], *p = st_buf, *tmp, *term; @@ -201,10 +205,10 @@ char **argv; -static int fixed_string_eq(pattern, text, text_length) - string pattern; - char *text; - int text_length; +static int +fixed_string_eq(string pattern, + char *text, + int text_length) { while (*pattern && text_length>0 && *pattern == *text) { pattern++; @@ -228,8 +232,8 @@ typedef struct _tty_str_info { unsigned int ignore: 1; } tty_str_info; -static void free_info(info) - tty_str_info *info; +static void +free_info(tty_str_info *info) { tty_str_info *next_info; @@ -240,10 +244,10 @@ static void free_info(info) } } -static int do_mode_change(current_mode_p, text, text_length) - tty_str_info *current_mode_p; - char *text; - int text_length; +static int +do_mode_change(tty_str_info *current_mode_p, + char *text, + int text_length) { /* alignment commands: */ if (fixed_string_eq("left", text, text_length) || @@ -279,8 +283,8 @@ static int do_mode_change(current_mode_p, text, text_length) return 0; } -static tty_str_info *convert_desc_to_tty_str_info(desc) - desctype *desc; +static tty_str_info * +convert_desc_to_tty_str_info(desctype *desc) { tty_str_info *temp; tty_str_info *result = NULL; @@ -367,10 +371,10 @@ static tty_str_info *convert_desc_to_tty_str_info(desc) #define max(a,b) ((a)>(b)?(a):(b)) -static int line_width(left_width, center_width, right_width) - int left_width; - int center_width; - int right_width; +static int +line_width(int left_width, + int center_width, + int right_width) { if (center_width>0) { if (left_width==0 && right_width==0) @@ -384,8 +388,8 @@ static int line_width(left_width, center_width, right_width) } } -static int calc_max_line_width(info) - tty_str_info *info; +static int +calc_max_line_width(tty_str_info *info) { int max_line_width = 0; int left = 0; @@ -432,9 +436,9 @@ static int calc_max_line_width(info) return(max_line_width); } -string tty_filter(text, use_fonts) - string text; - int use_fonts; +string +tty_filter(string text, + int use_fonts) { string text_copy = string_Copy(text); string result_so_far = string_Copy(""); diff --git a/zwgc/variables.c b/zwgc/variables.c index cda09d6..a444b44 100644 --- a/zwgc/variables.c +++ b/zwgc/variables.c @@ -56,8 +56,8 @@ static string_dictionary number_variable_dict = NULL; * Effects: Returns true iff text matches [0-9]*. ("" matches...) */ -static int is_digits(text) - string text; +static int +is_digits(string text) { for (; *text; text++) if (!isdigit(*text)) @@ -83,7 +83,8 @@ static int is_digits(text) * Effects: Sets all description langauge variables to "". */ -void var_clear_all_variables() +void +var_clear_all_variables(void) { if (non_number_variable_dict) { string_dictionary_SafeDestroy(non_number_variable_dict); @@ -104,8 +105,8 @@ void var_clear_all_variables() * call. DO NOT FREE THIS STRING. */ -string var_get_variable(name) - string name; +string +var_get_variable(string name) { char *result; int field_to_get; @@ -150,9 +151,9 @@ string var_get_variable(name) * to have the value value. */ -void var_set_variable(name, value) - string name; - string value; +void +var_set_variable(string name, + string value) { string_dictionary_Set(is_number_variable(name) ? number_variable_dict : non_number_variable_dict, name, value); @@ -167,9 +168,9 @@ void var_set_variable(name, value) * to have as its value number's ascii representation. */ -void var_set_variable_to_number(name, number) - string name; - int number; +void +var_set_variable_to_number(string name, + int number) { char buffer[20]; @@ -190,9 +191,9 @@ void var_set_variable_to_number(name, number) * convenience reasons. */ -void var_set_variable_then_free_value(name, value) - string name; - string value; +void +var_set_variable_then_free_value(string name, + string value) { string_dictionary_binding *binding; int exists; @@ -229,9 +230,9 @@ void var_set_variable_then_free_value(name, value) * data or var_clear_all_variables is called. */ -void var_set_number_variables_to_fields(data, length) - char *data; - int length; +void +var_set_number_variables_to_fields(char *data, + int length) { fields_data = data; fields_data_length = length; diff --git a/zwgc/variables.h b/zwgc/variables.h index 6962341..b0be99b 100644 --- a/zwgc/variables.h +++ b/zwgc/variables.h @@ -27,7 +27,7 @@ * Effects: Sets all description langauge variables to "". */ -extern void var_clear_all_variables(); +extern void var_clear_all_variables(void); /* * string var_get_variable(string name) @@ -38,7 +38,7 @@ extern void var_clear_all_variables(); * call. DO NOT FREE THIS STRING. */ -extern string var_get_variable(); +extern string var_get_variable(string); /* * void var_set_variable(string name, value) @@ -49,7 +49,7 @@ extern string var_get_variable(); * to have the value value. */ -extern void var_set_variable(); +extern void var_set_variable(string, string); /* * void var_set_variable_to_number(string name; int number) @@ -60,7 +60,7 @@ extern void var_set_variable(); * to have as its value number's ascii representation. */ -extern void var_set_variable_to_number(); +extern void var_set_variable_to_number(string, int); /* * void var_set_variable_then_free_value(string name, value) @@ -75,7 +75,7 @@ extern void var_set_variable_to_number(); * convenience reasons. */ -extern void var_set_variable_then_free_value(); +extern void var_set_variable_then_free_value(string, string); /* * void var_set_number_variables_to_fields(char *data, int length) @@ -91,6 +91,6 @@ extern void var_set_variable_then_free_value(); * data or var_clear_all_variables is called. */ -extern void var_set_number_variables_to_fields(); +extern void var_set_number_variables_to_fields(char *, int); #endif diff --git a/zwgc/xcut.c b/zwgc/xcut.c index cadfc3d..b6019a9 100644 --- a/zwgc/xcut.c +++ b/zwgc/xcut.c @@ -42,21 +42,20 @@ static const char rcsid_xcut_c[] = "$Id$"; * */ -extern char *xmarkGetText(); - extern long ttl; static char *selected_text=NULL; static Window selecting_in = 0; -char *getSelectedText() +char * +getSelectedText(void) { return(selected_text); } #ifdef notdef -static string x_gram_to_string(gram) - x_gram *gram; +static string +x_gram_to_string(x_gram *gram) { int i, index, len; int last_y = -1; @@ -86,27 +85,27 @@ static string x_gram_to_string(gram) */ /*ARGSUSED*/ -Bool isShiftButton1(dpy,event,arg) - Display *dpy; - XEvent *event; - char *arg; +Bool +isShiftButton1(Display *dpy, + XEvent *event, + char *arg) { return(event->xbutton.state & (ShiftMask|Button1Mask)); } /*ARGSUSED*/ -Bool isShiftButton3(dpy,event,arg) - Display *dpy; - XEvent *event; - char *arg; +Bool +isShiftButton3(Display *dpy, + XEvent *event, + char *arg) { return(event->xbutton.state & (ShiftMask|Button3Mask)); } -void getLastEvent(dpy,state,event) - Display *dpy; - unsigned int state; - XEvent *event; +void +getLastEvent(Display *dpy, + unsigned int state, + XEvent *event) { XEvent xev; @@ -119,11 +118,11 @@ void getLastEvent(dpy,state,event) } } -void xunmark(dpy,w,gram,desc_context) - Display *dpy; - Window w; - x_gram *gram; - XContext desc_context; +void +xunmark(Display *dpy, + Window w, + x_gram *gram, + XContext desc_context) { if (gram == NULL) if (XFindContext(dpy, w, desc_context, (caddr_t *) &gram)) @@ -144,11 +143,11 @@ void xunmark(dpy,w,gram,desc_context) static int current_pressop = PRESSOP_NONE; -void xdestroygram(dpy,w,desc_context,gram) - Display *dpy; - Window w; - XContext desc_context; - x_gram *gram; +void +xdestroygram(Display *dpy, + Window w, + XContext desc_context, + x_gram *gram) { struct timeval now; @@ -176,10 +175,10 @@ void xdestroygram(dpy,w,desc_context,gram) } } -void xcut(dpy,event,desc_context) - Display *dpy; - XEvent *event; - XContext desc_context; +void +xcut(Display *dpy, + XEvent *event, + XContext desc_context) { x_gram *gram; Window w = event->xany.window; diff --git a/zwgc/xerror.c b/zwgc/xerror.c index 33e389a..4a5a0ae 100644 --- a/zwgc/xerror.c +++ b/zwgc/xerror.c @@ -27,24 +27,24 @@ static const char rcsid_xerror_c[] = "$Id$"; int xerror_happened; /*ARGSUSED*/ -static int xerrortrap(dpy,xerrev) - Display *dpy; - XErrorEvent *xerrev; +static int +xerrortrap(Display *dpy, + XErrorEvent *xerrev) { xerror_happened = 1; return 0; } /*ARGSUSED*/ -void begin_xerror_trap(dpy) - Display *dpy; +void +begin_xerror_trap(Display *dpy) { xerror_happened = 0; XSetErrorHandler(xerrortrap); } -void end_xerror_trap(dpy) - Display *dpy; +void +end_xerror_trap(Display *dpy) { XSync(dpy,False); XSetErrorHandler(NULL); diff --git a/zwgc/xerror.h b/zwgc/xerror.h index d5a42e7..ea6702e 100644 --- a/zwgc/xerror.h +++ b/zwgc/xerror.h @@ -22,7 +22,7 @@ static const char rcsid_xerror_h[] = "$Id$"; extern int xerror_happened; -void begin_xerror_trap(); -void end_xerror_trap(); +void begin_xerror_trap(Display *); +void end_xerror_trap(Display *); #endif diff --git a/zwgc/xmark.c b/zwgc/xmark.c index 1c796f3..7285834 100644 --- a/zwgc/xmark.c +++ b/zwgc/xmark.c @@ -43,10 +43,11 @@ x_gram *oldgram = NULL; (STARTCHAR != -1) && (ENDCHAR != -1) && \ (STARTPIXEL != -1) && (ENDPIXEL != -1)) -void xmarkSetBound(gram,x,y,which) - x_gram *gram; - int x,y; - int which; +void +xmarkSetBound(x_gram *gram, + int x, + int y, + int which) { int i,xofs,yofs; XFontStruct *font; @@ -136,8 +137,9 @@ void xmarkSetBound(gram,x,y,which) } /* needs both bounds to be valid (!= -1) */ -static int xmarkNearest(x,y) - int x,y; +static int +xmarkNearest(int x, + int y) { int middle; @@ -157,11 +159,14 @@ static int xmarkNearest(x,y) } } -void xmarkExpose(dpy,w,gram,b1,p1,b2,p2) - Display *dpy; - Window w; - x_gram *gram; - unsigned int b1,p1,b2,p2; +void +xmarkExpose(Display *dpy, + Window w, + x_gram *gram, + unsigned int b1, + unsigned int p1, + unsigned int b2, + unsigned int p2) { #define swap(x,y) temp=(x); (x)=(y); (y)=temp int i,temp; @@ -226,11 +231,11 @@ void xmarkExpose(dpy,w,gram,b1,p1,b2,p2) /* Public functions: */ -void xmarkRedraw(dpy,w,gram,range) - Display *dpy; - Window w; - x_gram *gram; - int range; +void +xmarkRedraw(Display *dpy, + Window w, + x_gram *gram, + int range) { #define ob1 ((unsigned int) oldblock[XMARK_START_BOUND]) #define ob2 ((unsigned int) oldblock[XMARK_END_BOUND]) @@ -262,7 +267,8 @@ void xmarkRedraw(dpy,w,gram,range) } /* needs both bounds to be valid (!= -1) */ -int xmarkSecond() +int +xmarkSecond(void) { if (STARTBLOCK > ENDBLOCK) return(XMARK_START_BOUND); @@ -278,7 +284,8 @@ int xmarkSecond() } } -void xmarkClear() +void +xmarkClear(void) { oldblock[0]=markblock[0]; oldblock[1]=markblock[1]; @@ -295,9 +302,10 @@ void xmarkClear() markgram=NULL; } -int xmarkExtendFromFirst(gram,x,y) - x_gram *gram; - int x,y; +int +xmarkExtendFromFirst(x_gram *gram, + int x, + int y) { if (markgram != gram) { xmarkClear(); @@ -317,9 +325,10 @@ int xmarkExtendFromFirst(gram,x,y) } } -int xmarkExtendFromNearest(gram,x,y) - x_gram *gram; - int x,y; +int +xmarkExtendFromNearest(x_gram *gram, + int x, + int y) { int bound; @@ -341,7 +350,8 @@ int xmarkExtendFromNearest(gram,x,y) } } -char *xmarkGetText() +char * +xmarkGetText(void) { int i, index, len; int last_y = -1; diff --git a/zwgc/xmark.h b/zwgc/xmark.h index f440cde..55c00c2 100644 --- a/zwgc/xmark.h +++ b/zwgc/xmark.h @@ -41,11 +41,12 @@ extern x_gram *markgram; #define STARTPIXEL (markpixel[XMARK_START_BOUND]) #define ENDPIXEL (markpixel[XMARK_END_BOUND]) -extern void xmarkSetBound(); -extern int xmarkSecond(); -extern void xmarkRedraw(); -extern void xmarkClear(); -extern int xmarkExtendFromStart(); -extern int xmarkExtendFromNearest(); +extern void xmarkSetBound(x_gram *, int, int, int); +extern int xmarkSecond(void); +extern void xmarkRedraw(Display *, Window, x_gram *, int); +extern void xmarkClear(void); +extern int xmarkExtendFromFirst(x_gram *, int, int); +extern int xmarkExtendFromNearest(x_gram *, int, int); +extern char *xmarkGetText(void); #endif diff --git a/zwgc/xrevstack.c b/zwgc/xrevstack.c index 1549956..2bd3f26 100644 --- a/zwgc/xrevstack.c +++ b/zwgc/xrevstack.c @@ -28,8 +28,8 @@ x_gram *bottom_gram = NULL; x_gram *unlinked = NULL; int reverse_stack = 0; -void add_to_bottom(gram) - x_gram *gram; +void +add_to_bottom(x_gram *gram) { if (bottom_gram) { bottom_gram->below = gram; @@ -44,17 +44,19 @@ void add_to_bottom(gram) } /*ARGSUSED*/ -void pull_to_top(gram) - x_gram *gram; -{} +void +pull_to_top(x_gram *gram) +{ +} /*ARGSUSED*/ -void push_to_bottom(gram) - x_gram *gram; -{} +void +push_to_bottom(x_gram *gram) +{ +} -void delete_gram(gram) - x_gram *gram; +void +delete_gram(x_gram *gram) { if (gram == bottom_gram) { if (gram->above) { @@ -82,8 +84,8 @@ void delete_gram(gram) gram->above = gram; } -void unlink_gram(gram) - x_gram *gram; +void +unlink_gram(x_gram *gram) { delete_gram(gram); @@ -111,8 +113,8 @@ x_gram *bottom_gram=NULL; static x_gram *top_gram=NULL; #ifdef DEBUG -void print_gram_list(str) -char *str; +void +print_gram_list(char *str) { x_gram *gram; char buf[80]; @@ -135,8 +137,8 @@ char *str; } #endif -void pull_to_top(gram) -x_gram *gram; +void +pull_to_top(x_gram *gram) { if (gram==top_gram) { /* already here */ @@ -166,8 +168,8 @@ x_gram *gram; #endif } -void push_to_bottom(gram) -x_gram *gram; +void +push_to_bottom(x_gram *gram) { if (gram==bottom_gram) { /* already here */ @@ -199,8 +201,8 @@ x_gram *gram; #endif } -void unlink_gram(gram) -x_gram *gram; +void +unlink_gram(x_gram *gram) { if (top_gram==bottom_gram) { /* the only gram in the stack */ @@ -222,8 +224,8 @@ x_gram *gram; } #ifdef notdef -void add_to_top(gram) -x_gram *gram; +void +add_to_top(x_gram *gram) { if (top_gram==NULL) { gram->above=NULL; @@ -242,8 +244,8 @@ x_gram *gram; } #endif -void add_to_bottom(gram) -x_gram *gram; +void +add_to_bottom(x_gram *gram) { if (bottom_gram==NULL) { gram->above=NULL; diff --git a/zwgc/xrevstack.h b/zwgc/xrevstack.h index 061d3d5..0976821 100644 --- a/zwgc/xrevstack.h +++ b/zwgc/xrevstack.h @@ -24,10 +24,10 @@ extern x_gram *bottom_gram; /* for testing against NULL */ extern x_gram *unlinked; extern int reverse_stack; /* is reverse stack on? */ -extern void add_to_bottom(/* x_gram */); -extern void delete_gram(/* x_gram */); -extern void unlink_gram(/* x_gram */); -extern void pull_to_top(/* x_gram */); -extern void push_to_bottom(/* x_gram */); +extern void add_to_bottom(x_gram *); +extern void delete_gram(x_gram *); +extern void unlink_gram(x_gram *); +extern void pull_to_top(x_gram *); +extern void push_to_bottom(x_gram *); #endif /* _XREVSTACK_H_ */ diff --git a/zwgc/xselect.c b/zwgc/xselect.c index 9a68658..2579dc4 100644 --- a/zwgc/xselect.c +++ b/zwgc/xselect.c @@ -30,7 +30,7 @@ static const char rcsid_xselect_c[] = "$Id$"; #include "new_string.h" #include "xselect.h" -extern char *getSelectedText(); +extern char *getSelectedText(void); static Time ownership_start = CurrentTime; static Time ownership_end = CurrentTime; @@ -52,10 +52,10 @@ static struct _ZAtom { /* internal static functions */ -static void xselNotify(dpy,selreq,property) - Display *dpy; - XSelectionRequestEvent *selreq; - Atom property; +static void +xselNotify(Display *dpy, + XSelectionRequestEvent *selreq, + Atom property) { XSelectionEvent ev; @@ -82,11 +82,12 @@ static Atom RequestAtoms[] = { XChangeProperty(dpy,w,PROP(property,target),(type),(format), \ PropModeReplace, (unsigned char *) (data),(size)) -static void xselSetProperties(dpy,w,property,target,selreq) - Display *dpy; - Window w; - Atom property,target; - XSelectionRequestEvent *selreq; +static void +xselSetProperties(Display *dpy, + Window w, + Atom property, + Atom target, + XSelectionRequestEvent *selreq) { if (target==ZA_TARGETS) { @@ -136,8 +137,8 @@ static void xselSetProperties(dpy,w,property,target,selreq) /* global functions */ -void xicccmInitAtoms(dpy) - Display *dpy; +void +xicccmInitAtoms(Display *dpy) { int i; @@ -148,10 +149,10 @@ void xicccmInitAtoms(dpy) RequestAtoms[i] = *(pRequestAtoms[i]); } -int xselGetOwnership(dpy,w,time) - Display *dpy; - Window w; - Time time; +int +xselGetOwnership(Display *dpy, + Window w, + Time time) { int temp; @@ -165,10 +166,10 @@ int xselGetOwnership(dpy,w,time) } /* Get the selection. Return !0 if success, 0 if fail */ -int xselProcessSelection(dpy,w,event) - Display *dpy; - Window w; - XEvent *event; +int +xselProcessSelection(Display *dpy, + Window w, + XEvent *event) { XSelectionRequestEvent *selreq = &(event->xselectionrequest); @@ -191,16 +192,16 @@ int xselProcessSelection(dpy,w,event) return(1); } -void xselOwnershipLost(time) - Time time; +void +xselOwnershipLost(Time time) { ownership_end = time; } /*ARGSUSED*/ -void xselGiveUpOwnership(dpy,w) - Display *dpy; - Window w; +void +xselGiveUpOwnership(Display *dpy, + Window w) { XSetSelectionOwner(dpy,XA_PRIMARY,None,ownership_start); diff --git a/zwgc/xselect.h b/zwgc/xselect.h index aa2a3fd..f8fa964 100644 --- a/zwgc/xselect.h +++ b/zwgc/xselect.h @@ -17,14 +17,12 @@ #ifndef _XSELECT_H_ #define _XSELECT_H_ -extern void xicccmInitAtoms(); -extern int xselGetOwnership(); -extern int xselProcessSelection(); -extern void xselOwnershipLost(); -extern void xselGiveUpOwnership(); +extern void xicccmInitAtoms(Display *); +extern int xselGetOwnership(Display *, Window, Time); +extern int xselProcessSelection(Display *, Window, XEvent *); +extern void xselOwnershipLost(Time); +extern void xselGiveUpOwnership(Display *, Window); -extern int xwmprotoDelete(); - -extern Atom XA_WM_PROTOCOLS,XA_WM_DELETE_WINDOW; +extern Atom XA_WM_PROTOCOLS, XA_WM_DELETE_WINDOW; #endif diff --git a/zwgc/xshow.c b/zwgc/xshow.c index d970ccc..68c64eb 100644 --- a/zwgc/xshow.c +++ b/zwgc/xshow.c @@ -26,9 +26,11 @@ static const char rcsid_xshow_c[] = "$Id$"; #include #include "pointer_dictionary.h" #include "new_memory.h" +#include "new_string.h" #include "formatter.h" #include "variables.h" #include "zwgc.h" +#include "X_driver.h" #include "X_fonts.h" #include "X_gram.h" #include "xmode_stack.h" @@ -41,10 +43,9 @@ static pointer_dictionary colorname_dict = NULL; extern int internal_border_width; extern unsigned long default_bgcolor; extern unsigned long default_fgcolor; -extern unsigned long x_string_to_color(); void -xshowinit() +xshowinit(void) { desc_context = XUniqueContext(); } @@ -55,9 +56,9 @@ struct res_dict_type { char * resclass; }; -static char *xres_get_resource (restype, style) - struct res_dict_type *restype; - char *style; +static char * +xres_get_resource(struct res_dict_type *restype, + char *style) { char *desc; pointer_dictionary_binding *binding; @@ -102,10 +103,10 @@ static struct res_dict_type fgcolor_resources = { }; /*ARGSUSED*/ -char *mode_to_colorname (dpy, style, mode) - Display *dpy; - char *style; - xmode *mode; +char * +mode_to_colorname (Display *dpy, + char *style, + xmode *mode) { char *desc, *result; @@ -116,16 +117,15 @@ char *mode_to_colorname (dpy, style, mode) return result; } -void fixup_and_draw(dpy, style, auxblocks, blocks, num, lines, numlines, - beepcount) - Display *dpy; - char *style; - xblock *blocks; - xauxblock *auxblocks; - int num; - xlinedesc *lines; - int numlines; - int beepcount; +void +fixup_and_draw(Display *dpy, + char *style, + xauxblock *auxblocks, + xblock *blocks, + int num, + xlinedesc *lines, + int numlines, + int beepcount) { int gram_xalign = 1; int gram_yalign = 1; @@ -338,8 +338,8 @@ void fixup_and_draw(dpy, style, auxblocks, blocks, num, lines, numlines, } /* Silly almost-but-not-quite-useless helper function */ -char *no_dots_downcase_var(str) - char *str; +char * +no_dots_downcase_var(char *str) { register char *var, *var2; @@ -354,11 +354,11 @@ char *no_dots_downcase_var(str) #define MODE_TO_FONT(dpy,style,mode) \ get_font((dpy),(style),(mode)->font?(mode)->font:(mode)->substyle, \ (mode)->size, (mode)->bold+(mode)->italic*2) -void xshow(dpy, desc, numstr, numnl) - Display *dpy; - desctype *desc; - int numstr; - int numnl; +void +xshow(Display *dpy, + desctype *desc, + int numstr, + int numnl) { XFontStruct *font; xmode_stack modes = xmode_stack_create(); @@ -535,10 +535,10 @@ void xshow(dpy, desc, numstr, numnl) free(style); } -static void xhandleevent(dpy, w, event) - Display *dpy; - Window w; - XEvent *event; +static void +xhandleevent(Display *dpy, + Window w, + XEvent *event) { x_gram *gram; @@ -553,8 +553,8 @@ static void xhandleevent(dpy, w, event) XFlush(dpy); } -void x_get_input(dpy) - Display *dpy; +void +x_get_input(Display *dpy) { XEvent event; diff --git a/zwgc/zephyr.c b/zwgc/zephyr.c index 9ad8dbe..e1497d4 100644 --- a/zwgc/zephyr.c +++ b/zwgc/zephyr.c @@ -58,11 +58,11 @@ static unsigned short zephyr_port = 0; * modified in any way. */ -static string get_zwgc_port_number_filename() +static string +get_zwgc_port_number_filename(void) { static char buffer[40]; char *temp; - char *getenv(); if (temp = getenv("WGFILE")) return(temp); @@ -76,7 +76,8 @@ static string get_zwgc_port_number_filename() * Write out the port number to the wg file. */ -void write_wgfile() +void +write_wgfile(void) { char *name = get_zwgc_port_number_filename(); FILE *port_file; @@ -95,8 +96,8 @@ void write_wgfile() * */ -static void handle_zephyr_input(notice_handler) - void (*notice_handler)(); +static void +handle_zephyr_input(void (*notice_handler)(ZNotice_t *)) { ZNotice_t *notice; struct sockaddr_in from; @@ -124,8 +125,7 @@ static void handle_zephyr_input(notice_handler) * */ -void zephyr_init(notice_handler) - void (*notice_handler)(); +void zephyr_init(void (*notice_handler)(ZNotice_t *)) { char *temp; char *exposure; @@ -197,7 +197,7 @@ void zephyr_init(notice_handler) /* * <<<>>> */ - mux_add_input_source(ZGetFD(), (void (*)())handle_zephyr_input, + mux_add_input_source(ZGetFD(), (void (*)(void *))handle_zephyr_input, notice_handler); zephyr_inited = 1; return; @@ -207,7 +207,7 @@ void zephyr_init(notice_handler) * */ -void finalize_zephyr() /* <<<>>> */ +void finalize_zephyr(void) /* <<<>>> */ { string temp; diff --git a/zwgc/zephyr.h b/zwgc/zephyr.h index 98265df..e821bfd 100644 --- a/zwgc/zephyr.h +++ b/zwgc/zephyr.h @@ -17,8 +17,8 @@ #ifndef zephyr_MODULE #define zephyr_MODULE -extern void zephyr_init(); -extern void finalize_zephyr(); -extern void write_wgfile(); +extern void zephyr_init(void(*)(ZNotice_t *)); +extern void finalize_zephyr(void); +extern void write_wgfile(void); #endif -- cgit v1.2.3