From: laroche Date: Wed, 16 Feb 2000 11:34:40 +0000 (+0000) Subject: Nix X-Git-Tag: r0-50-1~2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=eb0a05454d304cf3b47ff97fee85035c0ead9763;p=thirdparty%2Fnewt.git Nix --- diff --git a/dialogboxes.c b/dialogboxes.c index 3bf87de..ac5453d 100644 --- a/dialogboxes.c +++ b/dialogboxes.c @@ -30,12 +30,13 @@ static void addButtons(int height, int width, newtComponent form, } } -static newtComponent textbox(int maxHeight, int width, char * text, int flags, - int * height) { +static newtComponent textbox(int maxHeight, int width, const char * text, + int flags, int * height) { newtComponent tb; int sFlag = (flags & FLAG_SCROLL_TEXT) ? NEWT_FLAG_SCROLL : 0; int i; - char * buf, * src, * dst; + char * buf, * dst; + const char * src; dst = buf = alloca(strlen(text) + 1); src = text; @@ -62,11 +63,12 @@ static newtComponent textbox(int maxHeight, int width, char * text, int flags, return tb; } -int gauge(char * text, int height, int width, poptContext optCon, int fd, +int gauge(const char * text, int height, int width, poptContext optCon, int fd, int flags) { newtComponent form, scale, tb; int top; - char * arg, * end; + const char * arg; + char * end; int val; FILE * f = fdopen(fd, "r"); char buf[3000]; @@ -125,7 +127,7 @@ int gauge(char * text, int height, int width, poptContext optCon, int fd, return DLG_OKAY; } -int inputBox(char * text, int height, int width, poptContext optCon, +int inputBox(const char * text, int height, int width, poptContext optCon, int flags, char ** result) { newtComponent form, entry, okay, cancel, answer, tb; char * val; @@ -153,11 +155,12 @@ int inputBox(char * text, int height, int width, poptContext optCon, return rc; } -int listBox(char * text, int height, int width, poptContext optCon, +int listBox(const char * text, int height, int width, poptContext optCon, int flags, char ** result) { newtComponent form, okay, tb, answer, listBox; newtComponent cancel = NULL; - char * arg, * end; + const char * arg; + char * end; int listHeight; int numItems = 0; int allocedItems = 5; @@ -168,8 +171,8 @@ int listBox(char * text, int height, int width, poptContext optCon, int maxTextWidth = 0; int scrollFlag; struct { - char * text; - char * tag; + const char * text; + const char * tag; } * itemInfo = malloc(allocedItems * sizeof(*itemInfo)); if (!(arg = poptGetArg(optCon))) return DLG_ERROR; @@ -236,11 +239,12 @@ int listBox(char * text, int height, int width, poptContext optCon, return rc; } -int checkList(char * text, int height, int width, poptContext optCon, +int checkList(const char * text, int height, int width, poptContext optCon, int useRadio, int flags, char *** selections) { newtComponent form, okay, tb, subform, answer; newtComponent sb = NULL, cancel = NULL; - char * arg, * end; + const char * arg; + char * end; int listHeight; int numBoxes = 0; int allocedBoxes = 5; @@ -251,8 +255,8 @@ int checkList(char * text, int height, int width, poptContext optCon, int maxWidth = 0; int top; struct { - char * text; - char * tag; + const char * text; + const char * tag; newtComponent comp; } * cbInfo = malloc(allocedBoxes * sizeof(*cbInfo)); char * cbStates = malloc(allocedBoxes * sizeof(cbStates)); @@ -359,7 +363,7 @@ int checkList(char * text, int height, int width, poptContext optCon, return rc; } -int messageBox(char * text, int height, int width, int type, int flags) { +int messageBox(const char * text, int height, int width, int type, int flags) { newtComponent form, yes, tb, answer; newtComponent no = NULL; int tFlag = (flags & FLAG_SCROLL_TEXT) ? NEWT_FLAG_SCROLL : 0; diff --git a/dialogboxes.h b/dialogboxes.h index b9ae127..29dab12 100644 --- a/dialogboxes.h +++ b/dialogboxes.h @@ -16,14 +16,14 @@ #define DLG_OKAY 0 #define DLG_CANCEL 1 -int messageBox(char * text, int height, int width, int type, int flags); -int checkList(char * text, int height, int width, poptContext optCon, +int messageBox(const char * text, int height, int width, int type, int flags); +int checkList(const char * text, int height, int width, poptContext optCon, int useRadio, int flags, char *** selections); -int listBox(char * text, int height, int width, poptContext optCon, +int listBox(const char * text, int height, int width, poptContext optCon, int flags, char ** result); -int inputBox(char * text, int height, int width, poptContext optCon, +int inputBox(const char * text, int height, int width, poptContext optCon, int flags, char ** result); -int gauge(char * text, int height, int width, poptContext optCon, int fd, +int gauge(const char * text, int height, int width, poptContext optCon, int fd, int flags); void useFullButtons(int state); diff --git a/whiptail.c b/whiptail.c index 9b52caa..7a7bda2 100644 --- a/whiptail.c +++ b/whiptail.c @@ -28,13 +28,13 @@ static void usage(void) { exit(1); } -int main(int argc, char ** argv) { +int main(int argc, const char ** argv) { enum mode mode = MODE_NONE; poptContext optCon; int arg; - char * optArg; - char * text; - char * nextArg; + const char * optArg; + const char * text; + const char * nextArg; char * end; int height; int width; diff --git a/whiptcl.c b/whiptcl.c index a7c6622..f137d79 100644 --- a/whiptcl.c +++ b/whiptcl.c @@ -57,9 +57,9 @@ static int wtCmd(ClientData clientData, Tcl_Interp * interp, int argc, enum mode mode = MODE_NONE; poptContext optCon; int arg; - char * optArg; - char * text; - char * nextArg; + const char * optArg; + const char * text; + const char * nextArg; char * end; int height; int width;