aboutsummaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rw-r--r--scripts/kallsyms.c94
-rw-r--r--scripts/kconfig/Makefile14
-rw-r--r--scripts/kconfig/POTFILES.in5
-rw-r--r--scripts/kconfig/conf.c20
-rw-r--r--scripts/kconfig/confdata.c16
-rw-r--r--scripts/kconfig/gconf.c52
-rw-r--r--scripts/kconfig/kxgettext.c221
-rw-r--r--scripts/kconfig/lkc.h8
-rw-r--r--scripts/kconfig/mconf.c120
-rw-r--r--scripts/kconfig/menu.c4
-rw-r--r--scripts/kconfig/qconf.cc59
-rwxr-xr-xscripts/kernel-doc49
-rwxr-xr-xscripts/makeman185
-rw-r--r--scripts/mod/file2alias.c111
-rwxr-xr-xscripts/patch-kernel131
-rwxr-xr-xscripts/split-man112
16 files changed, 692 insertions, 509 deletions
diff --git a/scripts/kallsyms.c b/scripts/kallsyms.c
index 090ffda4adbc..d3d2e5341051 100644
--- a/scripts/kallsyms.c
+++ b/scripts/kallsyms.c
@@ -67,8 +67,9 @@ struct sym_entry {
67 67
68static struct sym_entry *table; 68static struct sym_entry *table;
69static int size, cnt; 69static int size, cnt;
70static unsigned long long _stext, _etext, _sinittext, _einittext; 70static unsigned long long _stext, _etext, _sinittext, _einittext, _sextratext, _eextratext;
71static int all_symbols = 0; 71static int all_symbols = 0;
72static char symbol_prefix_char = '\0';
72 73
73struct token { 74struct token {
74 unsigned char data[MAX_TOK_SIZE]; 75 unsigned char data[MAX_TOK_SIZE];
@@ -93,7 +94,7 @@ unsigned char best_table_len[256];
93static void 94static void
94usage(void) 95usage(void)
95{ 96{
96 fprintf(stderr, "Usage: kallsyms [--all-symbols] < in.map > out.S\n"); 97 fprintf(stderr, "Usage: kallsyms [--all-symbols] [--symbol-prefix=<prefix char>] < in.map > out.S\n");
97 exit(1); 98 exit(1);
98} 99}
99 100
@@ -112,6 +113,7 @@ static int
112read_symbol(FILE *in, struct sym_entry *s) 113read_symbol(FILE *in, struct sym_entry *s)
113{ 114{
114 char str[500]; 115 char str[500];
116 char *sym;
115 int rc; 117 int rc;
116 118
117 rc = fscanf(in, "%llx %c %499s\n", &s->addr, &s->type, str); 119 rc = fscanf(in, "%llx %c %499s\n", &s->addr, &s->type, str);
@@ -123,27 +125,36 @@ read_symbol(FILE *in, struct sym_entry *s)
123 return -1; 125 return -1;
124 } 126 }
125 127
128 sym = str;
129 /* skip prefix char */
130 if (symbol_prefix_char && str[0] == symbol_prefix_char)
131 sym++;
132
126 /* Ignore most absolute/undefined (?) symbols. */ 133 /* Ignore most absolute/undefined (?) symbols. */
127 if (strcmp(str, "_stext") == 0) 134 if (strcmp(sym, "_stext") == 0)
128 _stext = s->addr; 135 _stext = s->addr;
129 else if (strcmp(str, "_etext") == 0) 136 else if (strcmp(sym, "_etext") == 0)
130 _etext = s->addr; 137 _etext = s->addr;
131 else if (strcmp(str, "_sinittext") == 0) 138 else if (strcmp(sym, "_sinittext") == 0)
132 _sinittext = s->addr; 139 _sinittext = s->addr;
133 else if (strcmp(str, "_einittext") == 0) 140 else if (strcmp(sym, "_einittext") == 0)
134 _einittext = s->addr; 141 _einittext = s->addr;
142 else if (strcmp(sym, "_sextratext") == 0)
143 _sextratext = s->addr;
144 else if (strcmp(sym, "_eextratext") == 0)
145 _eextratext = s->addr;
135 else if (toupper(s->type) == 'A') 146 else if (toupper(s->type) == 'A')
136 { 147 {
137 /* Keep these useful absolute symbols */ 148 /* Keep these useful absolute symbols */
138 if (strcmp(str, "__kernel_syscall_via_break") && 149 if (strcmp(sym, "__kernel_syscall_via_break") &&
139 strcmp(str, "__kernel_syscall_via_epc") && 150 strcmp(sym, "__kernel_syscall_via_epc") &&
140 strcmp(str, "__kernel_sigtramp") && 151 strcmp(sym, "__kernel_sigtramp") &&
141 strcmp(str, "__gp")) 152 strcmp(sym, "__gp"))
142 return -1; 153 return -1;
143 154
144 } 155 }
145 else if (toupper(s->type) == 'U' || 156 else if (toupper(s->type) == 'U' ||
146 is_arm_mapping_symbol(str)) 157 is_arm_mapping_symbol(sym))
147 return -1; 158 return -1;
148 159
149 /* include the type field in the symbol name, so that it gets 160 /* include the type field in the symbol name, so that it gets
@@ -177,30 +188,37 @@ symbol_valid(struct sym_entry *s)
177 "_SDA2_BASE_", /* ppc */ 188 "_SDA2_BASE_", /* ppc */
178 NULL }; 189 NULL };
179 int i; 190 int i;
191 int offset = 1;
192
193 /* skip prefix char */
194 if (symbol_prefix_char && *(s->sym + 1) == symbol_prefix_char)
195 offset++;
180 196
181 /* if --all-symbols is not specified, then symbols outside the text 197 /* if --all-symbols is not specified, then symbols outside the text
182 * and inittext sections are discarded */ 198 * and inittext sections are discarded */
183 if (!all_symbols) { 199 if (!all_symbols) {
184 if ((s->addr < _stext || s->addr > _etext) 200 if ((s->addr < _stext || s->addr > _etext)
185 && (s->addr < _sinittext || s->addr > _einittext)) 201 && (s->addr < _sinittext || s->addr > _einittext)
202 && (s->addr < _sextratext || s->addr > _eextratext))
186 return 0; 203 return 0;
187 /* Corner case. Discard any symbols with the same value as 204 /* Corner case. Discard any symbols with the same value as
188 * _etext or _einittext, they can move between pass 1 and 2 205 * _etext _einittext or _eextratext; they can move between pass
189 * when the kallsyms data is added. If these symbols move then 206 * 1 and 2 when the kallsyms data are added. If these symbols
190 * they may get dropped in pass 2, which breaks the kallsyms 207 * move then they may get dropped in pass 2, which breaks the
191 * rules. 208 * kallsyms rules.
192 */ 209 */
193 if ((s->addr == _etext && strcmp(s->sym + 1, "_etext")) || 210 if ((s->addr == _etext && strcmp(s->sym + offset, "_etext")) ||
194 (s->addr == _einittext && strcmp(s->sym + 1, "_einittext"))) 211 (s->addr == _einittext && strcmp(s->sym + offset, "_einittext")) ||
212 (s->addr == _eextratext && strcmp(s->sym + offset, "_eextratext")))
195 return 0; 213 return 0;
196 } 214 }
197 215
198 /* Exclude symbols which vary between passes. */ 216 /* Exclude symbols which vary between passes. */
199 if (strstr(s->sym + 1, "_compiled.")) 217 if (strstr(s->sym + offset, "_compiled."))
200 return 0; 218 return 0;
201 219
202 for (i = 0; special_symbols[i]; i++) 220 for (i = 0; special_symbols[i]; i++)
203 if( strcmp(s->sym + 1, special_symbols[i]) == 0 ) 221 if( strcmp(s->sym + offset, special_symbols[i]) == 0 )
204 return 0; 222 return 0;
205 223
206 return 1; 224 return 1;
@@ -225,9 +243,15 @@ read_map(FILE *in)
225 243
226static void output_label(char *label) 244static void output_label(char *label)
227{ 245{
228 printf(".globl %s\n",label); 246 if (symbol_prefix_char)
247 printf(".globl %c%s\n", symbol_prefix_char, label);
248 else
249 printf(".globl %s\n", label);
229 printf("\tALGN\n"); 250 printf("\tALGN\n");
230 printf("%s:\n",label); 251 if (symbol_prefix_char)
252 printf("%c%s:\n", symbol_prefix_char, label);
253 else
254 printf("%s:\n", label);
231} 255}
232 256
233/* uncompress a compressed symbol. When this function is called, the best table 257/* uncompress a compressed symbol. When this function is called, the best table
@@ -665,6 +689,13 @@ static void optimize_token_table(void)
665 689
666 insert_real_symbols_in_table(); 690 insert_real_symbols_in_table();
667 691
692 /* When valid symbol is not registered, exit to error */
693 if (good_head.left == good_head.right &&
694 bad_head.left == bad_head.right) {
695 fprintf(stderr, "No valid symbol.\n");
696 exit(1);
697 }
698
668 optimize_result(); 699 optimize_result();
669} 700}
670 701
@@ -672,9 +703,21 @@ static void optimize_token_table(void)
672int 703int
673main(int argc, char **argv) 704main(int argc, char **argv)
674{ 705{
675 if (argc == 2 && strcmp(argv[1], "--all-symbols") == 0) 706 if (argc >= 2) {
676 all_symbols = 1; 707 int i;
677 else if (argc != 1) 708 for (i = 1; i < argc; i++) {
709 if(strcmp(argv[i], "--all-symbols") == 0)
710 all_symbols = 1;
711 else if (strncmp(argv[i], "--symbol-prefix=", 16) == 0) {
712 char *p = &argv[i][16];
713 /* skip quote */
714 if ((*p == '"' && *(p+2) == '"') || (*p == '\'' && *(p+2) == '\''))
715 p++;
716 symbol_prefix_char = *p;
717 } else
718 usage();
719 }
720 } else if (argc != 1)
678 usage(); 721 usage();
679 722
680 read_map(stdin); 723 read_map(stdin);
@@ -683,4 +726,3 @@ main(int argc, char **argv)
683 726
684 return 0; 727 return 0;
685} 728}
686
diff --git a/scripts/kconfig/Makefile b/scripts/kconfig/Makefile
index 5a5ddc40f36c..09abb891d11f 100644
--- a/scripts/kconfig/Makefile
+++ b/scripts/kconfig/Makefile
@@ -2,7 +2,7 @@
2# Kernel configuration targets 2# Kernel configuration targets
3# These targets are used from top-level makefile 3# These targets are used from top-level makefile
4 4
5.PHONY: oldconfig xconfig gconfig menuconfig config silentoldconfig 5.PHONY: oldconfig xconfig gconfig menuconfig config silentoldconfig update-po-config
6 6
7xconfig: $(obj)/qconf 7xconfig: $(obj)/qconf
8 $< arch/$(ARCH)/Kconfig 8 $< arch/$(ARCH)/Kconfig
@@ -23,6 +23,13 @@ oldconfig: $(obj)/conf
23silentoldconfig: $(obj)/conf 23silentoldconfig: $(obj)/conf
24 $< -s arch/$(ARCH)/Kconfig 24 $< -s arch/$(ARCH)/Kconfig
25 25
26update-po-config: $(obj)/kxgettext
27 xgettext --default-domain=linux \
28 --add-comments --keyword=_ --keyword=N_ \
29 --files-from=scripts/kconfig/POTFILES.in \
30 -o scripts/kconfig/linux.pot
31 scripts/kconfig/kxgettext arch/$(ARCH)/Kconfig >> scripts/kconfig/linux.pot
32
26.PHONY: randconfig allyesconfig allnoconfig allmodconfig defconfig 33.PHONY: randconfig allyesconfig allnoconfig allmodconfig defconfig
27 34
28randconfig: $(obj)/conf 35randconfig: $(obj)/conf
@@ -72,9 +79,10 @@ help:
72# Based on GTK which needs to be installed to compile it 79# Based on GTK which needs to be installed to compile it
73# object files used by all kconfig flavours 80# object files used by all kconfig flavours
74 81
75hostprogs-y := conf mconf qconf gconf 82hostprogs-y := conf mconf qconf gconf kxgettext
76conf-objs := conf.o zconf.tab.o 83conf-objs := conf.o zconf.tab.o
77mconf-objs := mconf.o zconf.tab.o 84mconf-objs := mconf.o zconf.tab.o
85kxgettext-objs := kxgettext.o zconf.tab.o
78 86
79ifeq ($(MAKECMDGOALS),xconfig) 87ifeq ($(MAKECMDGOALS),xconfig)
80 qconf-target := 1 88 qconf-target := 1
@@ -107,7 +115,7 @@ HOSTLOADLIBES_gconf = `pkg-config gtk+-2.0 gmodule-2.0 libglade-2.0 --libs`
107HOSTCFLAGS_gconf.o = `pkg-config gtk+-2.0 gmodule-2.0 libglade-2.0 --cflags` \ 115HOSTCFLAGS_gconf.o = `pkg-config gtk+-2.0 gmodule-2.0 libglade-2.0 --cflags` \
108 -D LKC_DIRECT_LINK 116 -D LKC_DIRECT_LINK
109 117
110$(obj)/conf.o $(obj)/mconf.o $(obj)/qconf.o $(obj)/gconf.o: $(obj)/zconf.tab.h 118$(obj)/conf.o $(obj)/mconf.o $(obj)/qconf.o $(obj)/gconf.o $(obj)/kxgettext: $(obj)/zconf.tab.h
111 119
112$(obj)/zconf.tab.h: $(src)/zconf.tab.h_shipped 120$(obj)/zconf.tab.h: $(src)/zconf.tab.h_shipped
113$(obj)/zconf.tab.c: $(src)/zconf.tab.c_shipped 121$(obj)/zconf.tab.c: $(src)/zconf.tab.c_shipped
diff --git a/scripts/kconfig/POTFILES.in b/scripts/kconfig/POTFILES.in
new file mode 100644
index 000000000000..cc94e46a79e8
--- /dev/null
+++ b/scripts/kconfig/POTFILES.in
@@ -0,0 +1,5 @@
1scripts/kconfig/mconf.c
2scripts/kconfig/conf.c
3scripts/kconfig/confdata.c
4scripts/kconfig/gconf.c
5scripts/kconfig/qconf.cc
diff --git a/scripts/kconfig/conf.c b/scripts/kconfig/conf.c
index a494d1aeb9f9..70e7264c6942 100644
--- a/scripts/kconfig/conf.c
+++ b/scripts/kconfig/conf.c
@@ -34,7 +34,7 @@ static int conf_cnt;
34static signed char line[128]; 34static signed char line[128];
35static struct menu *rootEntry; 35static struct menu *rootEntry;
36 36
37static char nohelp_text[] = "Sorry, no help available for this option yet.\n"; 37static char nohelp_text[] = N_("Sorry, no help available for this option yet.\n");
38 38
39static void strip(signed char *str) 39static void strip(signed char *str)
40{ 40{
@@ -56,9 +56,9 @@ static void strip(signed char *str)
56static void check_stdin(void) 56static void check_stdin(void)
57{ 57{
58 if (!valid_stdin && input_mode == ask_silent) { 58 if (!valid_stdin && input_mode == ask_silent) {
59 printf("aborted!\n\n"); 59 printf(_("aborted!\n\n"));
60 printf("Console input/output is redirected. "); 60 printf(_("Console input/output is redirected. "));
61 printf("Run 'make oldconfig' to update configuration.\n\n"); 61 printf(_("Run 'make oldconfig' to update configuration.\n\n"));
62 exit(1); 62 exit(1);
63 } 63 }
64} 64}
@@ -470,7 +470,7 @@ static void check_conf(struct menu *menu)
470 if (sym) { 470 if (sym) {
471 if (sym_is_changable(sym) && !sym_has_value(sym)) { 471 if (sym_is_changable(sym) && !sym_has_value(sym)) {
472 if (!conf_cnt++) 472 if (!conf_cnt++)
473 printf("*\n* Restart config...\n*\n"); 473 printf(_("*\n* Restart config...\n*\n"));
474 rootEntry = menu_get_parent_menu(menu); 474 rootEntry = menu_get_parent_menu(menu);
475 conf(rootEntry); 475 conf(rootEntry);
476 } 476 }
@@ -504,7 +504,7 @@ int main(int ac, char **av)
504 input_mode = set_default; 504 input_mode = set_default;
505 defconfig_file = av[i++]; 505 defconfig_file = av[i++];
506 if (!defconfig_file) { 506 if (!defconfig_file) {
507 printf("%s: No default config file specified\n", 507 printf(_("%s: No default config file specified\n"),
508 av[0]); 508 av[0]);
509 exit(1); 509 exit(1);
510 } 510 }
@@ -530,7 +530,7 @@ int main(int ac, char **av)
530 } 530 }
531 name = av[i]; 531 name = av[i];
532 if (!name) { 532 if (!name) {
533 printf("%s: Kconfig file missing\n", av[0]); 533 printf(_("%s: Kconfig file missing\n"), av[0]);
534 } 534 }
535 conf_parse(name); 535 conf_parse(name);
536 //zconfdump(stdout); 536 //zconfdump(stdout);
@@ -547,12 +547,12 @@ int main(int ac, char **av)
547 break; 547 break;
548 case ask_silent: 548 case ask_silent:
549 if (stat(".config", &tmpstat)) { 549 if (stat(".config", &tmpstat)) {
550 printf("***\n" 550 printf(_("***\n"
551 "*** You have not yet configured your kernel!\n" 551 "*** You have not yet configured your kernel!\n"
552 "***\n" 552 "***\n"
553 "*** Please run some configurator (e.g. \"make oldconfig\" or\n" 553 "*** Please run some configurator (e.g. \"make oldconfig\" or\n"
554 "*** \"make menuconfig\" or \"make xconfig\").\n" 554 "*** \"make menuconfig\" or \"make xconfig\").\n"
555 "***\n"); 555 "***\n"));
556 exit(1); 556 exit(1);
557 } 557 }
558 case ask_all: 558 case ask_all:
@@ -576,7 +576,7 @@ int main(int ac, char **av)
576 check_conf(&rootmenu); 576 check_conf(&rootmenu);
577 } while (conf_cnt); 577 } while (conf_cnt);
578 if (conf_write(NULL)) { 578 if (conf_write(NULL)) {
579 fprintf(stderr, "\n*** Error during writing of the kernel configuration.\n\n"); 579 fprintf(stderr, _("\n*** Error during writing of the kernel configuration.\n\n"));
580 return 1; 580 return 1;
581 } 581 }
582 return 0; 582 return 0;
diff --git a/scripts/kconfig/confdata.c b/scripts/kconfig/confdata.c
index 1e82ae390a69..2755c459d780 100644
--- a/scripts/kconfig/confdata.c
+++ b/scripts/kconfig/confdata.c
@@ -88,9 +88,9 @@ int conf_read(const char *name)
88 name = conf_expand_value(name); 88 name = conf_expand_value(name);
89 in = zconf_fopen(name); 89 in = zconf_fopen(name);
90 if (in) { 90 if (in) {
91 printf("#\n" 91 printf(_("#\n"
92 "# using defaults found in %s\n" 92 "# using defaults found in %s\n"
93 "#\n", name); 93 "#\n"), name);
94 break; 94 break;
95 } 95 }
96 } 96 }
@@ -312,11 +312,11 @@ int conf_write(const char *name)
312 if (env && *env) 312 if (env && *env)
313 use_timestamp = 0; 313 use_timestamp = 0;
314 314
315 fprintf(out, "#\n" 315 fprintf(out, _("#\n"
316 "# Automatically generated make config: don't edit\n" 316 "# Automatically generated make config: don't edit\n"
317 "# Linux kernel version: %s\n" 317 "# Linux kernel version: %s\n"
318 "%s%s" 318 "%s%s"
319 "#\n", 319 "#\n"),
320 sym_get_string_value(sym), 320 sym_get_string_value(sym),
321 use_timestamp ? "# " : "", 321 use_timestamp ? "# " : "",
322 use_timestamp ? ctime(&now) : ""); 322 use_timestamp ? ctime(&now) : "");
diff --git a/scripts/kconfig/gconf.c b/scripts/kconfig/gconf.c
index 6fdbe6e3ce0d..ad6b12043874 100644
--- a/scripts/kconfig/gconf.c
+++ b/scripts/kconfig/gconf.c
@@ -41,7 +41,7 @@ static gboolean resizeable = FALSE;
41static gboolean config_changed = FALSE; 41static gboolean config_changed = FALSE;
42 42
43static char nohelp_text[] = 43static char nohelp_text[] =
44 "Sorry, no help available for this option yet.\n"; 44 N_("Sorry, no help available for this option yet.\n");
45 45
46GtkWidget *main_wnd = NULL; 46GtkWidget *main_wnd = NULL;
47GtkWidget *tree1_w = NULL; // left frame 47GtkWidget *tree1_w = NULL; // left frame
@@ -193,7 +193,7 @@ void init_main_window(const gchar * glade_file)
193 193
194 xml = glade_xml_new(glade_file, "window1", NULL); 194 xml = glade_xml_new(glade_file, "window1", NULL);
195 if (!xml) 195 if (!xml)
196 g_error("GUI loading failed !\n"); 196 g_error(_("GUI loading failed !\n"));
197 glade_xml_signal_autoconnect(xml); 197 glade_xml_signal_autoconnect(xml);
198 198
199 main_wnd = glade_xml_get_widget(xml, "window1"); 199 main_wnd = glade_xml_get_widget(xml, "window1");
@@ -275,7 +275,7 @@ void init_main_window(const gchar * glade_file)
275 /*"style", PANGO_STYLE_OBLIQUE, */ 275 /*"style", PANGO_STYLE_OBLIQUE, */
276 NULL); 276 NULL);
277 277
278 sprintf(title, "Linux Kernel v%s Configuration", 278 sprintf(title, _("Linux Kernel v%s Configuration"),
279 getenv("KERNELRELEASE")); 279 getenv("KERNELRELEASE"));
280 gtk_window_set_title(GTK_WINDOW(main_wnd), title); 280 gtk_window_set_title(GTK_WINDOW(main_wnd), title);
281 281
@@ -325,7 +325,7 @@ void init_left_tree(void)
325 325
326 column = gtk_tree_view_column_new(); 326 column = gtk_tree_view_column_new();
327 gtk_tree_view_append_column(view, column); 327 gtk_tree_view_append_column(view, column);
328 gtk_tree_view_column_set_title(column, "Options"); 328 gtk_tree_view_column_set_title(column, _("Options"));
329 329
330 renderer = gtk_cell_renderer_toggle_new(); 330 renderer = gtk_cell_renderer_toggle_new();
331 gtk_tree_view_column_pack_start(GTK_TREE_VIEW_COLUMN(column), 331 gtk_tree_view_column_pack_start(GTK_TREE_VIEW_COLUMN(column),
@@ -370,7 +370,7 @@ void init_right_tree(void)
370 370
371 column = gtk_tree_view_column_new(); 371 column = gtk_tree_view_column_new();
372 gtk_tree_view_append_column(view, column); 372 gtk_tree_view_append_column(view, column);
373 gtk_tree_view_column_set_title(column, "Options"); 373 gtk_tree_view_column_set_title(column, _("Options"));
374 374
375 renderer = gtk_cell_renderer_pixbuf_new(); 375 renderer = gtk_cell_renderer_pixbuf_new();
376 gtk_tree_view_column_pack_start(GTK_TREE_VIEW_COLUMN(column), 376 gtk_tree_view_column_pack_start(GTK_TREE_VIEW_COLUMN(column),
@@ -401,7 +401,7 @@ void init_right_tree(void)
401 401
402 renderer = gtk_cell_renderer_text_new(); 402 renderer = gtk_cell_renderer_text_new();
403 gtk_tree_view_insert_column_with_attributes(view, -1, 403 gtk_tree_view_insert_column_with_attributes(view, -1,
404 "Name", renderer, 404 _("Name"), renderer,
405 "text", COL_NAME, 405 "text", COL_NAME,
406 "foreground-gdk", 406 "foreground-gdk",
407 COL_COLOR, NULL); 407 COL_COLOR, NULL);
@@ -425,7 +425,7 @@ void init_right_tree(void)
425 COL_COLOR, NULL); 425 COL_COLOR, NULL);
426 renderer = gtk_cell_renderer_text_new(); 426 renderer = gtk_cell_renderer_text_new();
427 gtk_tree_view_insert_column_with_attributes(view, -1, 427 gtk_tree_view_insert_column_with_attributes(view, -1,
428 "Value", renderer, 428 _("Value"), renderer,
429 "text", COL_VALUE, 429 "text", COL_VALUE,
430 "editable", 430 "editable",
431 COL_EDIT, 431 COL_EDIT,
@@ -466,15 +466,15 @@ static void text_insert_help(struct menu *menu)
466 GtkTextIter start, end; 466 GtkTextIter start, end;
467 const char *prompt = menu_get_prompt(menu); 467 const char *prompt = menu_get_prompt(menu);
468 gchar *name; 468 gchar *name;
469 const char *help = nohelp_text; 469 const char *help = _(nohelp_text);
470 470
471 if (!menu->sym) 471 if (!menu->sym)
472 help = ""; 472 help = "";
473 else if (menu->sym->help) 473 else if (menu->sym->help)
474 help = menu->sym->help; 474 help = _(menu->sym->help);
475 475
476 if (menu->sym && menu->sym->name) 476 if (menu->sym && menu->sym->name)
477 name = g_strdup_printf(menu->sym->name); 477 name = g_strdup_printf(_(menu->sym->name));
478 else 478 else
479 name = g_strdup(""); 479 name = g_strdup("");
480 480
@@ -530,7 +530,7 @@ gboolean on_window1_delete_event(GtkWidget * widget, GdkEvent * event,
530 if (config_changed == FALSE) 530 if (config_changed == FALSE)
531 return FALSE; 531 return FALSE;
532 532
533 dialog = gtk_dialog_new_with_buttons("Warning !", 533 dialog = gtk_dialog_new_with_buttons(_("Warning !"),
534 GTK_WINDOW(main_wnd), 534 GTK_WINDOW(main_wnd),
535 (GtkDialogFlags) 535 (GtkDialogFlags)
536 (GTK_DIALOG_MODAL | 536 (GTK_DIALOG_MODAL |
@@ -544,7 +544,7 @@ gboolean on_window1_delete_event(GtkWidget * widget, GdkEvent * event,
544 gtk_dialog_set_default_response(GTK_DIALOG(dialog), 544 gtk_dialog_set_default_response(GTK_DIALOG(dialog),
545 GTK_RESPONSE_CANCEL); 545 GTK_RESPONSE_CANCEL);
546 546
547 label = gtk_label_new("\nSave configuration ?\n"); 547 label = gtk_label_new(_("\nSave configuration ?\n"));
548 gtk_container_add(GTK_CONTAINER(GTK_DIALOG(dialog)->vbox), label); 548 gtk_container_add(GTK_CONTAINER(GTK_DIALOG(dialog)->vbox), label);
549 gtk_widget_show(label); 549 gtk_widget_show(label);
550 550
@@ -604,7 +604,7 @@ load_filename(GtkFileSelection * file_selector, gpointer user_data)
604 (user_data)); 604 (user_data));
605 605
606 if (conf_read(fn)) 606 if (conf_read(fn))
607 text_insert_msg("Error", "Unable to load configuration !"); 607 text_insert_msg(_("Error"), _("Unable to load configuration !"));
608 else 608 else
609 display_tree(&rootmenu); 609 display_tree(&rootmenu);
610} 610}
@@ -613,7 +613,7 @@ void on_load1_activate(GtkMenuItem * menuitem, gpointer user_data)
613{ 613{
614 GtkWidget *fs; 614 GtkWidget *fs;
615 615
616 fs = gtk_file_selection_new("Load file..."); 616 fs = gtk_file_selection_new(_("Load file..."));
617 g_signal_connect(GTK_OBJECT(GTK_FILE_SELECTION(fs)->ok_button), 617 g_signal_connect(GTK_OBJECT(GTK_FILE_SELECTION(fs)->ok_button),
618 "clicked", 618 "clicked",
619 G_CALLBACK(load_filename), (gpointer) fs); 619 G_CALLBACK(load_filename), (gpointer) fs);
@@ -632,7 +632,7 @@ void on_load1_activate(GtkMenuItem * menuitem, gpointer user_data)
632void on_save1_activate(GtkMenuItem * menuitem, gpointer user_data) 632void on_save1_activate(GtkMenuItem * menuitem, gpointer user_data)
633{ 633{
634 if (conf_write(NULL)) 634 if (conf_write(NULL))
635 text_insert_msg("Error", "Unable to save configuration !"); 635 text_insert_msg(_("Error"), _("Unable to save configuration !"));
636 636
637 config_changed = FALSE; 637 config_changed = FALSE;
638} 638}
@@ -647,7 +647,7 @@ store_filename(GtkFileSelection * file_selector, gpointer user_data)
647 (user_data)); 647 (user_data));
648 648
649 if (conf_write(fn)) 649 if (conf_write(fn))
650 text_insert_msg("Error", "Unable to save configuration !"); 650 text_insert_msg(_("Error"), _("Unable to save configuration !"));
651 651
652 gtk_widget_destroy(GTK_WIDGET(user_data)); 652 gtk_widget_destroy(GTK_WIDGET(user_data));
653} 653}
@@ -656,7 +656,7 @@ void on_save_as1_activate(GtkMenuItem * menuitem, gpointer user_data)
656{ 656{
657 GtkWidget *fs; 657 GtkWidget *fs;
658 658
659 fs = gtk_file_selection_new("Save file as..."); 659 fs = gtk_file_selection_new(_("Save file as..."));
660 g_signal_connect(GTK_OBJECT(GTK_FILE_SELECTION(fs)->ok_button), 660 g_signal_connect(GTK_OBJECT(GTK_FILE_SELECTION(fs)->ok_button),
661 "clicked", 661 "clicked",
662 G_CALLBACK(store_filename), (gpointer) fs); 662 G_CALLBACK(store_filename), (gpointer) fs);
@@ -740,7 +740,7 @@ on_show_debug_info1_activate(GtkMenuItem * menuitem, gpointer user_data)
740void on_introduction1_activate(GtkMenuItem * menuitem, gpointer user_data) 740void on_introduction1_activate(GtkMenuItem * menuitem, gpointer user_data)
741{ 741{
742 GtkWidget *dialog; 742 GtkWidget *dialog;
743 const gchar *intro_text = 743 const gchar *intro_text = _(
744 "Welcome to gkc, the GTK+ graphical kernel configuration tool\n" 744 "Welcome to gkc, the GTK+ graphical kernel configuration tool\n"
745 "for Linux.\n" 745 "for Linux.\n"
746 "For each option, a blank box indicates the feature is disabled, a\n" 746 "For each option, a blank box indicates the feature is disabled, a\n"
@@ -756,7 +756,7 @@ void on_introduction1_activate(GtkMenuItem * menuitem, gpointer user_data)
756 "option.\n" 756 "option.\n"
757 "\n" 757 "\n"
758 "Toggling Show Debug Info under the Options menu will show \n" 758 "Toggling Show Debug Info under the Options menu will show \n"
759 "the dependencies, which you can then match by examining other options."; 759 "the dependencies, which you can then match by examining other options.");
760 760
761 dialog = gtk_message_dialog_new(GTK_WINDOW(main_wnd), 761 dialog = gtk_message_dialog_new(GTK_WINDOW(main_wnd),
762 GTK_DIALOG_DESTROY_WITH_PARENT, 762 GTK_DIALOG_DESTROY_WITH_PARENT,
@@ -773,8 +773,8 @@ void on_about1_activate(GtkMenuItem * menuitem, gpointer user_data)
773{ 773{
774 GtkWidget *dialog; 774 GtkWidget *dialog;
775 const gchar *about_text = 775 const gchar *about_text =
776 "gkc is copyright (c) 2002 Romain Lievin <roms@lpg.ticalc.org>.\n" 776 _("gkc is copyright (c) 2002 Romain Lievin <roms@lpg.ticalc.org>.\n"
777 "Based on the source code from Roman Zippel.\n"; 777 "Based on the source code from Roman Zippel.\n");
778 778
779 dialog = gtk_message_dialog_new(GTK_WINDOW(main_wnd), 779 dialog = gtk_message_dialog_new(GTK_WINDOW(main_wnd),
780 GTK_DIALOG_DESTROY_WITH_PARENT, 780 GTK_DIALOG_DESTROY_WITH_PARENT,
@@ -791,9 +791,9 @@ void on_license1_activate(GtkMenuItem * menuitem, gpointer user_data)
791{ 791{
792 GtkWidget *dialog; 792 GtkWidget *dialog;
793 const gchar *license_text = 793 const gchar *license_text =
794 "gkc is released under the terms of the GNU GPL v2.\n" 794 _("gkc is released under the terms of the GNU GPL v2.\n"
795 "For more information, please see the source code or\n" 795 "For more information, please see the source code or\n"
796 "visit http://www.fsf.org/licenses/licenses.html\n"; 796 "visit http://www.fsf.org/licenses/licenses.html\n");
797 797
798 dialog = gtk_message_dialog_new(GTK_WINDOW(main_wnd), 798 dialog = gtk_message_dialog_new(GTK_WINDOW(main_wnd),
799 GTK_DIALOG_DESTROY_WITH_PARENT, 799 GTK_DIALOG_DESTROY_WITH_PARENT,
@@ -1579,6 +1579,10 @@ int main(int ac, char *av[])
1579 kconfig_load(); 1579 kconfig_load();
1580#endif 1580#endif
1581 1581
1582 bindtextdomain(PACKAGE, LOCALEDIR);
1583 bind_textdomain_codeset(PACKAGE, "UTF-8");
1584 textdomain(PACKAGE);
1585
1582 /* GTK stuffs */ 1586 /* GTK stuffs */
1583 gtk_set_locale(); 1587 gtk_set_locale();
1584 gtk_init(&ac, &av); 1588 gtk_init(&ac, &av);
diff --git a/scripts/kconfig/kxgettext.c b/scripts/kconfig/kxgettext.c
new file mode 100644
index 000000000000..1c88d7c6d5a7
--- /dev/null
+++ b/scripts/kconfig/kxgettext.c
@@ -0,0 +1,221 @@
1/*
2 * Arnaldo Carvalho de Melo <acme@conectiva.com.br>, 2005
3 *
4 * Released under the terms of the GNU GPL v2.0
5 */
6
7#include <stdlib.h>
8#include <string.h>
9
10#define LKC_DIRECT_LINK
11#include "lkc.h"
12
13static char *escape(const char* text, char *bf, int len)
14{
15 char *bfp = bf;
16 int multiline = strchr(text, '\n') != NULL;
17
18 *bfp++ = '"';
19 --len;
20
21 if (multiline) {
22 *bfp++ = '"';
23 *bfp++ = '\n';
24 *bfp++ = '"';
25 len -= 3;
26 }
27
28 while (*text != '\0' && len > 1) {
29 if (*text == '"')
30 *bfp++ = '\\';
31 else if (*text == '\n') {
32 *bfp++ = '\\';
33 *bfp++ = 'n';
34 *bfp++ = '"';
35 *bfp++ = '\n';
36 *bfp++ = '"';
37 len -= 5;
38 ++text;
39 goto next;
40 }
41 *bfp++ = *text++;
42next:
43 --len;
44 }
45
46 if (multiline)
47 bfp -= 3;
48
49 *bfp++ = '"';
50 *bfp = '\0';
51
52 return bf;
53}
54
55struct file_line {
56 struct file_line *next;
57 char* file;
58 int lineno;
59};
60
61static struct file_line *file_line__new(char *file, int lineno)
62{
63 struct file_line *self = malloc(sizeof(*self));
64
65 if (self == NULL)
66 goto out;
67
68 self->file = file;
69 self->lineno = lineno;
70 self->next = NULL;
71out:
72 return self;
73}
74
75struct message {
76 const char *msg;
77 const char *option;
78 struct message *next;
79 struct file_line *files;
80};
81
82static struct message *message__list;
83
84static struct message *message__new(const char *msg, char *option, char *file, int lineno)
85{
86 struct message *self = malloc(sizeof(*self));
87
88 if (self == NULL)
89 goto out;
90
91 self->files = file_line__new(file, lineno);
92 if (self->files == NULL)
93 goto out_fail;
94
95 self->msg = strdup(msg);
96 if (self->msg == NULL)
97 goto out_fail_msg;
98
99 self->option = option;
100 self->next = NULL;
101out:
102 return self;
103out_fail_msg:
104 free(self->files);
105out_fail:
106 free(self);
107 self = NULL;
108 goto out;
109}
110
111static struct message *mesage__find(const char *msg)
112{
113 struct message *m = message__list;
114
115 while (m != NULL) {
116 if (strcmp(m->msg, msg) == 0)
117 break;
118 m = m->next;
119 }
120
121 return m;
122}
123
124static int message__add_file_line(struct message *self, char *file, int lineno)
125{
126 int rc = -1;
127 struct file_line *fl = file_line__new(file, lineno);
128
129 if (fl == NULL)
130 goto out;
131
132 fl->next = self->files;
133 self->files = fl;
134 rc = 0;
135out:
136 return rc;
137}
138
139static int message__add(const char *msg, char *option, char *file, int lineno)
140{
141 int rc = 0;
142 char bf[16384];
143 char *escaped = escape(msg, bf, sizeof(bf));
144 struct message *m = mesage__find(escaped);
145
146 if (m != NULL)
147 rc = message__add_file_line(m, file, lineno);
148 else {
149 m = message__new(escaped, option, file, lineno);
150
151 if (m != NULL) {
152 m->next = message__list;
153 message__list = m;
154 } else
155 rc = -1;
156 }
157 return rc;
158}
159
160void menu_build_message_list(struct menu *menu)
161{
162 struct menu *child;
163
164 message__add(menu_get_prompt(menu), NULL,
165 menu->file == NULL ? "Root Menu" : menu->file->name,
166 menu->lineno);
167
168 if (menu->sym != NULL && menu->sym->help != NULL)
169 message__add(menu->sym->help, menu->sym->name,
170 menu->file == NULL ? "Root Menu" : menu->file->name,
171 menu->lineno);
172
173 for (child = menu->list; child != NULL; child = child->next)
174 if (child->prompt != NULL)
175 menu_build_message_list(child);
176}
177
178static void message__print_file_lineno(struct message *self)
179{
180 struct file_line *fl = self->files;
181
182 printf("\n#: %s:%d", fl->file, fl->lineno);
183 fl = fl->next;
184
185 while (fl != NULL) {
186 printf(", %s:%d", fl->file, fl->lineno);
187 fl = fl->next;
188 }
189
190 if (self->option != NULL)
191 printf(", %s:00000", self->option);
192
193 putchar('\n');
194}
195
196static void message__print_gettext_msgid_msgstr(struct message *self)
197{
198 message__print_file_lineno(self);
199
200 printf("msgid %s\n"
201 "msgstr \"\"\n", self->msg);
202}
203
204void menu__xgettext(void)
205{
206 struct message *m = message__list;
207
208 while (m != NULL) {
209 message__print_gettext_msgid_msgstr(m);
210 m = m->next;
211 }
212}
213
214int main(int ac, char **av)
215{
216 conf_parse(av[1]);
217
218 menu_build_message_list(menu_get_root_menu(NULL));
219 menu__xgettext();
220 return 0;
221}
diff --git a/scripts/kconfig/lkc.h b/scripts/kconfig/lkc.h
index b8a67fc9d647..8b84c42b49b5 100644
--- a/scripts/kconfig/lkc.h
+++ b/scripts/kconfig/lkc.h
@@ -8,6 +8,8 @@
8 8
9#include "expr.h" 9#include "expr.h"
10 10
11#include <libintl.h>
12
11#ifdef __cplusplus 13#ifdef __cplusplus
12extern "C" { 14extern "C" {
13#endif 15#endif
@@ -23,6 +25,12 @@ extern "C" {
23 25
24#define SRCTREE "srctree" 26#define SRCTREE "srctree"
25 27
28#define PACKAGE "linux"
29#define LOCALEDIR "/usr/share/locale"
30
31#define _(text) gettext(text)
32#define N_(text) (text)
33
26int zconfparse(void); 34int zconfparse(void);
27void zconfdump(FILE *out); 35void zconfdump(FILE *out);
28 36
diff --git a/scripts/kconfig/mconf.c b/scripts/kconfig/mconf.c
index 730d316fe7fe..e5db10ca9564 100644
--- a/scripts/kconfig/mconf.c
+++ b/scripts/kconfig/mconf.c
@@ -4,6 +4,8 @@
4 * 4 *
5 * Introduced single menu mode (show all sub-menus in one large tree). 5 * Introduced single menu mode (show all sub-menus in one large tree).
6 * 2002-11-06 Petr Baudis <pasky@ucw.cz> 6 * 2002-11-06 Petr Baudis <pasky@ucw.cz>
7 *
8 * i18n, 2005, Arnaldo Carvalho de Melo <acme@conectiva.com.br>
7 */ 9 */
8 10
9#include <sys/ioctl.h> 11#include <sys/ioctl.h>
@@ -23,7 +25,7 @@
23#include "lkc.h" 25#include "lkc.h"
24 26
25static char menu_backtitle[128]; 27static char menu_backtitle[128];
26static const char mconf_readme[] = 28static const char mconf_readme[] = N_(
27"Overview\n" 29"Overview\n"
28"--------\n" 30"--------\n"
29"Some kernel features may be built directly into the kernel.\n" 31"Some kernel features may be built directly into the kernel.\n"
@@ -156,39 +158,39 @@ static const char mconf_readme[] =
156"\n" 158"\n"
157"Note that this mode can eventually be a little more CPU expensive\n" 159"Note that this mode can eventually be a little more CPU expensive\n"
158"(especially with a larger number of unrolled categories) than the\n" 160"(especially with a larger number of unrolled categories) than the\n"
159"default mode.\n", 161"default mode.\n"),
160menu_instructions[] = 162menu_instructions[] = N_(
161 "Arrow keys navigate the menu. " 163 "Arrow keys navigate the menu. "
162 "<Enter> selects submenus --->. " 164 "<Enter> selects submenus --->. "
163 "Highlighted letters are hotkeys. " 165 "Highlighted letters are hotkeys. "
164 "Pressing <Y> includes, <N> excludes, <M> modularizes features. " 166 "Pressing <Y> includes, <N> excludes, <M> modularizes features. "
165 "Press <Esc><Esc> to exit, <?> for Help, </> for Search. " 167 "Press <Esc><Esc> to exit, <?> for Help, </> for Search. "
166 "Legend: [*] built-in [ ] excluded <M> module < > module capable", 168 "Legend: [*] built-in [ ] excluded <M> module < > module capable"),
167radiolist_instructions[] = 169radiolist_instructions[] = N_(
168 "Use the arrow keys to navigate this window or " 170 "Use the arrow keys to navigate this window or "
169 "press the hotkey of the item you wish to select " 171 "press the hotkey of the item you wish to select "
170 "followed by the <SPACE BAR>. " 172 "followed by the <SPACE BAR>. "
171 "Press <?> for additional information about this option.", 173 "Press <?> for additional information about this option."),
172inputbox_instructions_int[] = 174inputbox_instructions_int[] = N_(
173 "Please enter a decimal value. " 175 "Please enter a decimal value. "
174 "Fractions will not be accepted. " 176 "Fractions will not be accepted. "
175 "Use the <TAB> key to move from the input field to the buttons below it.", 177 "Use the <TAB> key to move from the input field to the buttons below it."),
176inputbox_instructions_hex[] = 178inputbox_instructions_hex[] = N_(
177 "Please enter a hexadecimal value. " 179 "Please enter a hexadecimal value. "
178 "Use the <TAB> key to move from the input field to the buttons below it.", 180 "Use the <TAB> key to move from the input field to the buttons below it."),
179inputbox_instructions_string[] = 181inputbox_instructions_string[] = N_(
180 "Please enter a string value. " 182 "Please enter a string value. "
181 "Use the <TAB> key to move from the input field to the buttons below it.", 183 "Use the <TAB> key to move from the input field to the buttons below it."),
182setmod_text[] = 184setmod_text[] = N_(
183 "This feature depends on another which has been configured as a module.\n" 185 "This feature depends on another which has been configured as a module.\n"
184 "As a result, this feature will be built as a module.", 186 "As a result, this feature will be built as a module."),
185nohelp_text[] = 187nohelp_text[] = N_(
186 "There is no help available for this kernel option.\n", 188 "There is no help available for this kernel option.\n"),
187load_config_text[] = 189load_config_text[] = N_(
188 "Enter the name of the configuration file you wish to load. " 190 "Enter the name of the configuration file you wish to load. "
189 "Accept the name shown to restore the configuration you " 191 "Accept the name shown to restore the configuration you "
190 "last retrieved. Leave blank to abort.", 192 "last retrieved. Leave blank to abort."),
191load_config_help[] = 193load_config_help[] = N_(
192 "\n" 194 "\n"
193 "For various reasons, one may wish to keep several different kernel\n" 195 "For various reasons, one may wish to keep several different kernel\n"
194 "configurations available on a single machine.\n" 196 "configurations available on a single machine.\n"
@@ -198,11 +200,11 @@ load_config_help[] =
198 "to modify that configuration.\n" 200 "to modify that configuration.\n"
199 "\n" 201 "\n"
200 "If you are uncertain, then you have probably never used alternate\n" 202 "If you are uncertain, then you have probably never used alternate\n"
201 "configuration files. You should therefor leave this blank to abort.\n", 203 "configuration files. You should therefor leave this blank to abort.\n"),
202save_config_text[] = 204save_config_text[] = N_(
203 "Enter a filename to which this configuration should be saved " 205 "Enter a filename to which this configuration should be saved "
204 "as an alternate. Leave blank to abort.", 206 "as an alternate. Leave blank to abort."),
205save_config_help[] = 207save_config_help[] = N_(
206 "\n" 208 "\n"
207 "For various reasons, one may wish to keep different kernel\n" 209 "For various reasons, one may wish to keep different kernel\n"
208 "configurations available on a single machine.\n" 210 "configurations available on a single machine.\n"
@@ -212,8 +214,8 @@ save_config_help[] =
212 "configuration options you have selected at that time.\n" 214 "configuration options you have selected at that time.\n"
213 "\n" 215 "\n"
214 "If you are uncertain what all this means then you should probably\n" 216 "If you are uncertain what all this means then you should probably\n"
215 "leave this blank.\n", 217 "leave this blank.\n"),
216search_help[] = 218search_help[] = N_(
217 "\n" 219 "\n"
218 "Search for CONFIG_ symbols and display their relations.\n" 220 "Search for CONFIG_ symbols and display their relations.\n"
219 "Example: search for \"^FOO\"\n" 221 "Example: search for \"^FOO\"\n"
@@ -250,7 +252,7 @@ search_help[] =
250 "Examples: USB => find all CONFIG_ symbols containing USB\n" 252 "Examples: USB => find all CONFIG_ symbols containing USB\n"
251 " ^USB => find all CONFIG_ symbols starting with USB\n" 253 " ^USB => find all CONFIG_ symbols starting with USB\n"
252 " USB$ => find all CONFIG_ symbols ending with USB\n" 254 " USB$ => find all CONFIG_ symbols ending with USB\n"
253 "\n"; 255 "\n");
254 256
255static signed char buf[4096], *bufptr = buf; 257static signed char buf[4096], *bufptr = buf;
256static signed char input_buf[4096]; 258static signed char input_buf[4096];
@@ -305,8 +307,8 @@ static void init_wsize(void)
305 } 307 }
306 308
307 if (rows < 19 || cols < 80) { 309 if (rows < 19 || cols < 80) {
308 fprintf(stderr, "Your display is too small to run Menuconfig!\n"); 310 fprintf(stderr, N_("Your display is too small to run Menuconfig!\n"));
309 fprintf(stderr, "It must be at least 19 lines by 80 columns.\n"); 311 fprintf(stderr, N_("It must be at least 19 lines by 80 columns.\n"));
310 exit(1); 312 exit(1);
311 } 313 }
312 314
@@ -526,9 +528,9 @@ static void search_conf(void)
526again: 528again:
527 cprint_init(); 529 cprint_init();
528 cprint("--title"); 530 cprint("--title");
529 cprint("Search Configuration Parameter"); 531 cprint(_("Search Configuration Parameter"));
530 cprint("--inputbox"); 532 cprint("--inputbox");
531 cprint("Enter Keyword"); 533 cprint(_("Enter Keyword"));
532 cprint("10"); 534 cprint("10");
533 cprint("75"); 535 cprint("75");
534 cprint(""); 536 cprint("");
@@ -539,7 +541,7 @@ again:
539 case 0: 541 case 0:
540 break; 542 break;
541 case 1: 543 case 1:
542 show_helptext("Search Configuration", search_help); 544 show_helptext(_("Search Configuration"), search_help);
543 goto again; 545 goto again;
544 default: 546 default:
545 return; 547 return;
@@ -548,7 +550,7 @@ again:
548 sym_arr = sym_re_search(input_buf); 550 sym_arr = sym_re_search(input_buf);
549 res = get_relations_str(sym_arr); 551 res = get_relations_str(sym_arr);
550 free(sym_arr); 552 free(sym_arr);
551 show_textbox("Search Results", str_get(&res), 0, 0); 553 show_textbox(_("Search Results"), str_get(&res), 0, 0);
552 str_free(&res); 554 str_free(&res);
553} 555}
554 556
@@ -721,9 +723,9 @@ static void conf(struct menu *menu)
721 while (1) { 723 while (1) {
722 cprint_init(); 724 cprint_init();
723 cprint("--title"); 725 cprint("--title");
724 cprint("%s", prompt ? prompt : "Main Menu"); 726 cprint("%s", prompt ? prompt : _("Main Menu"));
725 cprint("--menu"); 727 cprint("--menu");
726 cprint(menu_instructions); 728 cprint(_(menu_instructions));
727 cprint("%d", rows); 729 cprint("%d", rows);
728 cprint("%d", cols); 730 cprint("%d", cols);
729 cprint("%d", rows - 10); 731 cprint("%d", rows - 10);
@@ -736,9 +738,9 @@ static void conf(struct menu *menu)
736 cprint(":"); 738 cprint(":");
737 cprint("--- "); 739 cprint("--- ");
738 cprint("L"); 740 cprint("L");
739 cprint(" Load an Alternate Configuration File"); 741 cprint(_(" Load an Alternate Configuration File"));
740 cprint("S"); 742 cprint("S");
741 cprint(" Save Configuration to an Alternate File"); 743 cprint(_(" Save Configuration to an Alternate File"));
742 } 744 }
743 stat = exec_conf(); 745 stat = exec_conf();
744 if (stat < 0) 746 if (stat < 0)
@@ -793,7 +795,7 @@ static void conf(struct menu *menu)
793 if (sym) 795 if (sym)
794 show_help(submenu); 796 show_help(submenu);
795 else 797 else
796 show_helptext("README", mconf_readme); 798 show_helptext("README", _(mconf_readme));
797 break; 799 break;
798 case 3: 800 case 3:
799 if (type == 't') { 801 if (type == 't') {
@@ -849,7 +851,7 @@ static void show_help(struct menu *menu)
849 { 851 {
850 if (sym->name) { 852 if (sym->name) {
851 str_printf(&help, "CONFIG_%s:\n\n", sym->name); 853 str_printf(&help, "CONFIG_%s:\n\n", sym->name);
852 str_append(&help, sym->help); 854 str_append(&help, _(sym->help));
853 str_append(&help, "\n"); 855 str_append(&help, "\n");
854 } 856 }
855 } else { 857 } else {
@@ -886,9 +888,9 @@ static void conf_choice(struct menu *menu)
886 while (1) { 888 while (1) {
887 cprint_init(); 889 cprint_init();
888 cprint("--title"); 890 cprint("--title");
889 cprint("%s", prompt ? prompt : "Main Menu"); 891 cprint("%s", prompt ? prompt : _("Main Menu"));
890 cprint("--radiolist"); 892 cprint("--radiolist");
891 cprint(radiolist_instructions); 893 cprint(_(radiolist_instructions));
892 cprint("15"); 894 cprint("15");
893 cprint("70"); 895 cprint("70");
894 cprint("6"); 896 cprint("6");
@@ -935,17 +937,17 @@ static void conf_string(struct menu *menu)
935 while (1) { 937 while (1) {
936 cprint_init(); 938 cprint_init();
937 cprint("--title"); 939 cprint("--title");
938 cprint("%s", prompt ? prompt : "Main Menu"); 940 cprint("%s", prompt ? prompt : _("Main Menu"));
939 cprint("--inputbox"); 941 cprint("--inputbox");
940 switch (sym_get_type(menu->sym)) { 942 switch (sym_get_type(menu->sym)) {
941 case S_INT: 943 case S_INT:
942 cprint(inputbox_instructions_int); 944 cprint(_(inputbox_instructions_int));
943 break; 945 break;
944 case S_HEX: 946 case S_HEX:
945 cprint(inputbox_instructions_hex); 947 cprint(_(inputbox_instructions_hex));
946 break; 948 break;
947 case S_STRING: 949 case S_STRING:
948 cprint(inputbox_instructions_string); 950 cprint(_(inputbox_instructions_string));
949 break; 951 break;
950 default: 952 default:
951 /* panic? */; 953 /* panic? */;
@@ -958,7 +960,7 @@ static void conf_string(struct menu *menu)
958 case 0: 960 case 0:
959 if (sym_set_string_value(menu->sym, input_buf)) 961 if (sym_set_string_value(menu->sym, input_buf))
960 return; 962 return;
961 show_textbox(NULL, "You have made an invalid entry.", 5, 43); 963 show_textbox(NULL, _("You have made an invalid entry."), 5, 43);
962 break; 964 break;
963 case 1: 965 case 1:
964 show_help(menu); 966 show_help(menu);
@@ -987,10 +989,10 @@ static void conf_load(void)
987 return; 989 return;
988 if (!conf_read(input_buf)) 990 if (!conf_read(input_buf))
989 return; 991 return;
990 show_textbox(NULL, "File does not exist!", 5, 38); 992 show_textbox(NULL, _("File does not exist!"), 5, 38);
991 break; 993 break;
992 case 1: 994 case 1:
993 show_helptext("Load Alternate Configuration", load_config_help); 995 show_helptext(_("Load Alternate Configuration"), load_config_help);
994 break; 996 break;
995 case 255: 997 case 255:
996 return; 998 return;
@@ -1016,10 +1018,10 @@ static void conf_save(void)
1016 return; 1018 return;
1017 if (!conf_write(input_buf)) 1019 if (!conf_write(input_buf))
1018 return; 1020 return;
1019 show_textbox(NULL, "Can't create file! Probably a nonexistent directory.", 5, 60); 1021 show_textbox(NULL, _("Can't create file! Probably a nonexistent directory."), 5, 60);
1020 break; 1022 break;
1021 case 1: 1023 case 1:
1022 show_helptext("Save Alternate Configuration", save_config_help); 1024 show_helptext(_("Save Alternate Configuration"), save_config_help);
1023 break; 1025 break;
1024 case 255: 1026 case 255:
1025 return; 1027 return;
@@ -1040,12 +1042,16 @@ int main(int ac, char **av)
1040 char *mode; 1042 char *mode;
1041 int stat; 1043 int stat;
1042 1044
1045 setlocale(LC_ALL, "");
1046 bindtextdomain(PACKAGE, LOCALEDIR);
1047 textdomain(PACKAGE);
1048
1043 conf_parse(av[1]); 1049 conf_parse(av[1]);
1044 conf_read(NULL); 1050 conf_read(NULL);
1045 1051
1046 sym = sym_lookup("KERNELRELEASE", 0); 1052 sym = sym_lookup("KERNELRELEASE", 0);
1047 sym_calc_value(sym); 1053 sym_calc_value(sym);
1048 sprintf(menu_backtitle, "Linux Kernel v%s Configuration", 1054 sprintf(menu_backtitle, _("Linux Kernel v%s Configuration"),
1049 sym_get_string_value(sym)); 1055 sym_get_string_value(sym));
1050 1056
1051 mode = getenv("MENUCONFIG_MODE"); 1057 mode = getenv("MENUCONFIG_MODE");
@@ -1062,7 +1068,7 @@ int main(int ac, char **av)
1062 do { 1068 do {
1063 cprint_init(); 1069 cprint_init();
1064 cprint("--yesno"); 1070 cprint("--yesno");
1065 cprint("Do you wish to save your new kernel configuration?"); 1071 cprint(_("Do you wish to save your new kernel configuration?"));
1066 cprint("5"); 1072 cprint("5");
1067 cprint("60"); 1073 cprint("60");
1068 stat = exec_conf(); 1074 stat = exec_conf();
@@ -1070,20 +1076,20 @@ int main(int ac, char **av)
1070 1076
1071 if (stat == 0) { 1077 if (stat == 0) {
1072 if (conf_write(NULL)) { 1078 if (conf_write(NULL)) {
1073 fprintf(stderr, "\n\n" 1079 fprintf(stderr, _("\n\n"
1074 "Error during writing of the kernel configuration.\n" 1080 "Error during writing of the kernel configuration.\n"
1075 "Your kernel configuration changes were NOT saved." 1081 "Your kernel configuration changes were NOT saved."
1076 "\n\n"); 1082 "\n\n"));
1077 return 1; 1083 return 1;
1078 } 1084 }
1079 printf("\n\n" 1085 printf(_("\n\n"
1080 "*** End of Linux kernel configuration.\n" 1086 "*** End of Linux kernel configuration.\n"
1081 "*** Execute 'make' to build the kernel or try 'make help'." 1087 "*** Execute 'make' to build the kernel or try 'make help'."
1082 "\n\n"); 1088 "\n\n"));
1083 } else { 1089 } else {
1084 fprintf(stderr, "\n\n" 1090 fprintf(stderr, _("\n\n"
1085 "Your kernel configuration changes were NOT saved." 1091 "Your kernel configuration changes were NOT saved."
1086 "\n\n"); 1092 "\n\n"));
1087 } 1093 }
1088 1094
1089 return 0; 1095 return 0;
diff --git a/scripts/kconfig/menu.c b/scripts/kconfig/menu.c
index 0c13156f3344..8c59b212722d 100644
--- a/scripts/kconfig/menu.c
+++ b/scripts/kconfig/menu.c
@@ -365,9 +365,9 @@ bool menu_is_visible(struct menu *menu)
365const char *menu_get_prompt(struct menu *menu) 365const char *menu_get_prompt(struct menu *menu)
366{ 366{
367 if (menu->prompt) 367 if (menu->prompt)
368 return menu->prompt->text; 368 return _(menu->prompt->text);
369 else if (menu->sym) 369 else if (menu->sym)
370 return menu->sym->name; 370 return _(menu->sym->name);
371 return NULL; 371 return NULL;
372} 372}
373 373
diff --git a/scripts/kconfig/qconf.cc b/scripts/kconfig/qconf.cc
index 0cdbf9dbbd51..4590cd31623f 100644
--- a/scripts/kconfig/qconf.cc
+++ b/scripts/kconfig/qconf.cc
@@ -26,8 +26,23 @@
26#include "qconf.moc" 26#include "qconf.moc"
27#include "images.c" 27#include "images.c"
28 28
29#ifdef _
30# undef _
31# define _ qgettext
32#endif
33
29static QApplication *configApp; 34static QApplication *configApp;
30 35
36static inline QString qgettext(const char* str)
37{
38 return QString::fromLocal8Bit(gettext(str));
39}
40
41static inline QString qgettext(const QString& str)
42{
43 return QString::fromLocal8Bit(gettext(str.latin1()));
44}
45
31ConfigSettings::ConfigSettings() 46ConfigSettings::ConfigSettings()
32 : showAll(false), showName(false), showRange(false), showData(false) 47 : showAll(false), showName(false), showRange(false), showData(false)
33{ 48{
@@ -177,7 +192,7 @@ void ConfigItem::updateMenu(void)
177 192
178 sym = menu->sym; 193 sym = menu->sym;
179 prop = menu->prompt; 194 prop = menu->prompt;
180 prompt = menu_get_prompt(menu); 195 prompt = QString::fromLocal8Bit(menu_get_prompt(menu));
181 196
182 if (prop) switch (prop->type) { 197 if (prop) switch (prop->type) {
183 case P_MENU: 198 case P_MENU:
@@ -203,7 +218,7 @@ void ConfigItem::updateMenu(void)
203 if (!sym) 218 if (!sym)
204 goto set_prompt; 219 goto set_prompt;
205 220
206 setText(nameColIdx, sym->name); 221 setText(nameColIdx, QString::fromLocal8Bit(sym->name));
207 222
208 type = sym_get_type(sym); 223 type = sym_get_type(sym);
209 switch (type) { 224 switch (type) {
@@ -213,9 +228,9 @@ void ConfigItem::updateMenu(void)
213 228
214 if (!sym_is_changable(sym) && !list->showAll) { 229 if (!sym_is_changable(sym) && !list->showAll) {
215 setPixmap(promptColIdx, 0); 230 setPixmap(promptColIdx, 0);
216 setText(noColIdx, 0); 231 setText(noColIdx, QString::null);
217 setText(modColIdx, 0); 232 setText(modColIdx, QString::null);
218 setText(yesColIdx, 0); 233 setText(yesColIdx, QString::null);
219 break; 234 break;
220 } 235 }
221 expr = sym_get_tristate_value(sym); 236 expr = sym_get_tristate_value(sym);
@@ -257,6 +272,7 @@ void ConfigItem::updateMenu(void)
257 const char* data; 272 const char* data;
258 273
259 data = sym_get_string_value(sym); 274 data = sym_get_string_value(sym);
275
260#if QT_VERSION >= 300 276#if QT_VERSION >= 300
261 int i = list->mapIdx(dataColIdx); 277 int i = list->mapIdx(dataColIdx);
262 if (i >= 0) 278 if (i >= 0)
@@ -264,9 +280,9 @@ void ConfigItem::updateMenu(void)
264#endif 280#endif
265 setText(dataColIdx, data); 281 setText(dataColIdx, data);
266 if (type == S_STRING) 282 if (type == S_STRING)
267 prompt.sprintf("%s: %s", prompt.latin1(), data); 283 prompt = QString("%1: %2").arg(prompt).arg(data);
268 else 284 else
269 prompt.sprintf("(%s) %s", data, prompt.latin1()); 285 prompt = QString("(%2) %1").arg(prompt).arg(data);
270 break; 286 break;
271 } 287 }
272 if (!sym_has_value(sym) && visible) 288 if (!sym_has_value(sym) && visible)
@@ -343,9 +359,9 @@ void ConfigLineEdit::show(ConfigItem* i)
343{ 359{
344 item = i; 360 item = i;
345 if (sym_get_string_value(item->menu->sym)) 361 if (sym_get_string_value(item->menu->sym))
346 setText(sym_get_string_value(item->menu->sym)); 362 setText(QString::fromLocal8Bit(sym_get_string_value(item->menu->sym)));
347 else 363 else
348 setText(0); 364 setText(QString::null);
349 Parent::show(); 365 Parent::show();
350 setFocus(); 366 setFocus();
351} 367}
@@ -961,7 +977,7 @@ ConfigMainWindow::ConfigMainWindow(void)
961 delete configSettings; 977 delete configSettings;
962} 978}
963 979
964static QString print_filter(const char *str) 980static QString print_filter(const QString &str)
965{ 981{
966 QRegExp re("[<>&\"\\n]"); 982 QRegExp re("[<>&\"\\n]");
967 QString res = str; 983 QString res = str;
@@ -994,7 +1010,7 @@ static QString print_filter(const char *str)
994 1010
995static void expr_print_help(void *data, const char *str) 1011static void expr_print_help(void *data, const char *str)
996{ 1012{
997 ((QString*)data)->append(print_filter(str)); 1013 reinterpret_cast<QString*>(data)->append(print_filter(str));
998} 1014}
999 1015
1000/* 1016/*
@@ -1009,7 +1025,7 @@ void ConfigMainWindow::setHelp(QListViewItem* item)
1009 if (item) 1025 if (item)
1010 menu = ((ConfigItem*)item)->menu; 1026 menu = ((ConfigItem*)item)->menu;
1011 if (!menu) { 1027 if (!menu) {
1012 helpText->setText(NULL); 1028 helpText->setText(QString::null);
1013 return; 1029 return;
1014 } 1030 }
1015 1031
@@ -1019,16 +1035,16 @@ void ConfigMainWindow::setHelp(QListViewItem* item)
1019 if (sym) { 1035 if (sym) {
1020 if (menu->prompt) { 1036 if (menu->prompt) {
1021 head += "<big><b>"; 1037 head += "<big><b>";
1022 head += print_filter(menu->prompt->text); 1038 head += print_filter(_(menu->prompt->text));
1023 head += "</b></big>"; 1039 head += "</b></big>";
1024 if (sym->name) { 1040 if (sym->name) {
1025 head += " ("; 1041 head += " (";
1026 head += print_filter(sym->name); 1042 head += print_filter(_(sym->name));
1027 head += ")"; 1043 head += ")";
1028 } 1044 }
1029 } else if (sym->name) { 1045 } else if (sym->name) {
1030 head += "<big><b>"; 1046 head += "<big><b>";
1031 head += print_filter(sym->name); 1047 head += print_filter(_(sym->name));
1032 head += "</b></big>"; 1048 head += "</b></big>";
1033 } 1049 }
1034 head += "<br><br>"; 1050 head += "<br><br>";
@@ -1049,7 +1065,7 @@ void ConfigMainWindow::setHelp(QListViewItem* item)
1049 case P_PROMPT: 1065 case P_PROMPT:
1050 case P_MENU: 1066 case P_MENU:
1051 debug += "prompt: "; 1067 debug += "prompt: ";
1052 debug += print_filter(prop->text); 1068 debug += print_filter(_(prop->text));
1053 debug += "<br>"; 1069 debug += "<br>";
1054 break; 1070 break;
1055 case P_DEFAULT: 1071 case P_DEFAULT:
@@ -1088,10 +1104,10 @@ void ConfigMainWindow::setHelp(QListViewItem* item)
1088 debug += "<br>"; 1104 debug += "<br>";
1089 } 1105 }
1090 1106
1091 help = print_filter(sym->help); 1107 help = print_filter(_(sym->help));
1092 } else if (menu->prompt) { 1108 } else if (menu->prompt) {
1093 head += "<big><b>"; 1109 head += "<big><b>";
1094 head += print_filter(menu->prompt->text); 1110 head += print_filter(_(menu->prompt->text));
1095 head += "</b></big><br><br>"; 1111 head += "</b></big><br><br>";
1096 if (showDebug) { 1112 if (showDebug) {
1097 if (menu->prompt->visible.expr) { 1113 if (menu->prompt->visible.expr) {
@@ -1111,7 +1127,7 @@ void ConfigMainWindow::loadConfig(void)
1111 QString s = QFileDialog::getOpenFileName(".config", NULL, this); 1127 QString s = QFileDialog::getOpenFileName(".config", NULL, this);
1112 if (s.isNull()) 1128 if (s.isNull())
1113 return; 1129 return;
1114 if (conf_read(s.latin1())) 1130 if (conf_read(QFile::encodeName(s)))
1115 QMessageBox::information(this, "qconf", "Unable to load configuration!"); 1131 QMessageBox::information(this, "qconf", "Unable to load configuration!");
1116 ConfigView::updateListAll(); 1132 ConfigView::updateListAll();
1117} 1133}
@@ -1127,7 +1143,7 @@ void ConfigMainWindow::saveConfigAs(void)
1127 QString s = QFileDialog::getSaveFileName(".config", NULL, this); 1143 QString s = QFileDialog::getSaveFileName(".config", NULL, this);
1128 if (s.isNull()) 1144 if (s.isNull())
1129 return; 1145 return;
1130 if (conf_write(s.latin1())) 1146 if (conf_write(QFile::encodeName(s)))
1131 QMessageBox::information(this, "qconf", "Unable to save configuration!"); 1147 QMessageBox::information(this, "qconf", "Unable to save configuration!");
1132} 1148}
1133 1149
@@ -1372,6 +1388,9 @@ int main(int ac, char** av)
1372 ConfigMainWindow* v; 1388 ConfigMainWindow* v;
1373 const char *name; 1389 const char *name;
1374 1390
1391 bindtextdomain(PACKAGE, LOCALEDIR);
1392 textdomain(PACKAGE);
1393
1375#ifndef LKC_DIRECT_LINK 1394#ifndef LKC_DIRECT_LINK
1376 kconfig_load(); 1395 kconfig_load();
1377#endif 1396#endif
diff --git a/scripts/kernel-doc b/scripts/kernel-doc
index 8b1dab63f11c..0835dc2a8aa9 100755
--- a/scripts/kernel-doc
+++ b/scripts/kernel-doc
@@ -553,15 +553,20 @@ sub output_section_xml(%) {
553 # print out each section 553 # print out each section
554 $lineprefix=" "; 554 $lineprefix=" ";
555 foreach $section (@{$args{'sectionlist'}}) { 555 foreach $section (@{$args{'sectionlist'}}) {
556 print "<refsect1>\n <title>$section</title>\n <para>\n"; 556 print "<refsect1>\n";
557 print "<title>$section</title>\n";
557 if ($section =~ m/EXAMPLE/i) { 558 if ($section =~ m/EXAMPLE/i) {
558 print "<example><para>\n"; 559 print "<informalexample><programlisting>\n";
560 } else {
561 print "<para>\n";
559 } 562 }
560 output_highlight($args{'sections'}{$section}); 563 output_highlight($args{'sections'}{$section});
561 if ($section =~ m/EXAMPLE/i) { 564 if ($section =~ m/EXAMPLE/i) {
562 print "</para></example>\n"; 565 print "</programlisting></informalexample>\n";
566 } else {
567 print "</para>\n";
563 } 568 }
564 print " </para>\n</refsect1>\n"; 569 print "</refsect1>\n";
565 } 570 }
566} 571}
567 572
@@ -576,8 +581,14 @@ sub output_function_xml(%) {
576 $id =~ s/[^A-Za-z0-9]/-/g; 581 $id =~ s/[^A-Za-z0-9]/-/g;
577 582
578 print "<refentry>\n"; 583 print "<refentry>\n";
584 print "<refentryinfo>\n";
585 print " <title>LINUX</title>\n";
586 print " <productname>Kernel Hackers Manual</productname>\n";
587 print " <date>$man_date</date>\n";
588 print "</refentryinfo>\n";
579 print "<refmeta>\n"; 589 print "<refmeta>\n";
580 print "<refentrytitle><phrase id=\"$id\">".$args{'function'}."</phrase></refentrytitle>\n"; 590 print " <refentrytitle><phrase id=\"$id\">".$args{'function'}."</phrase></refentrytitle>\n";
591 print " <manvolnum>9</manvolnum>\n";
581 print "</refmeta>\n"; 592 print "</refmeta>\n";
582 print "<refnamediv>\n"; 593 print "<refnamediv>\n";
583 print " <refname>".$args{'function'}."</refname>\n"; 594 print " <refname>".$args{'function'}."</refname>\n";
@@ -607,7 +618,7 @@ sub output_function_xml(%) {
607 } 618 }
608 } 619 }
609 } else { 620 } else {
610 print " <void>\n"; 621 print " <void/>\n";
611 } 622 }
612 print " </funcprototype></funcsynopsis>\n"; 623 print " </funcprototype></funcsynopsis>\n";
613 print "</refsynopsisdiv>\n"; 624 print "</refsynopsisdiv>\n";
@@ -646,8 +657,14 @@ sub output_struct_xml(%) {
646 $id =~ s/[^A-Za-z0-9]/-/g; 657 $id =~ s/[^A-Za-z0-9]/-/g;
647 658
648 print "<refentry>\n"; 659 print "<refentry>\n";
660 print "<refentryinfo>\n";
661 print " <title>LINUX</title>\n";
662 print " <productname>Kernel Hackers Manual</productname>\n";
663 print " <date>$man_date</date>\n";
664 print "</refentryinfo>\n";
649 print "<refmeta>\n"; 665 print "<refmeta>\n";
650 print "<refentrytitle><phrase id=\"$id\">".$args{'type'}." ".$args{'struct'}."</phrase></refentrytitle>\n"; 666 print " <refentrytitle><phrase id=\"$id\">".$args{'type'}." ".$args{'struct'}."</phrase></refentrytitle>\n";
667 print " <manvolnum>9</manvolnum>\n";
651 print "</refmeta>\n"; 668 print "</refmeta>\n";
652 print "<refnamediv>\n"; 669 print "<refnamediv>\n";
653 print " <refname>".$args{'type'}." ".$args{'struct'}."</refname>\n"; 670 print " <refname>".$args{'type'}." ".$args{'struct'}."</refname>\n";
@@ -724,8 +741,14 @@ sub output_enum_xml(%) {
724 $id =~ s/[^A-Za-z0-9]/-/g; 741 $id =~ s/[^A-Za-z0-9]/-/g;
725 742
726 print "<refentry>\n"; 743 print "<refentry>\n";
744 print "<refentryinfo>\n";
745 print " <title>LINUX</title>\n";
746 print " <productname>Kernel Hackers Manual</productname>\n";
747 print " <date>$man_date</date>\n";
748 print "</refentryinfo>\n";
727 print "<refmeta>\n"; 749 print "<refmeta>\n";
728 print "<refentrytitle><phrase id=\"$id\">enum ".$args{'enum'}."</phrase></refentrytitle>\n"; 750 print " <refentrytitle><phrase id=\"$id\">enum ".$args{'enum'}."</phrase></refentrytitle>\n";
751 print " <manvolnum>9</manvolnum>\n";
729 print "</refmeta>\n"; 752 print "</refmeta>\n";
730 print "<refnamediv>\n"; 753 print "<refnamediv>\n";
731 print " <refname>enum ".$args{'enum'}."</refname>\n"; 754 print " <refname>enum ".$args{'enum'}."</refname>\n";
@@ -784,8 +807,14 @@ sub output_typedef_xml(%) {
784 $id =~ s/[^A-Za-z0-9]/-/g; 807 $id =~ s/[^A-Za-z0-9]/-/g;
785 808
786 print "<refentry>\n"; 809 print "<refentry>\n";
810 print "<refentryinfo>\n";
811 print " <title>LINUX</title>\n";
812 print " <productname>Kernel Hackers Manual</productname>\n";
813 print " <date>$man_date</date>\n";
814 print "</refentryinfo>\n";
787 print "<refmeta>\n"; 815 print "<refmeta>\n";
788 print "<refentrytitle><phrase id=\"$id\">typedef ".$args{'typedef'}."</phrase></refentrytitle>\n"; 816 print " <refentrytitle><phrase id=\"$id\">typedef ".$args{'typedef'}."</phrase></refentrytitle>\n";
817 print " <manvolnum>9</manvolnum>\n";
789 print "</refmeta>\n"; 818 print "</refmeta>\n";
790 print "<refnamediv>\n"; 819 print "<refnamediv>\n";
791 print " <refname>typedef ".$args{'typedef'}."</refname>\n"; 820 print " <refname>typedef ".$args{'typedef'}."</refname>\n";
@@ -1465,6 +1494,8 @@ sub dump_function($$) {
1465 1494
1466 $prototype =~ s/^static +//; 1495 $prototype =~ s/^static +//;
1467 $prototype =~ s/^extern +//; 1496 $prototype =~ s/^extern +//;
1497 $prototype =~ s/^fastcall +//;
1498 $prototype =~ s/^asmlinkage +//;
1468 $prototype =~ s/^inline +//; 1499 $prototype =~ s/^inline +//;
1469 $prototype =~ s/^__inline__ +//; 1500 $prototype =~ s/^__inline__ +//;
1470 $prototype =~ s/^#define +//; #ak added 1501 $prototype =~ s/^#define +//; #ak added
diff --git a/scripts/makeman b/scripts/makeman
deleted file mode 100755
index db3af647ee17..000000000000
--- a/scripts/makeman
+++ /dev/null
@@ -1,185 +0,0 @@
1#!/usr/bin/perl
2
3use strict;
4
5## Copyright (C) Michael Still (mikal@stillhq.com)
6## Released under the terms of the GNU GPL
7##
8## A script to make or install the manpages extracted by split-man
9##
10## Arguements: $1 -- the word "convert" or "install"
11## $2 -- the directory containing the SGML files for the manpages
12## $3 -- the filename which contained the sgmldoc output
13## (I need this so I know which manpages to convert)
14
15my($LISTING, $GENERATED, $INPUT, $OUTPUT, $front, $mode, $filename, $tmpdir);
16
17if($ARGV[0] eq ""){
18 die "Usage: makeman [convert | install] <dir> <file>\n";
19}
20
21if( ! -d "$ARGV[1]" ){
22 die "Output directory \"$ARGV[1]\" does not exist\n";
23}
24
25if($ENV{"TMPDIR"} ne ""){
26 $tmpdir = $ENV{"TMPDIR"};
27}
28else{
29 $tmpdir = "/tmp";
30}
31
32if($ARGV[0] eq "convert"){
33 open LISTING, "grep \"<refentrytitle>\" $ARGV[2] |";
34 while(<LISTING>){
35 s/<\/.*$//;
36 s/^.*>//;
37 s/\.sgml//;
38 s/struct //;
39 s/typedef //;
40
41 chomp;
42 $filename = $_;
43 print "Processing $filename\n";
44
45 # Open the input file to extract the front matter, generate the man page,
46 # and open it, and the rearrange everything until it is happy
47 open INPUT, "< $ARGV[1]/$filename.sgml";
48 $front = "";
49 $mode = 0;
50
51 # The modes used here are:
52 # mode = 0
53 # <!-- BEGINFRONTTAG -->
54 # <!-- <bookinfo> mode = 1
55 # <!-- <legalnotice> mode = 2
56 # <!-- ...GPL or whatever...
57 # <!-- </legalnotice> mode = 4
58 # <!-- </bookinfo> mode = 3
59 # <!-- ENDFRONTTAG -->
60 #
61 # ...doco...
62
63 # I know that some of the if statements in this while loop are in a funny
64 # order, but that is deliberate...
65 while(<INPUT>){
66 if($mode > 0){
67 s/<!-- //;
68 s/ -->//;
69 s/<docinfo>//i;
70 s<\/docinfo>//i;
71 s/^[ \t]*//i;
72 }
73
74 if($mode == 2){
75 if(/<para>/i){
76 }
77 elsif(/<\/para>/i){
78 $front = "$front.\\\" \n";
79 }
80 elsif(/<\/legalnotice>/i){
81 $mode = 4;
82 }
83 elsif(/^[ \t]*$/){
84 }
85 else{
86 $front = "$front.\\\" $_";
87 }
88 }
89
90 if($mode == 1){
91 if(/<title>(.*)<\/title>/i){
92 $front = "$front.\\\" This documentation was generated from the book titled \"$1\", which is part of the Linux kernel source.\n.\\\" \n";
93 }
94 elsif(/<legalnotice>/i){
95 $front = "$front.\\\" This documentation comes with the following legal notice:\n.\\\" \n";
96 $mode = 2;
97 }
98
99 elsif(/<author>/i){
100 $front = "$front.\\\" Documentation by: ";
101 }
102 elsif(/<firstname>(.*)<\/firstname>/i){
103 $front = "$front$1 ";
104 }
105 elsif(/<surname>(.*)<\/surname>/i){
106 $front = "$front$1 ";
107 }
108 elsif(/<email>(.*)<\/email>/i){
109 $front = "$front($1)";
110 }
111 elsif(/\/author>/i){
112 $front = "$front\n";
113 }
114
115 elsif(/<copyright>/i){
116 $front = "$front.\\\" Documentation copyright: ";
117 }
118 elsif(/<holder>(.*)<\/holder>/i){
119 $front = "$front$1 ";
120 }
121 elsif(/<year>(.*)<\/year>/i){
122 $front = "$front$1 ";
123 }
124 elsif(/\/copyright>/i){
125 $front = "$front\n";
126 }
127
128 elsif(/^[ \t]*$/
129 || /<affiliation>/i
130 || /<\/affiliation>/i
131 || /<address>/i
132 || /<\/address>/i
133 || /<authorgroup>/i
134 || /<\/authorgroup>/i
135 || /<\/legalnotice>/i
136 || /<date>/i
137 || /<\/date>/i
138 || /<edition>/i
139 || /<\/edition>/i
140 || /<pubdate>/i
141 || /<\/pubdate>/i){
142 }
143 else{
144 print "Unknown tag in manpage conversion: $_";
145 }
146 }
147
148 if($mode == 0){
149 if(/<bookinfo>/i){
150 $mode = 1;
151 }
152 }
153
154 if($mode == 4){
155 if(/<\/bookinfo>/i){
156 $mode = 3;
157 }
158 }
159 }
160 close INPUT;
161
162 system("cd $ARGV[1]; docbook2man $filename.sgml; mv $filename.9 $tmpdir/$$.9\n");
163 open GENERATED, "< $tmpdir/$$.9";
164 open OUTPUT, "> $ARGV[1]/$filename.9";
165
166 print OUTPUT "$front";
167 print OUTPUT ".\\\" For comments on the formatting of this manpage, please contact Michael Still <mikal\@stillhq.com>\n\n";
168 while(<GENERATED>){
169 print OUTPUT "$_";
170 }
171 close OUTPUT;
172 close GENERATED;
173
174 system("gzip -f $ARGV[1]/$filename.9\n");
175 unlink("$tmpdir/$$.9");
176 }
177}
178elsif($ARGV[0] eq "install"){
179 system("mkdir -p /usr/local/man/man9/; install $ARGV[1]/*.9.gz /usr/local/man/man9/");
180}
181else{
182 die "Usage: makeman [convert | install] <dir> <file>\n";
183}
184
185print "Done\n";
diff --git a/scripts/mod/file2alias.c b/scripts/mod/file2alias.c
index d54b52d3bb6f..32197efe67ed 100644
--- a/scripts/mod/file2alias.c
+++ b/scripts/mod/file2alias.c
@@ -47,32 +47,31 @@ do { \
47 sprintf(str + strlen(str), "*"); \ 47 sprintf(str + strlen(str), "*"); \
48} while(0) 48} while(0)
49 49
50/* Looks like "usb:vNpNdlNdhNdcNdscNdpNicNiscNipN" */ 50/* USB is special because the bcdDevice can be matched against a numeric range */
51static int do_usb_entry(const char *filename, 51/* Looks like "usb:vNpNdNdcNdscNdpNicNiscNipN" */
52 struct usb_device_id *id, char *alias) 52static void do_usb_entry(struct usb_device_id *id,
53 unsigned int bcdDevice_initial, int bcdDevice_initial_digits,
54 unsigned char range_lo, unsigned char range_hi,
55 struct module *mod)
53{ 56{
54 id->match_flags = TO_NATIVE(id->match_flags); 57 char alias[500];
55 id->idVendor = TO_NATIVE(id->idVendor);
56 id->idProduct = TO_NATIVE(id->idProduct);
57 id->bcdDevice_lo = TO_NATIVE(id->bcdDevice_lo);
58 id->bcdDevice_hi = TO_NATIVE(id->bcdDevice_hi);
59
60 /*
61 * Some modules (visor) have empty slots as placeholder for
62 * run-time specification that results in catch-all alias
63 */
64 if (!(id->idVendor | id->bDeviceClass | id->bInterfaceClass))
65 return 1;
66
67 strcpy(alias, "usb:"); 58 strcpy(alias, "usb:");
68 ADD(alias, "v", id->match_flags&USB_DEVICE_ID_MATCH_VENDOR, 59 ADD(alias, "v", id->match_flags&USB_DEVICE_ID_MATCH_VENDOR,
69 id->idVendor); 60 id->idVendor);
70 ADD(alias, "p", id->match_flags&USB_DEVICE_ID_MATCH_PRODUCT, 61 ADD(alias, "p", id->match_flags&USB_DEVICE_ID_MATCH_PRODUCT,
71 id->idProduct); 62 id->idProduct);
72 ADD(alias, "dl", id->match_flags&USB_DEVICE_ID_MATCH_DEV_LO, 63
73 id->bcdDevice_lo); 64 strcat(alias, "d");
74 ADD(alias, "dh", id->match_flags&USB_DEVICE_ID_MATCH_DEV_HI, 65 if (bcdDevice_initial_digits)
75 id->bcdDevice_hi); 66 sprintf(alias + strlen(alias), "%0*X",
67 bcdDevice_initial_digits, bcdDevice_initial);
68 if (range_lo == range_hi)
69 sprintf(alias + strlen(alias), "%u", range_lo);
70 else if (range_lo > 0 || range_hi < 9)
71 sprintf(alias + strlen(alias), "[%u-%u]", range_lo, range_hi);
72 if (bcdDevice_initial_digits < (sizeof(id->bcdDevice_lo) * 2 - 1))
73 strcat(alias, "*");
74
76 ADD(alias, "dc", id->match_flags&USB_DEVICE_ID_MATCH_DEV_CLASS, 75 ADD(alias, "dc", id->match_flags&USB_DEVICE_ID_MATCH_DEV_CLASS,
77 id->bDeviceClass); 76 id->bDeviceClass);
78 ADD(alias, "dsc", 77 ADD(alias, "dsc",
@@ -90,7 +89,73 @@ static int do_usb_entry(const char *filename,
90 ADD(alias, "ip", 89 ADD(alias, "ip",
91 id->match_flags&USB_DEVICE_ID_MATCH_INT_PROTOCOL, 90 id->match_flags&USB_DEVICE_ID_MATCH_INT_PROTOCOL,
92 id->bInterfaceProtocol); 91 id->bInterfaceProtocol);
93 return 1; 92
93 /* Always end in a wildcard, for future extension */
94 if (alias[strlen(alias)-1] != '*')
95 strcat(alias, "*");
96 buf_printf(&mod->dev_table_buf,
97 "MODULE_ALIAS(\"%s\");\n", alias);
98}
99
100static void do_usb_entry_multi(struct usb_device_id *id, struct module *mod)
101{
102 unsigned int devlo, devhi;
103 unsigned char chi, clo;
104 int ndigits;
105
106 id->match_flags = TO_NATIVE(id->match_flags);
107 id->idVendor = TO_NATIVE(id->idVendor);
108 id->idProduct = TO_NATIVE(id->idProduct);
109
110 devlo = id->match_flags & USB_DEVICE_ID_MATCH_DEV_LO ?
111 TO_NATIVE(id->bcdDevice_lo) : 0x0U;
112 devhi = id->match_flags & USB_DEVICE_ID_MATCH_DEV_HI ?
113 TO_NATIVE(id->bcdDevice_hi) : ~0x0U;
114
115 /*
116 * Some modules (visor) have empty slots as placeholder for
117 * run-time specification that results in catch-all alias
118 */
119 if (!(id->idVendor | id->bDeviceClass | id->bInterfaceClass))
120 return;
121
122 /* Convert numeric bcdDevice range into fnmatch-able pattern(s) */
123 for (ndigits = sizeof(id->bcdDevice_lo) * 2 - 1; devlo <= devhi; ndigits--) {
124 clo = devlo & 0xf;
125 chi = devhi & 0xf;
126 if (chi > 9) /* it's bcd not hex */
127 chi = 9;
128 devlo >>= 4;
129 devhi >>= 4;
130
131 if (devlo == devhi || !ndigits) {
132 do_usb_entry(id, devlo, ndigits, clo, chi, mod);
133 break;
134 }
135
136 if (clo > 0)
137 do_usb_entry(id, devlo++, ndigits, clo, 9, mod);
138
139 if (chi < 9)
140 do_usb_entry(id, devhi--, ndigits, 0, chi, mod);
141 }
142}
143
144static void do_usb_table(void *symval, unsigned long size,
145 struct module *mod)
146{
147 unsigned int i;
148 const unsigned long id_size = sizeof(struct usb_device_id);
149
150 if (size % id_size || size < id_size) {
151 fprintf(stderr, "*** Warning: %s ids %lu bad size "
152 "(each on %lu)\n", mod->name, size, id_size);
153 }
154 /* Leave last one: it's the terminator. */
155 size -= id_size;
156
157 for (i = 0; i < size; i += id_size)
158 do_usb_entry_multi(symval + i, mod);
94} 159}
95 160
96/* Looks like: ieee1394:venNmoNspNverN */ 161/* Looks like: ieee1394:venNmoNspNverN */
@@ -280,8 +345,8 @@ void handle_moddevtable(struct module *mod, struct elf_info *info,
280 do_table(symval, sym->st_size, sizeof(struct pci_device_id), 345 do_table(symval, sym->st_size, sizeof(struct pci_device_id),
281 do_pci_entry, mod); 346 do_pci_entry, mod);
282 else if (sym_is(symname, "__mod_usb_device_table")) 347 else if (sym_is(symname, "__mod_usb_device_table"))
283 do_table(symval, sym->st_size, sizeof(struct usb_device_id), 348 /* special case to handle bcdDevice ranges */
284 do_usb_entry, mod); 349 do_usb_table(symval, sym->st_size, mod);
285 else if (sym_is(symname, "__mod_ieee1394_device_table")) 350 else if (sym_is(symname, "__mod_ieee1394_device_table"))
286 do_table(symval, sym->st_size, sizeof(struct ieee1394_device_id), 351 do_table(symval, sym->st_size, sizeof(struct ieee1394_device_id),
287 do_ieee1394_entry, mod); 352 do_ieee1394_entry, mod);
diff --git a/scripts/patch-kernel b/scripts/patch-kernel
index 43af01075612..f2d47ca9c8fa 100755
--- a/scripts/patch-kernel
+++ b/scripts/patch-kernel
@@ -46,6 +46,19 @@
46# fix some whitespace damage; 46# fix some whitespace damage;
47# be smarter about stopping when current version is larger than requested; 47# be smarter about stopping when current version is larger than requested;
48# Randy Dunlap <rddunlap@osdl.org>, 2004-AUG-18. 48# Randy Dunlap <rddunlap@osdl.org>, 2004-AUG-18.
49#
50# Add better support for (non-incremental) 2.6.x.y patches;
51# If an ending version number if not specified, the script automatically
52# increments the SUBLEVEL (x in 2.6.x.y) until no more patch files are found;
53# however, EXTRAVERSION (y in 2.6.x.y) is never automatically incremented
54# but must be specified fully.
55#
56# patch-kernel does not normally support reverse patching, but does so when
57# applying EXTRAVERSION (x.y) patches, so that moving from 2.6.11.y to 2.6.11.z
58# is easy and handled by the script (reverse 2.6.11.y and apply 2.6.11.z).
59# Randy Dunlap <rddunlap@osdl.org>, 2005-APR-08.
60
61PNAME=patch-kernel
49 62
50# Set directories from arguments, or use defaults. 63# Set directories from arguments, or use defaults.
51sourcedir=${1-/usr/src/linux} 64sourcedir=${1-/usr/src/linux}
@@ -54,7 +67,7 @@ stopvers=${3-default}
54 67
55if [ "$1" == -h -o "$1" == --help -o ! -r "$sourcedir/Makefile" ]; then 68if [ "$1" == -h -o "$1" == --help -o ! -r "$sourcedir/Makefile" ]; then
56cat << USAGE 69cat << USAGE
57usage: patch-kernel [-h] [ sourcedir [ patchdir [ stopversion ] [ -acxx ] ] ] 70usage: $PNAME [-h] [ sourcedir [ patchdir [ stopversion ] [ -acxx ] ] ]
58 source directory defaults to /usr/src/linux, 71 source directory defaults to /usr/src/linux,
59 patch directory defaults to the current directory, 72 patch directory defaults to the current directory,
60 stopversion defaults to <all in patchdir>. 73 stopversion defaults to <all in patchdir>.
@@ -73,6 +86,19 @@ do
73done 86done
74 87
75# --------------------------------------------------------------------------- 88# ---------------------------------------------------------------------------
89# arg1 is filename
90noFile () {
91 echo "cannot find patch file: ${patch}"
92 exit 1
93}
94
95# ---------------------------------------------------------------------------
96backwards () {
97 echo "$PNAME does not support reverse patching"
98 exit 1
99}
100
101# ---------------------------------------------------------------------------
76# Find a file, first parameter is basename of file 102# Find a file, first parameter is basename of file
77# it tries many compression mechanisms and sets variables to say how to get it 103# it tries many compression mechanisms and sets variables to say how to get it
78findFile () { 104findFile () {
@@ -133,6 +159,28 @@ applyPatch () {
133 return 0; 159 return 0;
134} 160}
135 161
162# ---------------------------------------------------------------------------
163# arg1 is patch filename
164reversePatch () {
165 echo -n "Reversing $1 (${name}) ... "
166 if $uncomp ${patchdir}/"$1"${ext} | patch -p1 -Rs -N -E -d $sourcedir
167 then
168 echo "done."
169 else
170 echo "failed. Clean it up."
171 exit 1
172 fi
173 if [ "`find $sourcedir/ '(' -name '*.rej' -o -name '.*.rej' ')' -print`" ]
174 then
175 echo "Aborting. Reject files found."
176 return 1
177 fi
178 # Remove backup files
179 find $sourcedir/ '(' -name '*.orig' -o -name '.*.orig' ')' -exec rm -f {} \;
180
181 return 0
182}
183
136# set current VERSION, PATCHLEVEL, SUBLEVEL, EXTRAVERSION 184# set current VERSION, PATCHLEVEL, SUBLEVEL, EXTRAVERSION
137TMPFILE=`mktemp .tmpver.XXXXXX` || { echo "cannot make temp file" ; exit 1; } 185TMPFILE=`mktemp .tmpver.XXXXXX` || { echo "cannot make temp file" ; exit 1; }
138grep -E "^(VERSION|PATCHLEVEL|SUBLEVEL|EXTRAVERSION)" $sourcedir/Makefile > $TMPFILE 186grep -E "^(VERSION|PATCHLEVEL|SUBLEVEL|EXTRAVERSION)" $sourcedir/Makefile > $TMPFILE
@@ -160,53 +208,57 @@ then
160 EXTRAVER=$EXTRAVERSION 208 EXTRAVER=$EXTRAVERSION
161 fi 209 fi
162 EXTRAVER=${EXTRAVER%%[[:punct:]]*} 210 EXTRAVER=${EXTRAVER%%[[:punct:]]*}
163 #echo "patch-kernel: changing EXTRAVERSION from $EXTRAVERSION to $EXTRAVER" 211 #echo "$PNAME: changing EXTRAVERSION from $EXTRAVERSION to $EXTRAVER"
164fi 212fi
165 213
166#echo "stopvers=$stopvers" 214#echo "stopvers=$stopvers"
167if [ $stopvers != "default" ]; then 215if [ $stopvers != "default" ]; then
168 STOPSUBLEVEL=`echo $stopvers | cut -d. -f3` 216 STOPSUBLEVEL=`echo $stopvers | cut -d. -f3`
169 STOPEXTRA=`echo $stopvers | cut -d. -f4` 217 STOPEXTRA=`echo $stopvers | cut -d. -f4`
170 #echo "STOPSUBLEVEL=$STOPSUBLEVEL, STOPEXTRA=$STOPEXTRA" 218 #echo "#___STOPSUBLEVEL=/$STOPSUBLEVEL/, STOPEXTRA=/$STOPEXTRA/"
171else 219else
172 STOPSUBLEVEL=9999 220 STOPSUBLEVEL=9999
173 STOPEXTRA=9999 221 STOPEXTRA=9999
174fi 222fi
175 223
176while : # incrementing SUBLEVEL (s in v.p.s) 224# This all assumes a 2.6.x[.y] kernel tree.
177do 225# Don't allow backwards/reverse patching.
178 if [ x$EXTRAVER != "x" ]; then 226if [ $STOPSUBLEVEL -lt $SUBLEVEL ]; then
227 backwards
228fi
229
230if [ x$EXTRAVER != "x" ]; then
179 CURRENTFULLVERSION="$VERSION.$PATCHLEVEL.$SUBLEVEL.$EXTRAVER" 231 CURRENTFULLVERSION="$VERSION.$PATCHLEVEL.$SUBLEVEL.$EXTRAVER"
180 else 232else
181 CURRENTFULLVERSION="$VERSION.$PATCHLEVEL.$SUBLEVEL" 233 CURRENTFULLVERSION="$VERSION.$PATCHLEVEL.$SUBLEVEL"
182 fi 234fi
235
236if [ x$EXTRAVER != "x" ]; then
237 echo "backing up to: $VERSION.$PATCHLEVEL.$SUBLEVEL"
238 patch="patch-${CURRENTFULLVERSION}"
239 findFile $patchdir/${patch} || noFile ${patch}
240 reversePatch ${patch} || exit 1
241fi
183 242
243# now current is 2.6.x, with no EXTRA applied,
244# so update to target SUBLEVEL (2.6.SUBLEVEL)
245# and then to target EXTRAVER (2.6.SUB.EXTRAVER) if requested.
246# If not ending sublevel is specified, it is incremented until
247# no further sublevels are found.
248
249if [ $STOPSUBLEVEL -gt $SUBLEVEL ]; then
250while : # incrementing SUBLEVEL (s in v.p.s)
251do
252 CURRENTFULLVERSION="$VERSION.$PATCHLEVEL.$SUBLEVEL"
253 EXTRAVER=
184 if [ $stopvers == $CURRENTFULLVERSION ]; then 254 if [ $stopvers == $CURRENTFULLVERSION ]; then
185 echo "Stopping at $CURRENTFULLVERSION base as requested." 255 echo "Stopping at $CURRENTFULLVERSION base as requested."
186 break 256 break
187 fi 257 fi
188 258
189 while : # incrementing EXTRAVER (x in v.p.s.x)
190 do
191 EXTRAVER=$((EXTRAVER + 1))
192 FULLVERSION="$VERSION.$PATCHLEVEL.$SUBLEVEL.$EXTRAVER"
193 #echo "... trying $FULLVERSION ..."
194
195 patch=patch-$FULLVERSION
196
197 # See if the file exists and find extension
198 findFile $patchdir/${patch} || break
199
200 # Apply the patch and check all is OK
201 applyPatch $patch || break
202
203 continue 2
204 done
205
206 EXTRAVER=
207 SUBLEVEL=$((SUBLEVEL + 1)) 259 SUBLEVEL=$((SUBLEVEL + 1))
208 FULLVERSION="$VERSION.$PATCHLEVEL.$SUBLEVEL" 260 FULLVERSION="$VERSION.$PATCHLEVEL.$SUBLEVEL"
209 #echo "___ trying $FULLVERSION ___" 261 #echo "#___ trying $FULLVERSION ___"
210 262
211 if [ $((SUBLEVEL)) -gt $((STOPSUBLEVEL)) ]; then 263 if [ $((SUBLEVEL)) -gt $((STOPSUBLEVEL)) ]; then
212 echo "Stopping since sublevel ($SUBLEVEL) is beyond stop-sublevel ($STOPSUBLEVEL)" 264 echo "Stopping since sublevel ($SUBLEVEL) is beyond stop-sublevel ($STOPSUBLEVEL)"
@@ -214,14 +266,33 @@ do
214 fi 266 fi
215 267
216 patch=patch-$FULLVERSION 268 patch=patch-$FULLVERSION
217
218 # See if the file exists and find extension 269 # See if the file exists and find extension
219 findFile $patchdir/${patch} || break 270 findFile $patchdir/${patch} || noFile ${patch}
220 271
221 # Apply the patch and check all is OK 272 # Apply the patch and check all is OK
222 applyPatch $patch || break 273 applyPatch $patch || break
223done 274done
224#echo "base all done" 275#echo "#___sublevel all done"
276fi
277
278# There is no incremental searching for extraversion...
279if [ "$STOPEXTRA" != "" ]; then
280while : # just to allow break
281do
282# apply STOPEXTRA directly (not incrementally) (x in v.p.s.x)
283 FULLVERSION="$VERSION.$PATCHLEVEL.$SUBLEVEL.$STOPEXTRA"
284 #echo "#... trying $FULLVERSION ..."
285 patch=patch-$FULLVERSION
286
287 # See if the file exists and find extension
288 findFile $patchdir/${patch} || noFile ${patch}
289
290 # Apply the patch and check all is OK
291 applyPatch $patch || break
292 #echo "#___extraver all done"
293 break
294done
295fi
225 296
226if [ x$gotac != x ]; then 297if [ x$gotac != x ]; then
227 # Out great user wants the -ac patches 298 # Out great user wants the -ac patches
diff --git a/scripts/split-man b/scripts/split-man
deleted file mode 100755
index 03897fe6a75d..000000000000
--- a/scripts/split-man
+++ /dev/null
@@ -1,112 +0,0 @@
1#!/usr/bin/perl
2
3use strict;
4
5## Copyright (C) Michael Still (mikal@stillhq.com)
6## Released under the terms of the GNU GPL
7##
8## Hoon through the specified DocBook SGML file, and split out the
9## man pages. These can then be processed into groff format, and
10## installed if desired...
11##
12## Arguements: $1 -- the name of the sgml file
13## $2 -- the directory to put the generated SGML files in
14## $3 -- kernel version
15
16my($SGML, $REF, $front, $refdata, $mode, $filename);
17
18if(($ARGV[0] eq "") || ($ARGV[1] eq "") || ($ARGV[2] eq "")){
19 die "Usage: split-man <sgml file> <output dir> <kernel version>\n";
20}
21
22open SGML, "< $ARGV[0]" or die "Could not open input file \"$ARGV[0]\"\n";
23if( ! -d "$ARGV[1]" ){
24 die "Output directory \"$ARGV[1]\" does not exist\n";
25}
26
27# Possible modes:
28# 0: Looking for input I care about
29# 1: Inside book front matter
30# 2: Inside a refentry
31# 3: Inside a refentry, and we know the filename
32
33$mode = 0;
34$refdata = "";
35$front = "";
36while(<SGML>){
37 # Starting modes
38 if(/<bookinfo>/ || /<docinfo>/){
39 $mode = 1;
40 }
41 elsif(/<refentry>/){
42 $mode = 2;
43 }
44 elsif(/<refentrytitle><phrase[^>]*>([^<]*)<.*$/){
45 $mode = 3;
46 $filename = $1;
47
48 $filename =~ s/struct //;
49 $filename =~ s/typedef //;
50
51 print "Found manpage for $filename\n";
52 open REF, "> $ARGV[1]/$filename.sgml" or
53 die "Couldn't open output file \"$ARGV[1]/$filename.sgml\": $!\n";
54 print REF <<EOF;
55<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook V4.1//EN">
56
57<!-- BEGINFRONTTAG: The following is front matter for the parent book -->
58$front
59<!-- ENDFRONTTAG: End front matter -->
60
61$refdata
62EOF
63 $refdata = "";
64 }
65
66 # Extraction
67 if($mode == 1){
68 chomp $_;
69 $front = "$front<!-- $_ -->\n";
70 }
71 elsif($mode == 2){
72 $refdata = "$refdata$_";
73 }
74 elsif($mode == 3){
75 # There are some fixups which need to be applied
76 if(/<\/refmeta>/){
77 print REF "<manvolnum>9</manvolnum>\n";
78 }
79 if(/<\/refentry>/){
80 print REF <<EOF;
81<refsect1><title>About this document</title>
82<para>
83This documentation was generated with kernel version $ARGV[2].
84</para>
85</refsect1>
86EOF
87 }
88
89 # For some reason, we title the synopsis twice in the main DocBook
90 if(! /<title>Synopsis<\/title>/){
91 if(/<refentrytitle>/){
92 s/struct //;
93 s/typedef //;
94 }
95
96 print REF "$_";
97 }
98 }
99
100 # Ending modes
101 if(/<\/bookinfo>/ || /<\/docinfo>/){
102 $mode = 0;
103 }
104 elsif(/<\/refentry>/){
105 $mode = 0;
106 close REF;
107 }
108}
109
110# And make sure we don't process this unnessesarily
111$ARGV[0] =~ s/\.sgml/.9/;
112`touch $ARGV[0]`;