summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorRalf Baechle <ralf@linux-mips.org>2000-06-19 22:45:37 +0000
committerRalf Baechle <ralf@linux-mips.org>2000-06-19 22:45:37 +0000
commit6d403070f28cd44860fdb3a53be5da0275c65cf4 (patch)
tree0d0e7fe7b5fb7568d19e11d7d862b77a866ce081 /scripts
parentecf1bf5f6c2e668d03b0a9fb026db7aa41e292e1 (diff)
Merge with 2.4.0-test1-ac21 + pile of MIPS cleanups to make merging
possible. Chainsawed RM200 kernel to compile again. Jazz machine status unknown.
Diffstat (limited to 'scripts')
-rw-r--r--scripts/Menuconfig2
-rw-r--r--scripts/cramfs/mkcramfs.c4
-rw-r--r--scripts/header.tk13
-rw-r--r--scripts/lxdialog/Makefile22
-rw-r--r--scripts/tail.tk4
-rw-r--r--scripts/tkgen.c77
-rw-r--r--scripts/tkparse.c32
7 files changed, 113 insertions, 41 deletions
diff --git a/scripts/Menuconfig b/scripts/Menuconfig
index 3e0da2a9f..c59053f1f 100644
--- a/scripts/Menuconfig
+++ b/scripts/Menuconfig
@@ -545,7 +545,7 @@ function l_int () {
# Semantics of + and ? in GNU expr changed, so
# we avoid them:
- if expr "$answer" : '0$\|-[1-9][0-9]*$\|[1-9][0-9]*$' >/dev/null
+ if expr "$answer" : '0$' '|' "$answer" : '[1-9][0-9]*$' '|' "$answer" : '-[1-9][0-9]*$' >/dev/null
then
eval $2="$answer"
else
diff --git a/scripts/cramfs/mkcramfs.c b/scripts/cramfs/mkcramfs.c
index 36b12df49..878e12b32 100644
--- a/scripts/cramfs/mkcramfs.c
+++ b/scripts/cramfs/mkcramfs.c
@@ -93,7 +93,7 @@ static int find_identical_file(struct entry *orig,struct entry *newfile)
if(!orig) return 0;
if(orig->size==newfile->size && orig->uncompressed && !memcmp(orig->uncompressed,newfile->uncompressed,orig->size)) {
newfile->same=orig;
- return 0;
+ return 1;
}
return find_identical_file(orig->child,newfile) ||
find_identical_file(orig->next,newfile);
@@ -441,9 +441,9 @@ static unsigned int do_compress(char *base, unsigned int offset, char const *nam
size -= input;
if (!is_zero (uncompressed, input)) {
compress(base + curr, &len, uncompressed, input);
- uncompressed += input;
curr += len;
}
+ uncompressed += input;
if (len > blksize*2) {
/* (I don't think this can happen with zlib.) */
diff --git a/scripts/header.tk b/scripts/header.tk
index f2189e239..94963425a 100644
--- a/scripts/header.tk
+++ b/scripts/header.tk
@@ -110,6 +110,8 @@ proc load_configfile { w title func } {
wm geometry $w +$winx+$winy
}
+bind all <Alt-q> {maybe_exit .maybe}
+
proc maybe_exit { w } {
catch {destroy $w}
toplevel $w -class Dialog
@@ -128,6 +130,8 @@ proc maybe_exit { w } {
-width 20 -command "destroy $w; focus $oldFocus"
pack $w.f.back $w.f.canc -side left -pady 10 -padx 45
pack $w.f -pady 10 -side bottom -padx 10 -anchor w
+ bind $w <Return> "exit"
+ bind $w <Escape> "destroy $w; focus $oldFocus"
focus $w
global winx; global winy
set winx [expr [winfo x .]+30]; set winy [expr [winfo y .]+30]
@@ -402,6 +406,7 @@ proc minimenu { w mnum line text variable helpidx } {
proc menusplit {w m n} {
if { $n > 2 } then {
+ update idletasks
set menuoptsize [expr [$m yposition 2] - [$m yposition 1]]
set maxsize [winfo screenheight $w]
set splitpoint [expr $maxsize * 4 / 5 / $menuoptsize - 1]
@@ -411,6 +416,10 @@ proc menusplit {w m n} {
}
}
+proc menutitle {text menu w} {
+ wm title $w "$text"
+}
+
proc submenu { w mnum line text subnum } {
frame $w.x$line
button $w.x$line.l -text "" -width 15 -relief groove
@@ -531,6 +540,9 @@ ${var}:\\
wm maxsize $w [winfo width $w] $sizy
}
+bind all <Alt-s> { catch {exec cp -f .config .config.old}; \
+ writeconfig .config include/linux/autoconf.h; wrapup .wrap }
+
proc wrapup {w } {
catch {destroy $w}
toplevel $w -class Dialog
@@ -554,6 +566,7 @@ proc wrapup {w } {
pack $w.f.back -side bottom -pady 10 -anchor s
pack $w.f -pady 10 -side top -padx 10 -anchor s
focus $w
+ bind $w <Return> "exit"
global winx; global winy
set winx [expr [winfo x .]+30]; set winy [expr [winfo y .]+30]
wm geometry $w +$winx+$winy
diff --git a/scripts/lxdialog/Makefile b/scripts/lxdialog/Makefile
index 2bad7a12f..ed8d17c37 100644
--- a/scripts/lxdialog/Makefile
+++ b/scripts/lxdialog/Makefile
@@ -1,20 +1,16 @@
-CC = $(HOSTCC)
-CPP = $(HOSTCC) -E
-
-CFLAGS = $(HOSTCFLAGS) -DLOCALE
-LDFLAGS = -s -L .
-LDLIBS = -lncurses
+HOSTCFLAGS += -DLOCALE
+LIBS = -lncurses
ifeq (/usr/include/ncurses/ncurses.h, $(wildcard /usr/include/ncurses/ncurses.h))
- CFLAGS += -I/usr/include/ncurses -DCURSES_LOC="<ncurses.h>"
+ HOSTCFLAGS += -I/usr/include/ncurses -DCURSES_LOC="<ncurses.h>"
else
ifeq (/usr/include/ncurses/curses.h, $(wildcard /usr/include/ncurses/curses.h))
- CFLAGS += -I/usr/include/ncurses -DCURSES_LOC="<ncurses/curses.h>"
+ HOSTCFLAGS += -I/usr/include/ncurses -DCURSES_LOC="<ncurses/curses.h>"
else
ifeq (/usr/include/ncurses.h, $(wildcard /usr/include/ncurses.h))
- CFLAGS += -DCURSES_LOC="<ncurses.h>"
+ HOSTCFLAGS += -DCURSES_LOC="<ncurses.h>"
else
- CFLAGS += -DCURSES_LOC="<curses.h>"
+ HOSTCFLAGS += -DCURSES_LOC="<curses.h>"
endif
endif
endif
@@ -22,16 +18,18 @@ endif
OBJS = checklist.o menubox.o textbox.o yesno.o inputbox.o \
util.o lxdialog.o msgbox.o
-SRCS = $(OBJS:.o=.c)
+%.o: %.c
+ $(HOSTCC) $(HOSTCFLAGS) -c -o $@ $<
all: ncurses lxdialog
lxdialog: $(OBJS)
+ $(HOSTCC) -o lxdialog $(OBJS) $(LIBS)
ncurses:
@echo "main() {}" > lxtemp.c
- @if $(CC) -lncurses lxtemp.c ; then \
+ @if $(HOSTCC) -lncurses lxtemp.c ; then \
rm -f lxtemp.c a.out; \
else \
rm -f lxtemp.c; \
diff --git a/scripts/tail.tk b/scripts/tail.tk
index 362742451..49d7aa37a 100644
--- a/scripts/tail.tk
+++ b/scripts/tail.tk
@@ -32,11 +32,11 @@ if { [file readable .config] == 1} then {
update_define 1 $total_menus 0
update_mainmenu
-button .f0.right.save -anchor w -text "Save and Exit" \
+button .f0.right.save -anchor w -text "Save and Exit" -underline 0\
-command { catch {exec cp -f .config .config.old}; \
writeconfig .config include/linux/autoconf.h; wrapup .wrap }
-button .f0.right.quit -anchor w -text "Quit Without Saving" \
+button .f0.right.quit -anchor w -text "Quit Without Saving" -underline 0\
-command { maybe_exit .maybe }
button .f0.right.load -anchor w -text "Load Configuration from File" \
diff --git a/scripts/tkgen.c b/scripts/tkgen.c
index 18d968eff..9faede610 100644
--- a/scripts/tkgen.c
+++ b/scripts/tkgen.c
@@ -149,18 +149,10 @@ static void start_proc( char * label, int menu_num, int toplevel )
printf( "\tpack $w.m -pady 10 -side top -padx 10\n" );
printf( "\twm title $w \"%s\" \n\n", label );
- /*
- * Attach the "Prev", "Next" and "OK" buttons at the end of the window.
- */
- printf( "\tframe $w.f\n" );
- if ( toplevel )
- printf( "\tbutton $w.f.back -text \"Main Menu\" \\\n" );
- else
- printf( "\tbutton $w.f.back -text \"OK\" \\\n" );
- printf( "\t\t-width 15 -command \"catch {focus $oldFocus}; destroy $w; unregister_active %d\"\n",
- menu_num );
- printf( "\tbutton $w.f.next -text \"Next\" \\\n" );
- printf( "\t\t-width 15 -command \"catch {focus $oldFocus}; " );
+ printf( "\tbind $w <Escape> \"catch {focus $oldFocus}; destroy $w; unregister_active %d; break\"\n", menu_num);
+
+ printf("\tset nextscript ");
+ printf("\"catch {focus $oldFocus}; " );
/*
* We are checking which windows should be destroyed and which are
* common parrents with the next one. Remember that menu_num field
@@ -182,13 +174,48 @@ static void start_proc( char * label, int menu_num, int toplevel )
}
printf( "menu%d .menu%d \\\"$title\\\"\"\n",
menu_num+1, menu_num+1 );
- if ( menu_num == tot_menu_num )
- printf( "\t$w.f.next configure -state disabled\n" );
- printf( "\tbutton $w.f.prev -text \"Prev\" \\\n" );
+
+ /*
+ * Attach the "Prev", "Next" and "OK" buttons at the end of the window.
+ */
+ printf( "\tframe $w.f\n" );
+ if ( toplevel )
+ printf( "\tbutton $w.f.back -text \"Main Menu\" \\\n" );
+ else
+ printf( "\tbutton $w.f.back -text \"OK\" \\\n" );
+ printf( "\t\t-width 15 -command \"catch {focus $oldFocus}; destroy $w; unregister_active %d\"\n",
+ menu_num );
+ printf( "\tbutton $w.f.next -text \"Next\" -underline 0\\\n" );
+ printf( "\t\t-width 15 -command $nextscript\n");
+
+ if ( menu_num == tot_menu_num ) {
+ printf( "\t$w.f.next configure -state disabled\n" );
+ /*
+ * this is a bit hackish but Alt-n must be rebound
+ * otherwise if the user press Alt-n on the last menu
+ * it will give him/her the next menu of one of the
+ * previous options
+ */
+ printf( "\tbind all <Alt-n> \"puts \\\"no more menus\\\" \"\n");
+ }
+ else
+ {
+ /*
+ * I should be binding to $w not all - but if I do nehat I get the error "unknown path"
+ */
+ printf( "\tbind all <Alt-n> $nextscript\n");
+ }
+ printf( "\tbutton $w.f.prev -text \"Prev\" -underline 0\\\n" );
printf( "\t\t-width 15 -command \"catch {focus $oldFocus}; destroy $w; unregister_active %d; menu%d .menu%d \\\"$title\\\"\"\n",
menu_num, menu_num-1, menu_num-1 );
- if ( menu_num == 1 )
+ if ( menu_num == 1 ) {
printf( "\t$w.f.prev configure -state disabled\n" );
+ }
+ else
+ {
+ printf( "\tbind $w <Alt-p> \"catch {focus $oldFocus}; destroy $w; unregister_active %d; menu%d .menu%d \\\"$title\\\";break\"\n",
+ menu_num, menu_num-1, menu_num-1 );
+ }
printf( "\tpack $w.f.back $w.f.next $w.f.prev -side left -expand on\n" );
printf( "\tpack $w.f -pady 10 -side bottom -anchor w -fill x\n" );
@@ -215,6 +242,12 @@ static void start_proc( char * label, int menu_num, int toplevel )
printf( "\t\t-relief flat -borderwidth 0 -yscrollcommand \"$w.config.vscroll set\" \\\n" );
printf( "\t\t-width [expr [winfo screenwidth .] * 1 / 2] \n" );
printf( "\tframe $w.config.f\n" );
+ printf( "\tbind $w <Key-Down> \"$w.config.canvas yview scroll 1 unit;break;\"\n");
+ printf( "\tbind $w <Key-Up> \"$w.config.canvas yview scroll -1 unit;break;\"\n");
+ printf( "\tbind $w <Key-Next> \"$w.config.canvas yview scroll 1 page;break;\"\n");
+ printf( "\tbind $w <Key-Prior> \"$w.config.canvas yview scroll -1 page;break;\"\n");
+ printf( "\tbind $w <Key-Home> \"$w.config.canvas yview moveto 0;break;\"\n");
+ printf( "\tbind $w <Key-End> \"$w.config.canvas yview moveto 1 ;break;\"\n");
printf( "\tpack $w.config.canvas -side right -fill y\n" );
printf("\n\n");
}
@@ -974,7 +1007,7 @@ static void end_proc( struct kconfig * scfg, int menu_num )
}
else
printf( "\tset winx [expr [winfo x .]+30]; set winy [expr [winfo y .]+30]\n" );
- printf( "\twm geometry $w +$winx+$winy\n" );
+ printf( "\tif {[winfo exists $w]} then {wm geometry $w +$winx+$winy}\n" );
/*
* Now that the whole window is in place, we need to wait for an "update"
@@ -987,7 +1020,7 @@ static void end_proc( struct kconfig * scfg, int menu_num )
* around frames. Sigh.
*/
printf( "\tupdate idletasks\n" );
- printf( "\t$w.config.canvas create window 0 0 -anchor nw -window $w.config.f\n\n" );
+ printf( "\tif {[winfo exists $w]} then {$w.config.canvas create window 0 0 -anchor nw -window $w.config.f\n\n" );
printf( "\t$w.config.canvas configure \\\n" );
printf( "\t\t-width [expr [winfo reqwidth $w.config.f] + 1]\\\n" );
printf( "\t\t-scrollregion \"-1 -1 [expr [winfo reqwidth $w.config.f] + 1] \\\n" );
@@ -1005,17 +1038,17 @@ static void end_proc( struct kconfig * scfg, int menu_num )
printf( "\t\t$w.config.canvas configure -height $canvtotal\n" );
printf( "\t} else {\n" );
printf( "\t\t$w.config.canvas configure -height [expr $scry - $winy]\n" );
- printf( "\t}\n" );
+ printf( "\t\t}\n\t}\n" );
/*
* Limit the min/max window size. Height can vary, but not width,
* because of the limitations of canvas and our laziness.
*/
printf( "\tupdate idletasks\n" );
- printf( "\twm maxsize $w [winfo width $w] [winfo screenheight $w]\n" );
+ printf( "\tif {[winfo exists $w]} then {\n\twm maxsize $w [winfo width $w] [winfo screenheight $w]\n" );
printf( "\twm minsize $w [winfo width $w] 100\n\n" );
printf( "\twm deiconify $w\n" );
- printf( "}\n\n\n" );
+ printf( "}\n}\n\n" );
/*
* Now we generate the companion procedure for the menu we just
@@ -1248,7 +1281,7 @@ void dump_tk_script( struct kconfig * scfg )
printf( "\tminimenu $w.config.f %d %d \"%s\" tmpvar_%d %s\n",
cfg->menu_number, cfg->menu_line, cfg->label,
-(cfg->nameindex), vartable[cfg->next->nameindex].name );
- printf( "\tmenu $w.config.f.x%d.x.menu -title \"%s\"\n",
+ printf( "\tmenu $w.config.f.x%d.x.menu -tearoffcommand \"menutitle \\\"%s\\\"\"\n",
cfg->menu_line, cfg->label );
cfg1 = cfg;
opt_count = 0;
diff --git a/scripts/tkparse.c b/scripts/tkparse.c
index e17f109a4..abf5ad8b0 100644
--- a/scripts/tkparse.c
+++ b/scripts/tkparse.c
@@ -173,6 +173,28 @@ static const char * get_qstring( const char * pnt, char ** label )
/*
+ * Get a quoted or unquoted string. It is recognized by the first
+ * non-white character. '"' and '"' are not allowed inside the string.
+ */
+static const char * get_qnqstring( const char * pnt, char ** label )
+{
+ char quote_char;
+
+ while ( *pnt == ' ' || *pnt == '\t' )
+ pnt++;
+
+ if ( *pnt == '\0' )
+ return pnt;
+ quote_char = *pnt;
+ if ( quote_char == '"' || quote_char == '\'' )
+ return get_qstring( pnt, label );
+ else
+ return get_string( pnt, label );
+}
+
+
+
+/*
* Tokenize an 'if' statement condition.
*/
static struct condition * tokenize_if( const char * pnt )
@@ -505,6 +527,8 @@ static void tokenize_line( const char * pnt )
if ( last_menuoption != NULL )
{
pnt = get_qstring(pnt, &cfg->label);
+ if (cfg->label == NULL)
+ syntax_error( "missing comment text" );
last_menuoption->label = cfg->label;
last_menuoption = NULL;
}
@@ -546,7 +570,9 @@ static void tokenize_line( const char * pnt )
case token_define_string:
pnt = get_string( pnt, &buffer );
cfg->nameindex = get_varnum( buffer );
- pnt = get_qstring( pnt, &cfg->value );
+ pnt = get_qnqstring( pnt, &cfg->value );
+ if (cfg->value == NULL)
+ syntax_error( "missing value" );
break;
case token_dep_bool:
@@ -659,7 +685,9 @@ static void tokenize_line( const char * pnt )
pnt = get_qstring ( pnt, &cfg->label );
pnt = get_string ( pnt, &buffer );
cfg->nameindex = get_varnum( buffer );
- pnt = get_qstring ( pnt, &cfg->value );
+ pnt = get_qnqstring ( pnt, &cfg->value );
+ if (cfg->value == NULL)
+ syntax_error( "missing initial value" );
break;
case token_if: