build: add new menuconfig code based on linux 3.9
SVN-Revision: 36361v19.07.3_mercusys_ac12_duma
parent
97e7fdf6fd
commit
9d5510a500
@ -1,2 +1,2 @@
|
|||||||
These files were taken from the Linux 2.6.16.7 Kernel
|
These files were taken from the Linux 3.9 Kernel
|
||||||
Configuration System and modified for the OpenWrt Buildroot.
|
Configuration System and modified for the OpenWrt Buildroot.
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -1,35 +0,0 @@
|
|||||||
#include <dlfcn.h>
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
|
|
||||||
#include "lkc.h"
|
|
||||||
|
|
||||||
#define P(name,type,arg) type (*name ## _p) arg
|
|
||||||
#include "lkc_proto.h"
|
|
||||||
#undef P
|
|
||||||
|
|
||||||
void kconfig_load(void)
|
|
||||||
{
|
|
||||||
void *handle;
|
|
||||||
char *error;
|
|
||||||
|
|
||||||
handle = dlopen("./libkconfig.so", RTLD_LAZY);
|
|
||||||
if (!handle) {
|
|
||||||
handle = dlopen("./scripts/kconfig/libkconfig.so", RTLD_LAZY);
|
|
||||||
if (!handle) {
|
|
||||||
fprintf(stderr, "%s\n", dlerror());
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#define P(name,type,arg) \
|
|
||||||
{ \
|
|
||||||
name ## _p = dlsym(handle, #name); \
|
|
||||||
if ((error = dlerror())) { \
|
|
||||||
fprintf(stderr, "%s\n", error); \
|
|
||||||
exit(1); \
|
|
||||||
} \
|
|
||||||
}
|
|
||||||
#include "lkc_proto.h"
|
|
||||||
#undef P
|
|
||||||
}
|
|
@ -1 +0,0 @@
|
|||||||
No backing up.
|
|
@ -0,0 +1,91 @@
|
|||||||
|
#ifndef LIST_H
|
||||||
|
#define LIST_H
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Copied from include/linux/...
|
||||||
|
*/
|
||||||
|
|
||||||
|
#undef offsetof
|
||||||
|
#define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* container_of - cast a member of a structure out to the containing structure
|
||||||
|
* @ptr: the pointer to the member.
|
||||||
|
* @type: the type of the container struct this is embedded in.
|
||||||
|
* @member: the name of the member within the struct.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
#define container_of(ptr, type, member) ({ \
|
||||||
|
const typeof( ((type *)0)->member ) *__mptr = (ptr); \
|
||||||
|
(type *)( (char *)__mptr - offsetof(type,member) );})
|
||||||
|
|
||||||
|
|
||||||
|
struct list_head {
|
||||||
|
struct list_head *next, *prev;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
#define LIST_HEAD_INIT(name) { &(name), &(name) }
|
||||||
|
|
||||||
|
#define LIST_HEAD(name) \
|
||||||
|
struct list_head name = LIST_HEAD_INIT(name)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* list_entry - get the struct for this entry
|
||||||
|
* @ptr: the &struct list_head pointer.
|
||||||
|
* @type: the type of the struct this is embedded in.
|
||||||
|
* @member: the name of the list_struct within the struct.
|
||||||
|
*/
|
||||||
|
#define list_entry(ptr, type, member) \
|
||||||
|
container_of(ptr, type, member)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* list_for_each_entry - iterate over list of given type
|
||||||
|
* @pos: the type * to use as a loop cursor.
|
||||||
|
* @head: the head for your list.
|
||||||
|
* @member: the name of the list_struct within the struct.
|
||||||
|
*/
|
||||||
|
#define list_for_each_entry(pos, head, member) \
|
||||||
|
for (pos = list_entry((head)->next, typeof(*pos), member); \
|
||||||
|
&pos->member != (head); \
|
||||||
|
pos = list_entry(pos->member.next, typeof(*pos), member))
|
||||||
|
|
||||||
|
/**
|
||||||
|
* list_empty - tests whether a list is empty
|
||||||
|
* @head: the list to test.
|
||||||
|
*/
|
||||||
|
static inline int list_empty(const struct list_head *head)
|
||||||
|
{
|
||||||
|
return head->next == head;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Insert a new entry between two known consecutive entries.
|
||||||
|
*
|
||||||
|
* This is only for internal list manipulation where we know
|
||||||
|
* the prev/next entries already!
|
||||||
|
*/
|
||||||
|
static inline void __list_add(struct list_head *_new,
|
||||||
|
struct list_head *prev,
|
||||||
|
struct list_head *next)
|
||||||
|
{
|
||||||
|
next->prev = _new;
|
||||||
|
_new->next = next;
|
||||||
|
_new->prev = prev;
|
||||||
|
prev->next = _new;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* list_add_tail - add a new entry
|
||||||
|
* @new: new entry to be added
|
||||||
|
* @head: list head to add it before
|
||||||
|
*
|
||||||
|
* Insert a new entry before the specified head.
|
||||||
|
* This is useful for implementing queues.
|
||||||
|
*/
|
||||||
|
static inline void list_add_tail(struct list_head *_new, struct list_head *head)
|
||||||
|
{
|
||||||
|
__list_add(_new, head->prev, head);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
@ -1,28 +0,0 @@
|
|||||||
# Makefile to build lxdialog package
|
|
||||||
#
|
|
||||||
|
|
||||||
all: lxdialog
|
|
||||||
|
|
||||||
# Use reursively expanded variables so we do not call gcc unless
|
|
||||||
# we really need to do so. (Do not call gcc as part of make mrproper)
|
|
||||||
CFLAGS := $(shell sh check-lxdialog.sh -ccflags)
|
|
||||||
LIBS := $(shell sh check-lxdialog.sh -ldflags gcc)
|
|
||||||
|
|
||||||
# workaround for OpenBSD, which does not use symlinks to libncurses.so
|
|
||||||
OS := $(shell uname -s)
|
|
||||||
ifeq ($(strip $(OS)),OpenBSD)
|
|
||||||
LIBS := -lncurses
|
|
||||||
endif
|
|
||||||
ifeq ($(shell uname -o),Cygwin)
|
|
||||||
LIBS := -lncurses
|
|
||||||
endif
|
|
||||||
always := $(hostprogs-y) dochecklxdialog
|
|
||||||
|
|
||||||
%.o: %.c
|
|
||||||
$(CC) -c $(CFLAGS) -o $@ $<
|
|
||||||
|
|
||||||
lxdialog: checklist.o menubox.o textbox.o yesno.o inputbox.o util.o lxdialog.o msgbox.o
|
|
||||||
$(CC) -o $@ $^ $(LIBS)
|
|
||||||
|
|
||||||
clean:
|
|
||||||
rm -f *.o lxdialog
|
|
@ -1,154 +0,0 @@
|
|||||||
/*
|
|
||||||
* colors.h -- color attribute definitions
|
|
||||||
*
|
|
||||||
* AUTHOR: Savio Lam (lam836@cs.cuhk.hk)
|
|
||||||
*
|
|
||||||
* This program is free software; you can redistribute it and/or
|
|
||||||
* modify it under the terms of the GNU General Public License
|
|
||||||
* as published by the Free Software Foundation; either version 2
|
|
||||||
* of the License, or (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program; if not, write to the Free Software
|
|
||||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Default color definitions
|
|
||||||
*
|
|
||||||
* *_FG = foreground
|
|
||||||
* *_BG = background
|
|
||||||
* *_HL = highlight?
|
|
||||||
*/
|
|
||||||
#define SCREEN_FG COLOR_CYAN
|
|
||||||
#define SCREEN_BG COLOR_BLUE
|
|
||||||
#define SCREEN_HL TRUE
|
|
||||||
|
|
||||||
#define SHADOW_FG COLOR_BLACK
|
|
||||||
#define SHADOW_BG COLOR_BLACK
|
|
||||||
#define SHADOW_HL TRUE
|
|
||||||
|
|
||||||
#define DIALOG_FG COLOR_BLACK
|
|
||||||
#define DIALOG_BG COLOR_WHITE
|
|
||||||
#define DIALOG_HL FALSE
|
|
||||||
|
|
||||||
#define TITLE_FG COLOR_BLUE
|
|
||||||
#define TITLE_BG COLOR_WHITE
|
|
||||||
#define TITLE_HL TRUE
|
|
||||||
|
|
||||||
#define BORDER_FG COLOR_WHITE
|
|
||||||
#define BORDER_BG COLOR_WHITE
|
|
||||||
#define BORDER_HL TRUE
|
|
||||||
|
|
||||||
#define BUTTON_ACTIVE_FG COLOR_WHITE
|
|
||||||
#define BUTTON_ACTIVE_BG COLOR_BLUE
|
|
||||||
#define BUTTON_ACTIVE_HL TRUE
|
|
||||||
|
|
||||||
#define BUTTON_INACTIVE_FG COLOR_BLACK
|
|
||||||
#define BUTTON_INACTIVE_BG COLOR_WHITE
|
|
||||||
#define BUTTON_INACTIVE_HL FALSE
|
|
||||||
|
|
||||||
#define BUTTON_KEY_ACTIVE_FG COLOR_WHITE
|
|
||||||
#define BUTTON_KEY_ACTIVE_BG COLOR_BLUE
|
|
||||||
#define BUTTON_KEY_ACTIVE_HL TRUE
|
|
||||||
|
|
||||||
#define BUTTON_KEY_INACTIVE_FG COLOR_RED
|
|
||||||
#define BUTTON_KEY_INACTIVE_BG COLOR_WHITE
|
|
||||||
#define BUTTON_KEY_INACTIVE_HL FALSE
|
|
||||||
|
|
||||||
#define BUTTON_LABEL_ACTIVE_FG COLOR_YELLOW
|
|
||||||
#define BUTTON_LABEL_ACTIVE_BG COLOR_BLUE
|
|
||||||
#define BUTTON_LABEL_ACTIVE_HL TRUE
|
|
||||||
|
|
||||||
#define BUTTON_LABEL_INACTIVE_FG COLOR_BLACK
|
|
||||||
#define BUTTON_LABEL_INACTIVE_BG COLOR_WHITE
|
|
||||||
#define BUTTON_LABEL_INACTIVE_HL TRUE
|
|
||||||
|
|
||||||
#define INPUTBOX_FG COLOR_BLACK
|
|
||||||
#define INPUTBOX_BG COLOR_WHITE
|
|
||||||
#define INPUTBOX_HL FALSE
|
|
||||||
|
|
||||||
#define INPUTBOX_BORDER_FG COLOR_BLACK
|
|
||||||
#define INPUTBOX_BORDER_BG COLOR_WHITE
|
|
||||||
#define INPUTBOX_BORDER_HL FALSE
|
|
||||||
|
|
||||||
#define SEARCHBOX_FG COLOR_BLACK
|
|
||||||
#define SEARCHBOX_BG COLOR_WHITE
|
|
||||||
#define SEARCHBOX_HL FALSE
|
|
||||||
|
|
||||||
#define SEARCHBOX_TITLE_FG COLOR_BLUE
|
|
||||||
#define SEARCHBOX_TITLE_BG COLOR_WHITE
|
|
||||||
#define SEARCHBOX_TITLE_HL TRUE
|
|
||||||
|
|
||||||
#define SEARCHBOX_BORDER_FG COLOR_WHITE
|
|
||||||
#define SEARCHBOX_BORDER_BG COLOR_WHITE
|
|
||||||
#define SEARCHBOX_BORDER_HL TRUE
|
|
||||||
|
|
||||||
#define POSITION_INDICATOR_FG COLOR_BLUE
|
|
||||||
#define POSITION_INDICATOR_BG COLOR_WHITE
|
|
||||||
#define POSITION_INDICATOR_HL TRUE
|
|
||||||
|
|
||||||
#define MENUBOX_FG COLOR_BLACK
|
|
||||||
#define MENUBOX_BG COLOR_WHITE
|
|
||||||
#define MENUBOX_HL FALSE
|
|
||||||
|
|
||||||
#define MENUBOX_BORDER_FG COLOR_WHITE
|
|
||||||
#define MENUBOX_BORDER_BG COLOR_WHITE
|
|
||||||
#define MENUBOX_BORDER_HL TRUE
|
|
||||||
|
|
||||||
#define ITEM_FG COLOR_BLACK
|
|
||||||
#define ITEM_BG COLOR_WHITE
|
|
||||||
#define ITEM_HL FALSE
|
|
||||||
|
|
||||||
#define ITEM_SELECTED_FG COLOR_WHITE
|
|
||||||
#define ITEM_SELECTED_BG COLOR_BLUE
|
|
||||||
#define ITEM_SELECTED_HL TRUE
|
|
||||||
|
|
||||||
#define TAG_FG COLOR_BLUE
|
|
||||||
#define TAG_BG COLOR_WHITE
|
|
||||||
#define TAG_HL TRUE
|
|
||||||
|
|
||||||
#define TAG_SELECTED_FG COLOR_YELLOW
|
|
||||||
#define TAG_SELECTED_BG COLOR_BLUE
|
|
||||||
#define TAG_SELECTED_HL TRUE
|
|
||||||
|
|
||||||
#define TAG_KEY_FG COLOR_BLUE
|
|
||||||
#define TAG_KEY_BG COLOR_WHITE
|
|
||||||
#define TAG_KEY_HL TRUE
|
|
||||||
|
|
||||||
#define TAG_KEY_SELECTED_FG COLOR_YELLOW
|
|
||||||
#define TAG_KEY_SELECTED_BG COLOR_BLUE
|
|
||||||
#define TAG_KEY_SELECTED_HL TRUE
|
|
||||||
|
|
||||||
#define CHECK_FG COLOR_BLACK
|
|
||||||
#define CHECK_BG COLOR_WHITE
|
|
||||||
#define CHECK_HL FALSE
|
|
||||||
|
|
||||||
#define CHECK_SELECTED_FG COLOR_WHITE
|
|
||||||
#define CHECK_SELECTED_BG COLOR_BLUE
|
|
||||||
#define CHECK_SELECTED_HL TRUE
|
|
||||||
|
|
||||||
#define UARROW_FG COLOR_GREEN
|
|
||||||
#define UARROW_BG COLOR_WHITE
|
|
||||||
#define UARROW_HL TRUE
|
|
||||||
|
|
||||||
#define DARROW_FG COLOR_GREEN
|
|
||||||
#define DARROW_BG COLOR_WHITE
|
|
||||||
#define DARROW_HL TRUE
|
|
||||||
|
|
||||||
/* End of default color definitions */
|
|
||||||
|
|
||||||
#define C_ATTR(x,y) ((x ? A_BOLD : 0) | COLOR_PAIR((y)))
|
|
||||||
#define COLOR_NAME_LEN 10
|
|
||||||
#define COLOR_COUNT 8
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Global variables
|
|
||||||
*/
|
|
||||||
|
|
||||||
extern int color_table[][3];
|
|
@ -1,204 +0,0 @@
|
|||||||
/*
|
|
||||||
* dialog - Display simple dialog boxes from shell scripts
|
|
||||||
*
|
|
||||||
* ORIGINAL AUTHOR: Savio Lam (lam836@cs.cuhk.hk)
|
|
||||||
* MODIFIED FOR LINUX KERNEL CONFIG BY: William Roadcap (roadcap@cfw.com)
|
|
||||||
*
|
|
||||||
* This program is free software; you can redistribute it and/or
|
|
||||||
* modify it under the terms of the GNU General Public License
|
|
||||||
* as published by the Free Software Foundation; either version 2
|
|
||||||
* of the License, or (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program; if not, write to the Free Software
|
|
||||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "dialog.h"
|
|
||||||
|
|
||||||
static void Usage(const char *name);
|
|
||||||
|
|
||||||
typedef int (jumperFn) (const char *title, int argc, const char *const *argv);
|
|
||||||
|
|
||||||
struct Mode {
|
|
||||||
char *name;
|
|
||||||
int argmin, argmax, argmod;
|
|
||||||
jumperFn *jumper;
|
|
||||||
};
|
|
||||||
|
|
||||||
jumperFn j_menu, j_radiolist, j_yesno, j_textbox, j_inputbox;
|
|
||||||
jumperFn j_msgbox, j_infobox;
|
|
||||||
|
|
||||||
static struct Mode modes[] = {
|
|
||||||
{"--menu", 9, 0, 3, j_menu},
|
|
||||||
{"--radiolist", 9, 0, 3, j_radiolist},
|
|
||||||
{"--yesno", 5, 5, 1, j_yesno},
|
|
||||||
{"--textbox", 5, 5, 1, j_textbox},
|
|
||||||
{"--inputbox", 5, 6, 1, j_inputbox},
|
|
||||||
{"--msgbox", 5, 5, 1, j_msgbox},
|
|
||||||
{"--infobox", 5, 5, 1, j_infobox},
|
|
||||||
{NULL, 0, 0, 0, NULL}
|
|
||||||
};
|
|
||||||
|
|
||||||
static struct Mode *modePtr;
|
|
||||||
|
|
||||||
#ifdef LOCALE
|
|
||||||
#include <locale.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
int main(int argc, const char *const *argv)
|
|
||||||
{
|
|
||||||
int offset = 0, opt_clear = 0, end_common_opts = 0, retval;
|
|
||||||
const char *title = NULL;
|
|
||||||
|
|
||||||
#ifdef LOCALE
|
|
||||||
(void)setlocale(LC_ALL, "");
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef TRACE
|
|
||||||
trace(TRACE_CALLS | TRACE_UPDATE);
|
|
||||||
#endif
|
|
||||||
if (argc < 2) {
|
|
||||||
Usage(argv[0]);
|
|
||||||
exit(-1);
|
|
||||||
}
|
|
||||||
|
|
||||||
while (offset < argc - 1 && !end_common_opts) { /* Common options */
|
|
||||||
if (!strcmp(argv[offset + 1], "--title")) {
|
|
||||||
if (argc - offset < 3 || title != NULL) {
|
|
||||||
Usage(argv[0]);
|
|
||||||
exit(-1);
|
|
||||||
} else {
|
|
||||||
title = argv[offset + 2];
|
|
||||||
offset += 2;
|
|
||||||
}
|
|
||||||
} else if (!strcmp(argv[offset + 1], "--backtitle")) {
|
|
||||||
if (backtitle != NULL) {
|
|
||||||
Usage(argv[0]);
|
|
||||||
exit(-1);
|
|
||||||
} else {
|
|
||||||
backtitle = argv[offset + 2];
|
|
||||||
offset += 2;
|
|
||||||
}
|
|
||||||
} else if (!strcmp(argv[offset + 1], "--clear")) {
|
|
||||||
if (opt_clear) { /* Hey, "--clear" can't appear twice! */
|
|
||||||
Usage(argv[0]);
|
|
||||||
exit(-1);
|
|
||||||
} else if (argc == 2) { /* we only want to clear the screen */
|
|
||||||
init_dialog();
|
|
||||||
refresh(); /* init_dialog() will clear the screen for us */
|
|
||||||
end_dialog();
|
|
||||||
return 0;
|
|
||||||
} else {
|
|
||||||
opt_clear = 1;
|
|
||||||
offset++;
|
|
||||||
}
|
|
||||||
} else /* no more common options */
|
|
||||||
end_common_opts = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (argc - 1 == offset) { /* no more options */
|
|
||||||
Usage(argv[0]);
|
|
||||||
exit(-1);
|
|
||||||
}
|
|
||||||
/* use a table to look for the requested mode, to avoid code duplication */
|
|
||||||
|
|
||||||
for (modePtr = modes; modePtr->name; modePtr++) /* look for the mode */
|
|
||||||
if (!strcmp(argv[offset + 1], modePtr->name))
|
|
||||||
break;
|
|
||||||
|
|
||||||
if (!modePtr->name)
|
|
||||||
Usage(argv[0]);
|
|
||||||
if (argc - offset < modePtr->argmin)
|
|
||||||
Usage(argv[0]);
|
|
||||||
if (modePtr->argmax && argc - offset > modePtr->argmax)
|
|
||||||
Usage(argv[0]);
|
|
||||||
|
|
||||||
init_dialog();
|
|
||||||
retval = (*(modePtr->jumper)) (title, argc - offset, argv + offset);
|
|
||||||
|
|
||||||
if (opt_clear) { /* clear screen before exit */
|
|
||||||
attr_clear(stdscr, LINES, COLS, screen_attr);
|
|
||||||
refresh();
|
|
||||||
}
|
|
||||||
end_dialog();
|
|
||||||
|
|
||||||
exit(retval);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Print program usage
|
|
||||||
*/
|
|
||||||
static void Usage(const char *name)
|
|
||||||
{
|
|
||||||
fprintf(stderr, "\
|
|
||||||
\ndialog, by Savio Lam (lam836@cs.cuhk.hk).\
|
|
||||||
\n patched by Stuart Herbert (S.Herbert@shef.ac.uk)\
|
|
||||||
\n modified/gutted for use as a Linux kernel config tool by \
|
|
||||||
\n William Roadcap (roadcapw@cfw.com)\
|
|
||||||
\n\
|
|
||||||
\n* Display dialog boxes from shell scripts *\
|
|
||||||
\n\
|
|
||||||
\nUsage: %s --clear\
|
|
||||||
\n %s [--title <title>] [--backtitle <backtitle>] --clear <Box options>\
|
|
||||||
\n\
|
|
||||||
\nBox options:\
|
|
||||||
\n\
|
|
||||||
\n --menu <text> <height> <width> <menu height> <tag1> <item1>...\
|
|
||||||
\n --radiolist <text> <height> <width> <list height> <tag1> <item1> <status1>...\
|
|
||||||
\n --textbox <file> <height> <width>\
|
|
||||||
\n --inputbox <text> <height> <width> [<init>]\
|
|
||||||
\n --yesno <text> <height> <width>\
|
|
||||||
\n", name, name);
|
|
||||||
exit(-1);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* These are the program jumpers
|
|
||||||
*/
|
|
||||||
|
|
||||||
int j_menu(const char *t, int ac, const char *const *av)
|
|
||||||
{
|
|
||||||
return dialog_menu(t, av[2], atoi(av[3]), atoi(av[4]),
|
|
||||||
atoi(av[5]), av[6], (ac - 6) / 2, av + 7);
|
|
||||||
}
|
|
||||||
|
|
||||||
int j_radiolist(const char *t, int ac, const char *const *av)
|
|
||||||
{
|
|
||||||
return dialog_checklist(t, av[2], atoi(av[3]), atoi(av[4]),
|
|
||||||
atoi(av[5]), (ac - 6) / 3, av + 6);
|
|
||||||
}
|
|
||||||
|
|
||||||
int j_textbox(const char *t, int ac, const char *const *av)
|
|
||||||
{
|
|
||||||
return dialog_textbox(t, av[2], atoi(av[3]), atoi(av[4]));
|
|
||||||
}
|
|
||||||
|
|
||||||
int j_yesno(const char *t, int ac, const char *const *av)
|
|
||||||
{
|
|
||||||
return dialog_yesno(t, av[2], atoi(av[3]), atoi(av[4]));
|
|
||||||
}
|
|
||||||
|
|
||||||
int j_inputbox(const char *t, int ac, const char *const *av)
|
|
||||||
{
|
|
||||||
int ret = dialog_inputbox(t, av[2], atoi(av[3]), atoi(av[4]),
|
|
||||||
ac == 6 ? av[5] : (char *)NULL);
|
|
||||||
if (ret == 0)
|
|
||||||
fprintf(stderr, "%s", dialog_input_result);
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
int j_msgbox(const char *t, int ac, const char *const *av)
|
|
||||||
{
|
|
||||||
return dialog_msgbox(t, av[2], atoi(av[3]), atoi(av[4]), 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
int j_infobox(const char *t, int ac, const char *const *av)
|
|
||||||
{
|
|
||||||
return dialog_msgbox(t, av[2], atoi(av[3]), atoi(av[4]), 0);
|
|
||||||
}
|
|
@ -1,71 +0,0 @@
|
|||||||
/*
|
|
||||||
* msgbox.c -- implements the message box and info box
|
|
||||||
*
|
|
||||||
* ORIGINAL AUTHOR: Savio Lam (lam836@cs.cuhk.hk)
|
|
||||||
* MODIFIED FOR LINUX KERNEL CONFIG BY: William Roadcap (roadcapw@cfw.com)
|
|
||||||
*
|
|
||||||
* This program is free software; you can redistribute it and/or
|
|
||||||
* modify it under the terms of the GNU General Public License
|
|
||||||
* as published by the Free Software Foundation; either version 2
|
|
||||||
* of the License, or (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program; if not, write to the Free Software
|
|
||||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "dialog.h"
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Display a message box. Program will pause and display an "OK" button
|
|
||||||
* if the parameter 'pause' is non-zero.
|
|
||||||
*/
|
|
||||||
int dialog_msgbox(const char *title, const char *prompt, int height, int width,
|
|
||||||
int pause)
|
|
||||||
{
|
|
||||||
int i, x, y, key = 0;
|
|
||||||
WINDOW *dialog;
|
|
||||||
|
|
||||||
/* center dialog box on screen */
|
|
||||||
x = (COLS - width) / 2;
|
|
||||||
y = (LINES - height) / 2;
|
|
||||||
|
|
||||||
draw_shadow(stdscr, y, x, height, width);
|
|
||||||
|
|
||||||
dialog = newwin(height, width, y, x);
|
|
||||||
keypad(dialog, TRUE);
|
|
||||||
|
|
||||||
draw_box(dialog, 0, 0, height, width, dialog_attr, border_attr);
|
|
||||||
|
|
||||||
print_title(dialog, title, width);
|
|
||||||
|
|
||||||
wattrset(dialog, dialog_attr);
|
|
||||||
print_autowrap(dialog, prompt, width - 2, 1, 2);
|
|
||||||
|
|
||||||
if (pause) {
|
|
||||||
wattrset(dialog, border_attr);
|
|
||||||
mvwaddch(dialog, height - 3, 0, ACS_LTEE);
|
|
||||||
for (i = 0; i < width - 2; i++)
|
|
||||||
waddch(dialog, ACS_HLINE);
|
|
||||||
wattrset(dialog, dialog_attr);
|
|
||||||
waddch(dialog, ACS_RTEE);
|
|
||||||
|
|
||||||
print_button(dialog, " Ok ", height - 2, width / 2 - 4, TRUE);
|
|
||||||
|
|
||||||
wrefresh(dialog);
|
|
||||||
while (key != ESC && key != '\n' && key != ' ' &&
|
|
||||||
key != 'O' && key != 'o' && key != 'X' && key != 'x')
|
|
||||||
key = wgetch(dialog);
|
|
||||||
} else {
|
|
||||||
key = '\n';
|
|
||||||
wrefresh(dialog);
|
|
||||||
}
|
|
||||||
|
|
||||||
delwin(dialog);
|
|
||||||
return key == ESC ? -1 : 0;
|
|
||||||
}
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue