]> git.ipfire.org Git - thirdparty/newt.git/commitdiff
1) patch from Bruce Perens which makes newt easier to build on debian
authorewt <ewt>
Sat, 3 Jan 1998 23:00:28 +0000 (23:00 +0000)
committerewt <ewt>
Sat, 3 Jan 1998 23:00:28 +0000 (23:00 +0000)
2) whiptail patch from Bruce which adds --infobox

16 files changed:
Makefile
button.c
checkbox.c
dialogboxes.c
dialogboxes.h
entry.c
form.c
label.c
listbox.c
newt.c
scale.c
scrollbar.c
showchars.c
showkey.c
textbox.c
whiptail.c

index 3b94bc4a404261954c816cb9bc795bcbcdfc1da2..8ce0ab24f75ca2e3b3fb1ee78dd6038232ae49e4 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,9 +1,9 @@
 LIBS = -lslang -lm #-lefence
 SHLIBS = -lslang -lm -lc
 
-CFLAGS = $(RPM_OPT_FLAGS) -Wall
+CFLAGS = $(RPM_OPT_FLAGS) -Wall -I/usr/include/slang
 ifeq ($(RPM_OPT_FLAGS),)
-CFLAGS += -g -O2
+CFLAGS += -g # -O2 -I/usr/include/slang
 endif
 
 VERSION = 0.21
index cb60d41cba0d23c092981245c0d950d08c93e2fe..35081bce0668f1804bfa1f8799ecc8ab1b1151e6 100644 (file)
--- a/button.c
+++ b/button.c
@@ -1,4 +1,4 @@
-#include <slang/slang.h>
+#include <slang.h>
 #include <stdlib.h>
 #include <string.h>
 
index ba3e19034d46945d64be0fbece26ee3c9a332361..1c798aff7b411a91c1c2b175f9dcb88b54923c9d 100644 (file)
@@ -1,4 +1,4 @@
-#include <slang/slang.h>
+#include <slang.h>
 #include <stdlib.h>
 #include <string.h>
 
index 1fadb71c07f8402e152c62c589364837a0898e59..fd9d269f5a419412449a7dcb4de9d51db933a913 100644 (file)
@@ -372,10 +372,14 @@ int messageBox(char * text, int height, int width, int type, int flags) {
 
     newtFormAddComponent(form, tb);
 
-    if (type == MSGBOX_MSG) {
+    switch ( type ) {
+    case MSGBOX_INFO:
+       break;
+    case MSGBOX_MSG:
        yes = makeButton((width - 8) / 2, height - 1 - buttonHeight, "Ok");
        newtFormAddComponent(form, yes);
-    } else {
+       break;
+    default:
        yes = makeButton((width - 16) / 3, height - 1 - buttonHeight, "Yes");
        no = makeButton(((width - 16) / 3) * 2 + 9, height - 1 - buttonHeight, 
                        "No");
@@ -385,11 +389,20 @@ int messageBox(char * text, int height, int width, int type, int flags) {
            newtFormSetCurrent(form, no);
     }
 
-    newtRunForm(form);
-    answer = newtFormGetCurrent(form);
+    if ( type != MSGBOX_INFO ) {
+       newtRunForm(form);
+
+       answer = newtFormGetCurrent(form);
+
+       if (answer == no)
+           return DLG_CANCEL;
+    }
+    else {
+       newtDrawForm(form);
+       newtRefresh();
+    }
+       
 
-    if (answer == no)
-       return DLG_CANCEL;
 
     return DLG_OKAY;
 }
index 0cf17c293dca28c51d66d3333dc577ebc83e1782..b9ae1278d4faacae168fcc681c76b0048a107c2f 100644 (file)
@@ -5,6 +5,7 @@
 
 #define MSGBOX_MSG 0 
 #define MSGBOX_YESNO 1
+#define MSGBOX_INFO 2
 
 #define FLAG_NOITEM            (1 << 0)
 #define FLAG_NOCANCEL          (1 << 1)
diff --git a/entry.c b/entry.c
index 43e598ee47c3e4cf8ad7a36a27dbc4f3aedbcbc5..12f22e3621f46f3973acbaa686e2e57ce88cd31d 100644 (file)
--- a/entry.c
+++ b/entry.c
@@ -1,5 +1,5 @@
 #include <ctype.h>
-#include <slang/slang.h>
+#include <slang.h>
 #include <stdlib.h>
 #include <string.h>
 
diff --git a/form.c b/form.c
index de7d5e102cf316c9d64e3668ba3ad1cc38801196..7bf8f48d6601849d2eeb09ea2a8ffc0a5513d06d 100644 (file)
--- a/form.c
+++ b/form.c
@@ -1,4 +1,4 @@
-#include <slang/slang.h>
+#include <slang.h>
 #include <stdarg.h>
 #include <stdlib.h>
 
diff --git a/label.c b/label.c
index c945d5a752d93be2a2cfa0506e29a39e7abb94c6..5c253cd8f2a3ae3f9c4118314b405fcae4fd0b85 100644 (file)
--- a/label.c
+++ b/label.c
@@ -1,4 +1,4 @@
-#include <slang/slang.h>
+#include <slang.h>
 #include <stdlib.h>
 #include <string.h>
 
index 3fb300dcb7febc4418849d2180e5efc32fe3f6c4..249db8dc6dda0675c53edb24150e54405975732c 100644 (file)
--- a/listbox.c
+++ b/listbox.c
@@ -3,7 +3,7 @@
    and contributed to newt for use under the LGPL license.
    Copyright (C) 1996, 1997 Elliot Lee */
 
-#include <slang/slang.h>
+#include <slang.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
diff --git a/newt.c b/newt.c
index 48c957c5459f82d6d1ef214ab8d02ebbd28ba2a2..817af3b30ba4a27fdc19d9000a457d4616a89dc2 100644 (file)
--- a/newt.c
+++ b/newt.c
@@ -1,4 +1,4 @@
-#include <slang/slang.h>
+#include <slang.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
diff --git a/scale.c b/scale.c
index fc533706075c29379fa6272819faa99f85d76748..e9327db264281b3ebc489cdc37d380762aa25efe 100644 (file)
--- a/scale.c
+++ b/scale.c
@@ -1,4 +1,4 @@
-#include <slang/slang.h>
+#include <slang.h>
 #include <stdlib.h>
 #include <string.h>
 
index 57e7e634d9248a8613774977040ebd904e765f7d..ff2337c21a16ba3b9db7faff79a8f7edfe02f78c 100644 (file)
@@ -1,4 +1,4 @@
-#include <slang/slang.h>
+#include <slang.h>
 #include <stdlib.h>
 #include <string.h>
 
index 0fc117f0fabb5b6c0bbe59c36567f2fe9773133f..71d0adbd1e0284efb2adafbc20401419af5aea06 100644 (file)
@@ -1,4 +1,4 @@
-#include <slang/slang.h>
+#include <slang.h>
 
 void printall(int offset) {
     int n = 0;
index 51d9193c677208afe5978b6e80e126ac1b73a4aa..0db804bdf734d9a51341c743806bc3c6ae6c01ad 100644 (file)
--- a/showkey.c
+++ b/showkey.c
@@ -1,5 +1,5 @@
 #include <stdio.h>
-#include <slang/slang.h>
+#include <slang.h>
 
 int main(void) {
     char n = 0;
index 4a4757d82fdf8dd66f790e2b172fd7d8e63d8a7d..640defce0c77dbade58aba001835545bbd4a353e 100644 (file)
--- a/textbox.c
+++ b/textbox.c
@@ -1,5 +1,5 @@
 #include <ctype.h>
-#include <slang/slang.h>
+#include <slang.h>
 #include <stdlib.h>
 #include <string.h>
 
index 95680ec00f05f0a80217f68e862ee76c0e91a5a3..fb93a921af35b9def0db3776240855ac0e8b88cb 100644 (file)
@@ -10,8 +10,8 @@
 #include "dialogboxes.h"
 #include "newt.h"
 
-enum mode { MODE_NONE, MODE_MSGBOX, MODE_YESNO, MODE_CHECKLIST, MODE_INPUTBOX,
-           MODE_RADIOLIST, MODE_MENU, MODE_GAUGE };
+enum mode { MODE_NONE, MODE_INFOBOX, MODE_MSGBOX, MODE_YESNO, MODE_CHECKLIST,
+               MODE_INPUTBOX, MODE_RADIOLIST, MODE_MENU, MODE_GAUGE };
 
 #define OPT_MSGBOX             1000
 #define OPT_CHECKLIST          1001
@@ -21,6 +21,7 @@ enum mode { MODE_NONE, MODE_MSGBOX, MODE_YESNO, MODE_CHECKLIST, MODE_INPUTBOX,
 #define OPT_MENU               1005
 #define OPT_RADIOLIST          1006
 #define OPT_GAUGE              1007
+#define OPT_INFOBOX            1008
 
 static void usage(void) {
     fprintf(stderr, "whiptail: bad parametrs (see man dialog(1) for details)\n");
@@ -60,6 +61,7 @@ int main(int argc, char ** argv) {
            { "fb", '\0', 0, 0, OPT_FULLBUTTONS },
            { "fullbuttons", '\0', 0, 0, OPT_FULLBUTTONS },
            { "gauge", '\0', 0, 0, OPT_GAUGE },
+           { "infobox", '\0', 0, 0, OPT_INFOBOX },
            { "menu", '\0', 0, 0, OPT_MENU },
            { "msgbox", '\0', 0, 0, OPT_MSGBOX },
            { "nocancel", '\0', 0, &noCancel, 0 },
@@ -78,6 +80,11 @@ int main(int argc, char ** argv) {
        optArg = poptGetOptArg(optCon);
 
        switch (arg) {
+         case OPT_INFOBOX:
+           if (mode != MODE_NONE) usage();
+           mode = MODE_INFOBOX;
+           break;
+
          case OPT_MENU:
            if (mode != MODE_NONE) usage();
            mode = MODE_MENU;
@@ -163,6 +170,10 @@ int main(int argc, char ** argv) {
        rc = messageBox(text, height, width, MSGBOX_MSG, flags);
        break;
 
+      case MODE_INFOBOX:
+       rc = messageBox(text, height, width, MSGBOX_INFO, flags);
+       break;
+
       case MODE_YESNO:
        rc = messageBox(text, height, width, MSGBOX_YESNO, flags);
        break;