From 1da495103ff6c9d56106862940968bc96dd0cda1 Mon Sep 17 00:00:00 2001 From: William McBrine Date: Wed, 14 Dec 2005 19:40:29 +0000 Subject: [PATCH] I am a dope. Pre-ANSI C doesn't have "const". --- demos/ncurses_cfg.h | 12 +++++++++--- demos/ptest.c | 4 ++-- demos/tui.c | 18 +++++++++++++++++- panel.h | 8 ++++++-- panel/panel.c | 18 +++++++++--------- pdcurses/addch.c | 14 +++++++------- pdcurses/addchstr.c | 18 +++++++++--------- pdcurses/addstr.c | 18 +++++++++--------- pdcurses/insstr.c | 18 +++++++++--------- pdcurses/overlay.c | 8 ++++---- pdcurses/pdcwin.c | 4 ++-- pdcurses/slk.c | 6 +++--- x11/pdcx11.c | 2 +- 13 files changed, 87 insertions(+), 61 deletions(-) diff --git a/demos/ncurses_cfg.h b/demos/ncurses_cfg.h index a483adde..ad8d1267 100644 --- a/demos/ncurses_cfg.h +++ b/demos/ncurses_cfg.h @@ -23,8 +23,14 @@ /* Some functions we don't have */ -#define getwin(a) ((WINDOW *)(NULL)) -#define putwin(a,b) (ERR) - +#ifdef HAVE_PROTO +WINDOW *getwin(FILE *filep) { return (WINDOW *)NULL; } +int putwin(WINDOW *win, FILE *filep) { return ERR; } int tigetnum(const char *capname) { return -2; } int wchgat(WINDOW *win, int n, attr_t attr, short color, const void *opts) { return ERR; } +#else +WINDOW *getwin(filep) { return (WINDOW *)NULL; } +int putwin(win, filep) { return ERR; } +int tigetnum(capname) { return -2; } +int wchgat(win, n, attr, color, opts) { return ERR; } +#endif diff --git a/demos/ptest.c b/demos/ptest.c index 1cfcf65d..f254575c 100644 --- a/demos/ptest.c +++ b/demos/ptest.c @@ -26,7 +26,7 @@ #endif #ifdef PDCDEBUG -char *rcsid_ptest = "$Id: ptest.c,v 1.9 2005/12/08 16:33:39 wmcbrine Exp $"; +char *rcsid_ptest = "$Id: ptest.c,v 1.10 2005/12/14 19:40:29 wmcbrine Exp $"; #endif #include @@ -99,7 +99,7 @@ void saywhat(const char *text) #else void saywhat(text) -const char *text; +char *text; #endif { diff --git a/demos/tui.c b/demos/tui.c index f13f770c..bd3b4173 100644 --- a/demos/tui.c +++ b/demos/tui.c @@ -45,7 +45,7 @@ int waitforkey Args((void)); void rmerror Args((void)); #ifdef PDCDEBUG -char *rcsid_tui = "$Id: tui.c,v 1.9 2005/12/08 16:33:39 wmcbrine Exp $"; +char *rcsid_tui = "$Id: tui.c,v 1.10 2005/12/14 19:40:29 wmcbrine Exp $"; #endif #if defined(__unix) && !defined(__DJGPP__) @@ -123,7 +123,11 @@ int length; if (length > 0) { +#if __STDC__ memmove ((void *)(s+length), (const void *)s, strlen(s)+1); +#else + memmove (s+length, s, strlen(s)+1); +#endif for (i=0; i buf) { +#if __STDC__ memmove ((void *)(bp-1), (const void *)bp, strlen(bp)+1); +#else + memmove (bp-1, bp, strlen(bp)+1); +#endif bp--; } } @@ -781,7 +789,11 @@ int field; tp = bp; while ((bp > buf) && (*(bp-1) == ' ')) bp--; while ((bp > buf) && (*(bp-1) != ' ')) bp--; +#if __STDC__ memmove ((void *)bp, (const void *)tp, strlen(tp)+1); +#else + memmove (bp, tp, strlen(tp)+1); +#endif } else if (isprint(c)) { @@ -790,7 +802,11 @@ int field; { if ((int)strlen(buf) < field-1) { +#if __STDC__ memmove ((void *)(bp+1), (const void *)bp, strlen(bp)+1); +#else + memmove (bp+1, bp, strlen(bp)+1); +#endif *bp++ = c; } } diff --git a/panel.h b/panel.h index e7065a8d..7befd297 100644 --- a/panel.h +++ b/panel.h @@ -18,7 +18,7 @@ *************************************************************************** */ /* -$Id: panel.h,v 1.5 2005/12/13 06:01:20 wmcbrine Exp $ +$Id: panel.h,v 1.6 2005/12/14 19:40:28 wmcbrine Exp $ */ /* *---------------------------------------------------------------------- @@ -48,7 +48,11 @@ typedef struct panel int wendx; struct panel *below; struct panel *above; +#ifdef HAVE_PROTO const void *user; +#else + void *user; +#endif struct panelobs *obscure; } PANEL; @@ -81,7 +85,7 @@ PANEL *panel_above(); PANEL *panel_below(); int panel_hidden(); int set_panel_userptr(); -const void *panel_userptr(); +void *panel_userptr(); int move_panel(); int replace_panel(); #endif diff --git a/panel/panel.c b/panel/panel.c index fe51eff4..34173942 100644 --- a/panel/panel.c +++ b/panel/panel.c @@ -31,7 +31,7 @@ #endif #ifdef PDCDEBUG -char *rcsid_panel = "$Id: panel.c,v 1.7 2005/12/13 06:01:22 wmcbrine Exp $"; +char *rcsid_panel = "$Id: panel.c,v 1.8 2005/12/14 19:40:29 wmcbrine Exp $"; #endif @@ -386,7 +386,7 @@ STATIC bool __panel_is_linked(const PANEL *pan) #else STATIC bool __panel_is_linked(pan) -const PANEL *pan; +PANEL *pan; #endif { register PANEL *pan2 = __bottom_panel; @@ -775,7 +775,7 @@ PANEL *panel_above(const PANEL *pan) #else PANEL * panel_above(pan) -const PANEL *pan; +PANEL *pan; #endif { if(!pan) @@ -811,7 +811,7 @@ PANEL *panel_below(const PANEL *pan) #else PANEL * panel_below(pan) -const PANEL *pan; +PANEL *pan; #endif { if(!pan) @@ -844,7 +844,7 @@ int panel_hidden(const PANEL *pan) #else int panel_hidden(pan) -const PANEL *pan; +PANEL *pan; #endif { if(!pan) @@ -876,9 +876,9 @@ const PANEL *pan; #ifdef HAVE_PROTO const void *panel_userptr(const PANEL *pan) #else -const void * +void * panel_userptr(pan) -const PANEL *pan; +PANEL *pan; #endif { if(!pan) @@ -911,7 +911,7 @@ WINDOW *panel_window(const PANEL *pan) #else WINDOW * panel_window(pan) -const PANEL *pan; +PANEL *pan; #endif { #ifdef PDCDEBUG @@ -988,7 +988,7 @@ int set_panel_userptr(PANEL *pan, const void *uptr) int set_panel_userptr(pan,uptr) PANEL *pan; -const void *uptr; +void *uptr; #endif { if(!pan) diff --git a/pdcurses/addch.c b/pdcurses/addch.c index 5ed9a307..6cc7d812 100644 --- a/pdcurses/addch.c +++ b/pdcurses/addch.c @@ -40,7 +40,7 @@ #endif #ifdef PDCDEBUG -char *rcsid_addch = "$Id: addch.c,v 1.2 2005/11/19 19:07:21 wmcbrine Exp $"; +char *rcsid_addch = "$Id: addch.c,v 1.3 2005/12/14 19:40:29 wmcbrine Exp $"; #endif /*man-start********************************************************************* @@ -138,7 +138,7 @@ char *rcsid_addch = "$Id: addch.c,v 1.2 2005/11/19 19:07:21 wmcbrine Exp $"; int PDC_CDECL addch(const chtype ch) #else int PDC_CDECL addch(ch) -const chtype ch; +chtype ch; #endif /***********************************************************************/ { @@ -154,7 +154,7 @@ int PDC_CDECL waddch(WINDOW *win, const chtype ch) #else int PDC_CDECL waddch(win,ch) WINDOW *win; -const chtype ch; +chtype ch; #endif /***********************************************************************/ { @@ -171,7 +171,7 @@ int PDC_CDECL mvaddch(int y, int x, const chtype ch) int PDC_CDECL mvaddch(y,x,ch) int y; int x; -const chtype ch; +chtype ch; #endif /***********************************************************************/ { @@ -190,7 +190,7 @@ int PDC_CDECL mvwaddch(win,y,x,ch) WINDOW *win; int y; int x; -const chtype ch; +chtype ch; #endif /***********************************************************************/ { @@ -206,7 +206,7 @@ const chtype ch; int PDC_CDECL echochar(const chtype ch) #else int PDC_CDECL echochar(ch) -const chtype ch; +chtype ch; #endif /***********************************************************************/ { @@ -224,7 +224,7 @@ int PDC_CDECL wechochar(WINDOW *win, const chtype ch) #else int PDC_CDECL wechochar(win,ch) WINDOW *win; -const chtype ch; +chtype ch; #endif /***********************************************************************/ { diff --git a/pdcurses/addchstr.c b/pdcurses/addchstr.c index 93525bbe..5a94cc77 100644 --- a/pdcurses/addchstr.c +++ b/pdcurses/addchstr.c @@ -44,7 +44,7 @@ #endif #ifdef PDCDEBUG -char *rcsid_addchstr = "$Id: addchstr.c,v 1.5 2005/11/19 19:07:21 wmcbrine Exp $"; +char *rcsid_addchstr = "$Id: addchstr.c,v 1.6 2005/12/14 19:40:29 wmcbrine Exp $"; #endif /*man-start********************************************************************* @@ -99,7 +99,7 @@ char *rcsid_addchstr = "$Id: addchstr.c,v 1.5 2005/11/19 19:07:21 wmcbrine Exp int PDC_CDECL addchstr(const chtype *ch) #else int PDC_CDECL addchstr(ch) -const chtype *ch; +chtype *ch; #endif /***********************************************************************/ { @@ -114,7 +114,7 @@ const chtype *ch; int PDC_CDECL addchnstr(const chtype *ch, int n) #else int PDC_CDECL addchnstr(ch,n) -const chtype *ch; +chtype *ch; int n; #endif /***********************************************************************/ @@ -176,7 +176,7 @@ int PDC_CDECL waddchstr(WINDOW *win, const chtype *ch) #else int PDC_CDECL waddchstr(win,ch) WINDOW *win; -const chtype *ch; +chtype *ch; #endif /***********************************************************************/ { @@ -195,7 +195,7 @@ int PDC_CDECL waddchnstr(WINDOW *win, const chtype *ch, int n) #else int PDC_CDECL waddchnstr(win,ch,n) WINDOW *win; -const chtype *ch; +chtype *ch; int n; #endif /***********************************************************************/ @@ -302,7 +302,7 @@ int PDC_CDECL mvaddchstr(int y, int x, const chtype *ch) int PDC_CDECL mvaddchstr(y,x,ch) int y; int x; -const chtype *ch; +chtype *ch; #endif /***********************************************************************/ { @@ -325,7 +325,7 @@ int PDC_CDECL mvaddchnstr(int y, int x, const chtype *ch, int n) int PDC_CDECL mvaddchnstr(y,x,ch,n) int y; int x; -const chtype *ch; +chtype *ch; int n; #endif /***********************************************************************/ @@ -350,7 +350,7 @@ int PDC_CDECL mvwaddchstr(win,y,x,ch) WINDOW *win; int y; int x; -const chtype *ch; +chtype *ch; #endif /***********************************************************************/ { @@ -374,7 +374,7 @@ int PDC_CDECL mvwaddchnstr(win,y,x,ch,n) WINDOW *win; int y; int x; -const chtype *ch; +chtype *ch; int n; #endif /***********************************************************************/ diff --git a/pdcurses/addstr.c b/pdcurses/addstr.c index ddd0187e..3ac27499 100644 --- a/pdcurses/addstr.c +++ b/pdcurses/addstr.c @@ -42,7 +42,7 @@ #endif #ifdef PDCDEBUG -char *rcsid_addstr = "$Id: addstr.c,v 1.2 2005/11/19 19:07:21 wmcbrine Exp $"; +char *rcsid_addstr = "$Id: addstr.c,v 1.3 2005/12/14 19:40:29 wmcbrine Exp $"; #endif /*man-start********************************************************************* @@ -100,7 +100,7 @@ char *rcsid_addstr = "$Id: addstr.c,v 1.2 2005/11/19 19:07:21 wmcbrine Exp $"; int PDC_CDECL addstr(const char *str) #else int PDC_CDECL addstr(str) -const char *str; +char *str; #endif /***********************************************************************/ { @@ -127,7 +127,7 @@ const char *str; int PDC_CDECL addnstr(const char *str, int n) #else int PDC_CDECL addnstr(str,n) -const char *str; +char *str; int n; #endif /***********************************************************************/ @@ -158,7 +158,7 @@ int PDC_CDECL waddstr(WINDOW *win, const char *str) #else int PDC_CDECL waddstr(win,str) WINDOW *win; -const char *str; +char *str; #endif /***********************************************************************/ { @@ -186,7 +186,7 @@ int PDC_CDECL waddnstr(WINDOW *win, const char *str, int n) #else int PDC_CDECL waddnstr(win,str,n) WINDOW *win; -const char *str; +char *str; int n; #endif /***********************************************************************/ @@ -219,7 +219,7 @@ int PDC_CDECL mvaddstr(int y, int x, const char *str) int PDC_CDECL mvaddstr(y,x,str) int y; int x; -const char *str; +char *str; #endif /***********************************************************************/ { @@ -251,7 +251,7 @@ int PDC_CDECL mvaddnstr(int y, int x, const char *str, int n) int PDC_CDECL mvaddnstr(y,x,str,n) int y; int x; -const char *str; +char *str; int n; #endif /***********************************************************************/ @@ -288,7 +288,7 @@ int PDC_CDECL mvwaddstr(win,y,x,str) WINDOW *win; int y; int x; -const char *str; +char *str; #endif /***********************************************************************/ { @@ -321,7 +321,7 @@ int PDC_CDECL mvwaddnstr(win,y,x,str,n) WINDOW *win; int y; int x; -const char *str; +char *str; int n; #endif /***********************************************************************/ diff --git a/pdcurses/insstr.c b/pdcurses/insstr.c index 704fea1b..65d8d0b7 100644 --- a/pdcurses/insstr.c +++ b/pdcurses/insstr.c @@ -46,7 +46,7 @@ #endif #ifdef PDCDEBUG -char *rcsid_insstr = "$Id: insstr.c,v 1.3 2005/11/19 19:07:21 wmcbrine Exp $"; +char *rcsid_insstr = "$Id: insstr.c,v 1.4 2005/12/14 19:40:29 wmcbrine Exp $"; #endif /*man-start********************************************************************* @@ -107,7 +107,7 @@ char *rcsid_insstr = "$Id: insstr.c,v 1.3 2005/11/19 19:07:21 wmcbrine Exp $"; int PDC_CDECL insstr(const char *str) #else int PDC_CDECL insstr(str) -const char *str; +char *str; #endif /***********************************************************************/ { @@ -125,7 +125,7 @@ const char *str; int PDC_CDECL insnstr(const char *str, int n) #else int PDC_CDECL insnstr(str,n) -const char *str; +char *str; int n; #endif /***********************************************************************/ @@ -145,7 +145,7 @@ int PDC_CDECL winsstr(WINDOW *win, const char *str) #else int PDC_CDECL winsstr(win,str) WINDOW *win; -const char *str; +char *str; #endif /***********************************************************************/ { @@ -164,7 +164,7 @@ int PDC_CDECL winsnstr(WINDOW *win, const char *str, int n) #else int PDC_CDECL winsnstr(win,str,n) WINDOW *win; -const char *str; +char *str; int n; #endif /***********************************************************************/ @@ -199,7 +199,7 @@ int PDC_CDECL mvinsstr(int y, int x, const char *str) int PDC_CDECL mvinsstr(y,x,str) int y; int x; -const char *str; +char *str; #endif /***********************************************************************/ { @@ -222,7 +222,7 @@ int PDC_CDECL mvinsnstr(int y, int x, const char *str, int n) int PDC_CDECL mvinsnstr(y,x,str,n) int y; int x; -const char *str; +char *str; int n; #endif /***********************************************************************/ @@ -247,7 +247,7 @@ int PDC_CDECL mvwinsstr(win,y,x,str) WINDOW *win; int y; int x; -const char *str; +char *str; #endif /***********************************************************************/ { @@ -271,7 +271,7 @@ int PDC_CDECL mvwinsnstr(win,y,x,str,n) WINDOW *win; int y; int x; -const char *str; +char *str; int n; #endif /***********************************************************************/ diff --git a/pdcurses/overlay.c b/pdcurses/overlay.c index c641a7f4..a18a2142 100644 --- a/pdcurses/overlay.c +++ b/pdcurses/overlay.c @@ -35,7 +35,7 @@ #endif #ifdef PDCDEBUG -char *rcsid_overlay = "$Id: overlay.c,v 1.2 2005/11/19 19:07:21 wmcbrine Exp $"; +char *rcsid_overlay = "$Id: overlay.c,v 1.3 2005/12/14 19:40:29 wmcbrine Exp $"; #endif /*man-start********************************************************************* @@ -102,7 +102,7 @@ char *rcsid_overlay = "$Id: overlay.c,v 1.2 2005/11/19 19:07:21 wmcbrine Exp $" int PDC_CDECL overlay(const WINDOW *src_w, WINDOW *dst_w) #else int PDC_CDECL overlay(src_w,dst_w) -const WINDOW *src_w; +WINDOW *src_w; WINDOW *dst_w; #endif /***********************************************************************/ @@ -171,7 +171,7 @@ WINDOW *dst_w; int PDC_CDECL overwrite(const WINDOW *src_w, WINDOW *dst_w) #else int PDC_CDECL overwrite(src_w,dst_w) -const WINDOW *src_w; +WINDOW *src_w; WINDOW *dst_w; #endif /***********************************************************************/ @@ -242,7 +242,7 @@ int PDC_CDECL copywin(const WINDOW *src_w, WINDOW *dst_w, int dst_tc, int dst_br, int dst_bc, int overlay) #else int PDC_CDECL copywin(src_w,dst_w,src_tr,src_tc,dst_tr,dst_tc,dst_br,dst_bc,overlay) -const WINDOW *src_w; +WINDOW *src_w; WINDOW *dst_w; int src_tr; int src_tc; diff --git a/pdcurses/pdcwin.c b/pdcurses/pdcwin.c index 58d30d94..5326c6ed 100644 --- a/pdcurses/pdcwin.c +++ b/pdcurses/pdcwin.c @@ -36,7 +36,7 @@ #endif #ifdef PDCDEBUG -char *rcsid_PDCwin = "$Id: pdcwin.c,v 1.7 2005/11/20 04:01:01 wmcbrine Exp $"; +char *rcsid_PDCwin = "$Id: pdcwin.c,v 1.8 2005/12/14 19:40:29 wmcbrine Exp $"; #endif /*man-start********************************************************************* @@ -67,7 +67,7 @@ int PDC_copy_win(const WINDOW *src_w, WINDOW *dst_w,int src_tr,int src_tc,int src_br,int src_bc,int dst_tr,int dst_tc,int dst_br,int dst_bc,bool overlay) #else int PDC_copy_win(src_w,dst_w,src_tr,src_tc,src_br,src_bc,dst_tr,dst_tc,dst_br,dst_bc,overlay) -const WINDOW *src_w; +WINDOW *src_w; WINDOW *dst_w; int src_tr; int src_tc; diff --git a/pdcurses/slk.c b/pdcurses/slk.c index caf980e5..6a231b19 100644 --- a/pdcurses/slk.c +++ b/pdcurses/slk.c @@ -43,7 +43,7 @@ #endif #ifdef PDCDEBUG -char *rcsid_slk = "$Id: slk.c,v 1.4 2005/12/12 04:09:49 wmcbrine Exp $"; +char *rcsid_slk = "$Id: slk.c,v 1.5 2005/12/14 19:40:29 wmcbrine Exp $"; #endif /*man-start********************************************************************* @@ -219,7 +219,7 @@ static int PDC_slk_set(int label_num, const char *label_str, int label_fmt, int #else static int PDC_slk_set(label_num, label_str, label_fmt, save) int label_num; -const char *label_str; +char *label_str; int label_fmt; int save; #endif @@ -330,7 +330,7 @@ int PDC_CDECL slk_set(int label_num, const char *label_str, int label_fmt) #else int PDC_CDECL slk_set(label_num, label_str, label_fmt) int label_num; -const char *label_str; +char *label_str; int label_fmt; #endif /***********************************************************************/ diff --git a/x11/pdcx11.c b/x11/pdcx11.c index 9179d58a..89304ad2 100644 --- a/x11/pdcx11.c +++ b/x11/pdcx11.c @@ -932,7 +932,7 @@ int xerror(); void say(const char *msg) #else void say(msg) -const char *msg; +char *msg; #endif { #ifdef PDCDEBUG