diff options
177 files changed, 23530 insertions, 4114 deletions
@@ -13,7 +13,7 @@ menu "Busybox Settings" | |||
13 | 13 | ||
14 | menu "General Configuration" | 14 | menu "General Configuration" |
15 | 15 | ||
16 | config CONFIG_NITPICK | 16 | config NITPICK |
17 | bool "See lots more (probably unnecessary) configuration options." | 17 | bool "See lots more (probably unnecessary) configuration options." |
18 | default n | 18 | default n |
19 | help | 19 | help |
@@ -29,7 +29,7 @@ config CONFIG_NITPICK | |||
29 | 29 | ||
30 | You have been warned. | 30 | You have been warned. |
31 | 31 | ||
32 | config CONFIG_DESKTOP | 32 | config DESKTOP |
33 | bool "Enable options for full-blown desktop systems." | 33 | bool "Enable options for full-blown desktop systems." |
34 | default n | 34 | default n |
35 | help | 35 | help |
@@ -39,8 +39,8 @@ config CONFIG_DESKTOP | |||
39 | 39 | ||
40 | choice | 40 | choice |
41 | prompt "Buffer allocation policy" | 41 | prompt "Buffer allocation policy" |
42 | default CONFIG_FEATURE_BUFFERS_USE_MALLOC | 42 | default FEATURE_BUFFERS_USE_MALLOC |
43 | depends on CONFIG_NITPICK | 43 | depends on NITPICK |
44 | help | 44 | help |
45 | There are 3 ways BusyBox can handle buffer allocations: | 45 | There are 3 ways BusyBox can handle buffer allocations: |
46 | - Use malloc. This costs code size for the call to xmalloc. | 46 | - Use malloc. This costs code size for the call to xmalloc. |
@@ -51,18 +51,18 @@ choice | |||
51 | behavior was the only one available for BusyBox versions 0.48 and | 51 | behavior was the only one available for BusyBox versions 0.48 and |
52 | earlier. | 52 | earlier. |
53 | 53 | ||
54 | config CONFIG_FEATURE_BUFFERS_USE_MALLOC | 54 | config FEATURE_BUFFERS_USE_MALLOC |
55 | bool "Allocate with Malloc" | 55 | bool "Allocate with Malloc" |
56 | 56 | ||
57 | config CONFIG_FEATURE_BUFFERS_GO_ON_STACK | 57 | config FEATURE_BUFFERS_GO_ON_STACK |
58 | bool "Allocate on the Stack" | 58 | bool "Allocate on the Stack" |
59 | 59 | ||
60 | config CONFIG_FEATURE_BUFFERS_GO_IN_BSS | 60 | config FEATURE_BUFFERS_GO_IN_BSS |
61 | bool "Allocate in the .bss section" | 61 | bool "Allocate in the .bss section" |
62 | 62 | ||
63 | endchoice | 63 | endchoice |
64 | 64 | ||
65 | config CONFIG_SHOW_USAGE | 65 | config SHOW_USAGE |
66 | bool "Show terse applet usage messages" | 66 | bool "Show terse applet usage messages" |
67 | default y | 67 | default y |
68 | help | 68 | help |
@@ -71,20 +71,20 @@ config CONFIG_SHOW_USAGE | |||
71 | messages if you say no here. | 71 | messages if you say no here. |
72 | This will save you up to 7k. | 72 | This will save you up to 7k. |
73 | 73 | ||
74 | config CONFIG_FEATURE_VERBOSE_USAGE | 74 | config FEATURE_VERBOSE_USAGE |
75 | bool "Show verbose applet usage messages" | 75 | bool "Show verbose applet usage messages" |
76 | default n | 76 | default n |
77 | select CONFIG_SHOW_USAGE | 77 | select SHOW_USAGE |
78 | help | 78 | help |
79 | All BusyBox applets will show more verbose help messages when | 79 | All BusyBox applets will show more verbose help messages when |
80 | busybox is invoked with --help. This will add a lot of text to the | 80 | busybox is invoked with --help. This will add a lot of text to the |
81 | busybox binary. In the default configuration, this will add about | 81 | busybox binary. In the default configuration, this will add about |
82 | 13k, but it can add much more depending on your configuration. | 82 | 13k, but it can add much more depending on your configuration. |
83 | 83 | ||
84 | config CONFIG_FEATURE_COMPRESS_USAGE | 84 | config FEATURE_COMPRESS_USAGE |
85 | bool "Store applet usage messages in compressed form" | 85 | bool "Store applet usage messages in compressed form" |
86 | default y | 86 | default y |
87 | depends on CONFIG_SHOW_USAGE | 87 | depends on SHOW_USAGE |
88 | help | 88 | help |
89 | Store usage messages in compressed form, uncompress them on-the-fly | 89 | Store usage messages in compressed form, uncompress them on-the-fly |
90 | when <applet> --help is called. | 90 | when <applet> --help is called. |
@@ -95,7 +95,7 @@ config CONFIG_FEATURE_COMPRESS_USAGE | |||
95 | and have very little memory, this might not be a win. Otherwise, | 95 | and have very little memory, this might not be a win. Otherwise, |
96 | you probably want this. | 96 | you probably want this. |
97 | 97 | ||
98 | config CONFIG_FEATURE_INSTALLER | 98 | config FEATURE_INSTALLER |
99 | bool "Support --install [-s] to install applet links at runtime" | 99 | bool "Support --install [-s] to install applet links at runtime" |
100 | default n | 100 | default n |
101 | help | 101 | help |
@@ -104,14 +104,14 @@ config CONFIG_FEATURE_INSTALLER | |||
104 | applets that are compiled into busybox. This feature requires the | 104 | applets that are compiled into busybox. This feature requires the |
105 | /proc filesystem. | 105 | /proc filesystem. |
106 | 106 | ||
107 | config CONFIG_LOCALE_SUPPORT | 107 | config LOCALE_SUPPORT |
108 | bool "Enable locale support (system needs locale for this to work)" | 108 | bool "Enable locale support (system needs locale for this to work)" |
109 | default n | 109 | default n |
110 | help | 110 | help |
111 | Enable this if your system has locale support and you would like | 111 | Enable this if your system has locale support and you would like |
112 | busybox to support locale settings. | 112 | busybox to support locale settings. |
113 | 113 | ||
114 | config CONFIG_GETOPT_LONG | 114 | config GETOPT_LONG |
115 | bool | 115 | bool |
116 | default y | 116 | default y |
117 | # bool "Enable support for --long-options" | 117 | # bool "Enable support for --long-options" |
@@ -120,7 +120,7 @@ config CONFIG_GETOPT_LONG | |||
120 | # Enable this if you want busybox applets to use the gnu --long-option | 120 | # Enable this if you want busybox applets to use the gnu --long-option |
121 | # style, in addition to single character -a -b -c style options. | 121 | # style, in addition to single character -a -b -c style options. |
122 | 122 | ||
123 | config CONFIG_FEATURE_DEVPTS | 123 | config FEATURE_DEVPTS |
124 | bool "Use the devpts filesystem for Unix98 PTYs" | 124 | bool "Use the devpts filesystem for Unix98 PTYs" |
125 | default y | 125 | default y |
126 | help | 126 | help |
@@ -130,10 +130,10 @@ config CONFIG_FEATURE_DEVPTS | |||
130 | /dev/ttyp<number> will be used. To use this option, you should have | 130 | /dev/ttyp<number> will be used. To use this option, you should have |
131 | devpts mounted. | 131 | devpts mounted. |
132 | 132 | ||
133 | config CONFIG_FEATURE_CLEAN_UP | 133 | config FEATURE_CLEAN_UP |
134 | bool "Clean up all memory before exiting (usually not needed)" | 134 | bool "Clean up all memory before exiting (usually not needed)" |
135 | default n | 135 | default n |
136 | depends on CONFIG_NITPICK | 136 | depends on NITPICK |
137 | help | 137 | help |
138 | As a size optimization, busybox normally exits without explicitly | 138 | As a size optimization, busybox normally exits without explicitly |
139 | freeing dynamically allocated memory or closing files. This saves | 139 | freeing dynamically allocated memory or closing files. This saves |
@@ -143,7 +143,7 @@ config CONFIG_FEATURE_CLEAN_UP | |||
143 | Don't enable this unless you have a really good reason to clean | 143 | Don't enable this unless you have a really good reason to clean |
144 | things up manually. | 144 | things up manually. |
145 | 145 | ||
146 | config CONFIG_FEATURE_SUID | 146 | config FEATURE_SUID |
147 | bool "Support for SUID/SGID handling" | 147 | bool "Support for SUID/SGID handling" |
148 | default n | 148 | default n |
149 | help | 149 | help |
@@ -158,17 +158,17 @@ config CONFIG_FEATURE_SUID | |||
158 | are login, passwd, su, ping, traceroute, crontab, dnsd, ipcrm, ipcs, | 158 | are login, passwd, su, ping, traceroute, crontab, dnsd, ipcrm, ipcs, |
159 | and vlock. | 159 | and vlock. |
160 | 160 | ||
161 | config CONFIG_FEATURE_SYSLOG | 161 | config FEATURE_SYSLOG |
162 | bool "Support for syslog" | 162 | bool "Support for syslog" |
163 | default n | 163 | default n |
164 | help | 164 | help |
165 | This option is auto-selected when you select any applet which may | 165 | This option is auto-selected when you select any applet which may |
166 | send its output to syslog. You do not need to select it manually. | 166 | send its output to syslog. You do not need to select it manually. |
167 | 167 | ||
168 | config CONFIG_FEATURE_SUID_CONFIG | 168 | config FEATURE_SUID_CONFIG |
169 | bool "Runtime SUID/SGID configuration via /etc/busybox.conf" | 169 | bool "Runtime SUID/SGID configuration via /etc/busybox.conf" |
170 | default n if CONFIG_FEATURE_SUID | 170 | default n if FEATURE_SUID |
171 | depends on CONFIG_FEATURE_SUID | 171 | depends on FEATURE_SUID |
172 | help | 172 | help |
173 | Allow the SUID / SGID state of an applet to be determined at runtime | 173 | Allow the SUID / SGID state of an applet to be determined at runtime |
174 | by checking /etc/busybox.conf. (This is sort of a poor man's sudo.) | 174 | by checking /etc/busybox.conf. (This is sort of a poor man's sudo.) |
@@ -197,15 +197,15 @@ config CONFIG_FEATURE_SUID_CONFIG | |||
197 | Robert 'sandman' Griebl has more information here: | 197 | Robert 'sandman' Griebl has more information here: |
198 | <url: http://www.softforge.de/bb/suid.html >. | 198 | <url: http://www.softforge.de/bb/suid.html >. |
199 | 199 | ||
200 | config CONFIG_FEATURE_SUID_CONFIG_QUIET | 200 | config FEATURE_SUID_CONFIG_QUIET |
201 | bool "Suppress warning message if /etc/busybox.conf is not readable" | 201 | bool "Suppress warning message if /etc/busybox.conf is not readable" |
202 | default y | 202 | default y |
203 | depends on CONFIG_FEATURE_SUID_CONFIG | 203 | depends on FEATURE_SUID_CONFIG |
204 | help | 204 | help |
205 | /etc/busybox.conf should be readable by the user needing the SUID, check | 205 | /etc/busybox.conf should be readable by the user needing the SUID, check |
206 | this option to avoid users to be notified about missing permissions. | 206 | this option to avoid users to be notified about missing permissions. |
207 | 207 | ||
208 | config CONFIG_SELINUX | 208 | config SELINUX |
209 | bool "Support NSA Security Enhanced Linux" | 209 | bool "Support NSA Security Enhanced Linux" |
210 | default n | 210 | default n |
211 | help | 211 | help |
@@ -225,7 +225,7 @@ config CONFIG_SELINUX | |||
225 | 225 | ||
226 | Most people will leave this set to 'N'. | 226 | Most people will leave this set to 'N'. |
227 | 227 | ||
228 | config CONFIG_BUSYBOX_EXEC_PATH | 228 | config BUSYBOX_EXEC_PATH |
229 | string "Path to BusyBox executable" | 229 | string "Path to BusyBox executable" |
230 | default "/proc/self/exe" | 230 | default "/proc/self/exe" |
231 | help | 231 | help |
@@ -239,7 +239,7 @@ endmenu | |||
239 | 239 | ||
240 | menu 'Build Options' | 240 | menu 'Build Options' |
241 | 241 | ||
242 | config CONFIG_STATIC | 242 | config STATIC |
243 | bool "Build BusyBox as a static binary (no shared libs)" | 243 | bool "Build BusyBox as a static binary (no shared libs)" |
244 | default n | 244 | default n |
245 | help | 245 | help |
@@ -253,7 +253,7 @@ config CONFIG_STATIC | |||
253 | 253 | ||
254 | Most people will leave this set to 'N'. | 254 | Most people will leave this set to 'N'. |
255 | 255 | ||
256 | config CONFIG_BUILD_LIBBUSYBOX | 256 | config BUILD_LIBBUSYBOX |
257 | bool "Build shared libbusybox" | 257 | bool "Build shared libbusybox" |
258 | default n | 258 | default n |
259 | help | 259 | help |
@@ -265,10 +265,10 @@ config CONFIG_BUILD_LIBBUSYBOX | |||
265 | binary serves no purpose (and increases the size). You should | 265 | binary serves no purpose (and increases the size). You should |
266 | almost certainly say "no" to this right now. | 266 | almost certainly say "no" to this right now. |
267 | 267 | ||
268 | config CONFIG_FEATURE_FULL_LIBBUSYBOX | 268 | config FEATURE_FULL_LIBBUSYBOX |
269 | bool "Feature-complete libbusybox" | 269 | bool "Feature-complete libbusybox" |
270 | default n if !CONFIG_FEATURE_SHARED_BUSYBOX | 270 | default n if !FEATURE_SHARED_BUSYBOX |
271 | depends on CONFIG_BUILD_LIBBUSYBOX | 271 | depends on BUILD_LIBBUSYBOX |
272 | help | 272 | help |
273 | Build a libbusybox with the complete feature-set, disregarding | 273 | Build a libbusybox with the complete feature-set, disregarding |
274 | the actually selected config. | 274 | the actually selected config. |
@@ -284,15 +284,15 @@ config CONFIG_FEATURE_FULL_LIBBUSYBOX | |||
284 | 284 | ||
285 | Say 'N' if in doubt. | 285 | Say 'N' if in doubt. |
286 | 286 | ||
287 | config CONFIG_FEATURE_SHARED_BUSYBOX | 287 | config FEATURE_SHARED_BUSYBOX |
288 | bool "Use shared libbusybox for busybox" | 288 | bool "Use shared libbusybox for busybox" |
289 | default y if CONFIG_BUILD_LIBBUSYBOX | 289 | default y if BUILD_LIBBUSYBOX |
290 | depends on !CONFIG_STATIC && CONFIG_BUILD_LIBBUSYBOX | 290 | depends on !STATIC && BUILD_LIBBUSYBOX |
291 | help | 291 | help |
292 | Use libbusybox.so also for busybox itself. | 292 | Use libbusybox.so also for busybox itself. |
293 | You need to have a working dynamic linker to use this variant. | 293 | You need to have a working dynamic linker to use this variant. |
294 | 294 | ||
295 | config CONFIG_LFS | 295 | config LFS |
296 | bool "Build with Large File Support (for accessing files > 2 GB)" | 296 | bool "Build with Large File Support (for accessing files > 2 GB)" |
297 | default n | 297 | default n |
298 | select FDISK_SUPPORT_LARGE_DISKS | 298 | select FDISK_SUPPORT_LARGE_DISKS |
@@ -304,7 +304,7 @@ config CONFIG_LFS | |||
304 | cp, mount, tar, and many others. If you want to access files larger | 304 | cp, mount, tar, and many others. If you want to access files larger |
305 | than 2 Gigabytes, enable this option. Otherwise, leave it set to 'N'. | 305 | than 2 Gigabytes, enable this option. Otherwise, leave it set to 'N'. |
306 | 306 | ||
307 | config CONFIG_BUILD_AT_ONCE | 307 | config BUILD_AT_ONCE |
308 | bool "Compile all sources at once" | 308 | bool "Compile all sources at once" |
309 | default n | 309 | default n |
310 | help | 310 | help |
@@ -327,7 +327,7 @@ endmenu | |||
327 | 327 | ||
328 | menu 'Debugging Options' | 328 | menu 'Debugging Options' |
329 | 329 | ||
330 | config CONFIG_DEBUG | 330 | config DEBUG |
331 | bool "Build BusyBox with extra Debugging symbols" | 331 | bool "Build BusyBox with extra Debugging symbols" |
332 | default n | 332 | default n |
333 | help | 333 | help |
@@ -338,10 +338,10 @@ config CONFIG_DEBUG | |||
338 | 338 | ||
339 | Most people should answer N. | 339 | Most people should answer N. |
340 | 340 | ||
341 | config CONFIG_DEBUG_PESSIMIZE | 341 | config DEBUG_PESSIMIZE |
342 | bool "Disable compiler optimizations." | 342 | bool "Disable compiler optimizations." |
343 | default n | 343 | default n |
344 | depends on CONFIG_DEBUG | 344 | depends on DEBUG |
345 | help | 345 | help |
346 | The compiler's optimization of source code can eliminate and reorder | 346 | The compiler's optimization of source code can eliminate and reorder |
347 | code, resulting in an executable that's hard to understand when | 347 | code, resulting in an executable that's hard to understand when |
@@ -351,8 +351,8 @@ config CONFIG_DEBUG_PESSIMIZE | |||
351 | 351 | ||
352 | choice | 352 | choice |
353 | prompt "Additional debugging library" | 353 | prompt "Additional debugging library" |
354 | default CONFIG_NO_DEBUG_LIB | 354 | default NO_DEBUG_LIB |
355 | depends on CONFIG_DEBUG | 355 | depends on DEBUG |
356 | help | 356 | help |
357 | Using an additional debugging library will make BusyBox become | 357 | Using an additional debugging library will make BusyBox become |
358 | considerable larger and will cause it to run more slowly. You | 358 | considerable larger and will cause it to run more slowly. You |
@@ -380,18 +380,18 @@ choice | |||
380 | you are hunting a hard to find memory problem. | 380 | you are hunting a hard to find memory problem. |
381 | 381 | ||
382 | 382 | ||
383 | config CONFIG_NO_DEBUG_LIB | 383 | config NO_DEBUG_LIB |
384 | bool "None" | 384 | bool "None" |
385 | 385 | ||
386 | config CONFIG_DMALLOC | 386 | config DMALLOC |
387 | bool "Dmalloc" | 387 | bool "Dmalloc" |
388 | 388 | ||
389 | config CONFIG_EFENCE | 389 | config EFENCE |
390 | bool "Electric-fence" | 390 | bool "Electric-fence" |
391 | 391 | ||
392 | endchoice | 392 | endchoice |
393 | 393 | ||
394 | config CONFIG_DEBUG_YANK_SUSv2 | 394 | config DEBUG_YANK_SUSv2 |
395 | bool "Disable obsolete features removed before SUSv3?" | 395 | bool "Disable obsolete features removed before SUSv3?" |
396 | default y | 396 | default y |
397 | help | 397 | help |
@@ -404,7 +404,7 @@ endmenu | |||
404 | 404 | ||
405 | menu 'Installation Options' | 405 | menu 'Installation Options' |
406 | 406 | ||
407 | config CONFIG_INSTALL_NO_USR | 407 | config INSTALL_NO_USR |
408 | bool "Don't use /usr" | 408 | bool "Don't use /usr" |
409 | default n | 409 | default n |
410 | help | 410 | help |
@@ -413,27 +413,27 @@ config CONFIG_INSTALL_NO_USR | |||
413 | 413 | ||
414 | choice | 414 | choice |
415 | prompt "Applets links" | 415 | prompt "Applets links" |
416 | default CONFIG_INSTALL_APPLET_SYMLINKS | 416 | default INSTALL_APPLET_SYMLINKS |
417 | help | 417 | help |
418 | Choose how you install applets links. | 418 | Choose how you install applets links. |
419 | 419 | ||
420 | config CONFIG_INSTALL_APPLET_SYMLINKS | 420 | config INSTALL_APPLET_SYMLINKS |
421 | bool "as soft-links" | 421 | bool "as soft-links" |
422 | help | 422 | help |
423 | Install applets as soft-links to the busybox binary. This needs some | 423 | Install applets as soft-links to the busybox binary. This needs some |
424 | free inodes on the filesystem, but might help with filesystem | 424 | free inodes on the filesystem, but might help with filesystem |
425 | generators that can't cope with hard-links. | 425 | generators that can't cope with hard-links. |
426 | 426 | ||
427 | config CONFIG_INSTALL_APPLET_HARDLINKS | 427 | config INSTALL_APPLET_HARDLINKS |
428 | bool "as hard-links" | 428 | bool "as hard-links" |
429 | help | 429 | help |
430 | Install applets as hard-links to the busybox binary. This might count | 430 | Install applets as hard-links to the busybox binary. This might count |
431 | on a filesystem with few inodes. | 431 | on a filesystem with few inodes. |
432 | 432 | ||
433 | config CONFIG_INSTALL_APPLET_DONT | 433 | config INSTALL_APPLET_DONT |
434 | bool | 434 | bool |
435 | prompt "not installed" | 435 | prompt "not installed" |
436 | depends on CONFIG_FEATURE_INSTALLER || CONFIG_FEATURE_SH_STANDALONE_SHELL | 436 | depends on FEATURE_INSTALLER || FEATURE_SH_STANDALONE_SHELL |
437 | help | 437 | help |
438 | Do not install applets links. Usefull when using the -install feature | 438 | Do not install applets links. Usefull when using the -install feature |
439 | or a standalone shell for rescue pruposes. | 439 | or a standalone shell for rescue pruposes. |
@@ -1,521 +1,1281 @@ | |||
1 | # Makefile for busybox | 1 | VERSION = 1 |
2 | PATCHLEVEL = 2 | ||
3 | SUBLEVEL = 1 | ||
4 | EXTRAVERSION = .svn | ||
5 | NAME=Unnamed | ||
6 | |||
7 | # *DOCUMENTATION* | ||
8 | # To see a list of typical targets execute "make help" | ||
9 | # More info can be located in ./README | ||
10 | # Comments in this file are targeted only to the developer, do not | ||
11 | # expect to learn how to build the kernel reading this file. | ||
12 | |||
13 | # Do not print "Entering directory ..." | ||
14 | MAKEFLAGS += --no-print-directory | ||
15 | |||
16 | # We are using a recursive build, so we need to do a little thinking | ||
17 | # to get the ordering right. | ||
2 | # | 18 | # |
3 | # Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org> | 19 | # Most importantly: sub-Makefiles should only ever modify files in |
4 | # | 20 | # their own directory. If in some directory we have a dependency on |
5 | # Licensed under GPLv2, see the file LICENSE in this tarball for details. | 21 | # a file in another dir (which doesn't happen often, but it's often |
22 | # unavoidable when linking the built-in.o targets which finally | ||
23 | # turn into busybox), we will call a sub make in that other dir, and | ||
24 | # after that we are sure that everything which is in that other dir | ||
25 | # is now up to date. | ||
6 | # | 26 | # |
27 | # The only cases where we need to modify files which have global | ||
28 | # effects are thus separated out and done before the recursive | ||
29 | # descending is started. They are now explicitly listed as the | ||
30 | # prepare rule. | ||
7 | 31 | ||
8 | # You shouldn't have to edit anything in this file for configuration | 32 | # To put more focus on warnings, be less verbose as default |
9 | # purposes, try "make help" or read http://busybox.net/FAQ.html. | 33 | # Use 'make V=1' to see the full commands |
10 | 34 | ||
11 | .PHONY: dummy subdirs release distclean clean config oldconfig menuconfig \ | 35 | ifdef V |
12 | tags check test depend dep buildtree hosttools _all checkhelp \ | 36 | ifeq ("$(origin V)", "command line") |
13 | sizes bloatcheck baseline objsizes | 37 | KBUILD_VERBOSE = $(V) |
38 | endif | ||
39 | endif | ||
40 | ifndef KBUILD_VERBOSE | ||
41 | KBUILD_VERBOSE = 0 | ||
42 | endif | ||
14 | 43 | ||
15 | noconfig_targets := menuconfig config oldconfig randconfig hosttools \ | 44 | # Call sparse as part of compilation of C files |
16 | defconfig allyesconfig allnoconfig allbareconfig \ | 45 | # Use 'make C=1' to enable sparse checking |
17 | clean distclean help \ | ||
18 | release tags | ||
19 | 46 | ||
20 | nocheck_targets := clean distclean help release tags | 47 | ifdef C |
48 | ifeq ("$(origin C)", "command line") | ||
49 | KBUILD_CHECKSRC = $(C) | ||
50 | endif | ||
51 | endif | ||
52 | ifndef KBUILD_CHECKSRC | ||
53 | KBUILD_CHECKSRC = 0 | ||
54 | endif | ||
21 | 55 | ||
22 | # the toplevel sourcedir | 56 | # Use make M=dir to specify directory of external module to build |
23 | ifndef top_srcdir | 57 | # Old syntax make ... SUBDIRS=$PWD is still supported |
24 | top_srcdir=$(CURDIR) | 58 | # Setting the environment variable KBUILD_EXTMOD take precedence |
59 | ifdef SUBDIRS | ||
60 | KBUILD_EXTMOD ?= $(SUBDIRS) | ||
25 | endif | 61 | endif |
26 | # toplevel directory of the object-tree | 62 | ifdef M |
27 | ifndef top_builddir | 63 | ifeq ("$(origin M)", "command line") |
28 | top_builddir=$(CURDIR) | 64 | KBUILD_EXTMOD := $(M) |
65 | endif | ||
29 | endif | 66 | endif |
30 | 67 | ||
31 | export srctree=$(top_srcdir) | ||
32 | vpath %/Config.in $(srctree) | ||
33 | 68 | ||
34 | DIRS:=applets archival archival/libunarchive coreutils console-tools \ | 69 | # kbuild supports saving output files in a separate directory. |
35 | debianutils editors findutils init miscutils modutils networking \ | 70 | # To locate output files in a separate directory two syntaxes are supported. |
36 | networking/libiproute networking/udhcp procps loginutils shell \ | 71 | # In both cases the working directory must be the root of the kernel src. |
37 | sysklogd util-linux e2fsprogs libpwdgrp coreutils/libcoreutils \ | 72 | # 1) O= |
38 | runit libbb | 73 | # Use "make O=dir/to/store/output/files/" |
74 | # | ||
75 | # 2) Set KBUILD_OUTPUT | ||
76 | # Set the environment variable KBUILD_OUTPUT to point to the directory | ||
77 | # where the output files shall be placed. | ||
78 | # export KBUILD_OUTPUT=dir/to/store/output/files/ | ||
79 | # make | ||
80 | # | ||
81 | # The O= assignment takes precedence over the KBUILD_OUTPUT environment | ||
82 | # variable. | ||
39 | 83 | ||
40 | SRC_DIRS:=$(patsubst %,$(top_srcdir)/%,$(DIRS)) | ||
41 | 84 | ||
42 | # That's our default target when none is given on the command line | 85 | # KBUILD_SRC is set on invocation of make in OBJ directory |
43 | _all: | 86 | # KBUILD_SRC is not intended to be used by the regular user (for now) |
44 | 87 | ifeq ($(KBUILD_SRC),) | |
45 | CONFIG_CONFIG_IN = $(top_srcdir)/Config.in | ||
46 | 88 | ||
47 | ifeq ($(BUILD_SRC),) | 89 | # OK, Make called in directory where kernel src resides |
90 | # Do we want to locate output files in a separate directory? | ||
48 | ifdef O | 91 | ifdef O |
49 | ifeq ("$(origin O)", "command line") | 92 | ifeq ("$(origin O)", "command line") |
50 | BUILD_OUTPUT := $(O) | 93 | KBUILD_OUTPUT := $(O) |
51 | top_builddir := $(O) | ||
52 | endif | 94 | endif |
95 | endif | ||
96 | |||
97 | # That's our default target when none is given on the command line | ||
98 | PHONY := _all | ||
99 | _all: | ||
100 | |||
101 | ifneq ($(KBUILD_OUTPUT),) | ||
102 | # Invoke a second make in the output directory, passing relevant variables | ||
103 | # check that the output directory actually exists | ||
104 | saved-output := $(KBUILD_OUTPUT) | ||
105 | KBUILD_OUTPUT := $(shell cd $(KBUILD_OUTPUT) && /bin/pwd) | ||
106 | $(if $(KBUILD_OUTPUT),, \ | ||
107 | $(error output directory "$(saved-output)" does not exist)) | ||
108 | |||
109 | PHONY += $(MAKECMDGOALS) | ||
110 | |||
111 | $(filter-out _all,$(MAKECMDGOALS)) _all: | ||
112 | $(if $(KBUILD_VERBOSE:1=),@)$(MAKE) -C $(KBUILD_OUTPUT) \ | ||
113 | KBUILD_SRC=$(CURDIR) \ | ||
114 | KBUILD_EXTMOD="$(KBUILD_EXTMOD)" -f $(CURDIR)/Makefile $@ | ||
115 | |||
116 | # Leave processing to above invocation of make | ||
117 | skip-makefile := 1 | ||
118 | endif # ifneq ($(KBUILD_OUTPUT),) | ||
119 | endif # ifeq ($(KBUILD_SRC),) | ||
120 | |||
121 | # We process the rest of the Makefile if this is the final invocation of make | ||
122 | ifeq ($(skip-makefile),) | ||
123 | |||
124 | # If building an external module we do not care about the all: rule | ||
125 | # but instead _all depend on modules | ||
126 | PHONY += all | ||
127 | ifeq ($(KBUILD_EXTMOD),) | ||
128 | _all: all | ||
53 | else | 129 | else |
54 | # If no alternate output-dir was specified, we build in cwd | 130 | _all: modules |
55 | # We are using BUILD_OUTPUT nevertheless to make sure that we create | ||
56 | # Rules.mak and the toplevel Makefile, in case they don't exist. | ||
57 | BUILD_OUTPUT := $(top_builddir) | ||
58 | endif | 131 | endif |
59 | 132 | ||
60 | # see if we are in verbose mode | 133 | srctree := $(if $(KBUILD_SRC),$(KBUILD_SRC),$(CURDIR)) |
61 | BUILD_VERBOSE := | 134 | TOPDIR := $(srctree) |
62 | ifdef V | 135 | # FIXME - TOPDIR is obsolete, use srctree/objtree |
63 | ifeq ("$(origin V)", "command line") | 136 | objtree := $(CURDIR) |
64 | BUILD_VERBOSE := $(V) | 137 | src := $(srctree) |
65 | endif | 138 | obj := $(objtree) |
139 | |||
140 | VPATH := $(srctree)$(if $(KBUILD_EXTMOD),:$(KBUILD_EXTMOD)) | ||
141 | |||
142 | export srctree objtree VPATH TOPDIR | ||
143 | |||
144 | |||
145 | # SUBARCH tells the usermode build what the underlying arch is. That is set | ||
146 | # first, and if a usermode build is happening, the "ARCH=um" on the command | ||
147 | # line overrides the setting of ARCH below. If a native build is happening, | ||
148 | # then ARCH is assigned, getting whatever value it gets normally, and | ||
149 | # SUBARCH is subsequently ignored. | ||
150 | |||
151 | SUBARCH := $(shell uname -m | sed -e s/i.86/i386/ -e s/sun4u/sparc64/ \ | ||
152 | -e s/arm.*/arm/ -e s/sa110/arm/ \ | ||
153 | -e s/s390x/s390/ -e s/parisc64/parisc/ \ | ||
154 | -e s/ppc.*/powerpc/ -e s/mips.*/mips/ ) | ||
155 | |||
156 | # Cross compiling and selecting different set of gcc/bin-utils | ||
157 | # --------------------------------------------------------------------------- | ||
158 | # | ||
159 | # When performing cross compilation for other architectures ARCH shall be set | ||
160 | # to the target architecture. (See arch/* for the possibilities). | ||
161 | # ARCH can be set during invocation of make: | ||
162 | # make ARCH=ia64 | ||
163 | # Another way is to have ARCH set in the environment. | ||
164 | # The default ARCH is the host where make is executed. | ||
165 | |||
166 | # CROSS_COMPILE specify the prefix used for all executables used | ||
167 | # during compilation. Only gcc and related bin-utils executables | ||
168 | # are prefixed with $(CROSS_COMPILE). | ||
169 | # CROSS_COMPILE can be set on the command line | ||
170 | # make CROSS_COMPILE=ia64-linux- | ||
171 | # Alternatively CROSS_COMPILE can be set in the environment. | ||
172 | # Default value for CROSS_COMPILE is not to prefix executables | ||
173 | # Note: Some architectures assign CROSS_COMPILE in their arch/*/Makefile | ||
174 | |||
175 | ARCH ?= $(SUBARCH) | ||
176 | CROSS_COMPILE ?= | ||
177 | |||
178 | # Architecture as present in compile.h | ||
179 | UTS_MACHINE := $(ARCH) | ||
180 | |||
181 | # SHELL used by kbuild | ||
182 | CONFIG_SHELL := $(shell if [ -x "$$BASH" ]; then echo $$BASH; \ | ||
183 | else if [ -x /bin/bash ]; then echo /bin/bash; \ | ||
184 | else echo sh; fi ; fi) | ||
185 | |||
186 | HOSTCC = gcc | ||
187 | HOSTCXX = g++ | ||
188 | HOSTCFLAGS = -Wall -Wstrict-prototypes -O2 -fomit-frame-pointer | ||
189 | HOSTCXXFLAGS = -O2 | ||
190 | |||
191 | # Decide whether to build built-in, modular, or both. | ||
192 | # Normally, just do built-in. | ||
193 | |||
194 | KBUILD_MODULES := | ||
195 | KBUILD_BUILTIN := 1 | ||
196 | |||
197 | # If we have only "make modules", don't compile built-in objects. | ||
198 | # When we're building modules with modversions, we need to consider | ||
199 | # the built-in objects during the descend as well, in order to | ||
200 | # make sure the checksums are uptodate before we record them. | ||
201 | |||
202 | ifeq ($(MAKECMDGOALS),modules) | ||
203 | KBUILD_BUILTIN := $(if $(CONFIG_MODVERSIONS),1) | ||
66 | endif | 204 | endif |
67 | ifdef VERBOSE | 205 | |
68 | ifeq ("$(origin VERBOSE)", "command line") | 206 | # If we have "make <whatever> modules", compile modules |
69 | BUILD_VERBOSE := $(VERBOSE) | 207 | # in addition to whatever we do anyway. |
70 | endif | 208 | # Just "make" or "make all" shall build modules as well |
209 | |||
210 | ifneq ($(filter all _all modules,$(MAKECMDGOALS)),) | ||
211 | KBUILD_MODULES := 1 | ||
212 | endif | ||
213 | |||
214 | ifeq ($(MAKECMDGOALS),) | ||
215 | KBUILD_MODULES := 1 | ||
71 | endif | 216 | endif |
72 | 217 | ||
73 | ifneq ($(strip $(BUILD_VERBOSE)),) | 218 | export KBUILD_MODULES KBUILD_BUILTIN |
74 | export BUILD_VERBOSE | 219 | export KBUILD_CHECKSRC KBUILD_SRC KBUILD_EXTMOD |
75 | CHECK_VERBOSE := -v | 220 | |
76 | # ARFLAGS+=v | 221 | # Beautify output |
222 | # --------------------------------------------------------------------------- | ||
223 | # | ||
224 | # Normally, we echo the whole command before executing it. By making | ||
225 | # that echo $($(quiet)$(cmd)), we now have the possibility to set | ||
226 | # $(quiet) to choose other forms of output instead, e.g. | ||
227 | # | ||
228 | # quiet_cmd_cc_o_c = Compiling $(RELDIR)/$@ | ||
229 | # cmd_cc_o_c = $(CC) $(c_flags) -c -o $@ $< | ||
230 | # | ||
231 | # If $(quiet) is empty, the whole command will be printed. | ||
232 | # If it is set to "quiet_", only the short version will be printed. | ||
233 | # If it is set to "silent_", nothing wil be printed at all, since | ||
234 | # the variable $(silent_cmd_cc_o_c) doesn't exist. | ||
235 | # | ||
236 | # A simple variant is to prefix commands with $(Q) - that's useful | ||
237 | # for commands that shall be hidden in non-verbose mode. | ||
238 | # | ||
239 | # $(Q)ln $@ :< | ||
240 | # | ||
241 | # If KBUILD_VERBOSE equals 0 then the above command will be hidden. | ||
242 | # If KBUILD_VERBOSE equals 1 then the above command is displayed. | ||
243 | |||
244 | ifeq ($(KBUILD_VERBOSE),1) | ||
245 | quiet = | ||
246 | Q = | ||
247 | else | ||
248 | quiet=quiet_ | ||
249 | Q = @ | ||
77 | endif | 250 | endif |
78 | 251 | ||
79 | ifneq ($(strip $(HAVE_DOT_CONFIG)),y) | 252 | # If the user is running make -s (silent mode), suppress echoing of |
80 | # pull in settings early | 253 | # commands |
81 | -include $(top_srcdir)/Rules.mak | 254 | |
255 | ifneq ($(findstring s,$(MAKEFLAGS)),) | ||
256 | quiet=silent_ | ||
82 | endif | 257 | endif |
83 | 258 | ||
84 | # All object directories. | 259 | export quiet Q KBUILD_VERBOSE |
85 | OBJ_DIRS := $(DIRS) | 260 | |
86 | all_tree := $(patsubst %,$(top_builddir)/%,$(OBJ_DIRS) scripts scripts/config include) | 261 | |
87 | all_tree: $(all_tree) | 262 | # Look for make include files relative to root of kernel src |
88 | $(all_tree): | 263 | MAKEFLAGS += --include-dir=$(srctree) |
89 | @mkdir -p "$@" | 264 | |
265 | # We need some generic definitions | ||
266 | include $(srctree)/scripts/Kbuild.include | ||
267 | |||
268 | # For maximum performance (+ possibly random breakage, uncomment | ||
269 | # the following) | ||
270 | |||
271 | MAKEFLAGS += -rR | ||
272 | |||
273 | # Make variables (CC, etc...) | ||
274 | |||
275 | AS = $(CROSS_COMPILE)as | ||
276 | LD = $(CROSS_COMPILE)ld | ||
277 | CC = $(CROSS_COMPILE)gcc | ||
278 | CPP = $(CC) -E | ||
279 | AR = $(CROSS_COMPILE)ar | ||
280 | NM = $(CROSS_COMPILE)nm | ||
281 | STRIP = $(CROSS_COMPILE)strip | ||
282 | OBJCOPY = $(CROSS_COMPILE)objcopy | ||
283 | OBJDUMP = $(CROSS_COMPILE)objdump | ||
284 | AWK = awk | ||
285 | GENKSYMS = scripts/genksyms/genksyms | ||
286 | DEPMOD = /sbin/depmod | ||
287 | KALLSYMS = scripts/kallsyms | ||
288 | PERL = perl | ||
289 | CHECK = sparse | ||
290 | |||
291 | CHECKFLAGS := -D__linux__ -Dlinux -D__STDC__ -Dunix -D__unix__ -Wbitwise $(CF) | ||
292 | MODFLAGS = -DMODULE | ||
293 | CFLAGS_MODULE = $(MODFLAGS) | ||
294 | AFLAGS_MODULE = $(MODFLAGS) | ||
295 | LDFLAGS_MODULE = -r | ||
296 | CFLAGS_KERNEL = | ||
297 | AFLAGS_KERNEL = | ||
298 | |||
299 | |||
300 | # Use LINUXINCLUDE when you must reference the include/ directory. | ||
301 | # Needed to be compatible with the O= option | ||
302 | CFLAGS := | ||
303 | CPPFLAGS := | ||
304 | AFLAGS := | ||
305 | include $(srctree)/Makefile.flags | ||
306 | |||
307 | # Read KERNELRELEASE from .kernelrelease (if it exists) | ||
308 | KERNELRELEASE = $(shell cat .kernelrelease 2> /dev/null) | ||
309 | KERNELVERSION = $(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION) | ||
310 | |||
311 | export VERSION PATCHLEVEL SUBLEVEL KERNELRELEASE KERNELVERSION \ | ||
312 | ARCH CONFIG_SHELL HOSTCC HOSTCFLAGS CROSS_COMPILE AS LD CC \ | ||
313 | CPP AR NM STRIP OBJCOPY OBJDUMP MAKE AWK GENKSYMS PERL UTS_MACHINE \ | ||
314 | HOSTCXX HOSTCXXFLAGS LDFLAGS_MODULE CHECK CHECKFLAGS | ||
315 | |||
316 | export CPPFLAGS NOSTDINC_FLAGS LINUXINCLUDE OBJCOPYFLAGS LDFLAGS | ||
317 | export CFLAGS CFLAGS_KERNEL CFLAGS_MODULE | ||
318 | export AFLAGS AFLAGS_KERNEL AFLAGS_MODULE | ||
319 | |||
320 | # When compiling out-of-tree modules, put MODVERDIR in the module | ||
321 | # tree rather than in the kernel tree. The kernel tree might | ||
322 | # even be read-only. | ||
323 | export MODVERDIR := $(if $(KBUILD_EXTMOD),$(firstword $(KBUILD_EXTMOD))/).tmp_versions | ||
324 | |||
325 | # Files to ignore in find ... statements | ||
326 | |||
327 | RCS_FIND_IGNORE := \( -name SCCS -o -name BitKeeper -o -name .svn -o -name CVS -o -name .pc -o -name .hg -o -name .git \) -prune -o | ||
328 | export RCS_TAR_IGNORE := --exclude SCCS --exclude BitKeeper --exclude .svn --exclude CVS --exclude .pc --exclude .hg --exclude .git | ||
329 | |||
330 | # =========================================================================== | ||
331 | # Rules shared between *config targets and build targets | ||
332 | |||
333 | # Basic helpers built in scripts/ | ||
334 | PHONY += scripts_basic | ||
335 | scripts_basic: | ||
336 | $(Q)$(MAKE) $(build)=scripts/basic | ||
337 | |||
338 | # To avoid any implicit rule to kick in, define an empty command. | ||
339 | scripts/basic/%: scripts_basic ; | ||
340 | |||
341 | PHONY += outputmakefile | ||
342 | # outputmakefile generates a Makefile in the output directory, if using a | ||
343 | # separate output directory. This allows convenient use of make in the | ||
344 | # output directory. | ||
345 | outputmakefile: | ||
346 | ifneq ($(KBUILD_SRC),) | ||
347 | $(Q)$(CONFIG_SHELL) $(srctree)/scripts/mkmakefile \ | ||
348 | $(srctree) $(objtree) $(VERSION) $(PATCHLEVEL) | ||
349 | endif | ||
90 | 350 | ||
91 | ifneq ($(BUILD_OUTPUT),) | 351 | # To make sure we do not include .config for any of the *config targets |
92 | # Invoke a second make in the output directory, passing relevant variables | 352 | # catch them early, and hand them over to scripts/kconfig/Makefile |
93 | # Check that the output directory actually exists | 353 | # It is allowed to specify more targets when calling make, including |
94 | saved-output := $(BUILD_OUTPUT) | 354 | # mixing *config targets and build targets. |
95 | BUILD_OUTPUT := $(shell cd $(BUILD_OUTPUT) && /bin/pwd) | 355 | # For example 'make oldconfig all'. |
96 | $(if $(wildcard $(BUILD_OUTPUT)),, \ | 356 | # Detect when mixed targets is specified, and make a second invocation |
97 | $(error output directory "$(saved-output)" does not exist)) | 357 | # of make so .config is not included in this case either (for *config). |
358 | |||
359 | no-dot-config-targets := clean mrproper distclean \ | ||
360 | cscope TAGS tags help %docs check% | ||
361 | |||
362 | config-targets := 0 | ||
363 | mixed-targets := 0 | ||
364 | dot-config := 1 | ||
365 | |||
366 | ifneq ($(filter $(no-dot-config-targets), $(MAKECMDGOALS)),) | ||
367 | ifeq ($(filter-out $(no-dot-config-targets), $(MAKECMDGOALS)),) | ||
368 | dot-config := 0 | ||
369 | endif | ||
370 | endif | ||
98 | 371 | ||
99 | .PHONY: $(MAKECMDGOALS) | 372 | ifeq ($(KBUILD_EXTMOD),) |
373 | ifneq ($(filter config %config,$(MAKECMDGOALS)),) | ||
374 | config-targets := 1 | ||
375 | ifneq ($(filter-out config %config,$(MAKECMDGOALS)),) | ||
376 | mixed-targets := 1 | ||
377 | endif | ||
378 | endif | ||
379 | endif | ||
100 | 380 | ||
101 | $(filter-out _all,$(MAKECMDGOALS)) _all: $(BUILD_OUTPUT)/Rules.mak $(BUILD_OUTPUT)/Makefile all_tree | 381 | ifeq ($(mixed-targets),1) |
102 | $(Q)$(MAKE) -C $(BUILD_OUTPUT) \ | 382 | # =========================================================================== |
103 | top_srcdir=$(top_srcdir) \ | 383 | # We're called with mixed targets (*config and build targets). |
104 | top_builddir=$(top_builddir) \ | 384 | # Handle them one by one. |
105 | BUILD_SRC=$(top_srcdir) \ | ||
106 | -f $(CURDIR)/Makefile $@ | ||
107 | 385 | ||
108 | $(BUILD_OUTPUT)/Rules.mak: | 386 | %:: FORCE |
109 | @echo > $@ | 387 | $(Q)$(MAKE) -C $(srctree) KBUILD_SRC= $@ |
110 | @echo top_srcdir=$(top_srcdir) >> $@ | ||
111 | @echo top_builddir=$(BUILD_OUTPUT) >> $@ | ||
112 | @echo include $(top_srcdir)/Rules.mak >> $@ | ||
113 | 388 | ||
114 | $(BUILD_OUTPUT)/Makefile: | 389 | else |
115 | @echo > $@ | 390 | ifeq ($(config-targets),1) |
116 | @echo top_srcdir=$(top_srcdir) >> $@ | 391 | # =========================================================================== |
117 | @echo top_builddir=$(BUILD_OUTPUT) >> $@ | 392 | # *config targets only - make sure prerequisites are updated, and descend |
118 | @echo BUILD_SRC='$$(top_srcdir)' >> $@ | 393 | # in scripts/kconfig to make the *config target |
119 | @echo include '$$(BUILD_SRC)'/Makefile >> $@ | 394 | |
395 | # Read arch specific Makefile to set KBUILD_DEFCONFIG as needed. | ||
396 | # KBUILD_DEFCONFIG may point out an alternative default configuration | ||
397 | # used for 'make defconfig' | ||
398 | -include $(srctree)/arch/$(ARCH)/Makefile | ||
399 | export KBUILD_DEFCONFIG | ||
400 | |||
401 | config %config: scripts_basic outputmakefile FORCE | ||
402 | $(Q)mkdir -p include/linux | ||
403 | $(Q)$(MAKE) $(build)=scripts/kconfig $@ | ||
404 | $(Q)$(MAKE) -C $(srctree) KBUILD_SRC= .kernelrelease | ||
120 | 405 | ||
121 | # Leave processing to above invocation of make | 406 | else |
122 | skip-makefile := 1 | 407 | # =========================================================================== |
123 | endif # ifneq ($(BUILD_OUTPUT),) | 408 | # Build targets only - this includes busybox, arch specific targets, clean |
124 | endif # ifeq ($(BUILD_SRC),) | 409 | # targets and others. In general all targets except *config targets. |
410 | |||
411 | ifeq ($(KBUILD_EXTMOD),) | ||
412 | # Additional helpers built in scripts/ | ||
413 | # Carefully list dependencies so we do not try to build scripts twice | ||
414 | # in parrallel | ||
415 | PHONY += scripts | ||
416 | scripts: scripts_basic include/config/MARKER | ||
417 | $(Q)$(MAKE) $(build)=$(@) | ||
418 | |||
419 | scripts_basic: include/autoconf.h | ||
420 | |||
421 | # Objects we will link into busybox / subdirs we need to visit | ||
422 | core-y := \ | ||
423 | applets/ \ | ||
424 | |||
425 | libs-y := \ | ||
426 | archival/ \ | ||
427 | archival/libunarchive/ \ | ||
428 | console-tools/ \ | ||
429 | coreutils/ \ | ||
430 | coreutils/libcoreutils/ \ | ||
431 | debianutils/ \ | ||
432 | e2fsprogs/ \ | ||
433 | e2fsprogs/blkid/ \ | ||
434 | e2fsprogs/e2p/ \ | ||
435 | e2fsprogs/ext2fs/ \ | ||
436 | e2fsprogs/uuid/ \ | ||
437 | editors/ \ | ||
438 | findutils/ \ | ||
439 | init/ \ | ||
440 | libbb/ \ | ||
441 | libpwdgrp/ \ | ||
442 | loginutils/ \ | ||
443 | miscutils/ \ | ||
444 | modutils/ \ | ||
445 | networking/ \ | ||
446 | networking/libiproute/ \ | ||
447 | networking/udhcp/ \ | ||
448 | procps/ \ | ||
449 | runit/ \ | ||
450 | shell/ \ | ||
451 | sysklogd/ \ | ||
452 | util-linux/ \ | ||
453 | |||
454 | endif # KBUILD_EXTMOD | ||
455 | |||
456 | ifeq ($(dot-config),1) | ||
457 | # In this section, we need .config | ||
125 | 458 | ||
126 | ifeq ($(skip-makefile),) | 459 | # Read in dependencies to all Kconfig* files, make sure to run |
460 | # oldconfig if changes are detected. | ||
461 | -include .kconfig.d | ||
127 | 462 | ||
128 | # We only need a copy of the Makefile for the config targets and reuse | 463 | include .config |
129 | # the rest from the source directory, i.e. we do not cp ALL_MAKEFILES. | ||
130 | scripts/config/Makefile: $(top_srcdir)/scripts/config/Makefile | ||
131 | cp $< $@ | ||
132 | 464 | ||
133 | _all: all | 465 | # If .config needs to be updated, it will be done via the dependency |
466 | # that autoconf has on .config. | ||
467 | # To avoid any implicit rule to kick in, define an empty command | ||
468 | .config .kconfig.d: ; | ||
134 | 469 | ||
135 | help: | 470 | # If .config is newer than include/autoconf.h, someone tinkered |
136 | @echo 'Cleaning:' | 471 | # with it and forgot to run make oldconfig. |
137 | @echo ' clean - delete temporary files created by build' | 472 | # If kconfig.d is missing then we are probarly in a cleaned tree so |
138 | @echo ' distclean - delete all non-source files (including .config)' | 473 | # we execute the config step to be sure to catch updated Kconfig files |
139 | @echo | 474 | include/autoconf.h: .kconfig.d .config |
140 | @echo 'Build:' | 475 | $(Q)mkdir -p include/linux |
141 | @echo ' all - Executable and documentation' | 476 | $(Q)$(MAKE) -f $(srctree)/Makefile silentoldconfig |
142 | @echo ' busybox - the swiss-army executable' | ||
143 | @echo ' doc - docs/BusyBox.{txt,html,1}' | ||
144 | @echo ' html - create html-based cross-reference' | ||
145 | @echo | ||
146 | @echo 'Configuration:' | ||
147 | @echo ' allnoconfig - disable all symbols in .config' | ||
148 | @echo ' allyesconfig - enable all symbols in .config (see defconfig)' | ||
149 | @echo ' allbareconfig - enable all applets without any sub-features' | ||
150 | @echo ' config - text based configurator (of last resort)' | ||
151 | @echo ' defconfig - set .config to largest generic configuration' | ||
152 | @echo ' menuconfig - interactive curses-based configurator' | ||
153 | @echo ' oldconfig - resolve any unresolved symbols in .config' | ||
154 | @echo ' hosttools - build sed for the host.' | ||
155 | @echo ' You can use these commands if the commands on the host' | ||
156 | @echo ' is unusable. Afterwards use it like:' | ||
157 | @echo ' make SED="$(top_builddir)/sed"' | ||
158 | @echo | ||
159 | @echo 'Installation:' | ||
160 | @echo ' install - install busybox into $(PREFIX)' | ||
161 | @echo ' uninstall' | ||
162 | @echo | ||
163 | @echo 'Development:' | ||
164 | @echo ' baseline - create busybox_old for bloatcheck.' | ||
165 | @echo ' bloatcheck - show size difference between old and new versions' | ||
166 | @echo ' check - run the test suite for all applets' | ||
167 | @echo ' checkhelp - check for missing help-entries in Config.in' | ||
168 | @echo ' randconfig - generate a random configuration' | ||
169 | @echo ' release - create a distribution tarball' | ||
170 | @echo ' sizes - show size of all enabled busybox symbols' | ||
171 | @echo ' objsizes - show size of each .o object built' | ||
172 | @echo | ||
173 | 477 | ||
478 | else | ||
479 | # Dummy target needed, because used as prerequisite | ||
480 | include/autoconf.h: ; | ||
481 | endif | ||
174 | 482 | ||
175 | include $(top_srcdir)/Rules.mak | 483 | # The all: target is the default when no target is given on the |
484 | # command line. | ||
485 | # This allow a user to issue only 'make' to build a kernel including modules | ||
486 | # Defaults busybox but it is usually overriden in the arch makefile | ||
487 | all: busybox | ||
176 | 488 | ||
177 | ifneq ($(strip $(HAVE_DOT_CONFIG)),y) | 489 | -include $(srctree)/arch/$(ARCH)/Makefile |
178 | 490 | ||
179 | # Default target if none was requested explicitly | 491 | # arch Makefile may override CC so keep this after arch Makefile is included |
180 | all: menuconfig | 492 | #bbox# NOSTDINC_FLAGS += -nostdinc -isystem $(shell $(CC) -print-file-name=include) |
493 | CHECKFLAGS += $(NOSTDINC_FLAGS) | ||
181 | 494 | ||
182 | # warn if no configuration exists and we are asked to build a non-config target | 495 | # warn about C99 declaration after statement |
183 | .config: | 496 | CFLAGS += $(call cc-option,-Wdeclaration-after-statement,) |
184 | @echo "" | 497 | |
185 | @echo "No $(top_builddir)/$@ found!" | 498 | # disable pointer signedness warnings in gcc 4.0 |
186 | @echo "Please refer to 'make help', section Configuration." | 499 | CFLAGS += $(call cc-option,-Wno-pointer-sign,) |
187 | @echo "" | 500 | |
188 | @exit 1 | 501 | # Default kernel image to build when no specific target is given. |
502 | # KBUILD_IMAGE may be overruled on the commandline or | ||
503 | # set in the environment | ||
504 | # Also any assignments in arch/$(ARCH)/Makefile take precedence over | ||
505 | # this default value | ||
506 | export KBUILD_IMAGE ?= busybox | ||
507 | |||
508 | # | ||
509 | # INSTALL_PATH specifies where to place the updated kernel and system map | ||
510 | # images. Default is /boot, but you can set it to other values | ||
511 | export INSTALL_PATH ?= /boot | ||
512 | |||
513 | # | ||
514 | # INSTALL_MOD_PATH specifies a prefix to MODLIB for module directory | ||
515 | # relocations required by build roots. This is not defined in the | ||
516 | # makefile but the arguement can be passed to make if needed. | ||
517 | # | ||
518 | |||
519 | MODLIB = $(INSTALL_MOD_PATH)/lib/modules/$(KERNELRELEASE) | ||
520 | export MODLIB | ||
521 | |||
522 | |||
523 | ifeq ($(KBUILD_EXTMOD),) | ||
524 | busybox-dirs := $(patsubst %/,%,$(filter %/, $(core-y) $(core-m) $(libs-y) $(libs-m))) | ||
525 | |||
526 | busybox-alldirs := $(sort $(busybox-dirs) $(patsubst %/,%,$(filter %/, \ | ||
527 | $(core-n) $(core-) $(libs-n) $(libs-) \ | ||
528 | ))) | ||
529 | |||
530 | core-y := $(patsubst %/, %/built-in.o, $(core-y)) | ||
531 | libs-y1 := $(patsubst %/, %/lib.a, $(libs-y)) | ||
532 | libs-y2 := $(patsubst %/, %/built-in.o, $(libs-y)) | ||
533 | libs-y := $(libs-y1) $(libs-y2) | ||
189 | 534 | ||
190 | # configuration | 535 | |
536 | # Build busybox | ||
191 | # --------------------------------------------------------------------------- | 537 | # --------------------------------------------------------------------------- |
538 | # busybox is build from the objects selected by $(busybox-init) and | ||
539 | # $(busybox-main). Most are built-in.o files from top-level directories | ||
540 | # in the kernel tree, others are specified in arch/$(ARCH)Makefile. | ||
541 | # Ordering when linking is important, and $(busybox-init) must be first. | ||
542 | # | ||
543 | # busybox | ||
544 | # ^ | ||
545 | # | | ||
546 | # +-< $(busybox-init) | ||
547 | # | +--< init/version.o + more | ||
548 | # | | ||
549 | # +--< $(busybox-main) | ||
550 | # | +--< driver/built-in.o mm/built-in.o + more | ||
551 | # | | ||
552 | # +-< kallsyms.o (see description in CONFIG_KALLSYMS section) | ||
553 | # | ||
554 | # busybox version (uname -v) cannot be updated during normal | ||
555 | # descending-into-subdirs phase since we do not yet know if we need to | ||
556 | # update busybox. | ||
557 | # Therefore this step is delayed until just before final link of busybox - | ||
558 | # except in the kallsyms case where it is done just before adding the | ||
559 | # symbols to the kernel. | ||
560 | # | ||
561 | # System.map is generated to document addresses of all kernel symbols | ||
562 | |||
563 | busybox-all := $(core-y) $(libs-y) | ||
564 | |||
565 | # Rule to link busybox - also used during CONFIG_KALLSYMS | ||
566 | # May be overridden by arch/$(ARCH)/Makefile | ||
567 | quiet_cmd_busybox__ ?= LINK $@ | ||
568 | cmd_busybox__ ?= scripts/trylink $(CC) -o $@ \ | ||
569 | -Wl,--warn-common -Wl,--sort-common -Wl,--gc-sections \ | ||
570 | -Wl,--start-group $(busybox-all) -Wl,--end-group \ | ||
571 | |||
572 | # Generate System.map | ||
573 | quiet_cmd_sysmap = SYSMAP | ||
574 | cmd_sysmap = $(CONFIG_SHELL) $(srctree)/scripts/mksysmap | ||
575 | |||
576 | # Link of busybox | ||
577 | # If CONFIG_KALLSYMS is set .version is already updated | ||
578 | # Generate System.map and verify that the content is consistent | ||
579 | # Use + in front of the busybox_version rule to silent warning with make -j2 | ||
580 | # First command is ':' to allow us to use + in front of the rule | ||
581 | define rule_busybox__ | ||
582 | : | ||
583 | $(call cmd,busybox__) | ||
584 | $(Q)echo 'cmd_$@ := $(cmd_busybox__)' > $(@D)/.$(@F).cmd | ||
585 | endef | ||
586 | |||
587 | |||
588 | ifdef CONFIG_KALLSYMS | ||
589 | # Generate section listing all symbols and add it into busybox $(kallsyms.o) | ||
590 | # It's a three stage process: | ||
591 | # o .tmp_busybox1 has all symbols and sections, but __kallsyms is | ||
592 | # empty | ||
593 | # Running kallsyms on that gives us .tmp_kallsyms1.o with | ||
594 | # the right size - busybox version (uname -v) is updated during this step | ||
595 | # o .tmp_busybox2 now has a __kallsyms section of the right size, | ||
596 | # but due to the added section, some addresses have shifted. | ||
597 | # From here, we generate a correct .tmp_kallsyms2.o | ||
598 | # o The correct .tmp_kallsyms2.o is linked into the final busybox. | ||
599 | # o Verify that the System.map from busybox matches the map from | ||
600 | # .tmp_busybox2, just in case we did not generate kallsyms correctly. | ||
601 | # o If CONFIG_KALLSYMS_EXTRA_PASS is set, do an extra pass using | ||
602 | # .tmp_busybox3 and .tmp_kallsyms3.o. This is only meant as a | ||
603 | # temporary bypass to allow the kernel to be built while the | ||
604 | # maintainers work out what went wrong with kallsyms. | ||
605 | |||
606 | ifdef CONFIG_KALLSYMS_EXTRA_PASS | ||
607 | last_kallsyms := 3 | ||
608 | else | ||
609 | last_kallsyms := 2 | ||
610 | endif | ||
192 | 611 | ||
193 | scripts/config/conf: scripts/config/Makefile | 612 | kallsyms.o := .tmp_kallsyms$(last_kallsyms).o |
194 | $(Q)$(MAKE) -C scripts/config conf | ||
195 | -@if [ ! -f .config ] ; then \ | ||
196 | touch .config; \ | ||
197 | fi | ||
198 | 613 | ||
199 | scripts/config/mconf: scripts/config/Makefile | 614 | define verify_kallsyms |
200 | $(Q)$(MAKE) -C scripts/config ncurses conf mconf | 615 | $(Q)$(if $($(quiet)cmd_sysmap), \ |
201 | -@if [ ! -f .config ] ; then \ | 616 | echo ' $($(quiet)cmd_sysmap) .tmp_System.map' &&) \ |
202 | touch .config; \ | 617 | $(cmd_sysmap) .tmp_busybox$(last_kallsyms) .tmp_System.map |
203 | fi | 618 | $(Q)cmp -s System.map .tmp_System.map || \ |
619 | (echo Inconsistent kallsyms data; \ | ||
620 | echo Try setting CONFIG_KALLSYMS_EXTRA_PASS; \ | ||
621 | rm .tmp_kallsyms* ; /bin/false ) | ||
622 | endef | ||
204 | 623 | ||
205 | menuconfig: scripts/config/mconf | 624 | # Update busybox version before link |
206 | @[ -f .config ] || $(MAKE) $(MAKEFLAGS) defconfig | 625 | # Use + in front of this rule to silent warning about make -j1 |
207 | @./scripts/config/mconf $(CONFIG_CONFIG_IN) | 626 | # First command is ':' to allow us to use + in front of this rule |
627 | cmd_ksym_ld = $(cmd_busybox__) | ||
628 | define rule_ksym_ld | ||
629 | : | ||
630 | +$(call cmd,busybox_version) | ||
631 | $(call cmd,busybox__) | ||
632 | $(Q)echo 'cmd_$@ := $(cmd_busybox__)' > $(@D)/.$(@F).cmd | ||
633 | endef | ||
208 | 634 | ||
209 | config: scripts/config/conf | 635 | # Generate .S file with all kernel symbols |
210 | @./scripts/config/conf $(CONFIG_CONFIG_IN) | 636 | quiet_cmd_kallsyms = KSYM $@ |
637 | cmd_kallsyms = $(NM) -n $< | $(KALLSYMS) \ | ||
638 | $(if $(CONFIG_KALLSYMS_ALL),--all-symbols) > $@ | ||
211 | 639 | ||
212 | oldconfig: scripts/config/conf | 640 | .tmp_kallsyms1.o .tmp_kallsyms2.o .tmp_kallsyms3.o: %.o: %.S scripts FORCE |
213 | @./scripts/config/conf -o $(CONFIG_CONFIG_IN) | 641 | $(call if_changed_dep,as_o_S) |
214 | 642 | ||
215 | randconfig: scripts/config/conf | 643 | .tmp_kallsyms%.S: .tmp_busybox% $(KALLSYMS) |
216 | @./scripts/config/conf -r $(CONFIG_CONFIG_IN) | 644 | $(call cmd,kallsyms) |
217 | 645 | ||
218 | allyesconfig: scripts/config/conf | 646 | # .tmp_busybox1 must be complete except kallsyms, so update busybox version |
219 | @./scripts/config/conf -y $(CONFIG_CONFIG_IN) > /dev/null | 647 | .tmp_busybox1: $(busybox-lds) $(busybox-all) FORCE |
648 | $(call if_changed_rule,ksym_ld) | ||
220 | 649 | ||
221 | allnoconfig: scripts/config/conf | 650 | .tmp_busybox2: $(busybox-lds) $(busybox-all) .tmp_kallsyms1.o FORCE |
222 | @./scripts/config/conf -n $(CONFIG_CONFIG_IN) > /dev/null | 651 | $(call if_changed,busybox__) |
223 | 652 | ||
224 | # defconfig is allyesconfig minus any features that are specialized enough | 653 | .tmp_busybox3: $(busybox-lds) $(busybox-all) .tmp_kallsyms2.o FORCE |
225 | # or cause enough behavior change that the user really should switch them on | 654 | $(call if_changed,busybox__) |
226 | # manually if that's what they want. Sort of "maximum sane config". | ||
227 | 655 | ||
228 | defconfig: scripts/config/conf | 656 | # Needs to visit scripts/ before $(KALLSYMS) can be used. |
229 | @./scripts/config/conf -y $(CONFIG_CONFIG_IN) > /dev/null | 657 | $(KALLSYMS): scripts ; |
230 | @$(SED) -i -r -e "s/^(CONFIG_(DEBUG.*|STATIC|SELINUX|NITPICK|BUILD_(AT_ONCE|LIBBUSYBOX)|FEATURE_(DEVFS|FULL_LIBBUSYBOX|SHARED_BUSYBOX|MTAB_SUPPORT|CLEAN_UP|UDHCP_DEBUG)|INSTALL_NO_USR))=.*/# \1 is not set/" .config | ||
231 | @./scripts/config/conf -o $(CONFIG_CONFIG_IN) > /dev/null | ||
232 | 658 | ||
659 | # Generate some data for debugging strange kallsyms problems | ||
660 | debug_kallsyms: .tmp_map$(last_kallsyms) | ||
233 | 661 | ||
234 | allbareconfig: scripts/config/conf | 662 | .tmp_map%: .tmp_busybox% FORCE |
235 | @./scripts/config/conf -y $(CONFIG_CONFIG_IN) > /dev/null | 663 | ($(OBJDUMP) -h $< | $(AWK) '/^ +[0-9]/{print $$4 " 0 " $$2}'; $(NM) $<) | sort > $@ |
236 | @$(SED) -i -r -e "s/^(CONFIG_(DEBUG|STATIC|SELINUX|DEVFSD|NC_GAPING_SECURITY_HOLE|BUILD_AT_ONCE)).*/# \1 is not set/" .config | ||
237 | @$(SED) -i -e "/FEATURE/s/=.*//;/^[^#]/s/.*FEATURE.*/# \0 is not set/;" .config | ||
238 | @echo "CONFIG_FEATURE_BUFFERS_GO_ON_STACK=y" >> .config | ||
239 | @yes n | ./scripts/config/conf -o $(CONFIG_CONFIG_IN) > /dev/null | ||
240 | 664 | ||
241 | hosttools: | 665 | .tmp_map3: .tmp_map2 |
242 | $(Q)cp .config .config.bak || noold=yea | ||
243 | $(Q)$(MAKE) CC="$(HOSTCC)" CFLAGS="$(HOSTCFLAGS) $(INCS)" allnoconfig | ||
244 | $(Q)mv .config .config.in | ||
245 | $(Q)(grep -v CONFIG_SED .config.in ; \ | ||
246 | echo "CONFIG_SED=y" ; ) > .config | ||
247 | $(Q)$(MAKE) CC="$(HOSTCC)" CFLAGS="$(HOSTCFLAGS) $(INCS)" oldconfig include/bb_config.h | ||
248 | $(Q)$(MAKE) CC="$(HOSTCC)" CFLAGS="$(HOSTCFLAGS) $(INCS)" busybox | ||
249 | $(Q)[ -f .config.bak ] && mv .config.bak .config || rm .config | ||
250 | mv busybox sed | ||
251 | @echo "Now do: $(MAKE) SED=$(top_builddir)/sed <target>" | ||
252 | 666 | ||
253 | else # ifneq ($(strip $(HAVE_DOT_CONFIG)),y) | 667 | .tmp_map2: .tmp_map1 |
254 | 668 | ||
255 | all: busybox busybox.links doc | 669 | endif # ifdef CONFIG_KALLSYMS |
256 | 670 | ||
257 | # In this section, we need .config | 671 | # busybox image - including updated kernel symbols |
258 | -include $(top_builddir)/.config.cmd | 672 | busybox_unstripped: $(busybox-all) FORCE |
259 | include $(patsubst %,%/Makefile.in, $(SRC_DIRS)) | 673 | $(call if_changed_rule,busybox__) |
260 | 674 | $(Q)rm -f .old_version | |
261 | endif # ifneq ($(strip $(HAVE_DOT_CONFIG)),y) | 675 | |
262 | 676 | busybox: busybox_unstripped | |
263 | -include $(top_builddir)/.config | 677 | $(Q)strip -s --remove-section=.note --remove-section=.comment \ |
264 | -include $(top_builddir)/.depend | 678 | busybox_unstripped -o $@ |
265 | 679 | ||
266 | 680 | # The actual objects are generated when descending, | |
267 | ifeq ($(strip $(CONFIG_BUILD_AT_ONCE)),y) | 681 | # make sure no implicit rule kicks in |
268 | libraries-y:= | 682 | $(sort $(busybox-all)): $(busybox-dirs) ; |
269 | # Which parts of the internal libs are requested? | 683 | |
270 | # Per default we only want what was actually selected. | 684 | # Handle descending into subdirectories listed in $(busybox-dirs) |
271 | # -a denotes all while -y denotes the selected ones. | 685 | # Preset locale variables to speed up the build process. Limit locale |
272 | ifeq ($(strip $(CONFIG_FEATURE_FULL_LIBBUSYBOX)),y) | 686 | # tweaks to this spot to avoid wrong language settings when running |
273 | LIBRARY_DEFINE:=$(LIBRARY_DEFINE-a) | 687 | # make menuconfig etc. |
274 | LIBRARY_SRC :=$(LIBRARY_SRC-a) | 688 | # Error messages still appears in the original language |
275 | else # CONFIG_FEATURE_FULL_LIBBUSYBOX | 689 | |
276 | LIBRARY_DEFINE:=$(LIBRARY_DEFINE-y) | 690 | PHONY += $(busybox-dirs) |
277 | LIBRARY_SRC :=$(LIBRARY_SRC-y) | 691 | $(busybox-dirs): prepare scripts |
278 | endif # CONFIG_FEATURE_FULL_LIBBUSYBOX | 692 | $(Q)$(MAKE) $(build)=$@ |
279 | APPLET_SRC:=$(APPLET_SRC-y) | 693 | |
280 | APPLETS_DEFINE:=$(APPLETS_DEFINE-y) | 694 | # Build the kernel release string |
281 | else # CONFIG_BUILD_AT_ONCE | 695 | # The KERNELRELEASE is stored in a file named .kernelrelease |
282 | APPLET_SRC:= | 696 | # to be used when executing for example make install or make modules_install |
283 | # no --combine, build archives out of the individual .o | 697 | # |
284 | # This was the old way the binary was built. | 698 | # Take the contents of any files called localversion* and the config |
285 | libbusybox-obj:=archival/libunarchive/libunarchive.a \ | 699 | # variable CONFIG_LOCALVERSION and append them to KERNELRELEASE. |
286 | networking/libiproute/libiproute.a \ | 700 | # LOCALVERSION from the command line override all of this |
287 | libpwdgrp/libpwdgrp.a \ | 701 | |
288 | coreutils/libcoreutils/libcoreutils.a \ | 702 | nullstring := |
289 | libbb/libbb.a | 703 | space := $(nullstring) # end of line |
290 | libbusybox-obj:=$(patsubst %,$(top_builddir)/%,$(libbusybox-obj)) | 704 | |
291 | 705 | ___localver = $(objtree)/localversion* $(srctree)/localversion* | |
292 | ifeq ($(strip $(CONFIG_FEATURE_SHARED_BUSYBOX)),y) | 706 | __localver = $(sort $(wildcard $(___localver))) |
293 | # linking against libbusybox, so don't build the .a already contained in the .so | 707 | # skip backup files (containing '~') |
294 | libraries-y:=$(filter-out $(libbusybox-obj),$(libraries-y)) | 708 | _localver = $(foreach f, $(__localver), $(if $(findstring ~, $(f)),,$(f))) |
295 | endif # CONFIG_FEATURE_SHARED_BUSYBOX | 709 | |
296 | endif # CONFIG_BUILD_AT_ONCE | 710 | localver = $(subst $(space),, \ |
297 | 711 | $(shell cat /dev/null $(_localver)) \ | |
298 | 712 | $(patsubst "%",%,$(CONFIG_LOCALVERSION))) | |
299 | ifeq ($(strip $(CONFIG_BUILD_LIBBUSYBOX)),y) | 713 | |
300 | LD_LIBBUSYBOX:=libbusybox.so | 714 | # If CONFIG_LOCALVERSION_AUTO is set scripts/setlocalversion is called |
301 | LIBBUSYBOX_SONAME:=$(LD_LIBBUSYBOX).$(MAJOR_VERSION).$(MINOR_VERSION).$(SUBLEVEL_VERSION) | 715 | # and if the SCM is know a tag from the SCM is appended. |
302 | DO_INSTALL_LIBS:=$(LD_LIBBUSYBOX) \ | 716 | # The appended tag is determinded by the SCM used. |
303 | $(LD_LIBBUSYBOX).$(MAJOR_VERSION) \ | 717 | # |
304 | $(LD_LIBBUSYBOX).$(MAJOR_VERSION).$(MINOR_VERSION) | 718 | # Currently, only git is supported. |
305 | endif # CONFIG_BUILD_LIBBUSYBOX | 719 | # Other SCMs can edit scripts/setlocalversion and add the appropriate |
306 | 720 | # checks as needed. | |
307 | ifeq ($(strip $(CONFIG_BUILD_AT_ONCE)),y) | 721 | ifdef CONFIG_LOCALVERSION_AUTO |
308 | ifneq ($(strip $(CONFIG_FEATURE_SHARED_BUSYBOX)),y) | 722 | _localver-auto = $(shell $(CONFIG_SHELL) \ |
309 | # --combine but not linking against libbusybox, so compile all | 723 | $(srctree)/scripts/setlocalversion $(srctree)) |
310 | BUSYBOX_SRC := $(LIBRARY_SRC) | 724 | localver-auto = $(LOCALVERSION)$(_localver-auto) |
311 | BUSYBOX_DEFINE:= $(LIBRARY_DEFINE) | ||
312 | endif # !CONFIG_FEATURE_SHARED_BUSYBOX | ||
313 | $(LIBBUSYBOX_SONAME): $(LIBRARY_SRC) | ||
314 | else # CONFIG_BUILD_AT_ONCE | ||
315 | $(LIBBUSYBOX_SONAME): $(libbusybox-obj) | ||
316 | endif # CONFIG_BUILD_AT_ONCE | ||
317 | |||
318 | ifeq ($(strip $(CONFIG_FEATURE_SHARED_BUSYBOX)),y) | ||
319 | LDBUSYBOX:=-L$(top_builddir) -lbusybox | ||
320 | endif | 725 | endif |
321 | 726 | ||
322 | ifeq ($(strip $(CONFIG_BUILD_LIBBUSYBOX)),y) | 727 | localver-full = $(localver)$(localver-auto) |
323 | $(LIBBUSYBOX_SONAME): | 728 | |
324 | ifndef MAJOR_VERSION | 729 | # Store (new) KERNELRELASE string in .kernelrelease |
325 | $(error MAJOR_VERSION needed for $@ is not defined) | 730 | kernelrelease = $(KERNELVERSION)$(localver-full) |
731 | .kernelrelease: FORCE | ||
732 | $(Q)rm -f $@ | ||
733 | $(Q)echo $(kernelrelease) > $@ | ||
734 | |||
735 | |||
736 | # Things we need to do before we recursively start building the kernel | ||
737 | # or the modules are listed in "prepare". | ||
738 | # A multi level approach is used. prepareN is processed before prepareN-1. | ||
739 | # archprepare is used in arch Makefiles and when processed asm symlink, | ||
740 | # version.h and scripts_basic is processed / created. | ||
741 | |||
742 | # Listed in dependency order | ||
743 | PHONY += prepare archprepare prepare0 prepare1 prepare2 prepare3 | ||
744 | |||
745 | # prepare-all is deprecated, use prepare as valid replacement | ||
746 | PHONY += prepare-all | ||
747 | |||
748 | # prepare3 is used to check if we are building in a separate output directory, | ||
749 | # and if so do: | ||
750 | # 1) Check that make has not been executed in the kernel src $(srctree) | ||
751 | # 2) Create the include2 directory, used for the second asm symlink | ||
752 | prepare3: .kernelrelease | ||
753 | ifneq ($(KBUILD_SRC),) | ||
754 | @echo ' Using $(srctree) as source for kernel' | ||
755 | $(Q)if [ -f $(srctree)/.config ]; then \ | ||
756 | echo " $(srctree) is not clean, please run 'make mrproper'";\ | ||
757 | echo " in the '$(srctree)' directory.";\ | ||
758 | /bin/false; \ | ||
759 | fi; | ||
760 | $(Q)if [ ! -d include2 ]; then mkdir -p include2; fi; | ||
761 | $(Q)ln -fsn $(srctree)/include/asm-$(ARCH) include2/asm | ||
326 | endif | 762 | endif |
327 | $(do_link.so) \ | ||
328 | -Wl,-soname=$(LD_LIBBUSYBOX).$(MAJOR_VERSION) \ | ||
329 | -Wl,-z,combreloc | ||
330 | @rm -f $(DO_INSTALL_LIBS) | ||
331 | @for i in $(DO_INSTALL_LIBS); do ln -s $(@) $$i ; done | ||
332 | $(do_strip) | ||
333 | 763 | ||
334 | endif # ifeq ($(strip $(CONFIG_BUILD_LIBBUSYBOX)),y) | 764 | # prepare2 creates a makefile if using a separate output directory |
765 | prepare2: prepare3 outputmakefile | ||
766 | |||
767 | prepare1: prepare2 include/config/MARKER | ||
768 | ifneq ($(KBUILD_MODULES),) | ||
769 | $(Q)mkdir -p $(MODVERDIR) | ||
770 | $(Q)rm -f $(MODVERDIR)/* | ||
771 | endif | ||
335 | 772 | ||
336 | busybox_unstripped: .depend $(LIBBUSYBOX_SONAME) $(BUSYBOX_SRC) $(APPLET_SRC) $(libraries-y) | 773 | archprepare: prepare1 scripts_basic |
337 | $(do_link) | ||
338 | 774 | ||
339 | busybox: busybox_unstripped | 775 | prepare0: archprepare FORCE |
340 | $(Q)cp busybox_unstripped busybox | 776 | $(Q)$(MAKE) $(build)=. |
341 | $(do_strip) | ||
342 | 777 | ||
343 | %.bflt: %_unstripped | 778 | # All the preparing.. |
344 | $(do_elf2flt) | 779 | prepare prepare-all: prepare0 |
345 | 780 | ||
346 | busybox.links: $(top_srcdir)/applets/busybox.mkll include/bb_config.h $(top_srcdir)/include/applets.h | 781 | # Leave this as default for preprocessing busybox.lds.S, which is now |
347 | $(Q)-$(SHELL) $^ >$@ | 782 | # done in arch/$(ARCH)/kernel/Makefile |
348 | 783 | ||
349 | install: $(top_srcdir)/applets/install.sh busybox busybox.links | 784 | export CPPFLAGS_busybox.lds += -P -C -U$(ARCH) |
350 | $(Q)DO_INSTALL_LIBS="$(strip $(LIBBUSYBOX_SONAME) $(DO_INSTALL_LIBS))" \ | 785 | |
351 | $(SHELL) $< $(PREFIX) $(INSTALL_OPTS) | 786 | # FIXME: The asm symlink changes when $(ARCH) changes. That's |
352 | ifeq ($(strip $(CONFIG_FEATURE_SUID)),y) | 787 | # hard to detect, but I suppose "make mrproper" is a good idea |
353 | @echo | 788 | # before switching between archs anyway. |
789 | |||
790 | #bbox# include/asm: | ||
791 | #bbox# @echo ' SYMLINK $@ -> include/asm-$(ARCH)' | ||
792 | #bbox# $(Q)if [ ! -d include ]; then mkdir -p include; fi; | ||
793 | #bbox# @ln -fsn asm-$(ARCH) $@ | ||
794 | |||
795 | # Split autoconf.h into include/linux/config/* | ||
796 | #bbox# piggybacked generation of few .h files | ||
797 | include/config/MARKER: scripts/basic/split-include include/autoconf.h | ||
798 | @echo ' SPLIT include/autoconf.h -> include/config/*' | ||
799 | @scripts/basic/split-include include/autoconf.h include/config | ||
800 | @echo ' GEN include/bbconfigopts.h' | ||
801 | @scripts/mkconfigs >include/bbconfigopts.h | ||
802 | @$(MAKE) $(build)=scripts | ||
803 | @echo ' GEN include/usage_compressed.h' | ||
804 | @scripts/usage_compressed include/usage_compressed.h scripts | ||
805 | @touch $@ | ||
806 | |||
807 | # Generate some files | ||
808 | # --------------------------------------------------------------------------- | ||
809 | |||
810 | # KERNELRELEASE can change from a few different places, meaning version.h | ||
811 | # needs to be updated, so this check is forced on all builds | ||
812 | |||
813 | uts_len := 64 | ||
814 | |||
815 | define filechk_version.h | ||
816 | if [ `echo -n "$(KERNELRELEASE)" | wc -c ` -gt $(uts_len) ]; then \ | ||
817 | echo '"$(KERNELRELEASE)" exceeds $(uts_len) characters' >&2; \ | ||
818 | exit 1; \ | ||
819 | fi; \ | ||
820 | (echo \#define UTS_RELEASE \"$(KERNELRELEASE)\"; \ | ||
821 | echo \#define LINUX_VERSION_CODE `expr $(VERSION) \\* 65536 + $(PATCHLEVEL) \\* 256 + $(SUBLEVEL)`; \ | ||
822 | echo '#define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))'; \ | ||
823 | ) | ||
824 | endef | ||
825 | |||
826 | # --------------------------------------------------------------------------- | ||
827 | |||
828 | PHONY += depend dep | ||
829 | depend dep: | ||
830 | @echo '*** Warning: make $@ is unnecessary now.' | ||
831 | |||
832 | # --------------------------------------------------------------------------- | ||
833 | # Modules | ||
834 | |||
835 | ifdef CONFIG_MODULES | ||
836 | |||
837 | # By default, build modules as well | ||
838 | |||
839 | all: modules | ||
840 | |||
841 | # Build modules | ||
842 | |||
843 | PHONY += modules | ||
844 | modules: $(busybox-dirs) $(if $(KBUILD_BUILTIN),busybox) | ||
845 | @echo ' Building modules, stage 2.'; | ||
846 | $(Q)$(MAKE) -rR -f $(srctree)/scripts/Makefile.modpost | ||
847 | |||
848 | |||
849 | # Target to prepare building external modules | ||
850 | PHONY += modules_prepare | ||
851 | modules_prepare: prepare scripts | ||
852 | |||
853 | # Target to install modules | ||
854 | PHONY += modules_install | ||
855 | modules_install: _modinst_ _modinst_post | ||
856 | |||
857 | PHONY += _modinst_ | ||
858 | _modinst_: | ||
859 | @if [ -z "`$(DEPMOD) -V 2>/dev/null | grep module-init-tools`" ]; then \ | ||
860 | echo "Warning: you may need to install module-init-tools"; \ | ||
861 | echo "See http://www.codemonkey.org.uk/docs/post-halloween-2.6.txt";\ | ||
862 | sleep 1; \ | ||
863 | fi | ||
864 | @rm -rf $(MODLIB)/kernel | ||
865 | @rm -f $(MODLIB)/source | ||
866 | @mkdir -p $(MODLIB)/kernel | ||
867 | @ln -s $(srctree) $(MODLIB)/source | ||
868 | @if [ ! $(objtree) -ef $(MODLIB)/build ]; then \ | ||
869 | rm -f $(MODLIB)/build ; \ | ||
870 | ln -s $(objtree) $(MODLIB)/build ; \ | ||
871 | fi | ||
872 | $(Q)$(MAKE) -rR -f $(srctree)/scripts/Makefile.modinst | ||
873 | |||
874 | # If System.map exists, run depmod. This deliberately does not have a | ||
875 | # dependency on System.map since that would run the dependency tree on | ||
876 | # busybox. This depmod is only for convenience to give the initial | ||
877 | # boot a modules.dep even before / is mounted read-write. However the | ||
878 | # boot script depmod is the master version. | ||
879 | ifeq "$(strip $(INSTALL_MOD_PATH))" "" | ||
880 | depmod_opts := | ||
881 | else | ||
882 | depmod_opts := -b $(INSTALL_MOD_PATH) -r | ||
883 | endif | ||
884 | PHONY += _modinst_post | ||
885 | _modinst_post: _modinst_ | ||
886 | if [ -r System.map -a -x $(DEPMOD) ]; then $(DEPMOD) -ae -F System.map $(depmod_opts) $(KERNELRELEASE); fi | ||
887 | |||
888 | else # CONFIG_MODULES | ||
889 | |||
890 | # Modules not configured | ||
891 | # --------------------------------------------------------------------------- | ||
892 | |||
893 | modules modules_install: FORCE | ||
354 | @echo | 894 | @echo |
355 | @echo -------------------------------------------------- | 895 | @echo "The present kernel configuration has modules disabled." |
356 | @echo You will probably need to make your busybox binary | 896 | @echo "Type 'make config' and enable loadable module support." |
357 | @echo setuid root to ensure all configured applets will | 897 | @echo "Then build a kernel with module support enabled." |
358 | @echo work properly. | ||
359 | @echo -------------------------------------------------- | ||
360 | @echo | 898 | @echo |
361 | endif | 899 | @exit 1 |
362 | 900 | ||
363 | uninstall: busybox.links | 901 | endif # CONFIG_MODULES |
364 | rm -f $(PREFIX)/bin/busybox | ||
365 | for i in `cat busybox.links` ; do rm -f $(PREFIX)$$i; done | ||
366 | ifneq ($(strip $(DO_INSTALL_LIBS)),n) | ||
367 | for i in $(LIBBUSYBOX_SONAME) $(DO_INSTALL_LIBS); do \ | ||
368 | rm -f $(PREFIX)$$i; \ | ||
369 | done | ||
370 | endif | ||
371 | 902 | ||
372 | check test: busybox | 903 | ### |
373 | bindir=$(top_builddir) srcdir=$(top_srcdir)/testsuite SED="$(SED)" \ | 904 | # Cleaning is done on three levels. |
374 | $(SHELL) $(top_srcdir)/testsuite/runtest $(CHECK_VERBOSE) | 905 | # make clean Delete most generated files |
906 | # Leave enough to build external modules | ||
907 | # make mrproper Delete the current configuration, and all generated files | ||
908 | # make distclean Remove editor backup files, patch leftover files and the like | ||
909 | |||
910 | # Directories & files removed with 'make clean' | ||
911 | CLEAN_DIRS += $(MODVERDIR) | ||
912 | CLEAN_FILES += busybox System.map \ | ||
913 | .tmp_kallsyms* .tmp_version .tmp_busybox* .tmp_System.map | ||
914 | |||
915 | # Directories & files removed with 'make mrproper' | ||
916 | MRPROPER_DIRS += include/config include2 | ||
917 | MRPROPER_FILES += .config .config.old include/asm .version .old_version \ | ||
918 | include/autoconf.h \ | ||
919 | .kernelrelease Module.symvers tags TAGS cscope* | ||
920 | |||
921 | # clean - Delete most, but leave enough to build external modules | ||
922 | # | ||
923 | clean: rm-dirs := $(CLEAN_DIRS) | ||
924 | clean: rm-files := $(CLEAN_FILES) | ||
925 | clean-dirs := $(addprefix _clean_,$(srctree) $(busybox-alldirs)) | ||
926 | |||
927 | PHONY += $(clean-dirs) clean archclean | ||
928 | $(clean-dirs): | ||
929 | $(Q)$(MAKE) $(clean)=$(patsubst _clean_%,%,$@) | ||
930 | |||
931 | clean: archclean $(clean-dirs) | ||
932 | $(call cmd,rmdirs) | ||
933 | $(call cmd,rmfiles) | ||
934 | @find . $(RCS_FIND_IGNORE) \ | ||
935 | \( -name '*.[oas]' -o -name '*.ko' -o -name '.*.cmd' \ | ||
936 | -o -name '.*.d' -o -name '.*.tmp' -o -name '*.mod.c' \) \ | ||
937 | -type f -print | xargs rm -f | ||
938 | |||
939 | # mrproper - Delete all generated files, including .config | ||
940 | # | ||
941 | mrproper: rm-dirs := $(wildcard $(MRPROPER_DIRS)) | ||
942 | mrproper: rm-files := $(wildcard $(MRPROPER_FILES)) | ||
943 | mrproper-dirs := $(addprefix _mrproper_,Documentation/DocBook scripts) | ||
375 | 944 | ||
376 | checkhelp: | 945 | PHONY += $(mrproper-dirs) mrproper archmrproper |
377 | $(Q)$(top_srcdir)/scripts/checkhelp.awk \ | 946 | $(mrproper-dirs): |
378 | $(wildcard $(patsubst %,%/Config.in,$(SRC_DIRS) ./)) | 947 | $(Q)$(MAKE) $(clean)=$(patsubst _mrproper_%,%,$@) |
379 | 948 | ||
380 | sizes: busybox_unstripped | 949 | mrproper: clean archmrproper $(mrproper-dirs) |
381 | $(NM) --size-sort $(<) | 950 | $(call cmd,rmdirs) |
951 | $(call cmd,rmfiles) | ||
382 | 952 | ||
383 | bloatcheck: busybox_old busybox_unstripped | 953 | # distclean |
384 | @$(top_srcdir)/scripts/bloat-o-meter busybox_old busybox_unstripped | 954 | # |
955 | PHONY += distclean | ||
385 | 956 | ||
386 | baseline: busybox_unstripped | 957 | distclean: mrproper |
387 | @mv busybox_unstripped busybox_old | 958 | @find $(srctree) $(RCS_FIND_IGNORE) \ |
959 | \( -name '*.orig' -o -name '*.rej' -o -name '*~' \ | ||
960 | -o -name '*.bak' -o -name '#*#' -o -name '.*.orig' \ | ||
961 | -o -name '.*.rej' -o -size 0 \ | ||
962 | -o -name '*%' -o -name '.*.cmd' -o -name 'core' \) \ | ||
963 | -type f -print | xargs rm -f | ||
388 | 964 | ||
389 | objsizes: busybox_unstripped | ||
390 | $(SHELL) $(top_srcdir)/scripts/objsizes | ||
391 | 965 | ||
392 | # Documentation Targets | 966 | # Packaging of the kernel to various formats |
393 | doc: docs/busybox.pod docs/BusyBox.txt docs/BusyBox.1 docs/BusyBox.html | 967 | # --------------------------------------------------------------------------- |
968 | # rpm target kept for backward compatibility | ||
969 | package-dir := $(srctree)/scripts/package | ||
394 | 970 | ||
395 | docs/busybox.pod : $(top_srcdir)/docs/busybox_header.pod $(top_srcdir)/include/usage.h $(top_srcdir)/docs/busybox_footer.pod $(top_srcdir)/docs/autodocifier.pl | 971 | %pkg: FORCE |
396 | $(disp_doc) | 972 | $(Q)$(MAKE) $(build)=$(package-dir) $@ |
397 | $(Q)-mkdir -p docs | 973 | rpm: FORCE |
398 | $(Q)-( cat $(top_srcdir)/docs/busybox_header.pod ; \ | 974 | $(Q)$(MAKE) $(build)=$(package-dir) $@ |
399 | $(top_srcdir)/docs/autodocifier.pl $(top_srcdir)/include/usage.h ; \ | ||
400 | cat $(top_srcdir)/docs/busybox_footer.pod ; ) > docs/busybox.pod | ||
401 | 975 | ||
402 | docs/BusyBox.txt: docs/busybox.pod | ||
403 | $(disp_doc) | ||
404 | $(Q)-mkdir -p docs | ||
405 | $(Q)-pod2text $< > $@ | ||
406 | 976 | ||
407 | docs/BusyBox.1: docs/busybox.pod | 977 | # Brief documentation of the typical targets used |
408 | $(disp_doc) | 978 | # --------------------------------------------------------------------------- |
409 | $(Q)-mkdir -p docs | ||
410 | $(Q)-pod2man --center=BusyBox --release="version $(VERSION)" \ | ||
411 | $< > $@ | ||
412 | 979 | ||
413 | docs/BusyBox.html: docs/busybox.net/BusyBox.html | 980 | boards := $(wildcard $(srctree)/arch/$(ARCH)/configs/*_defconfig) |
414 | $(disp_doc) | 981 | boards := $(notdir $(boards)) |
415 | $(Q)-mkdir -p docs | ||
416 | $(Q)-rm -f docs/BusyBox.html | ||
417 | $(Q)-cp docs/busybox.net/BusyBox.html docs/BusyBox.html | ||
418 | 982 | ||
419 | docs/busybox.net/BusyBox.html: docs/busybox.pod | 983 | -include Makefile.help |
420 | $(Q)-mkdir -p docs/busybox.net | ||
421 | $(Q)-pod2html --noindex $< > \ | ||
422 | docs/busybox.net/BusyBox.html | ||
423 | $(Q)-rm -f pod2htm* | ||
424 | 984 | ||
425 | # The nifty new dependency stuff | 985 | # Documentation targets |
426 | scripts/bb_mkdep: $(top_srcdir)/scripts/bb_mkdep.c | 986 | # --------------------------------------------------------------------------- |
427 | $(do_link.h) | 987 | %docs: scripts_basic FORCE |
988 | $(Q)$(MAKE) $(build)=Documentation/DocBook $@ | ||
989 | |||
990 | else # KBUILD_EXTMOD | ||
991 | |||
992 | ### | ||
993 | # External module support. | ||
994 | # When building external modules the kernel used as basis is considered | ||
995 | # read-only, and no consistency checks are made and the make | ||
996 | # system is not used on the basis kernel. If updates are required | ||
997 | # in the basis kernel ordinary make commands (without M=...) must | ||
998 | # be used. | ||
999 | # | ||
1000 | # The following are the only valid targets when building external | ||
1001 | # modules. | ||
1002 | # make M=dir clean Delete all automatically generated files | ||
1003 | # make M=dir modules Make all modules in specified dir | ||
1004 | # make M=dir Same as 'make M=dir modules' | ||
1005 | # make M=dir modules_install | ||
1006 | # Install the modules build in the module directory | ||
1007 | # Assumes install directory is already created | ||
1008 | |||
1009 | # We are always building modules | ||
1010 | KBUILD_MODULES := 1 | ||
1011 | PHONY += crmodverdir | ||
1012 | crmodverdir: | ||
1013 | $(Q)mkdir -p $(MODVERDIR) | ||
1014 | $(Q)rm -f $(MODVERDIR)/* | ||
1015 | |||
1016 | PHONY += $(objtree)/Module.symvers | ||
1017 | $(objtree)/Module.symvers: | ||
1018 | @test -e $(objtree)/Module.symvers || ( \ | ||
1019 | echo; \ | ||
1020 | echo " WARNING: Symbol version dump $(objtree)/Module.symvers"; \ | ||
1021 | echo " is missing; modules will have no dependencies and modversions."; \ | ||
1022 | echo ) | ||
1023 | |||
1024 | module-dirs := $(addprefix _module_,$(KBUILD_EXTMOD)) | ||
1025 | PHONY += $(module-dirs) modules | ||
1026 | $(module-dirs): crmodverdir $(objtree)/Module.symvers | ||
1027 | $(Q)$(MAKE) $(build)=$(patsubst _module_%,%,$@) | ||
1028 | |||
1029 | modules: $(module-dirs) | ||
1030 | @echo ' Building modules, stage 2.'; | ||
1031 | $(Q)$(MAKE) -rR -f $(srctree)/scripts/Makefile.modpost | ||
1032 | |||
1033 | PHONY += modules_install | ||
1034 | modules_install: _emodinst_ _emodinst_post | ||
1035 | |||
1036 | install-dir := $(if $(INSTALL_MOD_DIR),$(INSTALL_MOD_DIR),extra) | ||
1037 | PHONY += _emodinst_ | ||
1038 | _emodinst_: | ||
1039 | $(Q)mkdir -p $(MODLIB)/$(install-dir) | ||
1040 | $(Q)$(MAKE) -rR -f $(srctree)/scripts/Makefile.modinst | ||
1041 | |||
1042 | # Run depmod only is we have System.map and depmod is executable | ||
1043 | quiet_cmd_depmod = DEPMOD $(KERNELRELEASE) | ||
1044 | cmd_depmod = if [ -r System.map -a -x $(DEPMOD) ]; then \ | ||
1045 | $(DEPMOD) -ae -F System.map \ | ||
1046 | $(if $(strip $(INSTALL_MOD_PATH)), \ | ||
1047 | -b $(INSTALL_MOD_PATH) -r) \ | ||
1048 | $(KERNELRELEASE); \ | ||
1049 | fi | ||
1050 | |||
1051 | PHONY += _emodinst_post | ||
1052 | _emodinst_post: _emodinst_ | ||
1053 | $(call cmd,depmod) | ||
1054 | |||
1055 | clean-dirs := $(addprefix _clean_,$(KBUILD_EXTMOD)) | ||
1056 | |||
1057 | PHONY += $(clean-dirs) clean | ||
1058 | $(clean-dirs): | ||
1059 | $(Q)$(MAKE) $(clean)=$(patsubst _clean_%,%,$@) | ||
1060 | |||
1061 | clean: rm-dirs := $(MODVERDIR) | ||
1062 | clean: $(clean-dirs) | ||
1063 | $(call cmd,rmdirs) | ||
1064 | @find $(KBUILD_EXTMOD) $(RCS_FIND_IGNORE) \ | ||
1065 | \( -name '*.[oas]' -o -name '*.ko' -o -name '.*.cmd' \ | ||
1066 | -o -name '.*.d' -o -name '.*.tmp' -o -name '*.mod.c' \) \ | ||
1067 | -type f -print | xargs rm -f | ||
428 | 1068 | ||
429 | DEP_INCLUDES := include/bb_config.h | 1069 | help: |
1070 | @echo ' Building external modules.' | ||
1071 | @echo ' Syntax: make -C path/to/kernel/src M=$$PWD target' | ||
1072 | @echo '' | ||
1073 | @echo ' modules - default target, build the module(s)' | ||
1074 | @echo ' modules_install - install the module' | ||
1075 | @echo ' clean - remove generated files in module directory only' | ||
1076 | @echo '' | ||
1077 | |||
1078 | # Dummies... | ||
1079 | PHONY += prepare scripts | ||
1080 | prepare: ; | ||
1081 | scripts: ; | ||
1082 | endif # KBUILD_EXTMOD | ||
1083 | |||
1084 | # Generate tags for editors | ||
1085 | # --------------------------------------------------------------------------- | ||
430 | 1086 | ||
431 | ifeq ($(strip $(CONFIG_BBCONFIG)),y) | 1087 | #We want __srctree to totally vanish out when KBUILD_OUTPUT is not set |
432 | DEP_INCLUDES += include/bbconfigopts.h | 1088 | #(which is the most common case IMHO) to avoid unneeded clutter in the big tags file. |
1089 | #Adding $(srctree) adds about 20M on i386 to the size of the output file! | ||
433 | 1090 | ||
434 | include/bbconfigopts.h: .config $(top_srcdir)/scripts/config/mkconfigs | 1091 | ifeq ($(src),$(obj)) |
435 | $(disp_gen) | 1092 | __srctree = |
436 | $(Q)$(top_srcdir)/scripts/config/mkconfigs > $@ | 1093 | else |
1094 | __srctree = $(srctree)/ | ||
437 | endif | 1095 | endif |
438 | 1096 | ||
439 | ifeq ($(strip $(CONFIG_FEATURE_COMPRESS_USAGE)),y) | 1097 | ifeq ($(ALLSOURCE_ARCHS),) |
440 | USAGE_BIN:=scripts/usage | 1098 | ifeq ($(ARCH),um) |
441 | $(USAGE_BIN): $(top_srcdir)/scripts/usage.c .config \ | 1099 | ALLINCLUDE_ARCHS := $(ARCH) $(SUBARCH) |
442 | $(top_srcdir)/include/usage.h | 1100 | else |
443 | $(do_link.h) | 1101 | ALLINCLUDE_ARCHS := $(ARCH) |
444 | 1102 | endif | |
445 | DEP_INCLUDES += include/usage_compressed.h | 1103 | else |
446 | 1104 | #Allow user to specify only ALLSOURCE_PATHS on the command line, keeping existing behaviour. | |
447 | include/usage_compressed.h: .config $(USAGE_BIN) \ | 1105 | ALLINCLUDE_ARCHS := $(ALLSOURCE_ARCHS) |
448 | $(top_srcdir)/scripts/usage_compressed | 1106 | endif |
449 | $(Q)SED="$(SED)" $(SHELL) $(top_srcdir)/scripts/usage_compressed \ | 1107 | |
450 | "$(top_builddir)/scripts" > $@ | 1108 | ALLSOURCE_ARCHS := $(ARCH) |
451 | endif # CONFIG_FEATURE_COMPRESS_USAGE | 1109 | |
452 | 1110 | define all-sources | |
453 | depend dep: .depend | 1111 | ( find $(__srctree) $(RCS_FIND_IGNORE) \ |
454 | .depend: scripts/bb_mkdep $(USAGE_BIN) $(DEP_INCLUDES) | 1112 | \( -name include -o -name arch \) -prune -o \ |
455 | $(disp_gen) | 1113 | -name '*.[chS]' -print; \ |
456 | $(Q)rm -f .depend | 1114 | for ARCH in $(ALLSOURCE_ARCHS) ; do \ |
457 | $(Q)mkdir -p include/config | 1115 | find $(__srctree)arch/$${ARCH} $(RCS_FIND_IGNORE) \ |
458 | $(Q)scripts/bb_mkdep -I $(top_srcdir)/include $(top_srcdir) > $@.tmp | 1116 | -name '*.[chS]' -print; \ |
459 | $(Q)mv $@.tmp $@ | 1117 | done ; \ |
460 | 1118 | find $(__srctree)security/selinux/include $(RCS_FIND_IGNORE) \ | |
461 | include/bb_config.h: .config | 1119 | -name '*.[chS]' -print; \ |
462 | @if [ ! -x $(top_builddir)/scripts/config/conf ] ; then \ | 1120 | find $(__srctree)include $(RCS_FIND_IGNORE) \ |
463 | $(MAKE) -C scripts/config conf; \ | 1121 | \( -name config -o -name 'asm-*' \) -prune \ |
464 | fi; | 1122 | -o -name '*.[chS]' -print; \ |
465 | @$(top_builddir)/scripts/config/conf -o $(CONFIG_CONFIG_IN) | 1123 | for ARCH in $(ALLINCLUDE_ARCHS) ; do \ |
466 | 1124 | find $(__srctree)include/asm-$${ARCH} $(RCS_FIND_IGNORE) \ | |
467 | clean: | 1125 | -name '*.[chS]' -print; \ |
468 | - $(MAKE) -C scripts/config $@ | 1126 | done ; \ |
469 | - rm -f docs/busybox.dvi docs/busybox.ps \ | 1127 | find $(__srctree)include/asm-generic $(RCS_FIND_IGNORE) \ |
470 | docs/busybox.pod docs/busybox.net/busybox.html \ | 1128 | -name '*.[chS]' -print ) |
471 | docs/busybox pod2htm* *.gdb *.elf *~ core .*config.log \ | 1129 | endef |
472 | docs/BusyBox.txt docs/BusyBox.1 docs/BusyBox.html \ | 1130 | |
473 | docs/busybox.net/BusyBox.html busybox.links \ | 1131 | quiet_cmd_cscope-file = FILELST cscope.files |
474 | libbusybox.so* \ | 1132 | cmd_cscope-file = (echo \-k; echo \-q; $(all-sources)) > cscope.files |
475 | .config.old busybox busybox_unstripped \ | 1133 | |
476 | include/usage_compressed.h scripts/usage | 1134 | quiet_cmd_cscope = MAKE cscope.out |
477 | - rm -r -f _install testsuite/links | 1135 | cmd_cscope = cscope -b |
478 | - find . -name .\*.flags -o -name \*.o -o -name \*.om -o -name \*.syn \ | 1136 | |
479 | -o -name \*.os -o -name \*.osm -o -name \*.a | xargs rm -f | 1137 | cscope: FORCE |
480 | 1138 | $(call cmd,cscope-file) | |
481 | distclean: clean | 1139 | $(call cmd,cscope) |
482 | rm -f scripts/bb_mkdep scripts/usage | 1140 | |
483 | rm -r -f include/config include/config.h $(DEP_INCLUDES) | 1141 | quiet_cmd_TAGS = MAKE $@ |
484 | find . -name .depend'*' -print0 | xargs -0 rm -f | 1142 | define cmd_TAGS |
485 | find . -name '*.rej' -print0 | xargs -0 rm -f | 1143 | rm -f $@; \ |
486 | rm -f .hdepend busybox_old .config .config.old .config.cmd | 1144 | ETAGSF=`etags --version | grep -i exuberant >/dev/null && \ |
487 | 1145 | echo "-I __initdata,__exitdata,__acquires,__releases \ | |
488 | release: distclean #doc | 1146 | -I EXPORT_SYMBOL,EXPORT_SYMBOL_GPL \ |
489 | cd ..; \ | 1147 | --extra=+f --c-kinds=+px"`; \ |
490 | rm -r -f $(PROG)-$(VERSION); \ | 1148 | $(all-sources) | xargs etags $$ETAGSF -a |
491 | cp -a busybox $(PROG)-$(VERSION); \ | 1149 | endef |
492 | \ | 1150 | |
493 | find $(PROG)-$(VERSION)/ -type d \ | 1151 | TAGS: FORCE |
494 | -name .svn \ | 1152 | $(call cmd,TAGS) |
495 | -print \ | 1153 | |
496 | -exec rm -r -f {} \; ; \ | 1154 | |
497 | \ | 1155 | quiet_cmd_tags = MAKE $@ |
498 | find $(PROG)-$(VERSION)/ -type f \ | 1156 | define cmd_tags |
499 | -name .\#* \ | 1157 | rm -f $@; \ |
500 | -print \ | 1158 | CTAGSF=`ctags --version | grep -i exuberant >/dev/null && \ |
501 | -exec rm -f {} \; ; \ | 1159 | echo "-I __initdata,__exitdata,__acquires,__releases \ |
502 | \ | 1160 | -I EXPORT_SYMBOL,EXPORT_SYMBOL_GPL \ |
503 | tar -cvzf $(PROG)-$(VERSION).tar.gz $(PROG)-$(VERSION)/; | 1161 | --extra=+f --c-kinds=+px"`; \ |
504 | 1162 | $(all-sources) | xargs ctags $$CTAGSF -a | |
505 | tags: | 1163 | endef |
506 | ctags -R . | 1164 | |
507 | 1165 | tags: FORCE | |
508 | # documentation, cross-reference | 1166 | $(call cmd,tags) |
509 | # Modern distributions already ship synopsis packages (e.g. debian) | 1167 | |
510 | # If you have an old distribution go to http://synopsis.fresco.org/ | 1168 | |
511 | syn_tgt := $(wildcard $(patsubst %,%/*.c,$(SRC_DIRS))) | 1169 | # Scripts to check various things for consistency |
512 | syn := $(patsubst %.c, %.syn, $(syn_tgt)) | 1170 | # --------------------------------------------------------------------------- |
513 | 1171 | ||
514 | %.syn: %.c | 1172 | includecheck: |
515 | synopsis -p C -l Comments.SSDFilter,Comments.Previous $(INCS) -Wp,verbose,debug,preprocess,cppflags="'$(CFLAGS) $(EXTRA_CFLAGS) $(LDFLAGS) $(PROG_CFLAGS) $(PROG_LDFLAGS) $(CFLAGS_COMBINE) $(APPLETS_DEFINE) $(BUSYBOX_DEFINE)'" -o $@ $< | 1173 | find * $(RCS_FIND_IGNORE) \ |
516 | html: $(syn) | 1174 | -name '*.[hcS]' -type f -print | sort \ |
517 | synopsis -f HTML -Wf,title="'BusyBox Documentation'" -o $@ $^ | 1175 | | xargs $(PERL) -w scripts/checkincludes.pl |
518 | 1176 | ||
519 | 1177 | versioncheck: | |
520 | endif # ifeq ($(skip-makefile),) | 1178 | find * $(RCS_FIND_IGNORE) \ |
1179 | -name '*.[hcS]' -type f -print | sort \ | ||
1180 | | xargs $(PERL) -w scripts/checkversion.pl | ||
1181 | |||
1182 | namespacecheck: | ||
1183 | $(PERL) $(srctree)/scripts/namespace.pl | ||
1184 | |||
1185 | endif #ifeq ($(config-targets),1) | ||
1186 | endif #ifeq ($(mixed-targets),1) | ||
1187 | |||
1188 | PHONY += checkstack | ||
1189 | checkstack: | ||
1190 | $(OBJDUMP) -d busybox $$(find . -name '*.ko') | \ | ||
1191 | $(PERL) $(src)/scripts/checkstack.pl $(ARCH) | ||
1192 | |||
1193 | kernelrelease: | ||
1194 | $(if $(wildcard .kernelrelease), $(Q)echo $(KERNELRELEASE), \ | ||
1195 | $(error kernelrelease not valid - run 'make *config' to update it)) | ||
1196 | kernelversion: | ||
1197 | @echo $(KERNELVERSION) | ||
1198 | |||
1199 | # Single targets | ||
1200 | # --------------------------------------------------------------------------- | ||
1201 | # Single targets are compatible with: | ||
1202 | # - build whith mixed source and output | ||
1203 | # - build with separate output dir 'make O=...' | ||
1204 | # - external modules | ||
1205 | # | ||
1206 | # target-dir => where to store outputfile | ||
1207 | # build-dir => directory in kernel source tree to use | ||
1208 | |||
1209 | ifeq ($(KBUILD_EXTMOD),) | ||
1210 | build-dir = $(patsubst %/,%,$(dir $@)) | ||
1211 | target-dir = $(dir $@) | ||
1212 | else | ||
1213 | zap-slash=$(filter-out .,$(patsubst %/,%,$(dir $@))) | ||
1214 | build-dir = $(KBUILD_EXTMOD)$(if $(zap-slash),/$(zap-slash)) | ||
1215 | target-dir = $(if $(KBUILD_EXTMOD),$(dir $<),$(dir $@)) | ||
1216 | endif | ||
1217 | |||
1218 | %.s: %.c prepare scripts FORCE | ||
1219 | $(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@) | ||
1220 | %.i: %.c prepare scripts FORCE | ||
1221 | $(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@) | ||
1222 | %.o: %.c prepare scripts FORCE | ||
1223 | $(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@) | ||
1224 | %.lst: %.c prepare scripts FORCE | ||
1225 | $(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@) | ||
1226 | %.s: %.S prepare scripts FORCE | ||
1227 | $(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@) | ||
1228 | %.o: %.S prepare scripts FORCE | ||
1229 | $(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@) | ||
1230 | |||
1231 | # Modules | ||
1232 | / %/: prepare scripts FORCE | ||
1233 | $(Q)$(MAKE) KBUILD_MODULES=$(if $(CONFIG_MODULES),1) \ | ||
1234 | $(build)=$(build-dir) | ||
1235 | %.ko: prepare scripts FORCE | ||
1236 | $(Q)$(MAKE) KBUILD_MODULES=$(if $(CONFIG_MODULES),1) \ | ||
1237 | $(build)=$(build-dir) $(@:.ko=.o) | ||
1238 | $(Q)$(MAKE) -rR -f $(srctree)/scripts/Makefile.modpost | ||
1239 | |||
1240 | # FIXME Should go into a make.lib or something | ||
1241 | # =========================================================================== | ||
1242 | |||
1243 | quiet_cmd_rmdirs = $(if $(wildcard $(rm-dirs)),CLEAN $(wildcard $(rm-dirs))) | ||
1244 | cmd_rmdirs = rm -rf $(rm-dirs) | ||
1245 | |||
1246 | quiet_cmd_rmfiles = $(if $(wildcard $(rm-files)),CLEAN $(wildcard $(rm-files))) | ||
1247 | cmd_rmfiles = rm -f $(rm-files) | ||
1248 | |||
1249 | |||
1250 | a_flags = -Wp,-MD,$(depfile) $(AFLAGS) $(AFLAGS_KERNEL) \ | ||
1251 | $(NOSTDINC_FLAGS) $(CPPFLAGS) \ | ||
1252 | $(modkern_aflags) $(EXTRA_AFLAGS) $(AFLAGS_$(*F).o) | ||
1253 | |||
1254 | quiet_cmd_as_o_S = AS $@ | ||
1255 | cmd_as_o_S = $(CC) $(a_flags) -c -o $@ $< | ||
1256 | |||
1257 | # read all saved command lines | ||
1258 | |||
1259 | targets := $(wildcard $(sort $(targets))) | ||
1260 | cmd_files := $(wildcard .*.cmd $(foreach f,$(targets),$(dir $(f)).$(notdir $(f)).cmd)) | ||
1261 | |||
1262 | ifneq ($(cmd_files),) | ||
1263 | $(cmd_files): ; # Do not try to update included dependency files | ||
1264 | include $(cmd_files) | ||
1265 | endif | ||
1266 | |||
1267 | # Shorthand for $(Q)$(MAKE) -f scripts/Makefile.clean obj=dir | ||
1268 | # Usage: | ||
1269 | # $(Q)$(MAKE) $(clean)=dir | ||
1270 | clean := -f $(if $(KBUILD_SRC),$(srctree)/)scripts/Makefile.clean obj | ||
1271 | |||
1272 | endif # skip-makefile | ||
1273 | |||
1274 | PHONY += FORCE | ||
1275 | FORCE: | ||
1276 | |||
1277 | -include Makefile.custom | ||
521 | 1278 | ||
1279 | # Declare the contents of the .PHONY variable as phony. We keep that | ||
1280 | # information in a variable se we can use it in if_changed and friends. | ||
1281 | .PHONY: $(PHONY) | ||
diff --git a/Makefile.custom b/Makefile.custom new file mode 100644 index 000000000..6880b97d6 --- /dev/null +++ b/Makefile.custom | |||
@@ -0,0 +1,131 @@ | |||
1 | ### # defconfig is allyesconfig minus any features that are specialized enough | ||
2 | ### # or cause enough behavior change that the user really should switch them on | ||
3 | ### # manually if that's what they want. Sort of "maximum sane config". | ||
4 | |||
5 | ### defconfig: scripts/config/conf | ||
6 | ### @./scripts/config/conf -y $(CONFIG_CONFIG_IN) > /dev/null | ||
7 | ### @$(SED) -i -r -e "s/^(CONFIG_(DEBUG.*|STATIC|SELINUX|NITPICK|BUILD_(AT_ONCE|LIBBUSYBOX)|FEATURE_(DEVFS|FULL_LIBBUSYBOX|SHARED_BUSYBOX|MTAB_SUPPORT|CLEAN_UP|UDHCP_DEBUG)|INSTALL_NO_USR))=.*/# \1 is not set/" .config | ||
8 | ### @./scripts/config/conf -o $(CONFIG_CONFIG_IN) > /dev/null | ||
9 | |||
10 | ### allbareconfig: scripts/config/conf | ||
11 | ### @./scripts/config/conf -y $(CONFIG_CONFIG_IN) > /dev/null | ||
12 | ### @$(SED) -i -r -e "s/^(CONFIG_(DEBUG|STATIC|SELINUX|DEVFSD|NC_GAPING_SECURITY_HOLE|BUILD_AT_ONCE)).*/# \1 is not set/" .config | ||
13 | ### @$(SED) -i -e "/FEATURE/s/=.*//;/^[^#]/s/.*FEATURE.*/# \0 is not set/;" .config | ||
14 | ### @echo "CONFIG_FEATURE_BUFFERS_GO_ON_STACK=y" >> .config | ||
15 | ### @yes n | ./scripts/config/conf -o $(CONFIG_CONFIG_IN) > /dev/null | ||
16 | |||
17 | ### hosttools: | ||
18 | ### $(Q)cp .config .config.bak || noold=yea | ||
19 | ### $(Q)$(MAKE) CC="$(HOSTCC)" CFLAGS="$(HOSTCFLAGS) $(INCS)" allnoconfig | ||
20 | ### $(Q)mv .config .config.in | ||
21 | ### $(Q)(grep -v CONFIG_SED .config.in ; \ | ||
22 | ### echo "CONFIG_SED=y" ; ) > .config | ||
23 | ### $(Q)$(MAKE) CC="$(HOSTCC)" CFLAGS="$(HOSTCFLAGS) $(INCS)" oldconfig include/bb_config.h | ||
24 | ### $(Q)$(MAKE) CC="$(HOSTCC)" CFLAGS="$(HOSTCFLAGS) $(INCS)" busybox | ||
25 | ### $(Q)[ -f .config.bak ] && mv .config.bak .config || rm .config | ||
26 | ### mv busybox sed | ||
27 | ### @echo "Now do: $(MAKE) SED=$(objtree)/sed <target>" | ||
28 | |||
29 | %.bflt: %_unstripped | ||
30 | $(CROSS_COMPILE)elf2flt $(ELF2FLTFLAGS) $< -o $@ | ||
31 | |||
32 | busybox.links: $(srctree)/applets/busybox.mkll include/bb_config.h $(srctree)/include/applets.h | ||
33 | $(Q)-$(SHELL) $^ >$@ | ||
34 | |||
35 | .PHONY: install | ||
36 | install: $(srctree)/applets/install.sh busybox busybox.links | ||
37 | $(Q)DO_INSTALL_LIBS="$(strip $(LIBBUSYBOX_SONAME) $(DO_INSTALL_LIBS))" \ | ||
38 | $(SHELL) $< $(CONFIG_PREFIX) $(INSTALL_OPTS) | ||
39 | ifeq ($(strip $(CONFIG_FEATURE_SUID)),y) | ||
40 | @echo | ||
41 | @echo | ||
42 | @echo -------------------------------------------------- | ||
43 | @echo You will probably need to make your busybox binary | ||
44 | @echo setuid root to ensure all configured applets will | ||
45 | @echo work properly. | ||
46 | @echo -------------------------------------------------- | ||
47 | @echo | ||
48 | endif | ||
49 | |||
50 | uninstall: busybox.links | ||
51 | rm -f $(CONFIG_PREFIX)/bin/busybox | ||
52 | for i in `cat busybox.links` ; do rm -f $(CONFIG_PREFIX)$$i; done | ||
53 | ifneq ($(strip $(DO_INSTALL_LIBS)),n) | ||
54 | for i in $(LIBBUSYBOX_SONAME) $(DO_INSTALL_LIBS); do \ | ||
55 | rm -f $(CONFIG_PREFIX)$$i; \ | ||
56 | done | ||
57 | endif | ||
58 | |||
59 | check test: busybox | ||
60 | bindir=$(objtree) srcdir=$(srctree)/testsuite SED="$(SED)" \ | ||
61 | $(SHELL) $(srctree)/testsuite/runtest $(if $(KBUILD_VERBOSE:1=),-v) | ||
62 | |||
63 | ### checkhelp: | ||
64 | ### $(Q)$(srctree)/scripts/checkhelp.awk \ | ||
65 | ### $(wildcard $(patsubst %,%/Config.in,$(SRC_DIRS) ./)) | ||
66 | |||
67 | .PHONY: sizes | ||
68 | sizes: busybox_unstripped | ||
69 | $(NM) --size-sort $(<) | ||
70 | |||
71 | .PHONY: bloatcheck | ||
72 | bloatcheck: busybox_old busybox_unstripped | ||
73 | @$(srctree)/scripts/bloat-o-meter busybox_old busybox_unstripped | ||
74 | |||
75 | .PHONY: baseline | ||
76 | baseline: busybox_unstripped | ||
77 | @mv busybox_unstripped busybox_old | ||
78 | |||
79 | .PHONY: objsizes | ||
80 | objsizes: busybox_unstripped | ||
81 | $(SHELL) $(srctree)/scripts/objsizes | ||
82 | |||
83 | # Documentation Targets | ||
84 | .PHONY: doc | ||
85 | doc: docs/busybox.pod docs/BusyBox.txt docs/BusyBox.1 docs/BusyBox.html | ||
86 | |||
87 | docs/busybox.pod: $(srctree)/docs/busybox_header.pod \ | ||
88 | $(srctree)/include/usage.h \ | ||
89 | $(srctree)/docs/busybox_footer.pod \ | ||
90 | $(srctree)/docs/autodocifier.pl | ||
91 | $(disp_doc) | ||
92 | $(Q)-mkdir -p docs | ||
93 | $(Q)-( cat $(srctree)/docs/busybox_header.pod ; \ | ||
94 | $(srctree)/docs/autodocifier.pl $(srctree)/include/usage.h ; \ | ||
95 | cat $(srctree)/docs/busybox_footer.pod ; ) > docs/busybox.pod | ||
96 | |||
97 | docs/BusyBox.txt: docs/busybox.pod | ||
98 | $(disp_doc) | ||
99 | $(Q)-mkdir -p docs | ||
100 | $(Q)-pod2text $< > $@ | ||
101 | |||
102 | docs/BusyBox.1: docs/busybox.pod | ||
103 | $(disp_doc) | ||
104 | $(Q)-mkdir -p docs | ||
105 | $(Q)-pod2man --center=BusyBox --release="version $(VERSION)" \ | ||
106 | $< > $@ | ||
107 | |||
108 | docs/BusyBox.html: docs/busybox.net/BusyBox.html | ||
109 | $(disp_doc) | ||
110 | $(Q)-mkdir -p docs | ||
111 | $(Q)-rm -f docs/BusyBox.html | ||
112 | $(Q)-cp docs/busybox.net/BusyBox.html docs/BusyBox.html | ||
113 | |||
114 | docs/busybox.net/BusyBox.html: docs/busybox.pod | ||
115 | $(Q)-mkdir -p docs/busybox.net | ||
116 | $(Q)-pod2html --noindex $< > \ | ||
117 | docs/busybox.net/BusyBox.html | ||
118 | $(Q)-rm -f pod2htm* | ||
119 | |||
120 | # documentation, cross-reference | ||
121 | # Modern distributions already ship synopsis packages (e.g. debian) | ||
122 | # If you have an old distribution go to http://synopsis.fresco.org/ | ||
123 | syn_tgt := $(wildcard $(patsubst %,%/*.c,$(SRC_DIRS))) | ||
124 | syn := $(patsubst %.c, %.syn, $(syn_tgt)) | ||
125 | |||
126 | %.syn: %.c | ||
127 | synopsis -p C -l Comments.SSDFilter,Comments.Previous $(INCS) -Wp,verbose,debug,preprocess,cppflags="'$(CFLAGS) $(EXTRA_CFLAGS) $(LDFLAGS) $(PROG_CFLAGS) $(PROG_LDFLAGS) $(CFLAGS_COMBINE) $(APPLETS_DEFINE) $(BUSYBOX_DEFINE)'" -o $@ $< | ||
128 | |||
129 | .PHONY: html | ||
130 | html: $(syn) | ||
131 | synopsis -f HTML -Wf,title="'BusyBox Documentation'" -o $@ $^ | ||
diff --git a/Makefile.flags b/Makefile.flags new file mode 100644 index 000000000..39c544e60 --- /dev/null +++ b/Makefile.flags | |||
@@ -0,0 +1,19 @@ | |||
1 | # ========================================================================== | ||
2 | # Building | ||
3 | # ========================================================================== | ||
4 | |||
5 | BB_VER = $(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION) | ||
6 | |||
7 | CPPFLAGS += \ | ||
8 | -Iinclude -Ilibbb \ | ||
9 | $(if $(KBUILD_SRC),-Iinclude2 -I$(srctree)/include) -I$(srctree)/libbb \ | ||
10 | -include include/autoconf.h \ | ||
11 | -D_GNU_SOURCE -DNDEBUG \ | ||
12 | -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 \ | ||
13 | -D"BB_VER=KBUILD_STR($(BB_VER))" -DBB_BT=AUTOCONF_TIMESTAMP \ | ||
14 | -Wall -Wstrict-prototypes -Wshadow -Werror \ | ||
15 | -funsigned-char -fno-builtin-strlen -finline-limit=0 -static-libgcc \ | ||
16 | -Os -march=i386 -mpreferred-stack-boundary=2 \ | ||
17 | -falign-functions=1 -falign-jumps=1 -falign-loops=1 \ | ||
18 | -fomit-frame-pointer -ffunction-sections -fdata-sections \ | ||
19 | -funsigned-char -fno-builtin-strlen \ | ||
diff --git a/Makefile.help b/Makefile.help new file mode 100644 index 000000000..3ba68d1e4 --- /dev/null +++ b/Makefile.help | |||
@@ -0,0 +1,88 @@ | |||
1 | ### Kernel's one: | ||
2 | ### help: | ||
3 | ### @echo 'Cleaning targets:' | ||
4 | ### @echo ' clean - remove most generated files but keep the config' | ||
5 | ### @echo ' mrproper - remove all generated files + config + various backup files' | ||
6 | ### @echo '' | ||
7 | ### @echo 'Configuration targets:' | ||
8 | ### @$(MAKE) -f $(srctree)/scripts/kconfig/Makefile help | ||
9 | ### @echo '' | ||
10 | ### @echo 'Other generic targets:' | ||
11 | ### @echo ' all - Build all targets marked with [*]' | ||
12 | ### @echo '* busybox - Build the bare kernel' | ||
13 | ### @echo '* modules - Build all modules' | ||
14 | ### @echo ' modules_install - Install all modules to INSTALL_MOD_PATH (default: /)' | ||
15 | ### @echo ' dir/ - Build all files in dir and below' | ||
16 | ### @echo ' dir/file.[ois] - Build specified target only' | ||
17 | ### @echo ' dir/file.ko - Build module including final link' | ||
18 | ### @echo ' rpm - Build a kernel as an RPM package' | ||
19 | ### @echo ' tags/TAGS - Generate tags file for editors' | ||
20 | ### @echo ' cscope - Generate cscope index' | ||
21 | ### @echo ' kernelrelease - Output the release version string' | ||
22 | ### @echo ' kernelversion - Output the version stored in Makefile' | ||
23 | ### @echo '' | ||
24 | ### @echo 'Static analysers' | ||
25 | ### @echo ' checkstack - Generate a list of stack hogs' | ||
26 | ### @echo ' namespacecheck - Name space analysis on compiled kernel' | ||
27 | ### @echo '' | ||
28 | ### @echo 'Kernel packaging:' | ||
29 | ### @$(MAKE) $(build)=$(package-dir) help | ||
30 | ### @echo '' | ||
31 | ### @echo 'Documentation targets:' | ||
32 | ### @$(MAKE) -f $(srctree)/Documentation/DocBook/Makefile dochelp | ||
33 | ### @echo '' | ||
34 | ### @echo 'Architecture specific targets ($(ARCH)):' | ||
35 | ### @$(if $(archhelp),$(archhelp),\ | ||
36 | ### echo ' No architecture specific help defined for $(ARCH)') | ||
37 | ### @echo '' | ||
38 | ### @$(if $(boards), \ | ||
39 | ### $(foreach b, $(boards), \ | ||
40 | ### printf " %-24s - Build for %s\\n" $(b) $(subst _defconfig,,$(b));) \ | ||
41 | ### echo '') | ||
42 | ### | ||
43 | ### @echo ' make V=0|1 [targets] 0 => quiet build (default), 1 => verbose build' | ||
44 | ### @echo ' make O=dir [targets] Locate all output files in "dir", including .config' | ||
45 | ### @echo ' make C=1 [targets] Check all c source with $$CHECK (sparse)' | ||
46 | ### @echo ' make C=2 [targets] Force check of all c source with $$CHECK (sparse)' | ||
47 | ### @echo '' | ||
48 | ### @echo 'Execute "make" or "make all" to build all targets marked with [*] ' | ||
49 | ### @echo 'For further info see the ./README file' | ||
50 | |||
51 | help: | ||
52 | @echo 'Cleaning:' | ||
53 | @echo ' clean - delete temporary files created by build' | ||
54 | @echo ' distclean - delete all non-source files (including .config)' | ||
55 | @echo | ||
56 | @echo 'Build:' | ||
57 | @echo ' all - Executable and documentation' | ||
58 | @echo ' busybox - the swiss-army executable' | ||
59 | @echo ' doc - docs/BusyBox.{txt,html,1}' | ||
60 | @echo ' html - create html-based cross-reference' | ||
61 | @echo | ||
62 | @echo 'Configuration:' | ||
63 | @echo ' allnoconfig - disable all symbols in .config' | ||
64 | @echo ' allyesconfig - enable all symbols in .config (see defconfig)' | ||
65 | @echo ' allbareconfig - enable all applets without any sub-features' | ||
66 | @echo ' config - text based configurator (of last resort)' | ||
67 | @echo ' defconfig - set .config to largest generic configuration' | ||
68 | @echo ' menuconfig - interactive curses-based configurator' | ||
69 | @echo ' oldconfig - resolve any unresolved symbols in .config' | ||
70 | @echo ' hosttools - build sed for the host.' | ||
71 | @echo ' You can use these commands if the commands on the host' | ||
72 | @echo ' is unusable. Afterwards use it like:' | ||
73 | @echo ' make SED="$(objtree)/sed"' | ||
74 | @echo | ||
75 | @echo 'Installation:' | ||
76 | @echo ' install - install busybox into $(PREFIX)' | ||
77 | @echo ' uninstall' | ||
78 | @echo | ||
79 | @echo 'Development:' | ||
80 | @echo ' baseline - create busybox_old for bloatcheck.' | ||
81 | @echo ' bloatcheck - show size difference between old and new versions' | ||
82 | @echo ' check - run the test suite for all applets' | ||
83 | @echo ' checkhelp - check for missing help-entries in Config.in' | ||
84 | @echo ' randconfig - generate a random configuration' | ||
85 | @echo ' release - create a distribution tarball' | ||
86 | @echo ' sizes - show size of all enabled busybox symbols' | ||
87 | @echo ' objsizes - show size of each .o object built' | ||
88 | @echo | ||
diff --git a/Rules.mak b/Rules.mak deleted file mode 100644 index e0704989b..000000000 --- a/Rules.mak +++ /dev/null | |||
@@ -1,436 +0,0 @@ | |||
1 | # Rules.make for busybox | ||
2 | # | ||
3 | # Copyright (C) 1999-2005 by Erik Andersen <andersen@codepoet.org> | ||
4 | # | ||
5 | # Licensed under GPLv2, see the file LICENSE in this tarball for details. | ||
6 | # | ||
7 | |||
8 | # Pull in the user's busybox configuration | ||
9 | ifeq ($(filter $(noconfig_targets),$(MAKECMDGOALS)),) | ||
10 | -include $(top_builddir)/.config | ||
11 | endif | ||
12 | |||
13 | #-------------------------------------------------------- | ||
14 | PROG := busybox | ||
15 | MAJOR_VERSION :=1 | ||
16 | MINOR_VERSION :=2 | ||
17 | SUBLEVEL_VERSION:=0 | ||
18 | EXTRAVERSION :=-svn | ||
19 | VERSION :=$(MAJOR_VERSION).$(MINOR_VERSION).$(SUBLEVEL_VERSION)$(EXTRAVERSION) | ||
20 | BUILDTIME := $(shell TZ=UTC date -u "+%Y.%m.%d-%H:%M%z") | ||
21 | |||
22 | |||
23 | #-------------------------------------------------------- | ||
24 | # With a modern GNU make(1) (highly recommended, that's what all the | ||
25 | # developers use), all of the following configuration values can be | ||
26 | # overridden at the command line. For example: | ||
27 | # make CROSS_COMPILE=powerpc-linux- top_srcdir="$HOME/busybox" PREFIX=/mnt/app | ||
28 | #-------------------------------------------------------- | ||
29 | |||
30 | # If you are running a cross compiler, you will want to set CROSS_COMPILE | ||
31 | # to something more interesting... Target architecture is determined | ||
32 | # by asking the CC compiler what arch it compiles things for, so unless | ||
33 | # your compiler is broken, you should not need to specify TARGET_ARCH | ||
34 | CC = $(CROSS_COMPILE)gcc | ||
35 | AR = $(CROSS_COMPILE)ar | ||
36 | AS = $(CROSS_COMPILE)as | ||
37 | LD = $(CROSS_COMPILE)ld | ||
38 | NM = $(CROSS_COMPILE)nm | ||
39 | STRIP = $(CROSS_COMPILE)strip | ||
40 | ELF2FLT = $(CROSS_COMPILE)elf2flt | ||
41 | CPP = $(CC) -E | ||
42 | SED ?= sed | ||
43 | BZIP2 ?= bzip2 | ||
44 | |||
45 | |||
46 | # What OS are you compiling busybox for? This allows you to include | ||
47 | # OS specific things, syscall overrides, etc. | ||
48 | TARGET_OS=linux | ||
49 | |||
50 | # Ensure consistent sort order, 'gcc -print-search-dirs' behavior, etc. | ||
51 | LC_ALL:= C | ||
52 | |||
53 | # This must bind late because srcdir is reset for every source subdirectory. | ||
54 | INCS:=-I$(top_builddir)/include -I$(top_srcdir)/include | ||
55 | CFLAGS=$(INCS) -I$(srcdir) -D_GNU_SOURCE | ||
56 | CFLAGS+=$(CHECKED_CFLAGS) | ||
57 | ARFLAGS=cru | ||
58 | |||
59 | # gcc centric. Perhaps fiddle with findstring gcc,$(CC) for the rest | ||
60 | # get the CC MAJOR/MINOR version | ||
61 | CC_MAJOR:=$(shell printf "%02d" $(shell echo __GNUC__ | $(CC) -E -xc - | tail -n 1)) | ||
62 | CC_MINOR:=$(shell printf "%02d" $(shell echo __GNUC_MINOR__ | $(CC) -E -xc - | tail -n 1)) | ||
63 | |||
64 | #-------------------------------------------------------- | ||
65 | export VERSION BUILDTIME HOSTCC HOSTCFLAGS CROSS_COMPILE CC AR AS LD NM STRIP CPP | ||
66 | ifeq ($(strip $(TARGET_ARCH)),) | ||
67 | TARGET_ARCH:=$(shell $(CC) -dumpmachine | $(SED) -e s'/-.*//' \ | ||
68 | -e 's/i.86/i386/' \ | ||
69 | -e 's/sparc.*/sparc/' \ | ||
70 | -e 's/arm.*/arm/g' \ | ||
71 | -e 's/m68k.*/m68k/' \ | ||
72 | -e 's/ppc/powerpc/g' \ | ||
73 | -e 's/v850.*/v850/g' \ | ||
74 | -e 's/sh[234]/sh/' \ | ||
75 | -e 's/mips-.*/mips/' \ | ||
76 | -e 's/mipsel-.*/mipsel/' \ | ||
77 | -e 's/cris.*/cris/' \ | ||
78 | ) | ||
79 | endif | ||
80 | |||
81 | # A nifty macro to make testing gcc features easier, but note that everything | ||
82 | # that uses this _must_ use := or it will be re-evaluated everytime it is | ||
83 | # referenced. | ||
84 | ifeq ($(strip $(BUILD_VERBOSE)),2) | ||
85 | VERBOSE_CHECK_CC=echo CC=\"$(1)\" check_cc $(2) >&2; | ||
86 | endif | ||
87 | check_cc=$(shell \ | ||
88 | $(VERBOSE_CHECK_CC) \ | ||
89 | if [ "x$(1)" != "x" ] && [ "x$(2)" != "x" ]; then \ | ||
90 | echo "int i;" > ./conftest.c; \ | ||
91 | if $(1) $(2) -c -o conftest.o conftest.c > /dev/null 2>&1; \ | ||
92 | then echo "$(2)"; else echo "$(3)"; fi ; \ | ||
93 | rm -f conftest.c conftest.o; \ | ||
94 | fi) | ||
95 | |||
96 | ifneq ($(filter $(nocheck_targets),$(MAKECMDGOALS)),) | ||
97 | check_cc:= | ||
98 | endif | ||
99 | |||
100 | # A not very robust macro to check for available ld flags | ||
101 | ifeq ($(strip $(BUILD_VERBOSE)),2) | ||
102 | VERBOSE_CHECK_LD=echo LD=\"$(1)\" check_ld $(2) >&2; | ||
103 | endif | ||
104 | check_ld=$(shell \ | ||
105 | $(VERBOSE_CHECK_LD) \ | ||
106 | if [ "x$(1)" != "x" ] && [ "x$(2)" != "x" ]; then \ | ||
107 | $(1) -o /dev/null -b binary /dev/null > /dev/null 2>&1 && \ | ||
108 | echo "-Wl,$(2)" ; \ | ||
109 | fi) | ||
110 | |||
111 | ifneq ($(filter $(nocheck_targets),$(MAKECMDGOALS)),) | ||
112 | check_ld:= | ||
113 | endif | ||
114 | |||
115 | # A not very robust macro to check for available strip flags | ||
116 | ifeq ($(strip $(BUILD_VERBOSE)),2) | ||
117 | VERBOSE_CHECK_STRIP=echo STRIPCMD=\"$(1)\" check_strip $(2) >&2; | ||
118 | endif | ||
119 | check_strip=$(shell \ | ||
120 | $(VERBOSE_CHECK_STRIP) \ | ||
121 | if [ "x$(1)" != "x" ] && [ "x$(2)" != "x" ]; then \ | ||
122 | echo "int i;" > ./conftest.c ; \ | ||
123 | $(CC) -c -o conftest.o conftest.c > /dev/null 2>&1 ; \ | ||
124 | $(1) $(2) conftest.o > /dev/null 2>&1 && \ | ||
125 | echo "$(1) $(2)" || echo "$(3)"; \ | ||
126 | rm -f conftest.c conftest.o > /dev/null 2>&1 ; \ | ||
127 | fi) | ||
128 | |||
129 | ifneq ($(filter $(nocheck_targets),$(MAKECMDGOALS)),) | ||
130 | check_strip:= | ||
131 | endif | ||
132 | |||
133 | |||
134 | # Select the compiler needed to build binaries for your development system | ||
135 | HOSTCC = gcc | ||
136 | HOSTCFLAGS:=$(call check_cc,$(HOSTCC),-Wall,) | ||
137 | HOSTCFLAGS+=$(call check_cc,$(HOSTCC),-Wstrict-prototypes,) | ||
138 | HOSTCFLAGS+=$(call check_cc,$(HOSTCC),-O2,) | ||
139 | HOSTCFLAGS+=$(call check_cc,$(HOSTCC),-fomit-frame-pointer,) | ||
140 | |||
141 | LD_WHOLE_ARCHIVE:=$(shell echo "int i;" > conftest.c ; \ | ||
142 | $(CC) -c -o conftest.o conftest.c ; \ | ||
143 | echo "int main(void){return 0;}" > conftest_main.c ; \ | ||
144 | $(CC) -c -o conftest_main.o conftest_main.c ; \ | ||
145 | $(AR) $(ARFLAGS) conftest.a conftest.o ; \ | ||
146 | $(CC) -Wl,--whole-archive conftest.a -Wl,--no-whole-archive \ | ||
147 | conftest_main.o -o conftest > /dev/null 2>&1 \ | ||
148 | && echo "-Wl,--whole-archive" ; \ | ||
149 | rm conftest_main.o conftest_main.c conftest.o conftest.c \ | ||
150 | conftest.a conftest > /dev/null 2>&1 ; ) | ||
151 | ifneq ($(findstring whole-archive,$(LD_WHOLE_ARCHIVE)),) | ||
152 | LD_NO_WHOLE_ARCHIVE:= -Wl,--no-whole-archive | ||
153 | endif | ||
154 | |||
155 | LD_START_GROUP:=$(shell echo "int bar(void){return 0;}" > conftest.c ; \ | ||
156 | $(CC) -c -o conftest.o conftest.c ; \ | ||
157 | echo "int main(void){return bar();}" > conftest_main.c ; \ | ||
158 | $(CC) -c -o conftest_main.o conftest_main.c ; \ | ||
159 | $(AR) $(ARFLAGS) conftest.a conftest.o ; \ | ||
160 | $(CC) -Wl,--start-group conftest.a conftest_main.o -Wl,--end-group \ | ||
161 | -o conftest > /dev/null 2>&1 && echo "-Wl,--start-group" ; \ | ||
162 | rm conftest_main.o conftest_main.c conftest.o conftest.c \ | ||
163 | conftest.a conftest > /dev/null 2>&1 ; ) | ||
164 | ifneq ($(findstring start-group,$(LD_START_GROUP)),) | ||
165 | LD_END_GROUP:= -Wl,--end-group | ||
166 | endif | ||
167 | |||
168 | CHECKED_LDFLAGS := $(call check_ld,$(LD),--warn-common,) | ||
169 | #CHECKED_LDFLAGS := $(call check_ld,$(LD),-static-libgcc,) | ||
170 | |||
171 | # Pin CHECKED_CFLAGS with := so it's only evaluated once. | ||
172 | CHECKED_CFLAGS:=$(call check_cc,$(CC),-Wall,) | ||
173 | CHECKED_CFLAGS+=$(call check_cc,$(CC),-Wstrict-prototypes,) | ||
174 | CHECKED_CFLAGS+=$(call check_cc,$(CC),-Wshadow,) | ||
175 | CHECKED_CFLAGS+=$(call check_cc,$(CC),-funsigned-char,) | ||
176 | CHECKED_CFLAGS+=$(call check_cc,$(CC),-fno-builtin-strlen,) | ||
177 | CHECKED_CFLAGS+=$(call check_cc,$(CC),-finline-limit=0,) | ||
178 | |||
179 | # gcc 2.95 exits with 0 for "unrecognized option" | ||
180 | ifeq ($(strip $(shell [ $(CC_MAJOR) -ge 3 ] ; echo $$?)),0) | ||
181 | CHECKED_CFLAGS+=$(call check_cc,$(CC),-static-libgcc,) | ||
182 | endif | ||
183 | |||
184 | # Preemptively pin this too. | ||
185 | PROG_CFLAGS:= | ||
186 | |||
187 | |||
188 | #-------------------------------------------------------- | ||
189 | # Arch specific compiler optimization stuff should go here. | ||
190 | # Unless you want to override the defaults, do not set anything | ||
191 | # for OPTIMIZATION... | ||
192 | |||
193 | # use '-Os' optimization if available, else use -O2 | ||
194 | OPTIMIZATION:=$(call check_cc,$(CC),-Os,-O2) | ||
195 | |||
196 | ifeq ($(CONFIG_BUILD_AT_ONCE),y) | ||
197 | # gcc 2.95 exits with 0 for "unrecognized option" | ||
198 | ifeq ($(strip $(shell [ $(CC_MAJOR) -ge 3 ] ; echo $$?)),0) | ||
199 | CFLAGS_COMBINE:=$(call check_cc,$(CC),--combine,) | ||
200 | endif | ||
201 | OPTIMIZATION+=$(call check_cc,$(CC),-funit-at-a-time,) | ||
202 | OPTIMIZATION+=$(call check_cc,$(CC),-fgcse-after-reload,) | ||
203 | ifneq ($(CONFIG_BUILD_LIBBUSYBOX),y) | ||
204 | # http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25795 | ||
205 | # This prevents us from using -fwhole-program when we build the lib | ||
206 | PROG_CFLAGS+=$(call check_cc,$(CC),-fwhole-program,) | ||
207 | endif # CONFIG_BUILD_LIBBUSYBOX | ||
208 | endif # CONFIG_BUILD_AT_ONCE | ||
209 | |||
210 | LIB_LDFLAGS:=$(call check_ld,$(LD),--enable-new-dtags,) | ||
211 | #LIB_LDFLAGS+=$(call check_ld,$(LD),--reduce-memory-overheads,) | ||
212 | #LIB_LDFLAGS+=$(call check_ld,$(LD),--as-needed,) | ||
213 | #LIB_LDFLAGS+=$(call check_ld,$(LD),--warn-shared-textrel,) | ||
214 | |||
215 | |||
216 | # Some nice architecture specific optimizations | ||
217 | ifeq ($(strip $(TARGET_ARCH)),arm) | ||
218 | OPTIMIZATION+=-fstrict-aliasing | ||
219 | endif | ||
220 | ifeq ($(strip $(TARGET_ARCH)),i386) | ||
221 | OPTIMIZATION+=$(call check_cc,$(CC),-march=i386,) | ||
222 | # gcc-4.0 and older seem to benefit from these | ||
223 | ifneq ($(strip $(shell [ $(CC_MAJOR) -ge 4 -a $(CC_MINOR) -ge 1 ] ; echo $$?)),0) | ||
224 | OPTIMIZATION+=$(call check_cc,$(CC),-mpreferred-stack-boundary=2,) | ||
225 | OPTIMIZATION+=$(call check_cc,$(CC),-falign-functions=1 -falign-jumps=1 -falign-loops=1, -malign-functions=0 -malign-jumps=0 -malign-loops=0,) | ||
226 | |||
227 | # gcc 4.1 produces many broken, totally invalid warnings | ||
228 | CHECKED_CFLAGS+=$(call check_cc,$(CC),-Werror,) | ||
229 | endif # gcc-4.0 and older | ||
230 | |||
231 | # gcc-4.1 and beyond seem to benefit from these | ||
232 | ifeq ($(strip $(shell [ $(CC_MAJOR) -ge 4 -a $(CC_MINOR) -ge 1 ] ; echo $$?)),0) | ||
233 | # turn off flags which hurt -Os | ||
234 | OPTIMIZATION+=$(call check_cc,$(CC),-fno-tree-loop-optimize,) | ||
235 | OPTIMIZATION+=$(call check_cc,$(CC),-fno-tree-dominator-opts,) | ||
236 | OPTIMIZATION+=$(call check_cc,$(CC),-fno-strength-reduce,) | ||
237 | |||
238 | OPTIMIZATION+=$(call check_cc,$(CC),-fno-branch-count-reg,) | ||
239 | endif # gcc-4.1 and beyond | ||
240 | endif | ||
241 | OPTIMIZATION+=$(call check_cc,$(CC),-fomit-frame-pointer,) | ||
242 | CHECKED_LDFLAGS += $(call check_ld,$(LD),--sort-common,) | ||
243 | |||
244 | # | ||
245 | #-------------------------------------------------------- | ||
246 | # If you're going to do a lot of builds with a non-vanilla configuration, | ||
247 | # it makes sense to adjust parameters above, so you can type "make" | ||
248 | # by itself, instead of following it by the same half-dozen overrides | ||
249 | # every time. The stuff below, on the other hand, is probably less | ||
250 | # prone to casual user adjustment. | ||
251 | # | ||
252 | |||
253 | ifeq ($(strip $(CONFIG_LFS)),y) | ||
254 | # For large file summit support | ||
255 | CFLAGS+=-D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 | ||
256 | endif | ||
257 | ifeq ($(strip $(CONFIG_DMALLOC)),y) | ||
258 | # For testing mem leaks with dmalloc | ||
259 | CFLAGS+=-DDMALLOC | ||
260 | LIBRARIES:=-ldmalloc | ||
261 | else | ||
262 | ifeq ($(strip $(CONFIG_EFENCE)),y) | ||
263 | LIBRARIES:=-lefence | ||
264 | endif | ||
265 | endif | ||
266 | |||
267 | # Debugging info | ||
268 | |||
269 | ifeq ($(strip $(CONFIG_DEBUG)),y) | ||
270 | CFLAGS +=-g | ||
271 | else | ||
272 | CFLAGS +=-DNDEBUG | ||
273 | endif | ||
274 | |||
275 | ifneq ($(strip $(CONFIG_DEBUG_PESSIMIZE)),y) | ||
276 | CFLAGS += $(OPTIMIZATION) | ||
277 | endif | ||
278 | |||
279 | # warn a bit more verbosely for non-release versions | ||
280 | ifneq ($(EXTRAVERSION),) | ||
281 | CHECKED_CFLAGS+=$(call check_cc,$(CC),-Wstrict-prototypes,) | ||
282 | CHECKED_CFLAGS+=$(call check_cc,$(CC),-Wmissing-prototypes,) | ||
283 | CHECKED_CFLAGS+=$(call check_cc,$(CC),-Wmissing-declarations,) | ||
284 | CHECKED_CFLAGS+=$(call check_cc,$(CC),-Wunused,) | ||
285 | CHECKED_CFLAGS+=$(call check_cc,$(CC),-Winit-self,) | ||
286 | CHECKED_CFLAGS+=$(call check_cc,$(CC),-Wshadow,) | ||
287 | CHECKED_CFLAGS+=$(call check_cc,$(CC),-Wcast-align,) | ||
288 | endif | ||
289 | STRIPCMD:=$(call check_strip,$(STRIP),-s --remove-section=.note --remove-section=.comment,$(STRIP)) | ||
290 | ifeq ($(strip $(CONFIG_STATIC)),y) | ||
291 | PROG_CFLAGS += $(call check_cc,$(CC),-static,) | ||
292 | else | ||
293 | ifneq ($(strip $(CONFIG_DEBUG)),y) | ||
294 | OPTIMIZATION+=$(call check_cc,$(CC),-ffunction-sections -fdata-sections,) | ||
295 | CHECKED_LDFLAGS += $(call check_ld,$(LD),--gc-sections,) | ||
296 | endif | ||
297 | endif | ||
298 | CFLAGS_SHARED := $(call check_cc,$(CC),-shared,) | ||
299 | LIB_CFLAGS+=$(CFLAGS_SHARED) | ||
300 | |||
301 | ifeq ($(strip $(CONFIG_BUILD_LIBBUSYBOX)),y) | ||
302 | CFLAGS_PIC:= $(call check_cc,$(CC),-fPIC,) | ||
303 | LIB_CFLAGS+=$(CFLAGS_PIC) | ||
304 | endif | ||
305 | |||
306 | ifeq ($(strip $(CONFIG_SELINUX)),y) | ||
307 | LIBRARIES += -lselinux -lsepol | ||
308 | endif | ||
309 | |||
310 | ifeq ($(strip $(PREFIX)),) | ||
311 | PREFIX:=`pwd`/_install | ||
312 | endif | ||
313 | |||
314 | ifneq ($(strip $(CONFIG_GETOPT_LONG)),y) | ||
315 | CFLAGS += -D__need_getopt | ||
316 | endif | ||
317 | |||
318 | # Additional complications due to support for pristine source dir. | ||
319 | # Include files in the build directory should take precedence over | ||
320 | # the copy in top_srcdir, both during the compilation phase and the | ||
321 | # shell script that finds the list of object files. | ||
322 | # Work in progress by <ldoolitt@recycle.lbl.gov>. | ||
323 | |||
324 | |||
325 | OBJECTS:=$(APPLET_SOURCES:.c=.o) busybox.o usage.o applets.o | ||
326 | CFLAGS += $(CHECKED_CFLAGS) $(CROSS_CFLAGS) | ||
327 | LDFLAGS += $(CHECKED_LDFLAGS) | ||
328 | |||
329 | ifdef BB_INIT_SCRIPT | ||
330 | CFLAGS += -DINIT_SCRIPT='"$(BB_INIT_SCRIPT)"' | ||
331 | endif | ||
332 | |||
333 | # Put user-supplied flags at the end, where they | ||
334 | # have a chance of winning. | ||
335 | -include $(top_builddir)/.config.mak | ||
336 | |||
337 | #------------------------------------------------------------ | ||
338 | # Installation options | ||
339 | ifeq ($(strip $(CONFIG_INSTALL_APPLET_HARDLINKS)),y) | ||
340 | INSTALL_OPTS=--hardlinks | ||
341 | endif | ||
342 | ifeq ($(strip $(CONFIG_INSTALL_APPLET_SYMLINKS)),y) | ||
343 | INSTALL_OPTS=--symlinks | ||
344 | endif | ||
345 | ifeq ($(strip $(CONFIG_INSTALL_APPLET_DONT)),y) | ||
346 | INSTALL_OPTS= | ||
347 | endif | ||
348 | |||
349 | #------------------------------------------------------------ | ||
350 | # Make the output nice and tight | ||
351 | MAKEFLAGS += --no-print-directory | ||
352 | export MAKE_IS_SILENT=n | ||
353 | ifneq ($(findstring s,$(MAKEFLAGS)),) | ||
354 | export MAKE_IS_SILENT=y | ||
355 | SECHO := @-false | ||
356 | DISP := sil | ||
357 | Q := @ | ||
358 | else | ||
359 | ifneq ($(BUILD_VERBOSE),) | ||
360 | SECHO := @-false | ||
361 | DISP := ver | ||
362 | Q := | ||
363 | else | ||
364 | SECHO := @echo | ||
365 | DISP := pur | ||
366 | Q := @ | ||
367 | endif | ||
368 | endif | ||
369 | |||
370 | show_objs = $(subst $(top_builddir)/,,$(subst ../,,$@)) | ||
371 | pur_disp_compile.c = echo " "CC $(show_objs) ; | ||
372 | pur_disp_compile.h = echo " "HOSTCC $(show_objs) ; | ||
373 | pur_disp_strip = echo " "STRIP $(show_objs) ; | ||
374 | pur_disp_link = echo " "LINK $(show_objs) ; | ||
375 | pur_disp_link.h = echo " "HOSTLINK $(show_objs) ; | ||
376 | pur_disp_ar = echo " "AR $(ARFLAGS) $(show_objs) ; | ||
377 | pur_disp_elf2flt = echo " "ELF2FLT $(ELF2FLTFLAGS) $(show_objs) ; | ||
378 | sil_disp_compile.c = | ||
379 | sil_disp_compile.h = | ||
380 | sil_disp_strip = | ||
381 | sil_disp_link = | ||
382 | sil_disp_link.h = | ||
383 | sil_disp_ar = | ||
384 | sil_disp_elf2flt = | ||
385 | ver_disp_compile.c = | ||
386 | ver_disp_compile.h = | ||
387 | ver_disp_strip = | ||
388 | ver_disp_link = | ||
389 | ver_disp_link.h = | ||
390 | ver_disp_ar = | ||
391 | ver_disp_elf2flt = | ||
392 | disp_compile.c = $(Q)$($(DISP)_disp_compile.c) | ||
393 | disp_compile.h = $(Q)$($(DISP)_disp_compile.h) | ||
394 | disp_strip = $(Q)$($(DISP)_disp_strip) | ||
395 | disp_link = $(Q)$($(DISP)_disp_link) | ||
396 | disp_link.h = $(Q)$($(DISP)_disp_link.h) | ||
397 | disp_ar = $(Q)$($(DISP)_disp_ar) | ||
398 | disp_elf2flt = $(Q)$($(DISP)_disp_elf2flt) | ||
399 | disp_gen = $(SECHO) " "GEN $@ ; true | ||
400 | disp_doc = $(SECHO) " "DOC $(subst docs/,,$@) ; true | ||
401 | cmd_compile.c = $(CC) $(CFLAGS) $(EXTRA_CFLAGS) -c -o $@ $< | ||
402 | cmd_compile.h = $(HOSTCC) $(HOSTCFLAGS) $(INCS) -c -o $@ $< | ||
403 | cmd_strip = $(STRIPCMD) $@ | ||
404 | cmd_link = $(CC) $(CFLAGS) $(EXTRA_CFLAGS) $(LDFLAGS) \ | ||
405 | $(PROG_CFLAGS) $(PROG_LDFLAGS) $(CFLAGS_COMBINE) \ | ||
406 | -o $@ $(LD_START_GROUP) \ | ||
407 | $(APPLETS_DEFINE) $(APPLET_SRC) \ | ||
408 | $(BUSYBOX_DEFINE) $(BUSYBOX_SRC) $(libraries-y) \ | ||
409 | $(LDBUSYBOX) $(LIBRARIES) \ | ||
410 | $(LD_END_GROUP) | ||
411 | cmd_link.so = $(CC) $(CFLAGS) $(EXTRA_CFLAGS) $(LDFLAGS) \ | ||
412 | $(LIB_CFLAGS) $(CFLAGS_COMBINE) $(LIB_LDFLAGS) \ | ||
413 | -o $(@) $(LD_START_GROUP) $(LD_WHOLE_ARCHIVE) \ | ||
414 | $(LIBRARY_DEFINE) $(^) \ | ||
415 | $(LD_NO_WHOLE_ARCHIVE) $(LD_END_GROUP) | ||
416 | cmd_link.h = $(HOSTCC) $(HOSTCFLAGS) $(INCS) $< -o $@ | ||
417 | cmd_ar = $(AR) $(ARFLAGS) $@ $^ | ||
418 | cmd_elf2flt = $(ELF2FLT) $(ELF2FLTFLAGS) $< -o $@ | ||
419 | compile.c = $(disp_compile.c) $(cmd_compile.c) | ||
420 | compile.h = $(disp_compile.h) $(cmd_compile.h) | ||
421 | do_strip = $(disp_strip) $(cmd_strip) | ||
422 | do_link = $(disp_link) $(cmd_link) | ||
423 | do_link.so = $(disp_link) $(cmd_link.so) | ||
424 | do_link.h = $(disp_link.h) $(cmd_link.h) | ||
425 | do_ar = $(disp_ar) $(cmd_ar) | ||
426 | do_elf2flt = $(disp_elf2flt) $(cmd_elf2flt) | ||
427 | |||
428 | uppercase = $(shell echo $1 | $(SED) -e "y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/") | ||
429 | %.a: | ||
430 | @if test -z "$($(call uppercase,$*)_DIR)" ; then \ | ||
431 | echo "Invalid target $@" ; \ | ||
432 | exit 1 ; \ | ||
433 | fi | ||
434 | $(Q)$(MAKE) $($(call uppercase,$*)_DIR)$@ | ||
435 | |||
436 | .PHONY: dummy | ||
diff --git a/applets/Kbuild b/applets/Kbuild new file mode 100644 index 000000000..04932eec4 --- /dev/null +++ b/applets/Kbuild | |||
@@ -0,0 +1,9 @@ | |||
1 | # Makefile for busybox | ||
2 | # | ||
3 | # Copyright (C) 1999-2005 by Erik Andersen <andersen@codepoet.org> | ||
4 | # | ||
5 | # Licensed under the GPL v2, see the file LICENSE in this tarball. | ||
6 | |||
7 | obj-y:= | ||
8 | obj-y += applets.o | ||
9 | obj-y += busybox.o | ||
diff --git a/applets/Makefile b/applets/Makefile deleted file mode 100644 index 0d892f5e5..000000000 --- a/applets/Makefile +++ /dev/null | |||
@@ -1,23 +0,0 @@ | |||
1 | # Makefile for busybox | ||
2 | # | ||
3 | # Copyright (C) 1999-2005 by Erik Andersen <andersen@codepoet.org> | ||
4 | # | ||
5 | # Licensed under the GPL v2, see the file LICENSE in this tarball. | ||
6 | |||
7 | ifndef top_srcdir | ||
8 | top_srcdir=.. | ||
9 | endif | ||
10 | ifndef top_builddir | ||
11 | top_builddir=.. | ||
12 | endif | ||
13 | srcdir=$(top_srcdir)/applets | ||
14 | APPLETS_DIR:=./ | ||
15 | include $(top_srcdir)/Rules.mak | ||
16 | include $(top_builddir)/.config | ||
17 | include $(srcdir)/Makefile.in | ||
18 | all: $(libraries-y) | ||
19 | -include $(top_builddir).depend | ||
20 | |||
21 | clean: | ||
22 | rm -f *.o *.a $(AR_TARGET) | ||
23 | |||
diff --git a/applets/Makefile.in b/applets/Makefile.in deleted file mode 100644 index 05580b9b4..000000000 --- a/applets/Makefile.in +++ /dev/null | |||
@@ -1,26 +0,0 @@ | |||
1 | # Makefile for busybox | ||
2 | # | ||
3 | # Copyright (C) 1999-2005 by Erik Andersen <andersen@codepoet.org> | ||
4 | # | ||
5 | # Licensed under the GPL v2, see the file LICENSE in this tarball. | ||
6 | |||
7 | APPLETS_AR:=applets.a | ||
8 | ifndef $(APPLETS_DIR) | ||
9 | APPLETS_DIR:=$(top_builddir)/applets/ | ||
10 | endif | ||
11 | srcdir=$(top_srcdir)/applets | ||
12 | |||
13 | APPLET_SRC:= $(patsubst %,$(srcdir)/%,applets.c busybox.c) | ||
14 | APPLET_OBJ:= $(patsubst $(srcdir)/%.c,$(APPLETS_DIR)%.o, $(APPLET_SRC)) | ||
15 | |||
16 | APPLET_SRC-y+=$(APPLET_SRC) | ||
17 | APPLET_SRC-a+=$(APPLET_SRC) | ||
18 | |||
19 | libraries-y+=$(APPLETS_DIR)$(APPLETS_AR) | ||
20 | |||
21 | $(APPLETS_DIR)$(APPLETS_AR): $(APPLET_OBJ) | ||
22 | $(do_ar) | ||
23 | |||
24 | $(APPLET_OBJ): $(top_builddir)/.config | ||
25 | $(APPLET_OBJ): $(APPLETS_DIR)%.o: $(srcdir)/%.c | ||
26 | $(compile.c) | ||
diff --git a/applets/applets.c b/applets/applets.c index d615ffcd8..b1f580953 100644 --- a/applets/applets.c +++ b/applets/applets.c | |||
@@ -42,8 +42,6 @@ const size_t NUM_APPLETS = (sizeof (applets) / sizeof (struct BB_applet) - 1); | |||
42 | #ifdef CONFIG_FEATURE_SUID_CONFIG | 42 | #ifdef CONFIG_FEATURE_SUID_CONFIG |
43 | 43 | ||
44 | #include <ctype.h> | 44 | #include <ctype.h> |
45 | #include "pwd_.h" | ||
46 | #include "grp_.h" | ||
47 | 45 | ||
48 | #define CONFIG_FILE "/etc/busybox.conf" | 46 | #define CONFIG_FILE "/etc/busybox.conf" |
49 | 47 | ||
diff --git a/archival/Config.in b/archival/Config.in index ea8076403..bc87573b1 100644 --- a/archival/Config.in +++ b/archival/Config.in | |||
@@ -5,7 +5,7 @@ | |||
5 | 5 | ||
6 | menu "Archival Utilities" | 6 | menu "Archival Utilities" |
7 | 7 | ||
8 | config CONFIG_AR | 8 | config AR |
9 | bool "ar" | 9 | bool "ar" |
10 | default n | 10 | default n |
11 | help | 11 | help |
@@ -28,17 +28,17 @@ config CONFIG_AR | |||
28 | Unless you have a specific application which requires ar, you should | 28 | Unless you have a specific application which requires ar, you should |
29 | probably say N here. | 29 | probably say N here. |
30 | 30 | ||
31 | config CONFIG_FEATURE_AR_LONG_FILENAMES | 31 | config FEATURE_AR_LONG_FILENAMES |
32 | bool "Enable support for long filenames (not need for debs)" | 32 | bool "Enable support for long filenames (not need for debs)" |
33 | default n | 33 | default n |
34 | depends on CONFIG_AR | 34 | depends on AR |
35 | help | 35 | help |
36 | By default the ar format can only store the first 15 characters of the | 36 | By default the ar format can only store the first 15 characters of the |
37 | filename, this option removes that limitation. | 37 | filename, this option removes that limitation. |
38 | It supports the GNU ar long filename method which moves multiple long | 38 | It supports the GNU ar long filename method which moves multiple long |
39 | filenames into a the data section of a new ar entry. | 39 | filenames into a the data section of a new ar entry. |
40 | 40 | ||
41 | config CONFIG_BUNZIP2 | 41 | config BUNZIP2 |
42 | bool "bunzip2" | 42 | bool "bunzip2" |
43 | default n | 43 | default n |
44 | help | 44 | help |
@@ -54,7 +54,7 @@ config CONFIG_BUNZIP2 | |||
54 | Unless you have a specific application which requires bunzip2, you | 54 | Unless you have a specific application which requires bunzip2, you |
55 | should probably say N here. | 55 | should probably say N here. |
56 | 56 | ||
57 | config CONFIG_CPIO | 57 | config CPIO |
58 | bool "cpio" | 58 | bool "cpio" |
59 | default n | 59 | default n |
60 | help | 60 | help |
@@ -68,7 +68,7 @@ config CONFIG_CPIO | |||
68 | Unless you have a specific application which requires cpio, you should | 68 | Unless you have a specific application which requires cpio, you should |
69 | probably say N here. | 69 | probably say N here. |
70 | 70 | ||
71 | config CONFIG_DPKG | 71 | config DPKG |
72 | bool "dpkg" | 72 | bool "dpkg" |
73 | default n | 73 | default n |
74 | help | 74 | help |
@@ -77,7 +77,7 @@ config CONFIG_DPKG | |||
77 | This implementation of dpkg has a number of limitations, you should use the | 77 | This implementation of dpkg has a number of limitations, you should use the |
78 | official dpkg if possible. | 78 | official dpkg if possible. |
79 | 79 | ||
80 | config CONFIG_DPKG_DEB | 80 | config DPKG_DEB |
81 | bool "dpkg_deb" | 81 | bool "dpkg_deb" |
82 | default n | 82 | default n |
83 | help | 83 | help |
@@ -88,16 +88,16 @@ config CONFIG_DPKG_DEB | |||
88 | Unless you have a specific application which requires dpkg-deb, you should | 88 | Unless you have a specific application which requires dpkg-deb, you should |
89 | probably say N here. | 89 | probably say N here. |
90 | 90 | ||
91 | config CONFIG_FEATURE_DPKG_DEB_EXTRACT_ONLY | 91 | config FEATURE_DPKG_DEB_EXTRACT_ONLY |
92 | bool "extract only (-x)" | 92 | bool "extract only (-x)" |
93 | default n | 93 | default n |
94 | depends on CONFIG_DPKG_DEB | 94 | depends on DPKG_DEB |
95 | help | 95 | help |
96 | This reduces dpkg-deb to the equivalent of "ar -p <deb> data.tar.gz | tar -zx". | 96 | This reduces dpkg-deb to the equivalent of "ar -p <deb> data.tar.gz | tar -zx". |
97 | However it saves space as none of the extra dpkg-deb, ar or tar options are | 97 | However it saves space as none of the extra dpkg-deb, ar or tar options are |
98 | needed, they are linked to internally. | 98 | needed, they are linked to internally. |
99 | 99 | ||
100 | config CONFIG_GUNZIP | 100 | config GUNZIP |
101 | bool "gunzip" | 101 | bool "gunzip" |
102 | default n | 102 | default n |
103 | help | 103 | help |
@@ -105,35 +105,35 @@ config CONFIG_GUNZIP | |||
105 | You can use the `-t' option to test the integrity of | 105 | You can use the `-t' option to test the integrity of |
106 | an archive, without decompressing it. | 106 | an archive, without decompressing it. |
107 | 107 | ||
108 | config CONFIG_FEATURE_GUNZIP_UNCOMPRESS | 108 | config FEATURE_GUNZIP_UNCOMPRESS |
109 | bool "Uncompress support" | 109 | bool "Uncompress support" |
110 | default n | 110 | default n |
111 | depends on CONFIG_GUNZIP | 111 | depends on GUNZIP |
112 | help | 112 | help |
113 | Enable if you want gunzip to have the ability to decompress | 113 | Enable if you want gunzip to have the ability to decompress |
114 | archives created by the program compress (not much | 114 | archives created by the program compress (not much |
115 | used anymore). | 115 | used anymore). |
116 | 116 | ||
117 | config CONFIG_GZIP | 117 | config GZIP |
118 | bool "gzip" | 118 | bool "gzip" |
119 | default n | 119 | default n |
120 | help | 120 | help |
121 | gzip is used to compress files. | 121 | gzip is used to compress files. |
122 | It's probably the most widely used UNIX compression program. | 122 | It's probably the most widely used UNIX compression program. |
123 | 123 | ||
124 | config CONFIG_RPM2CPIO | 124 | config RPM2CPIO |
125 | bool "rpm2cpio" | 125 | bool "rpm2cpio" |
126 | default n | 126 | default n |
127 | help | 127 | help |
128 | Converts an RPM file into a CPIO archive. | 128 | Converts an RPM file into a CPIO archive. |
129 | 129 | ||
130 | config CONFIG_RPM | 130 | config RPM |
131 | bool "rpm" | 131 | bool "rpm" |
132 | default n | 132 | default n |
133 | help | 133 | help |
134 | Mini RPM applet - queries and extracts | 134 | Mini RPM applet - queries and extracts |
135 | 135 | ||
136 | config CONFIG_TAR | 136 | config TAR |
137 | bool "tar" | 137 | bool "tar" |
138 | default n | 138 | default n |
139 | help | 139 | help |
@@ -141,86 +141,86 @@ config CONFIG_TAR | |||
141 | create compressed archives. It's probably the most widely used | 141 | create compressed archives. It's probably the most widely used |
142 | UNIX archive program. | 142 | UNIX archive program. |
143 | 143 | ||
144 | config CONFIG_FEATURE_TAR_CREATE | 144 | config FEATURE_TAR_CREATE |
145 | bool "Enable archive creation" | 145 | bool "Enable archive creation" |
146 | default y | 146 | default y |
147 | depends on CONFIG_TAR | 147 | depends on TAR |
148 | help | 148 | help |
149 | If you enable this option you'll be able to create | 149 | If you enable this option you'll be able to create |
150 | tar archives using the `-c' option. | 150 | tar archives using the `-c' option. |
151 | 151 | ||
152 | config CONFIG_FEATURE_TAR_BZIP2 | 152 | config FEATURE_TAR_BZIP2 |
153 | bool "Enable -j option to handle .tar.bz2 files" | 153 | bool "Enable -j option to handle .tar.bz2 files" |
154 | default n | 154 | default n |
155 | depends on CONFIG_TAR | 155 | depends on TAR |
156 | help | 156 | help |
157 | If you enable this option you'll be able to extract | 157 | If you enable this option you'll be able to extract |
158 | archives compressed with bzip2. | 158 | archives compressed with bzip2. |
159 | 159 | ||
160 | config CONFIG_FEATURE_TAR_LZMA | 160 | config FEATURE_TAR_LZMA |
161 | bool "Enable -a option to handle .tar.lzma files" | 161 | bool "Enable -a option to handle .tar.lzma files" |
162 | default n | 162 | default n |
163 | depends on CONFIG_TAR | 163 | depends on TAR |
164 | help | 164 | help |
165 | If you enable this option you'll be able to extract | 165 | If you enable this option you'll be able to extract |
166 | archives compressed with lzma. | 166 | archives compressed with lzma. |
167 | 167 | ||
168 | config CONFIG_FEATURE_TAR_FROM | 168 | config FEATURE_TAR_FROM |
169 | bool "Enable -X (exclude from) and -T (include from) options)" | 169 | bool "Enable -X (exclude from) and -T (include from) options)" |
170 | default n | 170 | default n |
171 | depends on CONFIG_TAR | 171 | depends on TAR |
172 | help | 172 | help |
173 | If you enable this option you'll be able to specify | 173 | If you enable this option you'll be able to specify |
174 | a list of files to include or exclude from an archive. | 174 | a list of files to include or exclude from an archive. |
175 | 175 | ||
176 | config CONFIG_FEATURE_TAR_GZIP | 176 | config FEATURE_TAR_GZIP |
177 | bool "Enable -z option" | 177 | bool "Enable -z option" |
178 | default y | 178 | default y |
179 | depends on CONFIG_TAR | 179 | depends on TAR |
180 | help | 180 | help |
181 | If you enable this option tar will be able to call gzip, | 181 | If you enable this option tar will be able to call gzip, |
182 | when creating or extracting tar gziped archives. | 182 | when creating or extracting tar gziped archives. |
183 | 183 | ||
184 | config CONFIG_FEATURE_TAR_COMPRESS | 184 | config FEATURE_TAR_COMPRESS |
185 | bool "Enable -Z option" | 185 | bool "Enable -Z option" |
186 | default n | 186 | default n |
187 | depends on CONFIG_TAR | 187 | depends on TAR |
188 | help | 188 | help |
189 | If you enable this option tar will be able to call uncompress, | 189 | If you enable this option tar will be able to call uncompress, |
190 | when extracting .tar.Z archives. | 190 | when extracting .tar.Z archives. |
191 | 191 | ||
192 | config CONFIG_FEATURE_TAR_OLDGNU_COMPATIBILITY | 192 | config FEATURE_TAR_OLDGNU_COMPATIBILITY |
193 | bool "Enable support for old tar header format" | 193 | bool "Enable support for old tar header format" |
194 | default N | 194 | default N |
195 | depends on CONFIG_TAR | 195 | depends on TAR |
196 | help | 196 | help |
197 | This option is required to unpack archives created in | 197 | This option is required to unpack archives created in |
198 | the old GNU format; help to kill this old format by | 198 | the old GNU format; help to kill this old format by |
199 | repacking your ancient archives with the new format. | 199 | repacking your ancient archives with the new format. |
200 | 200 | ||
201 | config CONFIG_FEATURE_TAR_GNU_EXTENSIONS | 201 | config FEATURE_TAR_GNU_EXTENSIONS |
202 | bool "Enable support for some GNU tar extensions" | 202 | bool "Enable support for some GNU tar extensions" |
203 | default y | 203 | default y |
204 | depends on CONFIG_TAR | 204 | depends on TAR |
205 | help | 205 | help |
206 | With this option busybox supports GNU long filenames and | 206 | With this option busybox supports GNU long filenames and |
207 | linknames. | 207 | linknames. |
208 | 208 | ||
209 | config CONFIG_FEATURE_TAR_LONG_OPTIONS | 209 | config FEATURE_TAR_LONG_OPTIONS |
210 | bool "Enable long options" | 210 | bool "Enable long options" |
211 | default n | 211 | default n |
212 | depends on CONFIG_TAR && CONFIG_GETOPT_LONG | 212 | depends on TAR && GETOPT_LONG |
213 | help | 213 | help |
214 | Enable use of long options, increases size by about 400 Bytes | 214 | Enable use of long options, increases size by about 400 Bytes |
215 | 215 | ||
216 | config CONFIG_UNCOMPRESS | 216 | config UNCOMPRESS |
217 | bool "uncompress" | 217 | bool "uncompress" |
218 | default n | 218 | default n |
219 | help | 219 | help |
220 | uncompress is used to decompress archives created by compress. | 220 | uncompress is used to decompress archives created by compress. |
221 | Not much used anymore, replaced by gzip/gunzip. | 221 | Not much used anymore, replaced by gzip/gunzip. |
222 | 222 | ||
223 | config CONFIG_UNLZMA | 223 | config UNLZMA |
224 | bool "unlzma" | 224 | bool "unlzma" |
225 | default n | 225 | default n |
226 | help | 226 | help |
@@ -235,15 +235,15 @@ config CONFIG_UNLZMA | |||
235 | Unless you have a specific application which requires unlzma, you | 235 | Unless you have a specific application which requires unlzma, you |
236 | should probably say N here. | 236 | should probably say N here. |
237 | 237 | ||
238 | config CONFIG_FEATURE_LZMA_FAST | 238 | config FEATURE_LZMA_FAST |
239 | bool "Optimze unlzma for speed" | 239 | bool "Optimze unlzma for speed" |
240 | default n | 240 | default n |
241 | depends on CONFIG_UNLZMA | 241 | depends on UNLZMA |
242 | help | 242 | help |
243 | This option reduces decompression time by about 33% at the cost of | 243 | This option reduces decompression time by about 33% at the cost of |
244 | a 2K bigger binary. | 244 | a 2K bigger binary. |
245 | 245 | ||
246 | config CONFIG_UNZIP | 246 | config UNZIP |
247 | bool "unzip" | 247 | bool "unzip" |
248 | default n | 248 | default n |
249 | help | 249 | help |
@@ -254,31 +254,31 @@ config CONFIG_UNZIP | |||
254 | directory of your choice. | 254 | directory of your choice. |
255 | 255 | ||
256 | comment "Common options for cpio and tar" | 256 | comment "Common options for cpio and tar" |
257 | depends on CONFIG_CPIO || CONFIG_TAR | 257 | depends on CPIO || TAR |
258 | 258 | ||
259 | config CONFIG_FEATURE_UNARCHIVE_TAPE | 259 | config FEATURE_UNARCHIVE_TAPE |
260 | bool "Enable tape drive support" | 260 | bool "Enable tape drive support" |
261 | default n | 261 | default n |
262 | depends on CONFIG_CPIO || CONFIG_TAR | 262 | depends on CPIO || TAR |
263 | help | 263 | help |
264 | I don't think this is needed anymore. | 264 | I don't think this is needed anymore. |
265 | 265 | ||
266 | comment "Common options for dpkg and dpkg_deb" | 266 | comment "Common options for dpkg and dpkg_deb" |
267 | depends on CONFIG_DPKG || CONFIG_DPKG_DEB | 267 | depends on DPKG || DPKG_DEB |
268 | 268 | ||
269 | config CONFIG_FEATURE_DEB_TAR_GZ | 269 | config FEATURE_DEB_TAR_GZ |
270 | bool "gzip debian packages (normal)" | 270 | bool "gzip debian packages (normal)" |
271 | default y if CONFIG_DPKG || CONFIG_DPKG_DEB | 271 | default y if DPKG || DPKG_DEB |
272 | depends on CONFIG_DPKG || CONFIG_DPKG_DEB | 272 | depends on DPKG || DPKG_DEB |
273 | help | 273 | help |
274 | This is the default compression method inside the debian ar file. | 274 | This is the default compression method inside the debian ar file. |
275 | 275 | ||
276 | If you want compatibility with standard .deb's you should say yes here. | 276 | If you want compatibility with standard .deb's you should say yes here. |
277 | 277 | ||
278 | config CONFIG_FEATURE_DEB_TAR_BZ2 | 278 | config FEATURE_DEB_TAR_BZ2 |
279 | bool "bzip2 debian packages" | 279 | bool "bzip2 debian packages" |
280 | default n | 280 | default n |
281 | depends on CONFIG_DPKG || CONFIG_DPKG_DEB | 281 | depends on DPKG || DPKG_DEB |
282 | help | 282 | help |
283 | This allows dpkg and dpkg-deb to extract deb's that are compressed internally | 283 | This allows dpkg and dpkg-deb to extract deb's that are compressed internally |
284 | with bzip2 instead of gzip. | 284 | with bzip2 instead of gzip. |
@@ -286,10 +286,10 @@ config CONFIG_FEATURE_DEB_TAR_BZ2 | |||
286 | You only want this if you are creating your own custom debian packages that | 286 | You only want this if you are creating your own custom debian packages that |
287 | use an internal control.tar.bz2 or data.tar.bz2. | 287 | use an internal control.tar.bz2 or data.tar.bz2. |
288 | 288 | ||
289 | config CONFIG_FEATURE_DEB_TAR_LZMA | 289 | config FEATURE_DEB_TAR_LZMA |
290 | bool "lzma debian packages" | 290 | bool "lzma debian packages" |
291 | default n | 291 | default n |
292 | depends on CONFIG_DPKG || CONFIG_DPKG_DEB | 292 | depends on DPKG || DPKG_DEB |
293 | help | 293 | help |
294 | This allows dpkg and dpkg-deb to extract deb's that are compressed | 294 | This allows dpkg and dpkg-deb to extract deb's that are compressed |
295 | internally with lzma instead of gzip. | 295 | internally with lzma instead of gzip. |
diff --git a/archival/Kbuild b/archival/Kbuild new file mode 100644 index 000000000..f85e0c2a7 --- /dev/null +++ b/archival/Kbuild | |||
@@ -0,0 +1,22 @@ | |||
1 | # Makefile for busybox | ||
2 | # | ||
3 | # Copyright (C) 1999-2005 by Erik Andersen <andersen@codepoet.org> | ||
4 | # | ||
5 | # Licensed under the GPL v2, see the file LICENSE in this tarball. | ||
6 | |||
7 | libs-y += libunarchive/ | ||
8 | |||
9 | lib-y:= | ||
10 | lib-$(CONFIG_AR) += ar.o | ||
11 | lib-$(CONFIG_BUNZIP2) += bunzip2.o | ||
12 | lib-$(CONFIG_UNLZMA) += unlzma.o | ||
13 | lib-$(CONFIG_CPIO) += cpio.o | ||
14 | lib-$(CONFIG_DPKG) += dpkg.o | ||
15 | lib-$(CONFIG_DPKG_DEB) += dpkg_deb.o | ||
16 | lib-$(CONFIG_GUNZIP) += gunzip.o | ||
17 | lib-$(CONFIG_GZIP) += gzip.o | ||
18 | lib-$(CONFIG_RPM2CPIO) += rpm2cpio.o | ||
19 | lib-$(CONFIG_RPM) += rpm.o | ||
20 | lib-$(CONFIG_TAR) += tar.o | ||
21 | lib-$(CONFIG_UNCOMPRESS) += uncompress.o | ||
22 | lib-$(CONFIG_UNZIP) += unzip.o | ||
diff --git a/archival/Makefile b/archival/Makefile deleted file mode 100644 index 66da4afc1..000000000 --- a/archival/Makefile +++ /dev/null | |||
@@ -1,23 +0,0 @@ | |||
1 | # Makefile for busybox | ||
2 | # | ||
3 | # Copyright (C) 1999-2005 by Erik Andersen <andersen@codepoet.org> | ||
4 | # | ||
5 | # Licensed under the GPL v2, see the file LICENSE in this tarball. | ||
6 | |||
7 | ifndef top_srcdir | ||
8 | top_srcdir=.. | ||
9 | endif | ||
10 | ifndef top_builddir | ||
11 | top_builddir=.. | ||
12 | endif | ||
13 | ARCHIVAL_DIR:=./ | ||
14 | srcdir=$(top_srcdir)/archival | ||
15 | include $(top_srcdir)/Rules.mak | ||
16 | include $(top_builddir)/.config | ||
17 | include $(srcdir)/Makefile.in | ||
18 | all: $(libraries-y) | ||
19 | -include $(top_builddir)/.depend | ||
20 | |||
21 | clean: | ||
22 | rm -f *.o *.a $(AR_TARGET) | ||
23 | |||
diff --git a/archival/Makefile.in b/archival/Makefile.in deleted file mode 100644 index 276ef4127..000000000 --- a/archival/Makefile.in +++ /dev/null | |||
@@ -1,41 +0,0 @@ | |||
1 | # Makefile for busybox | ||
2 | # | ||
3 | # Copyright (C) 1999-2005 by Erik Andersen <andersen@codepoet.org> | ||
4 | # | ||
5 | # Licensed under the GPL v2, see the file LICENSE in this tarball. | ||
6 | |||
7 | ARCHIVAL_AR:=archival.a | ||
8 | ifndef $(ARCHIVAL_DIR) | ||
9 | ARCHIVAL_DIR:=$(top_builddir)/archival/ | ||
10 | endif | ||
11 | srcdir=$(top_srcdir)/archival | ||
12 | |||
13 | ARCHIVAL-y:= | ||
14 | ARCHIVAL-$(CONFIG_AR) += ar.o | ||
15 | ARCHIVAL-$(CONFIG_BUNZIP2) += bunzip2.o | ||
16 | ARCHIVAL-$(CONFIG_UNLZMA) += unlzma.o | ||
17 | ARCHIVAL-$(CONFIG_CPIO) += cpio.o | ||
18 | ARCHIVAL-$(CONFIG_DPKG) += dpkg.o | ||
19 | ARCHIVAL-$(CONFIG_DPKG_DEB) += dpkg_deb.o | ||
20 | ARCHIVAL-$(CONFIG_GUNZIP) += gunzip.o | ||
21 | ARCHIVAL-$(CONFIG_GZIP) += gzip.o | ||
22 | ARCHIVAL-$(CONFIG_RPM2CPIO) += rpm2cpio.o | ||
23 | ARCHIVAL-$(CONFIG_RPM) += rpm.o | ||
24 | ARCHIVAL-$(CONFIG_TAR) += tar.o | ||
25 | ARCHIVAL-$(CONFIG_UNCOMPRESS) += uncompress.o | ||
26 | ARCHIVAL-$(CONFIG_UNZIP) += unzip.o | ||
27 | |||
28 | ifneq ($(strip $(ARCHIVAL-y)),) | ||
29 | libraries-y+=$(ARCHIVAL_DIR)$(ARCHIVAL_AR) | ||
30 | endif | ||
31 | |||
32 | ARCHIVAL_SRC-y:=$(patsubst %.o,$(srcdir)/%.c,$(ARCHIVAL-y)) | ||
33 | ARCHIVAL_SRC-a:=$(wildcard $(srcdir)/*.c) | ||
34 | APPLET_SRC-y+=$(ARCHIVAL_SRC-y) | ||
35 | APPLET_SRC-a+=$(ARCHIVAL_SRC-a) | ||
36 | |||
37 | $(ARCHIVAL_DIR)$(ARCHIVAL_AR): $(patsubst %,$(ARCHIVAL_DIR)%, $(ARCHIVAL-y)) | ||
38 | $(do_ar) | ||
39 | |||
40 | $(ARCHIVAL_DIR)%.o: $(srcdir)/%.c | ||
41 | $(compile.c) | ||
diff --git a/archival/libunarchive/Kbuild b/archival/libunarchive/Kbuild new file mode 100644 index 000000000..c5f1bfbfe --- /dev/null +++ b/archival/libunarchive/Kbuild | |||
@@ -0,0 +1,59 @@ | |||
1 | # Makefile for busybox | ||
2 | # | ||
3 | # Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org> | ||
4 | # | ||
5 | # Licensed under the GPL v2 or later, see the file LICENSE in this tarball. | ||
6 | |||
7 | lib-y:= \ | ||
8 | \ | ||
9 | data_skip.o \ | ||
10 | data_extract_all.o \ | ||
11 | data_extract_to_stdout.o \ | ||
12 | data_extract_to_buffer.o \ | ||
13 | \ | ||
14 | filter_accept_all.o \ | ||
15 | filter_accept_list.o \ | ||
16 | filter_accept_reject_list.o \ | ||
17 | \ | ||
18 | header_skip.o \ | ||
19 | header_list.o \ | ||
20 | header_verbose_list.o \ | ||
21 | \ | ||
22 | archive_xread_all_eof.o \ | ||
23 | \ | ||
24 | seek_by_char.o \ | ||
25 | seek_by_jump.o \ | ||
26 | \ | ||
27 | data_align.o \ | ||
28 | find_list_entry.o \ | ||
29 | open_transformer.o \ | ||
30 | init_handle.o | ||
31 | |||
32 | GUNZIP_FILES:= check_header_gzip.o decompress_unzip.o | ||
33 | DPKG_FILES:= \ | ||
34 | get_header_ar.o \ | ||
35 | unpack_ar_archive.o \ | ||
36 | get_header_tar.o \ | ||
37 | filter_accept_list_reassign.o | ||
38 | |||
39 | lib-$(CONFIG_AR) += get_header_ar.o unpack_ar_archive.o | ||
40 | lib-$(CONFIG_BUNZIP2) += decompress_bunzip2.o | ||
41 | lib-$(CONFIG_UNLZMA) += decompress_unlzma.o | ||
42 | lib-$(CONFIG_CPIO) += get_header_cpio.o | ||
43 | lib-$(CONFIG_DPKG) += $(DPKG_FILES) | ||
44 | lib-$(CONFIG_DPKG_DEB) += $(DPKG_FILES) | ||
45 | lib-$(CONFIG_FEATURE_DEB_TAR_GZ) += $(GUNZIP_FILES) get_header_tar_gz.o | ||
46 | lib-$(CONFIG_FEATURE_DEB_TAR_BZ2) += decompress_bunzip2.o get_header_tar_bz2.o | ||
47 | lib-$(CONFIG_FEATURE_DEB_TAR_LZMA) += decompress_unlzma.o get_header_tar_lzma.o | ||
48 | lib-$(CONFIG_GUNZIP) += $(GUNZIP_FILES) | ||
49 | lib-$(CONFIG_FEATURE_GUNZIP_UNCOMPRESS) += decompress_uncompress.o | ||
50 | lib-$(CONFIG_RPM2CPIO) += $(GUNZIP_FILES) get_header_cpio.o | ||
51 | lib-$(CONFIG_RPM) += $(GUNZIP_FILES) get_header_cpio.o | ||
52 | lib-$(CONFIG_TAR) += get_header_tar.o | ||
53 | lib-$(CONFIG_FEATURE_TAR_BZIP2) += decompress_bunzip2.o get_header_tar_bz2.o | ||
54 | lib-$(CONFIG_FEATURE_TAR_LZMA) += decompress_unlzma.o get_header_tar_lzma.o | ||
55 | lib-$(CONFIG_FEATURE_TAR_GZIP) += $(GUNZIP_FILES) get_header_tar_gz.o | ||
56 | lib-$(CONFIG_FEATURE_TAR_COMPRESS) += decompress_uncompress.o | ||
57 | lib-$(CONFIG_UNCOMPRESS) += decompress_uncompress.o | ||
58 | lib-$(CONFIG_UNZIP) += $(GUNZIP_FILES) | ||
59 | lib-$(CONFIG_FEATURE_COMPRESS_USAGE) += decompress_bunzip2.o | ||
diff --git a/archival/libunarchive/Makefile b/archival/libunarchive/Makefile deleted file mode 100644 index 9ab1cac81..000000000 --- a/archival/libunarchive/Makefile +++ /dev/null | |||
@@ -1,36 +0,0 @@ | |||
1 | # Makefile for busybox | ||
2 | # | ||
3 | # Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org> | ||
4 | # | ||
5 | # This program is free software; you can redistribute it and/or modify | ||
6 | # it under the terms of the GNU General Public License as published by | ||
7 | # the Free Software Foundation; either version 2 of the License, or | ||
8 | # (at your option) any later version. | ||
9 | # | ||
10 | # This program is distributed in the hope that it will be useful, | ||
11 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
13 | # General Public License for more details. | ||
14 | # | ||
15 | # You should have received a copy of the GNU General Public License | ||
16 | # along with this program; if not, write to the Free Software | ||
17 | # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
18 | # | ||
19 | |||
20 | ifndef top_srcdir | ||
21 | top_srcdir=../.. | ||
22 | endif | ||
23 | ifndef top_builddir | ||
24 | top_builddir=../.. | ||
25 | endif | ||
26 | srcdir=$(top_srcdir)/archival/libunarchive | ||
27 | LIBUNARCHIVE_DIR:=./ | ||
28 | include $(top_srcdir)/Rules.mak | ||
29 | include $(top_builddir)/.config | ||
30 | include $(srcdir)/Makefile.in | ||
31 | all: $(libraries-y) | ||
32 | -include $(top_builddir)/.depend | ||
33 | |||
34 | clean: | ||
35 | rm -f *.o *.a $(AR_TARGET) | ||
36 | |||
diff --git a/archival/libunarchive/Makefile.in b/archival/libunarchive/Makefile.in deleted file mode 100644 index 46c50f81d..000000000 --- a/archival/libunarchive/Makefile.in +++ /dev/null | |||
@@ -1,83 +0,0 @@ | |||
1 | # Makefile for busybox | ||
2 | # | ||
3 | # Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org> | ||
4 | # | ||
5 | # Licensed under the GPL v2 or later, see the file LICENSE in this tarball. | ||
6 | |||
7 | LIBUNARCHIVE_AR:=libunarchive.a | ||
8 | ifndef $(LIBUNARCHIVE_DIR) | ||
9 | LIBUNARCHIVE_DIR:=$(top_builddir)/archival/libunarchive | ||
10 | endif | ||
11 | srcdir=$(top_srcdir)/archival/libunarchive | ||
12 | |||
13 | LIBUNARCHIVE-obj:=$(LIBUNARCHIVE_DIR)/$(LIBUNARCHIVE_AR) | ||
14 | |||
15 | libraries-y+=$(LIBUNARCHIVE-obj) | ||
16 | |||
17 | LIBUNARCHIVE-y:= \ | ||
18 | \ | ||
19 | data_skip.o \ | ||
20 | data_extract_all.o \ | ||
21 | data_extract_to_stdout.o \ | ||
22 | data_extract_to_buffer.o \ | ||
23 | \ | ||
24 | filter_accept_all.o \ | ||
25 | filter_accept_list.o \ | ||
26 | filter_accept_reject_list.o \ | ||
27 | \ | ||
28 | header_skip.o \ | ||
29 | header_list.o \ | ||
30 | header_verbose_list.o \ | ||
31 | \ | ||
32 | archive_xread_all_eof.o \ | ||
33 | \ | ||
34 | seek_by_char.o \ | ||
35 | seek_by_jump.o \ | ||
36 | \ | ||
37 | data_align.o \ | ||
38 | find_list_entry.o \ | ||
39 | open_transformer.o \ | ||
40 | init_handle.o | ||
41 | |||
42 | GUNZIP_FILES:= check_header_gzip.o decompress_unzip.o | ||
43 | DPKG_FILES:= \ | ||
44 | get_header_ar.o \ | ||
45 | unpack_ar_archive.o \ | ||
46 | get_header_tar.o \ | ||
47 | filter_accept_list_reassign.o | ||
48 | |||
49 | LIBUNARCHIVE-$(CONFIG_AR) += get_header_ar.o unpack_ar_archive.o | ||
50 | LIBUNARCHIVE-$(CONFIG_BUNZIP2) += decompress_bunzip2.o | ||
51 | LIBUNARCHIVE-$(CONFIG_UNLZMA) += decompress_unlzma.o | ||
52 | LIBUNARCHIVE-$(CONFIG_CPIO) += get_header_cpio.o | ||
53 | LIBUNARCHIVE-$(CONFIG_DPKG) += $(DPKG_FILES) | ||
54 | LIBUNARCHIVE-$(CONFIG_DPKG_DEB) += $(DPKG_FILES) | ||
55 | LIBUNARCHIVE-$(CONFIG_FEATURE_DEB_TAR_GZ) += $(GUNZIP_FILES) get_header_tar_gz.o | ||
56 | LIBUNARCHIVE-$(CONFIG_FEATURE_DEB_TAR_BZ2) += decompress_bunzip2.o get_header_tar_bz2.o | ||
57 | LIBUNARCHIVE-$(CONFIG_FEATURE_DEB_TAR_LZMA) += decompress_unlzma.o get_header_tar_lzma.o | ||
58 | LIBUNARCHIVE-$(CONFIG_GUNZIP) += $(GUNZIP_FILES) | ||
59 | LIBUNARCHIVE-$(CONFIG_FEATURE_GUNZIP_UNCOMPRESS) += decompress_uncompress.o | ||
60 | LIBUNARCHIVE-$(CONFIG_RPM2CPIO) += $(GUNZIP_FILES) get_header_cpio.o | ||
61 | LIBUNARCHIVE-$(CONFIG_RPM) += $(GUNZIP_FILES) get_header_cpio.o | ||
62 | LIBUNARCHIVE-$(CONFIG_TAR) += get_header_tar.o | ||
63 | LIBUNARCHIVE-$(CONFIG_FEATURE_TAR_BZIP2) += decompress_bunzip2.o get_header_tar_bz2.o | ||
64 | LIBUNARCHIVE-$(CONFIG_FEATURE_TAR_LZMA) += decompress_unlzma.o get_header_tar_lzma.o | ||
65 | LIBUNARCHIVE-$(CONFIG_FEATURE_TAR_GZIP) += $(GUNZIP_FILES) get_header_tar_gz.o | ||
66 | LIBUNARCHIVE-$(CONFIG_FEATURE_TAR_COMPRESS) += decompress_uncompress.o | ||
67 | LIBUNARCHIVE-$(CONFIG_UNCOMPRESS) += decompress_uncompress.o | ||
68 | LIBUNARCHIVE-$(CONFIG_UNZIP) += $(GUNZIP_FILES) | ||
69 | LIBUNARCHIVE-$(CONFIG_FEATURE_COMPRESS_USAGE) += decompress_bunzip2.o | ||
70 | |||
71 | |||
72 | LIBUNARCHIVE-y:=$(sort $(LIBUNARCHIVE-y)) | ||
73 | |||
74 | LIBUNARCHIVE_SRC-y:=$(patsubst %,$(srcdir)/%,$(subst .o,.c,$(LIBUNARCHIVE-y))) | ||
75 | LIBUNARCHIVE_SRC-a:=$(wildcard $(srcdir)/*.c) | ||
76 | LIBRARY_SRC-y+=$(LIBUNARCHIVE_SRC-y) | ||
77 | LIBRARY_SRC-a+=$(LIBUNARCHIVE_SRC-a) | ||
78 | |||
79 | $(LIBUNARCHIVE_DIR)/$(LIBUNARCHIVE_AR): $(patsubst %,$(LIBUNARCHIVE_DIR)/%,$(LIBUNARCHIVE-y)) | ||
80 | $(do_ar) | ||
81 | |||
82 | $(LIBUNARCHIVE_DIR)/%.o: $(srcdir)/%.c | ||
83 | $(compile.c) | ||
diff --git a/console-tools/Config.in b/console-tools/Config.in index ec2273c35..f1dbac531 100644 --- a/console-tools/Config.in +++ b/console-tools/Config.in | |||
@@ -5,81 +5,81 @@ | |||
5 | 5 | ||
6 | menu "Console Utilities" | 6 | menu "Console Utilities" |
7 | 7 | ||
8 | config CONFIG_CHVT | 8 | config CHVT |
9 | bool "chvt" | 9 | bool "chvt" |
10 | default n | 10 | default n |
11 | help | 11 | help |
12 | This program is used to change to another terminal. | 12 | This program is used to change to another terminal. |
13 | Example: chvt 4 (change to terminal /dev/tty4) | 13 | Example: chvt 4 (change to terminal /dev/tty4) |
14 | 14 | ||
15 | config CONFIG_CLEAR | 15 | config CLEAR |
16 | bool "clear" | 16 | bool "clear" |
17 | default n | 17 | default n |
18 | help | 18 | help |
19 | This program clears the terminal screen. | 19 | This program clears the terminal screen. |
20 | 20 | ||
21 | config CONFIG_DEALLOCVT | 21 | config DEALLOCVT |
22 | bool "deallocvt" | 22 | bool "deallocvt" |
23 | default n | 23 | default n |
24 | help | 24 | help |
25 | This program deallocates unused virtual consoles. | 25 | This program deallocates unused virtual consoles. |
26 | 26 | ||
27 | config CONFIG_DUMPKMAP | 27 | config DUMPKMAP |
28 | bool "dumpkmap" | 28 | bool "dumpkmap" |
29 | default n | 29 | default n |
30 | help | 30 | help |
31 | This program dumps the kernel's keyboard translation table to | 31 | This program dumps the kernel's keyboard translation table to |
32 | stdout, in binary format. You can then use loadkmap to load it. | 32 | stdout, in binary format. You can then use loadkmap to load it. |
33 | 33 | ||
34 | config CONFIG_LOADFONT | 34 | config LOADFONT |
35 | bool "loadfont" | 35 | bool "loadfont" |
36 | default n | 36 | default n |
37 | help | 37 | help |
38 | This program loads a console font from standard input. | 38 | This program loads a console font from standard input. |
39 | 39 | ||
40 | config CONFIG_LOADKMAP | 40 | config LOADKMAP |
41 | bool "loadkmap" | 41 | bool "loadkmap" |
42 | default n | 42 | default n |
43 | help | 43 | help |
44 | This program loads a keyboard translation table from | 44 | This program loads a keyboard translation table from |
45 | standard input. | 45 | standard input. |
46 | 46 | ||
47 | config CONFIG_OPENVT | 47 | config OPENVT |
48 | bool "openvt" | 48 | bool "openvt" |
49 | default n | 49 | default n |
50 | help | 50 | help |
51 | This program is used to start a command on an unused | 51 | This program is used to start a command on an unused |
52 | virtual terminal. | 52 | virtual terminal. |
53 | 53 | ||
54 | config CONFIG_RESET | 54 | config RESET |
55 | bool "reset" | 55 | bool "reset" |
56 | default n | 56 | default n |
57 | help | 57 | help |
58 | This program is used to reset the terminal screen, if it | 58 | This program is used to reset the terminal screen, if it |
59 | gets messed up. | 59 | gets messed up. |
60 | 60 | ||
61 | config CONFIG_SETCONSOLE | 61 | config SETCONSOLE |
62 | bool "setconsole" | 62 | bool "setconsole" |
63 | default n | 63 | default n |
64 | help | 64 | help |
65 | This program redirects the system console to another device, | 65 | This program redirects the system console to another device, |
66 | like the current tty while logged in via telnet. | 66 | like the current tty while logged in via telnet. |
67 | 67 | ||
68 | config CONFIG_FEATURE_SETCONSOLE_LONG_OPTIONS | 68 | config FEATURE_SETCONSOLE_LONG_OPTIONS |
69 | bool "Enable long options" | 69 | bool "Enable long options" |
70 | default n | 70 | default n |
71 | depends on CONFIG_SET_CONSOLE && CONFIG_GETOPT_LONG | 71 | depends on SET_CONSOLE && GETOPT_LONG |
72 | help | 72 | help |
73 | Support long options for the setconsole applet. | 73 | Support long options for the setconsole applet. |
74 | 74 | ||
75 | config CONFIG_SETKEYCODES | 75 | config SETKEYCODES |
76 | bool "setkeycodes" | 76 | bool "setkeycodes" |
77 | default n | 77 | default n |
78 | help | 78 | help |
79 | This program loads entries into the kernel's scancode-to-keycode | 79 | This program loads entries into the kernel's scancode-to-keycode |
80 | map, allowing unusual keyboards to generate usable keycodes. | 80 | map, allowing unusual keyboards to generate usable keycodes. |
81 | 81 | ||
82 | config CONFIG_SETLOGCONS | 82 | config SETLOGCONS |
83 | bool "setlogcons" | 83 | bool "setlogcons" |
84 | default n | 84 | default n |
85 | help | 85 | help |
diff --git a/console-tools/Kbuild b/console-tools/Kbuild new file mode 100644 index 000000000..8e377c559 --- /dev/null +++ b/console-tools/Kbuild | |||
@@ -0,0 +1,18 @@ | |||
1 | # Makefile for busybox | ||
2 | # | ||
3 | # Copyright (C) 1999-2005 by Erik Andersen <andersen@codepoet.org> | ||
4 | # | ||
5 | # Licensed under the GPL v2, see the file LICENSE in this tarball. | ||
6 | |||
7 | lib-y:= | ||
8 | lib-$(CONFIG_CHVT) += chvt.o | ||
9 | lib-$(CONFIG_CLEAR) += clear.o | ||
10 | lib-$(CONFIG_DEALLOCVT) += deallocvt.o | ||
11 | lib-$(CONFIG_DUMPKMAP) += dumpkmap.o | ||
12 | lib-$(CONFIG_SETCONSOLE) += setconsole.o | ||
13 | lib-$(CONFIG_LOADFONT) += loadfont.o | ||
14 | lib-$(CONFIG_LOADKMAP) += loadkmap.o | ||
15 | lib-$(CONFIG_OPENVT) += openvt.o | ||
16 | lib-$(CONFIG_RESET) += reset.o | ||
17 | lib-$(CONFIG_SETKEYCODES) += setkeycodes.o | ||
18 | lib-$(CONFIG_SETLOGCONS) += setlogcons.o | ||
diff --git a/console-tools/Makefile b/console-tools/Makefile deleted file mode 100644 index 87a242b51..000000000 --- a/console-tools/Makefile +++ /dev/null | |||
@@ -1,23 +0,0 @@ | |||
1 | # Makefile for busybox | ||
2 | # | ||
3 | # Copyright (C) 1999-2005 by Erik Andersen <andersen@codepoet.org> | ||
4 | # | ||
5 | # Licensed under the GPL v2, see the file LICENSE in this tarball. | ||
6 | |||
7 | ifndef top_srcdir | ||
8 | top_srcdir=.. | ||
9 | endif | ||
10 | ifndef top_builddir | ||
11 | top_builddir=.. | ||
12 | endif | ||
13 | srcdir=$(top_srcdir)/console/tools | ||
14 | CONSOLETOOLS_DIR:=./ | ||
15 | include $(top_srcdir)/Rules.mak | ||
16 | include $(top_builddir)/.config | ||
17 | include $(srcdir)/Makefile.in | ||
18 | all: $(libraries-y) | ||
19 | -include $(top_builddir)/.depend | ||
20 | |||
21 | clean: | ||
22 | rm -f *.o *.a $(AR_TARGET) | ||
23 | |||
diff --git a/console-tools/Makefile.in b/console-tools/Makefile.in deleted file mode 100644 index 437bcd0ec..000000000 --- a/console-tools/Makefile.in +++ /dev/null | |||
@@ -1,38 +0,0 @@ | |||
1 | # Makefile for busybox | ||
2 | # | ||
3 | # Copyright (C) 1999-2005 by Erik Andersen <andersen@codepoet.org> | ||
4 | # | ||
5 | # Licensed under the GPL v2, see the file LICENSE in this tarball. | ||
6 | |||
7 | CONSOLETOOLS_AR:=console-tools.a | ||
8 | ifndef $(CONSOLETOOLS_DIR) | ||
9 | CONSOLETOOLS_DIR:=$(top_builddir)/console-tools/ | ||
10 | endif | ||
11 | srcdir=$(top_srcdir)/console-tools | ||
12 | |||
13 | CONSOLETOOLS-y:= | ||
14 | CONSOLETOOLS-$(CONFIG_CHVT) += chvt.o | ||
15 | CONSOLETOOLS-$(CONFIG_CLEAR) += clear.o | ||
16 | CONSOLETOOLS-$(CONFIG_DEALLOCVT) += deallocvt.o | ||
17 | CONSOLETOOLS-$(CONFIG_DUMPKMAP) += dumpkmap.o | ||
18 | CONSOLETOOLS-$(CONFIG_SETCONSOLE) += setconsole.o | ||
19 | CONSOLETOOLS-$(CONFIG_LOADFONT) += loadfont.o | ||
20 | CONSOLETOOLS-$(CONFIG_LOADKMAP) += loadkmap.o | ||
21 | CONSOLETOOLS-$(CONFIG_OPENVT) += openvt.o | ||
22 | CONSOLETOOLS-$(CONFIG_RESET) += reset.o | ||
23 | CONSOLETOOLS-$(CONFIG_SETKEYCODES) += setkeycodes.o | ||
24 | CONSOLETOOLS-$(CONFIG_SETLOGCONS) += setlogcons.o | ||
25 | |||
26 | ifneq ($(strip $(CONSOLETOOLS-y)),) | ||
27 | libraries-y+=$(CONSOLETOOLS_DIR)$(CONSOLETOOLS_AR) | ||
28 | endif | ||
29 | CONSOLETOOLS_SRC-y:=$(patsubst %.o,$(srcdir)/%.c,$(CONSOLETOOLS-y)) | ||
30 | CONSOLETOOLS_SRC-a:=$(wildcard $(srcdir)/*.c) | ||
31 | APPLET_SRC-y+=$(CONSOLETOOLS_SRC-y) | ||
32 | APPLET_SRC-a+=$(CONSOLETOOLS_SRC-a) | ||
33 | |||
34 | $(CONSOLETOOLS_DIR)$(CONSOLETOOLS_AR): $(patsubst %,$(CONSOLETOOLS_DIR)%, $(CONSOLETOOLS-y)) | ||
35 | $(do_ar) | ||
36 | |||
37 | $(CONSOLETOOLS_DIR)%.o: $(srcdir)/%.c | ||
38 | $(compile.c) | ||
diff --git a/coreutils/Config.in b/coreutils/Config.in index 6598a8d9c..000f3a8af 100644 --- a/coreutils/Config.in +++ b/coreutils/Config.in | |||
@@ -5,7 +5,7 @@ | |||
5 | 5 | ||
6 | menu "Coreutils" | 6 | menu "Coreutils" |
7 | 7 | ||
8 | config CONFIG_BASENAME | 8 | config BASENAME |
9 | bool "basename" | 9 | bool "basename" |
10 | default n | 10 | default n |
11 | help | 11 | help |
@@ -13,101 +13,101 @@ config CONFIG_BASENAME | |||
13 | leaving just the filename itself. Enable this option if you wish | 13 | leaving just the filename itself. Enable this option if you wish |
14 | to enable the 'basename' utility. | 14 | to enable the 'basename' utility. |
15 | 15 | ||
16 | config CONFIG_CAL | 16 | config CAL |
17 | bool "cal" | 17 | bool "cal" |
18 | default n | 18 | default n |
19 | help | 19 | help |
20 | cal is used to display a monthly calender. | 20 | cal is used to display a monthly calender. |
21 | 21 | ||
22 | config CONFIG_CAT | 22 | config CAT |
23 | bool "cat" | 23 | bool "cat" |
24 | default n | 24 | default n |
25 | help | 25 | help |
26 | cat is used to concatenate files and print them to the standard | 26 | cat is used to concatenate files and print them to the standard |
27 | output. Enable this option if you wish to enable the 'cat' utility. | 27 | output. Enable this option if you wish to enable the 'cat' utility. |
28 | 28 | ||
29 | config CONFIG_CATV | 29 | config CATV |
30 | bool "catv" | 30 | bool "catv" |
31 | default n | 31 | default n |
32 | help | 32 | help |
33 | Display nonprinting characters as escape sequences (like some | 33 | Display nonprinting characters as escape sequences (like some |
34 | implementations' cat -v option). | 34 | implementations' cat -v option). |
35 | 35 | ||
36 | config CONFIG_CHGRP | 36 | config CHGRP |
37 | bool "chgrp" | 37 | bool "chgrp" |
38 | default n | 38 | default n |
39 | help | 39 | help |
40 | chgrp is used to change the group ownership of files. | 40 | chgrp is used to change the group ownership of files. |
41 | 41 | ||
42 | config CONFIG_CHMOD | 42 | config CHMOD |
43 | bool "chmod" | 43 | bool "chmod" |
44 | default n | 44 | default n |
45 | help | 45 | help |
46 | chmod is used to change the access permission of files. | 46 | chmod is used to change the access permission of files. |
47 | 47 | ||
48 | config CONFIG_CHOWN | 48 | config CHOWN |
49 | bool "chown" | 49 | bool "chown" |
50 | default n | 50 | default n |
51 | help | 51 | help |
52 | chown is used to change the user and/or group ownership | 52 | chown is used to change the user and/or group ownership |
53 | of files. | 53 | of files. |
54 | 54 | ||
55 | config CONFIG_CHROOT | 55 | config CHROOT |
56 | bool "chroot" | 56 | bool "chroot" |
57 | default n | 57 | default n |
58 | help | 58 | help |
59 | chroot is used to change the root directory and run a command. | 59 | chroot is used to change the root directory and run a command. |
60 | The default command is `/bin/sh'. | 60 | The default command is `/bin/sh'. |
61 | 61 | ||
62 | config CONFIG_CKSUM | 62 | config CKSUM |
63 | bool "cksum" | 63 | bool "cksum" |
64 | default n | 64 | default n |
65 | help | 65 | help |
66 | cksum is used to calculate the CRC32 checksum of a file. | 66 | cksum is used to calculate the CRC32 checksum of a file. |
67 | 67 | ||
68 | config CONFIG_CMP | 68 | config CMP |
69 | bool "cmp" | 69 | bool "cmp" |
70 | default n | 70 | default n |
71 | help | 71 | help |
72 | cmp is used to compare two files and returns the result | 72 | cmp is used to compare two files and returns the result |
73 | to standard output. | 73 | to standard output. |
74 | 74 | ||
75 | config CONFIG_COMM | 75 | config COMM |
76 | bool "comm" | 76 | bool "comm" |
77 | default n | 77 | default n |
78 | help | 78 | help |
79 | comm is used to compare two files line by line and return | 79 | comm is used to compare two files line by line and return |
80 | a three-column output. | 80 | a three-column output. |
81 | 81 | ||
82 | config CONFIG_CP | 82 | config CP |
83 | bool "cp" | 83 | bool "cp" |
84 | default n | 84 | default n |
85 | help | 85 | help |
86 | cp is used to copy files and directories. | 86 | cp is used to copy files and directories. |
87 | 87 | ||
88 | config CONFIG_CUT | 88 | config CUT |
89 | bool "cut" | 89 | bool "cut" |
90 | default n | 90 | default n |
91 | help | 91 | help |
92 | cut is used to print selected parts of lines from | 92 | cut is used to print selected parts of lines from |
93 | each file to stdout. | 93 | each file to stdout. |
94 | 94 | ||
95 | config CONFIG_DATE | 95 | config DATE |
96 | bool "date" | 96 | bool "date" |
97 | default n | 97 | default n |
98 | help | 98 | help |
99 | date is used to set the system date or display the | 99 | date is used to set the system date or display the |
100 | current time in the given format. | 100 | current time in the given format. |
101 | 101 | ||
102 | config CONFIG_FEATURE_DATE_ISOFMT | 102 | config FEATURE_DATE_ISOFMT |
103 | bool "Enable ISO date format output (-I)" | 103 | bool "Enable ISO date format output (-I)" |
104 | default y | 104 | default y |
105 | depends on CONFIG_DATE | 105 | depends on DATE |
106 | help | 106 | help |
107 | Enable option (-I) to output an ISO-8601 compliant | 107 | Enable option (-I) to output an ISO-8601 compliant |
108 | date/time string. | 108 | date/time string. |
109 | 109 | ||
110 | config CONFIG_DD | 110 | config DD |
111 | bool "dd" | 111 | bool "dd" |
112 | default n | 112 | default n |
113 | help | 113 | help |
@@ -115,10 +115,10 @@ config CONFIG_DD | |||
115 | by default) using specific input and output blocksizes, | 115 | by default) using specific input and output blocksizes, |
116 | while optionally performing conversions on it. | 116 | while optionally performing conversions on it. |
117 | 117 | ||
118 | config CONFIG_FEATURE_DD_SIGNAL_HANDLING | 118 | config FEATURE_DD_SIGNAL_HANDLING |
119 | bool "Enable DD signal handling for status reporting" | 119 | bool "Enable DD signal handling for status reporting" |
120 | default y | 120 | default y |
121 | depends on CONFIG_DD | 121 | depends on DD |
122 | help | 122 | help |
123 | sending a SIGUSR1 signal to a running `dd' process makes it | 123 | sending a SIGUSR1 signal to a running `dd' process makes it |
124 | print to standard error the number of records read and written | 124 | print to standard error the number of records read and written |
@@ -127,22 +127,22 @@ config CONFIG_FEATURE_DD_SIGNAL_HANDLING | |||
127 | $ dd if=/dev/zero of=/dev/null& pid=$! $ kill -USR1 $pid; sleep 1; kill $pid | 127 | $ dd if=/dev/zero of=/dev/null& pid=$! $ kill -USR1 $pid; sleep 1; kill $pid |
128 | 10899206+0 records in 10899206+0 records out | 128 | 10899206+0 records in 10899206+0 records out |
129 | 129 | ||
130 | config CONFIG_FEATURE_DD_IBS_OBS | 130 | config FEATURE_DD_IBS_OBS |
131 | bool "Enable ibs, obs and conv options" | 131 | bool "Enable ibs, obs and conv options" |
132 | default n | 132 | default n |
133 | depends on CONFIG_DD | 133 | depends on DD |
134 | help | 134 | help |
135 | Enables support for writing a certain number of bytes in and out, | 135 | Enables support for writing a certain number of bytes in and out, |
136 | at a time, and performing conversions on the data stream. | 136 | at a time, and performing conversions on the data stream. |
137 | 137 | ||
138 | config CONFIG_DF | 138 | config DF |
139 | bool "df" | 139 | bool "df" |
140 | default n | 140 | default n |
141 | help | 141 | help |
142 | df reports the amount of disk space used and available | 142 | df reports the amount of disk space used and available |
143 | on filesystems. | 143 | on filesystems. |
144 | 144 | ||
145 | config CONFIG_DIFF | 145 | config DIFF |
146 | bool "diff" | 146 | bool "diff" |
147 | default n | 147 | default n |
148 | help | 148 | help |
@@ -150,81 +150,81 @@ config CONFIG_DIFF | |||
150 | differences between them in a form that can be given to | 150 | differences between them in a form that can be given to |
151 | the patch command. | 151 | the patch command. |
152 | 152 | ||
153 | config CONFIG_FEATURE_DIFF_BINARY | 153 | config FEATURE_DIFF_BINARY |
154 | bool "Enable checks for binary files" | 154 | bool "Enable checks for binary files" |
155 | default y | 155 | default y |
156 | depends on CONFIG_DIFF | 156 | depends on DIFF |
157 | help | 157 | help |
158 | This option enables support for checking for binary files | 158 | This option enables support for checking for binary files |
159 | before a comparison is carried out. | 159 | before a comparison is carried out. |
160 | 160 | ||
161 | config CONFIG_FEATURE_DIFF_DIR | 161 | config FEATURE_DIFF_DIR |
162 | bool "Enable directory support" | 162 | bool "Enable directory support" |
163 | default y | 163 | default y |
164 | depends on CONFIG_DIFF | 164 | depends on DIFF |
165 | help | 165 | help |
166 | This option enables support for directory and subdirectory | 166 | This option enables support for directory and subdirectory |
167 | comparison. | 167 | comparison. |
168 | 168 | ||
169 | config CONFIG_FEATURE_DIFF_MINIMAL | 169 | config FEATURE_DIFF_MINIMAL |
170 | bool "Enable -d option to find smaller sets of changes" | 170 | bool "Enable -d option to find smaller sets of changes" |
171 | default n | 171 | default n |
172 | depends on CONFIG_DIFF | 172 | depends on DIFF |
173 | help | 173 | help |
174 | Enabling this option allows the use of -d to make diff | 174 | Enabling this option allows the use of -d to make diff |
175 | try hard to find the smallest possible set of changes. | 175 | try hard to find the smallest possible set of changes. |
176 | 176 | ||
177 | config CONFIG_DIRNAME | 177 | config DIRNAME |
178 | bool "dirname" | 178 | bool "dirname" |
179 | default n | 179 | default n |
180 | help | 180 | help |
181 | dirname is used to strip a non-directory suffix from | 181 | dirname is used to strip a non-directory suffix from |
182 | a file name. | 182 | a file name. |
183 | 183 | ||
184 | config CONFIG_DOS2UNIX | 184 | config DOS2UNIX |
185 | bool "dos2unix/unix2dos" | 185 | bool "dos2unix/unix2dos" |
186 | default n | 186 | default n |
187 | help | 187 | help |
188 | dos2unix is used to convert a text file from DOS format to | 188 | dos2unix is used to convert a text file from DOS format to |
189 | UNIX format, and vice versa. | 189 | UNIX format, and vice versa. |
190 | 190 | ||
191 | config CONFIG_UNIX2DOS | 191 | config UNIX2DOS |
192 | bool | 192 | bool |
193 | default y | 193 | default y |
194 | depends on CONFIG_DOS2UNIX | 194 | depends on DOS2UNIX |
195 | help | 195 | help |
196 | unix2dos is used to convert a text file from UNIX format to | 196 | unix2dos is used to convert a text file from UNIX format to |
197 | DOS format, and vice versa. | 197 | DOS format, and vice versa. |
198 | 198 | ||
199 | config CONFIG_DU | 199 | config DU |
200 | bool "du (default blocksize of 512 bytes)" | 200 | bool "du (default blocksize of 512 bytes)" |
201 | default n | 201 | default n |
202 | help | 202 | help |
203 | du is used to report the amount of disk space used | 203 | du is used to report the amount of disk space used |
204 | for specified files. | 204 | for specified files. |
205 | 205 | ||
206 | config CONFIG_FEATURE_DU_DEFAULT_BLOCKSIZE_1K | 206 | config FEATURE_DU_DEFAULT_BLOCKSIZE_1K |
207 | bool "Use a default blocksize of 1024 bytes (1K)" | 207 | bool "Use a default blocksize of 1024 bytes (1K)" |
208 | default y | 208 | default y |
209 | depends on CONFIG_DU | 209 | depends on DU |
210 | help | 210 | help |
211 | Use a blocksize of (1K) instead of the default 512b. | 211 | Use a blocksize of (1K) instead of the default 512b. |
212 | 212 | ||
213 | config CONFIG_ECHO | 213 | config ECHO |
214 | bool "echo (basic SuSv3 version taking no options)" | 214 | bool "echo (basic SuSv3 version taking no options)" |
215 | default n | 215 | default n |
216 | help | 216 | help |
217 | echo is used to print a specified string to stdout. | 217 | echo is used to print a specified string to stdout. |
218 | 218 | ||
219 | # this entry also appears in shell/Config.in, next to the echo builtin | 219 | # this entry also appears in shell/Config.in, next to the echo builtin |
220 | config CONFIG_FEATURE_FANCY_ECHO | 220 | config FEATURE_FANCY_ECHO |
221 | bool "Enable echo options (-n and -e)" | 221 | bool "Enable echo options (-n and -e)" |
222 | default y | 222 | default y |
223 | depends on CONFIG_ECHO | 223 | depends on ECHO |
224 | help | 224 | help |
225 | This adds options (-n and -e) to echo. | 225 | This adds options (-n and -e) to echo. |
226 | 226 | ||
227 | config CONFIG_ENV | 227 | config ENV |
228 | bool "env" | 228 | bool "env" |
229 | default n | 229 | default n |
230 | help | 230 | help |
@@ -232,158 +232,158 @@ config CONFIG_ENV | |||
232 | a command; without options it displays the current | 232 | a command; without options it displays the current |
233 | environment. | 233 | environment. |
234 | 234 | ||
235 | config CONFIG_FEATURE_ENV_LONG_OPTIONS | 235 | config FEATURE_ENV_LONG_OPTIONS |
236 | bool "Enable long options" | 236 | bool "Enable long options" |
237 | default n | 237 | default n |
238 | depends on CONFIG_ENV && CONFIG_GETOPT_LONG | 238 | depends on ENV && GETOPT_LONG |
239 | help | 239 | help |
240 | Support long options for the env applet. | 240 | Support long options for the env applet. |
241 | 241 | ||
242 | config CONFIG_EXPR | 242 | config EXPR |
243 | bool "expr" | 243 | bool "expr" |
244 | default n | 244 | default n |
245 | help | 245 | help |
246 | expr is used to calculate numbers and print the result | 246 | expr is used to calculate numbers and print the result |
247 | to standard output. | 247 | to standard output. |
248 | 248 | ||
249 | config CONFIG_EXPR_MATH_SUPPORT_64 | 249 | config EXPR_MATH_SUPPORT_64 |
250 | bool "Extend Posix numbers support to 64 bit" | 250 | bool "Extend Posix numbers support to 64 bit" |
251 | default n | 251 | default n |
252 | depends on CONFIG_EXPR | 252 | depends on EXPR |
253 | help | 253 | help |
254 | Enable 64-bit math support in the expr applet. This will make | 254 | Enable 64-bit math support in the expr applet. This will make |
255 | the applet slightly larger, but will allow computation with very | 255 | the applet slightly larger, but will allow computation with very |
256 | large numbers. | 256 | large numbers. |
257 | 257 | ||
258 | config CONFIG_FALSE | 258 | config FALSE |
259 | bool "false" | 259 | bool "false" |
260 | default n | 260 | default n |
261 | help | 261 | help |
262 | false returns an exit code of FALSE (1). | 262 | false returns an exit code of FALSE (1). |
263 | 263 | ||
264 | config CONFIG_FOLD | 264 | config FOLD |
265 | bool "fold" | 265 | bool "fold" |
266 | default n | 266 | default n |
267 | help | 267 | help |
268 | Wrap text to fit a specific width. | 268 | Wrap text to fit a specific width. |
269 | 269 | ||
270 | config CONFIG_HEAD | 270 | config HEAD |
271 | bool "head" | 271 | bool "head" |
272 | default n | 272 | default n |
273 | help | 273 | help |
274 | head is used to print the first specified number of lines | 274 | head is used to print the first specified number of lines |
275 | from files. | 275 | from files. |
276 | 276 | ||
277 | config CONFIG_FEATURE_FANCY_HEAD | 277 | config FEATURE_FANCY_HEAD |
278 | bool "Enable head options (-c, -q, and -v)" | 278 | bool "Enable head options (-c, -q, and -v)" |
279 | default n | 279 | default n |
280 | depends on CONFIG_HEAD | 280 | depends on HEAD |
281 | help | 281 | help |
282 | This enables the head options (-c, -q, and -v). | 282 | This enables the head options (-c, -q, and -v). |
283 | 283 | ||
284 | config CONFIG_HOSTID | 284 | config HOSTID |
285 | bool "hostid" | 285 | bool "hostid" |
286 | default n | 286 | default n |
287 | help | 287 | help |
288 | hostid prints the numeric identifier (in hexadecimal) for | 288 | hostid prints the numeric identifier (in hexadecimal) for |
289 | the current host. | 289 | the current host. |
290 | 290 | ||
291 | config CONFIG_ID | 291 | config ID |
292 | bool "id" | 292 | bool "id" |
293 | default n | 293 | default n |
294 | help | 294 | help |
295 | id displays the current user and group ID names. | 295 | id displays the current user and group ID names. |
296 | 296 | ||
297 | config CONFIG_INSTALL | 297 | config INSTALL |
298 | bool "install" | 298 | bool "install" |
299 | default n | 299 | default n |
300 | help | 300 | help |
301 | Copy files and set attributes. | 301 | Copy files and set attributes. |
302 | 302 | ||
303 | config CONFIG_FEATURE_INSTALL_LONG_OPTIONS | 303 | config FEATURE_INSTALL_LONG_OPTIONS |
304 | bool "Enable long options" | 304 | bool "Enable long options" |
305 | default n | 305 | default n |
306 | depends on CONFIG_INSTALL && CONFIG_GETOPT_LONG | 306 | depends on INSTALL && GETOPT_LONG |
307 | help | 307 | help |
308 | Support long options for the install applet. | 308 | Support long options for the install applet. |
309 | 309 | ||
310 | config CONFIG_LENGTH | 310 | config LENGTH |
311 | bool "length" | 311 | bool "length" |
312 | default n | 312 | default n |
313 | help | 313 | help |
314 | length is used to print out the length of a specified string. | 314 | length is used to print out the length of a specified string. |
315 | 315 | ||
316 | config CONFIG_LN | 316 | config LN |
317 | bool "ln" | 317 | bool "ln" |
318 | default n | 318 | default n |
319 | help | 319 | help |
320 | ln is used to create hard or soft links between files. | 320 | ln is used to create hard or soft links between files. |
321 | 321 | ||
322 | config CONFIG_LOGNAME | 322 | config LOGNAME |
323 | bool "logname" | 323 | bool "logname" |
324 | default n | 324 | default n |
325 | help | 325 | help |
326 | logname is used to print the current user's login name. | 326 | logname is used to print the current user's login name. |
327 | 327 | ||
328 | config CONFIG_LS | 328 | config LS |
329 | bool "ls" | 329 | bool "ls" |
330 | default n | 330 | default n |
331 | help | 331 | help |
332 | ls is used to list the contents of directories. | 332 | ls is used to list the contents of directories. |
333 | 333 | ||
334 | config CONFIG_FEATURE_LS_FILETYPES | 334 | config FEATURE_LS_FILETYPES |
335 | bool "Enable filetyping options (-p and -F)" | 335 | bool "Enable filetyping options (-p and -F)" |
336 | default y | 336 | default y |
337 | depends on CONFIG_LS | 337 | depends on LS |
338 | help | 338 | help |
339 | Enable the ls options (-p and -F). | 339 | Enable the ls options (-p and -F). |
340 | 340 | ||
341 | config CONFIG_FEATURE_LS_FOLLOWLINKS | 341 | config FEATURE_LS_FOLLOWLINKS |
342 | bool "Enable symlinks dereferencing (-L)" | 342 | bool "Enable symlinks dereferencing (-L)" |
343 | default y | 343 | default y |
344 | depends on CONFIG_LS | 344 | depends on LS |
345 | help | 345 | help |
346 | Enable the ls option (-L). | 346 | Enable the ls option (-L). |
347 | 347 | ||
348 | config CONFIG_FEATURE_LS_RECURSIVE | 348 | config FEATURE_LS_RECURSIVE |
349 | bool "Enable recursion (-R)" | 349 | bool "Enable recursion (-R)" |
350 | default y | 350 | default y |
351 | depends on CONFIG_LS | 351 | depends on LS |
352 | help | 352 | help |
353 | Enable the ls option (-R). | 353 | Enable the ls option (-R). |
354 | 354 | ||
355 | config CONFIG_FEATURE_LS_SORTFILES | 355 | config FEATURE_LS_SORTFILES |
356 | bool "Sort the file names" | 356 | bool "Sort the file names" |
357 | default y | 357 | default y |
358 | depends on CONFIG_LS | 358 | depends on LS |
359 | help | 359 | help |
360 | Allow ls to sort file names alphabetically. | 360 | Allow ls to sort file names alphabetically. |
361 | 361 | ||
362 | config CONFIG_FEATURE_LS_TIMESTAMPS | 362 | config FEATURE_LS_TIMESTAMPS |
363 | bool "Show file timestamps" | 363 | bool "Show file timestamps" |
364 | default y | 364 | default y |
365 | depends on CONFIG_LS | 365 | depends on LS |
366 | help | 366 | help |
367 | Allow ls to display timestamps for files. | 367 | Allow ls to display timestamps for files. |
368 | 368 | ||
369 | config CONFIG_FEATURE_LS_USERNAME | 369 | config FEATURE_LS_USERNAME |
370 | bool "Show username/groupnames" | 370 | bool "Show username/groupnames" |
371 | default y | 371 | default y |
372 | depends on CONFIG_LS | 372 | depends on LS |
373 | help | 373 | help |
374 | Allow ls to display username/groupname for files. | 374 | Allow ls to display username/groupname for files. |
375 | 375 | ||
376 | config CONFIG_FEATURE_LS_COLOR | 376 | config FEATURE_LS_COLOR |
377 | bool "Allow use of color to identify file types" | 377 | bool "Allow use of color to identify file types" |
378 | default y | 378 | default y |
379 | depends on CONFIG_LS && CONFIG_GETOPT_LONG | 379 | depends on LS && GETOPT_LONG |
380 | help | 380 | help |
381 | This enables the --color option to ls. | 381 | This enables the --color option to ls. |
382 | 382 | ||
383 | config CONFIG_FEATURE_LS_COLOR_IS_DEFAULT | 383 | config FEATURE_LS_COLOR_IS_DEFAULT |
384 | bool "Produce colored ls output by default" | 384 | bool "Produce colored ls output by default" |
385 | default n | 385 | default n |
386 | depends on CONFIG_FEATURE_LS_COLOR | 386 | depends on FEATURE_LS_COLOR |
387 | help | 387 | help |
388 | Saying yes here will turn coloring on by default, | 388 | Saying yes here will turn coloring on by default, |
389 | even if no "--color" option is given to the ls command. | 389 | even if no "--color" option is given to the ls command. |
@@ -391,143 +391,143 @@ config CONFIG_FEATURE_LS_COLOR_IS_DEFAULT | |||
391 | configurable, and the output may not be legible on | 391 | configurable, and the output may not be legible on |
392 | many output screens. | 392 | many output screens. |
393 | 393 | ||
394 | config CONFIG_MD5SUM | 394 | config MD5SUM |
395 | bool "md5sum" | 395 | bool "md5sum" |
396 | default n | 396 | default n |
397 | help | 397 | help |
398 | md5sum is used to print or check MD5 checksums. | 398 | md5sum is used to print or check MD5 checksums. |
399 | 399 | ||
400 | config CONFIG_MKDIR | 400 | config MKDIR |
401 | bool "mkdir" | 401 | bool "mkdir" |
402 | default n | 402 | default n |
403 | help | 403 | help |
404 | mkdir is used to create directories with the specified names. | 404 | mkdir is used to create directories with the specified names. |
405 | 405 | ||
406 | config CONFIG_FEATURE_MKDIR_LONG_OPTIONS | 406 | config FEATURE_MKDIR_LONG_OPTIONS |
407 | bool "Enable long options" | 407 | bool "Enable long options" |
408 | default n | 408 | default n |
409 | depends on CONFIG_MKDIR && CONFIG_GETOPT_LONG | 409 | depends on MKDIR && GETOPT_LONG |
410 | help | 410 | help |
411 | Support long options for the mkdir applet. | 411 | Support long options for the mkdir applet. |
412 | 412 | ||
413 | config CONFIG_MKFIFO | 413 | config MKFIFO |
414 | bool "mkfifo" | 414 | bool "mkfifo" |
415 | default n | 415 | default n |
416 | help | 416 | help |
417 | mkfifo is used to create FIFOs (named pipes). | 417 | mkfifo is used to create FIFOs (named pipes). |
418 | The `mknod' program can also create FIFOs. | 418 | The `mknod' program can also create FIFOs. |
419 | 419 | ||
420 | config CONFIG_MKNOD | 420 | config MKNOD |
421 | bool "mknod" | 421 | bool "mknod" |
422 | default n | 422 | default n |
423 | help | 423 | help |
424 | mknod is used to create FIFOs or block/character special | 424 | mknod is used to create FIFOs or block/character special |
425 | files with the specified names. | 425 | files with the specified names. |
426 | 426 | ||
427 | config CONFIG_MV | 427 | config MV |
428 | bool "mv" | 428 | bool "mv" |
429 | default n | 429 | default n |
430 | help | 430 | help |
431 | mv is used to move or rename files or directories. | 431 | mv is used to move or rename files or directories. |
432 | 432 | ||
433 | config CONFIG_FEATURE_MV_LONG_OPTIONS | 433 | config FEATURE_MV_LONG_OPTIONS |
434 | bool "Enable long options" | 434 | bool "Enable long options" |
435 | default n | 435 | default n |
436 | depends on CONFIG_MV && CONFIG_GETOPT_LONG | 436 | depends on MV && GETOPT_LONG |
437 | help | 437 | help |
438 | Support long options for the mv applet. | 438 | Support long options for the mv applet. |
439 | 439 | ||
440 | config CONFIG_NICE | 440 | config NICE |
441 | bool "nice" | 441 | bool "nice" |
442 | default n | 442 | default n |
443 | help | 443 | help |
444 | nice runs a program with modified scheduling priority. | 444 | nice runs a program with modified scheduling priority. |
445 | 445 | ||
446 | config CONFIG_NOHUP | 446 | config NOHUP |
447 | bool "nohup" | 447 | bool "nohup" |
448 | default n | 448 | default n |
449 | help | 449 | help |
450 | run a command immune to hangups, with output to a non-tty. | 450 | run a command immune to hangups, with output to a non-tty. |
451 | 451 | ||
452 | config CONFIG_OD | 452 | config OD |
453 | bool "od" | 453 | bool "od" |
454 | default n | 454 | default n |
455 | help | 455 | help |
456 | od is used to dump binary files in octal and other formats. | 456 | od is used to dump binary files in octal and other formats. |
457 | 457 | ||
458 | config CONFIG_PRINTENV | 458 | config PRINTENV |
459 | bool "printenv" | 459 | bool "printenv" |
460 | default n | 460 | default n |
461 | help | 461 | help |
462 | printenv is used to print all or part of environment. | 462 | printenv is used to print all or part of environment. |
463 | 463 | ||
464 | config CONFIG_PRINTF | 464 | config PRINTF |
465 | bool "printf" | 465 | bool "printf" |
466 | default n | 466 | default n |
467 | help | 467 | help |
468 | printf is used to format and print specified strings. | 468 | printf is used to format and print specified strings. |
469 | It's similar to `echo' except it has more options. | 469 | It's similar to `echo' except it has more options. |
470 | 470 | ||
471 | config CONFIG_PWD | 471 | config PWD |
472 | bool "pwd" | 472 | bool "pwd" |
473 | default n | 473 | default n |
474 | help | 474 | help |
475 | pwd is used to print the current directory. | 475 | pwd is used to print the current directory. |
476 | 476 | ||
477 | config CONFIG_REALPATH | 477 | config REALPATH |
478 | bool "realpath" | 478 | bool "realpath" |
479 | default n | 479 | default n |
480 | help | 480 | help |
481 | Return the canonicalized absolute pathname. | 481 | Return the canonicalized absolute pathname. |
482 | This isn't provided by GNU shellutils, but where else does it belong. | 482 | This isn't provided by GNU shellutils, but where else does it belong. |
483 | 483 | ||
484 | config CONFIG_RM | 484 | config RM |
485 | bool "rm" | 485 | bool "rm" |
486 | default n | 486 | default n |
487 | help | 487 | help |
488 | rm is used to remove files or directories. | 488 | rm is used to remove files or directories. |
489 | 489 | ||
490 | config CONFIG_RMDIR | 490 | config RMDIR |
491 | bool "rmdir" | 491 | bool "rmdir" |
492 | default n | 492 | default n |
493 | help | 493 | help |
494 | rmdir is used to remove empty directories. | 494 | rmdir is used to remove empty directories. |
495 | 495 | ||
496 | config CONFIG_SEQ | 496 | config SEQ |
497 | bool "seq" | 497 | bool "seq" |
498 | default n | 498 | default n |
499 | help | 499 | help |
500 | print a sequence of numbers | 500 | print a sequence of numbers |
501 | 501 | ||
502 | config CONFIG_SHA1SUM | 502 | config SHA1SUM |
503 | bool "sha1sum" | 503 | bool "sha1sum" |
504 | default n | 504 | default n |
505 | help | 505 | help |
506 | Compute and check SHA1 message digest | 506 | Compute and check SHA1 message digest |
507 | 507 | ||
508 | config CONFIG_SLEEP | 508 | config SLEEP |
509 | bool "sleep (single integer arg with no suffix)" | 509 | bool "sleep (single integer arg with no suffix)" |
510 | default n | 510 | default n |
511 | help | 511 | help |
512 | sleep is used to pause for a specified number of seconds, | 512 | sleep is used to pause for a specified number of seconds, |
513 | 513 | ||
514 | config CONFIG_FEATURE_FANCY_SLEEP | 514 | config FEATURE_FANCY_SLEEP |
515 | bool "Enable multiple integer args and optional time suffixes" | 515 | bool "Enable multiple integer args and optional time suffixes" |
516 | default n | 516 | default n |
517 | depends on CONFIG_SLEEP | 517 | depends on SLEEP |
518 | help | 518 | help |
519 | Allow sleep to pause for specified minutes, hours, and days. | 519 | Allow sleep to pause for specified minutes, hours, and days. |
520 | 520 | ||
521 | config CONFIG_SORT | 521 | config SORT |
522 | bool "sort" | 522 | bool "sort" |
523 | default n | 523 | default n |
524 | help | 524 | help |
525 | sort is used to sort lines of text in specified files. | 525 | sort is used to sort lines of text in specified files. |
526 | 526 | ||
527 | config CONFIG_FEATURE_SORT_BIG | 527 | config FEATURE_SORT_BIG |
528 | bool "full SuSv3 compliant sort (Support -ktcsbdfiozgM)" | 528 | bool "full SuSv3 compliant sort (Support -ktcsbdfiozgM)" |
529 | default y | 529 | default y |
530 | depends on CONFIG_SORT | 530 | depends on SORT |
531 | help | 531 | help |
532 | Without this, sort only supports -r, -u, and an integer version | 532 | Without this, sort only supports -r, -u, and an integer version |
533 | of -n. Selecting this adds sort keys, floating point support, and | 533 | of -n. Selecting this adds sort keys, floating point support, and |
@@ -536,69 +536,69 @@ config CONFIG_FEATURE_SORT_BIG | |||
536 | The SuSv3 sort standard is available at: | 536 | The SuSv3 sort standard is available at: |
537 | http://www.opengroup.org/onlinepubs/007904975/utilities/sort.html | 537 | http://www.opengroup.org/onlinepubs/007904975/utilities/sort.html |
538 | 538 | ||
539 | config CONFIG_STAT | 539 | config STAT |
540 | bool "stat" | 540 | bool "stat" |
541 | default n | 541 | default n |
542 | help | 542 | help |
543 | display file or filesystem status. | 543 | display file or filesystem status. |
544 | 544 | ||
545 | config CONFIG_FEATURE_STAT_FORMAT | 545 | config FEATURE_STAT_FORMAT |
546 | bool "Enable custom formats (-c)" | 546 | bool "Enable custom formats (-c)" |
547 | default n | 547 | default n |
548 | depends on CONFIG_STAT | 548 | depends on STAT |
549 | help | 549 | help |
550 | Without this, stat will not support the '-c format' option where | 550 | Without this, stat will not support the '-c format' option where |
551 | users can pass a custom format string for output. This adds about | 551 | users can pass a custom format string for output. This adds about |
552 | 7k to a nonstatic build on amd64. | 552 | 7k to a nonstatic build on amd64. |
553 | 553 | ||
554 | config CONFIG_STTY | 554 | config STTY |
555 | bool "stty" | 555 | bool "stty" |
556 | default n | 556 | default n |
557 | help | 557 | help |
558 | stty is used to change and print terminal line settings. | 558 | stty is used to change and print terminal line settings. |
559 | 559 | ||
560 | config CONFIG_SUM | 560 | config SUM |
561 | bool "sum" | 561 | bool "sum" |
562 | default n | 562 | default n |
563 | help | 563 | help |
564 | checksum and count the blocks in a file | 564 | checksum and count the blocks in a file |
565 | 565 | ||
566 | config CONFIG_SYNC | 566 | config SYNC |
567 | bool "sync" | 567 | bool "sync" |
568 | default n | 568 | default n |
569 | help | 569 | help |
570 | sync is used to flush filesystem buffers. | 570 | sync is used to flush filesystem buffers. |
571 | 571 | ||
572 | config CONFIG_TAIL | 572 | config TAIL |
573 | bool "tail" | 573 | bool "tail" |
574 | default n | 574 | default n |
575 | help | 575 | help |
576 | tail is used to print the last specified number of lines | 576 | tail is used to print the last specified number of lines |
577 | from files. | 577 | from files. |
578 | 578 | ||
579 | config CONFIG_FEATURE_FANCY_TAIL | 579 | config FEATURE_FANCY_TAIL |
580 | bool "Enable extra tail options (-q, -s, and -v)" | 580 | bool "Enable extra tail options (-q, -s, and -v)" |
581 | default y | 581 | default y |
582 | depends on CONFIG_TAIL | 582 | depends on TAIL |
583 | help | 583 | help |
584 | The options (-q, -s, and -v) are provided by GNU tail, but | 584 | The options (-q, -s, and -v) are provided by GNU tail, but |
585 | are not specific in the SUSv3 standard. | 585 | are not specific in the SUSv3 standard. |
586 | 586 | ||
587 | config CONFIG_TEE | 587 | config TEE |
588 | bool "tee" | 588 | bool "tee" |
589 | default n | 589 | default n |
590 | help | 590 | help |
591 | tee is used to read from standard input and write | 591 | tee is used to read from standard input and write |
592 | to standard output and files. | 592 | to standard output and files. |
593 | 593 | ||
594 | config CONFIG_FEATURE_TEE_USE_BLOCK_IO | 594 | config FEATURE_TEE_USE_BLOCK_IO |
595 | bool "Enable block i/o (larger/faster) instead of byte i/o." | 595 | bool "Enable block i/o (larger/faster) instead of byte i/o." |
596 | default n | 596 | default n |
597 | depends on CONFIG_TEE | 597 | depends on TEE |
598 | help | 598 | help |
599 | Enable this option for a faster tee, at expense of size. | 599 | Enable this option for a faster tee, at expense of size. |
600 | 600 | ||
601 | config CONFIG_TEST | 601 | config TEST |
602 | bool "test" | 602 | bool "test" |
603 | default n | 603 | default n |
604 | help | 604 | help |
@@ -606,39 +606,39 @@ config CONFIG_TEST | |||
606 | returning an appropriate exit code. The bash shell | 606 | returning an appropriate exit code. The bash shell |
607 | has test built in, ash can build it in optionally. | 607 | has test built in, ash can build it in optionally. |
608 | 608 | ||
609 | config CONFIG_FEATURE_TEST_64 | 609 | config FEATURE_TEST_64 |
610 | bool "Extend test to 64 bit" | 610 | bool "Extend test to 64 bit" |
611 | default n | 611 | default n |
612 | depends on CONFIG_TEST | 612 | depends on TEST |
613 | help | 613 | help |
614 | Enable 64-bit support in test. | 614 | Enable 64-bit support in test. |
615 | 615 | ||
616 | config CONFIG_TOUCH | 616 | config TOUCH |
617 | bool "touch" | 617 | bool "touch" |
618 | default n | 618 | default n |
619 | help | 619 | help |
620 | touch is used to create or change the access and/or | 620 | touch is used to create or change the access and/or |
621 | modification timestamp of specified files. | 621 | modification timestamp of specified files. |
622 | 622 | ||
623 | config CONFIG_TR | 623 | config TR |
624 | bool "tr" | 624 | bool "tr" |
625 | default n | 625 | default n |
626 | help | 626 | help |
627 | tr is used to squeeze, and/or delete characters from standard | 627 | tr is used to squeeze, and/or delete characters from standard |
628 | input, writing to standard output. | 628 | input, writing to standard output. |
629 | 629 | ||
630 | config CONFIG_FEATURE_TR_CLASSES | 630 | config FEATURE_TR_CLASSES |
631 | bool "Enable character classes (such as [:upper:])" | 631 | bool "Enable character classes (such as [:upper:])" |
632 | default n | 632 | default n |
633 | depends on CONFIG_TR | 633 | depends on TR |
634 | help | 634 | help |
635 | Enable character classes, enabling commands such as: | 635 | Enable character classes, enabling commands such as: |
636 | tr [:upper:] [:lower:] to convert input into lowercase. | 636 | tr [:upper:] [:lower:] to convert input into lowercase. |
637 | 637 | ||
638 | config CONFIG_FEATURE_TR_EQUIV | 638 | config FEATURE_TR_EQUIV |
639 | bool "Enable equivalence classes" | 639 | bool "Enable equivalence classes" |
640 | default n | 640 | default n |
641 | depends on CONFIG_TR | 641 | depends on TR |
642 | help | 642 | help |
643 | Enable equivalence classes, which essentially add the enclosed | 643 | Enable equivalence classes, which essentially add the enclosed |
644 | character to the current set. For instance, tr [=a=] xyz would | 644 | character to the current set. For instance, tr [=a=] xyz would |
@@ -646,86 +646,86 @@ config CONFIG_FEATURE_TR_EQUIV | |||
646 | useful for cases when no other way of expressing a character | 646 | useful for cases when no other way of expressing a character |
647 | is possible. | 647 | is possible. |
648 | 648 | ||
649 | config CONFIG_TRUE | 649 | config TRUE |
650 | bool "true" | 650 | bool "true" |
651 | default n | 651 | default n |
652 | help | 652 | help |
653 | true returns an exit code of TRUE (0). | 653 | true returns an exit code of TRUE (0). |
654 | 654 | ||
655 | config CONFIG_TTY | 655 | config TTY |
656 | bool "tty" | 656 | bool "tty" |
657 | default n | 657 | default n |
658 | help | 658 | help |
659 | tty is used to print the name of the current terminal to | 659 | tty is used to print the name of the current terminal to |
660 | standard output. | 660 | standard output. |
661 | 661 | ||
662 | config CONFIG_UNAME | 662 | config UNAME |
663 | bool "uname" | 663 | bool "uname" |
664 | default n | 664 | default n |
665 | help | 665 | help |
666 | uname is used to print system information. | 666 | uname is used to print system information. |
667 | 667 | ||
668 | config CONFIG_UNIQ | 668 | config UNIQ |
669 | bool "uniq" | 669 | bool "uniq" |
670 | default n | 670 | default n |
671 | help | 671 | help |
672 | uniq is used to remove duplicate lines from a sorted file. | 672 | uniq is used to remove duplicate lines from a sorted file. |
673 | 673 | ||
674 | config CONFIG_USLEEP | 674 | config USLEEP |
675 | bool "usleep" | 675 | bool "usleep" |
676 | default n | 676 | default n |
677 | help | 677 | help |
678 | usleep is used to pause for a specified number of microseconds. | 678 | usleep is used to pause for a specified number of microseconds. |
679 | 679 | ||
680 | config CONFIG_UUDECODE | 680 | config UUDECODE |
681 | bool "uudecode" | 681 | bool "uudecode" |
682 | default n | 682 | default n |
683 | help | 683 | help |
684 | uudecode is used to decode a uuencoded file. | 684 | uudecode is used to decode a uuencoded file. |
685 | 685 | ||
686 | config CONFIG_UUENCODE | 686 | config UUENCODE |
687 | bool "uuencode" | 687 | bool "uuencode" |
688 | default n | 688 | default n |
689 | help | 689 | help |
690 | uuencode is used to uuencode a file. | 690 | uuencode is used to uuencode a file. |
691 | 691 | ||
692 | config CONFIG_WATCH | 692 | config WATCH |
693 | bool "watch" | 693 | bool "watch" |
694 | default n | 694 | default n |
695 | select CONFIG_DATE | 695 | select DATE |
696 | help | 696 | help |
697 | watch is used to execute a program periodically, showing | 697 | watch is used to execute a program periodically, showing |
698 | output to the screen. | 698 | output to the screen. |
699 | 699 | ||
700 | config CONFIG_WC | 700 | config WC |
701 | bool "wc" | 701 | bool "wc" |
702 | default n | 702 | default n |
703 | help | 703 | help |
704 | wc is used to print the number of bytes, words, and lines, | 704 | wc is used to print the number of bytes, words, and lines, |
705 | in specified files. | 705 | in specified files. |
706 | 706 | ||
707 | config CONFIG_FEATURE_WC_LARGE | 707 | config FEATURE_WC_LARGE |
708 | bool "Support very large files in wc" | 708 | bool "Support very large files in wc" |
709 | default n | 709 | default n |
710 | depends on CONFIG_WC | 710 | depends on WC |
711 | help | 711 | help |
712 | Use "unsigned long long" in wc for count variables | 712 | Use "unsigned long long" in wc for count variables |
713 | 713 | ||
714 | config CONFIG_WHO | 714 | config WHO |
715 | bool "who" | 715 | bool "who" |
716 | default n | 716 | default n |
717 | select CONFIG_FEATURE_UTMP | 717 | select FEATURE_UTMP |
718 | help | 718 | help |
719 | who is used to show who is logged on. | 719 | who is used to show who is logged on. |
720 | 720 | ||
721 | config CONFIG_WHOAMI | 721 | config WHOAMI |
722 | bool "whoami" | 722 | bool "whoami" |
723 | default n | 723 | default n |
724 | help | 724 | help |
725 | whoami is used to print the username of the current | 725 | whoami is used to print the username of the current |
726 | user id (same as id -un). | 726 | user id (same as id -un). |
727 | 727 | ||
728 | config CONFIG_YES | 728 | config YES |
729 | bool "yes" | 729 | bool "yes" |
730 | default n | 730 | default n |
731 | help | 731 | help |
@@ -733,22 +733,22 @@ config CONFIG_YES | |||
733 | the default string `y'. | 733 | the default string `y'. |
734 | 734 | ||
735 | comment "Common options for cp and mv" | 735 | comment "Common options for cp and mv" |
736 | depends on CONFIG_CP || CONFIG_MV | 736 | depends on CP || MV |
737 | 737 | ||
738 | config CONFIG_FEATURE_PRESERVE_HARDLINKS | 738 | config FEATURE_PRESERVE_HARDLINKS |
739 | bool "Preserve hard links" | 739 | bool "Preserve hard links" |
740 | default n | 740 | default n |
741 | depends on CONFIG_CP || CONFIG_MV | 741 | depends on CP || MV |
742 | help | 742 | help |
743 | Allow cp and mv to preserve hard links. | 743 | Allow cp and mv to preserve hard links. |
744 | 744 | ||
745 | comment "Common options for ls, more and telnet" | 745 | comment "Common options for ls, more and telnet" |
746 | depends on CONFIG_LS || CONFIG_MORE || CONFIG_TELNET | 746 | depends on LS || MORE || TELNET |
747 | 747 | ||
748 | config CONFIG_FEATURE_AUTOWIDTH | 748 | config FEATURE_AUTOWIDTH |
749 | bool "Calculate terminal & column widths" | 749 | bool "Calculate terminal & column widths" |
750 | default y | 750 | default y |
751 | depends on CONFIG_LS || CONFIG_MORE || CONFIG_TELNET | 751 | depends on LS || MORE || TELNET |
752 | help | 752 | help |
753 | This option allows utilities such as 'ls', 'more' and 'telnet' | 753 | This option allows utilities such as 'ls', 'more' and 'telnet' |
754 | to determine the width of the screen, which can allow them to | 754 | to determine the width of the screen, which can allow them to |
@@ -757,22 +757,22 @@ config CONFIG_FEATURE_AUTOWIDTH | |||
757 | primitive and will be unable to determine the current screen width. | 757 | primitive and will be unable to determine the current screen width. |
758 | 758 | ||
759 | comment "Common options for df, du, ls" | 759 | comment "Common options for df, du, ls" |
760 | depends on CONFIG_DF || CONFIG_DU || CONFIG_LS | 760 | depends on DF || DU || LS |
761 | 761 | ||
762 | config CONFIG_FEATURE_HUMAN_READABLE | 762 | config FEATURE_HUMAN_READABLE |
763 | bool "Support for human readable output (example 13k, 23M, 235G)" | 763 | bool "Support for human readable output (example 13k, 23M, 235G)" |
764 | default n | 764 | default n |
765 | depends on CONFIG_DF || CONFIG_DU || CONFIG_LS | 765 | depends on DF || DU || LS |
766 | help | 766 | help |
767 | Allow df, du, and ls to have human readable output. | 767 | Allow df, du, and ls to have human readable output. |
768 | 768 | ||
769 | comment "Common options for md5sum, sha1sum" | 769 | comment "Common options for md5sum, sha1sum" |
770 | depends on CONFIG_MD5SUM || CONFIG_SHA1SUM | 770 | depends on MD5SUM || SHA1SUM |
771 | 771 | ||
772 | config CONFIG_FEATURE_MD5_SHA1_SUM_CHECK | 772 | config FEATURE_MD5_SHA1_SUM_CHECK |
773 | bool "Enable -c, -s and -w options" | 773 | bool "Enable -c, -s and -w options" |
774 | default n | 774 | default n |
775 | depends on CONFIG_MD5SUM || CONFIG_SHA1SUM | 775 | depends on MD5SUM || SHA1SUM |
776 | help | 776 | help |
777 | Enabling the -c options allows files to be checked | 777 | Enabling the -c options allows files to be checked |
778 | against pre-calculated hash values. | 778 | against pre-calculated hash values. |
diff --git a/coreutils/Kbuild b/coreutils/Kbuild new file mode 100644 index 000000000..cf1718419 --- /dev/null +++ b/coreutils/Kbuild | |||
@@ -0,0 +1,81 @@ | |||
1 | # Makefile for busybox | ||
2 | # | ||
3 | # Copyright (C) 1999-2005 by Erik Andersen <andersen@codepoet.org> | ||
4 | # | ||
5 | # Licensed under the GPL v2, see the file LICENSE in this tarball. | ||
6 | |||
7 | libs-y += libcoreutils/ | ||
8 | |||
9 | lib-y:= | ||
10 | lib-$(CONFIG_BASENAME) += basename.o | ||
11 | lib-$(CONFIG_CAL) += cal.o | ||
12 | lib-$(CONFIG_CAT) += cat.o | ||
13 | lib-$(CONFIG_CATV) += catv.o | ||
14 | lib-$(CONFIG_CHGRP) += chgrp.o | ||
15 | lib-$(CONFIG_CHMOD) += chmod.o | ||
16 | lib-$(CONFIG_CHOWN) += chown.o | ||
17 | lib-$(CONFIG_CHROOT) += chroot.o | ||
18 | lib-$(CONFIG_CKSUM) += cksum.o | ||
19 | lib-$(CONFIG_CMP) += cmp.o | ||
20 | lib-$(CONFIG_COMM) += comm.o | ||
21 | lib-$(CONFIG_CP) += cp.o | ||
22 | lib-$(CONFIG_CUT) += cut.o | ||
23 | lib-$(CONFIG_DATE) += date.o | ||
24 | lib-$(CONFIG_DD) += dd.o | ||
25 | lib-$(CONFIG_DF) += df.o | ||
26 | lib-$(CONFIG_DIFF) += diff.o | ||
27 | lib-$(CONFIG_DIRNAME) += dirname.o | ||
28 | lib-$(CONFIG_DOS2UNIX) += dos2unix.o | ||
29 | lib-$(CONFIG_DU) += du.o | ||
30 | lib-$(CONFIG_ECHO) += echo.o | ||
31 | lib-$(CONFIG_ENV) += env.o | ||
32 | lib-$(CONFIG_EXPR) += expr.o | ||
33 | lib-$(CONFIG_FALSE) += false.o | ||
34 | lib-$(CONFIG_FOLD) += fold.o | ||
35 | lib-$(CONFIG_HEAD) += head.o | ||
36 | lib-$(CONFIG_HOSTID) += hostid.o | ||
37 | lib-$(CONFIG_ID) += id.o | ||
38 | lib-$(CONFIG_INSTALL) += install.o | ||
39 | lib-$(CONFIG_LENGTH) += length.o | ||
40 | lib-$(CONFIG_LN) += ln.o | ||
41 | lib-$(CONFIG_LOGNAME) += logname.o | ||
42 | lib-$(CONFIG_LS) += ls.o | ||
43 | lib-$(CONFIG_MD5SUM) += md5_sha1_sum.o | ||
44 | lib-$(CONFIG_MKDIR) += mkdir.o | ||
45 | lib-$(CONFIG_MKFIFO) += mkfifo.o | ||
46 | lib-$(CONFIG_MKNOD) += mknod.o | ||
47 | lib-$(CONFIG_MV) += mv.o | ||
48 | lib-$(CONFIG_NICE) += nice.o | ||
49 | lib-$(CONFIG_NOHUP) += nohup.o | ||
50 | lib-$(CONFIG_OD) += od.o | ||
51 | lib-$(CONFIG_PRINTENV) += printenv.o | ||
52 | lib-$(CONFIG_PRINTF) += printf.o | ||
53 | lib-$(CONFIG_PWD) += pwd.o | ||
54 | lib-$(CONFIG_REALPATH) += realpath.o | ||
55 | lib-$(CONFIG_RM) += rm.o | ||
56 | lib-$(CONFIG_RMDIR) += rmdir.o | ||
57 | lib-$(CONFIG_SEQ) += seq.o | ||
58 | lib-$(CONFIG_SHA1SUM) += md5_sha1_sum.o | ||
59 | lib-$(CONFIG_SLEEP) += sleep.o | ||
60 | lib-$(CONFIG_SORT) += sort.o | ||
61 | lib-$(CONFIG_STAT) += stat.o | ||
62 | lib-$(CONFIG_STTY) += stty.o | ||
63 | lib-$(CONFIG_SUM) += sum.o | ||
64 | lib-$(CONFIG_SYNC) += sync.o | ||
65 | lib-$(CONFIG_TAIL) += tail.o | ||
66 | lib-$(CONFIG_TEE) += tee.o | ||
67 | lib-$(CONFIG_TEST) += test.o | ||
68 | lib-$(CONFIG_TOUCH) += touch.o | ||
69 | lib-$(CONFIG_TR) += tr.o | ||
70 | lib-$(CONFIG_TRUE) += true.o | ||
71 | lib-$(CONFIG_TTY) += tty.o | ||
72 | lib-$(CONFIG_UNAME) += uname.o | ||
73 | lib-$(CONFIG_UNIQ) += uniq.o | ||
74 | lib-$(CONFIG_USLEEP) += usleep.o | ||
75 | lib-$(CONFIG_UUDECODE) += uudecode.o | ||
76 | lib-$(CONFIG_UUENCODE) += uuencode.o | ||
77 | lib-$(CONFIG_WATCH) += watch.o | ||
78 | lib-$(CONFIG_WC) += wc.o | ||
79 | lib-$(CONFIG_WHO) += who.o | ||
80 | lib-$(CONFIG_WHOAMI) += whoami.o | ||
81 | lib-$(CONFIG_YES) += yes.o | ||
diff --git a/coreutils/Makefile b/coreutils/Makefile deleted file mode 100644 index c29f3a934..000000000 --- a/coreutils/Makefile +++ /dev/null | |||
@@ -1,23 +0,0 @@ | |||
1 | # Makefile for busybox | ||
2 | # | ||
3 | # Copyright (C) 1999-2005 by Erik Andersen <andersen@codepoet.org> | ||
4 | # | ||
5 | # Licensed under the GPL v2, see the file LICENSE in this tarball. | ||
6 | |||
7 | ifndef top_srcdir | ||
8 | top_srcdir=.. | ||
9 | endif | ||
10 | ifndef top_builddir | ||
11 | top_builddir=.. | ||
12 | endif | ||
13 | srcdir=$(top_srcdir)/coreutils | ||
14 | SHELLUTILS_DIR:=./ | ||
15 | include $(top_srcdir)/Rules.mak | ||
16 | include $(top_builddir)/.config | ||
17 | include $(srcdir)/Makefile.in | ||
18 | all: $(libraries-y) | ||
19 | -include $(top_builddir)/.depend | ||
20 | |||
21 | clean: | ||
22 | rm -f *.o *.a $(AR_TARGET) | ||
23 | |||
diff --git a/coreutils/Makefile.in b/coreutils/Makefile.in deleted file mode 100644 index 50c090f8d..000000000 --- a/coreutils/Makefile.in +++ /dev/null | |||
@@ -1,102 +0,0 @@ | |||
1 | # Makefile for busybox | ||
2 | # | ||
3 | # Copyright (C) 1999-2005 by Erik Andersen <andersen@codepoet.org> | ||
4 | # | ||
5 | # Licensed under the GPL v2, see the file LICENSE in this tarball. | ||
6 | |||
7 | COREUTILS_AR:=coreutils.a | ||
8 | ifndef $(COREUTILS_DIR) | ||
9 | COREUTILS_DIR:=$(top_builddir)/coreutils/ | ||
10 | endif | ||
11 | srcdir=$(top_srcdir)/coreutils | ||
12 | |||
13 | COREUTILS-y:= | ||
14 | COREUTILS-$(CONFIG_BASENAME) += basename.o | ||
15 | COREUTILS-$(CONFIG_CAL) += cal.o | ||
16 | COREUTILS-$(CONFIG_CAT) += cat.o | ||
17 | COREUTILS-$(CONFIG_CATV) += catv.o | ||
18 | COREUTILS-$(CONFIG_CHGRP) += chgrp.o | ||
19 | COREUTILS-$(CONFIG_CHMOD) += chmod.o | ||
20 | COREUTILS-$(CONFIG_CHOWN) += chown.o | ||
21 | COREUTILS-$(CONFIG_CHROOT) += chroot.o | ||
22 | COREUTILS-$(CONFIG_CKSUM) += cksum.o | ||
23 | COREUTILS-$(CONFIG_CMP) += cmp.o | ||
24 | COREUTILS-$(CONFIG_COMM) += comm.o | ||
25 | COREUTILS-$(CONFIG_CP) += cp.o | ||
26 | COREUTILS-$(CONFIG_CUT) += cut.o | ||
27 | COREUTILS-$(CONFIG_DATE) += date.o | ||
28 | COREUTILS-$(CONFIG_DD) += dd.o | ||
29 | COREUTILS-$(CONFIG_DF) += df.o | ||
30 | COREUTILS-$(CONFIG_DIFF) += diff.o | ||
31 | COREUTILS-$(CONFIG_DIRNAME) += dirname.o | ||
32 | COREUTILS-$(CONFIG_DOS2UNIX) += dos2unix.o | ||
33 | COREUTILS-$(CONFIG_DU) += du.o | ||
34 | COREUTILS-$(CONFIG_ECHO) += echo.o | ||
35 | COREUTILS-$(CONFIG_ENV) += env.o | ||
36 | COREUTILS-$(CONFIG_EXPR) += expr.o | ||
37 | COREUTILS-$(CONFIG_FALSE) += false.o | ||
38 | COREUTILS-$(CONFIG_FOLD) += fold.o | ||
39 | COREUTILS-$(CONFIG_HEAD) += head.o | ||
40 | COREUTILS-$(CONFIG_HOSTID) += hostid.o | ||
41 | COREUTILS-$(CONFIG_ID) += id.o | ||
42 | COREUTILS-$(CONFIG_INSTALL) += install.o | ||
43 | COREUTILS-$(CONFIG_LENGTH) += length.o | ||
44 | COREUTILS-$(CONFIG_LN) += ln.o | ||
45 | COREUTILS-$(CONFIG_LOGNAME) += logname.o | ||
46 | COREUTILS-$(CONFIG_LS) += ls.o | ||
47 | COREUTILS-$(CONFIG_MD5SUM) += md5_sha1_sum.o | ||
48 | COREUTILS-$(CONFIG_MKDIR) += mkdir.o | ||
49 | COREUTILS-$(CONFIG_MKFIFO) += mkfifo.o | ||
50 | COREUTILS-$(CONFIG_MKNOD) += mknod.o | ||
51 | COREUTILS-$(CONFIG_MV) += mv.o | ||
52 | COREUTILS-$(CONFIG_NICE) += nice.o | ||
53 | COREUTILS-$(CONFIG_NOHUP) += nohup.o | ||
54 | COREUTILS-$(CONFIG_OD) += od.o | ||
55 | COREUTILS-$(CONFIG_PRINTENV) += printenv.o | ||
56 | COREUTILS-$(CONFIG_PRINTF) += printf.o | ||
57 | COREUTILS-$(CONFIG_PWD) += pwd.o | ||
58 | COREUTILS-$(CONFIG_REALPATH) += realpath.o | ||
59 | COREUTILS-$(CONFIG_RM) += rm.o | ||
60 | COREUTILS-$(CONFIG_RMDIR) += rmdir.o | ||
61 | COREUTILS-$(CONFIG_SEQ) += seq.o | ||
62 | COREUTILS-$(CONFIG_SHA1SUM) += md5_sha1_sum.o | ||
63 | COREUTILS-$(CONFIG_SLEEP) += sleep.o | ||
64 | COREUTILS-$(CONFIG_SORT) += sort.o | ||
65 | COREUTILS-$(CONFIG_STAT) += stat.o | ||
66 | COREUTILS-$(CONFIG_STTY) += stty.o | ||
67 | COREUTILS-$(CONFIG_SUM) += sum.o | ||
68 | COREUTILS-$(CONFIG_SYNC) += sync.o | ||
69 | COREUTILS-$(CONFIG_TAIL) += tail.o | ||
70 | COREUTILS-$(CONFIG_TEE) += tee.o | ||
71 | COREUTILS-$(CONFIG_TEST) += test.o | ||
72 | COREUTILS-$(CONFIG_TOUCH) += touch.o | ||
73 | COREUTILS-$(CONFIG_TR) += tr.o | ||
74 | COREUTILS-$(CONFIG_TRUE) += true.o | ||
75 | COREUTILS-$(CONFIG_TTY) += tty.o | ||
76 | COREUTILS-$(CONFIG_UNAME) += uname.o | ||
77 | COREUTILS-$(CONFIG_UNIQ) += uniq.o | ||
78 | COREUTILS-$(CONFIG_USLEEP) += usleep.o | ||
79 | COREUTILS-$(CONFIG_UUDECODE) += uudecode.o | ||
80 | COREUTILS-$(CONFIG_UUENCODE) += uuencode.o | ||
81 | COREUTILS-$(CONFIG_WATCH) += watch.o | ||
82 | COREUTILS-$(CONFIG_WC) += wc.o | ||
83 | COREUTILS-$(CONFIG_WHO) += who.o | ||
84 | COREUTILS-$(CONFIG_WHOAMI) += whoami.o | ||
85 | COREUTILS-$(CONFIG_YES) += yes.o | ||
86 | |||
87 | COREUTILS-y:=$(sort $(COREUTILS-y)) | ||
88 | |||
89 | ifneq ($(strip $(COREUTILS-y)),) | ||
90 | libraries-y+=$(COREUTILS_DIR)$(COREUTILS_AR) | ||
91 | endif | ||
92 | |||
93 | COREUTILS_SRC-y:=$(patsubst %.o,$(srcdir)/%.c,$(COREUTILS-y)) | ||
94 | COREUTILS_SRC-a:=$(wildcard $(srcdir)/*.c) | ||
95 | APPLET_SRC-y+=$(COREUTILS_SRC-y) | ||
96 | APPLET_SRC-a+=$(COREUTILS_SRC-a) | ||
97 | |||
98 | $(COREUTILS_DIR)$(COREUTILS_AR): $(patsubst %,$(COREUTILS_DIR)%, $(COREUTILS-y)) | ||
99 | $(do_ar) | ||
100 | |||
101 | $(COREUTILS_DIR)%.o: $(srcdir)/%.c | ||
102 | $(compile.c) | ||
diff --git a/coreutils/diff.c b/coreutils/diff.c index 2edcd96ca..b30aad5a7 100644 --- a/coreutils/diff.c +++ b/coreutils/diff.c | |||
@@ -1165,9 +1165,8 @@ int diff_main(int argc, char **argv) | |||
1165 | llist_t *L_arg = NULL; | 1165 | llist_t *L_arg = NULL; |
1166 | 1166 | ||
1167 | opt_complementary = "L::"; | 1167 | opt_complementary = "L::"; |
1168 | cmd_flags = | 1168 | cmd_flags = getopt32(argc, argv, "abdiL:NqrsS:tTU:wu", |
1169 | getopt32(argc, argv, "abdiL:NqrsS:tTU:wu", &L_arg, &start, | 1169 | &L_arg, &start, &U_opt); |
1170 | &U_opt); | ||
1171 | 1170 | ||
1172 | if (cmd_flags & FLAG_L) { | 1171 | if (cmd_flags & FLAG_L) { |
1173 | while (L_arg) { | 1172 | while (L_arg) { |
diff --git a/coreutils/id.c b/coreutils/id.c index dd825ab3c..9e49999cd 100644 --- a/coreutils/id.c +++ b/coreutils/id.c | |||
@@ -13,7 +13,6 @@ | |||
13 | */ | 13 | */ |
14 | 14 | ||
15 | #include "busybox.h" | 15 | #include "busybox.h" |
16 | #include "pwd_.h" | ||
17 | #include <stdio.h> | 16 | #include <stdio.h> |
18 | #include <unistd.h> | 17 | #include <unistd.h> |
19 | #include <sys/types.h> | 18 | #include <sys/types.h> |
diff --git a/coreutils/libcoreutils/Kbuild b/coreutils/libcoreutils/Kbuild new file mode 100644 index 000000000..755d01f86 --- /dev/null +++ b/coreutils/libcoreutils/Kbuild | |||
@@ -0,0 +1,12 @@ | |||
1 | # Makefile for busybox | ||
2 | # | ||
3 | # Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org> | ||
4 | # | ||
5 | # Licensed under the GPL v2 or later, see the file LICENSE in this tarball. | ||
6 | |||
7 | lib-y:= | ||
8 | lib-$(CONFIG_MKFIFO) += getopt_mk_fifo_nod.o | ||
9 | lib-$(CONFIG_MKNOD) += getopt_mk_fifo_nod.o | ||
10 | lib-$(CONFIG_INSTALL) += cp_mv_stat.o | ||
11 | lib-$(CONFIG_CP) += cp_mv_stat.o | ||
12 | lib-$(CONFIG_MV) += cp_mv_stat.o | ||
diff --git a/coreutils/libcoreutils/Makefile b/coreutils/libcoreutils/Makefile deleted file mode 100644 index fabde2d0e..000000000 --- a/coreutils/libcoreutils/Makefile +++ /dev/null | |||
@@ -1,37 +0,0 @@ | |||
1 | # Makefile for busybox | ||
2 | # | ||
3 | # Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org> | ||
4 | # | ||
5 | # This program is free software; you can redistribute it and/or modify | ||
6 | # it under the terms of the GNU General Public License as published by | ||
7 | # the Free Software Foundation; either version 2 of the License, or | ||
8 | # (at your option) any later version. | ||
9 | # | ||
10 | # This program is distributed in the hope that it will be useful, | ||
11 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
13 | # General Public License for more details. | ||
14 | # | ||
15 | # You should have received a copy of the GNU General Public License | ||
16 | # along with this program; if not, write to the Free Software | ||
17 | # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
18 | # | ||
19 | |||
20 | ifndef top_srcdir | ||
21 | top_srcdir=../.. | ||
22 | endif | ||
23 | ifndef top_builddir | ||
24 | top_builddir=../.. | ||
25 | endif | ||
26 | srcdir=$(top_srcdir)/coreutils/libcoreutils | ||
27 | LIBCOREUTILS_DIR:=./ | ||
28 | include $(top_srcdir)/Rules.mak | ||
29 | include $(top_builddir)/.config | ||
30 | include $(srcdir)/Makefile.in | ||
31 | |||
32 | all: $(libraries-y) | ||
33 | -include $(top_builddir)/.depend | ||
34 | |||
35 | clean: | ||
36 | rm -f *.o *.a $(AR_TARGET) | ||
37 | |||
diff --git a/coreutils/libcoreutils/Makefile.in b/coreutils/libcoreutils/Makefile.in deleted file mode 100644 index 30a38c9d9..000000000 --- a/coreutils/libcoreutils/Makefile.in +++ /dev/null | |||
@@ -1,39 +0,0 @@ | |||
1 | # Makefile for busybox | ||
2 | # | ||
3 | # Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org> | ||
4 | # | ||
5 | # Licensed under the GPL v2 or later, see the file LICENSE in this tarball. | ||
6 | |||
7 | LIBCOREUTILS_AR:=libcoreutils.a | ||
8 | ifndef $(LIBCOREUTILS_DIR) | ||
9 | LIBCOREUTILS_DIR:=$(top_builddir)/coreutils/libcoreutils | ||
10 | endif | ||
11 | srcdir=$(top_srcdir)/coreutils/libcoreutils | ||
12 | |||
13 | LIBCOREUTILS_ALL_SRC:= cp_mv_stat.c getopt_mk_fifo_nod.c | ||
14 | |||
15 | LIBCOREUTILS-y:= | ||
16 | LIBCOREUTILS-$(CONFIG_MKFIFO) += getopt_mk_fifo_nod.o | ||
17 | LIBCOREUTILS-$(CONFIG_MKNOD) += getopt_mk_fifo_nod.o | ||
18 | LIBCOREUTILS-$(CONFIG_INSTALL) += cp_mv_stat.o | ||
19 | LIBCOREUTILS-$(CONFIG_CP) += cp_mv_stat.o | ||
20 | LIBCOREUTILS-$(CONFIG_MV) += cp_mv_stat.o | ||
21 | |||
22 | LIBCOREUTILS-y:=$(sort $(LIBCOREUTILS-y)) | ||
23 | |||
24 | LIBCOREUTILS_SRC-y:=$(patsubst %,$(srcdir)/%,$(subst .o,.c,$(LIBCOREUTILS-y))) | ||
25 | LIBCOREUTILS_SRC-a:=$(wildcard $(srcdir)/*.c) | ||
26 | LIBRARY_SRC-y+=$(LIBCOREUTILS_SRC-y) | ||
27 | LIBRARY_SRC-a+=$(LIBCOREUTILS_SRC-a) | ||
28 | |||
29 | ifneq ($(strip $(LIBCOREUTILS-y)),) | ||
30 | libraries-y+=$(LIBCOREUTILS_DIR)/$(LIBCOREUTILS_AR) | ||
31 | endif | ||
32 | |||
33 | LIBCOREUTILS_OBJS=$(patsubst %,$(LIBCOREUTILS_DIR)/%, $(LIBCOREUTILS-y)) | ||
34 | |||
35 | $(LIBCOREUTILS_DIR)/$(LIBCOREUTILS_AR): $(patsubst %,$(LIBCOREUTILS_DIR)/%,$(LIBCOREUTILS-y)) | ||
36 | $(do_ar) | ||
37 | |||
38 | $(LIBCOREUTILS_DIR)/%.o: $(srcdir)/%.c | ||
39 | $(compile.c) | ||
diff --git a/debianutils/Config.in b/debianutils/Config.in index 3dd2ef61b..3d85999ff 100644 --- a/debianutils/Config.in +++ b/debianutils/Config.in | |||
@@ -5,33 +5,33 @@ | |||
5 | 5 | ||
6 | menu "Debian Utilities" | 6 | menu "Debian Utilities" |
7 | 7 | ||
8 | config CONFIG_MKTEMP | 8 | config MKTEMP |
9 | bool "mktemp" | 9 | bool "mktemp" |
10 | default n | 10 | default n |
11 | help | 11 | help |
12 | mktemp is used to create unique temporary files | 12 | mktemp is used to create unique temporary files |
13 | 13 | ||
14 | config CONFIG_PIPE_PROGRESS | 14 | config PIPE_PROGRESS |
15 | bool "pipe_progress" | 15 | bool "pipe_progress" |
16 | default n | 16 | default n |
17 | help | 17 | help |
18 | Display a dot to indicate pipe activity. | 18 | Display a dot to indicate pipe activity. |
19 | 19 | ||
20 | config CONFIG_READLINK | 20 | config READLINK |
21 | bool "readlink" | 21 | bool "readlink" |
22 | default n | 22 | default n |
23 | help | 23 | help |
24 | This program reads a symbolic link and returns the name | 24 | This program reads a symbolic link and returns the name |
25 | of the file it points to | 25 | of the file it points to |
26 | 26 | ||
27 | config CONFIG_FEATURE_READLINK_FOLLOW | 27 | config FEATURE_READLINK_FOLLOW |
28 | bool "Enable canonicalization by following all symlinks (-f)" | 28 | bool "Enable canonicalization by following all symlinks (-f)" |
29 | default n | 29 | default n |
30 | depends on CONFIG_READLINK | 30 | depends on READLINK |
31 | help | 31 | help |
32 | Enable the readlink option (-f). | 32 | Enable the readlink option (-f). |
33 | 33 | ||
34 | config CONFIG_RUN_PARTS | 34 | config RUN_PARTS |
35 | bool "run-parts" | 35 | bool "run-parts" |
36 | default n | 36 | default n |
37 | help | 37 | help |
@@ -46,14 +46,14 @@ config CONFIG_RUN_PARTS | |||
46 | Unless you know that run-parts is used in some of your scripts | 46 | Unless you know that run-parts is used in some of your scripts |
47 | you can safely say N here. | 47 | you can safely say N here. |
48 | 48 | ||
49 | config CONFIG_FEATURE_RUN_PARTS_LONG_OPTIONS | 49 | config FEATURE_RUN_PARTS_LONG_OPTIONS |
50 | bool "Enable long options" | 50 | bool "Enable long options" |
51 | default n | 51 | default n |
52 | depends on CONFIG_RUN_PARTS && CONFIG_GETOPT_LONG | 52 | depends on RUN_PARTS && GETOPT_LONG |
53 | help | 53 | help |
54 | Support long options for the run-parts applet. | 54 | Support long options for the run-parts applet. |
55 | 55 | ||
56 | config CONFIG_START_STOP_DAEMON | 56 | config START_STOP_DAEMON |
57 | bool "start-stop-daemon" | 57 | bool "start-stop-daemon" |
58 | default y | 58 | default y |
59 | help | 59 | help |
@@ -61,23 +61,23 @@ config CONFIG_START_STOP_DAEMON | |||
61 | termination of system-level processes, usually the ones | 61 | termination of system-level processes, usually the ones |
62 | started during the startup of the system. | 62 | started during the startup of the system. |
63 | 63 | ||
64 | config CONFIG_FEATURE_START_STOP_DAEMON_FANCY | 64 | config FEATURE_START_STOP_DAEMON_FANCY |
65 | bool "Support additional arguments" | 65 | bool "Support additional arguments" |
66 | default y | 66 | default y |
67 | depends on CONFIG_START_STOP_DAEMON | 67 | depends on START_STOP_DAEMON |
68 | help | 68 | help |
69 | Support additional arguments. | 69 | Support additional arguments. |
70 | -o|--oknodo ignored since we exit with 0 anyway | 70 | -o|--oknodo ignored since we exit with 0 anyway |
71 | -v|--verbose | 71 | -v|--verbose |
72 | 72 | ||
73 | config CONFIG_FEATURE_START_STOP_DAEMON_LONG_OPTIONS | 73 | config FEATURE_START_STOP_DAEMON_LONG_OPTIONS |
74 | bool "Enable long options" | 74 | bool "Enable long options" |
75 | default n | 75 | default n |
76 | depends on CONFIG_START_STOP_DAEMON && CONFIG_GETOPT_LONG | 76 | depends on START_STOP_DAEMON && GETOPT_LONG |
77 | help | 77 | help |
78 | Support long options for the start-stop-daemon applet. | 78 | Support long options for the start-stop-daemon applet. |
79 | 79 | ||
80 | config CONFIG_WHICH | 80 | config WHICH |
81 | bool "which" | 81 | bool "which" |
82 | default n | 82 | default n |
83 | help | 83 | help |
diff --git a/debianutils/Kbuild b/debianutils/Kbuild new file mode 100644 index 000000000..99df6a536 --- /dev/null +++ b/debianutils/Kbuild | |||
@@ -0,0 +1,13 @@ | |||
1 | # Makefile for busybox | ||
2 | # | ||
3 | # Copyright (C) 1999-2005 by Erik Andersen <andersen@codepoet.org> | ||
4 | # | ||
5 | # Licensed under the GPL v2, see the file LICENSE in this tarball. | ||
6 | |||
7 | lib-y:= | ||
8 | lib-$(CONFIG_MKTEMP) += mktemp.o | ||
9 | lib-$(CONFIG_PIPE_PROGRESS) += pipe_progress.o | ||
10 | lib-$(CONFIG_READLINK) += readlink.o | ||
11 | lib-$(CONFIG_RUN_PARTS) += run_parts.o | ||
12 | lib-$(CONFIG_START_STOP_DAEMON) += start_stop_daemon.o | ||
13 | lib-$(CONFIG_WHICH) += which.o | ||
diff --git a/debianutils/Makefile b/debianutils/Makefile deleted file mode 100644 index 3d240b7bc..000000000 --- a/debianutils/Makefile +++ /dev/null | |||
@@ -1,23 +0,0 @@ | |||
1 | # Makefile for busybox | ||
2 | # | ||
3 | # Copyright (C) 1999-2005 by Erik Andersen <andersen@codepoet.org> | ||
4 | # | ||
5 | # Licensed under the GPL v2, see the file LICENSE in this tarball. | ||
6 | |||
7 | ifndef top_srcdir | ||
8 | top_srcdir=.. | ||
9 | endif | ||
10 | ifndef top_builddir | ||
11 | top_builddir=.. | ||
12 | endif | ||
13 | srcdir=$(top_srcdir)/debianutils | ||
14 | DEBIANUTILS_DIR:=./ | ||
15 | include $(top_srcdir)/Rules.mak | ||
16 | include $(top_builddir)/.config | ||
17 | include $(srcdir)/Makefile.in | ||
18 | all: $(libraries-y) | ||
19 | -include $(top_builddir)/.depend | ||
20 | |||
21 | clean: | ||
22 | rm -f *.o *.a $(AR_TARGET) | ||
23 | |||
diff --git a/debianutils/Makefile.in b/debianutils/Makefile.in deleted file mode 100644 index 2983565b8..000000000 --- a/debianutils/Makefile.in +++ /dev/null | |||
@@ -1,33 +0,0 @@ | |||
1 | # Makefile for busybox | ||
2 | # | ||
3 | # Copyright (C) 1999-2005 by Erik Andersen <andersen@codepoet.org> | ||
4 | # | ||
5 | # Licensed under the GPL v2, see the file LICENSE in this tarball. | ||
6 | |||
7 | DEBIANUTILS_AR:=debianutils.a | ||
8 | ifndef $(DEBIANUTILS_DIR) | ||
9 | DEBIANUTILS_DIR:=$(top_builddir)/debianutils/ | ||
10 | endif | ||
11 | srcdir=$(top_srcdir)/debianutils | ||
12 | |||
13 | DEBIANUTILS-y:= | ||
14 | DEBIANUTILS-$(CONFIG_MKTEMP) += mktemp.o | ||
15 | DEBIANUTILS-$(CONFIG_PIPE_PROGRESS) += pipe_progress.o | ||
16 | DEBIANUTILS-$(CONFIG_READLINK) += readlink.o | ||
17 | DEBIANUTILS-$(CONFIG_RUN_PARTS) += run_parts.o | ||
18 | DEBIANUTILS-$(CONFIG_START_STOP_DAEMON) += start_stop_daemon.o | ||
19 | DEBIANUTILS-$(CONFIG_WHICH) += which.o | ||
20 | |||
21 | ifneq ($(strip $(DEBIANUTILS-y)),) | ||
22 | libraries-y+=$(DEBIANUTILS_DIR)$(DEBIANUTILS_AR) | ||
23 | endif | ||
24 | DEBIANUTILS_SRC-y:=$(patsubst %.o,$(srcdir)/%.c,$(DEBIANUTILS-y)) | ||
25 | DEBIANUTILS_SRC-a:=$(wildcard $(srcdir)/*.c) | ||
26 | APPLET_SRC-y+=$(DEBIANUTILS_SRC-y) | ||
27 | APPLET_SRC-a+=$(DEBIANUTILS_SRC-a) | ||
28 | |||
29 | $(DEBIANUTILS_DIR)$(DEBIANUTILS_AR): $(patsubst %,$(DEBIANUTILS_DIR)%, $(DEBIANUTILS-y)) | ||
30 | $(do_ar) | ||
31 | |||
32 | $(DEBIANUTILS_DIR)%.o: $(srcdir)/%.c | ||
33 | $(compile.c) | ||
diff --git a/e2fsprogs/Config.in b/e2fsprogs/Config.in index 91e873e3a..0062b2fe3 100644 --- a/e2fsprogs/Config.in +++ b/e2fsprogs/Config.in | |||
@@ -5,13 +5,13 @@ | |||
5 | 5 | ||
6 | menu "Linux Ext2 FS Progs" | 6 | menu "Linux Ext2 FS Progs" |
7 | 7 | ||
8 | config CONFIG_CHATTR | 8 | config CHATTR |
9 | bool "chattr" | 9 | bool "chattr" |
10 | default n | 10 | default n |
11 | help | 11 | help |
12 | chattr changes the file attributes on a second extended file system. | 12 | chattr changes the file attributes on a second extended file system. |
13 | 13 | ||
14 | config CONFIG_E2FSCK | 14 | config E2FSCK |
15 | bool "e2fsck" | 15 | bool "e2fsck" |
16 | default n | 16 | default n |
17 | help | 17 | help |
@@ -20,7 +20,7 @@ config CONFIG_E2FSCK | |||
20 | The normal compat symlinks 'fsck.ext2' and 'fsck.ext3' are also | 20 | The normal compat symlinks 'fsck.ext2' and 'fsck.ext3' are also |
21 | provided. | 21 | provided. |
22 | 22 | ||
23 | config CONFIG_FSCK | 23 | config FSCK |
24 | bool "fsck" | 24 | bool "fsck" |
25 | default n | 25 | default n |
26 | help | 26 | help |
@@ -28,38 +28,38 @@ config CONFIG_FSCK | |||
28 | In actuality, fsck is simply a front-end for the various file system | 28 | In actuality, fsck is simply a front-end for the various file system |
29 | checkers (fsck.fstype) available under Linux. | 29 | checkers (fsck.fstype) available under Linux. |
30 | 30 | ||
31 | config CONFIG_LSATTR | 31 | config LSATTR |
32 | bool "lsattr" | 32 | bool "lsattr" |
33 | default n | 33 | default n |
34 | help | 34 | help |
35 | lsattr lists the file attributes on a second extended file system. | 35 | lsattr lists the file attributes on a second extended file system. |
36 | 36 | ||
37 | config CONFIG_MKE2FS | 37 | config MKE2FS |
38 | bool "mke2fs" | 38 | bool "mke2fs" |
39 | default n | 39 | default n |
40 | help | 40 | help |
41 | mke2fs is used to create an ext2/ext3 filesystem. The normal compat | 41 | mke2fs is used to create an ext2/ext3 filesystem. The normal compat |
42 | symlinks 'mkfs.ext2' and 'mkfs.ext3' are also provided. | 42 | symlinks 'mkfs.ext2' and 'mkfs.ext3' are also provided. |
43 | 43 | ||
44 | config CONFIG_TUNE2FS | 44 | config TUNE2FS |
45 | bool "tune2fs" | 45 | bool "tune2fs" |
46 | default n | 46 | default n |
47 | help | 47 | help |
48 | tune2fs allows the system administrator to adjust various tunable | 48 | tune2fs allows the system administrator to adjust various tunable |
49 | filesystem parameters on Linux ext2/ext3 filesystems. | 49 | filesystem parameters on Linux ext2/ext3 filesystems. |
50 | 50 | ||
51 | config CONFIG_E2LABEL | 51 | config E2LABEL |
52 | bool "e2label" | 52 | bool "e2label" |
53 | default n | 53 | default n |
54 | depends on CONFIG_TUNE2FS | 54 | depends on TUNE2FS |
55 | help | 55 | help |
56 | e2label will display or change the filesystem label on the ext2 | 56 | e2label will display or change the filesystem label on the ext2 |
57 | filesystem located on device. | 57 | filesystem located on device. |
58 | 58 | ||
59 | config CONFIG_FINDFS | 59 | config FINDFS |
60 | bool "findfs" | 60 | bool "findfs" |
61 | default n | 61 | default n |
62 | depends on CONFIG_TUNE2FS | 62 | depends on TUNE2FS |
63 | help | 63 | help |
64 | findfs will search the disks in the system looking for a filesystem | 64 | findfs will search the disks in the system looking for a filesystem |
65 | which has a label matching label or a UUID equal to uuid. | 65 | which has a label matching label or a UUID equal to uuid. |
diff --git a/e2fsprogs/Kbuild b/e2fsprogs/Kbuild new file mode 100644 index 000000000..f35a1ae32 --- /dev/null +++ b/e2fsprogs/Kbuild | |||
@@ -0,0 +1,27 @@ | |||
1 | # Makefile for busybox | ||
2 | # | ||
3 | # Copyright (C) 1999-2005 by Erik Andersen <andersen@codepoet.org> | ||
4 | # | ||
5 | # Licensed under the GPL v2, see the file LICENSE in this tarball. | ||
6 | |||
7 | lib-y:= | ||
8 | |||
9 | lib-$(CONFIG_CHATTR) += chattr.o | ||
10 | libs-$(CONFIG_CHATTR) += e2p/ | ||
11 | |||
12 | lib-$(CONFIG_E2FSCK) += e2fsck.o util.o | ||
13 | libs-$(CONFIG_E2FSCK) += blkid/ ext2fs/ uuid/ | ||
14 | |||
15 | lib-$(CONFIG_FSCK) += fsck.o util.o | ||
16 | libs-$(CONFIG_FSCK) += blkid/ ext2fs/ uuid/ | ||
17 | |||
18 | lib-$(CONFIG_LSATTR) += lsattr.o | ||
19 | libs-$(CONFIG_LSATTR) += e2p/ | ||
20 | |||
21 | lib-$(CONFIG_MKE2FS) += mke2fs.o util.o | ||
22 | libs-$(CONFIG_MKE2FS) += e2p/ blkid/ ext2fs/ uuid/ | ||
23 | |||
24 | lib-$(CONFIG_TUNE2FS) += tune2fs.o util.o | ||
25 | libs-$(CONFIG_TUNE2FS) += e2p/ blkid/ ext2fs/ uuid/ | ||
26 | |||
27 | CFLAGS += -include e2fsprogs/e2fsbb.h | ||
diff --git a/e2fsprogs/Makefile b/e2fsprogs/Makefile deleted file mode 100644 index 0efa9bb3b..000000000 --- a/e2fsprogs/Makefile +++ /dev/null | |||
@@ -1,22 +0,0 @@ | |||
1 | # Makefile for busybox | ||
2 | # | ||
3 | # Copyright (C) 1999-2005 by Erik Andersen <andersen@codepoet.org> | ||
4 | # | ||
5 | # Licensed under the GPL v2, see the file LICENSE in this tarball. | ||
6 | |||
7 | ifndef top_srcdir | ||
8 | top_srcdir=.. | ||
9 | endif | ||
10 | ifndef top_builddir | ||
11 | top_builddir=.. | ||
12 | endif | ||
13 | srcdir=$(top_srcdir)/e2fsprogs | ||
14 | E2FSPROGS_DIR:=./ | ||
15 | include $(top_builddir)/.config | ||
16 | include $(top_srcdir)/Rules.mak | ||
17 | include Makefile.in | ||
18 | all: $(libraries-y) | ||
19 | -include $(top_builddir)/.depend | ||
20 | |||
21 | clean: | ||
22 | rm -f *.o *.a */*.o $(AR_TARGET) | ||
diff --git a/e2fsprogs/Makefile.in b/e2fsprogs/Makefile.in deleted file mode 100644 index 160271686..000000000 --- a/e2fsprogs/Makefile.in +++ /dev/null | |||
@@ -1,86 +0,0 @@ | |||
1 | # Makefile for busybox | ||
2 | # | ||
3 | # Copyright (C) 1999-2005 by Erik Andersen <andersen@codepoet.org> | ||
4 | # | ||
5 | # Licensed under the GPL v2, see the file LICENSE in this tarball. | ||
6 | |||
7 | E2FSPROGS_AR:=e2fsprogs.a | ||
8 | |||
9 | E2FSPROGS_DIR:=$(top_builddir)/e2fsprogs | ||
10 | E2FSPROGS_SRC:=$(top_srcdir)/e2fsprogs | ||
11 | |||
12 | E2FSPROGS_CFLAGS := -include $(E2FSPROGS_SRC)/e2fsbb.h | ||
13 | |||
14 | BLKID_SRC := cache.c dev.c devname.c devno.c blkid_getsize.c \ | ||
15 | probe.c read.c resolve.c save.c tag.c list.c | ||
16 | BLKID_SRCS := $(patsubst %,blkid/%, $(BLKID_SRC)) | ||
17 | BLKID_OBJS := $(patsubst %.c,%.o, $(BLKID_SRCS)) | ||
18 | |||
19 | E2P_SRC := fgetsetflags.c fgetsetversion.c pf.c iod.c mntopts.c \ | ||
20 | feature.c ls.c uuid.c pe.c ostype.c ps.c hashstr.c \ | ||
21 | parse_num.c | ||
22 | E2P_SRCS := $(patsubst %,e2p/%, $(E2P_SRC)) | ||
23 | E2P_OBJS := $(patsubst %.c,%.o, $(E2P_SRCS)) | ||
24 | |||
25 | EXT2FS_SRC := gen_bitmap.c bitops.c ismounted.c mkjournal.c unix_io.c \ | ||
26 | rw_bitmaps.c initialize.c bitmaps.c block.c \ | ||
27 | ind_block.c inode.c freefs.c alloc_stats.c closefs.c \ | ||
28 | openfs.c io_manager.c finddev.c read_bb.c alloc.c badblocks.c \ | ||
29 | getsize.c getsectsize.c alloc_tables.c read_bb_file.c mkdir.c \ | ||
30 | bb_inode.c newdir.c alloc_sb.c lookup.c dirblock.c expanddir.c \ | ||
31 | dir_iterate.c link.c res_gdt.c icount.c get_pathname.c dblist.c \ | ||
32 | dirhash.c version.c flushb.c unlink.c check_desc.c valid_blk.c \ | ||
33 | ext_attr.c bmap.c dblist_dir.c ext2fs_inline.c swapfs.c | ||
34 | EXT2FS_SRCS := $(patsubst %,ext2fs/%, $(EXT2FS_SRC)) | ||
35 | EXT2FS_OBJS := $(patsubst %.c,%.o, $(EXT2FS_SRCS)) | ||
36 | |||
37 | UUID_SRC := compare.c gen_uuid.c pack.c parse.c unpack.c unparse.c \ | ||
38 | uuid_time.c | ||
39 | UUID_SRCS := $(patsubst %,uuid/%, $(UUID_SRC)) | ||
40 | UUID_OBJS := $(patsubst %.c,%.o, $(UUID_SRCS)) | ||
41 | |||
42 | E2FSPROGS-y:= | ||
43 | E2FSPROGS-$(CONFIG_CHATTR) += chattr.o $(E2P_OBJS) | ||
44 | E2FSPROGS-$(CONFIG_E2FSCK) += e2fsck.o util.o $(BLKID_OBJS) $(EXT2FS_OBJS) $(UUID_OBJS) | ||
45 | E2FSPROGS-$(CONFIG_FSCK) += fsck.o util.o $(BLKID_OBJS) $(EXT2FS_OBJS) $(UUID_OBJS) | ||
46 | E2FSPROGS-$(CONFIG_LSATTR) += lsattr.o $(E2P_OBJS) | ||
47 | E2FSPROGS-$(CONFIG_MKE2FS) += mke2fs.o util.o $(E2P_OBJS) $(BLKID_OBJS) $(EXT2FS_OBJS) $(UUID_OBJS) | ||
48 | E2FSPROGS-$(CONFIG_TUNE2FS) += tune2fs.o util.o $(E2P_OBJS) $(BLKID_OBJS) $(EXT2FS_OBJS) $(UUID_OBJS) | ||
49 | |||
50 | E2FSPROGS-y:=$(sort $(E2FSPROGS-y)) | ||
51 | |||
52 | ifneq ($(strip $(E2FSPROGS-y)),) | ||
53 | libraries-y+=$(E2FSPROGS_DIR)/$(E2FSPROGS_AR) | ||
54 | endif | ||
55 | |||
56 | E2FSPROGS_SRC-y:=$(patsubst %.o,$(E2FSPROGS_SRC)/%.c,$(E2FSPROGS-y)) | ||
57 | E2FSPROGS_SRC-a:=$(wildcard $(E2FSPROGS_SRC)/*.c) $(patsubst %,$(E2FSPROGS_SRC)/%,$(BLKID_SRCS) $(E2P_SRCS) $(EXT2FS_SRCS) $(UUID_SRCS)) | ||
58 | APPLET_SRC-y+=$(E2FSPROGS_SRC-y) | ||
59 | APPLET_SRC-a+=$(E2FSPROGS_SRC-a) | ||
60 | |||
61 | # XXX: FIXME: change .c to include their stuff relative to $(E2FSPROGS_SRC) | ||
62 | E2FSPROGS_TMP_KLUDGE:=$(patsubst %,-I$(E2FSPROGS_SRC)/%,blkid e2fsck e2p ext2fs uuid) | ||
63 | |||
64 | APPLETS_DEFINE-y+=$(E2FSPROGS_CFLAGS) -I$(E2FSPROGS_SRC) $(E2FSPROGS_TMP_KLUDGE) | ||
65 | APPLETS_DEFINE-a+=$(E2FSPROGS_CFLAGS) -I$(E2FSPROGS_SRC) $(E2FSPROGS_TMP_KLUDGE) | ||
66 | |||
67 | $(E2FSPROGS_DIR)/$(E2FSPROGS_AR): $(patsubst %,$(E2FSPROGS_DIR)/%, $(E2FSPROGS-y)) | ||
68 | $(do_ar) | ||
69 | |||
70 | $(E2FSPROGS_DIR)/%.o: $(subst $(top_builddir),$(top_srcdir),$(E2FSPROGS_DIR)/%.c) | ||
71 | $(compile.c) $(E2FSPROGS_CFLAGS) | ||
72 | |||
73 | # for building out-of-tree we need to make sure that the directories to hold | ||
74 | # the object tree are created | ||
75 | $(patsubst %,$(E2FSPROGS_DIR)/%, blkid e2fsck e2p ext2fs uuid): | ||
76 | @mkdir -p "$@" | ||
77 | |||
78 | # make sure that the directories are order-only prerequisites. Otherwise we | ||
79 | # may have object files created after the timestamp of the directory was | ||
80 | # updated which would lead to spurious rebuilds (as some of the dentries | ||
81 | # may be older than the dir itself). | ||
82 | $(patsubst %,$(E2FSPROGS_DIR)/%, $(BLKID_OBJS)):|$(E2FSPROGS_DIR)/blkid | ||
83 | $(patsubst %,$(E2FSPROGS_DIR)/%, $(E2FSCK_OBJS)):|$(E2FSPROGS_DIR)/e2fsck | ||
84 | $(patsubst %,$(E2FSPROGS_DIR)/%, $(E2P_OBJS)):|$(E2FSPROGS_DIR)/e2p | ||
85 | $(patsubst %,$(E2FSPROGS_DIR)/%, $(EXT2FS_OBJS)):|$(E2FSPROGS_DIR)/ext2fs | ||
86 | $(patsubst %,$(E2FSPROGS_DIR)/%, $(UUID_OBJS)):|$(E2FSPROGS_DIR)/uuid | ||
diff --git a/e2fsprogs/blkid/Kbuild b/e2fsprogs/blkid/Kbuild new file mode 100644 index 000000000..ba0bee03d --- /dev/null +++ b/e2fsprogs/blkid/Kbuild | |||
@@ -0,0 +1,18 @@ | |||
1 | # Makefile for busybox | ||
2 | # | ||
3 | # Copyright (C) 1999-2005 by Erik Andersen <andersen@codepoet.org> | ||
4 | # | ||
5 | # Licensed under the GPL v2, see the file LICENSE in this tarball. | ||
6 | |||
7 | lib-y:= | ||
8 | lib-y += cache.o dev.o devname.o devno.o blkid_getsize.o \ | ||
9 | probe.o read.o resolve.o save.o tag.o list.o | ||
10 | |||
11 | CFLAGS_dev.o := -include include/busybox.h | ||
12 | CFLAGS_devname.o := -include include/busybox.h | ||
13 | CFLAGS_devno.o := -include include/busybox.h | ||
14 | CFLAGS_blkid_getsize.o := -include include/busybox.h | ||
15 | CFLAGS_probe.o := -include include/busybox.h | ||
16 | CFLAGS_save.o := -include include/busybox.h | ||
17 | CFLAGS_tag.o := -include include/busybox.h | ||
18 | CFLAGS_list.o := -include include/busybox.h | ||
diff --git a/e2fsprogs/blkid/blkid_getsize.c b/e2fsprogs/blkid/blkid_getsize.c index 7a2133f0a..3c5ec5b76 100644 --- a/e2fsprogs/blkid/blkid_getsize.c +++ b/e2fsprogs/blkid/blkid_getsize.c | |||
@@ -14,9 +14,7 @@ | |||
14 | #include "blkidP.h" | 14 | #include "blkidP.h" |
15 | 15 | ||
16 | #include <stdio.h> | 16 | #include <stdio.h> |
17 | #if HAVE_UNISTD_H | ||
18 | #include <unistd.h> | 17 | #include <unistd.h> |
19 | #endif | ||
20 | #if HAVE_ERRNO_H | 18 | #if HAVE_ERRNO_H |
21 | #include <errno.h> | 19 | #include <errno.h> |
22 | #endif | 20 | #endif |
diff --git a/e2fsprogs/blkid/devname.c b/e2fsprogs/blkid/devname.c index b5c1bc9a8..7606e400d 100644 --- a/e2fsprogs/blkid/devname.c +++ b/e2fsprogs/blkid/devname.c | |||
@@ -23,9 +23,7 @@ | |||
23 | #if HAVE_SYS_TYPES_H | 23 | #if HAVE_SYS_TYPES_H |
24 | #include <sys/types.h> | 24 | #include <sys/types.h> |
25 | #endif | 25 | #endif |
26 | #if HAVE_SYS_STAT_H | ||
27 | #include <sys/stat.h> | 26 | #include <sys/stat.h> |
28 | #endif | ||
29 | #if HAVE_ERRNO_H | 27 | #if HAVE_ERRNO_H |
30 | #include <errno.h> | 28 | #include <errno.h> |
31 | #endif | 29 | #endif |
diff --git a/e2fsprogs/blkid/devno.c b/e2fsprogs/blkid/devno.c index 065761fb4..be93666be 100644 --- a/e2fsprogs/blkid/devno.c +++ b/e2fsprogs/blkid/devno.c | |||
@@ -21,9 +21,7 @@ | |||
21 | #if HAVE_SYS_TYPES_H | 21 | #if HAVE_SYS_TYPES_H |
22 | #include <sys/types.h> | 22 | #include <sys/types.h> |
23 | #endif | 23 | #endif |
24 | #if HAVE_SYS_STAT_H | ||
25 | #include <sys/stat.h> | 24 | #include <sys/stat.h> |
26 | #endif | ||
27 | #include <dirent.h> | 25 | #include <dirent.h> |
28 | #if HAVE_ERRNO_H | 26 | #if HAVE_ERRNO_H |
29 | #include <errno.h> | 27 | #include <errno.h> |
diff --git a/e2fsprogs/e2p/Kbuild b/e2fsprogs/e2p/Kbuild new file mode 100644 index 000000000..24a692ea1 --- /dev/null +++ b/e2fsprogs/e2p/Kbuild | |||
@@ -0,0 +1,10 @@ | |||
1 | # Makefile for busybox | ||
2 | # | ||
3 | # Copyright (C) 1999-2005 by Erik Andersen <andersen@codepoet.org> | ||
4 | # | ||
5 | # Licensed under the GPL v2, see the file LICENSE in this tarball. | ||
6 | |||
7 | lib-y:= | ||
8 | lib-y += fgetsetflags.o fgetsetversion.o pf.o iod.o mntopts.o \ | ||
9 | feature.o ls.o uuid.o pe.o ostype.o ps.o hashstr.o \ | ||
10 | parse_num.o | ||
diff --git a/e2fsprogs/e2p/fgetsetflags.c b/e2fsprogs/e2p/fgetsetflags.c index 86bf65d50..34e40551f 100644 --- a/e2fsprogs/e2p/fgetsetflags.c +++ b/e2fsprogs/e2p/fgetsetflags.c | |||
@@ -63,8 +63,8 @@ int fgetsetflags (const char * name, unsigned long * get_flags, unsigned long se | |||
63 | if (save_errno) | 63 | if (save_errno) |
64 | errno = save_errno; | 64 | errno = save_errno; |
65 | return r; | 65 | return r; |
66 | #endif /* HAVE_EXT2_IOCTLS */ | ||
67 | notsupp: | 66 | notsupp: |
67 | #endif /* HAVE_EXT2_IOCTLS */ | ||
68 | errno = EOPNOTSUPP; | 68 | errno = EOPNOTSUPP; |
69 | return -1; | 69 | return -1; |
70 | } | 70 | } |
diff --git a/e2fsprogs/ext2fs/Kbuild b/e2fsprogs/ext2fs/Kbuild new file mode 100644 index 000000000..dc499348d --- /dev/null +++ b/e2fsprogs/ext2fs/Kbuild | |||
@@ -0,0 +1,18 @@ | |||
1 | # Makefile for busybox | ||
2 | # | ||
3 | # Copyright (C) 1999-2005 by Erik Andersen <andersen@codepoet.org> | ||
4 | # | ||
5 | # Licensed under the GPL v2, see the file LICENSE in this tarball. | ||
6 | |||
7 | lib-y:= | ||
8 | lib-y += gen_bitmap.o bitops.o ismounted.o mkjournal.o unix_io.o \ | ||
9 | rw_bitmaps.o initialize.o bitmaps.o block.o \ | ||
10 | ind_block.o inode.o freefs.o alloc_stats.o closefs.o \ | ||
11 | openfs.o io_manager.o finddev.o read_bb.o alloc.o badblocks.o \ | ||
12 | getsize.o getsectsize.o alloc_tables.o read_bb_file.o mkdir.o \ | ||
13 | bb_inode.o newdir.o alloc_sb.o lookup.o dirblock.o expanddir.o \ | ||
14 | dir_iterate.o link.o res_gdt.o icount.o get_pathname.o dblist.o \ | ||
15 | dirhash.o version.o flushb.o unlink.o check_desc.o valid_blk.o \ | ||
16 | ext_attr.o bmap.o dblist_dir.o ext2fs_inline.o swapfs.o | ||
17 | |||
18 | CFLAGS += -include e2fsprogs/e2fsbb.h | ||
diff --git a/e2fsprogs/tune2fs.c b/e2fsprogs/tune2fs.c index 9bd6f4c7e..01ba31c68 100644 --- a/e2fsprogs/tune2fs.c +++ b/e2fsprogs/tune2fs.c | |||
@@ -45,8 +45,6 @@ | |||
45 | #include "blkid/blkid.h" | 45 | #include "blkid/blkid.h" |
46 | 46 | ||
47 | #include "busybox.h" | 47 | #include "busybox.h" |
48 | #include "grp_.h" | ||
49 | #include "pwd_.h" | ||
50 | 48 | ||
51 | static char * device_name = NULL; | 49 | static char * device_name = NULL; |
52 | static char * new_label, *new_last_mounted, *new_UUID; | 50 | static char * new_label, *new_last_mounted, *new_UUID; |
diff --git a/e2fsprogs/uuid/Kbuild b/e2fsprogs/uuid/Kbuild new file mode 100644 index 000000000..0ae74aed3 --- /dev/null +++ b/e2fsprogs/uuid/Kbuild | |||
@@ -0,0 +1,9 @@ | |||
1 | # Makefile for busybox | ||
2 | # | ||
3 | # Copyright (C) 1999-2005 by Erik Andersen <andersen@codepoet.org> | ||
4 | # | ||
5 | # Licensed under the GPL v2, see the file LICENSE in this tarball. | ||
6 | |||
7 | lib-y:= | ||
8 | lib-y += compare.o gen_uuid.o pack.o parse.o unpack.o unparse.o \ | ||
9 | uuid_time.o | ||
diff --git a/e2fsprogs/uuid/gen_uuid.c b/e2fsprogs/uuid/gen_uuid.c index e5c0f0d53..9d700a015 100644 --- a/e2fsprogs/uuid/gen_uuid.c +++ b/e2fsprogs/uuid/gen_uuid.c | |||
@@ -41,6 +41,7 @@ | |||
41 | #include <sys/types.h> | 41 | #include <sys/types.h> |
42 | #include <sys/stat.h> | 42 | #include <sys/stat.h> |
43 | #include <sys/file.h> | 43 | #include <sys/file.h> |
44 | #include <sys/time.h> | ||
44 | #ifdef HAVE_SYS_IOCTL_H | 45 | #ifdef HAVE_SYS_IOCTL_H |
45 | #include <sys/ioctl.h> | 46 | #include <sys/ioctl.h> |
46 | #endif | 47 | #endif |
diff --git a/editors/Config.in b/editors/Config.in index 14c316c08..4ba009019 100644 --- a/editors/Config.in +++ b/editors/Config.in | |||
@@ -5,22 +5,22 @@ | |||
5 | 5 | ||
6 | menu "Editors" | 6 | menu "Editors" |
7 | 7 | ||
8 | config CONFIG_AWK | 8 | config AWK |
9 | bool "awk" | 9 | bool "awk" |
10 | default n | 10 | default n |
11 | help | 11 | help |
12 | Awk is used as a pattern scanning and processing language. This is | 12 | Awk is used as a pattern scanning and processing language. This is |
13 | the BusyBox implementation of that programming language. | 13 | the BusyBox implementation of that programming language. |
14 | 14 | ||
15 | config CONFIG_FEATURE_AWK_MATH | 15 | config FEATURE_AWK_MATH |
16 | bool "Enable math functions (requires libm)" | 16 | bool "Enable math functions (requires libm)" |
17 | default y | 17 | default y |
18 | depends on CONFIG_AWK | 18 | depends on AWK |
19 | help | 19 | help |
20 | Enable math functions of the Awk programming language. | 20 | Enable math functions of the Awk programming language. |
21 | NOTE: This will require libm to be present for linking. | 21 | NOTE: This will require libm to be present for linking. |
22 | 22 | ||
23 | config CONFIG_ED | 23 | config ED |
24 | bool "ed" | 24 | bool "ed" |
25 | default n | 25 | default n |
26 | help | 26 | help |
@@ -28,20 +28,20 @@ config CONFIG_ED | |||
28 | Small, simple, evil. Part of SUSv3. If you're not already using | 28 | Small, simple, evil. Part of SUSv3. If you're not already using |
29 | this, you don't need it. | 29 | this, you don't need it. |
30 | 30 | ||
31 | config CONFIG_PATCH | 31 | config PATCH |
32 | bool "patch" | 32 | bool "patch" |
33 | default n | 33 | default n |
34 | help | 34 | help |
35 | Apply a unified diff formatted patch. | 35 | Apply a unified diff formatted patch. |
36 | 36 | ||
37 | config CONFIG_SED | 37 | config SED |
38 | bool "sed" | 38 | bool "sed" |
39 | default n | 39 | default n |
40 | help | 40 | help |
41 | sed is used to perform text transformations on a file | 41 | sed is used to perform text transformations on a file |
42 | or input from a pipeline. | 42 | or input from a pipeline. |
43 | 43 | ||
44 | config CONFIG_VI | 44 | config VI |
45 | bool "vi" | 45 | bool "vi" |
46 | default n | 46 | default n |
47 | help | 47 | help |
@@ -50,79 +50,79 @@ config CONFIG_VI | |||
50 | learning curve. If you are not already comfortable with 'vi' | 50 | learning curve. If you are not already comfortable with 'vi' |
51 | you may wish to use something else. | 51 | you may wish to use something else. |
52 | 52 | ||
53 | config CONFIG_FEATURE_VI_COLON | 53 | config FEATURE_VI_COLON |
54 | bool "Enable \":\" colon commands (no \"ex\" mode)" | 54 | bool "Enable \":\" colon commands (no \"ex\" mode)" |
55 | default y | 55 | default y |
56 | depends on CONFIG_VI | 56 | depends on VI |
57 | help | 57 | help |
58 | Enable a limited set of colon commands for vi. This does not | 58 | Enable a limited set of colon commands for vi. This does not |
59 | provide an "ex" mode. | 59 | provide an "ex" mode. |
60 | 60 | ||
61 | config CONFIG_FEATURE_VI_YANKMARK | 61 | config FEATURE_VI_YANKMARK |
62 | bool "Enable yank/put commands and mark cmds" | 62 | bool "Enable yank/put commands and mark cmds" |
63 | default y | 63 | default y |
64 | depends on CONFIG_VI | 64 | depends on VI |
65 | help | 65 | help |
66 | This will enable you to use yank and put, as well as mark in | 66 | This will enable you to use yank and put, as well as mark in |
67 | busybox vi. | 67 | busybox vi. |
68 | 68 | ||
69 | config CONFIG_FEATURE_VI_SEARCH | 69 | config FEATURE_VI_SEARCH |
70 | bool "Enable search and replace cmds" | 70 | bool "Enable search and replace cmds" |
71 | default y | 71 | default y |
72 | depends on CONFIG_VI | 72 | depends on VI |
73 | help | 73 | help |
74 | Select this if you wish to be able to do search and replace in | 74 | Select this if you wish to be able to do search and replace in |
75 | busybox vi. | 75 | busybox vi. |
76 | 76 | ||
77 | config CONFIG_FEATURE_VI_USE_SIGNALS | 77 | config FEATURE_VI_USE_SIGNALS |
78 | bool "Catch signals" | 78 | bool "Catch signals" |
79 | default y | 79 | default y |
80 | depends on CONFIG_VI | 80 | depends on VI |
81 | help | 81 | help |
82 | Selecting this option will make busybox vi signal aware. This will | 82 | Selecting this option will make busybox vi signal aware. This will |
83 | make busybox vi support SIGWINCH to deal with Window Changes, catch | 83 | make busybox vi support SIGWINCH to deal with Window Changes, catch |
84 | Ctrl-Z and Ctrl-C and alarms. | 84 | Ctrl-Z and Ctrl-C and alarms. |
85 | 85 | ||
86 | config CONFIG_FEATURE_VI_DOT_CMD | 86 | config FEATURE_VI_DOT_CMD |
87 | bool "Remember previous cmd and \".\" cmd" | 87 | bool "Remember previous cmd and \".\" cmd" |
88 | default y | 88 | default y |
89 | depends on CONFIG_VI | 89 | depends on VI |
90 | help | 90 | help |
91 | Make busybox vi remember the last command and be able to repeat it. | 91 | Make busybox vi remember the last command and be able to repeat it. |
92 | 92 | ||
93 | config CONFIG_FEATURE_VI_READONLY | 93 | config FEATURE_VI_READONLY |
94 | bool "Enable -R option and \"view\" mode" | 94 | bool "Enable -R option and \"view\" mode" |
95 | default y | 95 | default y |
96 | depends on CONFIG_VI | 96 | depends on VI |
97 | help | 97 | help |
98 | Enable the read-only command line option, which allows the user to | 98 | Enable the read-only command line option, which allows the user to |
99 | open a file in read-only mode. | 99 | open a file in read-only mode. |
100 | 100 | ||
101 | config CONFIG_FEATURE_VI_SETOPTS | 101 | config FEATURE_VI_SETOPTS |
102 | bool "Enable set-able options, ai ic showmatch" | 102 | bool "Enable set-able options, ai ic showmatch" |
103 | default y | 103 | default y |
104 | depends on CONFIG_VI | 104 | depends on VI |
105 | help | 105 | help |
106 | Enable the editor to set some (ai, ic, showmatch) options. | 106 | Enable the editor to set some (ai, ic, showmatch) options. |
107 | 107 | ||
108 | config CONFIG_FEATURE_VI_SET | 108 | config FEATURE_VI_SET |
109 | bool "Support for :set" | 109 | bool "Support for :set" |
110 | default y | 110 | default y |
111 | depends on CONFIG_VI | 111 | depends on VI |
112 | help | 112 | help |
113 | Support for ":set". | 113 | Support for ":set". |
114 | 114 | ||
115 | config CONFIG_FEATURE_VI_WIN_RESIZE | 115 | config FEATURE_VI_WIN_RESIZE |
116 | bool "Handle window resize" | 116 | bool "Handle window resize" |
117 | default y | 117 | default y |
118 | depends on CONFIG_VI | 118 | depends on VI |
119 | help | 119 | help |
120 | Make busybox vi behave nicely with terminals that get resized. | 120 | Make busybox vi behave nicely with terminals that get resized. |
121 | 121 | ||
122 | config CONFIG_FEATURE_VI_OPTIMIZE_CURSOR | 122 | config FEATURE_VI_OPTIMIZE_CURSOR |
123 | bool "Optimize cursor movement" | 123 | bool "Optimize cursor movement" |
124 | default y | 124 | default y |
125 | depends on CONFIG_VI | 125 | depends on VI |
126 | help | 126 | help |
127 | This will make the cursor movement faster, but requires more memory | 127 | This will make the cursor movement faster, but requires more memory |
128 | and it makes the applet a tiny bit larger. | 128 | and it makes the applet a tiny bit larger. |
diff --git a/editors/Kbuild b/editors/Kbuild new file mode 100644 index 000000000..d991e1faf --- /dev/null +++ b/editors/Kbuild | |||
@@ -0,0 +1,12 @@ | |||
1 | # Makefile for busybox | ||
2 | # | ||
3 | # Copyright (C) 1999-2005 by Erik Andersen <andersen@codepoet.org> | ||
4 | # | ||
5 | # Licensed under the GPL v2, see the file LICENSE in this tarball. | ||
6 | |||
7 | lib-y:= | ||
8 | lib-$(CONFIG_AWK) += awk.o | ||
9 | lib-$(CONFIG_ED) += ed.o | ||
10 | lib-$(CONFIG_PATCH) += patch.o | ||
11 | lib-$(CONFIG_SED) += sed.o | ||
12 | lib-$(CONFIG_VI) += vi.o | ||
diff --git a/editors/Makefile b/editors/Makefile deleted file mode 100644 index 22790095a..000000000 --- a/editors/Makefile +++ /dev/null | |||
@@ -1,23 +0,0 @@ | |||
1 | # Makefile for busybox | ||
2 | # | ||
3 | # Copyright (C) 1999-2005 by Erik Andersen <andersen@codepoet.org> | ||
4 | # | ||
5 | # Licensed under the GPL v2, see the file LICENSE in this tarball. | ||
6 | |||
7 | ifndef top_srcdir | ||
8 | top_srcdir=.. | ||
9 | endif | ||
10 | ifndef top_builddir | ||
11 | top_builddir=.. | ||
12 | endif | ||
13 | srcdir=$(top_srcdir)/editors | ||
14 | EDITOR_DIR:=./ | ||
15 | include $(top_srcdir)/Rules.mak | ||
16 | include $(top_builddir)/.config | ||
17 | include $(srcdir)/Makefile.in | ||
18 | all: $(libraries-y) | ||
19 | -include $(top_builddir)/.depend | ||
20 | |||
21 | clean: | ||
22 | rm -f *.o *.a $(AR_TARGET) | ||
23 | |||
diff --git a/editors/Makefile.in b/editors/Makefile.in deleted file mode 100644 index 9a46e32c2..000000000 --- a/editors/Makefile.in +++ /dev/null | |||
@@ -1,40 +0,0 @@ | |||
1 | # Makefile for busybox | ||
2 | # | ||
3 | # Copyright (C) 1999-2005 by Erik Andersen <andersen@codepoet.org> | ||
4 | # | ||
5 | # Licensed under the GPL v2, see the file LICENSE in this tarball. | ||
6 | |||
7 | EDITOR_AR:=editors.a | ||
8 | ifndef $(EDITOR_DIR) | ||
9 | EDITOR_DIR:=$(top_builddir)/editors/ | ||
10 | endif | ||
11 | srcdir=$(top_srcdir)/editors | ||
12 | |||
13 | EDITOR-y:= | ||
14 | EDITOR-$(CONFIG_AWK) += awk.o | ||
15 | EDITOR-$(CONFIG_ED) += ed.o | ||
16 | EDITOR-$(CONFIG_PATCH) += patch.o | ||
17 | EDITOR-$(CONFIG_SED) += sed.o | ||
18 | EDITOR-$(CONFIG_VI) += vi.o | ||
19 | |||
20 | ifneq ($(strip $(EDITOR-y)),) | ||
21 | libraries-y+=$(EDITOR_DIR)$(EDITOR_AR) | ||
22 | endif | ||
23 | |||
24 | EDITOR_SRC-y:=$(patsubst %.o,$(srcdir)/%.c,$(EDITOR-y)) | ||
25 | EDITOR_SRC-a:=$(wildcard $(srcdir)/*.c) | ||
26 | APPLET_SRC-y+=$(EDITOR_SRC-y) | ||
27 | APPLET_SRC-a+=$(EDITOR_SRC-a) | ||
28 | |||
29 | needlibm-y:= | ||
30 | needlibm-$(CONFIG_FEATURE_AWK_MATH) := y | ||
31 | |||
32 | ifeq ($(needlibm-y),y) | ||
33 | LIBRARIES := -lm $(filter-out -lm,$(LIBRARIES)) | ||
34 | endif | ||
35 | |||
36 | $(EDITOR_DIR)$(EDITOR_AR): $(patsubst %,$(EDITOR_DIR)%, $(EDITOR-y)) | ||
37 | $(do_ar) | ||
38 | |||
39 | $(EDITOR_DIR)%.o: $(srcdir)/%.c | ||
40 | $(compile.c) | ||
diff --git a/findutils/Config.in b/findutils/Config.in index 12387a44e..5a4476a98 100644 --- a/findutils/Config.in +++ b/findutils/Config.in | |||
@@ -5,152 +5,152 @@ | |||
5 | 5 | ||
6 | menu "Finding Utilities" | 6 | menu "Finding Utilities" |
7 | 7 | ||
8 | config CONFIG_FIND | 8 | config FIND |
9 | bool "find" | 9 | bool "find" |
10 | default n | 10 | default n |
11 | help | 11 | help |
12 | find is used to search your system to find specified files. | 12 | find is used to search your system to find specified files. |
13 | 13 | ||
14 | config CONFIG_FEATURE_FIND_PRINT0 | 14 | config FEATURE_FIND_PRINT0 |
15 | bool "Enable -print0 option" | 15 | bool "Enable -print0 option" |
16 | default y | 16 | default y |
17 | depends on CONFIG_FIND | 17 | depends on FIND |
18 | help | 18 | help |
19 | Causes output names to be separated by a null character | 19 | Causes output names to be separated by a null character |
20 | rather than a newline. This allows names that contain | 20 | rather than a newline. This allows names that contain |
21 | newlines and other whitespace to be more easily | 21 | newlines and other whitespace to be more easily |
22 | interpreted by other programs. | 22 | interpreted by other programs. |
23 | 23 | ||
24 | config CONFIG_FEATURE_FIND_MTIME | 24 | config FEATURE_FIND_MTIME |
25 | bool "Enable modified time matching (-mtime) option" | 25 | bool "Enable modified time matching (-mtime) option" |
26 | default y | 26 | default y |
27 | depends on CONFIG_FIND | 27 | depends on FIND |
28 | help | 28 | help |
29 | Allow searching based on the modification time of | 29 | Allow searching based on the modification time of |
30 | files, in days. | 30 | files, in days. |
31 | 31 | ||
32 | config CONFIG_FEATURE_FIND_MMIN | 32 | config FEATURE_FIND_MMIN |
33 | bool "Enable modified time matching (-min) option" | 33 | bool "Enable modified time matching (-min) option" |
34 | default y | 34 | default y |
35 | depends on CONFIG_FIND | 35 | depends on FIND |
36 | help | 36 | help |
37 | Allow searching based on the modification time of | 37 | Allow searching based on the modification time of |
38 | files, in minutes. | 38 | files, in minutes. |
39 | 39 | ||
40 | config CONFIG_FEATURE_FIND_PERM | 40 | config FEATURE_FIND_PERM |
41 | bool "Enable permissions matching (-perm) option" | 41 | bool "Enable permissions matching (-perm) option" |
42 | default y | 42 | default y |
43 | depends on CONFIG_FIND | 43 | depends on FIND |
44 | help | 44 | help |
45 | Enable searching based on file permissions. | 45 | Enable searching based on file permissions. |
46 | 46 | ||
47 | config CONFIG_FEATURE_FIND_TYPE | 47 | config FEATURE_FIND_TYPE |
48 | bool "Enable filetype matching (-type) option" | 48 | bool "Enable filetype matching (-type) option" |
49 | default y | 49 | default y |
50 | depends on CONFIG_FIND | 50 | depends on FIND |
51 | help | 51 | help |
52 | Enable searching based on file type (file, | 52 | Enable searching based on file type (file, |
53 | directory, socket, device, etc.). | 53 | directory, socket, device, etc.). |
54 | 54 | ||
55 | config CONFIG_FEATURE_FIND_XDEV | 55 | config FEATURE_FIND_XDEV |
56 | bool "Enable stay in filesystem (-xdev) option" | 56 | bool "Enable stay in filesystem (-xdev) option" |
57 | default y | 57 | default y |
58 | depends on CONFIG_FIND | 58 | depends on FIND |
59 | help | 59 | help |
60 | This option will allow find to restrict searches to a single | 60 | This option will allow find to restrict searches to a single |
61 | filesystem. | 61 | filesystem. |
62 | 62 | ||
63 | config CONFIG_FEATURE_FIND_NEWER | 63 | config FEATURE_FIND_NEWER |
64 | bool "Enable -newer option for comparing file mtimes" | 64 | bool "Enable -newer option for comparing file mtimes" |
65 | default y | 65 | default y |
66 | depends on CONFIG_FIND | 66 | depends on FIND |
67 | help | 67 | help |
68 | Support the 'find -newer' option for finding any files which have | 68 | Support the 'find -newer' option for finding any files which have |
69 | a modified time that is more recent than the specified FILE. | 69 | a modified time that is more recent than the specified FILE. |
70 | 70 | ||
71 | config CONFIG_FEATURE_FIND_INUM | 71 | config FEATURE_FIND_INUM |
72 | bool "Enable inode number matching (-inum) option" | 72 | bool "Enable inode number matching (-inum) option" |
73 | default y | 73 | default y |
74 | depends on CONFIG_FIND | 74 | depends on FIND |
75 | help | 75 | help |
76 | Support the 'find -inum' option for searching by inode number. | 76 | Support the 'find -inum' option for searching by inode number. |
77 | 77 | ||
78 | config CONFIG_FEATURE_FIND_EXEC | 78 | config FEATURE_FIND_EXEC |
79 | bool "Enable (-exec) option allowing execution of commands" | 79 | bool "Enable (-exec) option allowing execution of commands" |
80 | default y | 80 | default y |
81 | depends on CONFIG_FIND | 81 | depends on FIND |
82 | help | 82 | help |
83 | Support the 'find -exec' option for executing commands based upon | 83 | Support the 'find -exec' option for executing commands based upon |
84 | the files matched. | 84 | the files matched. |
85 | 85 | ||
86 | config CONFIG_GREP | 86 | config GREP |
87 | bool "grep" | 87 | bool "grep" |
88 | default n | 88 | default n |
89 | help | 89 | help |
90 | grep is used to search files for a specified pattern. | 90 | grep is used to search files for a specified pattern. |
91 | 91 | ||
92 | config CONFIG_FEATURE_GREP_EGREP_ALIAS | 92 | config FEATURE_GREP_EGREP_ALIAS |
93 | bool "Support extended regular expressions (egrep & grep -E)" | 93 | bool "Support extended regular expressions (egrep & grep -E)" |
94 | default y | 94 | default y |
95 | depends on CONFIG_GREP | 95 | depends on GREP |
96 | help | 96 | help |
97 | Enabled support for extended regular expressions. Extended | 97 | Enabled support for extended regular expressions. Extended |
98 | regular expressions allow for alternation (foo|bar), grouping, | 98 | regular expressions allow for alternation (foo|bar), grouping, |
99 | and various repetition operators. | 99 | and various repetition operators. |
100 | 100 | ||
101 | config CONFIG_FEATURE_GREP_FGREP_ALIAS | 101 | config FEATURE_GREP_FGREP_ALIAS |
102 | bool "Alias fgrep to grep -F" | 102 | bool "Alias fgrep to grep -F" |
103 | default y | 103 | default y |
104 | depends on CONFIG_GREP | 104 | depends on GREP |
105 | help | 105 | help |
106 | fgrep sees the search pattern as a normal string rather than | 106 | fgrep sees the search pattern as a normal string rather than |
107 | regular expressions. | 107 | regular expressions. |
108 | grep -F is always builtin, this just creates the fgrep alias. | 108 | grep -F is always builtin, this just creates the fgrep alias. |
109 | 109 | ||
110 | config CONFIG_FEATURE_GREP_CONTEXT | 110 | config FEATURE_GREP_CONTEXT |
111 | bool "Enable before and after context flags (-A, -B and -C)" | 111 | bool "Enable before and after context flags (-A, -B and -C)" |
112 | default y | 112 | default y |
113 | depends on CONFIG_GREP | 113 | depends on GREP |
114 | help | 114 | help |
115 | Print the specified number of leading (-B) and/or trailing (-A) | 115 | Print the specified number of leading (-B) and/or trailing (-A) |
116 | context surrounding our matching lines. | 116 | context surrounding our matching lines. |
117 | Print the specified number of context lines (-C). | 117 | Print the specified number of context lines (-C). |
118 | 118 | ||
119 | config CONFIG_XARGS | 119 | config XARGS |
120 | bool "xargs" | 120 | bool "xargs" |
121 | default n | 121 | default n |
122 | help | 122 | help |
123 | xargs is used to execute a specified command on | 123 | xargs is used to execute a specified command on |
124 | every item from standard input. | 124 | every item from standard input. |
125 | 125 | ||
126 | config CONFIG_FEATURE_XARGS_SUPPORT_CONFIRMATION | 126 | config FEATURE_XARGS_SUPPORT_CONFIRMATION |
127 | bool "Enable prompt and confirmation option -p" | 127 | bool "Enable prompt and confirmation option -p" |
128 | default n | 128 | default n |
129 | depends on CONFIG_XARGS | 129 | depends on XARGS |
130 | help | 130 | help |
131 | Support prompt the user about whether to run each command | 131 | Support prompt the user about whether to run each command |
132 | line and read a line from the terminal. | 132 | line and read a line from the terminal. |
133 | 133 | ||
134 | config CONFIG_FEATURE_XARGS_SUPPORT_QUOTES | 134 | config FEATURE_XARGS_SUPPORT_QUOTES |
135 | bool "Enable support single and double quotes and backslash" | 135 | bool "Enable support single and double quotes and backslash" |
136 | default n | 136 | default n |
137 | depends on CONFIG_XARGS | 137 | depends on XARGS |
138 | help | 138 | help |
139 | Default xargs unsupport single and double quotes | 139 | Default xargs unsupport single and double quotes |
140 | and backslash for can use aruments with spaces. | 140 | and backslash for can use aruments with spaces. |
141 | 141 | ||
142 | config CONFIG_FEATURE_XARGS_SUPPORT_TERMOPT | 142 | config FEATURE_XARGS_SUPPORT_TERMOPT |
143 | bool "Enable support options -x" | 143 | bool "Enable support options -x" |
144 | default n | 144 | default n |
145 | depends on CONFIG_XARGS | 145 | depends on XARGS |
146 | help | 146 | help |
147 | Enable support exit if the size (see the -s or -n option) | 147 | Enable support exit if the size (see the -s or -n option) |
148 | is exceeded. | 148 | is exceeded. |
149 | 149 | ||
150 | config CONFIG_FEATURE_XARGS_SUPPORT_ZERO_TERM | 150 | config FEATURE_XARGS_SUPPORT_ZERO_TERM |
151 | bool "Enable null terminated option -0" | 151 | bool "Enable null terminated option -0" |
152 | default n | 152 | default n |
153 | depends on CONFIG_XARGS | 153 | depends on XARGS |
154 | help | 154 | help |
155 | Enable input filenames are terminated by a null character | 155 | Enable input filenames are terminated by a null character |
156 | instead of by whitespace, and the quotes and backslash | 156 | instead of by whitespace, and the quotes and backslash |
diff --git a/findutils/Kbuild b/findutils/Kbuild new file mode 100644 index 000000000..7b504bacf --- /dev/null +++ b/findutils/Kbuild | |||
@@ -0,0 +1,10 @@ | |||
1 | # Makefile for busybox | ||
2 | # | ||
3 | # Copyright (C) 1999-2005 by Erik Andersen <andersen@codepoet.org> | ||
4 | # | ||
5 | # Licensed under the GPL v2, see the file LICENSE in this tarball. | ||
6 | |||
7 | lib-y:= | ||
8 | lib-$(CONFIG_FIND) += find.o | ||
9 | lib-$(CONFIG_GREP) += grep.o | ||
10 | lib-$(CONFIG_XARGS) += xargs.o | ||
diff --git a/findutils/Makefile b/findutils/Makefile deleted file mode 100644 index f152c8126..000000000 --- a/findutils/Makefile +++ /dev/null | |||
@@ -1,23 +0,0 @@ | |||
1 | # Makefile for busybox | ||
2 | # | ||
3 | # Copyright (C) 1999-2005 by Erik Andersen <andersen@codepoet.org> | ||
4 | # | ||
5 | # Licensed under the GPL v2, see the file LICENSE in this tarball. | ||
6 | |||
7 | ifndef top_srcdir | ||
8 | top_srcdir=.. | ||
9 | endif | ||
10 | ifndef top_builddir | ||
11 | top_builddir=.. | ||
12 | endif | ||
13 | srcdir=$(top_srcdir)/findutils | ||
14 | FINDUTILS_DIR:=./ | ||
15 | include $(top_srcdir)/Rules.mak | ||
16 | include $(top_builddir)/.config | ||
17 | include $(srcdir)/Makefile.in | ||
18 | all: $(libraries-y) | ||
19 | -include $(top_builddir)/.depend | ||
20 | |||
21 | clean: | ||
22 | rm -f *.o *.a $(AR_TARGET) | ||
23 | |||
diff --git a/findutils/Makefile.in b/findutils/Makefile.in deleted file mode 100644 index 25a2d38d3..000000000 --- a/findutils/Makefile.in +++ /dev/null | |||
@@ -1,31 +0,0 @@ | |||
1 | # Makefile for busybox | ||
2 | # | ||
3 | # Copyright (C) 1999-2005 by Erik Andersen <andersen@codepoet.org> | ||
4 | # | ||
5 | # Licensed under the GPL v2, see the file LICENSE in this tarball. | ||
6 | |||
7 | FINDUTILS_AR:=findutils.a | ||
8 | ifndef $(FINDUTILS_DIR) | ||
9 | FINDUTILS_DIR:=$(top_builddir)/findutils/ | ||
10 | endif | ||
11 | srcdir=$(top_srcdir)/findutils | ||
12 | |||
13 | FINDUTILS-y:= | ||
14 | FINDUTILS-$(CONFIG_FIND) += find.o | ||
15 | FINDUTILS-$(CONFIG_GREP) += grep.o | ||
16 | FINDUTILS-$(CONFIG_XARGS) += xargs.o | ||
17 | |||
18 | ifneq ($(strip $(FINDUTILS-y)),) | ||
19 | libraries-y+=$(FINDUTILS_DIR)$(FINDUTILS_AR) | ||
20 | endif | ||
21 | |||
22 | FINDUTILS_SRC-y:=$(patsubst %.o,$(srcdir)/%.c,$(FINDUTILS-y)) | ||
23 | FINDUTILS_SRC-a:=$(wildcard $(srcdir)/*.c) | ||
24 | APPLET_SRC-y+=$(FINDUTILS_SRC-y) | ||
25 | APPLET_SRC-a+=$(FINDUTILS_SRC-a) | ||
26 | |||
27 | $(FINDUTILS_DIR)$(FINDUTILS_AR): $(patsubst %,$(FINDUTILS_DIR)%, $(FINDUTILS-y)) | ||
28 | $(do_ar) | ||
29 | |||
30 | $(FINDUTILS_DIR)%.o: $(srcdir)/%.c | ||
31 | $(compile.c) | ||
diff --git a/include/bb_config.h b/include/bb_config.h new file mode 100644 index 000000000..beec07cba --- /dev/null +++ b/include/bb_config.h | |||
@@ -0,0 +1,142 @@ | |||
1 | /* Hack. kbuild will not define needed macros for config symbols | ||
2 | * which depend on other symbols, which themself are off. | ||
3 | * Provide them here by hand. Need a better idea. */ | ||
4 | |||
5 | #ifndef ENABLE_KILLALL5 | ||
6 | #define ENABLE_KILLALL5 0 | ||
7 | #define USE_KILLALL5(...) | ||
8 | #define SKIP_KILLALL5(...) __VA_ARGS__ | ||
9 | #endif | ||
10 | |||
11 | #ifndef ENABLE_FEATURE_QUERY_MODULE_INTERFACE | ||
12 | #define ENABLE_FEATURE_QUERY_MODULE_INTERFACE 0 | ||
13 | #define USE_FEATURE_QUERY_MODULE_INTERFACE(...) | ||
14 | #define SKIP_FEATURE_QUERY_MODULE_INTERFACE(...) __VA_ARGS__ | ||
15 | #endif | ||
16 | |||
17 | #ifndef ENABLE_FEATURE_CLEAN_UP | ||
18 | #define ENABLE_FEATURE_CLEAN_UP 0 | ||
19 | #define USE_FEATURE_CLEAN_UP(...) | ||
20 | #define SKIP_FEATURE_CLEAN_UP(...) __VA_ARGS__ | ||
21 | #endif | ||
22 | |||
23 | #ifndef ENABLE_FEATURE_SH_STANDALONE_SHELL | ||
24 | #define ENABLE_FEATURE_SH_STANDALONE_SHELL 0 | ||
25 | #define USE_FEATURE_SH_STANDALONE_SHELL(...) | ||
26 | #define SKIP_FEATURE_SH_STANDALONE_SHELL(...) __VA_ARGS__ | ||
27 | #endif | ||
28 | |||
29 | #ifndef ENABLE_FEATURE_MTAB_SUPPORT | ||
30 | #define ENABLE_FEATURE_MTAB_SUPPORT 0 | ||
31 | #define USE_FEATURE_MTAB_SUPPORT(...) | ||
32 | #define SKIP_FEATURE_MTAB_SUPPORT(...) __VA_ARGS__ | ||
33 | #endif | ||
34 | |||
35 | #ifndef ENABLE_FEATURE_PRESERVE_HARDLINKS | ||
36 | #define ENABLE_FEATURE_PRESERVE_HARDLINKS 0 | ||
37 | #define USE_FEATURE_PRESERVE_HARDLINKS(...) | ||
38 | #define SKIP_FEATURE_PRESERVE_HARDLINKS(...) __VA_ARGS__ | ||
39 | #endif | ||
40 | |||
41 | #ifndef ENABLE_FEATURE_AUTOWIDTH | ||
42 | #define ENABLE_FEATURE_AUTOWIDTH 0 | ||
43 | #define USE_FEATURE_AUTOWIDTH(...) | ||
44 | #define SKIP_FEATURE_AUTOWIDTH(...) __VA_ARGS__ | ||
45 | #endif | ||
46 | |||
47 | #ifndef ENABLE_FEATURE_SUID_CONFIG | ||
48 | #define ENABLE_FEATURE_SUID_CONFIG 0 | ||
49 | #define USE_FEATURE_SUID_CONFIG(...) | ||
50 | #define SKIP_FEATURE_SUID_CONFIG(...) __VA_ARGS__ | ||
51 | #endif | ||
52 | |||
53 | #ifndef ENABLE_APP_DUMPLEASES | ||
54 | #define ENABLE_APP_DUMPLEASES 0 | ||
55 | #define USE_APP_DUMPLEASES(...) | ||
56 | #define SKIP_APP_DUMPLEASES(...) __VA_ARGS__ | ||
57 | #endif | ||
58 | |||
59 | #ifndef ENABLE_E2LABEL | ||
60 | #define ENABLE_E2LABEL 0 | ||
61 | #define USE_E2LABEL(...) | ||
62 | #define SKIP_E2LABEL(...) __VA_ARGS__ | ||
63 | #endif | ||
64 | |||
65 | #ifndef ENABLE_FEATURE_GREP_EGREP_ALIAS | ||
66 | #define ENABLE_FEATURE_GREP_EGREP_ALIAS 0 | ||
67 | #define USE_FEATURE_GREP_EGREP_ALIAS(...) | ||
68 | #define SKIP_FEATURE_GREP_EGREP_ALIAS(...) __VA_ARGS__ | ||
69 | #endif | ||
70 | |||
71 | #ifndef ENABLE_FEATURE_GREP_FGREP_ALIAS | ||
72 | #define ENABLE_FEATURE_GREP_FGREP_ALIAS 0 | ||
73 | #define USE_FEATURE_GREP_FGREP_ALIAS(...) | ||
74 | #define SKIP_FEATURE_GREP_FGREP_ALIAS(...) __VA_ARGS__ | ||
75 | #endif | ||
76 | |||
77 | #ifndef ENABLE_FINDFS | ||
78 | #define ENABLE_FINDFS 0 | ||
79 | #define USE_FINDFS(...) | ||
80 | #define SKIP_FINDFS(...) __VA_ARGS__ | ||
81 | #endif | ||
82 | |||
83 | #ifndef ENABLE_IPADDR | ||
84 | #define ENABLE_IPADDR 0 | ||
85 | #define USE_IPADDR(...) | ||
86 | #define SKIP_IPADDR(...) __VA_ARGS__ | ||
87 | #endif | ||
88 | |||
89 | #ifndef ENABLE_IPLINK | ||
90 | #define ENABLE_IPLINK 0 | ||
91 | #define USE_IPLINK(...) | ||
92 | #define SKIP_IPLINK(...) __VA_ARGS__ | ||
93 | #endif | ||
94 | |||
95 | #ifndef ENABLE_IPROUTE | ||
96 | |||
97 | #define ENABLE_IPROUTE 0 | ||
98 | #define USE_IPROUTE(...) | ||
99 | #define SKIP_IPROUTE(...) __VA_ARGS__ | ||
100 | #endif | ||
101 | |||
102 | #ifndef ENABLE_IPTUNNEL | ||
103 | #define ENABLE_IPTUNNEL 0 | ||
104 | #define USE_IPTUNNEL(...) | ||
105 | #define SKIP_IPTUNNEL(...) __VA_ARGS__ | ||
106 | #endif | ||
107 | |||
108 | #ifndef ENABLE_KILLALL | ||
109 | #define ENABLE_KILLALL 0 | ||
110 | #define USE_KILLALL(...) | ||
111 | #define SKIP_KILLALL(...) __VA_ARGS__ | ||
112 | #endif | ||
113 | |||
114 | #ifndef ENABLE_KLOGD | ||
115 | #define ENABLE_KLOGD 0 | ||
116 | #define USE_KLOGD(...) | ||
117 | #define SKIP_KLOGD(...) __VA_ARGS__ | ||
118 | #endif | ||
119 | |||
120 | #ifndef ENABLE_FEATURE_INITRD | ||
121 | #define ENABLE_FEATURE_INITRD 0 | ||
122 | #define USE_FEATURE_INITRD(...) | ||
123 | #define SKIP_FEATURE_INITRD(...) __VA_ARGS__ | ||
124 | #endif | ||
125 | |||
126 | #ifndef ENABLE_LOGREAD | ||
127 | #define ENABLE_LOGREAD 0 | ||
128 | #define USE_LOGREAD(...) | ||
129 | #define SKIP_LOGREAD(...) __VA_ARGS__ | ||
130 | #endif | ||
131 | |||
132 | #ifndef ENABLE_PING6 | ||
133 | #define ENABLE_PING6 0 | ||
134 | #define USE_PING6(...) | ||
135 | #define SKIP_PING6(...) __VA_ARGS__ | ||
136 | #endif | ||
137 | |||
138 | #ifndef ENABLE_UNIX2DOS | ||
139 | #define ENABLE_UNIX2DOS 0 | ||
140 | #define USE_UNIX2DOS(...) | ||
141 | #define SKIP_UNIX2DOS(...) __VA_ARGS__ | ||
142 | #endif | ||
diff --git a/include/busybox.h b/include/busybox.h index fbda6efcb..d20337ff1 100644 --- a/include/busybox.h +++ b/include/busybox.h | |||
@@ -7,8 +7,6 @@ | |||
7 | #ifndef _BB_INTERNAL_H_ | 7 | #ifndef _BB_INTERNAL_H_ |
8 | #define _BB_INTERNAL_H_ 1 | 8 | #define _BB_INTERNAL_H_ 1 |
9 | 9 | ||
10 | #include "bb_config.h" | ||
11 | |||
12 | #include "libbb.h" | 10 | #include "libbb.h" |
13 | 11 | ||
14 | /* order matters: used as index into "install_dir[]" in busybox.c */ | 12 | /* order matters: used as index into "install_dir[]" in busybox.c */ |
diff --git a/include/grp_.h b/include/grp_.h index 3ac5c8461..b34addfa2 100644 --- a/include/grp_.h +++ b/include/grp_.h | |||
@@ -30,12 +30,10 @@ | |||
30 | #ifndef _GRP_H | 30 | #ifndef _GRP_H |
31 | #define _GRP_H 1 | 31 | #define _GRP_H 1 |
32 | 32 | ||
33 | |||
34 | #include <sys/types.h> | 33 | #include <sys/types.h> |
35 | #include <features.h> | 34 | #include <features.h> |
36 | #include <stdio.h> | 35 | #include <stdio.h> |
37 | 36 | ||
38 | |||
39 | /* The group structure. */ | 37 | /* The group structure. */ |
40 | struct group | 38 | struct group |
41 | { | 39 | { |
diff --git a/include/libbb.h b/include/libbb.h index 88847ac59..ed1d780fd 100644 --- a/include/libbb.h +++ b/include/libbb.h | |||
@@ -377,7 +377,6 @@ extern const char *applet_name; | |||
377 | extern const char bb_msg_full_version[]; | 377 | extern const char bb_msg_full_version[]; |
378 | extern const char bb_msg_memory_exhausted[]; | 378 | extern const char bb_msg_memory_exhausted[]; |
379 | extern const char bb_msg_invalid_date[]; | 379 | extern const char bb_msg_invalid_date[]; |
380 | extern const char bb_msg_io_error[]; | ||
381 | extern const char bb_msg_read_error[]; | 380 | extern const char bb_msg_read_error[]; |
382 | extern const char bb_msg_write_error[]; | 381 | extern const char bb_msg_write_error[]; |
383 | extern const char bb_msg_name_longer_than_foo[]; | 382 | extern const char bb_msg_name_longer_than_foo[]; |
diff --git a/init/Config.in b/init/Config.in index 2a39d50e5..c0ad5263d 100644 --- a/init/Config.in +++ b/init/Config.in | |||
@@ -5,32 +5,32 @@ | |||
5 | 5 | ||
6 | menu "Init Utilities" | 6 | menu "Init Utilities" |
7 | 7 | ||
8 | config CONFIG_INIT | 8 | config INIT |
9 | bool "init" | 9 | bool "init" |
10 | default n | 10 | default n |
11 | select CONFIG_FEATURE_SYSLOG | 11 | select FEATURE_SYSLOG |
12 | help | 12 | help |
13 | init is the first program run when the system boots. | 13 | init is the first program run when the system boots. |
14 | 14 | ||
15 | config CONFIG_DEBUG_INIT | 15 | config DEBUG_INIT |
16 | bool "debugging aid" | 16 | bool "debugging aid" |
17 | default n | 17 | default n |
18 | depends on CONFIG_INIT | 18 | depends on INIT |
19 | help | 19 | help |
20 | Turn this on to disable all the dangerous | 20 | Turn this on to disable all the dangerous |
21 | rebooting stuff when debugging. | 21 | rebooting stuff when debugging. |
22 | 22 | ||
23 | config CONFIG_FEATURE_USE_INITTAB | 23 | config FEATURE_USE_INITTAB |
24 | bool "Support reading an inittab file" | 24 | bool "Support reading an inittab file" |
25 | default y | 25 | default y |
26 | depends on CONFIG_INIT | 26 | depends on INIT |
27 | help | 27 | help |
28 | Allow init to read an inittab file when the system boot. | 28 | Allow init to read an inittab file when the system boot. |
29 | 29 | ||
30 | config CONFIG_FEATURE_INIT_SCTTY | 30 | config FEATURE_INIT_SCTTY |
31 | bool "Support running commands with a controlling-tty" | 31 | bool "Support running commands with a controlling-tty" |
32 | default n | 32 | default n |
33 | depends on CONFIG_INIT | 33 | depends on INIT |
34 | help | 34 | help |
35 | If this option is enabled a command starting with hyphen (-) | 35 | If this option is enabled a command starting with hyphen (-) |
36 | is run in its own session (setsid(2)) and possibly with a | 36 | is run in its own session (setsid(2)) and possibly with a |
@@ -38,17 +38,17 @@ config CONFIG_FEATURE_INIT_SCTTY | |||
38 | behavour, but is often what you want in an embedded system where | 38 | behavour, but is often what you want in an embedded system where |
39 | the console is only accessed during development or for maintenance. | 39 | the console is only accessed during development or for maintenance. |
40 | 40 | ||
41 | config CONFIG_FEATURE_EXTRA_QUIET | 41 | config FEATURE_EXTRA_QUIET |
42 | bool "Be _extra_ quiet on boot" | 42 | bool "Be _extra_ quiet on boot" |
43 | default y | 43 | default y |
44 | depends on CONFIG_INIT | 44 | depends on INIT |
45 | help | 45 | help |
46 | Prevent init from logging some messages to the console during boot. | 46 | Prevent init from logging some messages to the console during boot. |
47 | 47 | ||
48 | config CONFIG_FEATURE_INIT_COREDUMPS | 48 | config FEATURE_INIT_COREDUMPS |
49 | bool "Support dumping core for child processes (debugging only)" | 49 | bool "Support dumping core for child processes (debugging only)" |
50 | default n | 50 | default n |
51 | depends on CONFIG_INIT | 51 | depends on INIT |
52 | help | 52 | help |
53 | If this option is enabled and the file /.init_enable_core | 53 | If this option is enabled and the file /.init_enable_core |
54 | exists, then init will call setrlimit() to allow unlimited | 54 | exists, then init will call setrlimit() to allow unlimited |
@@ -57,10 +57,10 @@ config CONFIG_FEATURE_INIT_COREDUMPS | |||
57 | 57 | ||
58 | 58 | ||
59 | 59 | ||
60 | config CONFIG_FEATURE_INITRD | 60 | config FEATURE_INITRD |
61 | bool "Support running init from within an initrd (not initramfs)" | 61 | bool "Support running init from within an initrd (not initramfs)" |
62 | default y | 62 | default y |
63 | depends on CONFIG_INIT | 63 | depends on INIT |
64 | help | 64 | help |
65 | Legacy support for running init under the old-style initrd. Allows | 65 | Legacy support for running init under the old-style initrd. Allows |
66 | the name linuxrc to act as init, and it doesn't assume init is PID 1. | 66 | the name linuxrc to act as init, and it doesn't assume init is PID 1. |
@@ -68,13 +68,13 @@ config CONFIG_FEATURE_INITRD | |||
68 | This does not apply to initramfs, which runs /init as PID 1 and | 68 | This does not apply to initramfs, which runs /init as PID 1 and |
69 | requires no special support. | 69 | requires no special support. |
70 | 70 | ||
71 | config CONFIG_HALT | 71 | config HALT |
72 | bool "poweroff, halt, and reboot" | 72 | bool "poweroff, halt, and reboot" |
73 | default y | 73 | default y |
74 | help | 74 | help |
75 | Stop all processes and either halt, reboot, or power off the system. | 75 | Stop all processes and either halt, reboot, or power off the system. |
76 | 76 | ||
77 | config CONFIG_MESG | 77 | config MESG |
78 | bool "mesg" | 78 | bool "mesg" |
79 | default y | 79 | default y |
80 | help | 80 | help |
diff --git a/init/Kbuild b/init/Kbuild new file mode 100644 index 000000000..e99360241 --- /dev/null +++ b/init/Kbuild | |||
@@ -0,0 +1,12 @@ | |||
1 | # Makefile for busybox | ||
2 | # | ||
3 | # Copyright (C) 1999-2005 by Erik Andersen <andersen@codepoet.org> | ||
4 | # | ||
5 | # Licensed under the GPL v2, see the file LICENSE in this tarball. | ||
6 | |||
7 | lib-y:= | ||
8 | lib-$(CONFIG_HALT) += halt.o | ||
9 | lib-$(CONFIG_INIT) += init.o | ||
10 | lib-$(CONFIG_MESG) += mesg.o | ||
11 | lib-$(CONFIG_INIT) += init_shared.o | ||
12 | lib-$(CONFIG_HALT) += init_shared.o | ||
diff --git a/init/Makefile b/init/Makefile deleted file mode 100644 index 63816f6aa..000000000 --- a/init/Makefile +++ /dev/null | |||
@@ -1,23 +0,0 @@ | |||
1 | # Makefile for busybox | ||
2 | # | ||
3 | # Copyright (C) 1999-2005 by Erik Andersen <andersen@codepoet.org> | ||
4 | # | ||
5 | # Licensed under the GPL v2, see the file LICENSE in this tarball. | ||
6 | |||
7 | ifndef top_srcdir | ||
8 | top_srcdir=.. | ||
9 | endif | ||
10 | ifndef top_builddir | ||
11 | top_builddir=.. | ||
12 | endif | ||
13 | srcdir=$(top_srcdir)/init | ||
14 | INIT_DIR:=./ | ||
15 | include $(top_srcdir)/Rules.mak | ||
16 | include $(top_builddir)/.config | ||
17 | include $(srcdir)/Makefile.in | ||
18 | all: $(libraries-y) | ||
19 | -include $(top_builddir)/.depend | ||
20 | |||
21 | clean: | ||
22 | rm -f *.o *.a $(AR_TARGET) | ||
23 | |||
diff --git a/init/Makefile.in b/init/Makefile.in deleted file mode 100644 index a48ead446..000000000 --- a/init/Makefile.in +++ /dev/null | |||
@@ -1,43 +0,0 @@ | |||
1 | # Makefile for busybox | ||
2 | # | ||
3 | # Copyright (C) 1999-2005 by Erik Andersen <andersen@codepoet.org> | ||
4 | # | ||
5 | # Licensed under the GPL v2, see the file LICENSE in this tarball. | ||
6 | |||
7 | INIT_AR:=init.a | ||
8 | ifndef $(INIT_DIR) | ||
9 | INIT_DIR:=$(top_builddir)/init/ | ||
10 | endif | ||
11 | srcdir=$(top_srcdir)/init | ||
12 | |||
13 | INIT-y:= | ||
14 | INIT-$(CONFIG_HALT) += halt.o | ||
15 | INIT-$(CONFIG_INIT) += init.o | ||
16 | INIT-$(CONFIG_MESG) += mesg.o | ||
17 | |||
18 | ifeq ($(strip $(CONFIG_HALT)),y) | ||
19 | CONFIG_INIT_SHARED=y | ||
20 | else | ||
21 | ifeq ($(strip $(CONFIG_INIT)),y) | ||
22 | CONFIG_INIT_SHARED=y | ||
23 | else | ||
24 | CONFIG_INIT_SHARED=n | ||
25 | endif | ||
26 | endif | ||
27 | |||
28 | INIT-$(CONFIG_INIT_SHARED) += init_shared.o | ||
29 | |||
30 | ifneq ($(strip $(INIT-y)),) | ||
31 | libraries-y+=$(INIT_DIR)$(INIT_AR) | ||
32 | endif | ||
33 | |||
34 | INIT_SRC-y:=$(patsubst %.o,$(srcdir)/%.c,$(INIT-y)) | ||
35 | INIT_SRC-a:=$(wildcard $(srcdir)/*.c) | ||
36 | APPLET_SRC-y+=$(INIT_SRC-y) | ||
37 | APPLET_SRC-a+=$(INIT_SRC-a) | ||
38 | |||
39 | $(INIT_DIR)$(INIT_AR): $(patsubst %,$(INIT_DIR)%, $(INIT-y)) | ||
40 | $(do_ar) | ||
41 | |||
42 | $(INIT_DIR)%.o: $(srcdir)/%.c | ||
43 | $(compile.c) | ||
diff --git a/libbb/Config.in b/libbb/Config.in index c5406cbb9..92ee55cbc 100644 --- a/libbb/Config.in +++ b/libbb/Config.in | |||
@@ -5,14 +5,14 @@ | |||
5 | 5 | ||
6 | menu "Busybox Library Tuning" | 6 | menu "Busybox Library Tuning" |
7 | 7 | ||
8 | config CONFIG_PASSWORD_MINLEN | 8 | config PASSWORD_MINLEN |
9 | int "Minimum password length" | 9 | int "Minimum password length" |
10 | default 6 | 10 | default 6 |
11 | range 5 32 | 11 | range 5 32 |
12 | help | 12 | help |
13 | Minimum allowable password length. | 13 | Minimum allowable password length. |
14 | 14 | ||
15 | config CONFIG_MD5_SIZE_VS_SPEED | 15 | config MD5_SIZE_VS_SPEED |
16 | int " MD5: Trade Bytes for Speed" | 16 | int " MD5: Trade Bytes for Speed" |
17 | default 2 | 17 | default 2 |
18 | range 0 3 | 18 | range 0 3 |
diff --git a/libbb/Kbuild b/libbb/Kbuild new file mode 100644 index 000000000..909f527ba --- /dev/null +++ b/libbb/Kbuild | |||
@@ -0,0 +1,61 @@ | |||
1 | # Makefile for busybox | ||
2 | # | ||
3 | # Copyright (C) 1999-2005 by Erik Andersen <andersen@codepoet.org> | ||
4 | # | ||
5 | # Licensed under the GPL v2, see the file LICENSE in this tarball. | ||
6 | |||
7 | lib-y:= \ | ||
8 | ask_confirmation.o change_identity.o chomp.o \ | ||
9 | compare_string_array.o concat_path_file.o copy_file.o copyfd.o \ | ||
10 | crc32.o create_icmp_socket.o create_icmp6_socket.o \ | ||
11 | device_open.o dump.o error_msg.o error_msg_and_die.o \ | ||
12 | find_pid_by_name.o find_root_device.o fgets_str.o full_read.o \ | ||
13 | full_write.o get_last_path_component.o get_line_from_file.o \ | ||
14 | herror_msg.o herror_msg_and_die.o \ | ||
15 | human_readable.o inet_common.o inode_hash.o isdirectory.o \ | ||
16 | kernel_version.o last_char_is.o login.o \ | ||
17 | make_directory.o md5.o mode_string.o mtab_file.o \ | ||
18 | obscure.o parse_mode.o parse_number.o perror_msg.o \ | ||
19 | perror_msg_and_die.o get_console.o \ | ||
20 | process_escape_sequence.o procps.o \ | ||
21 | recursive_action.o remove_file.o \ | ||
22 | restricted_shell.o run_parts.o run_shell.o safe_read.o safe_write.o \ | ||
23 | safe_strncpy.o setup_environment.o sha1.o simplify_path.o \ | ||
24 | trim.o u_signal_names.o vdprintf.o verror_msg.o \ | ||
25 | vherror_msg.o vperror_msg.o wfopen.o xconnect.o xgetcwd.o \ | ||
26 | xgethostbyname.o xgethostbyname2.o xreadlink.o xgetlarg.o \ | ||
27 | fclose_nonstdin.o fflush_stdout_and_exit.o \ | ||
28 | getopt32.o default_error_retval.o wfopen_input.o speed_table.o \ | ||
29 | perror_nomsg_and_die.o perror_nomsg.o skip_whitespace.o bb_askpass.o \ | ||
30 | warn_ignoring_args.o concat_subpath_file.o vfork_daemon_rexec.o \ | ||
31 | bb_do_delay.o uuencode.o info_msg.o vinfo_msg.o | ||
32 | |||
33 | # conditionally compiled objects: | ||
34 | lib-$(CONFIG_FEATURE_MOUNT_LOOP) += loop.o | ||
35 | lib-$(CONFIG_LOSETUP) += loop.o | ||
36 | lib-$(CONFIG_FEATURE_MTAB_SUPPORT) += mtab.o | ||
37 | lib-$(CONFIG_PASSWD) += pw_encrypt.o | ||
38 | lib-$(CONFIG_SULOGIN) += pw_encrypt.o | ||
39 | lib-$(CONFIG_FEATURE_HTTPD_AUTH_MD5) += pw_encrypt.o | ||
40 | lib-$(CONFIG_VLOCK) += correct_password.o | ||
41 | lib-$(CONFIG_SU) += correct_password.o | ||
42 | lib-$(CONFIG_LOGIN) += correct_password.o | ||
43 | lib-$(CONFIG_DF) += find_mount_point.o | ||
44 | lib-$(CONFIG_EJECT) += find_mount_point.o | ||
45 | |||
46 | # We shouldn't build xregcomp.c if we don't need it - this ensures we don't | ||
47 | # require regex.h to be in the include dir even if we don't need it thereby | ||
48 | # allowing us to build busybox even if uclibc regex support is disabled. | ||
49 | |||
50 | lib-$(CONFIG_AWK) += xregcomp.o | ||
51 | lib-$(CONFIG_SED) += xregcomp.o | ||
52 | lib-$(CONFIG_LESS) += xregcomp.o | ||
53 | lib-$(CONFIG_DEVFSD) += xregcomp.o | ||
54 | |||
55 | lib-y += messages.o | ||
56 | lib-y += xfuncs.o | ||
57 | lib-y += printf.o | ||
58 | lib-y += xgetularg.o | ||
59 | lib-y += safe_strtol.o | ||
60 | lib-y += bb_pwd.o | ||
61 | lib-y += llist.o | ||
diff --git a/libbb/Makefile b/libbb/Makefile deleted file mode 100644 index 336398641..000000000 --- a/libbb/Makefile +++ /dev/null | |||
@@ -1,29 +0,0 @@ | |||
1 | # Makefile for busybox | ||
2 | # | ||
3 | # Copyright (C) 1999-2005 by Erik Andersen <andersen@codepoet.org> | ||
4 | # | ||
5 | # Licensed under the GPL v2, see the file LICENSE in this tarball. | ||
6 | |||
7 | ifndef top_srcdir | ||
8 | top_srcdir=.. | ||
9 | endif | ||
10 | ifndef top_builddir | ||
11 | top_builddir=.. | ||
12 | endif | ||
13 | srcdir=$(top_srcdir)/libbb | ||
14 | LIBBB_DIR:=./ | ||
15 | |||
16 | # Ensure "all" is still the default target when make is run by itself in | ||
17 | # libbb, even if the files we include define rules for targets. | ||
18 | |||
19 | all: | ||
20 | |||
21 | include $(top_srcdir)/Rules.mak | ||
22 | include $(top_builddir)/.config | ||
23 | include Makefile.in | ||
24 | all: $(libraries-y) | ||
25 | -include $(top_builddir)/.depend | ||
26 | |||
27 | clean: | ||
28 | rm -f *.o *.a $(AR_TARGET) | ||
29 | |||
diff --git a/libbb/Makefile.in b/libbb/Makefile.in deleted file mode 100644 index ef5c6b97a..000000000 --- a/libbb/Makefile.in +++ /dev/null | |||
@@ -1,155 +0,0 @@ | |||
1 | # Makefile for busybox | ||
2 | # | ||
3 | # Copyright (C) 1999-2005 by Erik Andersen <andersen@codepoet.org> | ||
4 | # | ||
5 | # Licensed under the GPL v2, see the file LICENSE in this tarball. | ||
6 | |||
7 | ifndef $(LIBBB_DIR) | ||
8 | LIBBB_DIR:=$(top_builddir)/libbb | ||
9 | endif | ||
10 | srcdir=$(top_srcdir)/libbb | ||
11 | |||
12 | LIBBB-n:= | ||
13 | LIBBB-y:= \ | ||
14 | ask_confirmation.c change_identity.c chomp.c \ | ||
15 | compare_string_array.c concat_path_file.c copy_file.c copyfd.c \ | ||
16 | crc32.c create_icmp_socket.c create_icmp6_socket.c \ | ||
17 | device_open.c dump.c error_msg.c error_msg_and_die.c \ | ||
18 | find_pid_by_name.c find_root_device.c fgets_str.c full_read.c \ | ||
19 | full_write.c get_last_path_component.c get_line_from_file.c \ | ||
20 | herror_msg.c herror_msg_and_die.c \ | ||
21 | human_readable.c inet_common.c inode_hash.c isdirectory.c \ | ||
22 | kernel_version.c last_char_is.c login.c \ | ||
23 | make_directory.c md5.c mode_string.c mtab_file.c \ | ||
24 | obscure.c parse_mode.c parse_number.c perror_msg.c \ | ||
25 | perror_msg_and_die.c get_console.c process_escape_sequence.c procps.c \ | ||
26 | recursive_action.c remove_file.c info_msg.c vinfo_msg.c \ | ||
27 | restricted_shell.c run_parts.c run_shell.c safe_read.c safe_write.c \ | ||
28 | safe_strncpy.c setup_environment.c sha1.c simplify_path.c \ | ||
29 | trim.c u_signal_names.c vdprintf.c verror_msg.c \ | ||
30 | vherror_msg.c vperror_msg.c wfopen.c xconnect.c xgetcwd.c \ | ||
31 | xgethostbyname.c xgethostbyname2.c xreadlink.c xgetlarg.c \ | ||
32 | fclose_nonstdin.c fflush_stdout_and_exit.c \ | ||
33 | getopt32.c default_error_retval.c wfopen_input.c speed_table.c \ | ||
34 | perror_nomsg_and_die.c perror_nomsg.c skip_whitespace.c bb_askpass.c \ | ||
35 | warn_ignoring_args.c concat_subpath_file.c vfork_daemon_rexec.c \ | ||
36 | bb_do_delay.c | ||
37 | |||
38 | # conditionally compiled objects: | ||
39 | LIBBB-$(CONFIG_FEATURE_MOUNT_LOOP)+= loop.c | ||
40 | LIBBB-$(CONFIG_LOSETUP)+= loop.c | ||
41 | LIBBB-$(CONFIG_FEATURE_MTAB_SUPPORT)+= mtab.c | ||
42 | LIBBB-$(CONFIG_PASSWD)+= pw_encrypt.c | ||
43 | LIBBB-$(CONFIG_SULOGIN)+= pw_encrypt.c | ||
44 | LIBBB-$(CONFIG_FEATURE_HTTPD_AUTH_MD5)+= pw_encrypt.c | ||
45 | LIBBB-$(CONFIG_VLOCK)+= correct_password.c | ||
46 | LIBBB-$(CONFIG_SU)+= correct_password.c | ||
47 | LIBBB-$(CONFIG_LOGIN)+= correct_password.c | ||
48 | LIBBB-$(CONFIG_DF)+= find_mount_point.c | ||
49 | LIBBB-$(CONFIG_EJECT)+= find_mount_point.c | ||
50 | LIBBB-$(CONFIG_UUENCODE)+= uuencode.c | ||
51 | LIBBB-$(CONFIG_WGET)+= uuencode.c | ||
52 | |||
53 | # We shouldn't build xregcomp.c if we don't need it - this ensures we don't | ||
54 | # require regex.h to be in the include dir even if we don't need it thereby | ||
55 | # allowing us to build busybox even if uclibc regex support is disabled. | ||
56 | |||
57 | regex-y:= | ||
58 | regex-$(CONFIG_AWK) += xregcomp.c | ||
59 | regex-$(CONFIG_SED) += xregcomp.c | ||
60 | regex-$(CONFIG_LESS) += xregcomp.c | ||
61 | regex-$(CONFIG_DEVFSD) += xregcomp.c | ||
62 | regex-$(CONFIG_MDEV) += xregcomp.c | ||
63 | regex-$(CONFIG_GREP) += xregcomp.c | ||
64 | |||
65 | # Sort has the happy side efect of returning a unique list | ||
66 | LIBBB-y += $(sort $(regex-y)) | ||
67 | |||
68 | LIBBB-y:=$(patsubst %,$(srcdir)/%,$(LIBBB-y)) | ||
69 | |||
70 | get-file-subparts = $(addsuffix .o,$(shell sed -n -e "s/^\#ifdef L_//p" ${1})) | ||
71 | |||
72 | # 1:N objects | ||
73 | LIBBB_MSRC0:=$(srcdir)/messages.c | ||
74 | LIBBB_MOBJ0:=$(call get-file-subparts, ${LIBBB_MSRC0}) | ||
75 | LIBBB_MOBJ0:=$(patsubst %,$(LIBBB_DIR)/%, $(LIBBB_MOBJ0)) | ||
76 | $(LIBBB_MOBJ0):$(LIBBB_MSRC0) | ||
77 | $(compile.c) -DL_$(notdir $*) | ||
78 | |||
79 | LIBBB_MSRC1:=$(srcdir)/xfuncs.c | ||
80 | LIBBB_MOBJ1:=$(call get-file-subparts, ${LIBBB_MSRC1}) | ||
81 | LIBBB_MOBJ1:=$(patsubst %,$(LIBBB_DIR)/%, $(LIBBB_MOBJ1)) | ||
82 | $(LIBBB_MOBJ1):$(LIBBB_MSRC1) | ||
83 | $(compile.c) -DL_$(notdir $*) | ||
84 | |||
85 | LIBBB_MSRC2:=$(srcdir)/printf.c | ||
86 | LIBBB_MOBJ2:=$(call get-file-subparts, ${LIBBB_MSRC2}) | ||
87 | LIBBB_MOBJ2:=$(patsubst %,$(LIBBB_DIR)/%, $(LIBBB_MOBJ2)) | ||
88 | $(LIBBB_MOBJ2):$(LIBBB_MSRC2) | ||
89 | $(compile.c) -DL_$(notdir $*) | ||
90 | |||
91 | LIBBB_MSRC3:=$(srcdir)/xgetularg.c | ||
92 | LIBBB_MOBJ3:=$(call get-file-subparts, ${LIBBB_MSRC3}) | ||
93 | LIBBB_MOBJ3:=$(patsubst %,$(LIBBB_DIR)/%, $(LIBBB_MOBJ3)) | ||
94 | $(LIBBB_MOBJ3):$(LIBBB_MSRC3) | ||
95 | $(compile.c) -DL_$(notdir $*) | ||
96 | |||
97 | LIBBB_MSRC4:=$(srcdir)/safe_strtol.c | ||
98 | LIBBB_MOBJ4:=$(call get-file-subparts, ${LIBBB_MSRC4}) | ||
99 | LIBBB_MOBJ4:=$(patsubst %,$(LIBBB_DIR)/%, $(LIBBB_MOBJ4)) | ||
100 | $(LIBBB_MOBJ4):$(LIBBB_MSRC4) | ||
101 | $(compile.c) -DL_$(notdir $*) | ||
102 | |||
103 | LIBBB_MSRC5:=$(srcdir)/bb_pwd.c | ||
104 | LIBBB_MOBJ5:=$(call get-file-subparts, ${LIBBB_MSRC5}) | ||
105 | LIBBB_MOBJ5:=$(patsubst %,$(LIBBB_DIR)/%, $(LIBBB_MOBJ5)) | ||
106 | $(LIBBB_MOBJ5):$(LIBBB_MSRC5) | ||
107 | $(compile.c) -DL_$(notdir $*) | ||
108 | |||
109 | LIBBB_MSRC6:=$(srcdir)/llist.c | ||
110 | LIBBB_MOBJ6:=$(call get-file-subparts, ${LIBBB_MSRC6}) | ||
111 | LIBBB_MOBJ6:=$(patsubst %,$(LIBBB_DIR)/%, $(LIBBB_MOBJ6)) | ||
112 | $(LIBBB_MOBJ6):$(LIBBB_MSRC6) | ||
113 | $(compile.c) -DL_$(notdir $*) | ||
114 | |||
115 | # We need the names of the object files built from MSRC for the L_ defines | ||
116 | LIBBB_ALL_MOBJ:=$(LIBBB_MOBJ0) $(LIBBB_MOBJ1) $(LIBBB_MOBJ2) $(LIBBB_MOBJ3) \ | ||
117 | $(LIBBB_MOBJ4) $(LIBBB_MOBJ5) $(LIBBB_MOBJ6) | ||
118 | |||
119 | LIBBB_ALL_MSRC:=$(LIBBB_MSRC0) $(LIBBB_MSRC1) $(LIBBB_MSRC2) $(LIBBB_MSRC3) \ | ||
120 | $(LIBBB_MSRC4) $(LIBBB_MSRC5) $(LIBBB_MSRC6) | ||
121 | |||
122 | LIBBB-y:=$(sort $(LIBBB-y) $(LIBBB_ALL_MSRC)) | ||
123 | |||
124 | LIBBB_AR:=$(LIBBB_DIR)/libbb.a | ||
125 | libraries-y+=$(LIBBB_AR) | ||
126 | |||
127 | needcrypt-y:= | ||
128 | ifneq ($(filter $(srcdir)/pw_encrypt.c,$(LIBBB-y)),) | ||
129 | needcrypt-y:=y | ||
130 | else | ||
131 | ifneq ($(filter $(srcdir)/correct_password.c,$(LIBBB-y)),) | ||
132 | needcrypt-y:=y | ||
133 | endif | ||
134 | endif | ||
135 | |||
136 | ifeq ($(needcrypt-y),y) | ||
137 | LIBRARIES := -lcrypt $(filter-out -lcrypt,$(LIBRARIES)) | ||
138 | endif | ||
139 | |||
140 | # all 1:1 objects | ||
141 | LIBBB_OBJS:=$(patsubst $(srcdir)/%.c,$(LIBBB_DIR)/%.o, $(LIBBB-y)) | ||
142 | $(LIBBB_DIR)/%.o: $(srcdir)/%.c | ||
143 | $(compile.c) | ||
144 | |||
145 | LIBBB_SRC-a:=$(wildcard $(srcdir)/*.c) | ||
146 | LIBRARY_SRC-y+=$(LIBBB-y) | ||
147 | LIBRARY_SRC-a+=$(LIBBB_SRC-a) | ||
148 | |||
149 | # all defines needed for 1:N objects | ||
150 | LIBBB_DEFINE-y:=$(patsubst %,-DL_%,$(subst .o,,$(notdir $(LIBBB_ALL_MOBJ)))) | ||
151 | LIBRARY_DEFINE-y+=$(LIBBB_DEFINE-y) | ||
152 | LIBRARY_DEFINE-a+=$(LIBBB_DEFINE-y) | ||
153 | |||
154 | $(LIBBB_AR): $(LIBBB_OBJS) $(LIBBB_ALL_MOBJ) | ||
155 | $(do_ar) | ||
diff --git a/libbb/bb_pwd.c b/libbb/bb_pwd.c index e4d327340..3a214ca33 100644 --- a/libbb/bb_pwd.c +++ b/libbb/bb_pwd.c | |||
@@ -7,8 +7,11 @@ | |||
7 | * Licensed under the GPL v2 or later, see the file LICENSE in this tarball. | 7 | * Licensed under the GPL v2 or later, see the file LICENSE in this tarball. |
8 | */ | 8 | */ |
9 | 9 | ||
10 | #include <stdio.h> | ||
11 | #include <string.h> | ||
12 | #include <assert.h> | ||
13 | #include "libbb.h" | ||
10 | 14 | ||
11 | #ifdef L_bb_getgrgid | ||
12 | /* Hacked by Tito Ragusa (c) 2004 <farmatito@tiscali.it> to make it more | 15 | /* Hacked by Tito Ragusa (c) 2004 <farmatito@tiscali.it> to make it more |
13 | * flexible : | 16 | * flexible : |
14 | * | 17 | * |
@@ -26,9 +29,6 @@ | |||
26 | * the program exits. | 29 | * the program exits. |
27 | */ | 30 | */ |
28 | 31 | ||
29 | #include "libbb.h" | ||
30 | #include "grp_.h" | ||
31 | |||
32 | /* gets a groupname given a gid */ | 32 | /* gets a groupname given a gid */ |
33 | char * bb_getgrgid(char *group, long gid, int bufsize) | 33 | char * bb_getgrgid(char *group, long gid, int bufsize) |
34 | { | 34 | { |
@@ -37,15 +37,6 @@ char * bb_getgrgid(char *group, long gid, int bufsize) | |||
37 | return bb_getug(group, (mygroup) ? | 37 | return bb_getug(group, (mygroup) ? |
38 | mygroup->gr_name : (char *)mygroup, gid, bufsize, 'g'); | 38 | mygroup->gr_name : (char *)mygroup, gid, bufsize, 'g'); |
39 | } | 39 | } |
40 | #endif /* L_bb_getgrgid */ | ||
41 | |||
42 | #ifdef L_bb_xgetgrnam | ||
43 | #include <stdio.h> | ||
44 | #include <string.h> | ||
45 | #include "libbb.h" | ||
46 | #include "pwd_.h" | ||
47 | #include "grp_.h" | ||
48 | |||
49 | 40 | ||
50 | /* returns a gid given a group name */ | 41 | /* returns a gid given a group name */ |
51 | long bb_xgetgrnam(const char *name) | 42 | long bb_xgetgrnam(const char *name) |
@@ -58,15 +49,6 @@ long bb_xgetgrnam(const char *name) | |||
58 | 49 | ||
59 | return (mygroup->gr_gid); | 50 | return (mygroup->gr_gid); |
60 | } | 51 | } |
61 | #endif /* L_bb_xgetgrnam */ | ||
62 | |||
63 | #ifdef L_bb_xgetpwnam | ||
64 | #include <stdio.h> | ||
65 | #include <string.h> | ||
66 | #include "libbb.h" | ||
67 | #include "pwd_.h" | ||
68 | #include "grp_.h" | ||
69 | |||
70 | 52 | ||
71 | /* returns a uid given a username */ | 53 | /* returns a uid given a username */ |
72 | long bb_xgetpwnam(const char *name) | 54 | long bb_xgetpwnam(const char *name) |
@@ -79,9 +61,7 @@ long bb_xgetpwnam(const char *name) | |||
79 | 61 | ||
80 | return myuser->pw_uid; | 62 | return myuser->pw_uid; |
81 | } | 63 | } |
82 | #endif /* L_bb_xgetpwnam */ | ||
83 | 64 | ||
84 | #ifdef L_bb_getpwuid | ||
85 | /* Hacked by Tito Ragusa (c) 2004 <farmatito@tiscali.it> to make it more | 65 | /* Hacked by Tito Ragusa (c) 2004 <farmatito@tiscali.it> to make it more |
86 | * flexible : | 66 | * flexible : |
87 | * | 67 | * |
@@ -99,9 +79,6 @@ long bb_xgetpwnam(const char *name) | |||
99 | * the program exits. | 79 | * the program exits. |
100 | */ | 80 | */ |
101 | 81 | ||
102 | #include "libbb.h" | ||
103 | #include "pwd_.h" | ||
104 | |||
105 | /* gets a username given a uid */ | 82 | /* gets a username given a uid */ |
106 | char * bb_getpwuid(char *name, long uid, int bufsize) | 83 | char * bb_getpwuid(char *name, long uid, int bufsize) |
107 | { | 84 | { |
@@ -110,9 +87,7 @@ char * bb_getpwuid(char *name, long uid, int bufsize) | |||
110 | return bb_getug(name, (myuser) ? | 87 | return bb_getug(name, (myuser) ? |
111 | myuser->pw_name : (char *)myuser , uid, bufsize, 'u'); | 88 | myuser->pw_name : (char *)myuser , uid, bufsize, 'u'); |
112 | } | 89 | } |
113 | #endif /* L_bb_getpwuid */ | ||
114 | 90 | ||
115 | #ifdef L_bb_getug | ||
116 | /* | 91 | /* |
117 | * if bufsize is > 0 char *buffer can not be set to NULL. | 92 | * if bufsize is > 0 char *buffer can not be set to NULL. |
118 | * If idname is not NULL it is written on the static | 93 | * If idname is not NULL it is written on the static |
@@ -127,11 +102,6 @@ char * bb_getpwuid(char *name, long uid, int bufsize) | |||
127 | * else an error message is printed and the program exits. | 102 | * else an error message is printed and the program exits. |
128 | */ | 103 | */ |
129 | 104 | ||
130 | #include <stdio.h> | ||
131 | #include <assert.h> | ||
132 | #include "libbb.h" | ||
133 | |||
134 | |||
135 | /* internal function for bb_getpwuid and bb_getgrgid */ | 105 | /* internal function for bb_getpwuid and bb_getgrgid */ |
136 | char * bb_getug(char *buffer, char *idname, long id, int bufsize, char prefix) | 106 | char * bb_getug(char *buffer, char *idname, long id, int bufsize, char prefix) |
137 | { | 107 | { |
@@ -146,13 +116,6 @@ char * bb_getug(char *buffer, char *idname, long id, int bufsize, char prefix) | |||
146 | } | 116 | } |
147 | return idname; | 117 | return idname; |
148 | } | 118 | } |
149 | #endif /* L_bb_getug */ | ||
150 | |||
151 | |||
152 | #ifdef L_get_ug_id | ||
153 | /* indirect dispatcher for pwd helpers. */ | ||
154 | #include <stdlib.h> | ||
155 | #include "libbb.h" | ||
156 | 119 | ||
157 | unsigned long get_ug_id(const char *s, | 120 | unsigned long get_ug_id(const char *s, |
158 | long (*__bb_getxxnam)(const char *)) | 121 | long (*__bb_getxxnam)(const char *)) |
@@ -167,4 +130,3 @@ unsigned long get_ug_id(const char *s, | |||
167 | 130 | ||
168 | return r; | 131 | return r; |
169 | } | 132 | } |
170 | #endif /* L_get_ug_id */ | ||
diff --git a/libbb/llist.c b/libbb/llist.c index 0e727c496..8bf89a595 100644 --- a/libbb/llist.c +++ b/libbb/llist.c | |||
@@ -13,7 +13,6 @@ | |||
13 | #include <stdlib.h> | 13 | #include <stdlib.h> |
14 | #include "libbb.h" | 14 | #include "libbb.h" |
15 | 15 | ||
16 | #ifdef L_llist_add_to | ||
17 | /* Add data to the start of the linked list. */ | 16 | /* Add data to the start of the linked list. */ |
18 | void llist_add_to(llist_t **old_head, void *data) | 17 | void llist_add_to(llist_t **old_head, void *data) |
19 | { | 18 | { |
@@ -22,9 +21,7 @@ void llist_add_to(llist_t **old_head, void *data) | |||
22 | new_head->link = *old_head; | 21 | new_head->link = *old_head; |
23 | *old_head = new_head; | 22 | *old_head = new_head; |
24 | } | 23 | } |
25 | #endif | ||
26 | 24 | ||
27 | #ifdef L_llist_add_to_end | ||
28 | /* Add data to the end of the linked list. */ | 25 | /* Add data to the end of the linked list. */ |
29 | void llist_add_to_end(llist_t **list_head, void *data) | 26 | void llist_add_to_end(llist_t **list_head, void *data) |
30 | { | 27 | { |
@@ -39,9 +36,7 @@ void llist_add_to_end(llist_t **list_head, void *data) | |||
39 | tail->link = new_item; | 36 | tail->link = new_item; |
40 | } | 37 | } |
41 | } | 38 | } |
42 | #endif | ||
43 | 39 | ||
44 | #ifdef L_llist_pop | ||
45 | /* Remove first element from the list and return it */ | 40 | /* Remove first element from the list and return it */ |
46 | void *llist_pop(llist_t **head) | 41 | void *llist_pop(llist_t **head) |
47 | { | 42 | { |
@@ -57,9 +52,7 @@ void *llist_pop(llist_t **head) | |||
57 | 52 | ||
58 | return data; | 53 | return data; |
59 | } | 54 | } |
60 | #endif | ||
61 | 55 | ||
62 | #ifdef L_llist_free | ||
63 | /* Recursively free all elements in the linked list. If freeit != NULL | 56 | /* Recursively free all elements in the linked list. If freeit != NULL |
64 | * call it on each datum in the list */ | 57 | * call it on each datum in the list */ |
65 | void llist_free(llist_t *elm, void (*freeit)(void *data)) | 58 | void llist_free(llist_t *elm, void (*freeit)(void *data)) |
@@ -69,4 +62,3 @@ void llist_free(llist_t *elm, void (*freeit)(void *data)) | |||
69 | if (freeit) freeit(data); | 62 | if (freeit) freeit(data); |
70 | } | 63 | } |
71 | } | 64 | } |
72 | #endif | ||
diff --git a/libbb/messages.c b/libbb/messages.c index 5aba7e693..bd41216a5 100644 --- a/libbb/messages.c +++ b/libbb/messages.c | |||
@@ -7,7 +7,6 @@ | |||
7 | 7 | ||
8 | #include "libbb.h" | 8 | #include "libbb.h" |
9 | 9 | ||
10 | #ifdef L_full_version | ||
11 | #ifndef BB_EXTRA_VERSION | 10 | #ifndef BB_EXTRA_VERSION |
12 | #define BANNER "BusyBox v" BB_VER " (" BB_BT ")" | 11 | #define BANNER "BusyBox v" BB_VER " (" BB_BT ")" |
13 | #else | 12 | #else |
@@ -15,92 +14,30 @@ | |||
15 | #endif | 14 | #endif |
16 | const char BB_BANNER[] = BANNER; | 15 | const char BB_BANNER[] = BANNER; |
17 | const char bb_msg_full_version[] = BANNER " multi-call binary"; | 16 | const char bb_msg_full_version[] = BANNER " multi-call binary"; |
18 | #endif | ||
19 | |||
20 | #ifdef L_memory_exhausted | ||
21 | const char bb_msg_memory_exhausted[] = "memory exhausted"; | ||
22 | #endif | ||
23 | #ifdef L_invalid_date | ||
24 | const char bb_msg_invalid_date[] = "invalid date `%s'"; | ||
25 | #endif | ||
26 | #ifdef L_io_error | ||
27 | const char bb_msg_io_error[] = "%s: input/output error -- %m"; | ||
28 | #endif | ||
29 | #ifdef L_write_error | ||
30 | const char bb_msg_write_error[] = "write error"; | ||
31 | #endif | ||
32 | #ifdef L_read_error | ||
33 | const char bb_msg_read_error[] = "read error"; | ||
34 | #endif | ||
35 | #ifdef L_name_longer_than_foo | ||
36 | const char bb_msg_name_longer_than_foo[] = "names longer than %d chars not supported"; | ||
37 | #endif | ||
38 | #ifdef L_unknown | ||
39 | const char bb_msg_unknown[] = "(unknown)"; | ||
40 | #endif | ||
41 | #ifdef L_can_not_create_raw_socket | ||
42 | const char bb_msg_can_not_create_raw_socket[] = "can't create raw socket"; | ||
43 | #endif | ||
44 | #ifdef L_perm_denied_are_you_root | ||
45 | const char bb_msg_perm_denied_are_you_root[] = "permission denied. (are you root?)"; | ||
46 | #endif | ||
47 | #ifdef L_msg_requires_arg | ||
48 | const char bb_msg_requires_arg[] = "%s requires an argument"; | ||
49 | #endif | ||
50 | #ifdef L_msg_invalid_arg | ||
51 | const char bb_msg_invalid_arg[] = "invalid argument `%s' to `%s'"; | ||
52 | #endif | ||
53 | #ifdef L_msg_standard_input | ||
54 | const char bb_msg_standard_input[] = "standard input"; | ||
55 | #endif | ||
56 | #ifdef L_msg_standard_output | ||
57 | const char bb_msg_standard_output[] = "standard output"; | ||
58 | #endif | ||
59 | |||
60 | #ifdef L_passwd_file | ||
61 | #define PASSWD_FILE "/etc/passwd" | ||
62 | const char bb_path_passwd_file[] = PASSWD_FILE; | ||
63 | #endif | ||
64 | 17 | ||
65 | #ifdef L_shadow_file | 18 | const char bb_msg_memory_exhausted[] = "memory exhausted"; |
66 | #define SHADOW_FILE "/etc/shadow" | 19 | const char bb_msg_invalid_date[] = "invalid date '%s'"; |
67 | const char bb_path_shadow_file[] = SHADOW_FILE; | 20 | const char bb_msg_write_error[] = "write error"; |
68 | #endif | 21 | const char bb_msg_read_error[] = "read error"; |
69 | 22 | const char bb_msg_name_longer_than_foo[] = "names longer than %d chars not supported"; | |
70 | #ifdef L_group_file | 23 | const char bb_msg_unknown[] = "(unknown)"; |
71 | #define GROUP_FILE "/etc/group" | 24 | const char bb_msg_can_not_create_raw_socket[] = "can't create raw socket"; |
72 | const char bb_path_group_file[] = GROUP_FILE; | 25 | const char bb_msg_perm_denied_are_you_root[] = "permission denied. (are you root?)"; |
73 | #endif | 26 | const char bb_msg_requires_arg[] = "%s requires an argument"; |
74 | 27 | const char bb_msg_invalid_arg[] = "invalid argument '%s' to '%s'"; | |
75 | #ifdef L_gshadow_file | 28 | const char bb_msg_standard_input[] = "standard input"; |
76 | #define GSHADOW_FILE "/etc/gshadow" | 29 | const char bb_msg_standard_output[] = "standard output"; |
77 | const char bb_path_gshadow_file[] = GSHADOW_FILE; | 30 | |
78 | #endif | 31 | const char bb_path_passwd_file[] = "/etc/passwd"; |
79 | 32 | const char bb_path_shadow_file[] = "/etc/shadow"; | |
80 | #ifdef L_nologin_file | 33 | const char bb_path_group_file[] = "/etc/group"; |
81 | #define NOLOGIN_FILE "/etc/nologin" | 34 | const char bb_path_gshadow_file[] = "/etc/gshadow"; |
82 | const char bb_path_nologin_file[] = NOLOGIN_FILE; | 35 | const char bb_path_nologin_file[] = "/etc/nologin"; |
83 | #endif | 36 | const char bb_path_securetty_file[] = "/etc/securetty"; |
84 | 37 | const char bb_path_motd_file[] = "/etc/motd"; | |
85 | #ifdef L_securetty_file | ||
86 | #define SECURETTY_FILE "/etc/securetty" | ||
87 | const char bb_path_securetty_file[] = SECURETTY_FILE; | ||
88 | #endif | ||
89 | |||
90 | #ifdef L_motd_file | ||
91 | #define MOTD_FILE "/etc/motd" | ||
92 | const char bb_path_motd_file[] = MOTD_FILE; | ||
93 | #endif | ||
94 | |||
95 | #ifdef L_shell_file | ||
96 | const char bb_default_login_shell[] = LIBBB_DEFAULT_LOGIN_SHELL; | 38 | const char bb_default_login_shell[] = LIBBB_DEFAULT_LOGIN_SHELL; |
97 | #endif | ||
98 | |||
99 | #ifdef L_bb_dev_null | ||
100 | const char bb_dev_null[] = "/dev/null"; | 39 | const char bb_dev_null[] = "/dev/null"; |
101 | #endif | ||
102 | 40 | ||
103 | #ifdef L_bb_path_wtmp_file | ||
104 | #include <utmp.h> | 41 | #include <utmp.h> |
105 | /* This is usually something like "/var/adm/wtmp" or "/var/log/wtmp" */ | 42 | /* This is usually something like "/var/adm/wtmp" or "/var/log/wtmp" */ |
106 | const char bb_path_wtmp_file[] = | 43 | const char bb_path_wtmp_file[] = |
@@ -111,9 +48,5 @@ WTMP_FILE; | |||
111 | #else | 48 | #else |
112 | # error unknown path to wtmp file | 49 | # error unknown path to wtmp file |
113 | #endif | 50 | #endif |
114 | #endif | ||
115 | 51 | ||
116 | |||
117 | #ifdef L_bb_common_bufsiz1 | ||
118 | char bb_common_bufsiz1[BUFSIZ+1]; | 52 | char bb_common_bufsiz1[BUFSIZ+1]; |
119 | #endif | ||
diff --git a/libbb/printf.c b/libbb/printf.c index 2e79555b5..f0ddb862e 100644 --- a/libbb/printf.c +++ b/libbb/printf.c | |||
@@ -37,7 +37,6 @@ | |||
37 | #include <errno.h> | 37 | #include <errno.h> |
38 | #include "libbb.h" | 38 | #include "libbb.h" |
39 | 39 | ||
40 | #ifdef L_bb_vfprintf | ||
41 | int bb_vfprintf(FILE * __restrict stream, | 40 | int bb_vfprintf(FILE * __restrict stream, |
42 | const char * __restrict format, | 41 | const char * __restrict format, |
43 | va_list arg) | 42 | va_list arg) |
@@ -65,16 +64,12 @@ int bb_vfprintf(FILE * __restrict stream, | |||
65 | 64 | ||
66 | return rv; | 65 | return rv; |
67 | } | 66 | } |
68 | #endif | ||
69 | 67 | ||
70 | #ifdef L_bb_vprintf | ||
71 | int bb_vprintf(const char * __restrict format, va_list arg) | 68 | int bb_vprintf(const char * __restrict format, va_list arg) |
72 | { | 69 | { |
73 | return bb_vfprintf(stdout, format, arg); | 70 | return bb_vfprintf(stdout, format, arg); |
74 | } | 71 | } |
75 | #endif | ||
76 | 72 | ||
77 | #ifdef L_bb_fprintf | ||
78 | int bb_fprintf(FILE * __restrict stream, | 73 | int bb_fprintf(FILE * __restrict stream, |
79 | const char * __restrict format, ...) | 74 | const char * __restrict format, ...) |
80 | { | 75 | { |
@@ -87,9 +82,7 @@ int bb_fprintf(FILE * __restrict stream, | |||
87 | 82 | ||
88 | return rv; | 83 | return rv; |
89 | } | 84 | } |
90 | #endif | ||
91 | 85 | ||
92 | #ifdef L_bb_printf | ||
93 | int bb_printf(const char * __restrict format, ...) | 86 | int bb_printf(const char * __restrict format, ...) |
94 | { | 87 | { |
95 | va_list arg; | 88 | va_list arg; |
@@ -101,4 +94,3 @@ int bb_printf(const char * __restrict format, ...) | |||
101 | 94 | ||
102 | return rv; | 95 | return rv; |
103 | } | 96 | } |
104 | #endif | ||
diff --git a/libbb/safe_strtol.c b/libbb/safe_strtol.c index 2e8fa9558..027fc1e62 100644 --- a/libbb/safe_strtol.c +++ b/libbb/safe_strtol.c | |||
@@ -12,7 +12,6 @@ | |||
12 | #include <assert.h> | 12 | #include <assert.h> |
13 | #include "libbb.h" | 13 | #include "libbb.h" |
14 | 14 | ||
15 | #ifdef L_safe_strtoi | ||
16 | int safe_strtoi(char *arg, int* value) | 15 | int safe_strtoi(char *arg, int* value) |
17 | { | 16 | { |
18 | int error; | 17 | int error; |
@@ -21,9 +20,7 @@ int safe_strtoi(char *arg, int* value) | |||
21 | *value = (int) lvalue; | 20 | *value = (int) lvalue; |
22 | return error; | 21 | return error; |
23 | } | 22 | } |
24 | #endif | ||
25 | 23 | ||
26 | #ifdef L_safe_strtod | ||
27 | int safe_strtod(char *arg, double* value) | 24 | int safe_strtod(char *arg, double* value) |
28 | { | 25 | { |
29 | char *endptr; | 26 | char *endptr; |
@@ -38,9 +35,7 @@ int safe_strtod(char *arg, double* value) | |||
38 | errno = errno_save; | 35 | errno = errno_save; |
39 | return 0; | 36 | return 0; |
40 | } | 37 | } |
41 | #endif | ||
42 | 38 | ||
43 | #ifdef L_safe_strtol | ||
44 | int safe_strtol(char *arg, long* value) | 39 | int safe_strtol(char *arg, long* value) |
45 | { | 40 | { |
46 | char *endptr; | 41 | char *endptr; |
@@ -55,9 +50,7 @@ int safe_strtol(char *arg, long* value) | |||
55 | errno = errno_save; | 50 | errno = errno_save; |
56 | return 0; | 51 | return 0; |
57 | } | 52 | } |
58 | #endif | ||
59 | 53 | ||
60 | #ifdef L_safe_strtoul | ||
61 | int safe_strtoul(char *arg, unsigned long* value) | 54 | int safe_strtoul(char *arg, unsigned long* value) |
62 | { | 55 | { |
63 | char *endptr; | 56 | char *endptr; |
@@ -72,9 +65,7 @@ int safe_strtoul(char *arg, unsigned long* value) | |||
72 | errno = errno_save; | 65 | errno = errno_save; |
73 | return 0; | 66 | return 0; |
74 | } | 67 | } |
75 | #endif | ||
76 | 68 | ||
77 | #ifdef L_safe_strtoll | ||
78 | int safe_strtoll(char *arg, long long* value) | 69 | int safe_strtoll(char *arg, long long* value) |
79 | { | 70 | { |
80 | char *endptr; | 71 | char *endptr; |
@@ -89,9 +80,7 @@ int safe_strtoll(char *arg, long long* value) | |||
89 | errno = errno_save; | 80 | errno = errno_save; |
90 | return 0; | 81 | return 0; |
91 | } | 82 | } |
92 | #endif | ||
93 | 83 | ||
94 | #ifdef L_safe_strtoull | ||
95 | int safe_strtoull(char *arg, unsigned long long* value) | 84 | int safe_strtoull(char *arg, unsigned long long* value) |
96 | { | 85 | { |
97 | char *endptr; | 86 | char *endptr; |
@@ -106,5 +95,3 @@ int safe_strtoull(char *arg, unsigned long long* value) | |||
106 | errno = errno_save; | 95 | errno = errno_save; |
107 | return 0; | 96 | return 0; |
108 | } | 97 | } |
109 | #endif | ||
110 | |||
diff --git a/libbb/xfuncs.c b/libbb/xfuncs.c index f1d4486c3..de765a32d 100644 --- a/libbb/xfuncs.c +++ b/libbb/xfuncs.c | |||
@@ -20,7 +20,6 @@ | |||
20 | * Since dmalloc's prototypes overwrite the impls here as they are | 20 | * Since dmalloc's prototypes overwrite the impls here as they are |
21 | * included after these prototypes in libbb.h, all is well. | 21 | * included after these prototypes in libbb.h, all is well. |
22 | */ | 22 | */ |
23 | #ifdef L_xmalloc | ||
24 | // Die if we can't allocate size bytes of memory. | 23 | // Die if we can't allocate size bytes of memory. |
25 | void *xmalloc(size_t size) | 24 | void *xmalloc(size_t size) |
26 | { | 25 | { |
@@ -29,9 +28,7 @@ void *xmalloc(size_t size) | |||
29 | bb_error_msg_and_die(bb_msg_memory_exhausted); | 28 | bb_error_msg_and_die(bb_msg_memory_exhausted); |
30 | return ptr; | 29 | return ptr; |
31 | } | 30 | } |
32 | #endif | ||
33 | 31 | ||
34 | #ifdef L_xrealloc | ||
35 | // Die if we can't resize previously allocated memory. (This returns a pointer | 32 | // Die if we can't resize previously allocated memory. (This returns a pointer |
36 | // to the new memory, which may or may not be the same as the old memory. | 33 | // to the new memory, which may or may not be the same as the old memory. |
37 | // It'll copy the contents to a new chunk and free the old one if necessary.) | 34 | // It'll copy the contents to a new chunk and free the old one if necessary.) |
@@ -42,11 +39,8 @@ void *xrealloc(void *ptr, size_t size) | |||
42 | bb_error_msg_and_die(bb_msg_memory_exhausted); | 39 | bb_error_msg_and_die(bb_msg_memory_exhausted); |
43 | return ptr; | 40 | return ptr; |
44 | } | 41 | } |
45 | #endif | ||
46 | #endif /* DMALLOC */ | 42 | #endif /* DMALLOC */ |
47 | 43 | ||
48 | |||
49 | #ifdef L_xzalloc | ||
50 | // Die if we can't allocate and zero size bytes of memory. | 44 | // Die if we can't allocate and zero size bytes of memory. |
51 | void *xzalloc(size_t size) | 45 | void *xzalloc(size_t size) |
52 | { | 46 | { |
@@ -54,9 +48,7 @@ void *xzalloc(size_t size) | |||
54 | memset(ptr, 0, size); | 48 | memset(ptr, 0, size); |
55 | return ptr; | 49 | return ptr; |
56 | } | 50 | } |
57 | #endif | ||
58 | 51 | ||
59 | #ifdef L_xstrdup | ||
60 | // Die if we can't copy a string to freshly allocated memory. | 52 | // Die if we can't copy a string to freshly allocated memory. |
61 | char * xstrdup(const char *s) | 53 | char * xstrdup(const char *s) |
62 | { | 54 | { |
@@ -72,9 +64,7 @@ char * xstrdup(const char *s) | |||
72 | 64 | ||
73 | return t; | 65 | return t; |
74 | } | 66 | } |
75 | #endif | ||
76 | 67 | ||
77 | #ifdef L_xstrndup | ||
78 | // Die if we can't allocate n+1 bytes (space for the null terminator) and copy | 68 | // Die if we can't allocate n+1 bytes (space for the null terminator) and copy |
79 | // the (possibly truncated to length n) string into it. | 69 | // the (possibly truncated to length n) string into it. |
80 | char * xstrndup(const char *s, int n) | 70 | char * xstrndup(const char *s, int n) |
@@ -88,9 +78,7 @@ char * xstrndup(const char *s, int n) | |||
88 | 78 | ||
89 | return safe_strncpy(t,s,n); | 79 | return safe_strncpy(t,s,n); |
90 | } | 80 | } |
91 | #endif | ||
92 | 81 | ||
93 | #ifdef L_xfopen | ||
94 | // Die if we can't open a file and return a FILE * to it. | 82 | // Die if we can't open a file and return a FILE * to it. |
95 | // Notice we haven't got xfread(), This is for use with fscanf() and friends. | 83 | // Notice we haven't got xfread(), This is for use with fscanf() and friends. |
96 | FILE *xfopen(const char *path, const char *mode) | 84 | FILE *xfopen(const char *path, const char *mode) |
@@ -100,9 +88,7 @@ FILE *xfopen(const char *path, const char *mode) | |||
100 | bb_perror_msg_and_die("%s", path); | 88 | bb_perror_msg_and_die("%s", path); |
101 | return fp; | 89 | return fp; |
102 | } | 90 | } |
103 | #endif | ||
104 | 91 | ||
105 | #ifdef L_xopen | ||
106 | // Die if we can't open an existing file and return an fd. | 92 | // Die if we can't open an existing file and return an fd. |
107 | int xopen(const char *pathname, int flags) | 93 | int xopen(const char *pathname, int flags) |
108 | { | 94 | { |
@@ -111,9 +97,7 @@ int xopen(const char *pathname, int flags) | |||
111 | 97 | ||
112 | return xopen3(pathname, flags, 0777); | 98 | return xopen3(pathname, flags, 0777); |
113 | } | 99 | } |
114 | #endif | ||
115 | 100 | ||
116 | #ifdef L_xopen3 | ||
117 | // Die if we can't open a new file and return an fd. | 101 | // Die if we can't open a new file and return an fd. |
118 | int xopen3(const char *pathname, int flags, int mode) | 102 | int xopen3(const char *pathname, int flags, int mode) |
119 | { | 103 | { |
@@ -125,9 +109,7 @@ int xopen3(const char *pathname, int flags, int mode) | |||
125 | } | 109 | } |
126 | return ret; | 110 | return ret; |
127 | } | 111 | } |
128 | #endif | ||
129 | 112 | ||
130 | #ifdef L_xread | ||
131 | // Die with an error message if we can't read the entire buffer. | 113 | // Die with an error message if we can't read the entire buffer. |
132 | void xread(int fd, void *buf, size_t count) | 114 | void xread(int fd, void *buf, size_t count) |
133 | { | 115 | { |
@@ -140,9 +122,7 @@ void xread(int fd, void *buf, size_t count) | |||
140 | buf = ((char *) buf) + size; | 122 | buf = ((char *) buf) + size; |
141 | } | 123 | } |
142 | } | 124 | } |
143 | #endif | ||
144 | 125 | ||
145 | #ifdef L_xwrite | ||
146 | // Die with an error message if we can't write the entire buffer. | 126 | // Die with an error message if we can't write the entire buffer. |
147 | void xwrite(int fd, void *buf, size_t count) | 127 | void xwrite(int fd, void *buf, size_t count) |
148 | { | 128 | { |
@@ -155,17 +135,13 @@ void xwrite(int fd, void *buf, size_t count) | |||
155 | buf = ((char *) buf) + size; | 135 | buf = ((char *) buf) + size; |
156 | } | 136 | } |
157 | } | 137 | } |
158 | #endif | ||
159 | 138 | ||
160 | #ifdef L_xlseek | ||
161 | // Die with an error message if we can't lseek to the right spot. | 139 | // Die with an error message if we can't lseek to the right spot. |
162 | void xlseek(int fd, off_t offset, int whence) | 140 | void xlseek(int fd, off_t offset, int whence) |
163 | { | 141 | { |
164 | if (offset != lseek(fd, offset, whence)) bb_error_msg_and_die("lseek"); | 142 | if (offset != lseek(fd, offset, whence)) bb_error_msg_and_die("lseek"); |
165 | } | 143 | } |
166 | #endif | ||
167 | 144 | ||
168 | #ifdef L_xread_char | ||
169 | // Die with an error message if we can't read one character. | 145 | // Die with an error message if we can't read one character. |
170 | unsigned char xread_char(int fd) | 146 | unsigned char xread_char(int fd) |
171 | { | 147 | { |
@@ -175,9 +151,7 @@ unsigned char xread_char(int fd) | |||
175 | 151 | ||
176 | return(tmp); | 152 | return(tmp); |
177 | } | 153 | } |
178 | #endif | ||
179 | 154 | ||
180 | #ifdef L_xferror | ||
181 | // Die with supplied error message if this FILE * has ferror set. | 155 | // Die with supplied error message if this FILE * has ferror set. |
182 | void xferror(FILE *fp, const char *fn) | 156 | void xferror(FILE *fp, const char *fn) |
183 | { | 157 | { |
@@ -185,17 +159,13 @@ void xferror(FILE *fp, const char *fn) | |||
185 | bb_error_msg_and_die("%s", fn); | 159 | bb_error_msg_and_die("%s", fn); |
186 | } | 160 | } |
187 | } | 161 | } |
188 | #endif | ||
189 | 162 | ||
190 | #ifdef L_xferror_stdout | ||
191 | // Die with an error message if stdout has ferror set. | 163 | // Die with an error message if stdout has ferror set. |
192 | void xferror_stdout(void) | 164 | void xferror_stdout(void) |
193 | { | 165 | { |
194 | xferror(stdout, bb_msg_standard_output); | 166 | xferror(stdout, bb_msg_standard_output); |
195 | } | 167 | } |
196 | #endif | ||
197 | 168 | ||
198 | #ifdef L_xfflush_stdout | ||
199 | // Die with an error message if we have trouble flushing stdout. | 169 | // Die with an error message if we have trouble flushing stdout. |
200 | void xfflush_stdout(void) | 170 | void xfflush_stdout(void) |
201 | { | 171 | { |
@@ -203,9 +173,7 @@ void xfflush_stdout(void) | |||
203 | bb_perror_msg_and_die(bb_msg_standard_output); | 173 | bb_perror_msg_and_die(bb_msg_standard_output); |
204 | } | 174 | } |
205 | } | 175 | } |
206 | #endif | ||
207 | 176 | ||
208 | #ifdef L_spawn | ||
209 | // This does a fork/exec in one call, using vfork(). Return PID of new child, | 177 | // This does a fork/exec in one call, using vfork(). Return PID of new child, |
210 | // -1 for failure. Runs argv[0], searching path if that has no / in it. | 178 | // -1 for failure. Runs argv[0], searching path if that has no / in it. |
211 | pid_t spawn(char **argv) | 179 | pid_t spawn(char **argv) |
@@ -230,9 +198,7 @@ pid_t spawn(char **argv) | |||
230 | } | 198 | } |
231 | return failed ? failed : pid; | 199 | return failed ? failed : pid; |
232 | } | 200 | } |
233 | #endif | ||
234 | 201 | ||
235 | #ifdef L_xspawn | ||
236 | // Die with an error message if we can't spawn a child process. | 202 | // Die with an error message if we can't spawn a child process. |
237 | pid_t xspawn(char **argv) | 203 | pid_t xspawn(char **argv) |
238 | { | 204 | { |
@@ -240,9 +206,7 @@ pid_t xspawn(char **argv) | |||
240 | if (pid < 0) bb_perror_msg_and_die("%s", *argv); | 206 | if (pid < 0) bb_perror_msg_and_die("%s", *argv); |
241 | return pid; | 207 | return pid; |
242 | } | 208 | } |
243 | #endif | ||
244 | 209 | ||
245 | #ifdef L_wait4 | ||
246 | // Wait for the specified child PID to exit, returning child's error return. | 210 | // Wait for the specified child PID to exit, returning child's error return. |
247 | int wait4pid(int pid) | 211 | int wait4pid(int pid) |
248 | { | 212 | { |
@@ -253,17 +217,13 @@ int wait4pid(int pid) | |||
253 | if (WIFSIGNALED(status)) return WTERMSIG(status); | 217 | if (WIFSIGNALED(status)) return WTERMSIG(status); |
254 | return 0; | 218 | return 0; |
255 | } | 219 | } |
256 | #endif | ||
257 | 220 | ||
258 | #ifdef L_xsetenv | ||
259 | void xsetenv(const char *key, const char *value) | 221 | void xsetenv(const char *key, const char *value) |
260 | { | 222 | { |
261 | if(setenv(key, value, 1)) | 223 | if(setenv(key, value, 1)) |
262 | bb_error_msg_and_die(bb_msg_memory_exhausted); | 224 | bb_error_msg_and_die(bb_msg_memory_exhausted); |
263 | } | 225 | } |
264 | #endif | ||
265 | 226 | ||
266 | #ifdef L_itoa | ||
267 | // Convert unsigned integer to ascii, writing into supplied buffer. A | 227 | // Convert unsigned integer to ascii, writing into supplied buffer. A |
268 | // truncated result is always null terminated (unless buflen is 0), and | 228 | // truncated result is always null terminated (unless buflen is 0), and |
269 | // contains the first few digits of the result ala strncpy. | 229 | // contains the first few digits of the result ala strncpy. |
@@ -319,9 +279,7 @@ char *itoa(int n) | |||
319 | 279 | ||
320 | return local_buf; | 280 | return local_buf; |
321 | } | 281 | } |
322 | #endif | ||
323 | 282 | ||
324 | #ifdef L_setuid | ||
325 | // Die with an error message if we can't set gid. (Because resource limits may | 283 | // Die with an error message if we can't set gid. (Because resource limits may |
326 | // limit this user to a given number of processes, and if that fills up the | 284 | // limit this user to a given number of processes, and if that fills up the |
327 | // setgid() will fail and we'll _still_be_root_, which is bad.) | 285 | // setgid() will fail and we'll _still_be_root_, which is bad.) |
@@ -335,9 +293,7 @@ void xsetuid(uid_t uid) | |||
335 | { | 293 | { |
336 | if (setuid(uid)) bb_error_msg_and_die("setuid"); | 294 | if (setuid(uid)) bb_error_msg_and_die("setuid"); |
337 | } | 295 | } |
338 | #endif | ||
339 | 296 | ||
340 | #ifdef L_fdlength | ||
341 | // Return how long the file at fd is, if there's any way to determine it. | 297 | // Return how long the file at fd is, if there's any way to determine it. |
342 | off_t fdlength(int fd) | 298 | off_t fdlength(int fd) |
343 | { | 299 | { |
@@ -375,9 +331,7 @@ off_t fdlength(int fd) | |||
375 | 331 | ||
376 | return pos + 1; | 332 | return pos + 1; |
377 | } | 333 | } |
378 | #endif | ||
379 | 334 | ||
380 | #ifdef L_xasprintf | ||
381 | // Die with an error message if we can't malloc() enough space and do an | 335 | // Die with an error message if we can't malloc() enough space and do an |
382 | // sprintf() into that space. | 336 | // sprintf() into that space. |
383 | char *xasprintf(const char *format, ...) | 337 | char *xasprintf(const char *format, ...) |
@@ -405,9 +359,7 @@ char *xasprintf(const char *format, ...) | |||
405 | if (r < 0) bb_error_msg_and_die(bb_msg_memory_exhausted); | 359 | if (r < 0) bb_error_msg_and_die(bb_msg_memory_exhausted); |
406 | return string_ptr; | 360 | return string_ptr; |
407 | } | 361 | } |
408 | #endif | ||
409 | 362 | ||
410 | #ifdef L_xprint_and_close_file | ||
411 | // Die with an error message if we can't copy an entire FILE * to stdout, then | 363 | // Die with an error message if we can't copy an entire FILE * to stdout, then |
412 | // close that file. | 364 | // close that file. |
413 | void xprint_and_close_file(FILE *file) | 365 | void xprint_and_close_file(FILE *file) |
@@ -418,18 +370,14 @@ void xprint_and_close_file(FILE *file) | |||
418 | 370 | ||
419 | fclose(file); | 371 | fclose(file); |
420 | } | 372 | } |
421 | #endif | ||
422 | 373 | ||
423 | #ifdef L_xchdir | ||
424 | // Die if we can't chdir to a new path. | 374 | // Die if we can't chdir to a new path. |
425 | void xchdir(const char *path) | 375 | void xchdir(const char *path) |
426 | { | 376 | { |
427 | if (chdir(path)) | 377 | if (chdir(path)) |
428 | bb_perror_msg_and_die("chdir(%s)", path); | 378 | bb_perror_msg_and_die("chdir(%s)", path); |
429 | } | 379 | } |
430 | #endif | ||
431 | 380 | ||
432 | #ifdef L_warn_opendir | ||
433 | // Print a warning message if opendir() fails, but don't die. | 381 | // Print a warning message if opendir() fails, but don't die. |
434 | DIR *warn_opendir(const char *path) | 382 | DIR *warn_opendir(const char *path) |
435 | { | 383 | { |
@@ -441,9 +389,7 @@ DIR *warn_opendir(const char *path) | |||
441 | } | 389 | } |
442 | return dp; | 390 | return dp; |
443 | } | 391 | } |
444 | #endif | ||
445 | 392 | ||
446 | #ifdef L_xopendir | ||
447 | // Die with an error message if opendir() fails. | 393 | // Die with an error message if opendir() fails. |
448 | DIR *xopendir(const char *path) | 394 | DIR *xopendir(const char *path) |
449 | { | 395 | { |
@@ -453,9 +399,7 @@ DIR *xopendir(const char *path) | |||
453 | bb_perror_msg_and_die("unable to open `%s'", path); | 399 | bb_perror_msg_and_die("unable to open `%s'", path); |
454 | return dp; | 400 | return dp; |
455 | } | 401 | } |
456 | #endif | ||
457 | 402 | ||
458 | #ifdef L_xdaemon | ||
459 | #ifndef BB_NOMMU | 403 | #ifndef BB_NOMMU |
460 | // Die with an error message if we can't daemonize. | 404 | // Die with an error message if we can't daemonize. |
461 | void xdaemon(int nochdir, int noclose) | 405 | void xdaemon(int nochdir, int noclose) |
@@ -463,9 +407,7 @@ void xdaemon(int nochdir, int noclose) | |||
463 | if (daemon(nochdir, noclose)) bb_perror_msg_and_die("daemon"); | 407 | if (daemon(nochdir, noclose)) bb_perror_msg_and_die("daemon"); |
464 | } | 408 | } |
465 | #endif | 409 | #endif |
466 | #endif | ||
467 | 410 | ||
468 | #ifdef L_xsocket | ||
469 | // Die with an error message if we can't open a new socket. | 411 | // Die with an error message if we can't open a new socket. |
470 | int xsocket(int domain, int type, int protocol) | 412 | int xsocket(int domain, int type, int protocol) |
471 | { | 413 | { |
@@ -475,34 +417,26 @@ int xsocket(int domain, int type, int protocol) | |||
475 | 417 | ||
476 | return r; | 418 | return r; |
477 | } | 419 | } |
478 | #endif | ||
479 | 420 | ||
480 | #ifdef L_xbind | ||
481 | // Die with an error message if we can't bind a socket to an address. | 421 | // Die with an error message if we can't bind a socket to an address. |
482 | void xbind(int sockfd, struct sockaddr *my_addr, socklen_t addrlen) | 422 | void xbind(int sockfd, struct sockaddr *my_addr, socklen_t addrlen) |
483 | { | 423 | { |
484 | if (bind(sockfd, my_addr, addrlen)) bb_perror_msg_and_die("bind"); | 424 | if (bind(sockfd, my_addr, addrlen)) bb_perror_msg_and_die("bind"); |
485 | } | 425 | } |
486 | #endif | ||
487 | 426 | ||
488 | #ifdef L_xlisten | ||
489 | // Die with an error message if we can't listen for connections on a socket. | 427 | // Die with an error message if we can't listen for connections on a socket. |
490 | void xlisten(int s, int backlog) | 428 | void xlisten(int s, int backlog) |
491 | { | 429 | { |
492 | if (listen(s, backlog)) bb_perror_msg_and_die("listen"); | 430 | if (listen(s, backlog)) bb_perror_msg_and_die("listen"); |
493 | } | 431 | } |
494 | #endif | ||
495 | 432 | ||
496 | #ifdef L_xstat | ||
497 | // xstat() - a stat() which dies on failure with meaningful error message | 433 | // xstat() - a stat() which dies on failure with meaningful error message |
498 | void xstat(char *name, struct stat *stat_buf) | 434 | void xstat(char *name, struct stat *stat_buf) |
499 | { | 435 | { |
500 | if (stat(name, stat_buf)) | 436 | if (stat(name, stat_buf)) |
501 | bb_perror_msg_and_die("can't stat '%s'", name); | 437 | bb_perror_msg_and_die("can't stat '%s'", name); |
502 | } | 438 | } |
503 | #endif | ||
504 | 439 | ||
505 | #ifdef L_get_terminal_width_height | ||
506 | /* It is perfectly ok to pass in a NULL for either width or for | 440 | /* It is perfectly ok to pass in a NULL for either width or for |
507 | * * height, in which case that value will not be set. */ | 441 | * * height, in which case that value will not be set. */ |
508 | int get_terminal_width_height(int fd, int *width, int *height) | 442 | int get_terminal_width_height(int fd, int *width, int *height) |
@@ -524,4 +458,3 @@ int get_terminal_width_height(int fd, int *width, int *height) | |||
524 | 458 | ||
525 | return ret; | 459 | return ret; |
526 | } | 460 | } |
527 | #endif | ||
diff --git a/libbb/xgetularg.c b/libbb/xgetularg.c index 21b0d12f7..17ba581f7 100644 --- a/libbb/xgetularg.c +++ b/libbb/xgetularg.c | |||
@@ -15,7 +15,6 @@ | |||
15 | #include <assert.h> | 15 | #include <assert.h> |
16 | #include "libbb.h" | 16 | #include "libbb.h" |
17 | 17 | ||
18 | #ifdef L_xgetularg_bnd_sfx | ||
19 | unsigned long bb_xgetularg_bnd_sfx(const char *arg, int base, | 18 | unsigned long bb_xgetularg_bnd_sfx(const char *arg, int base, |
20 | unsigned long lower, | 19 | unsigned long lower, |
21 | unsigned long upper, | 20 | unsigned long upper, |
@@ -75,9 +74,7 @@ unsigned long bb_xgetularg_bnd_sfx(const char *arg, int base, | |||
75 | 74 | ||
76 | return r; | 75 | return r; |
77 | } | 76 | } |
78 | #endif | ||
79 | 77 | ||
80 | #ifdef L_xgetlarg_bnd_sfx | ||
81 | long bb_xgetlarg_bnd_sfx(const char *arg, int base, | 78 | long bb_xgetlarg_bnd_sfx(const char *arg, int base, |
82 | long lower, | 79 | long lower, |
83 | long upper, | 80 | long upper, |
@@ -104,36 +101,27 @@ long bb_xgetlarg_bnd_sfx(const char *arg, int base, | |||
104 | 101 | ||
105 | return r; | 102 | return r; |
106 | } | 103 | } |
107 | #endif | ||
108 | 104 | ||
109 | #ifdef L_getlarg10_sfx | ||
110 | long bb_xgetlarg10_sfx(const char *arg, const struct suffix_mult *suffixes) | 105 | long bb_xgetlarg10_sfx(const char *arg, const struct suffix_mult *suffixes) |
111 | { | 106 | { |
112 | return bb_xgetlarg_bnd_sfx(arg, 10, LONG_MIN, LONG_MAX, suffixes); | 107 | return bb_xgetlarg_bnd_sfx(arg, 10, LONG_MIN, LONG_MAX, suffixes); |
113 | } | 108 | } |
114 | #endif | ||
115 | 109 | ||
116 | #ifdef L_xgetularg_bnd | ||
117 | unsigned long bb_xgetularg_bnd(const char *arg, int base, | 110 | unsigned long bb_xgetularg_bnd(const char *arg, int base, |
118 | unsigned long lower, | 111 | unsigned long lower, |
119 | unsigned long upper) | 112 | unsigned long upper) |
120 | { | 113 | { |
121 | return bb_xgetularg_bnd_sfx(arg, base, lower, upper, NULL); | 114 | return bb_xgetularg_bnd_sfx(arg, base, lower, upper, NULL); |
122 | } | 115 | } |
123 | #endif | ||
124 | 116 | ||
125 | #ifdef L_xgetularg10_bnd | ||
126 | unsigned long bb_xgetularg10_bnd(const char *arg, | 117 | unsigned long bb_xgetularg10_bnd(const char *arg, |
127 | unsigned long lower, | 118 | unsigned long lower, |
128 | unsigned long upper) | 119 | unsigned long upper) |
129 | { | 120 | { |
130 | return bb_xgetularg_bnd(arg, 10, lower, upper); | 121 | return bb_xgetularg_bnd(arg, 10, lower, upper); |
131 | } | 122 | } |
132 | #endif | ||
133 | 123 | ||
134 | #ifdef L_xgetularg10 | ||
135 | unsigned long bb_xgetularg10(const char *arg) | 124 | unsigned long bb_xgetularg10(const char *arg) |
136 | { | 125 | { |
137 | return bb_xgetularg10_bnd(arg, 0, ULONG_MAX); | 126 | return bb_xgetularg10_bnd(arg, 0, ULONG_MAX); |
138 | } | 127 | } |
139 | #endif | ||
diff --git a/libpwdgrp/Kbuild b/libpwdgrp/Kbuild new file mode 100644 index 000000000..36a6ce393 --- /dev/null +++ b/libpwdgrp/Kbuild | |||
@@ -0,0 +1,7 @@ | |||
1 | # Makefile for busybox | ||
2 | # | ||
3 | # Copyright (C) 1999-2005 by Erik Andersen <andersen@codepoet.org> | ||
4 | # | ||
5 | # Licensed under the GPL v2, see the file LICENSE in this tarball. | ||
6 | |||
7 | lib-y:=pwd_grp.o | ||
diff --git a/libpwdgrp/Makefile b/libpwdgrp/Makefile deleted file mode 100644 index 630a7688f..000000000 --- a/libpwdgrp/Makefile +++ /dev/null | |||
@@ -1,23 +0,0 @@ | |||
1 | # Makefile for busybox | ||
2 | # | ||
3 | # Copyright (C) 1999-2005 by Erik Andersen <andersen@codepoet.org> | ||
4 | # | ||
5 | # Licensed under the GPL v2, see the file LICENSE in this tarball. | ||
6 | |||
7 | ifndef top_srcdir | ||
8 | top_srcdir=.. | ||
9 | endif | ||
10 | ifndef top_builddir | ||
11 | top_builddir=.. | ||
12 | endif | ||
13 | srcdir=$(top_srcdir)/libpwgrp | ||
14 | LIBPWDGRP_DIR:=./ | ||
15 | include $(top_srcdir)/Rules.mak | ||
16 | include $(top_builddir)/.config | ||
17 | include Makefile.in | ||
18 | all: $(libraries-y) | ||
19 | -include $(top_builddir)/.depend | ||
20 | |||
21 | clean: | ||
22 | rm -f *.o *.a $(AR_TARGET) | ||
23 | |||
diff --git a/libpwdgrp/Makefile.in b/libpwdgrp/Makefile.in deleted file mode 100644 index 2511d34ef..000000000 --- a/libpwdgrp/Makefile.in +++ /dev/null | |||
@@ -1,51 +0,0 @@ | |||
1 | # Makefile for busybox | ||
2 | # | ||
3 | # Copyright (C) 1999-2005 by Erik Andersen <andersen@codepoet.org> | ||
4 | # | ||
5 | # Licensed under the GPL v2, see the file LICENSE in this tarball. | ||
6 | |||
7 | LIBPWDGRP_AR:=libpwdgrp.a | ||
8 | ifndef $(LIBPWDGRP_DIR) | ||
9 | LIBPWDGRP_DIR:=$(top_builddir)/libpwdgrp | ||
10 | endif | ||
11 | srcdir=$(top_srcdir)/libpwdgrp | ||
12 | |||
13 | LIBPWDGRP-obj:=$(LIBPWDGRP_DIR)/$(LIBPWDGRP_AR) | ||
14 | |||
15 | libraries-y+=$(LIBPWDGRP_DIR)/$(LIBPWDGRP_AR) | ||
16 | |||
17 | LIBPWDGRP_MSRC0:=$(srcdir)/pwd_grp.c | ||
18 | LIBPWDGRP_MOBJ0-$(CONFIG_USE_BB_PWD_GRP):= fgetpwent_r.o fgetgrent_r.o \ | ||
19 | fgetpwent.o fgetgrent.o getpwnam_r.o getgrnam_r.o getpwuid_r.o \ | ||
20 | getgrgid_r.o getpwuid.o getgrgid.o getpwnam.o getgrnam.o getpw.o \ | ||
21 | getpwent_r.o getgrent_r.o getpwent.o getgrent.o \ | ||
22 | initgroups.o putpwent.o putgrent.o | ||
23 | LIBPWDGRP_MOBJS0=$(patsubst %,$(LIBPWDGRP_DIR)/%, $(LIBPWDGRP_MOBJ0-y)) | ||
24 | |||
25 | LIBPWDGRP_MSRC1:=$(srcdir)/pwd_grp.c | ||
26 | LIBPWDGRP_MOBJ1-$(CONFIG_USE_BB_PWD_GRP):= __parsepwent.o __parsegrent.o \ | ||
27 | __pgsreader.o fgetspent_r.o fgetspent.o sgetspent_r.o getspnam_r.o \ | ||
28 | getspnam.o getspent_r.o getspent.o sgetspent.o \ | ||
29 | putspent.o __parsespent.o # getspuid_r.o getspuid.o | ||
30 | LIBPWDGRP_MOBJS1=$(patsubst %,$(LIBPWDGRP_DIR)/%, $(LIBPWDGRP_MOBJ1-y)) | ||
31 | |||
32 | LIBPWDGRP_DEFINE0-y:=$(patsubst %,-DL_%,$(subst .o,,$(notdir $(LIBPWDGRP_MOBJS0)))) | ||
33 | LIBPWDGRP_DEFINE1-y:=$(patsubst %,-DL_%,$(subst .o,,$(notdir $(LIBPWDGRP_MOBJS1)))) | ||
34 | |||
35 | LIBPWDGRP_SRC-y:=$(LIBPWDGRP_MSRC0) | ||
36 | |||
37 | LIBRARY_SRC-y+=$(LIBPWDGRP_SRC-y) | ||
38 | LIBRARY_SRC-a+=$(LIBPWDGRP_SRC-y) | ||
39 | |||
40 | LIBRARY_DEFINE-y+=$(LIBPWDGRP_DEFINE0-y) $(LIBPWDGRP_DEFINE1-y) | ||
41 | LIBRARY_DEFINE-a+=$(LIBPWDGRP_DEFINE0-y) $(LIBPWDGRP_DEFINE1-y) | ||
42 | |||
43 | |||
44 | $(LIBPWDGRP_DIR)/$(LIBPWDGRP_AR): $(LIBPWDGRP_MOBJS0) $(LIBPWDGRP_MOBJS1) | ||
45 | $(do_ar) | ||
46 | |||
47 | $(LIBPWDGRP_MOBJS0): $(LIBPWDGRP_MSRC0) | ||
48 | $(compile.c) -DL_$(notdir $*) | ||
49 | |||
50 | $(LIBPWDGRP_MOBJS1): $(LIBPWDGRP_MSRC1) | ||
51 | $(compile.c) -DL_$(notdir $*) | ||
diff --git a/libpwdgrp/pwd_grp.c b/libpwdgrp/pwd_grp.c index 132ec60be..ac65d4c5b 100644 --- a/libpwdgrp/pwd_grp.c +++ b/libpwdgrp/pwd_grp.c | |||
@@ -29,8 +29,6 @@ | |||
29 | #include <assert.h> | 29 | #include <assert.h> |
30 | #include <ctype.h> | 30 | #include <ctype.h> |
31 | 31 | ||
32 | #include "shadow_.h" | ||
33 | |||
34 | #ifndef _PATH_SHADOW | 32 | #ifndef _PATH_SHADOW |
35 | #define _PATH_SHADOW "/etc/shadow" | 33 | #define _PATH_SHADOW "/etc/shadow" |
36 | #endif | 34 | #endif |
@@ -57,7 +55,7 @@ extern int __parsegrent(void *gr, char *line); | |||
57 | extern int __parsespent(void *sp, char *line); | 55 | extern int __parsespent(void *sp, char *line); |
58 | 56 | ||
59 | extern int __pgsreader(int (*__parserfunc)(void *d, char *line), void *data, | 57 | extern int __pgsreader(int (*__parserfunc)(void *d, char *line), void *data, |
60 | char *__restrict line_buff, size_t buflen, FILE *f); | 58 | char *__restrict line_buff, size_t buflen, FILE *f); |
61 | 59 | ||
62 | /**********************************************************************/ | 60 | /**********************************************************************/ |
63 | /* For the various fget??ent_r funcs, return | 61 | /* For the various fget??ent_r funcs, return |
@@ -75,8 +73,6 @@ extern int __pgsreader(int (*__parserfunc)(void *d, char *line), void *data, | |||
75 | */ | 73 | */ |
76 | /**********************************************************************/ | 74 | /**********************************************************************/ |
77 | 75 | ||
78 | #ifdef L_fgetpwent_r | ||
79 | |||
80 | int fgetpwent_r(FILE *__restrict stream, struct passwd *__restrict resultbuf, | 76 | int fgetpwent_r(FILE *__restrict stream, struct passwd *__restrict resultbuf, |
81 | char *__restrict buffer, size_t buflen, | 77 | char *__restrict buffer, size_t buflen, |
82 | struct passwd **__restrict result) | 78 | struct passwd **__restrict result) |
@@ -92,10 +88,6 @@ int fgetpwent_r(FILE *__restrict stream, struct passwd *__restrict resultbuf, | |||
92 | return rv; | 88 | return rv; |
93 | } | 89 | } |
94 | 90 | ||
95 | #endif | ||
96 | /**********************************************************************/ | ||
97 | #ifdef L_fgetgrent_r | ||
98 | |||
99 | int fgetgrent_r(FILE *__restrict stream, struct group *__restrict resultbuf, | 91 | int fgetgrent_r(FILE *__restrict stream, struct group *__restrict resultbuf, |
100 | char *__restrict buffer, size_t buflen, | 92 | char *__restrict buffer, size_t buflen, |
101 | struct group **__restrict result) | 93 | struct group **__restrict result) |
@@ -111,10 +103,6 @@ int fgetgrent_r(FILE *__restrict stream, struct group *__restrict resultbuf, | |||
111 | return rv; | 103 | return rv; |
112 | } | 104 | } |
113 | 105 | ||
114 | #endif | ||
115 | /**********************************************************************/ | ||
116 | #ifdef L_fgetspent_r | ||
117 | |||
118 | int fgetspent_r(FILE *__restrict stream, struct spwd *__restrict resultbuf, | 106 | int fgetspent_r(FILE *__restrict stream, struct spwd *__restrict resultbuf, |
119 | char *__restrict buffer, size_t buflen, | 107 | char *__restrict buffer, size_t buflen, |
120 | struct spwd **__restrict result) | 108 | struct spwd **__restrict result) |
@@ -130,13 +118,11 @@ int fgetspent_r(FILE *__restrict stream, struct spwd *__restrict resultbuf, | |||
130 | return rv; | 118 | return rv; |
131 | } | 119 | } |
132 | 120 | ||
133 | #endif | ||
134 | /**********************************************************************/ | 121 | /**********************************************************************/ |
135 | /* For the various fget??ent funcs, return NULL on failure and a | 122 | /* For the various fget??ent funcs, return NULL on failure and a |
136 | * pointer to the appropriate struct (statically allocated) on success. | 123 | * pointer to the appropriate struct (statically allocated) on success. |
137 | */ | 124 | */ |
138 | /**********************************************************************/ | 125 | /**********************************************************************/ |
139 | #ifdef L_fgetpwent | ||
140 | 126 | ||
141 | struct passwd *fgetpwent(FILE *stream) | 127 | struct passwd *fgetpwent(FILE *stream) |
142 | { | 128 | { |
@@ -148,10 +134,6 @@ struct passwd *fgetpwent(FILE *stream) | |||
148 | return result; | 134 | return result; |
149 | } | 135 | } |
150 | 136 | ||
151 | #endif | ||
152 | /**********************************************************************/ | ||
153 | #ifdef L_fgetgrent | ||
154 | |||
155 | struct group *fgetgrent(FILE *stream) | 137 | struct group *fgetgrent(FILE *stream) |
156 | { | 138 | { |
157 | static char buffer[GRP_BUFFER_SIZE]; | 139 | static char buffer[GRP_BUFFER_SIZE]; |
@@ -162,10 +144,6 @@ struct group *fgetgrent(FILE *stream) | |||
162 | return result; | 144 | return result; |
163 | } | 145 | } |
164 | 146 | ||
165 | #endif | ||
166 | /**********************************************************************/ | ||
167 | #ifdef L_fgetspent | ||
168 | |||
169 | extern int fgetspent_r(FILE *__restrict stream, struct spwd *__restrict resultbuf, | 147 | extern int fgetspent_r(FILE *__restrict stream, struct spwd *__restrict resultbuf, |
170 | char *__restrict buffer, size_t buflen, | 148 | char *__restrict buffer, size_t buflen, |
171 | struct spwd **__restrict result); | 149 | struct spwd **__restrict result); |
@@ -179,10 +157,6 @@ struct spwd *fgetspent(FILE *stream) | |||
179 | return result; | 157 | return result; |
180 | } | 158 | } |
181 | 159 | ||
182 | #endif | ||
183 | /**********************************************************************/ | ||
184 | #ifdef L_sgetspent_r | ||
185 | |||
186 | int sgetspent_r(const char *string, struct spwd *result_buf, | 160 | int sgetspent_r(const char *string, struct spwd *result_buf, |
187 | char *buffer, size_t buflen, struct spwd **result) | 161 | char *buffer, size_t buflen, struct spwd **result) |
188 | { | 162 | { |
@@ -211,65 +185,53 @@ int sgetspent_r(const char *string, struct spwd *result_buf, | |||
211 | return rv; | 185 | return rv; |
212 | } | 186 | } |
213 | 187 | ||
214 | #endif | ||
215 | /**********************************************************************/ | 188 | /**********************************************************************/ |
216 | 189 | ||
217 | #ifdef GETXXKEY_R_FUNC | 190 | #ifdef GETXXKEY_R_FUNC |
218 | #error GETXXKEY_R_FUNC is already defined! | 191 | #error GETXXKEY_R_FUNC is already defined! |
219 | #endif | 192 | #endif |
220 | 193 | ||
221 | #ifdef L_getpwnam_r | 194 | #define GETXXKEY_R_FUNC getpwnam_R |
222 | #define GETXXKEY_R_FUNC getpwnam_r | ||
223 | #define GETXXKEY_R_PARSER __parsepwent | 195 | #define GETXXKEY_R_PARSER __parsepwent |
224 | #define GETXXKEY_R_ENTTYPE struct passwd | 196 | #define GETXXKEY_R_ENTTYPE struct passwd |
225 | #define GETXXKEY_R_TEST(ENT) (!strcmp((ENT)->pw_name, key)) | 197 | #define GETXXKEY_R_TEST(ENT) (!strcmp((ENT)->pw_name, key)) |
226 | #define DO_GETXXKEY_R_KEYTYPE const char *__restrict | 198 | #define DO_GETXXKEY_R_KEYTYPE const char *__restrict |
227 | #define DO_GETXXKEY_R_PATHNAME _PATH_PASSWD | 199 | #define DO_GETXXKEY_R_PATHNAME _PATH_PASSWD |
228 | #include "pwd_grp_internal.c" | 200 | #include "pwd_grp_internal.c" |
229 | #endif | ||
230 | 201 | ||
231 | #ifdef L_getgrnam_r | 202 | #define GETXXKEY_R_FUNC getgrnam_R |
232 | #define GETXXKEY_R_FUNC getgrnam_r | ||
233 | #define GETXXKEY_R_PARSER __parsegrent | 203 | #define GETXXKEY_R_PARSER __parsegrent |
234 | #define GETXXKEY_R_ENTTYPE struct group | 204 | #define GETXXKEY_R_ENTTYPE struct group |
235 | #define GETXXKEY_R_TEST(ENT) (!strcmp((ENT)->gr_name, key)) | 205 | #define GETXXKEY_R_TEST(ENT) (!strcmp((ENT)->gr_name, key)) |
236 | #define DO_GETXXKEY_R_KEYTYPE const char *__restrict | 206 | #define DO_GETXXKEY_R_KEYTYPE const char *__restrict |
237 | #define DO_GETXXKEY_R_PATHNAME _PATH_GROUP | 207 | #define DO_GETXXKEY_R_PATHNAME _PATH_GROUP |
238 | #include "pwd_grp_internal.c" | 208 | #include "pwd_grp_internal.c" |
239 | #endif | ||
240 | 209 | ||
241 | #ifdef L_getspnam_r | 210 | #define GETXXKEY_R_FUNC getspnam_R |
242 | #define GETXXKEY_R_FUNC getspnam_r | ||
243 | #define GETXXKEY_R_PARSER __parsespent | 211 | #define GETXXKEY_R_PARSER __parsespent |
244 | #define GETXXKEY_R_ENTTYPE struct spwd | 212 | #define GETXXKEY_R_ENTTYPE struct spwd |
245 | #define GETXXKEY_R_TEST(ENT) (!strcmp((ENT)->sp_namp, key)) | 213 | #define GETXXKEY_R_TEST(ENT) (!strcmp((ENT)->sp_namp, key)) |
246 | #define DO_GETXXKEY_R_KEYTYPE const char *__restrict | 214 | #define DO_GETXXKEY_R_KEYTYPE const char *__restrict |
247 | #define DO_GETXXKEY_R_PATHNAME _PATH_SHADOW | 215 | #define DO_GETXXKEY_R_PATHNAME _PATH_SHADOW |
248 | #include "pwd_grp_internal.c" | 216 | #include "pwd_grp_internal.c" |
249 | #endif | ||
250 | 217 | ||
251 | #ifdef L_getpwuid_r | 218 | #define GETXXKEY_R_FUNC getpwuid_R |
252 | #define GETXXKEY_R_FUNC getpwuid_r | ||
253 | #define GETXXKEY_R_PARSER __parsepwent | 219 | #define GETXXKEY_R_PARSER __parsepwent |
254 | #define GETXXKEY_R_ENTTYPE struct passwd | 220 | #define GETXXKEY_R_ENTTYPE struct passwd |
255 | #define GETXXKEY_R_TEST(ENT) ((ENT)->pw_uid == key) | 221 | #define GETXXKEY_R_TEST(ENT) ((ENT)->pw_uid == key) |
256 | #define DO_GETXXKEY_R_KEYTYPE uid_t | 222 | #define DO_GETXXKEY_R_KEYTYPE uid_t |
257 | #define DO_GETXXKEY_R_PATHNAME _PATH_PASSWD | 223 | #define DO_GETXXKEY_R_PATHNAME _PATH_PASSWD |
258 | #include "pwd_grp_internal.c" | 224 | #include "pwd_grp_internal.c" |
259 | #endif | ||
260 | 225 | ||
261 | #ifdef L_getgrgid_r | 226 | #define GETXXKEY_R_FUNC getgrgid_R |
262 | #define GETXXKEY_R_FUNC getgrgid_r | ||
263 | #define GETXXKEY_R_PARSER __parsegrent | 227 | #define GETXXKEY_R_PARSER __parsegrent |
264 | #define GETXXKEY_R_ENTTYPE struct group | 228 | #define GETXXKEY_R_ENTTYPE struct group |
265 | #define GETXXKEY_R_TEST(ENT) ((ENT)->gr_gid == key) | 229 | #define GETXXKEY_R_TEST(ENT) ((ENT)->gr_gid == key) |
266 | #define DO_GETXXKEY_R_KEYTYPE gid_t | 230 | #define DO_GETXXKEY_R_KEYTYPE gid_t |
267 | #define DO_GETXXKEY_R_PATHNAME _PATH_GROUP | 231 | #define DO_GETXXKEY_R_PATHNAME _PATH_GROUP |
268 | #include "pwd_grp_internal.c" | 232 | #include "pwd_grp_internal.c" |
269 | #endif | ||
270 | 233 | ||
271 | /**********************************************************************/ | 234 | /**********************************************************************/ |
272 | #ifdef L_getpwuid | ||
273 | 235 | ||
274 | struct passwd *getpwuid(uid_t uid) | 236 | struct passwd *getpwuid(uid_t uid) |
275 | { | 237 | { |
@@ -281,10 +243,6 @@ struct passwd *getpwuid(uid_t uid) | |||
281 | return result; | 243 | return result; |
282 | } | 244 | } |
283 | 245 | ||
284 | #endif | ||
285 | /**********************************************************************/ | ||
286 | #ifdef L_getgrgid | ||
287 | |||
288 | struct group *getgrgid(gid_t gid) | 246 | struct group *getgrgid(gid_t gid) |
289 | { | 247 | { |
290 | static char buffer[GRP_BUFFER_SIZE]; | 248 | static char buffer[GRP_BUFFER_SIZE]; |
@@ -295,10 +253,6 @@ struct group *getgrgid(gid_t gid) | |||
295 | return result; | 253 | return result; |
296 | } | 254 | } |
297 | 255 | ||
298 | #endif | ||
299 | /**********************************************************************/ | ||
300 | #ifdef L_getspuid_r | ||
301 | |||
302 | /* This function is non-standard and is currently not built. It seems | 256 | /* This function is non-standard and is currently not built. It seems |
303 | * to have been created as a reentrant version of the non-standard | 257 | * to have been created as a reentrant version of the non-standard |
304 | * functions getspuid. Why getspuid was added, I do not know. */ | 258 | * functions getspuid. Why getspuid was added, I do not know. */ |
@@ -320,10 +274,6 @@ int getspuid_r(uid_t uid, struct spwd *__restrict resultbuf, | |||
320 | return rv; | 274 | return rv; |
321 | } | 275 | } |
322 | 276 | ||
323 | #endif | ||
324 | /**********************************************************************/ | ||
325 | #ifdef L_getspuid | ||
326 | |||
327 | /* This function is non-standard and is currently not built. | 277 | /* This function is non-standard and is currently not built. |
328 | * Why it was added, I do not know. */ | 278 | * Why it was added, I do not know. */ |
329 | 279 | ||
@@ -337,10 +287,6 @@ struct spwd *getspuid(uid_t uid) | |||
337 | return result; | 287 | return result; |
338 | } | 288 | } |
339 | 289 | ||
340 | #endif | ||
341 | /**********************************************************************/ | ||
342 | #ifdef L_getpwnam | ||
343 | |||
344 | struct passwd *getpwnam(const char *name) | 290 | struct passwd *getpwnam(const char *name) |
345 | { | 291 | { |
346 | static char buffer[PWD_BUFFER_SIZE]; | 292 | static char buffer[PWD_BUFFER_SIZE]; |
@@ -351,10 +297,6 @@ struct passwd *getpwnam(const char *name) | |||
351 | return result; | 297 | return result; |
352 | } | 298 | } |
353 | 299 | ||
354 | #endif | ||
355 | /**********************************************************************/ | ||
356 | #ifdef L_getgrnam | ||
357 | |||
358 | struct group *getgrnam(const char *name) | 300 | struct group *getgrnam(const char *name) |
359 | { | 301 | { |
360 | static char buffer[GRP_BUFFER_SIZE]; | 302 | static char buffer[GRP_BUFFER_SIZE]; |
@@ -365,10 +307,6 @@ struct group *getgrnam(const char *name) | |||
365 | return result; | 307 | return result; |
366 | } | 308 | } |
367 | 309 | ||
368 | #endif | ||
369 | /**********************************************************************/ | ||
370 | #ifdef L_getspnam | ||
371 | |||
372 | struct spwd *getspnam(const char *name) | 310 | struct spwd *getspnam(const char *name) |
373 | { | 311 | { |
374 | static char buffer[PWD_BUFFER_SIZE]; | 312 | static char buffer[PWD_BUFFER_SIZE]; |
@@ -379,10 +317,6 @@ struct spwd *getspnam(const char *name) | |||
379 | return result; | 317 | return result; |
380 | } | 318 | } |
381 | 319 | ||
382 | #endif | ||
383 | /**********************************************************************/ | ||
384 | #ifdef L_getpw | ||
385 | |||
386 | int getpw(uid_t uid, char *buf) | 320 | int getpw(uid_t uid, char *buf) |
387 | { | 321 | { |
388 | struct passwd resultbuf; | 322 | struct passwd resultbuf; |
@@ -406,10 +340,8 @@ int getpw(uid_t uid, char *buf) | |||
406 | return -1; | 340 | return -1; |
407 | } | 341 | } |
408 | 342 | ||
409 | #endif | ||
410 | /**********************************************************************/ | 343 | /**********************************************************************/ |
411 | 344 | ||
412 | #if defined(L_getpwent_r) || defined(L_getgrent_r) || defined(L_getspent_r) | ||
413 | #if defined CONFIG_USE_BB_THREADSAFE_SHADOW && defined PTHREAD_MUTEX_INITIALIZER | 345 | #if defined CONFIG_USE_BB_THREADSAFE_SHADOW && defined PTHREAD_MUTEX_INITIALIZER |
414 | static pthread_mutex_t mylock = PTHREAD_MUTEX_INITIALIZER; | 346 | static pthread_mutex_t mylock = PTHREAD_MUTEX_INITIALIZER; |
415 | # define LOCK pthread_mutex_lock(&mylock) | 347 | # define LOCK pthread_mutex_lock(&mylock) |
@@ -418,9 +350,7 @@ static pthread_mutex_t mylock = PTHREAD_MUTEX_INITIALIZER; | |||
418 | # define LOCK ((void) 0) | 350 | # define LOCK ((void) 0) |
419 | # define UNLOCK ((void) 0) | 351 | # define UNLOCK ((void) 0) |
420 | #endif | 352 | #endif |
421 | #endif | ||
422 | 353 | ||
423 | #ifdef L_getpwent_r | ||
424 | static FILE *pwf /*= NULL*/; | 354 | static FILE *pwf /*= NULL*/; |
425 | void setpwent(void) | 355 | void setpwent(void) |
426 | { | 356 | { |
@@ -468,10 +398,6 @@ int getpwent_r(struct passwd *__restrict resultbuf, | |||
468 | return rv; | 398 | return rv; |
469 | } | 399 | } |
470 | 400 | ||
471 | #endif | ||
472 | /**********************************************************************/ | ||
473 | #ifdef L_getgrent_r | ||
474 | |||
475 | static FILE *grf /*= NULL*/; | 401 | static FILE *grf /*= NULL*/; |
476 | void setgrent(void) | 402 | void setgrent(void) |
477 | { | 403 | { |
@@ -518,10 +444,6 @@ int getgrent_r(struct group *__restrict resultbuf, | |||
518 | return rv; | 444 | return rv; |
519 | } | 445 | } |
520 | 446 | ||
521 | #endif | ||
522 | /**********************************************************************/ | ||
523 | #ifdef L_getspent_r | ||
524 | |||
525 | static FILE *spf /*= NULL*/; | 447 | static FILE *spf /*= NULL*/; |
526 | void setspent(void) | 448 | void setspent(void) |
527 | { | 449 | { |
@@ -567,10 +489,6 @@ int getspent_r(struct spwd *resultbuf, char *buffer, | |||
567 | return rv; | 489 | return rv; |
568 | } | 490 | } |
569 | 491 | ||
570 | #endif | ||
571 | /**********************************************************************/ | ||
572 | #ifdef L_getpwent | ||
573 | |||
574 | struct passwd *getpwent(void) | 492 | struct passwd *getpwent(void) |
575 | { | 493 | { |
576 | static char line_buff[PWD_BUFFER_SIZE]; | 494 | static char line_buff[PWD_BUFFER_SIZE]; |
@@ -581,10 +499,6 @@ struct passwd *getpwent(void) | |||
581 | return result; | 499 | return result; |
582 | } | 500 | } |
583 | 501 | ||
584 | #endif | ||
585 | /**********************************************************************/ | ||
586 | #ifdef L_getgrent | ||
587 | |||
588 | struct group *getgrent(void) | 502 | struct group *getgrent(void) |
589 | { | 503 | { |
590 | static char line_buff[GRP_BUFFER_SIZE]; | 504 | static char line_buff[GRP_BUFFER_SIZE]; |
@@ -595,10 +509,6 @@ struct group *getgrent(void) | |||
595 | return result; | 509 | return result; |
596 | } | 510 | } |
597 | 511 | ||
598 | #endif | ||
599 | /**********************************************************************/ | ||
600 | #ifdef L_getspent | ||
601 | |||
602 | struct spwd *getspent(void) | 512 | struct spwd *getspent(void) |
603 | { | 513 | { |
604 | static char line_buff[PWD_BUFFER_SIZE]; | 514 | static char line_buff[PWD_BUFFER_SIZE]; |
@@ -609,10 +519,6 @@ struct spwd *getspent(void) | |||
609 | return result; | 519 | return result; |
610 | } | 520 | } |
611 | 521 | ||
612 | #endif | ||
613 | /**********************************************************************/ | ||
614 | #ifdef L_sgetspent | ||
615 | |||
616 | struct spwd *sgetspent(const char *string) | 522 | struct spwd *sgetspent(const char *string) |
617 | { | 523 | { |
618 | static char line_buff[PWD_BUFFER_SIZE]; | 524 | static char line_buff[PWD_BUFFER_SIZE]; |
@@ -623,10 +529,6 @@ struct spwd *sgetspent(const char *string) | |||
623 | return result; | 529 | return result; |
624 | } | 530 | } |
625 | 531 | ||
626 | #endif | ||
627 | /**********************************************************************/ | ||
628 | #ifdef L_initgroups | ||
629 | |||
630 | int initgroups(const char *user, gid_t gid) | 532 | int initgroups(const char *user, gid_t gid) |
631 | { | 533 | { |
632 | FILE *grfile; | 534 | FILE *grfile; |
@@ -679,10 +581,6 @@ int initgroups(const char *user, gid_t gid) | |||
679 | return rv; | 581 | return rv; |
680 | } | 582 | } |
681 | 583 | ||
682 | #endif | ||
683 | /**********************************************************************/ | ||
684 | #ifdef L_putpwent | ||
685 | |||
686 | int putpwent(const struct passwd *__restrict p, FILE *__restrict f) | 584 | int putpwent(const struct passwd *__restrict p, FILE *__restrict f) |
687 | { | 585 | { |
688 | int rv = -1; | 586 | int rv = -1; |
@@ -704,10 +602,6 @@ int putpwent(const struct passwd *__restrict p, FILE *__restrict f) | |||
704 | return rv; | 602 | return rv; |
705 | } | 603 | } |
706 | 604 | ||
707 | #endif | ||
708 | /**********************************************************************/ | ||
709 | #ifdef L_putgrent | ||
710 | |||
711 | int putgrent(const struct group *__restrict p, FILE *__restrict f) | 605 | int putgrent(const struct group *__restrict p, FILE *__restrict f) |
712 | { | 606 | { |
713 | static const char format[] = ",%s"; | 607 | static const char format[] = ",%s"; |
@@ -749,10 +643,6 @@ int putgrent(const struct group *__restrict p, FILE *__restrict f) | |||
749 | return rv; | 643 | return rv; |
750 | } | 644 | } |
751 | 645 | ||
752 | #endif | ||
753 | /**********************************************************************/ | ||
754 | #ifdef L_putspent | ||
755 | |||
756 | static const unsigned char _sp_off[] = { | 646 | static const unsigned char _sp_off[] = { |
757 | offsetof(struct spwd, sp_lstchg), /* 2 - not a char ptr */ | 647 | offsetof(struct spwd, sp_lstchg), /* 2 - not a char ptr */ |
758 | offsetof(struct spwd, sp_min), /* 3 - not a char ptr */ | 648 | offsetof(struct spwd, sp_min), /* 3 - not a char ptr */ |
@@ -799,11 +689,9 @@ DO_UNLOCK: | |||
799 | return rv; | 689 | return rv; |
800 | } | 690 | } |
801 | 691 | ||
802 | #endif | ||
803 | /**********************************************************************/ | 692 | /**********************************************************************/ |
804 | /* Internal uClibc functions. */ | 693 | /* Internal uClibc functions. */ |
805 | /**********************************************************************/ | 694 | /**********************************************************************/ |
806 | #ifdef L___parsepwent | ||
807 | 695 | ||
808 | static const unsigned char pw_off[] = { | 696 | static const unsigned char pw_off[] = { |
809 | offsetof(struct passwd, pw_name), /* 0 */ | 697 | offsetof(struct passwd, pw_name), /* 0 */ |
@@ -860,9 +748,7 @@ int __parsepwent(void *data, char *line) | |||
860 | return -1; | 748 | return -1; |
861 | } | 749 | } |
862 | 750 | ||
863 | #endif | ||
864 | /**********************************************************************/ | 751 | /**********************************************************************/ |
865 | #ifdef L___parsegrent | ||
866 | 752 | ||
867 | static const unsigned char gr_off[] = { | 753 | static const unsigned char gr_off[] = { |
868 | offsetof(struct group, gr_name), /* 0 */ | 754 | offsetof(struct group, gr_name), /* 0 */ |
@@ -958,9 +844,7 @@ int __parsegrent(void *data, char *line) | |||
958 | return -1; | 844 | return -1; |
959 | } | 845 | } |
960 | 846 | ||
961 | #endif | ||
962 | /**********************************************************************/ | 847 | /**********************************************************************/ |
963 | #ifdef L___parsespent | ||
964 | 848 | ||
965 | static const unsigned char sp_off[] = { | 849 | static const unsigned char sp_off[] = { |
966 | offsetof(struct spwd, sp_namp), /* 0 */ | 850 | offsetof(struct spwd, sp_namp), /* 0 */ |
@@ -1017,9 +901,7 @@ int __parsespent(void *data, char * line) | |||
1017 | return EINVAL; | 901 | return EINVAL; |
1018 | } | 902 | } |
1019 | 903 | ||
1020 | #endif | ||
1021 | /**********************************************************************/ | 904 | /**********************************************************************/ |
1022 | #ifdef L___pgsreader | ||
1023 | 905 | ||
1024 | /* Reads until if EOF, or until if finds a line which fits in the buffer | 906 | /* Reads until if EOF, or until if finds a line which fits in the buffer |
1025 | * and for which the parser function succeeds. | 907 | * and for which the parser function succeeds. |
@@ -1084,5 +966,4 @@ int __pgsreader(int (*__parserfunc)(void *d, char *line), void *data, | |||
1084 | return rv; | 966 | return rv; |
1085 | } | 967 | } |
1086 | 968 | ||
1087 | #endif | ||
1088 | /**********************************************************************/ | 969 | /**********************************************************************/ |
diff --git a/libpwdgrp/pwd_grp_internal.c b/libpwdgrp/pwd_grp_internal.c index 39c11f677..866ed3699 100644 --- a/libpwdgrp/pwd_grp_internal.c +++ b/libpwdgrp/pwd_grp_internal.c | |||
@@ -18,96 +18,45 @@ | |||
18 | * | 18 | * |
19 | */ | 19 | */ |
20 | 20 | ||
21 | #include <features.h> | ||
22 | #include <stdio.h> | ||
23 | #include <stdlib.h> | ||
24 | #include <stdint.h> | ||
25 | #include <string.h> | ||
26 | #include <stddef.h> | ||
27 | #include <errno.h> | ||
28 | #include <assert.h> | ||
29 | #include <ctype.h> | ||
30 | |||
31 | #include "pwd_.h" | ||
32 | #include "grp_.h" | ||
33 | #include "shadow_.h" | ||
34 | #include "libbb.h" | ||
35 | |||
36 | #ifndef _PATH_SHADOW | ||
37 | #define _PATH_SHADOW "/etc/shadow" | ||
38 | #endif | ||
39 | #ifndef _PATH_PASSWD | ||
40 | #define _PATH_PASSWD "/etc/passwd" | ||
41 | #endif | ||
42 | #ifndef _PATH_GROUP | ||
43 | #define _PATH_GROUP "/etc/group" | ||
44 | #endif | ||
45 | |||
46 | /**********************************************************************/ | ||
47 | /* Sizes for statically allocated buffers. */ | ||
48 | |||
49 | /* If you change these values, also change _SC_GETPW_R_SIZE_MAX and | ||
50 | * _SC_GETGR_R_SIZE_MAX in libc/unistd/sysconf.c to match */ | ||
51 | #define PWD_BUFFER_SIZE 256 | ||
52 | #define GRP_BUFFER_SIZE 256 | ||
53 | |||
54 | /**********************************************************************/ | ||
55 | /* Prototypes for internal functions. */ | ||
56 | |||
57 | extern int __parsepwent(void *pw, char *line); | ||
58 | extern int __parsegrent(void *gr, char *line); | ||
59 | extern int __parsespent(void *sp, char *line); | ||
60 | |||
61 | extern int __pgsreader(int (*__parserfunc)(void *d, char *line), void *data, | ||
62 | char *__restrict line_buff, size_t buflen, FILE *f); | ||
63 | |||
64 | |||
65 | #ifndef GETXXKEY_R_FUNC | 21 | #ifndef GETXXKEY_R_FUNC |
66 | #error GETXXKEY_R_FUNC is not defined! | 22 | #error GETXXKEY_R_FUNC is not defined! |
67 | #endif | 23 | #endif |
68 | /**********************************************************************/ | ||
69 | #ifdef GETXXKEY_R_FUNC | ||
70 | 24 | ||
71 | int GETXXKEY_R_FUNC(DO_GETXXKEY_R_KEYTYPE key, | 25 | int GETXXKEY_R_FUNC(DO_GETXXKEY_R_KEYTYPE key, |
72 | GETXXKEY_R_ENTTYPE *__restrict resultbuf, | 26 | GETXXKEY_R_ENTTYPE *__restrict resultbuf, |
73 | char *__restrict buffer, size_t buflen, | 27 | char *__restrict buffer, size_t buflen, |
74 | GETXXKEY_R_ENTTYPE **__restrict result) | 28 | GETXXKEY_R_ENTTYPE **__restrict result) |
75 | { | 29 | { |
76 | FILE *stream; | 30 | FILE *stream; |
77 | int rv; | 31 | int rv; |
78 | 32 | ||
79 | *result = NULL; | 33 | *result = NULL; |
80 | 34 | ||
81 | if (!(stream = fopen(DO_GETXXKEY_R_PATHNAME, "r"))) { | 35 | stream = fopen(DO_GETXXKEY_R_PATHNAME, "r"); |
82 | rv = errno; | 36 | if (!stream) |
83 | } else { | 37 | return errno; |
84 | do { | 38 | while (1) { |
85 | if (!(rv = __pgsreader(GETXXKEY_R_PARSER, resultbuf, | 39 | rv = __pgsreader(GETXXKEY_R_PARSER, resultbuf, buffer, buflen, stream); |
86 | buffer, buflen, stream)) | 40 | if (!rv) { |
87 | ) { | 41 | if (GETXXKEY_R_TEST(resultbuf)) { /* Found key? */ |
88 | if (GETXXKEY_R_TEST(resultbuf)) { /* Found key? */ | 42 | *result = resultbuf; |
89 | *result = resultbuf; | ||
90 | break; | ||
91 | } | ||
92 | } else { | ||
93 | if (rv == ENOENT) { /* end-of-file encountered. */ | ||
94 | rv = 0; | ||
95 | } | ||
96 | break; | 43 | break; |
97 | } | 44 | } |
98 | } while (1); | 45 | } else { |
99 | fclose(stream); | 46 | if (rv == ENOENT) { /* end-of-file encountered. */ |
47 | rv = 0; | ||
48 | } | ||
49 | break; | ||
50 | } | ||
100 | } | 51 | } |
52 | fclose(stream); | ||
101 | 53 | ||
102 | return rv; | 54 | return rv; |
103 | } | 55 | } |
104 | 56 | ||
105 | #endif | ||
106 | /**********************************************************************/ | ||
107 | #undef GETXXKEY_R_FUNC | 57 | #undef GETXXKEY_R_FUNC |
108 | #undef GETXXKEY_R_PARSER | 58 | #undef GETXXKEY_R_PARSER |
109 | #undef GETXXKEY_R_ENTTYPE | 59 | #undef GETXXKEY_R_ENTTYPE |
110 | #undef GETXXKEY_R_TEST | 60 | #undef GETXXKEY_R_TEST |
111 | #undef DO_GETXXKEY_R_KEYTYPE | 61 | #undef DO_GETXXKEY_R_KEYTYPE |
112 | #undef DO_GETXXKEY_R_PATHNAME | 62 | #undef DO_GETXXKEY_R_PATHNAME |
113 | |||
diff --git a/loginutils/Config.in b/loginutils/Config.in index 6e45b706a..f434585ef 100644 --- a/loginutils/Config.in +++ b/loginutils/Config.in | |||
@@ -5,7 +5,7 @@ | |||
5 | 5 | ||
6 | menu "Login/Password Management Utilities" | 6 | menu "Login/Password Management Utilities" |
7 | 7 | ||
8 | config CONFIG_FEATURE_SHADOWPASSWDS | 8 | config FEATURE_SHADOWPASSWDS |
9 | bool "Support for shadow passwords" | 9 | bool "Support for shadow passwords" |
10 | default n | 10 | default n |
11 | help | 11 | help |
@@ -13,10 +13,10 @@ config CONFIG_FEATURE_SHADOWPASSWDS | |||
13 | readable by root and thus the encrypted passwords are no longer | 13 | readable by root and thus the encrypted passwords are no longer |
14 | publicly readable. | 14 | publicly readable. |
15 | 15 | ||
16 | config CONFIG_USE_BB_SHADOW | 16 | config USE_BB_SHADOW |
17 | bool " Use busybox shadow password functions" | 17 | bool " Use busybox shadow password functions" |
18 | default y | 18 | default y |
19 | depends on CONFIG_USE_BB_PWD_GRP && CONFIG_FEATURE_SHADOWPASSWDS | 19 | depends on USE_BB_PWD_GRP && FEATURE_SHADOWPASSWDS |
20 | help | 20 | help |
21 | If you leave this disabled, busybox will use the system's shadow | 21 | If you leave this disabled, busybox will use the system's shadow |
22 | password handling functions. And if you are using the GNU C library | 22 | password handling functions. And if you are using the GNU C library |
@@ -32,7 +32,7 @@ config CONFIG_USE_BB_SHADOW | |||
32 | able to use PAM to access shadow passwords from remote LDAP | 32 | able to use PAM to access shadow passwords from remote LDAP |
33 | password servers and whatnot. | 33 | password servers and whatnot. |
34 | 34 | ||
35 | config CONFIG_USE_BB_PWD_GRP | 35 | config USE_BB_PWD_GRP |
36 | bool "Use internal password and group functions rather than system functions" | 36 | bool "Use internal password and group functions rather than system functions" |
37 | default n | 37 | default n |
38 | help | 38 | help |
@@ -53,86 +53,86 @@ config CONFIG_USE_BB_PWD_GRP | |||
53 | 53 | ||
54 | If you enable this option, it will add about 1.5k to busybox. | 54 | If you enable this option, it will add about 1.5k to busybox. |
55 | 55 | ||
56 | config CONFIG_ADDGROUP | 56 | config ADDGROUP |
57 | bool "addgroup" | 57 | bool "addgroup" |
58 | default n | 58 | default n |
59 | help | 59 | help |
60 | Utility for creating a new group account. | 60 | Utility for creating a new group account. |
61 | 61 | ||
62 | config CONFIG_DELGROUP | 62 | config DELGROUP |
63 | bool "delgroup" | 63 | bool "delgroup" |
64 | default n | 64 | default n |
65 | help | 65 | help |
66 | Utility for deleting a group account. | 66 | Utility for deleting a group account. |
67 | 67 | ||
68 | config CONFIG_ADDUSER | 68 | config ADDUSER |
69 | bool "adduser" | 69 | bool "adduser" |
70 | default n | 70 | default n |
71 | help | 71 | help |
72 | Utility for creating a new user account. | 72 | Utility for creating a new user account. |
73 | 73 | ||
74 | config CONFIG_DELUSER | 74 | config DELUSER |
75 | bool "deluser" | 75 | bool "deluser" |
76 | default n | 76 | default n |
77 | help | 77 | help |
78 | Utility for deleting a user account. | 78 | Utility for deleting a user account. |
79 | 79 | ||
80 | config CONFIG_GETTY | 80 | config GETTY |
81 | bool "getty" | 81 | bool "getty" |
82 | default n | 82 | default n |
83 | select CONFIG_FEATURE_SYSLOG | 83 | select FEATURE_SYSLOG |
84 | help | 84 | help |
85 | getty lets you log in on a tty, it is normally invoked by init. | 85 | getty lets you log in on a tty, it is normally invoked by init. |
86 | 86 | ||
87 | config CONFIG_FEATURE_UTMP | 87 | config FEATURE_UTMP |
88 | bool "Support utmp file" | 88 | bool "Support utmp file" |
89 | depends on CONFIG_GETTY || CONFIG_LOGIN || CONFIG_SU || CONFIG_WHO | 89 | depends on GETTY || LOGIN || SU || WHO |
90 | default n | 90 | default n |
91 | help | 91 | help |
92 | The file /var/run/utmp is used to track who is currently logged in. | 92 | The file /var/run/utmp is used to track who is currently logged in. |
93 | 93 | ||
94 | config CONFIG_FEATURE_WTMP | 94 | config FEATURE_WTMP |
95 | bool "Support wtmp file" | 95 | bool "Support wtmp file" |
96 | depends on CONFIG_GETTY || CONFIG_LOGIN || CONFIG_SU || CONFIG_LAST | 96 | depends on GETTY || LOGIN || SU || LAST |
97 | default n | 97 | default n |
98 | select CONFIG_FEATURE_UTMP | 98 | select FEATURE_UTMP |
99 | help | 99 | help |
100 | The file /var/run/wtmp is used to track when user's have logged into | 100 | The file /var/run/wtmp is used to track when user's have logged into |
101 | and logged out of the system. | 101 | and logged out of the system. |
102 | 102 | ||
103 | config CONFIG_LOGIN | 103 | config LOGIN |
104 | bool "login" | 104 | bool "login" |
105 | default n | 105 | default n |
106 | select CONFIG_FEATURE_SUID | 106 | select FEATURE_SUID |
107 | select CONFIG_FEATURE_SYSLOG | 107 | select FEATURE_SYSLOG |
108 | help | 108 | help |
109 | login is used when signing onto a system. | 109 | login is used when signing onto a system. |
110 | 110 | ||
111 | Note that Busybox binary must be setuid root for this applet to | 111 | Note that Busybox binary must be setuid root for this applet to |
112 | work properly. | 112 | work properly. |
113 | 113 | ||
114 | config CONFIG_LOGIN_SCRIPTS | 114 | config LOGIN_SCRIPTS |
115 | bool "Support for login scripts" | 115 | bool "Support for login scripts" |
116 | depends on CONFIG_LOGIN | 116 | depends on LOGIN |
117 | default n | 117 | default n |
118 | help | 118 | help |
119 | Enable this if you want login to execute $LOGIN_PRE_SUID_SCRIPT | 119 | Enable this if you want login to execute $LOGIN_PRE_SUID_SCRIPT |
120 | just prior to swithching from root to logged-in user. | 120 | just prior to swithching from root to logged-in user. |
121 | 121 | ||
122 | config CONFIG_FEATURE_SECURETTY | 122 | config FEATURE_SECURETTY |
123 | bool "Support for /etc/securetty" | 123 | bool "Support for /etc/securetty" |
124 | default y | 124 | default y |
125 | depends on CONFIG_LOGIN | 125 | depends on LOGIN |
126 | help | 126 | help |
127 | The file /etc/securetty is used by (some versions of) login(1). | 127 | The file /etc/securetty is used by (some versions of) login(1). |
128 | The file contains the device names of tty lines (one per line, | 128 | The file contains the device names of tty lines (one per line, |
129 | without leading /dev/) on which root is allowed to login. | 129 | without leading /dev/) on which root is allowed to login. |
130 | 130 | ||
131 | config CONFIG_PASSWD | 131 | config PASSWD |
132 | bool "passwd" | 132 | bool "passwd" |
133 | default n | 133 | default n |
134 | select CONFIG_FEATURE_SUID | 134 | select FEATURE_SUID |
135 | select CONFIG_FEATURE_SYSLOG | 135 | select FEATURE_SYSLOG |
136 | help | 136 | help |
137 | passwd changes passwords for user and group accounts. A normal user | 137 | passwd changes passwords for user and group accounts. A normal user |
138 | may only change the password for his/her own account, the super user | 138 | may only change the password for his/her own account, the super user |
@@ -142,11 +142,11 @@ config CONFIG_PASSWD | |||
142 | Note that Busybox binary must be setuid root for this applet to | 142 | Note that Busybox binary must be setuid root for this applet to |
143 | work properly. | 143 | work properly. |
144 | 144 | ||
145 | config CONFIG_SU | 145 | config SU |
146 | bool "su" | 146 | bool "su" |
147 | default n | 147 | default n |
148 | select CONFIG_FEATURE_SUID | 148 | select FEATURE_SUID |
149 | select CONFIG_FEATURE_SYSLOG | 149 | select FEATURE_SYSLOG |
150 | help | 150 | help |
151 | su is used to become another user during a login session. | 151 | su is used to become another user during a login session. |
152 | Invoked without a username, su defaults to becoming the super user. | 152 | Invoked without a username, su defaults to becoming the super user. |
@@ -154,25 +154,25 @@ config CONFIG_SU | |||
154 | Note that Busybox binary must be setuid root for this applet to | 154 | Note that Busybox binary must be setuid root for this applet to |
155 | work properly. | 155 | work properly. |
156 | 156 | ||
157 | config CONFIG_SU_SYSLOG | 157 | config SU_SYSLOG |
158 | bool "Support for syslog in su" | 158 | bool "Support for syslog in su" |
159 | default y | 159 | default y |
160 | depends on CONFIG_SU | 160 | depends on SU |
161 | help | 161 | help |
162 | Enables support for syslog in su. | 162 | Enables support for syslog in su. |
163 | 163 | ||
164 | config CONFIG_SULOGIN | 164 | config SULOGIN |
165 | bool "sulogin" | 165 | bool "sulogin" |
166 | default n | 166 | default n |
167 | select CONFIG_FEATURE_SYSLOG | 167 | select FEATURE_SYSLOG |
168 | help | 168 | help |
169 | sulogin is invoked when the system goes into single user | 169 | sulogin is invoked when the system goes into single user |
170 | mode (this is done through an entry in inittab). | 170 | mode (this is done through an entry in inittab). |
171 | 171 | ||
172 | config CONFIG_VLOCK | 172 | config VLOCK |
173 | bool "vlock" | 173 | bool "vlock" |
174 | default n | 174 | default n |
175 | select CONFIG_FEATURE_SUID | 175 | select FEATURE_SUID |
176 | help | 176 | help |
177 | Build the "vlock" applet which allows you to lock (virtual) terminals. | 177 | Build the "vlock" applet which allows you to lock (virtual) terminals. |
178 | 178 | ||
diff --git a/loginutils/Kbuild b/loginutils/Kbuild new file mode 100644 index 000000000..6c9d193e1 --- /dev/null +++ b/loginutils/Kbuild | |||
@@ -0,0 +1,17 @@ | |||
1 | # Makefile for busybox | ||
2 | # | ||
3 | # Copyright (C) 1999-2005 by Erik Andersen <andersen@codepoet.org> | ||
4 | # | ||
5 | # Licensed under the GPL v2, see the file LICENSE in this tarball. | ||
6 | |||
7 | lib-y:= | ||
8 | lib-$(CONFIG_ADDGROUP) += addgroup.o | ||
9 | lib-$(CONFIG_ADDUSER) += adduser.o | ||
10 | lib-$(CONFIG_GETTY) += getty.o | ||
11 | lib-$(CONFIG_LOGIN) += login.o | ||
12 | lib-$(CONFIG_PASSWD) += passwd.o | ||
13 | lib-$(CONFIG_SU) += su.o | ||
14 | lib-$(CONFIG_SULOGIN) += sulogin.o | ||
15 | lib-$(CONFIG_VLOCK) += vlock.o | ||
16 | lib-$(CONFIG_DELUSER) += deluser.o | ||
17 | lib-$(CONFIG_DELGROUP) += deluser.o | ||
diff --git a/loginutils/Makefile b/loginutils/Makefile deleted file mode 100644 index b81f42964..000000000 --- a/loginutils/Makefile +++ /dev/null | |||
@@ -1,23 +0,0 @@ | |||
1 | # Makefile for busybox | ||
2 | # | ||
3 | # Copyright (C) 1999-2005 by Erik Andersen <andersen@codepoet.org> | ||
4 | # | ||
5 | # Licensed under the GPL v2, see the file LICENSE in this tarball. | ||
6 | |||
7 | ifndef top_srcdir | ||
8 | top_srcdir=.. | ||
9 | endif | ||
10 | ifndef top_builddir | ||
11 | top_builddir=.. | ||
12 | endif | ||
13 | srcdir=$(top_srcdir)/loginutils | ||
14 | LOGINUTILS_DIR:=./ | ||
15 | include $(top_srcdir)/Rules.mak | ||
16 | include $(top_builddir)/.config | ||
17 | include Makefile.in | ||
18 | all: $(libraries-y) | ||
19 | -include $(top_builddir)/.depend | ||
20 | |||
21 | clean: | ||
22 | rm -f *.o *.a $(AR_TARGET) | ||
23 | |||
diff --git a/loginutils/Makefile.in b/loginutils/Makefile.in deleted file mode 100644 index 0063762ab..000000000 --- a/loginutils/Makefile.in +++ /dev/null | |||
@@ -1,52 +0,0 @@ | |||
1 | # Makefile for busybox | ||
2 | # | ||
3 | # Copyright (C) 1999-2005 by Erik Andersen <andersen@codepoet.org> | ||
4 | # | ||
5 | # Licensed under the GPL v2, see the file LICENSE in this tarball. | ||
6 | |||
7 | LOGINUTILS_AR:=loginutils.a | ||
8 | ifndef LOGINUTILS_DIR | ||
9 | LOGINUTILS_DIR:=$(top_builddir)/loginutils/ | ||
10 | endif | ||
11 | srcdir=$(top_srcdir)/loginutils | ||
12 | |||
13 | LOGINUTILS-y:= | ||
14 | LOGINUTILS-$(CONFIG_ADDGROUP) += addgroup.o | ||
15 | LOGINUTILS-$(CONFIG_ADDUSER) += adduser.o | ||
16 | LOGINUTILS-$(CONFIG_GETTY) += getty.o | ||
17 | LOGINUTILS-$(CONFIG_LOGIN) += login.o | ||
18 | LOGINUTILS-$(CONFIG_PASSWD) += passwd.o | ||
19 | LOGINUTILS-$(CONFIG_SU) += su.o | ||
20 | LOGINUTILS-$(CONFIG_SULOGIN) += sulogin.o | ||
21 | LOGINUTILS-$(CONFIG_VLOCK) += vlock.o | ||
22 | LOGINUTILS-$(CONFIG_DELUSER) += deluser.o | ||
23 | LOGINUTILS-$(CONFIG_DELGROUP) += deluser.o | ||
24 | |||
25 | LOGINUTILS-y:=$(sort $(LOGINUTILS-y)) | ||
26 | |||
27 | ifneq ($(strip $(LOGINUTILS-y)),) | ||
28 | libraries-y+=$(LOGINUTILS_DIR)$(LOGINUTILS_AR) | ||
29 | endif | ||
30 | |||
31 | LOGINUTILS_SRC-y:=$(patsubst %.o,$(srcdir)/%.c,$(LOGINUTILS-y)) | ||
32 | LOGINUTILS_SRC-a:=$(wildcard $(srcdir)/*.c) | ||
33 | APPLET_SRC-y+=$(LOGINUTILS_SRC-y) | ||
34 | APPLET_SRC-a+=$(LOGINUTILS_SRC-a) | ||
35 | |||
36 | needcrypt-y:= | ||
37 | needcrypt-$(CONFIG_LOGIN) := y | ||
38 | needcrypt-$(CONFIG_PASSWD) := y | ||
39 | needcrypt-$(CONFIG_SU) := y | ||
40 | needcrypt-$(CONFIG_SULOGIN) := y | ||
41 | needcrypt-$(CONFIG_VLOCK) := y | ||
42 | |||
43 | |||
44 | ifeq ($(needcrypt-y),y) | ||
45 | LIBRARIES := -lcrypt $(filter-out -lcrypt,$(LIBRARIES)) | ||
46 | endif | ||
47 | |||
48 | $(LOGINUTILS_DIR)$(LOGINUTILS_AR): $(patsubst %,$(LOGINUTILS_DIR)%, $(LOGINUTILS-y)) | ||
49 | $(do_ar) | ||
50 | |||
51 | $(LOGINUTILS_DIR)%.o: $(srcdir)/%.c | ||
52 | $(compile.c) | ||
diff --git a/miscutils/Config.in b/miscutils/Config.in index 50ed4df99..311c7135c 100644 --- a/miscutils/Config.in +++ b/miscutils/Config.in | |||
@@ -5,25 +5,25 @@ | |||
5 | 5 | ||
6 | menu "Miscellaneous Utilities" | 6 | menu "Miscellaneous Utilities" |
7 | 7 | ||
8 | config CONFIG_ADJTIMEX | 8 | config ADJTIMEX |
9 | bool "adjtimex" | 9 | bool "adjtimex" |
10 | default n | 10 | default n |
11 | help | 11 | help |
12 | Adjtimex reads and optionally sets adjustment parameters for | 12 | Adjtimex reads and optionally sets adjustment parameters for |
13 | the Linux clock adjustment algorithm. | 13 | the Linux clock adjustment algorithm. |
14 | 14 | ||
15 | config CONFIG_BBCONFIG | 15 | config BBCONFIG |
16 | bool "bbconfig" | 16 | bool "bbconfig" |
17 | default n | 17 | default n |
18 | help | 18 | help |
19 | The bbconfig applet will print the config file with which | 19 | The bbconfig applet will print the config file with which |
20 | busybox was built. | 20 | busybox was built. |
21 | 21 | ||
22 | config CONFIG_CROND | 22 | config CROND |
23 | bool "crond" | 23 | bool "crond" |
24 | default n | 24 | default n |
25 | select CONFIG_FEATURE_SUID | 25 | select FEATURE_SUID |
26 | select CONFIG_FEATURE_SYSLOG | 26 | select FEATURE_SYSLOG |
27 | help | 27 | help |
28 | Crond is a background daemon that parses individual crontab | 28 | Crond is a background daemon that parses individual crontab |
29 | files and executes commands on behalf of the users in question. | 29 | files and executes commands on behalf of the users in question. |
@@ -35,39 +35,39 @@ config CONFIG_CROND | |||
35 | Note that Busybox binary must be setuid root for this applet to | 35 | Note that Busybox binary must be setuid root for this applet to |
36 | work properly. | 36 | work properly. |
37 | 37 | ||
38 | config CONFIG_DEBUG_CROND_OPTION | 38 | config DEBUG_CROND_OPTION |
39 | bool "Support debug option -d" | 39 | bool "Support debug option -d" |
40 | depends on CONFIG_CROND | 40 | depends on CROND |
41 | default n | 41 | default n |
42 | help | 42 | help |
43 | Support option -d to enter debug mode. | 43 | Support option -d to enter debug mode. |
44 | 44 | ||
45 | config CONFIG_FEATURE_CROND_CALL_SENDMAIL | 45 | config FEATURE_CROND_CALL_SENDMAIL |
46 | bool "Using /usr/sbin/sendmail?" | 46 | bool "Using /usr/sbin/sendmail?" |
47 | default n | 47 | default n |
48 | depends on CONFIG_CROND | 48 | depends on CROND |
49 | help | 49 | help |
50 | Support calling /usr/sbin/sendmail for send cmd outputs. | 50 | Support calling /usr/sbin/sendmail for send cmd outputs. |
51 | 51 | ||
52 | config CONFIG_CRONTAB | 52 | config CRONTAB |
53 | bool "crontab" | 53 | bool "crontab" |
54 | default n | 54 | default n |
55 | select CONFIG_FEATURE_SUID | 55 | select FEATURE_SUID |
56 | help | 56 | help |
57 | Crontab manipulates the crontab for a particular user. Only | 57 | Crontab manipulates the crontab for a particular user. Only |
58 | the superuser may specify a different user and/or crontab directory. | 58 | the superuser may specify a different user and/or crontab directory. |
59 | 59 | ||
60 | config CONFIG_DC | 60 | config DC |
61 | bool "dc" | 61 | bool "dc" |
62 | default n | 62 | default n |
63 | help | 63 | help |
64 | Dc is a reverse-polish desk calculator which supports unlimited | 64 | Dc is a reverse-polish desk calculator which supports unlimited |
65 | precision arithmetic. | 65 | precision arithmetic. |
66 | 66 | ||
67 | config CONFIG_DEVFSD | 67 | config DEVFSD |
68 | bool "devfsd (obsolete)" | 68 | bool "devfsd (obsolete)" |
69 | default n | 69 | default n |
70 | select CONFIG_FEATURE_SYSLOG | 70 | select FEATURE_SYSLOG |
71 | help | 71 | help |
72 | This is deprecated, and will be removed at the end of 2008. | 72 | This is deprecated, and will be removed at the end of 2008. |
73 | 73 | ||
@@ -80,30 +80,30 @@ config CONFIG_DEVFSD | |||
80 | 80 | ||
81 | But only if they are written UPPERCASE!!!!!!!! | 81 | But only if they are written UPPERCASE!!!!!!!! |
82 | 82 | ||
83 | config CONFIG_DEVFSD_MODLOAD | 83 | config DEVFSD_MODLOAD |
84 | bool "Adds support for MODLOAD keyword in devsfd.conf" | 84 | bool "Adds support for MODLOAD keyword in devsfd.conf" |
85 | default n | 85 | default n |
86 | depends on CONFIG_DEVFSD | 86 | depends on DEVFSD |
87 | help | 87 | help |
88 | This actually doesn't work with busybox modutils but needs | 88 | This actually doesn't work with busybox modutils but needs |
89 | the external modutils. | 89 | the external modutils. |
90 | 90 | ||
91 | config CONFIG_DEVFSD_FG_NP | 91 | config DEVFSD_FG_NP |
92 | bool "Enables the -fg and -np options" | 92 | bool "Enables the -fg and -np options" |
93 | default n | 93 | default n |
94 | depends on CONFIG_DEVFSD | 94 | depends on DEVFSD |
95 | help | 95 | help |
96 | -fg Run the daemon in the foreground. | 96 | -fg Run the daemon in the foreground. |
97 | -np Exit after parsing the configuration file. Do not poll for events. | 97 | -np Exit after parsing the configuration file. Do not poll for events. |
98 | 98 | ||
99 | config CONFIG_DEVFSD_VERBOSE | 99 | config DEVFSD_VERBOSE |
100 | bool "Increases logging (and size)" | 100 | bool "Increases logging (and size)" |
101 | default n | 101 | default n |
102 | depends on CONFIG_DEVFSD | 102 | depends on DEVFSD |
103 | help | 103 | help |
104 | Increases logging to stderr or syslog. | 104 | Increases logging to stderr or syslog. |
105 | 105 | ||
106 | config CONFIG_FEATURE_DEVFS | 106 | config FEATURE_DEVFS |
107 | bool " Use devfs names for all devices (obsolete)" | 107 | bool " Use devfs names for all devices (obsolete)" |
108 | default n | 108 | default n |
109 | help | 109 | help |
@@ -113,126 +113,126 @@ config CONFIG_FEATURE_DEVFS | |||
113 | /dev/loop0. If your /dev directory has normal names instead of | 113 | /dev/loop0. If your /dev directory has normal names instead of |
114 | devfs names, you don't want this. | 114 | devfs names, you don't want this. |
115 | 115 | ||
116 | config CONFIG_EJECT | 116 | config EJECT |
117 | bool "eject" | 117 | bool "eject" |
118 | default n | 118 | default n |
119 | help | 119 | help |
120 | Used to eject cdroms. (defaults to /dev/cdrom) | 120 | Used to eject cdroms. (defaults to /dev/cdrom) |
121 | 121 | ||
122 | config CONFIG_LAST | 122 | config LAST |
123 | bool "last" | 123 | bool "last" |
124 | default n | 124 | default n |
125 | select CONFIG_FEATURE_WTMP | 125 | select FEATURE_WTMP |
126 | help | 126 | help |
127 | 'last' displays a list of the last users that logged into the system. | 127 | 'last' displays a list of the last users that logged into the system. |
128 | 128 | ||
129 | config CONFIG_LESS | 129 | config LESS |
130 | bool "less" | 130 | bool "less" |
131 | default n | 131 | default n |
132 | help | 132 | help |
133 | 'less' is a pager, meaning that it displays text files. It possesses | 133 | 'less' is a pager, meaning that it displays text files. It possesses |
134 | a wide array of features, and is an improvement over 'more'. | 134 | a wide array of features, and is an improvement over 'more'. |
135 | 135 | ||
136 | config CONFIG_FEATURE_LESS_BRACKETS | 136 | config FEATURE_LESS_BRACKETS |
137 | bool "Enable bracket searching" | 137 | bool "Enable bracket searching" |
138 | default y | 138 | default y |
139 | depends on CONFIG_LESS | 139 | depends on LESS |
140 | help | 140 | help |
141 | This option adds the capability to search for matching left and right | 141 | This option adds the capability to search for matching left and right |
142 | brackets, facilitating programming. | 142 | brackets, facilitating programming. |
143 | 143 | ||
144 | config CONFIG_FEATURE_LESS_FLAGS | 144 | config FEATURE_LESS_FLAGS |
145 | bool "Enable extra flags" | 145 | bool "Enable extra flags" |
146 | default y | 146 | default y |
147 | depends on CONFIG_LESS | 147 | depends on LESS |
148 | help | 148 | help |
149 | The extra flags provided do the following: | 149 | The extra flags provided do the following: |
150 | 150 | ||
151 | The -M flag enables a more sophisticated status line. | 151 | The -M flag enables a more sophisticated status line. |
152 | The -m flag enables a simpler status line with a percentage. | 152 | The -m flag enables a simpler status line with a percentage. |
153 | 153 | ||
154 | config CONFIG_FEATURE_LESS_FLAGCS | 154 | config FEATURE_LESS_FLAGCS |
155 | bool "Enable flag changes" | 155 | bool "Enable flag changes" |
156 | default n | 156 | default n |
157 | depends on CONFIG_LESS | 157 | depends on LESS |
158 | help | 158 | help |
159 | This enables the ability to change command-line flags within | 159 | This enables the ability to change command-line flags within |
160 | less itself. | 160 | less itself. |
161 | 161 | ||
162 | config CONFIG_FEATURE_LESS_MARKS | 162 | config FEATURE_LESS_MARKS |
163 | bool "Enable marks" | 163 | bool "Enable marks" |
164 | default n | 164 | default n |
165 | depends on CONFIG_LESS | 165 | depends on LESS |
166 | help | 166 | help |
167 | Marks enable positions in a file to be stored for easy reference. | 167 | Marks enable positions in a file to be stored for easy reference. |
168 | 168 | ||
169 | config CONFIG_FEATURE_LESS_REGEXP | 169 | config FEATURE_LESS_REGEXP |
170 | bool "Enable regular expressions" | 170 | bool "Enable regular expressions" |
171 | default n | 171 | default n |
172 | depends on CONFIG_LESS | 172 | depends on LESS |
173 | help | 173 | help |
174 | Enable regular expressions, allowing complex file searches. | 174 | Enable regular expressions, allowing complex file searches. |
175 | 175 | ||
176 | config CONFIG_HDPARM | 176 | config HDPARM |
177 | bool "hdparm" | 177 | bool "hdparm" |
178 | default n | 178 | default n |
179 | help | 179 | help |
180 | Get/Set hard drive parameters. Primarily intended for ATA | 180 | Get/Set hard drive parameters. Primarily intended for ATA |
181 | drives. Adds about 13k (or around 30k if you enable the | 181 | drives. Adds about 13k (or around 30k if you enable the |
182 | CONFIG_FEATURE_HDPARM_GET_IDENTITY option).... | 182 | FEATURE_HDPARM_GET_IDENTITY option).... |
183 | 183 | ||
184 | config CONFIG_FEATURE_HDPARM_GET_IDENTITY | 184 | config FEATURE_HDPARM_GET_IDENTITY |
185 | bool "Support obtaining detailed information directly from drives" | 185 | bool "Support obtaining detailed information directly from drives" |
186 | default y | 186 | default y |
187 | depends on CONFIG_HDPARM | 187 | depends on HDPARM |
188 | help | 188 | help |
189 | Enables the -I and -i options to obtain detailed information | 189 | Enables the -I and -i options to obtain detailed information |
190 | directly from drives about their capabilities and supported ATA | 190 | directly from drives about their capabilities and supported ATA |
191 | feature set. If no device name is specified, hdparm will read | 191 | feature set. If no device name is specified, hdparm will read |
192 | identify data from stdin. Enabling this option will add about 16k... | 192 | identify data from stdin. Enabling this option will add about 16k... |
193 | 193 | ||
194 | config CONFIG_FEATURE_HDPARM_HDIO_SCAN_HWIF | 194 | config FEATURE_HDPARM_HDIO_SCAN_HWIF |
195 | bool "Register an IDE interface (DANGEROUS)" | 195 | bool "Register an IDE interface (DANGEROUS)" |
196 | default n | 196 | default n |
197 | depends on CONFIG_HDPARM | 197 | depends on HDPARM |
198 | help | 198 | help |
199 | Enables the 'hdparm -R' option to register an IDE interface. | 199 | Enables the 'hdparm -R' option to register an IDE interface. |
200 | This is dangerous stuff, so you should probably say N. | 200 | This is dangerous stuff, so you should probably say N. |
201 | 201 | ||
202 | config CONFIG_FEATURE_HDPARM_HDIO_UNREGISTER_HWIF | 202 | config FEATURE_HDPARM_HDIO_UNREGISTER_HWIF |
203 | bool "Un-register an IDE interface (DANGEROUS)" | 203 | bool "Un-register an IDE interface (DANGEROUS)" |
204 | default n | 204 | default n |
205 | depends on CONFIG_HDPARM | 205 | depends on HDPARM |
206 | help | 206 | help |
207 | Enables the 'hdparm -U' option to un-register an IDE interface. | 207 | Enables the 'hdparm -U' option to un-register an IDE interface. |
208 | This is dangerous stuff, so you should probably say N. | 208 | This is dangerous stuff, so you should probably say N. |
209 | 209 | ||
210 | config CONFIG_FEATURE_HDPARM_HDIO_DRIVE_RESET | 210 | config FEATURE_HDPARM_HDIO_DRIVE_RESET |
211 | bool "perform device reset (DANGEROUS)" | 211 | bool "perform device reset (DANGEROUS)" |
212 | default n | 212 | default n |
213 | depends on CONFIG_HDPARM | 213 | depends on HDPARM |
214 | help | 214 | help |
215 | Enables the 'hdparm -w' option to perform a device reset. | 215 | Enables the 'hdparm -w' option to perform a device reset. |
216 | This is dangerous stuff, so you should probably say N. | 216 | This is dangerous stuff, so you should probably say N. |
217 | 217 | ||
218 | config CONFIG_FEATURE_HDPARM_HDIO_TRISTATE_HWIF | 218 | config FEATURE_HDPARM_HDIO_TRISTATE_HWIF |
219 | bool "tristate device for hotswap (DANGEROUS)" | 219 | bool "tristate device for hotswap (DANGEROUS)" |
220 | default n | 220 | default n |
221 | depends on CONFIG_HDPARM | 221 | depends on HDPARM |
222 | help | 222 | help |
223 | Enables the 'hdparm -x' option to tristate device for hotswap, | 223 | Enables the 'hdparm -x' option to tristate device for hotswap, |
224 | and the '-b' option to get/set bus state. This is dangerous | 224 | and the '-b' option to get/set bus state. This is dangerous |
225 | stuff, so you should probably say N. | 225 | stuff, so you should probably say N. |
226 | 226 | ||
227 | config CONFIG_FEATURE_HDPARM_HDIO_GETSET_DMA | 227 | config FEATURE_HDPARM_HDIO_GETSET_DMA |
228 | bool "get/set using_dma flag (DANGEROUS)" | 228 | bool "get/set using_dma flag (DANGEROUS)" |
229 | default n | 229 | default n |
230 | depends on CONFIG_HDPARM | 230 | depends on HDPARM |
231 | help | 231 | help |
232 | Enables the 'hdparm -d' option to get/set using_dma flag. | 232 | Enables the 'hdparm -d' option to get/set using_dma flag. |
233 | This is dangerous stuff, so you should probably say N. | 233 | This is dangerous stuff, so you should probably say N. |
234 | 234 | ||
235 | config CONFIG_MAKEDEVS | 235 | config MAKEDEVS |
236 | bool "makedevs" | 236 | bool "makedevs" |
237 | default n | 237 | default n |
238 | help | 238 | help |
@@ -253,24 +253,24 @@ config CONFIG_MAKEDEVS | |||
253 | 253 | ||
254 | choice | 254 | choice |
255 | prompt "Choose makedevs behaviour" | 255 | prompt "Choose makedevs behaviour" |
256 | depends CONFIG_MAKEDEVS | 256 | depends MAKEDEVS |
257 | default CONFIG_FEATURE_MAKEDEVS_TABLE | 257 | default FEATURE_MAKEDEVS_TABLE |
258 | 258 | ||
259 | config CONFIG_FEATURE_MAKEDEVS_LEAF | 259 | config FEATURE_MAKEDEVS_LEAF |
260 | bool "leaf" | 260 | bool "leaf" |
261 | 261 | ||
262 | config CONFIG_FEATURE_MAKEDEVS_TABLE | 262 | config FEATURE_MAKEDEVS_TABLE |
263 | bool "table" | 263 | bool "table" |
264 | 264 | ||
265 | endchoice | 265 | endchoice |
266 | 266 | ||
267 | config CONFIG_MOUNTPOINT | 267 | config MOUNTPOINT |
268 | bool "mountpoint" | 268 | bool "mountpoint" |
269 | default n | 269 | default n |
270 | help | 270 | help |
271 | mountpoint checks if the directory is a mountpoint. | 271 | mountpoint checks if the directory is a mountpoint. |
272 | 272 | ||
273 | config CONFIG_MT | 273 | config MT |
274 | bool "mt" | 274 | bool "mt" |
275 | default n | 275 | default n |
276 | help | 276 | help |
@@ -278,7 +278,7 @@ config CONFIG_MT | |||
278 | to advance or rewind a tape past a specified number of archive | 278 | to advance or rewind a tape past a specified number of archive |
279 | files on the tape. | 279 | files on the tape. |
280 | 280 | ||
281 | config CONFIG_READAHEAD | 281 | config READAHEAD |
282 | bool "readahead" | 282 | bool "readahead" |
283 | default n | 283 | default n |
284 | help | 284 | help |
@@ -294,7 +294,7 @@ config CONFIG_READAHEAD | |||
294 | As readahead(2) blocks until each file has been read, it is best to | 294 | As readahead(2) blocks until each file has been read, it is best to |
295 | run this applet as a background job. | 295 | run this applet as a background job. |
296 | 296 | ||
297 | config CONFIG_RUNLEVEL | 297 | config RUNLEVEL |
298 | bool "runlevel" | 298 | bool "runlevel" |
299 | default n | 299 | default n |
300 | help | 300 | help |
@@ -303,32 +303,32 @@ config CONFIG_RUNLEVEL | |||
303 | This applet uses utmp but does not rely on busybox supporing | 303 | This applet uses utmp but does not rely on busybox supporing |
304 | utmp on purpose. It is used by e.g. emdebian via /etc/init.d/rc. | 304 | utmp on purpose. It is used by e.g. emdebian via /etc/init.d/rc. |
305 | 305 | ||
306 | config CONFIG_RX | 306 | config RX |
307 | bool "rx" | 307 | bool "rx" |
308 | default n | 308 | default n |
309 | help | 309 | help |
310 | Receive files using the Xmodem protocol. | 310 | Receive files using the Xmodem protocol. |
311 | 311 | ||
312 | config CONFIG_STRINGS | 312 | config STRINGS |
313 | bool "strings" | 313 | bool "strings" |
314 | default n | 314 | default n |
315 | help | 315 | help |
316 | strings prints the printable character sequences for each file | 316 | strings prints the printable character sequences for each file |
317 | specified. | 317 | specified. |
318 | 318 | ||
319 | config CONFIG_SETSID | 319 | config SETSID |
320 | bool "setsid" | 320 | bool "setsid" |
321 | default n | 321 | default n |
322 | help | 322 | help |
323 | setsid runs a program in a new session | 323 | setsid runs a program in a new session |
324 | 324 | ||
325 | config CONFIG_TASKSET | 325 | config TASKSET |
326 | bool "taskset" | 326 | bool "taskset" |
327 | default n | 327 | default n |
328 | help | 328 | help |
329 | Retrieve or set a processes's CPU affinity. | 329 | Retrieve or set a processes's CPU affinity. |
330 | 330 | ||
331 | config CONFIG_TIME | 331 | config TIME |
332 | bool "time" | 332 | bool "time" |
333 | default n | 333 | default n |
334 | help | 334 | help |
@@ -336,7 +336,7 @@ config CONFIG_TIME | |||
336 | When the command finishes, time writes a message to standard output | 336 | When the command finishes, time writes a message to standard output |
337 | giving timing statistics about this program run. | 337 | giving timing statistics about this program run. |
338 | 338 | ||
339 | config CONFIG_WATCHDOG | 339 | config WATCHDOG |
340 | bool "watchdog" | 340 | bool "watchdog" |
341 | default n | 341 | default n |
342 | help | 342 | help |
diff --git a/miscutils/Kbuild b/miscutils/Kbuild new file mode 100644 index 000000000..1c9e9fded --- /dev/null +++ b/miscutils/Kbuild | |||
@@ -0,0 +1,27 @@ | |||
1 | # Makefile for busybox | ||
2 | # | ||
3 | # Copyright (C) 1999-2005 by Erik Andersen <andersen@codepoet.org> | ||
4 | # | ||
5 | # Licensed under the GPL v2, see the file LICENSE in this tarball. | ||
6 | |||
7 | lib-y:= | ||
8 | lib-$(CONFIG_ADJTIMEX) += adjtimex.o | ||
9 | lib-$(CONFIG_CROND) += crond.o | ||
10 | lib-$(CONFIG_CRONTAB) += crontab.o | ||
11 | lib-$(CONFIG_BBCONFIG) += bbconfig.o | ||
12 | lib-$(CONFIG_DC) += dc.o | ||
13 | lib-$(CONFIG_DEVFSD) += devfsd.o | ||
14 | lib-$(CONFIG_EJECT) += eject.o | ||
15 | lib-$(CONFIG_HDPARM) += hdparm.o | ||
16 | lib-$(CONFIG_LAST) += last.o | ||
17 | lib-$(CONFIG_LESS) += less.o | ||
18 | lib-$(CONFIG_MAKEDEVS) += makedevs.o | ||
19 | lib-$(CONFIG_MOUNTPOINT) += mountpoint.o | ||
20 | lib-$(CONFIG_MT) += mt.o | ||
21 | lib-$(CONFIG_READAHEAD) += readahead.o | ||
22 | lib-$(CONFIG_RUNLEVEL) += runlevel.o | ||
23 | lib-$(CONFIG_RX) += rx.o | ||
24 | lib-$(CONFIG_SETSID) += setsid.o | ||
25 | lib-$(CONFIG_STRINGS) += strings.o | ||
26 | lib-$(CONFIG_TIME) += time.o | ||
27 | lib-$(CONFIG_WATCHDOG) += watchdog.o | ||
diff --git a/miscutils/Makefile b/miscutils/Makefile deleted file mode 100644 index 91b31ec9e..000000000 --- a/miscutils/Makefile +++ /dev/null | |||
@@ -1,23 +0,0 @@ | |||
1 | # Makefile for busybox | ||
2 | # | ||
3 | # Copyright (C) 1999-2005 by Erik Andersen <andersen@codepoet.org> | ||
4 | # | ||
5 | # Licensed under the GPL v2, see the file LICENSE in this tarball. | ||
6 | |||
7 | ifndef top_srcdir | ||
8 | top_srcdir=.. | ||
9 | endif | ||
10 | ifndef top_builddir | ||
11 | top_builddir=.. | ||
12 | endif | ||
13 | srcdir=$(top_srcdir)/miscutils | ||
14 | MISCUTILS_DIR:=./ | ||
15 | include $(top_srcdir)/Rules.mak | ||
16 | include $(top_builddir)/.config | ||
17 | include Makefile.in | ||
18 | all: $(libraries-y) | ||
19 | -include $(top_builddir)/.depend | ||
20 | |||
21 | clean: | ||
22 | rm -f *.o *.a $(AR_TARGET) | ||
23 | |||
diff --git a/miscutils/Makefile.in b/miscutils/Makefile.in deleted file mode 100644 index d32d7714e..000000000 --- a/miscutils/Makefile.in +++ /dev/null | |||
@@ -1,55 +0,0 @@ | |||
1 | # Makefile for busybox | ||
2 | # | ||
3 | # Copyright (C) 1999-2005 by Erik Andersen <andersen@codepoet.org> | ||
4 | # | ||
5 | # Licensed under the GPL v2, see the file LICENSE in this tarball. | ||
6 | |||
7 | MISCUTILS_AR:=miscutils.a | ||
8 | ifndef $(MISCUTILS_DIR) | ||
9 | MISCUTILS_DIR:=$(top_builddir)/miscutils/ | ||
10 | endif | ||
11 | srcdir=$(top_srcdir)/miscutils | ||
12 | |||
13 | MISCUTILS-y:= | ||
14 | MISCUTILS-$(CONFIG_ADJTIMEX) += adjtimex.o | ||
15 | MISCUTILS-$(CONFIG_CROND) += crond.o | ||
16 | MISCUTILS-$(CONFIG_CRONTAB) += crontab.o | ||
17 | MISCUTILS-$(CONFIG_BBCONFIG) += bbconfig.o | ||
18 | MISCUTILS-$(CONFIG_DC) += dc.o | ||
19 | MISCUTILS-$(CONFIG_DEVFSD) += devfsd.o | ||
20 | MISCUTILS-$(CONFIG_EJECT) += eject.o | ||
21 | MISCUTILS-$(CONFIG_HDPARM) += hdparm.o | ||
22 | MISCUTILS-$(CONFIG_LAST) += last.o | ||
23 | MISCUTILS-$(CONFIG_LESS) += less.o | ||
24 | MISCUTILS-$(CONFIG_MAKEDEVS) += makedevs.o | ||
25 | MISCUTILS-$(CONFIG_MOUNTPOINT) += mountpoint.o | ||
26 | MISCUTILS-$(CONFIG_MT) += mt.o | ||
27 | MISCUTILS-$(CONFIG_READAHEAD) += readahead.o | ||
28 | MISCUTILS-$(CONFIG_RUNLEVEL) += runlevel.o | ||
29 | MISCUTILS-$(CONFIG_RX) += rx.o | ||
30 | MISCUTILS-$(CONFIG_SETSID) += setsid.o | ||
31 | MISCUTILS-$(CONFIG_STRINGS) += strings.o | ||
32 | MISCUTILS-$(CONFIG_TIME) += time.o | ||
33 | MISCUTILS-$(CONFIG_WATCHDOG) += watchdog.o | ||
34 | |||
35 | ifneq ($(strip $(MISCUTILS-y)),) | ||
36 | libraries-y+=$(MISCUTILS_DIR)$(MISCUTILS_AR) | ||
37 | endif | ||
38 | |||
39 | MISCUTILS_SRC-y:=$(patsubst %.o,$(srcdir)/%.c,$(MISCUTILS-y)) | ||
40 | MISCUTILS_SRC-a:=$(wildcard $(srcdir)/*.c) | ||
41 | APPLET_SRC-y+=$(MISCUTILS_SRC-y) | ||
42 | APPLET_SRC-a+=$(MISCUTILS_SRC-a) | ||
43 | |||
44 | needlibm-y:= | ||
45 | needlibm-$(CONFIG_DC) := y | ||
46 | |||
47 | ifeq ($(needlibm-y),y) | ||
48 | LIBRARIES := -lm $(filter-out -lm,$(LIBRARIES)) | ||
49 | endif | ||
50 | |||
51 | $(MISCUTILS_DIR)$(MISCUTILS_AR): $(patsubst %,$(MISCUTILS_DIR)%, $(MISCUTILS-y)) | ||
52 | $(do_ar) | ||
53 | |||
54 | $(MISCUTILS_DIR)%.o: $(srcdir)/%.c | ||
55 | $(compile.c) | ||
diff --git a/miscutils/rx.c b/miscutils/rx.c index 52a76bfd9..00951b711 100644 --- a/miscutils/rx.c +++ b/miscutils/rx.c | |||
@@ -266,7 +266,7 @@ int rx_main(int argc, char **argv) | |||
266 | filefd = xopen3(fn, O_RDWR|O_CREAT|O_TRUNC, 0666); | 266 | filefd = xopen3(fn, O_RDWR|O_CREAT|O_TRUNC, 0666); |
267 | 267 | ||
268 | if (tcgetattr(ttyfd, &tty) < 0) | 268 | if (tcgetattr(ttyfd, &tty) < 0) |
269 | bb_perror_msg_and_die("%s: tcgetattr failed", argv[0]); | 269 | bb_perror_msg_and_die("tcgetattr"); |
270 | 270 | ||
271 | orig_tty = tty; | 271 | orig_tty = tty; |
272 | 272 | ||
@@ -284,8 +284,7 @@ int rx_main(int argc, char **argv) | |||
284 | tcsetattr(ttyfd, TCSAFLUSH, &orig_tty); | 284 | tcsetattr(ttyfd, TCSAFLUSH, &orig_tty); |
285 | 285 | ||
286 | if (n < 0) | 286 | if (n < 0) |
287 | bb_error_msg_and_die("\n%s: receive failed:\n %s", | 287 | bb_error_msg_and_die("\nreceive failed:\n %s", error_buf); |
288 | argv[0], error_buf); | ||
289 | 288 | ||
290 | bb_fflush_stdout_and_exit(EXIT_SUCCESS); | 289 | bb_fflush_stdout_and_exit(EXIT_SUCCESS); |
291 | } | 290 | } |
diff --git a/modutils/Config.in b/modutils/Config.in index 8974fb795..b28c66d24 100644 --- a/modutils/Config.in +++ b/modutils/Config.in | |||
@@ -5,24 +5,24 @@ | |||
5 | 5 | ||
6 | menu "Linux Module Utilities" | 6 | menu "Linux Module Utilities" |
7 | 7 | ||
8 | config CONFIG_INSMOD | 8 | config INSMOD |
9 | bool "insmod" | 9 | bool "insmod" |
10 | default n | 10 | default n |
11 | help | 11 | help |
12 | insmod is used to load specified modules in the running kernel. | 12 | insmod is used to load specified modules in the running kernel. |
13 | 13 | ||
14 | config CONFIG_FEATURE_INSMOD_VERSION_CHECKING | 14 | config FEATURE_INSMOD_VERSION_CHECKING |
15 | bool "Module version checking" | 15 | bool "Module version checking" |
16 | default n | 16 | default n |
17 | depends on CONFIG_INSMOD && CONFIG_FEATURE_2_4_MODULES | 17 | depends on INSMOD && FEATURE_2_4_MODULES |
18 | help | 18 | help |
19 | Support checking of versions for modules. This is used to | 19 | Support checking of versions for modules. This is used to |
20 | ensure that the kernel and module are made for each other. | 20 | ensure that the kernel and module are made for each other. |
21 | 21 | ||
22 | config CONFIG_FEATURE_INSMOD_KSYMOOPS_SYMBOLS | 22 | config FEATURE_INSMOD_KSYMOOPS_SYMBOLS |
23 | bool "Add module symbols to kernel symbol table" | 23 | bool "Add module symbols to kernel symbol table" |
24 | default n | 24 | default n |
25 | depends on CONFIG_INSMOD && CONFIG_FEATURE_2_4_MODULES | 25 | depends on INSMOD && FEATURE_2_4_MODULES |
26 | help | 26 | help |
27 | By adding module symbols to the kernel symbol table, Oops messages | 27 | By adding module symbols to the kernel symbol table, Oops messages |
28 | occuring within kernel modules can be properly debugged. By enabling | 28 | occuring within kernel modules can be properly debugged. By enabling |
@@ -30,20 +30,20 @@ config CONFIG_FEATURE_INSMOD_KSYMOOPS_SYMBOLS | |||
30 | table for properly debugging support. If you are not interested in | 30 | table for properly debugging support. If you are not interested in |
31 | Oops messages from kernel modules, say N. | 31 | Oops messages from kernel modules, say N. |
32 | 32 | ||
33 | config CONFIG_FEATURE_INSMOD_LOADINKMEM | 33 | config FEATURE_INSMOD_LOADINKMEM |
34 | bool "In kernel memory optimization (uClinux only)" | 34 | bool "In kernel memory optimization (uClinux only)" |
35 | default n | 35 | default n |
36 | depends on CONFIG_INSMOD && CONFIG_FEATURE_2_4_MODULES | 36 | depends on INSMOD && FEATURE_2_4_MODULES |
37 | help | 37 | help |
38 | This is a special uClinux only memory optimization that lets insmod | 38 | This is a special uClinux only memory optimization that lets insmod |
39 | load the specified kernel module directly into kernel space, reducing | 39 | load the specified kernel module directly into kernel space, reducing |
40 | memory usage by preventing the need for two copies of the module | 40 | memory usage by preventing the need for two copies of the module |
41 | being loaded into memory. | 41 | being loaded into memory. |
42 | 42 | ||
43 | config CONFIG_FEATURE_INSMOD_LOAD_MAP | 43 | config FEATURE_INSMOD_LOAD_MAP |
44 | bool "Enable load map (-m) option" | 44 | bool "Enable load map (-m) option" |
45 | default n | 45 | default n |
46 | depends on CONFIG_INSMOD && CONFIG_FEATURE_2_4_MODULES | 46 | depends on INSMOD && FEATURE_2_4_MODULES |
47 | help | 47 | help |
48 | Enabling this, one would be able to get a load map | 48 | Enabling this, one would be able to get a load map |
49 | output on stdout. This makes kernel module debugging | 49 | output on stdout. This makes kernel module debugging |
@@ -51,36 +51,36 @@ config CONFIG_FEATURE_INSMOD_LOAD_MAP | |||
51 | If you don't plan to debug kernel modules, you | 51 | If you don't plan to debug kernel modules, you |
52 | don't need this option. | 52 | don't need this option. |
53 | 53 | ||
54 | config CONFIG_FEATURE_INSMOD_LOAD_MAP_FULL | 54 | config FEATURE_INSMOD_LOAD_MAP_FULL |
55 | bool "Symbols in load map" | 55 | bool "Symbols in load map" |
56 | default y | 56 | default y |
57 | depends on CONFIG_FEATURE_INSMOD_LOAD_MAP | 57 | depends on FEATURE_INSMOD_LOAD_MAP |
58 | help | 58 | help |
59 | Without this option, -m will only output section | 59 | Without this option, -m will only output section |
60 | load map. With this option, -m will also output | 60 | load map. With this option, -m will also output |
61 | symbols load map. | 61 | symbols load map. |
62 | 62 | ||
63 | config CONFIG_RMMOD | 63 | config RMMOD |
64 | bool "rmmod" | 64 | bool "rmmod" |
65 | default n | 65 | default n |
66 | help | 66 | help |
67 | rmmod is used to unload specified modules from the kernel. | 67 | rmmod is used to unload specified modules from the kernel. |
68 | 68 | ||
69 | config CONFIG_LSMOD | 69 | config LSMOD |
70 | bool "lsmod" | 70 | bool "lsmod" |
71 | default n | 71 | default n |
72 | help | 72 | help |
73 | lsmod is used to display a list of loaded modules. | 73 | lsmod is used to display a list of loaded modules. |
74 | 74 | ||
75 | config CONFIG_FEATURE_LSMOD_PRETTY_2_6_OUTPUT | 75 | config FEATURE_LSMOD_PRETTY_2_6_OUTPUT |
76 | bool "lsmod pretty output for 2.6.x Linux kernels " | 76 | bool "lsmod pretty output for 2.6.x Linux kernels " |
77 | default n | 77 | default n |
78 | depends on CONFIG_LSMOD | 78 | depends on LSMOD |
79 | help | 79 | help |
80 | This option makes output format of lsmod adjusted to | 80 | This option makes output format of lsmod adjusted to |
81 | the format of module-init-tools for Linux kernel 2.6. | 81 | the format of module-init-tools for Linux kernel 2.6. |
82 | 82 | ||
83 | config CONFIG_MODPROBE | 83 | config MODPROBE |
84 | bool "modprobe" | 84 | bool "modprobe" |
85 | default n | 85 | default n |
86 | help | 86 | help |
@@ -90,11 +90,11 @@ config CONFIG_MODPROBE | |||
90 | Note that in the state, modprobe does not understand multiple | 90 | Note that in the state, modprobe does not understand multiple |
91 | module options from the configuration file. See option below. | 91 | module options from the configuration file. See option below. |
92 | 92 | ||
93 | config CONFIG_FEATURE_MODPROBE_MULTIPLE_OPTIONS | 93 | config FEATURE_MODPROBE_MULTIPLE_OPTIONS |
94 | bool | 94 | bool |
95 | prompt "Multiple options parsing" if CONFIG_NITPICK | 95 | prompt "Multiple options parsing" if NITPICK |
96 | default y | 96 | default y |
97 | depends on CONFIG_MODPROBE | 97 | depends on MODPROBE |
98 | help | 98 | help |
99 | Allow modprobe to understand more than one option to pass to | 99 | Allow modprobe to understand more than one option to pass to |
100 | modules. | 100 | modules. |
@@ -107,51 +107,51 @@ config CONFIG_FEATURE_MODPROBE_MULTIPLE_OPTIONS | |||
107 | Saying Y here is not a bad idea if you're not that short | 107 | Saying Y here is not a bad idea if you're not that short |
108 | on storage capacity. | 108 | on storage capacity. |
109 | 109 | ||
110 | config CONFIG_FEATURE_MODPROBE_FANCY_ALIAS | 110 | config FEATURE_MODPROBE_FANCY_ALIAS |
111 | bool | 111 | bool |
112 | prompt "Fancy alias parsing" if CONFIG_NITPICK | 112 | prompt "Fancy alias parsing" if NITPICK |
113 | default y | 113 | default y |
114 | depends on CONFIG_MODPROBE && CONFIG_FEATURE_2_6_MODULES | 114 | depends on MODPROBE && FEATURE_2_6_MODULES |
115 | help | 115 | help |
116 | Say 'y' here to enable parsing of aliases with underscore/dash | 116 | Say 'y' here to enable parsing of aliases with underscore/dash |
117 | mismatch between module name and file name, along with bus-specific | 117 | mismatch between module name and file name, along with bus-specific |
118 | aliases (such as pci:... or usb:... aliases). | 118 | aliases (such as pci:... or usb:... aliases). |
119 | 119 | ||
120 | comment "Options common to multiple modutils" | 120 | comment "Options common to multiple modutils" |
121 | depends on CONFIG_INSMOD || CONFIG_RMMOD || CONFIG_MODPROBE || CONFIG_LSMOD | 121 | depends on INSMOD || RMMOD || MODPROBE || LSMOD |
122 | 122 | ||
123 | config CONFIG_FEATURE_CHECK_TAINTED_MODULE | 123 | config FEATURE_CHECK_TAINTED_MODULE |
124 | # Simulate indentation | 124 | # Simulate indentation |
125 | bool "Support tainted module checking with new kernels" | 125 | bool "Support tainted module checking with new kernels" |
126 | default y | 126 | default y |
127 | depends on CONFIG_INSMOD || CONFIG_LSMOD | 127 | depends on INSMOD || LSMOD |
128 | help | 128 | help |
129 | Support checking for tainted modules. These are usually binary | 129 | Support checking for tainted modules. These are usually binary |
130 | only modules that will make the linux-kernel list ignore your | 130 | only modules that will make the linux-kernel list ignore your |
131 | support request. | 131 | support request. |
132 | This option is required to support GPLONLY modules. | 132 | This option is required to support GPLONLY modules. |
133 | 133 | ||
134 | config CONFIG_FEATURE_2_4_MODULES | 134 | config FEATURE_2_4_MODULES |
135 | # Simulate indentation | 135 | # Simulate indentation |
136 | bool "Support version 2.2.x to 2.4.x Linux kernels" | 136 | bool "Support version 2.2.x to 2.4.x Linux kernels" |
137 | default y | 137 | default y |
138 | depends on CONFIG_INSMOD || CONFIG_RMMOD | 138 | depends on INSMOD || RMMOD |
139 | help | 139 | help |
140 | Support module loading for 2.2.x and 2.4.x Linux kernels. | 140 | Support module loading for 2.2.x and 2.4.x Linux kernels. |
141 | 141 | ||
142 | config CONFIG_FEATURE_2_6_MODULES | 142 | config FEATURE_2_6_MODULES |
143 | # Simulate indentation | 143 | # Simulate indentation |
144 | bool "Support version 2.6.x Linux kernels" | 144 | bool "Support version 2.6.x Linux kernels" |
145 | default y | 145 | default y |
146 | depends on CONFIG_INSMOD || CONFIG_RMMOD || CONFIG_MODPROBE | 146 | depends on INSMOD || RMMOD || MODPROBE |
147 | help | 147 | help |
148 | Support module loading for newer 2.6.x Linux kernels. | 148 | Support module loading for newer 2.6.x Linux kernels. |
149 | 149 | ||
150 | 150 | ||
151 | config CONFIG_FEATURE_QUERY_MODULE_INTERFACE | 151 | config FEATURE_QUERY_MODULE_INTERFACE |
152 | bool | 152 | bool |
153 | default y | 153 | default y |
154 | depends on CONFIG_FEATURE_2_4_MODULES && !CONFIG_FEATURE_2_6_MODULES | 154 | depends on FEATURE_2_4_MODULES && !FEATURE_2_6_MODULES |
155 | 155 | ||
156 | 156 | ||
157 | endmenu | 157 | endmenu |
diff --git a/modutils/Kbuild b/modutils/Kbuild new file mode 100644 index 000000000..cff02b4f2 --- /dev/null +++ b/modutils/Kbuild | |||
@@ -0,0 +1,11 @@ | |||
1 | # Makefile for busybox | ||
2 | # | ||
3 | # Copyright (C) 1999-2005 by Erik Andersen <andersen@codepoet.org> | ||
4 | # | ||
5 | # Licensed under the GPL v2, see the file LICENSE in this tarball. | ||
6 | |||
7 | lib-y:= | ||
8 | lib-$(CONFIG_INSMOD) += insmod.o | ||
9 | lib-$(CONFIG_LSMOD) += lsmod.o | ||
10 | lib-$(CONFIG_MODPROBE) += modprobe.o | ||
11 | lib-$(CONFIG_RMMOD) += rmmod.o | ||
diff --git a/modutils/Makefile b/modutils/Makefile deleted file mode 100644 index 65090c5a2..000000000 --- a/modutils/Makefile +++ /dev/null | |||
@@ -1,23 +0,0 @@ | |||
1 | # Makefile for busybox | ||
2 | # | ||
3 | # Copyright (C) 1999-2005 by Erik Andersen <andersen@codepoet.org> | ||
4 | # | ||
5 | # Licensed under the GPL v2, see the file LICENSE in this tarball. | ||
6 | |||
7 | ifndef top_srcdir | ||
8 | top_srcdir=.. | ||
9 | endif | ||
10 | ifndef top_builddir | ||
11 | top_builddir=.. | ||
12 | endif | ||
13 | srcdir=$(top_srcdir)/modutils | ||
14 | MODUTILS_DIR:=./ | ||
15 | include $(top_srcdir)/Rules.mak | ||
16 | include $(top_builddir)/.config | ||
17 | include Makefile.in | ||
18 | all: $(libraries-y) | ||
19 | -include $(top_builddir)/.depend | ||
20 | |||
21 | clean: | ||
22 | rm -f *.o *.a $(AR_TARGET) | ||
23 | |||
diff --git a/modutils/Makefile.in b/modutils/Makefile.in deleted file mode 100644 index 5c7c9238e..000000000 --- a/modutils/Makefile.in +++ /dev/null | |||
@@ -1,32 +0,0 @@ | |||
1 | # Makefile for busybox | ||
2 | # | ||
3 | # Copyright (C) 1999-2005 by Erik Andersen <andersen@codepoet.org> | ||
4 | # | ||
5 | # Licensed under the GPL v2, see the file LICENSE in this tarball. | ||
6 | |||
7 | MODUTILS_AR:=modutils.a | ||
8 | ifndef $(MODUTILS_DIR) | ||
9 | MODUTILS_DIR:=$(top_builddir)/modutils/ | ||
10 | endif | ||
11 | srcdir=$(top_srcdir)/modutils | ||
12 | |||
13 | MODUTILS-y:= | ||
14 | MODUTILS-$(CONFIG_INSMOD) += insmod.o | ||
15 | MODUTILS-$(CONFIG_LSMOD) += lsmod.o | ||
16 | MODUTILS-$(CONFIG_MODPROBE) += modprobe.o | ||
17 | MODUTILS-$(CONFIG_RMMOD) += rmmod.o | ||
18 | |||
19 | ifneq ($(strip $(MODUTILS-y)),) | ||
20 | libraries-y+=$(MODUTILS_DIR)$(MODUTILS_AR) | ||
21 | endif | ||
22 | |||
23 | MODUTILS_SRC-y:=$(patsubst %.o,$(srcdir)/%.c,$(MODUTILS-y)) | ||
24 | MODUTILS_SRC-a:=$(wildcard $(srcdir)/*.c) | ||
25 | APPLET_SRC-y+=$(MODUTILS_SRC-y) | ||
26 | APPLET_SRC-a+=$(MODUTILS_SRC-a) | ||
27 | |||
28 | $(MODUTILS_DIR)$(MODUTILS_AR): $(patsubst %,$(MODUTILS_DIR)%, $(MODUTILS-y)) | ||
29 | $(do_ar) | ||
30 | |||
31 | $(MODUTILS_DIR)%.o: $(srcdir)/%.c | ||
32 | $(compile.c) | ||
diff --git a/networking/Config.in b/networking/Config.in index b78ae37e7..f9ea56488 100644 --- a/networking/Config.in +++ b/networking/Config.in | |||
@@ -5,132 +5,132 @@ | |||
5 | 5 | ||
6 | menu "Networking Utilities" | 6 | menu "Networking Utilities" |
7 | 7 | ||
8 | config CONFIG_FEATURE_IPV6 | 8 | config FEATURE_IPV6 |
9 | bool "Enable IPv6 support" | 9 | bool "Enable IPv6 support" |
10 | default n | 10 | default n |
11 | help | 11 | help |
12 | Enable IPv6 support in busybox. | 12 | Enable IPv6 support in busybox. |
13 | This adds IPv6 support in the networking applets. | 13 | This adds IPv6 support in the networking applets. |
14 | 14 | ||
15 | config CONFIG_ARPING | 15 | config ARPING |
16 | bool "arping" | 16 | bool "arping" |
17 | default n | 17 | default n |
18 | help | 18 | help |
19 | Ping hosts by ARP packets | 19 | Ping hosts by ARP packets |
20 | 20 | ||
21 | config CONFIG_DNSD | 21 | config DNSD |
22 | bool "dnsd" | 22 | bool "dnsd" |
23 | default n | 23 | default n |
24 | help | 24 | help |
25 | Small and static DNS server daemon. | 25 | Small and static DNS server daemon. |
26 | 26 | ||
27 | config CONFIG_ETHER_WAKE | 27 | config ETHER_WAKE |
28 | bool "ether-wake" | 28 | bool "ether-wake" |
29 | default n | 29 | default n |
30 | help | 30 | help |
31 | Send a magic packet to wake up sleeping machines. | 31 | Send a magic packet to wake up sleeping machines. |
32 | 32 | ||
33 | config CONFIG_FAKEIDENTD | 33 | config FAKEIDENTD |
34 | bool "fakeidentd" | 34 | bool "fakeidentd" |
35 | default n | 35 | default n |
36 | select CONFIG_FEATURE_SYSLOG | 36 | select FEATURE_SYSLOG |
37 | help | 37 | help |
38 | fakeidentd listens on the ident port and returns a predefined | 38 | fakeidentd listens on the ident port and returns a predefined |
39 | fake value on any query. | 39 | fake value on any query. |
40 | 40 | ||
41 | config CONFIG_FTPGET | 41 | config FTPGET |
42 | bool "ftpget" | 42 | bool "ftpget" |
43 | default n | 43 | default n |
44 | help | 44 | help |
45 | Retrieve a remote file via FTP. | 45 | Retrieve a remote file via FTP. |
46 | 46 | ||
47 | config CONFIG_FTPPUT | 47 | config FTPPUT |
48 | bool "ftpput" | 48 | bool "ftpput" |
49 | default n | 49 | default n |
50 | help | 50 | help |
51 | Store a remote file via FTP. | 51 | Store a remote file via FTP. |
52 | 52 | ||
53 | config CONFIG_FEATURE_FTPGETPUT_LONG_OPTIONS | 53 | config FEATURE_FTPGETPUT_LONG_OPTIONS |
54 | bool "Enable long options in ftpget/ftpput" | 54 | bool "Enable long options in ftpget/ftpput" |
55 | default n | 55 | default n |
56 | depends on CONFIG_GETOPT_LONG && (CONFIG_FTPGET || CONFIG_FTPPUT) | 56 | depends on GETOPT_LONG && (CONFIG_FTPGET || FTPPUT) |
57 | help | 57 | help |
58 | Support long options for the ftpget/ftpput applet. | 58 | Support long options for the ftpget/ftpput applet. |
59 | 59 | ||
60 | config CONFIG_HOSTNAME | 60 | config HOSTNAME |
61 | bool "hostname" | 61 | bool "hostname" |
62 | default n | 62 | default n |
63 | help | 63 | help |
64 | Show or set the system's host name | 64 | Show or set the system's host name |
65 | 65 | ||
66 | config CONFIG_HTTPD | 66 | config HTTPD |
67 | bool "httpd" | 67 | bool "httpd" |
68 | default n | 68 | default n |
69 | help | 69 | help |
70 | Serve web pages via an HTTP server. | 70 | Serve web pages via an HTTP server. |
71 | 71 | ||
72 | config CONFIG_FEATURE_HTTPD_WITHOUT_INETD | 72 | config FEATURE_HTTPD_WITHOUT_INETD |
73 | bool "Support using httpd as a daemon (not from inetd)" | 73 | bool "Support using httpd as a daemon (not from inetd)" |
74 | default n | 74 | default n |
75 | depends on CONFIG_HTTPD | 75 | depends on HTTPD |
76 | help | 76 | help |
77 | This option enables uid and port options for the httpd applet, | 77 | This option enables uid and port options for the httpd applet, |
78 | and eliminates the need to be called from the inetd server daemon. | 78 | and eliminates the need to be called from the inetd server daemon. |
79 | 79 | ||
80 | config CONFIG_FEATURE_HTTPD_RELOAD_CONFIG_SIGHUP | 80 | config FEATURE_HTTPD_RELOAD_CONFIG_SIGHUP |
81 | bool "Support reloading the global config file using hup signal" | 81 | bool "Support reloading the global config file using hup signal" |
82 | default n | 82 | default n |
83 | depends on CONFIG_HTTPD && CONFIG_FEATURE_HTTPD_WITHOUT_INETD | 83 | depends on HTTPD && FEATURE_HTTPD_WITHOUT_INETD |
84 | help | 84 | help |
85 | This option enables processing of SIGHUP to reload cached | 85 | This option enables processing of SIGHUP to reload cached |
86 | configuration settings. | 86 | configuration settings. |
87 | 87 | ||
88 | config CONFIG_FEATURE_HTTPD_SETUID | 88 | config FEATURE_HTTPD_SETUID |
89 | bool "Enable support -u <user> option" | 89 | bool "Enable support -u <user> option" |
90 | default n | 90 | default n |
91 | depends on CONFIG_HTTPD && CONFIG_FEATURE_HTTPD_WITHOUT_INETD | 91 | depends on HTTPD && FEATURE_HTTPD_WITHOUT_INETD |
92 | help | 92 | help |
93 | This option allows the server to run as a specific user | 93 | This option allows the server to run as a specific user |
94 | rather than defaulting to the user that starts the server. | 94 | rather than defaulting to the user that starts the server. |
95 | Use of this option requires special privileges to change to a | 95 | Use of this option requires special privileges to change to a |
96 | different user. | 96 | different user. |
97 | 97 | ||
98 | config CONFIG_FEATURE_HTTPD_BASIC_AUTH | 98 | config FEATURE_HTTPD_BASIC_AUTH |
99 | bool "Enable Basic http Authentication" | 99 | bool "Enable Basic http Authentication" |
100 | default y | 100 | default y |
101 | depends on CONFIG_HTTPD | 101 | depends on HTTPD |
102 | help | 102 | help |
103 | Utilizes password settings from /etc/httpd.conf for basic | 103 | Utilizes password settings from /etc/httpd.conf for basic |
104 | authentication on a per url basis. | 104 | authentication on a per url basis. |
105 | 105 | ||
106 | config CONFIG_FEATURE_HTTPD_AUTH_MD5 | 106 | config FEATURE_HTTPD_AUTH_MD5 |
107 | bool "Support MD5 crypted passwords for http Authentication" | 107 | bool "Support MD5 crypted passwords for http Authentication" |
108 | default n | 108 | default n |
109 | depends on CONFIG_FEATURE_HTTPD_BASIC_AUTH | 109 | depends on FEATURE_HTTPD_BASIC_AUTH |
110 | help | 110 | help |
111 | Enables basic per URL authentication from /etc/httpd.conf | 111 | Enables basic per URL authentication from /etc/httpd.conf |
112 | using md5 passwords. | 112 | using md5 passwords. |
113 | 113 | ||
114 | config CONFIG_FEATURE_HTTPD_CONFIG_WITH_MIME_TYPES | 114 | config FEATURE_HTTPD_CONFIG_WITH_MIME_TYPES |
115 | bool "Support loading additional MIME types at run-time" | 115 | bool "Support loading additional MIME types at run-time" |
116 | default n | 116 | default n |
117 | depends on CONFIG_HTTPD | 117 | depends on HTTPD |
118 | help | 118 | help |
119 | This option enables support for additional MIME types at | 119 | This option enables support for additional MIME types at |
120 | run-time to be specified in the configuration file. | 120 | run-time to be specified in the configuration file. |
121 | 121 | ||
122 | config CONFIG_FEATURE_HTTPD_CGI | 122 | config FEATURE_HTTPD_CGI |
123 | bool "Support Common Gateway Interface (CGI)" | 123 | bool "Support Common Gateway Interface (CGI)" |
124 | default y | 124 | default y |
125 | depends on CONFIG_HTTPD | 125 | depends on HTTPD |
126 | help | 126 | help |
127 | This option allows scripts and executables to be invoked | 127 | This option allows scripts and executables to be invoked |
128 | when specific URLs are requested. | 128 | when specific URLs are requested. |
129 | 129 | ||
130 | config CONFIG_FEATURE_HTTPD_CONFIG_WITH_SCRIPT_INTERPR | 130 | config FEATURE_HTTPD_CONFIG_WITH_SCRIPT_INTERPR |
131 | bool "Enable support for running scripts through an interpreter" | 131 | bool "Enable support for running scripts through an interpreter" |
132 | default n | 132 | default n |
133 | depends on CONFIG_FEATURE_HTTPD_CGI | 133 | depends on FEATURE_HTTPD_CGI |
134 | help | 134 | help |
135 | This option enables support for running scripts through an | 135 | This option enables support for running scripts through an |
136 | interpreter. Turn this on if you want PHP scripts to work | 136 | interpreter. Turn this on if you want PHP scripts to work |
@@ -138,81 +138,81 @@ config CONFIG_FEATURE_HTTPD_CONFIG_WITH_SCRIPT_INTERPR | |||
138 | config file: | 138 | config file: |
139 | *.php:/path/to/your/php | 139 | *.php:/path/to/your/php |
140 | 140 | ||
141 | config CONFIG_FEATURE_HTTPD_SET_REMOTE_PORT_TO_ENV | 141 | config FEATURE_HTTPD_SET_REMOTE_PORT_TO_ENV |
142 | bool "Support the REMOTE_PORT environment variable for CGI" | 142 | bool "Support the REMOTE_PORT environment variable for CGI" |
143 | default n | 143 | default n |
144 | depends on CONFIG_FEATURE_HTTPD_CGI | 144 | depends on FEATURE_HTTPD_CGI |
145 | help | 145 | help |
146 | Use of this option can assist scripts in generating | 146 | Use of this option can assist scripts in generating |
147 | references that contain a unique port number. | 147 | references that contain a unique port number. |
148 | 148 | ||
149 | config CONFIG_FEATURE_HTTPD_ENCODE_URL_STR | 149 | config FEATURE_HTTPD_ENCODE_URL_STR |
150 | bool "Enable the -e option for shell script CGI simplification." | 150 | bool "Enable the -e option for shell script CGI simplification." |
151 | default y | 151 | default y |
152 | depends on CONFIG_HTTPD | 152 | depends on HTTPD |
153 | help | 153 | help |
154 | This option allows html encoding arbitrary | 154 | This option allows html encoding arbitrary |
155 | strings for display of the browser. Output goes to stdout. | 155 | strings for display of the browser. Output goes to stdout. |
156 | For example, httpd -e "<Hello World>" as | 156 | For example, httpd -e "<Hello World>" as |
157 | "<Hello World>". | 157 | "<Hello World>". |
158 | 158 | ||
159 | config CONFIG_IFCONFIG | 159 | config IFCONFIG |
160 | bool "ifconfig" | 160 | bool "ifconfig" |
161 | default n | 161 | default n |
162 | help | 162 | help |
163 | Ifconfig is used to configure the kernel-resident network interfaces. | 163 | Ifconfig is used to configure the kernel-resident network interfaces. |
164 | 164 | ||
165 | config CONFIG_FEATURE_IFCONFIG_STATUS | 165 | config FEATURE_IFCONFIG_STATUS |
166 | bool "Enable status reporting output (+7k)" | 166 | bool "Enable status reporting output (+7k)" |
167 | default y | 167 | default y |
168 | depends on CONFIG_IFCONFIG | 168 | depends on IFCONFIG |
169 | help | 169 | help |
170 | If ifconfig is called with no arguments it will display the status | 170 | If ifconfig is called with no arguments it will display the status |
171 | of the currently active interfaces. | 171 | of the currently active interfaces. |
172 | 172 | ||
173 | config CONFIG_FEATURE_IFCONFIG_SLIP | 173 | config FEATURE_IFCONFIG_SLIP |
174 | bool "Enable slip-specific options \"keepalive\" and \"outfill\"" | 174 | bool "Enable slip-specific options \"keepalive\" and \"outfill\"" |
175 | default n | 175 | default n |
176 | depends on CONFIG_IFCONFIG | 176 | depends on IFCONFIG |
177 | help | 177 | help |
178 | Allow "keepalive" and "outfill" support for SLIP. If you're not | 178 | Allow "keepalive" and "outfill" support for SLIP. If you're not |
179 | planning on using serial lines, leave this unchecked. | 179 | planning on using serial lines, leave this unchecked. |
180 | 180 | ||
181 | config CONFIG_FEATURE_IFCONFIG_MEMSTART_IOADDR_IRQ | 181 | config FEATURE_IFCONFIG_MEMSTART_IOADDR_IRQ |
182 | bool "Enable options \"mem_start\", \"io_addr\", and \"irq\"" | 182 | bool "Enable options \"mem_start\", \"io_addr\", and \"irq\"" |
183 | default n | 183 | default n |
184 | depends on CONFIG_IFCONFIG | 184 | depends on IFCONFIG |
185 | help | 185 | help |
186 | Allow the start address for shared memory, start address for I/O, | 186 | Allow the start address for shared memory, start address for I/O, |
187 | and/or the interrupt line used by the specified device. | 187 | and/or the interrupt line used by the specified device. |
188 | 188 | ||
189 | config CONFIG_FEATURE_IFCONFIG_HW | 189 | config FEATURE_IFCONFIG_HW |
190 | bool "Enable option \"hw\" (ether only)" | 190 | bool "Enable option \"hw\" (ether only)" |
191 | default y | 191 | default y |
192 | depends on CONFIG_IFCONFIG | 192 | depends on IFCONFIG |
193 | help | 193 | help |
194 | Set the hardware address of this interface, if the device driver | 194 | Set the hardware address of this interface, if the device driver |
195 | supports this operation. Currently, we only support the 'ether' | 195 | supports this operation. Currently, we only support the 'ether' |
196 | class. | 196 | class. |
197 | 197 | ||
198 | config CONFIG_FEATURE_IFCONFIG_BROADCAST_PLUS | 198 | config FEATURE_IFCONFIG_BROADCAST_PLUS |
199 | bool "Set the broadcast automatically" | 199 | bool "Set the broadcast automatically" |
200 | default n | 200 | default n |
201 | depends on CONFIG_IFCONFIG | 201 | depends on IFCONFIG |
202 | help | 202 | help |
203 | Setting this will make ifconfig attempt to find the broadcast | 203 | Setting this will make ifconfig attempt to find the broadcast |
204 | automatically if the value '+' is used. | 204 | automatically if the value '+' is used. |
205 | 205 | ||
206 | config CONFIG_IFUPDOWN | 206 | config IFUPDOWN |
207 | bool "ifupdown" | 207 | bool "ifupdown" |
208 | default n | 208 | default n |
209 | select CONFIG_RUN_PARTS | 209 | select RUN_PARTS |
210 | help | 210 | help |
211 | Activate or deactivate the specified interfaces. This applet makes | 211 | Activate or deactivate the specified interfaces. This applet makes |
212 | use of either "ifconfig" and "route" or the "ip" command to actually | 212 | use of either "ifconfig" and "route" or the "ip" command to actually |
213 | configure network interfaces. Therefore, you will probably also want | 213 | configure network interfaces. Therefore, you will probably also want |
214 | to enable either CONFIG_IFCONFIG and CONFIG_ROUTE, or enable | 214 | to enable either IFCONFIG and ROUTE, or enable |
215 | CONFIG_FEATURE_IFUPDOWN_IP and the various CONFIG_IP options. Of | 215 | FEATURE_IFUPDOWN_IP and the various IP options. Of |
216 | course you could use non-busybox versions of these programs, so | 216 | course you could use non-busybox versions of these programs, so |
217 | against my better judgement (since this will surely result in plenty | 217 | against my better judgement (since this will surely result in plenty |
218 | of support questions on the mailing list), I do not force you to | 218 | of support questions on the mailing list), I do not force you to |
@@ -220,34 +220,34 @@ config CONFIG_IFUPDOWN | |||
220 | "ifconfig" and "route" or the "ip" command, either via busybox or via | 220 | "ifconfig" and "route" or the "ip" command, either via busybox or via |
221 | standalone utilities. | 221 | standalone utilities. |
222 | 222 | ||
223 | config CONFIG_FEATURE_IFUPDOWN_IP | 223 | config FEATURE_IFUPDOWN_IP |
224 | bool "Use ip applet" | 224 | bool "Use ip applet" |
225 | default n | 225 | default n |
226 | depends on CONFIG_IFUPDOWN | 226 | depends on IFUPDOWN |
227 | help | 227 | help |
228 | Use the iproute "ip" command to implement "ifup" and "ifdown", rather | 228 | Use the iproute "ip" command to implement "ifup" and "ifdown", rather |
229 | than the default of using the older 'ifconfig' and 'route' utilities. | 229 | than the default of using the older 'ifconfig' and 'route' utilities. |
230 | 230 | ||
231 | config CONFIG_FEATURE_IFUPDOWN_IP_BUILTIN | 231 | config FEATURE_IFUPDOWN_IP_BUILTIN |
232 | bool "Use busybox ip applet" | 232 | bool "Use busybox ip applet" |
233 | default y | 233 | default y |
234 | depends on CONFIG_FEATURE_IFUPDOWN_IP | 234 | depends on FEATURE_IFUPDOWN_IP |
235 | select CONFIG_IP | 235 | select IP |
236 | select CONFIG_FEATURE_IP_ADDRESS | 236 | select FEATURE_IP_ADDRESS |
237 | select CONFIG_FEATURE_IP_LINK | 237 | select FEATURE_IP_LINK |
238 | select CONFIG_FEATURE_IP_ROUTE | 238 | select FEATURE_IP_ROUTE |
239 | help | 239 | help |
240 | Use the busybox iproute "ip" applet to implement "ifupdown". | 240 | Use the busybox iproute "ip" applet to implement "ifupdown". |
241 | 241 | ||
242 | If leave this disabled, you must install the full-blown iproute2 | 242 | If leave this disabled, you must install the full-blown iproute2 |
243 | utility or the "ifup" and "ifdown" applets will not work. | 243 | utility or the "ifup" and "ifdown" applets will not work. |
244 | 244 | ||
245 | config CONFIG_FEATURE_IFUPDOWN_IP_BUILTIN | 245 | config FEATURE_IFUPDOWN_IP_BUILTIN |
246 | bool "Use busybox ifconfig and route applets" | 246 | bool "Use busybox ifconfig and route applets" |
247 | default y | 247 | default y |
248 | depends on CONFIG_IFUPDOWN && !CONFIG_FEATURE_IFUPDOWN_IP | 248 | depends on IFUPDOWN && !CONFIG_FEATURE_IFUPDOWN_IP |
249 | select CONFIG_IFCONFIG | 249 | select IFCONFIG |
250 | select CONFIG_ROUTE | 250 | select ROUTE |
251 | help | 251 | help |
252 | Use the busybox iproute "ifconfig" and "route" applets to | 252 | Use the busybox iproute "ifconfig" and "route" applets to |
253 | implement the "ifup" and "ifdown" utilities. | 253 | implement the "ifup" and "ifdown" utilities. |
@@ -256,87 +256,87 @@ config CONFIG_FEATURE_IFUPDOWN_IP_BUILTIN | |||
256 | and route utilities, or the "ifup" and "ifdown" applets will not | 256 | and route utilities, or the "ifup" and "ifdown" applets will not |
257 | work. | 257 | work. |
258 | 258 | ||
259 | config CONFIG_FEATURE_IFUPDOWN_IPV4 | 259 | config FEATURE_IFUPDOWN_IPV4 |
260 | bool "Enable support for IPv4" | 260 | bool "Enable support for IPv4" |
261 | default y | 261 | default y |
262 | depends on CONFIG_IFUPDOWN | 262 | depends on IFUPDOWN |
263 | help | 263 | help |
264 | If you want busybox to talk IPv4, leave this on. | 264 | If you want busybox to talk IPv4, leave this on. |
265 | 265 | ||
266 | config CONFIG_FEATURE_IFUPDOWN_IPV6 | 266 | config FEATURE_IFUPDOWN_IPV6 |
267 | bool "Enable support for IPv6" | 267 | bool "Enable support for IPv6" |
268 | default n | 268 | default n |
269 | depends on CONFIG_IFUPDOWN && CONFIG_FEATURE_IPV6 | 269 | depends on IFUPDOWN && FEATURE_IPV6 |
270 | help | 270 | help |
271 | If you need support for IPv6, turn this option on. | 271 | If you need support for IPv6, turn this option on. |
272 | 272 | ||
273 | config CONFIG_FEATURE_IFUPDOWN_IPX | 273 | config FEATURE_IFUPDOWN_IPX |
274 | bool "Enable support for IPX" | 274 | bool "Enable support for IPX" |
275 | default n | 275 | default n |
276 | depends on CONFIG_IFUPDOWN | 276 | depends on IFUPDOWN |
277 | help | 277 | help |
278 | If this option is selected you can use busybox to work with IPX | 278 | If this option is selected you can use busybox to work with IPX |
279 | networks. | 279 | networks. |
280 | 280 | ||
281 | config CONFIG_FEATURE_IFUPDOWN_MAPPING | 281 | config FEATURE_IFUPDOWN_MAPPING |
282 | bool "Enable mapping support" | 282 | bool "Enable mapping support" |
283 | default n | 283 | default n |
284 | depends on CONFIG_IFUPDOWN | 284 | depends on IFUPDOWN |
285 | help | 285 | help |
286 | This enables support for the "mapping" stanza, unless you have | 286 | This enables support for the "mapping" stanza, unless you have |
287 | a weird network setup you don't need it. | 287 | a weird network setup you don't need it. |
288 | 288 | ||
289 | config CONFIG_INETD | 289 | config INETD |
290 | bool "inetd" | 290 | bool "inetd" |
291 | default n | 291 | default n |
292 | select CONFIG_FEATURE_SYSLOG | 292 | select FEATURE_SYSLOG |
293 | help | 293 | help |
294 | Internet superserver daemon | 294 | Internet superserver daemon |
295 | 295 | ||
296 | config CONFIG_FEATURE_INETD_SUPPORT_BUILTIN_ECHO | 296 | config FEATURE_INETD_SUPPORT_BUILTIN_ECHO |
297 | bool "Support echo service" | 297 | bool "Support echo service" |
298 | default y | 298 | default y |
299 | depends on CONFIG_INETD | 299 | depends on INETD |
300 | help | 300 | help |
301 | Echo received data internal inetd service | 301 | Echo received data internal inetd service |
302 | 302 | ||
303 | config CONFIG_FEATURE_INETD_SUPPORT_BUILTIN_DISCARD | 303 | config FEATURE_INETD_SUPPORT_BUILTIN_DISCARD |
304 | bool "Support discard service" | 304 | bool "Support discard service" |
305 | default y | 305 | default y |
306 | depends on CONFIG_INETD | 306 | depends on INETD |
307 | help | 307 | help |
308 | Internet /dev/null internal inetd service | 308 | Internet /dev/null internal inetd service |
309 | 309 | ||
310 | config CONFIG_FEATURE_INETD_SUPPORT_BUILTIN_TIME | 310 | config FEATURE_INETD_SUPPORT_BUILTIN_TIME |
311 | bool "Support time service" | 311 | bool "Support time service" |
312 | default y | 312 | default y |
313 | depends on CONFIG_INETD | 313 | depends on INETD |
314 | help | 314 | help |
315 | Return 32 bit time since 1900 internal inetd service | 315 | Return 32 bit time since 1900 internal inetd service |
316 | 316 | ||
317 | config CONFIG_FEATURE_INETD_SUPPORT_BUILTIN_DAYTIME | 317 | config FEATURE_INETD_SUPPORT_BUILTIN_DAYTIME |
318 | bool "Support daytime service" | 318 | bool "Support daytime service" |
319 | default y | 319 | default y |
320 | depends on CONFIG_INETD | 320 | depends on INETD |
321 | help | 321 | help |
322 | Return human-readable time internal inetd service | 322 | Return human-readable time internal inetd service |
323 | 323 | ||
324 | config CONFIG_FEATURE_INETD_SUPPORT_BUILTIN_CHARGEN | 324 | config FEATURE_INETD_SUPPORT_BUILTIN_CHARGEN |
325 | bool "Support chargen service" | 325 | bool "Support chargen service" |
326 | default y | 326 | default y |
327 | depends on CONFIG_INETD | 327 | depends on INETD |
328 | help | 328 | help |
329 | Familiar character generator internal inetd service | 329 | Familiar character generator internal inetd service |
330 | 330 | ||
331 | config CONFIG_FEATURE_INETD_RPC | 331 | config FEATURE_INETD_RPC |
332 | bool "Support RPC services" | 332 | bool "Support RPC services" |
333 | default n | 333 | default n |
334 | depends on CONFIG_INETD | 334 | depends on INETD |
335 | help | 335 | help |
336 | Suuport Sun-RPC based services | 336 | Suuport Sun-RPC based services |
337 | 337 | ||
338 | 338 | ||
339 | config CONFIG_IP | 339 | config IP |
340 | bool "ip" | 340 | bool "ip" |
341 | default n | 341 | default n |
342 | help | 342 | help |
@@ -344,38 +344,38 @@ config CONFIG_IP | |||
344 | utility. You generally don't need "ip" to use busybox with | 344 | utility. You generally don't need "ip" to use busybox with |
345 | TCP/IP. | 345 | TCP/IP. |
346 | 346 | ||
347 | config CONFIG_FEATURE_IP_ADDRESS | 347 | config FEATURE_IP_ADDRESS |
348 | bool "ip address" | 348 | bool "ip address" |
349 | default y | 349 | default y |
350 | depends on CONFIG_IP | 350 | depends on IP |
351 | help | 351 | help |
352 | Address manipulation support for the "ip" applet. | 352 | Address manipulation support for the "ip" applet. |
353 | 353 | ||
354 | config CONFIG_FEATURE_IP_LINK | 354 | config FEATURE_IP_LINK |
355 | bool "ip link" | 355 | bool "ip link" |
356 | default y | 356 | default y |
357 | depends on CONFIG_IP | 357 | depends on IP |
358 | help | 358 | help |
359 | Configure network devices with "ip". | 359 | Configure network devices with "ip". |
360 | 360 | ||
361 | config CONFIG_FEATURE_IP_ROUTE | 361 | config FEATURE_IP_ROUTE |
362 | bool "ip route" | 362 | bool "ip route" |
363 | default y | 363 | default y |
364 | depends on CONFIG_IP | 364 | depends on IP |
365 | help | 365 | help |
366 | Add support for routing table management to "ip". | 366 | Add support for routing table management to "ip". |
367 | 367 | ||
368 | config CONFIG_FEATURE_IP_TUNNEL | 368 | config FEATURE_IP_TUNNEL |
369 | bool "ip tunnel" | 369 | bool "ip tunnel" |
370 | default n | 370 | default n |
371 | depends on CONFIG_IP | 371 | depends on IP |
372 | help | 372 | help |
373 | Add support for tunneling commands to "ip". | 373 | Add support for tunneling commands to "ip". |
374 | 374 | ||
375 | config CONFIG_FEATURE_IP_SHORT_FORMS | 375 | config FEATURE_IP_SHORT_FORMS |
376 | bool "Support short forms of ip commands." | 376 | bool "Support short forms of ip commands." |
377 | default n | 377 | default n |
378 | depends on CONFIG_IP | 378 | depends on IP |
379 | help | 379 | help |
380 | Also support short-form of ip <OBJECT> commands: | 380 | Also support short-form of ip <OBJECT> commands: |
381 | ip addr -> ipaddr | 381 | ip addr -> ipaddr |
@@ -386,51 +386,51 @@ config CONFIG_FEATURE_IP_SHORT_FORMS | |||
386 | Say N unless you desparately need the short form of the ip | 386 | Say N unless you desparately need the short form of the ip |
387 | object commands. | 387 | object commands. |
388 | 388 | ||
389 | config CONFIG_IPADDR | 389 | config IPADDR |
390 | bool | 390 | bool |
391 | default y | 391 | default y |
392 | depends on CONFIG_FEATURE_IP_SHORT_FORMS && CONFIG_FEATURE_IP_ADDRESS | 392 | depends on FEATURE_IP_SHORT_FORMS && FEATURE_IP_ADDRESS |
393 | 393 | ||
394 | config CONFIG_IPLINK | 394 | config IPLINK |
395 | bool | 395 | bool |
396 | default y | 396 | default y |
397 | depends on CONFIG_FEATURE_IP_SHORT_FORMS && CONFIG_FEATURE_IP_LINK | 397 | depends on FEATURE_IP_SHORT_FORMS && FEATURE_IP_LINK |
398 | 398 | ||
399 | config CONFIG_IPROUTE | 399 | config IPROUTE |
400 | bool | 400 | bool |
401 | default y | 401 | default y |
402 | depends on CONFIG_FEATURE_IP_SHORT_FORMS && CONFIG_FEATURE_IP_ROUTE | 402 | depends on FEATURE_IP_SHORT_FORMS && FEATURE_IP_ROUTE |
403 | 403 | ||
404 | config CONFIG_IPTUNNEL | 404 | config IPTUNNEL |
405 | bool | 405 | bool |
406 | default y | 406 | default y |
407 | depends on CONFIG_FEATURE_IP_SHORT_FORMS && CONFIG_FEATURE_IP_TUNNEL | 407 | depends on FEATURE_IP_SHORT_FORMS && FEATURE_IP_TUNNEL |
408 | 408 | ||
409 | config CONFIG_IPCALC | 409 | config IPCALC |
410 | bool "ipcalc" | 410 | bool "ipcalc" |
411 | default n | 411 | default n |
412 | help | 412 | help |
413 | ipcalc takes an IP address and netmask and calculates the | 413 | ipcalc takes an IP address and netmask and calculates the |
414 | resulting broadcast, network, and host range. | 414 | resulting broadcast, network, and host range. |
415 | 415 | ||
416 | config CONFIG_FEATURE_IPCALC_FANCY | 416 | config FEATURE_IPCALC_FANCY |
417 | bool "Fancy IPCALC, more options, adds 1 kbyte" | 417 | bool "Fancy IPCALC, more options, adds 1 kbyte" |
418 | default y | 418 | default y |
419 | depends on CONFIG_IPCALC | 419 | depends on IPCALC |
420 | help | 420 | help |
421 | Adds the options hostname, prefix and silent to the output of "ipcalc". | 421 | Adds the options hostname, prefix and silent to the output of "ipcalc". |
422 | 422 | ||
423 | config CONFIG_FEATURE_IPCALC_LONG_OPTIONS | 423 | config FEATURE_IPCALC_LONG_OPTIONS |
424 | bool "Enable long options" | 424 | bool "Enable long options" |
425 | default n | 425 | default n |
426 | depends on CONFIG_IPCALC && CONFIG_GETOPT_LONG | 426 | depends on IPCALC && GETOPT_LONG |
427 | help | 427 | help |
428 | Support long options for the ipcalc applet. | 428 | Support long options for the ipcalc applet. |
429 | 429 | ||
430 | config CONFIG_NAMEIF | 430 | config NAMEIF |
431 | bool "nameif" | 431 | bool "nameif" |
432 | default n | 432 | default n |
433 | select CONFIG_FEATURE_SYSLOG | 433 | select FEATURE_SYSLOG |
434 | help | 434 | help |
435 | nameif is used to rename network interface by its MAC address. | 435 | nameif is used to rename network interface by its MAC address. |
436 | Renamed interfaces MUST be in the down state. | 436 | Renamed interfaces MUST be in the down state. |
@@ -442,107 +442,107 @@ config CONFIG_NAMEIF | |||
442 | # Comment | 442 | # Comment |
443 | new_interface_name XX:XX:XX:XX:XX:XX | 443 | new_interface_name XX:XX:XX:XX:XX:XX |
444 | 444 | ||
445 | config CONFIG_NC | 445 | config NC |
446 | bool "nc" | 446 | bool "nc" |
447 | default n | 447 | default n |
448 | help | 448 | help |
449 | A simple Unix utility which reads and writes data across network | 449 | A simple Unix utility which reads and writes data across network |
450 | connections. | 450 | connections. |
451 | 451 | ||
452 | config CONFIG_NC_SERVER | 452 | config NC_SERVER |
453 | bool "Netcat server options (-lp)" | 453 | bool "Netcat server options (-lp)" |
454 | default n | 454 | default n |
455 | depends on CONFIG_NC | 455 | depends on NC |
456 | help | 456 | help |
457 | Allow netcat to act as a server. | 457 | Allow netcat to act as a server. |
458 | 458 | ||
459 | config CONFIG_NC_EXTRA | 459 | config NC_EXTRA |
460 | bool "Netcat extensions (-eiw and filename)" | 460 | bool "Netcat extensions (-eiw and filename)" |
461 | default n | 461 | default n |
462 | depends on CONFIG_NC | 462 | depends on NC |
463 | help | 463 | help |
464 | Add -e (support for executing the rest of the command line after | 464 | Add -e (support for executing the rest of the command line after |
465 | making or receiving a successful connection), -i (delay interval for | 465 | making or receiving a successful connection), -i (delay interval for |
466 | lines sent), -w (timeout for initial connection). | 466 | lines sent), -w (timeout for initial connection). |
467 | 467 | ||
468 | config CONFIG_NETSTAT | 468 | config NETSTAT |
469 | bool "netstat" | 469 | bool "netstat" |
470 | default n | 470 | default n |
471 | help | 471 | help |
472 | netstat prints information about the Linux networking subsystem. | 472 | netstat prints information about the Linux networking subsystem. |
473 | 473 | ||
474 | config CONFIG_NSLOOKUP | 474 | config NSLOOKUP |
475 | bool "nslookup" | 475 | bool "nslookup" |
476 | default n | 476 | default n |
477 | help | 477 | help |
478 | nslookup is a tool to query Internet name servers. | 478 | nslookup is a tool to query Internet name servers. |
479 | 479 | ||
480 | config CONFIG_PING | 480 | config PING |
481 | bool "ping" | 481 | bool "ping" |
482 | default n | 482 | default n |
483 | help | 483 | help |
484 | ping uses the ICMP protocol's mandatory ECHO_REQUEST datagram to | 484 | ping uses the ICMP protocol's mandatory ECHO_REQUEST datagram to |
485 | elicit an ICMP ECHO_RESPONSE from a host or gateway. | 485 | elicit an ICMP ECHO_RESPONSE from a host or gateway. |
486 | 486 | ||
487 | config CONFIG_FEATURE_FANCY_PING | 487 | config FEATURE_FANCY_PING |
488 | bool "Enable fancy ping output" | 488 | bool "Enable fancy ping output" |
489 | default y | 489 | default y |
490 | depends on CONFIG_PING | 490 | depends on PING |
491 | help | 491 | help |
492 | Make the output from the ping applet include statistics, and at the | 492 | Make the output from the ping applet include statistics, and at the |
493 | same time provide full support for ICMP packets. | 493 | same time provide full support for ICMP packets. |
494 | 494 | ||
495 | config CONFIG_PING6 | 495 | config PING6 |
496 | bool "ping6" | 496 | bool "ping6" |
497 | default n | 497 | default n |
498 | depends on CONFIG_FEATURE_IPV6 | 498 | depends on FEATURE_IPV6 |
499 | help | 499 | help |
500 | This will give you a ping that can talk IPv6. | 500 | This will give you a ping that can talk IPv6. |
501 | 501 | ||
502 | config CONFIG_FEATURE_FANCY_PING6 | 502 | config FEATURE_FANCY_PING6 |
503 | bool "Enable fancy ping6 output" | 503 | bool "Enable fancy ping6 output" |
504 | default y | 504 | default y |
505 | depends on CONFIG_PING6 | 505 | depends on PING6 |
506 | help | 506 | help |
507 | Make the output from the ping6 applet include statistics, and at the | 507 | Make the output from the ping6 applet include statistics, and at the |
508 | same time provide full support for ICMP packets. | 508 | same time provide full support for ICMP packets. |
509 | 509 | ||
510 | config CONFIG_ROUTE | 510 | config ROUTE |
511 | bool "route" | 511 | bool "route" |
512 | default n | 512 | default n |
513 | help | 513 | help |
514 | Route displays or manipulates the kernel's IP routing tables. | 514 | Route displays or manipulates the kernel's IP routing tables. |
515 | 515 | ||
516 | config CONFIG_TELNET | 516 | config TELNET |
517 | bool "telnet" | 517 | bool "telnet" |
518 | default n | 518 | default n |
519 | help | 519 | help |
520 | Telnet is an interface to the TELNET protocol, but is also commonly | 520 | Telnet is an interface to the TELNET protocol, but is also commonly |
521 | used to test other simple protocols. | 521 | used to test other simple protocols. |
522 | 522 | ||
523 | config CONFIG_FEATURE_TELNET_TTYPE | 523 | config FEATURE_TELNET_TTYPE |
524 | bool "Pass TERM type to remote host" | 524 | bool "Pass TERM type to remote host" |
525 | default y | 525 | default y |
526 | depends on CONFIG_TELNET | 526 | depends on TELNET |
527 | help | 527 | help |
528 | Setting this option will forward the TERM environment variable to the | 528 | Setting this option will forward the TERM environment variable to the |
529 | remote host you are connecting to. This is useful to make sure that | 529 | remote host you are connecting to. This is useful to make sure that |
530 | things like ANSI colors and other control sequences behave. | 530 | things like ANSI colors and other control sequences behave. |
531 | 531 | ||
532 | config CONFIG_FEATURE_TELNET_AUTOLOGIN | 532 | config FEATURE_TELNET_AUTOLOGIN |
533 | bool "Pass USER type to remote host" | 533 | bool "Pass USER type to remote host" |
534 | default y | 534 | default y |
535 | depends on CONFIG_TELNET | 535 | depends on TELNET |
536 | help | 536 | help |
537 | Setting this option will forward the USER environment variable to the | 537 | Setting this option will forward the USER environment variable to the |
538 | remote host you are connecting to. This is useful when you need to | 538 | remote host you are connecting to. This is useful when you need to |
539 | log into a machine without telling the username (autologin). This | 539 | log into a machine without telling the username (autologin). This |
540 | option enables `-a' and `-l USER' arguments. | 540 | option enables `-a' and `-l USER' arguments. |
541 | 541 | ||
542 | config CONFIG_TELNETD | 542 | config TELNETD |
543 | bool "telnetd" | 543 | bool "telnetd" |
544 | default n | 544 | default n |
545 | select CONFIG_FEATURE_SYSLOG | 545 | select FEATURE_SYSLOG |
546 | help | 546 | help |
547 | A daemon for the TELNET protocol, allowing you to log onto the host | 547 | A daemon for the TELNET protocol, allowing you to log onto the host |
548 | running the daemon. Please keep in mind that the TELNET protocol | 548 | running the daemon. Please keep in mind that the TELNET protocol |
@@ -554,8 +554,8 @@ config CONFIG_TELNETD | |||
554 | 554 | ||
555 | Note that for busybox telnetd to work you need several things: | 555 | Note that for busybox telnetd to work you need several things: |
556 | First of all, your kernel needs: | 556 | First of all, your kernel needs: |
557 | CONFIG_UNIX98_PTYS=y | 557 | UNIX98_PTYS=y |
558 | CONFIG_DEVPTS_FS=y | 558 | DEVPTS_FS=y |
559 | 559 | ||
560 | Next, you need a /dev/pts directory on your root filesystem: | 560 | Next, you need a /dev/pts directory on your root filesystem: |
561 | 561 | ||
@@ -572,8 +572,8 @@ config CONFIG_TELNETD | |||
572 | 572 | ||
573 | mount -t devpts devpts /dev/pts | 573 | mount -t devpts devpts /dev/pts |
574 | 574 | ||
575 | You need to be sure that Busybox has CONFIG_LOGIN and | 575 | You need to be sure that Busybox has LOGIN and |
576 | CONFIG_FEATURE_SUID enabled. And finally, you should make | 576 | FEATURE_SUID enabled. And finally, you should make |
577 | certain that Busybox has been installed setuid root: | 577 | certain that Busybox has been installed setuid root: |
578 | 578 | ||
579 | chown root.root /bin/busybox | 579 | chown root.root /bin/busybox |
@@ -582,15 +582,15 @@ config CONFIG_TELNETD | |||
582 | with all that done, telnetd _should_ work.... | 582 | with all that done, telnetd _should_ work.... |
583 | 583 | ||
584 | 584 | ||
585 | config CONFIG_FEATURE_TELNETD_INETD | 585 | config FEATURE_TELNETD_INETD |
586 | bool "Support call from inetd only" | 586 | bool "Support call from inetd only" |
587 | default n | 587 | default n |
588 | depends on CONFIG_TELNETD | 588 | depends on TELNETD |
589 | help | 589 | help |
590 | Selecting this will make telnetd only callable from inetd, | 590 | Selecting this will make telnetd only callable from inetd, |
591 | removing the standalone support. | 591 | removing the standalone support. |
592 | 592 | ||
593 | config CONFIG_TFTP | 593 | config TFTP |
594 | bool "tftp" | 594 | bool "tftp" |
595 | default n | 595 | default n |
596 | help | 596 | help |
@@ -598,114 +598,114 @@ config CONFIG_TFTP | |||
598 | is usually used for simple, small transfers such as a root image | 598 | is usually used for simple, small transfers such as a root image |
599 | for a network-enabled bootloader. | 599 | for a network-enabled bootloader. |
600 | 600 | ||
601 | config CONFIG_FEATURE_TFTP_GET | 601 | config FEATURE_TFTP_GET |
602 | bool "Enable \"get\" command" | 602 | bool "Enable \"get\" command" |
603 | default y | 603 | default y |
604 | depends on CONFIG_TFTP | 604 | depends on TFTP |
605 | help | 605 | help |
606 | Add support for the GET command within the TFTP client. This allows | 606 | Add support for the GET command within the TFTP client. This allows |
607 | a client to retrieve a file from a TFTP server. | 607 | a client to retrieve a file from a TFTP server. |
608 | 608 | ||
609 | config CONFIG_FEATURE_TFTP_PUT | 609 | config FEATURE_TFTP_PUT |
610 | bool "Enable \"put\" command" | 610 | bool "Enable \"put\" command" |
611 | default y | 611 | default y |
612 | depends on CONFIG_TFTP | 612 | depends on TFTP |
613 | help | 613 | help |
614 | Add support for the PUT command within the TFTP client. This allows | 614 | Add support for the PUT command within the TFTP client. This allows |
615 | a client to transfer a file to a TFTP server. | 615 | a client to transfer a file to a TFTP server. |
616 | 616 | ||
617 | config CONFIG_FEATURE_TFTP_BLOCKSIZE | 617 | config FEATURE_TFTP_BLOCKSIZE |
618 | bool "Enable \"blocksize\" command" | 618 | bool "Enable \"blocksize\" command" |
619 | default n | 619 | default n |
620 | depends on CONFIG_TFTP | 620 | depends on TFTP |
621 | help | 621 | help |
622 | Allow the client to specify the desired block size for transfers. | 622 | Allow the client to specify the desired block size for transfers. |
623 | 623 | ||
624 | config CONFIG_DEBUG_TFTP | 624 | config DEBUG_TFTP |
625 | bool "Enable debug" | 625 | bool "Enable debug" |
626 | default n | 626 | default n |
627 | depends on CONFIG_TFTP | 627 | depends on TFTP |
628 | help | 628 | help |
629 | Enable debug settings for tftp. This is useful if you're running | 629 | Enable debug settings for tftp. This is useful if you're running |
630 | into problems with tftp as the protocol doesn't help you much when | 630 | into problems with tftp as the protocol doesn't help you much when |
631 | you run into problems. | 631 | you run into problems. |
632 | 632 | ||
633 | config CONFIG_TRACEROUTE | 633 | config TRACEROUTE |
634 | bool "traceroute" | 634 | bool "traceroute" |
635 | default n | 635 | default n |
636 | help | 636 | help |
637 | Utility to trace the route of IP packets | 637 | Utility to trace the route of IP packets |
638 | 638 | ||
639 | config CONFIG_FEATURE_TRACEROUTE_VERBOSE | 639 | config FEATURE_TRACEROUTE_VERBOSE |
640 | bool "Enable verbose output" | 640 | bool "Enable verbose output" |
641 | default n | 641 | default n |
642 | depends on CONFIG_TRACEROUTE | 642 | depends on TRACEROUTE |
643 | help | 643 | help |
644 | Add some verbosity to traceroute. This includes amongst other things | 644 | Add some verbosity to traceroute. This includes amongst other things |
645 | hostnames and ICMP response types. | 645 | hostnames and ICMP response types. |
646 | 646 | ||
647 | config CONFIG_FEATURE_TRACEROUTE_SOURCE_ROUTE | 647 | config FEATURE_TRACEROUTE_SOURCE_ROUTE |
648 | bool "Enable loose source route" | 648 | bool "Enable loose source route" |
649 | default n | 649 | default n |
650 | depends on CONFIG_TRACEROUTE | 650 | depends on TRACEROUTE |
651 | help | 651 | help |
652 | Add option to specify a loose source route gateway | 652 | Add option to specify a loose source route gateway |
653 | (8 maximum). | 653 | (8 maximum). |
654 | 654 | ||
655 | config CONFIG_FEATURE_TRACEROUTE_USE_ICMP | 655 | config FEATURE_TRACEROUTE_USE_ICMP |
656 | bool "Use ICMP instead of UDP" | 656 | bool "Use ICMP instead of UDP" |
657 | default n | 657 | default n |
658 | depends on CONFIG_TRACEROUTE | 658 | depends on TRACEROUTE |
659 | help | 659 | help |
660 | Add feature to allow for ICMP ECHO instead of UDP datagrams. | 660 | Add feature to allow for ICMP ECHO instead of UDP datagrams. |
661 | 661 | ||
662 | source networking/udhcp/Config.in | 662 | source networking/udhcp/Config.in |
663 | 663 | ||
664 | config CONFIG_VCONFIG | 664 | config VCONFIG |
665 | bool "vconfig" | 665 | bool "vconfig" |
666 | default n | 666 | default n |
667 | help | 667 | help |
668 | Creates, removes, and configures VLAN interfaces | 668 | Creates, removes, and configures VLAN interfaces |
669 | 669 | ||
670 | config CONFIG_WGET | 670 | config WGET |
671 | bool "wget" | 671 | bool "wget" |
672 | default n | 672 | default n |
673 | help | 673 | help |
674 | wget is a utility for non-interactive download of files from HTTP, | 674 | wget is a utility for non-interactive download of files from HTTP, |
675 | HTTPS, and FTP servers. | 675 | HTTPS, and FTP servers. |
676 | 676 | ||
677 | config CONFIG_FEATURE_WGET_STATUSBAR | 677 | config FEATURE_WGET_STATUSBAR |
678 | bool "Enable a nifty process meter (+2k)" | 678 | bool "Enable a nifty process meter (+2k)" |
679 | default y | 679 | default y |
680 | depends on CONFIG_WGET | 680 | depends on WGET |
681 | help | 681 | help |
682 | Enable the transfer progress bar for wget transfers. | 682 | Enable the transfer progress bar for wget transfers. |
683 | 683 | ||
684 | config CONFIG_FEATURE_WGET_AUTHENTICATION | 684 | config FEATURE_WGET_AUTHENTICATION |
685 | bool "Enable HTTP authentication" | 685 | bool "Enable HTTP authentication" |
686 | default y | 686 | default y |
687 | depends on CONFIG_WGET | 687 | depends on WGET |
688 | help | 688 | help |
689 | Support authenticated HTTP transfers. | 689 | Support authenticated HTTP transfers. |
690 | 690 | ||
691 | config CONFIG_FEATURE_WGET_IP6_LITERAL | 691 | config FEATURE_WGET_IP6_LITERAL |
692 | bool "Enable IPv6 literal addresses" | 692 | bool "Enable IPv6 literal addresses" |
693 | default y | 693 | default y |
694 | depends on CONFIG_WGET && CONFIG_FEATURE_IPV6 | 694 | depends on WGET && FEATURE_IPV6 |
695 | help | 695 | help |
696 | Support IPv6 address literal notation in URLs. | 696 | Support IPv6 address literal notation in URLs. |
697 | 697 | ||
698 | config CONFIG_FEATURE_WGET_LONG_OPTIONS | 698 | config FEATURE_WGET_LONG_OPTIONS |
699 | bool "Enable long options" | 699 | bool "Enable long options" |
700 | default n | 700 | default n |
701 | depends on CONFIG_WGET && CONFIG_GETOPT_LONG | 701 | depends on WGET && GETOPT_LONG |
702 | help | 702 | help |
703 | Support long options for the wget applet. | 703 | Support long options for the wget applet. |
704 | 704 | ||
705 | config CONFIG_ZCIP | 705 | config ZCIP |
706 | bool "zcip" | 706 | bool "zcip" |
707 | default n | 707 | default n |
708 | select CONFIG_FEATURE_SYSLOG | 708 | select FEATURE_SYSLOG |
709 | help | 709 | help |
710 | ZCIP provides ZeroConf IPv4 address selection, according to RFC 3927. | 710 | ZCIP provides ZeroConf IPv4 address selection, according to RFC 3927. |
711 | It's a daemon that allocates and defends a dynamically assigned | 711 | It's a daemon that allocates and defends a dynamically assigned |
diff --git a/networking/Kbuild b/networking/Kbuild new file mode 100644 index 000000000..066475925 --- /dev/null +++ b/networking/Kbuild | |||
@@ -0,0 +1,38 @@ | |||
1 | # Makefile for busybox | ||
2 | # | ||
3 | # Copyright (C) 1999-2005 by Erik Andersen <andersen@codepoet.org> | ||
4 | # | ||
5 | # Licensed under the GPL v2, see the file LICENSE in this tarball. | ||
6 | |||
7 | lib-y:= | ||
8 | lib-$(CONFIG_ARPING) += arping.o | ||
9 | lib-$(CONFIG_DNSD) += dnsd.o | ||
10 | lib-$(CONFIG_ETHER_WAKE) += ether-wake.o | ||
11 | lib-$(CONFIG_FAKEIDENTD) += fakeidentd.o | ||
12 | lib-$(CONFIG_FTPGET) += ftpgetput.o | ||
13 | lib-$(CONFIG_FTPPUT) += ftpgetput.o | ||
14 | lib-$(CONFIG_HOSTNAME) += hostname.o | ||
15 | lib-$(CONFIG_HTTPD) += httpd.o | ||
16 | lib-$(CONFIG_IFCONFIG) += ifconfig.o interface.o | ||
17 | lib-$(CONFIG_IFUPDOWN) += ifupdown.o | ||
18 | lib-$(CONFIG_INETD) += inetd.o | ||
19 | lib-$(CONFIG_IP) += ip.o | ||
20 | lib-$(CONFIG_IPCALC) += ipcalc.o | ||
21 | lib-$(CONFIG_IPADDR) += ipaddr.o | ||
22 | lib-$(CONFIG_IPLINK) += iplink.o | ||
23 | lib-$(CONFIG_IPROUTE) += iproute.o | ||
24 | lib-$(CONFIG_IPTUNNEL) += iptunnel.o | ||
25 | lib-$(CONFIG_NAMEIF) += nameif.o | ||
26 | lib-$(CONFIG_NC) += nc.o | ||
27 | lib-$(CONFIG_NETSTAT) += netstat.o | ||
28 | lib-$(CONFIG_NSLOOKUP) += nslookup.o | ||
29 | lib-$(CONFIG_PING) += ping.o | ||
30 | lib-$(CONFIG_PING6) += ping6.o | ||
31 | lib-$(CONFIG_ROUTE) += route.o | ||
32 | lib-$(CONFIG_TELNET) += telnet.o | ||
33 | lib-$(CONFIG_TELNETD) += telnetd.o | ||
34 | lib-$(CONFIG_TFTP) += tftp.o | ||
35 | lib-$(CONFIG_TRACEROUTE) += traceroute.o | ||
36 | lib-$(CONFIG_VCONFIG) += vconfig.o | ||
37 | lib-$(CONFIG_WGET) += wget.o | ||
38 | lib-$(CONFIG_ZCIP) += zcip.o | ||
diff --git a/networking/Makefile b/networking/Makefile deleted file mode 100644 index c3f2d79c9..000000000 --- a/networking/Makefile +++ /dev/null | |||
@@ -1,23 +0,0 @@ | |||
1 | # Makefile for busybox | ||
2 | # | ||
3 | # Copyright (C) 1999-2005 by Erik Andersen <andersen@codepoet.org> | ||
4 | # | ||
5 | # Licensed under the GPL v2, see the file LICENSE in this tarball. | ||
6 | |||
7 | ifndef top_srcdir | ||
8 | top_srcdir=.. | ||
9 | endif | ||
10 | ifndef top_builddir | ||
11 | top_builddir=.. | ||
12 | endif | ||
13 | srcdir=$(top_srcdir)/networking | ||
14 | NETWORKING_DIR:=./ | ||
15 | include $(top_srcdir)/Rules.mak | ||
16 | include $(top_builddir)/.config | ||
17 | include Makefile.in | ||
18 | all: $(libraries-y) | ||
19 | -include $(top_builddir)/.depend | ||
20 | |||
21 | clean: | ||
22 | rm -f *.o *.a $(AR_TARGET) | ||
23 | |||
diff --git a/networking/Makefile.in b/networking/Makefile.in deleted file mode 100644 index 650fc1a4a..000000000 --- a/networking/Makefile.in +++ /dev/null | |||
@@ -1,70 +0,0 @@ | |||
1 | # Makefile for busybox | ||
2 | # | ||
3 | # Copyright (C) 1999-2005 by Erik Andersen <andersen@codepoet.org> | ||
4 | # | ||
5 | # Licensed under the GPL v2, see the file LICENSE in this tarball. | ||
6 | |||
7 | NETWORKING_AR:=networking.a | ||
8 | ifndef $(NETWORKING_DIR) | ||
9 | NETWORKING_DIR:=$(top_builddir)/networking/ | ||
10 | endif | ||
11 | srcdir=$(top_srcdir)/networking | ||
12 | |||
13 | NETWORKING-y:= | ||
14 | NETWORKING-$(CONFIG_ARPING) += arping.o | ||
15 | NETWORKING-$(CONFIG_DNSD) += dnsd.o | ||
16 | NETWORKING-$(CONFIG_ETHER_WAKE) += ether-wake.o | ||
17 | NETWORKING-$(CONFIG_FAKEIDENTD) += fakeidentd.o | ||
18 | NETWORKING-$(CONFIG_FTPGET) += ftpgetput.o | ||
19 | NETWORKING-$(CONFIG_FTPPUT) += ftpgetput.o | ||
20 | NETWORKING-$(CONFIG_HOSTNAME) += hostname.o | ||
21 | NETWORKING-$(CONFIG_HTTPD) += httpd.o | ||
22 | NETWORKING-$(CONFIG_IFCONFIG) += ifconfig.o interface.o | ||
23 | NETWORKING-$(CONFIG_IFUPDOWN) += ifupdown.o | ||
24 | NETWORKING-$(CONFIG_INETD) += inetd.o | ||
25 | NETWORKING-$(CONFIG_IP) += ip.o | ||
26 | NETWORKING-$(CONFIG_IPCALC) += ipcalc.o | ||
27 | NETWORKING-$(CONFIG_IPADDR) += ipaddr.o | ||
28 | NETWORKING-$(CONFIG_IPLINK) += iplink.o | ||
29 | NETWORKING-$(CONFIG_IPROUTE) += iproute.o | ||
30 | NETWORKING-$(CONFIG_IPTUNNEL) += iptunnel.o | ||
31 | NETWORKING-$(CONFIG_NAMEIF) += nameif.o | ||
32 | NETWORKING-$(CONFIG_NC) += nc.o | ||
33 | NETWORKING-$(CONFIG_NETSTAT) += netstat.o | ||
34 | NETWORKING-$(CONFIG_NSLOOKUP) += nslookup.o | ||
35 | NETWORKING-$(CONFIG_PING) += ping.o | ||
36 | NETWORKING-$(CONFIG_PING6) += ping6.o | ||
37 | NETWORKING-$(CONFIG_ROUTE) += route.o | ||
38 | NETWORKING-$(CONFIG_TELNET) += telnet.o | ||
39 | NETWORKING-$(CONFIG_TELNETD) += telnetd.o | ||
40 | NETWORKING-$(CONFIG_TFTP) += tftp.o | ||
41 | NETWORKING-$(CONFIG_TRACEROUTE) += traceroute.o | ||
42 | NETWORKING-$(CONFIG_VCONFIG) += vconfig.o | ||
43 | NETWORKING-$(CONFIG_WGET) += wget.o | ||
44 | NETWORKING-$(CONFIG_ZCIP) += zcip.o | ||
45 | |||
46 | NETWORKING-y:=$(sort $(NETWORKING-y)) | ||
47 | ifneq ($(strip $(NETWORKING-y)),) | ||
48 | libraries-y+=$(NETWORKING_DIR)$(NETWORKING_AR) | ||
49 | endif | ||
50 | |||
51 | NETWORKING_SRC-y:=$(patsubst %.o,$(srcdir)/%.c,$(NETWORKING-y)) | ||
52 | NETWORKING_SRC-a:=$(wildcard $(srcdir)/*.c) | ||
53 | APPLET_SRC-y+=$(NETWORKING_SRC-y) | ||
54 | APPLET_SRC-a+=$(NETWORKING_SRC-a) | ||
55 | |||
56 | LIBRARY_DEFINE-y+= -I$(top_srcdir)/networking | ||
57 | LIBRARY_DEFINE-a+= -I$(top_srcdir)/networking | ||
58 | |||
59 | needcrypt-y:= | ||
60 | needcrypt-$(CONFIG_FEATURE_HTTPD_AUTH_MD5) := y | ||
61 | |||
62 | ifeq ($(needcrypt-y),y) | ||
63 | LIBRARIES := -lcrypt $(filter-out -lcrypt,$(LIBRARIES)) | ||
64 | endif | ||
65 | |||
66 | $(NETWORKING_DIR)$(NETWORKING_AR): $(patsubst %,$(NETWORKING_DIR)%, $(NETWORKING-y)) | ||
67 | $(do_ar) | ||
68 | |||
69 | $(NETWORKING_DIR)%.o: $(srcdir)/%.c | ||
70 | $(compile.c) | ||
diff --git a/networking/libiproute/Kbuild b/networking/libiproute/Kbuild new file mode 100644 index 000000000..476374e19 --- /dev/null +++ b/networking/libiproute/Kbuild | |||
@@ -0,0 +1,58 @@ | |||
1 | # Makefile for busybox | ||
2 | # | ||
3 | # Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org> | ||
4 | # | ||
5 | # Licensed under the GPL v2 or later, see the file LICENSE in this tarball. | ||
6 | # | ||
7 | |||
8 | lib-y:= | ||
9 | lib-$(CONFIG_IP) += \ | ||
10 | ip_parse_common_args.o \ | ||
11 | ipaddress.o \ | ||
12 | iplink.o \ | ||
13 | iproute.o \ | ||
14 | iptunnel.o \ | ||
15 | libnetlink.o \ | ||
16 | ll_addr.o \ | ||
17 | ll_map.o \ | ||
18 | ll_proto.o \ | ||
19 | ll_types.o \ | ||
20 | rt_names.o \ | ||
21 | rtm_map.o \ | ||
22 | utils.o | ||
23 | |||
24 | lib-$(CONFIG_IPADDR) += \ | ||
25 | ip_parse_common_args.o \ | ||
26 | ipaddress.o \ | ||
27 | libnetlink.o \ | ||
28 | ll_addr.o \ | ||
29 | ll_map.o \ | ||
30 | ll_types.o \ | ||
31 | rt_names.o \ | ||
32 | utils.o | ||
33 | |||
34 | lib-$(CONFIG_IPLINK) += \ | ||
35 | ip_parse_common_args.o \ | ||
36 | ipaddress.o \ | ||
37 | iplink.o \ | ||
38 | libnetlink.o \ | ||
39 | ll_addr.o \ | ||
40 | ll_map.o \ | ||
41 | ll_types.o \ | ||
42 | rt_names.o \ | ||
43 | utils.o | ||
44 | |||
45 | lib-$(CONFIG_IPROUTE) += \ | ||
46 | ip_parse_common_args.o \ | ||
47 | iproute.o \ | ||
48 | libnetlink.o \ | ||
49 | ll_map.o \ | ||
50 | rt_names.o \ | ||
51 | rtm_map.o \ | ||
52 | utils.o | ||
53 | |||
54 | lib-$(CONFIG_IPTUNNEL) += \ | ||
55 | ip_parse_common_args.o \ | ||
56 | iptunnel.o \ | ||
57 | rt_names.o \ | ||
58 | utils.o | ||
diff --git a/networking/libiproute/Makefile b/networking/libiproute/Makefile deleted file mode 100644 index 2fafae738..000000000 --- a/networking/libiproute/Makefile +++ /dev/null | |||
@@ -1,36 +0,0 @@ | |||
1 | # Makefile for busybox | ||
2 | # | ||
3 | # Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org> | ||
4 | # | ||
5 | # This program is free software; you can redistribute it and/or modify | ||
6 | # it under the terms of the GNU General Public License as published by | ||
7 | # the Free Software Foundation; either version 2 of the License, or | ||
8 | # (at your option) any later version. | ||
9 | # | ||
10 | # This program is distributed in the hope that it will be useful, | ||
11 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
13 | # General Public License for more details. | ||
14 | # | ||
15 | # You should have received a copy of the GNU General Public License | ||
16 | # along with this program; if not, write to the Free Software | ||
17 | # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
18 | # | ||
19 | |||
20 | ifndef top_srcdir | ||
21 | top_srcdir=../.. | ||
22 | endif | ||
23 | ifndef top_builddir | ||
24 | top_builddir=../.. | ||
25 | endif | ||
26 | srcdir=$(top_srcdir)/networking/libiproute | ||
27 | LIBIPROUTE_DIR:=./ | ||
28 | include $(top_srcdir)/Rules.mak | ||
29 | include $(top_builddir)/.config | ||
30 | include Makefile.in | ||
31 | all: $(libraries-y) | ||
32 | -include $(top_builddir)/.depend | ||
33 | |||
34 | clean: | ||
35 | rm -f *.o *.a $(AR_TARGET) | ||
36 | |||
diff --git a/networking/libiproute/Makefile.in b/networking/libiproute/Makefile.in deleted file mode 100644 index f713502b3..000000000 --- a/networking/libiproute/Makefile.in +++ /dev/null | |||
@@ -1,83 +0,0 @@ | |||
1 | # Makefile for busybox | ||
2 | # | ||
3 | # Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org> | ||
4 | # | ||
5 | # Licensed under the GPL v2 or later, see the file LICENSE in this tarball. | ||
6 | # | ||
7 | |||
8 | LIBIPROUTE_AR:=libiproute.a | ||
9 | ifndef $(LIBIPROUTE_DIR) | ||
10 | LIBIPROUTE_DIR:=$(top_builddir)/networking/libiproute | ||
11 | endif | ||
12 | srcdir=$(top_srcdir)/networking/libiproute | ||
13 | |||
14 | LIBIPROUTE-y:= | ||
15 | LIBIPROUTE-$(CONFIG_IP) += \ | ||
16 | ip_parse_common_args.o \ | ||
17 | ipaddress.o \ | ||
18 | iplink.o \ | ||
19 | iproute.o \ | ||
20 | iptunnel.o \ | ||
21 | libnetlink.o \ | ||
22 | ll_addr.o \ | ||
23 | ll_map.o \ | ||
24 | ll_proto.o \ | ||
25 | ll_types.o \ | ||
26 | rt_names.o \ | ||
27 | rtm_map.o \ | ||
28 | utils.o | ||
29 | |||
30 | LIBIPROUTE-$(CONFIG_IPADDR) += \ | ||
31 | ip_parse_common_args.o \ | ||
32 | ipaddress.o \ | ||
33 | libnetlink.o \ | ||
34 | ll_addr.o \ | ||
35 | ll_map.o \ | ||
36 | ll_types.o \ | ||
37 | rt_names.o \ | ||
38 | utils.o | ||
39 | |||
40 | LIBIPROUTE-$(CONFIG_IPLINK) += \ | ||
41 | ip_parse_common_args.o \ | ||
42 | ipaddress.o \ | ||
43 | iplink.o \ | ||
44 | libnetlink.o \ | ||
45 | ll_addr.o \ | ||
46 | ll_map.o \ | ||
47 | ll_types.o \ | ||
48 | rt_names.o \ | ||
49 | utils.o | ||
50 | |||
51 | LIBIPROUTE-$(CONFIG_IPROUTE) += \ | ||
52 | ip_parse_common_args.o \ | ||
53 | iproute.o \ | ||
54 | libnetlink.o \ | ||
55 | ll_map.o \ | ||
56 | rt_names.o \ | ||
57 | rtm_map.o \ | ||
58 | utils.o | ||
59 | |||
60 | LIBIPROUTE-$(CONFIG_IPTUNNEL) += \ | ||
61 | ip_parse_common_args.o \ | ||
62 | iptunnel.o \ | ||
63 | rt_names.o \ | ||
64 | utils.o | ||
65 | |||
66 | LIBIPROUTE-y:=$(sort $(LIBIPROUTE-y)) | ||
67 | |||
68 | LIBIPROUTE_SRC-y:=$(patsubst %,$(srcdir)/%,$(subst .o,.c,$(LIBIPROUTE-y))) | ||
69 | LIBIPROUTE_SRC-a:=$(wildcard $(srcdir)/*.c) | ||
70 | LIBRARY_SRC-y+=$(LIBIPROUTE_SRC-y) | ||
71 | LIBRARY_SRC-a+=$(LIBIPROUTE_SRC-a) | ||
72 | |||
73 | LIBIPROUTE-obj:=$(LIBIPROUTE_DIR)/$(LIBIPROUTE_AR) | ||
74 | |||
75 | ifneq ($(strip $(LIBIPROUTE-y)),) | ||
76 | libraries-y+=$(LIBIPROUTE_DIR)/$(LIBIPROUTE_AR) | ||
77 | endif | ||
78 | |||
79 | $(LIBIPROUTE_DIR)/$(LIBIPROUTE_AR): $(patsubst %,$(LIBIPROUTE_DIR)/%,$(LIBIPROUTE-y)) | ||
80 | $(do_ar) | ||
81 | |||
82 | $(LIBIPROUTE_DIR)/%.o: $(srcdir)/%.c | ||
83 | $(compile.c) | ||
diff --git a/networking/udhcp/Config.in b/networking/udhcp/Config.in index f01340192..13dbcee9c 100644 --- a/networking/udhcp/Config.in +++ b/networking/udhcp/Config.in | |||
@@ -3,7 +3,7 @@ | |||
3 | # see scripts/kbuild/config-language.txt. | 3 | # see scripts/kbuild/config-language.txt. |
4 | # | 4 | # |
5 | 5 | ||
6 | config CONFIG_APP_UDHCPD | 6 | config APP_UDHCPD |
7 | bool "udhcp Server (udhcpd)" | 7 | bool "udhcp Server (udhcpd)" |
8 | default n | 8 | default n |
9 | help | 9 | help |
@@ -12,10 +12,10 @@ config CONFIG_APP_UDHCPD | |||
12 | 12 | ||
13 | See http://udhcp.busybox.net for further details. | 13 | See http://udhcp.busybox.net for further details. |
14 | 14 | ||
15 | config CONFIG_APP_DUMPLEASES | 15 | config APP_DUMPLEASES |
16 | bool "Lease display utility (dumpleases)" | 16 | bool "Lease display utility (dumpleases)" |
17 | default n | 17 | default n |
18 | depends on CONFIG_APP_UDHCPD | 18 | depends on APP_UDHCPD |
19 | help | 19 | help |
20 | dumpleases displays the leases written out by the udhcpd server. | 20 | dumpleases displays the leases written out by the udhcpd server. |
21 | Lease times are stored in the file by time remaining in lease, or | 21 | Lease times are stored in the file by time remaining in lease, or |
@@ -23,7 +23,7 @@ config CONFIG_APP_DUMPLEASES | |||
23 | 23 | ||
24 | See http://udhcp.busybox.net for further details. | 24 | See http://udhcp.busybox.net for further details. |
25 | 25 | ||
26 | config CONFIG_APP_UDHCPC | 26 | config APP_UDHCPC |
27 | bool "udhcp Client (udhcpc)" | 27 | bool "udhcp Client (udhcpc)" |
28 | default n | 28 | default n |
29 | help | 29 | help |
@@ -35,21 +35,21 @@ config CONFIG_APP_UDHCPC | |||
35 | 35 | ||
36 | See http://udhcp.busybox.net for further details. | 36 | See http://udhcp.busybox.net for further details. |
37 | 37 | ||
38 | config CONFIG_FEATURE_UDHCP_SYSLOG | 38 | config FEATURE_UDHCP_SYSLOG |
39 | bool "Log udhcp messages to syslog" | 39 | bool "Log udhcp messages to syslog" |
40 | default n | 40 | default n |
41 | depends on CONFIG_APP_UDHCPD || CONFIG_APP_UDHCPC | 41 | depends on APP_UDHCPD || APP_UDHCPC |
42 | select CONFIG_FEATURE_SYSLOG | 42 | select FEATURE_SYSLOG |
43 | help | 43 | help |
44 | If not daemonized, udhcpd prints its messages to stdout/stderr. | 44 | If not daemonized, udhcpd prints its messages to stdout/stderr. |
45 | If this option is selected, it will also log them to syslog. | 45 | If this option is selected, it will also log them to syslog. |
46 | 46 | ||
47 | See http://udhcp.busybox.net for further details. | 47 | See http://udhcp.busybox.net for further details. |
48 | 48 | ||
49 | config CONFIG_FEATURE_UDHCP_DEBUG | 49 | config FEATURE_UDHCP_DEBUG |
50 | bool "Compile udhcp with noisy debugging messages" | 50 | bool "Compile udhcp with noisy debugging messages" |
51 | default n | 51 | default n |
52 | depends on CONFIG_APP_UDHCPD || CONFIG_APP_UDHCPC | 52 | depends on APP_UDHCPD || APP_UDHCPC |
53 | help | 53 | help |
54 | If selected, udhcpd will output extra debugging output. If using | 54 | If selected, udhcpd will output extra debugging output. If using |
55 | this option, compile uDHCP with "-g", and do not fork the daemon to | 55 | this option, compile uDHCP with "-g", and do not fork the daemon to |
diff --git a/networking/udhcp/Kbuild b/networking/udhcp/Kbuild new file mode 100644 index 000000000..90047c174 --- /dev/null +++ b/networking/udhcp/Kbuild | |||
@@ -0,0 +1,17 @@ | |||
1 | # Makefile for busybox | ||
2 | # | ||
3 | # Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org> | ||
4 | # | ||
5 | # Licensed under the GPL v2 or later, see the file LICENSE in this tarball. | ||
6 | # | ||
7 | |||
8 | lib-y:= | ||
9 | lib-$(CONFIG_APP_UDHCPC) += common.o options.o packet.o pidfile.o \ | ||
10 | signalpipe.o socket.o | ||
11 | lib-$(CONFIG_APP_UDHCPD) += common.o options.o packet.o pidfile.o \ | ||
12 | signalpipe.o socket.o | ||
13 | lib-$(CONFIG_APP_UDHCPC) += dhcpc.o clientpacket.o clientsocket.o \ | ||
14 | script.o | ||
15 | lib-$(CONFIG_APP_UDHCPD) += dhcpd.o arpping.o files.o leases.o \ | ||
16 | serverpacket.o static_leases.o | ||
17 | lib-$(CONFIG_APP_DUMPLEASES) += dumpleases.o | ||
diff --git a/networking/udhcp/Makefile b/networking/udhcp/Makefile deleted file mode 100644 index 23131f8f0..000000000 --- a/networking/udhcp/Makefile +++ /dev/null | |||
@@ -1,23 +0,0 @@ | |||
1 | # Makefile for busybox | ||
2 | # | ||
3 | # Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org> | ||
4 | # | ||
5 | # Licensed under GPLv2 or later, see file LICENSE in this tarball for details. | ||
6 | |||
7 | #ifndef top_srcdir | ||
8 | #top_srcdir=../.. | ||
9 | #endif | ||
10 | #ifndef top_builddir | ||
11 | #top_builddir=../.. | ||
12 | #endif | ||
13 | srcdir=$(top_srcdir)/networking/udhcp | ||
14 | UDHCP_DIR:=./ | ||
15 | include $(top_srcdir)/Rules.mak | ||
16 | include $(top_builddir)/.config | ||
17 | include Makefile.in | ||
18 | all: $(libraries-y) | ||
19 | -include $(top_builddir)/.depend | ||
20 | |||
21 | clean: | ||
22 | rm -f *.o *.a $(AR_TARGET) | ||
23 | |||
diff --git a/networking/udhcp/Makefile.in b/networking/udhcp/Makefile.in deleted file mode 100644 index cbc6f2b39..000000000 --- a/networking/udhcp/Makefile.in +++ /dev/null | |||
@@ -1,53 +0,0 @@ | |||
1 | # Makefile for busybox | ||
2 | # | ||
3 | # Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org> | ||
4 | # | ||
5 | # Licensed under the GPL v2 or later, see the file LICENSE in this tarball. | ||
6 | # | ||
7 | |||
8 | UDHCP_AR:=udhcp.a | ||
9 | ifndef $(UDHCP_DIR) | ||
10 | UDHCP_DIR:=$(top_builddir)/networking/udhcp/ | ||
11 | endif | ||
12 | srcdir=$(top_srcdir)/networking/udhcp | ||
13 | |||
14 | #ok, so I forgot how to do an or, but this is a quick and dirty hack | ||
15 | ifeq ($(strip $(CONFIG_APP_UDHCPC)),y) | ||
16 | CONFIG_UDHCP_SHARED=y | ||
17 | else | ||
18 | ifeq ($(strip $(CONFIG_APP_UDHCPD)),y) | ||
19 | CONFIG_UDHCP_SHARED=y | ||
20 | else | ||
21 | CONFIG_UDHCP_SHARED=n | ||
22 | endif | ||
23 | endif | ||
24 | |||
25 | UDHCP-y:= | ||
26 | UDHCP-$(CONFIG_UDHCP_SHARED) += common.c options.c packet.c pidfile.c \ | ||
27 | signalpipe.c socket.c | ||
28 | UDHCP-$(CONFIG_APP_UDHCPC) += dhcpc.c clientpacket.c clientsocket.c \ | ||
29 | script.c | ||
30 | UDHCP-$(CONFIG_APP_UDHCPD) += dhcpd.c arpping.c files.c leases.c \ | ||
31 | serverpacket.c static_leases.c | ||
32 | UDHCP-$(CONFIG_APP_DUMPLEASES) += dumpleases.c | ||
33 | UDHCP_OBJS:=$(patsubst %.c,$(UDHCP_DIR)%.o, $(UDHCP-y)) | ||
34 | |||
35 | ifneq ($(strip $(UDHCP-y)),) | ||
36 | libraries-y+=$(UDHCP_DIR)$(UDHCP_AR) | ||
37 | endif | ||
38 | |||
39 | UDHCP-y:=$(patsubst %,$(srcdir)/%,$(UDHCP-y)) | ||
40 | UDHCP-a:=$(wildcard $(srcdir)/*.c) | ||
41 | APPLET_SRC-y+=$(UDHCP-y) | ||
42 | APPLET_SRC-a+=$(UDHCP-a) | ||
43 | |||
44 | UDHCP_INCLUDES:=$(srcdir) | ||
45 | |||
46 | APPLETS_DEFINE-y+= -I$(UDHCP_INCLUDES) | ||
47 | APPLETS_DEFINE-a+= -I$(UDHCP_INCLUDES) | ||
48 | |||
49 | $(UDHCP_DIR)$(UDHCP_AR): $(UDHCP_OBJS) | ||
50 | $(do_ar) | ||
51 | |||
52 | $(UDHCP_OBJS): $(UDHCP_DIR)%.o : $(srcdir)/%.c | ||
53 | $(compile.c) | ||
diff --git a/procps/Config.in b/procps/Config.in index 2d4ad3bd4..20d5f9bf2 100644 --- a/procps/Config.in +++ b/procps/Config.in | |||
@@ -5,7 +5,7 @@ | |||
5 | 5 | ||
6 | menu "Process Utilities" | 6 | menu "Process Utilities" |
7 | 7 | ||
8 | config CONFIG_FREE | 8 | config FREE |
9 | bool "free" | 9 | bool "free" |
10 | default n | 10 | default n |
11 | help | 11 | help |
@@ -13,7 +13,7 @@ config CONFIG_FREE | |||
13 | memory in the system, as well as the buffers used by the kernel. | 13 | memory in the system, as well as the buffers used by the kernel. |
14 | The shared memory column should be ignored; it is obsolete. | 14 | The shared memory column should be ignored; it is obsolete. |
15 | 15 | ||
16 | config CONFIG_FUSER | 16 | config FUSER |
17 | bool "fuser" | 17 | bool "fuser" |
18 | default n | 18 | default n |
19 | help | 19 | help |
@@ -21,7 +21,7 @@ config CONFIG_FUSER | |||
21 | file open. fuser can also list all PIDs that have a given network | 21 | file open. fuser can also list all PIDs that have a given network |
22 | (TCP or UDP) port open. | 22 | (TCP or UDP) port open. |
23 | 23 | ||
24 | config CONFIG_KILL | 24 | config KILL |
25 | bool "kill" | 25 | bool "kill" |
26 | default n | 26 | default n |
27 | help | 27 | help |
@@ -29,86 +29,86 @@ config CONFIG_KILL | |||
29 | process or process group. If no signal is specified, the TERM | 29 | process or process group. If no signal is specified, the TERM |
30 | signal is sent. | 30 | signal is sent. |
31 | 31 | ||
32 | config CONFIG_KILLALL | 32 | config KILLALL |
33 | bool "killall" | 33 | bool "killall" |
34 | default n | 34 | default n |
35 | depends on CONFIG_KILL | 35 | depends on KILL |
36 | help | 36 | help |
37 | killall sends a signal to all processes running any of the | 37 | killall sends a signal to all processes running any of the |
38 | specified commands. If no signal name is specified, SIGTERM is | 38 | specified commands. If no signal name is specified, SIGTERM is |
39 | sent. | 39 | sent. |
40 | 40 | ||
41 | config CONFIG_KILLALL5 | 41 | config KILLALL5 |
42 | bool "killall5" | 42 | bool "killall5" |
43 | default n | 43 | default n |
44 | depends on CONFIG_KILL | 44 | depends on KILL |
45 | 45 | ||
46 | config CONFIG_PIDOF | 46 | config PIDOF |
47 | bool "pidof" | 47 | bool "pidof" |
48 | default n | 48 | default n |
49 | help | 49 | help |
50 | Pidof finds the process id's (pids) of the named programs. It prints | 50 | Pidof finds the process id's (pids) of the named programs. It prints |
51 | those id's on the standard output. | 51 | those id's on the standard output. |
52 | 52 | ||
53 | config CONFIG_FEATURE_PIDOF_SINGLE | 53 | config FEATURE_PIDOF_SINGLE |
54 | bool "Enable argument for single shot (-s)" | 54 | bool "Enable argument for single shot (-s)" |
55 | default n | 55 | default n |
56 | depends on CONFIG_PIDOF | 56 | depends on PIDOF |
57 | help | 57 | help |
58 | Support argument '-s' for returning only the first pid found. | 58 | Support argument '-s' for returning only the first pid found. |
59 | 59 | ||
60 | config CONFIG_FEATURE_PIDOF_OMIT | 60 | config FEATURE_PIDOF_OMIT |
61 | bool "Enable argument for omitting pids (-o)" | 61 | bool "Enable argument for omitting pids (-o)" |
62 | default n | 62 | default n |
63 | depends on CONFIG_PIDOF | 63 | depends on PIDOF |
64 | help | 64 | help |
65 | Support argument '-o' for omitting the given pids in output. | 65 | Support argument '-o' for omitting the given pids in output. |
66 | The special pid %PPID can be used to name the parent process | 66 | The special pid %PPID can be used to name the parent process |
67 | of the pidof, in other words the calling shell or shell script. | 67 | of the pidof, in other words the calling shell or shell script. |
68 | 68 | ||
69 | config CONFIG_PS | 69 | config PS |
70 | bool "ps" | 70 | bool "ps" |
71 | default n | 71 | default n |
72 | help | 72 | help |
73 | ps gives a snapshot of the current processes. | 73 | ps gives a snapshot of the current processes. |
74 | 74 | ||
75 | config CONFIG_FEATURE_PS_WIDE | 75 | config FEATURE_PS_WIDE |
76 | bool "Enable argument for wide output (-w)" | 76 | bool "Enable argument for wide output (-w)" |
77 | default n | 77 | default n |
78 | depends on CONFIG_PS | 78 | depends on PS |
79 | help | 79 | help |
80 | Support argument 'w' for wide output. | 80 | Support argument 'w' for wide output. |
81 | If given once, 132 chars are printed and given more than | 81 | If given once, 132 chars are printed and given more than |
82 | one, the length is unlimited. | 82 | one, the length is unlimited. |
83 | 83 | ||
84 | config CONFIG_RENICE | 84 | config RENICE |
85 | bool "renice" | 85 | bool "renice" |
86 | default n | 86 | default n |
87 | help | 87 | help |
88 | Renice alters the scheduling priority of one or more running | 88 | Renice alters the scheduling priority of one or more running |
89 | processes. | 89 | processes. |
90 | 90 | ||
91 | config CONFIG_BB_SYSCTL | 91 | config BB_SYSCTL |
92 | bool "sysctl" | 92 | bool "sysctl" |
93 | default n | 93 | default n |
94 | help | 94 | help |
95 | Configure kernel parameters at runtime. | 95 | Configure kernel parameters at runtime. |
96 | 96 | ||
97 | config CONFIG_TOP | 97 | config TOP |
98 | bool "top" | 98 | bool "top" |
99 | default n | 99 | default n |
100 | help | 100 | help |
101 | The top program provides a dynamic real-time view of a running | 101 | The top program provides a dynamic real-time view of a running |
102 | system. | 102 | system. |
103 | 103 | ||
104 | config CONFIG_FEATURE_TOP_CPU_USAGE_PERCENTAGE | 104 | config FEATURE_TOP_CPU_USAGE_PERCENTAGE |
105 | bool "Support showing CPU usage percentage (add 2k bytes)" | 105 | bool "Support showing CPU usage percentage (add 2k bytes)" |
106 | default y | 106 | default y |
107 | depends on CONFIG_TOP | 107 | depends on TOP |
108 | help | 108 | help |
109 | Make top display CPU usage. | 109 | Make top display CPU usage. |
110 | 110 | ||
111 | config CONFIG_UPTIME | 111 | config UPTIME |
112 | bool "uptime" | 112 | bool "uptime" |
113 | default n | 113 | default n |
114 | help | 114 | help |
diff --git a/procps/Kbuild b/procps/Kbuild new file mode 100644 index 000000000..6a9a86637 --- /dev/null +++ b/procps/Kbuild | |||
@@ -0,0 +1,16 @@ | |||
1 | # Makefile for busybox | ||
2 | # | ||
3 | # Copyright (C) 1999-2005 by Erik Andersen <andersen@codepoet.org> | ||
4 | # | ||
5 | # Licensed under the GPL v2, see the file LICENSE in this tarball. | ||
6 | |||
7 | lib-y:= | ||
8 | lib-$(CONFIG_FREE) += free.o | ||
9 | lib-$(CONFIG_KILL) += kill.o | ||
10 | lib-$(CONFIG_PIDOF) += pidof.o | ||
11 | lib-$(CONFIG_PS) += ps.o | ||
12 | lib-$(CONFIG_RENICE) += renice.o | ||
13 | lib-$(CONFIG_BB_SYSCTL) += sysctl.o | ||
14 | lib-$(CONFIG_TOP) += top.o | ||
15 | lib-$(CONFIG_UPTIME) += uptime.o | ||
16 | lib-$(CONFIG_FUSER) += fuser.o | ||
diff --git a/procps/Makefile b/procps/Makefile deleted file mode 100644 index 1db6ffa58..000000000 --- a/procps/Makefile +++ /dev/null | |||
@@ -1,23 +0,0 @@ | |||
1 | # Makefile for busybox | ||
2 | # | ||
3 | # Copyright (C) 1999-2005 by Erik Andersen <andersen@codepoet.org> | ||
4 | # | ||
5 | # Licensed under the GPL v2, see the file LICENSE in this tarball. | ||
6 | |||
7 | ifndef top_srcdir | ||
8 | top_srcdir=.. | ||
9 | endif | ||
10 | ifndef top_builddir | ||
11 | top_builddir=.. | ||
12 | endif | ||
13 | srcdir=$(top_srcdir)/procps | ||
14 | PROCPS_DIR:=./ | ||
15 | include $(top_srcdir)/Rules.mak | ||
16 | include $(top_builddir)/.config | ||
17 | include Makefile.in | ||
18 | all: $(libraries-y) | ||
19 | -include $(top_builddir)/.depend | ||
20 | |||
21 | clean: | ||
22 | rm -f *.o *.a $(AR_TARGET) | ||
23 | |||
diff --git a/procps/Makefile.in b/procps/Makefile.in deleted file mode 100644 index 261c49b02..000000000 --- a/procps/Makefile.in +++ /dev/null | |||
@@ -1,37 +0,0 @@ | |||
1 | # Makefile for busybox | ||
2 | # | ||
3 | # Copyright (C) 1999-2005 by Erik Andersen <andersen@codepoet.org> | ||
4 | # | ||
5 | # Licensed under the GPL v2, see the file LICENSE in this tarball. | ||
6 | |||
7 | PROCPS_AR:=procps.a | ||
8 | ifndef $(PROCPS_DIR) | ||
9 | PROCPS_DIR:=$(top_builddir)/procps/ | ||
10 | endif | ||
11 | srcdir=$(top_srcdir)/procps | ||
12 | |||
13 | PROCPS-y:= | ||
14 | PROCPS-$(CONFIG_FREE) += free.o | ||
15 | PROCPS-$(CONFIG_KILL) += kill.o | ||
16 | PROCPS-$(CONFIG_PIDOF) += pidof.o | ||
17 | PROCPS-$(CONFIG_PS) += ps.o | ||
18 | PROCPS-$(CONFIG_RENICE) += renice.o | ||
19 | PROCPS-$(CONFIG_BB_SYSCTL) += sysctl.o | ||
20 | PROCPS-$(CONFIG_TOP) += top.o | ||
21 | PROCPS-$(CONFIG_UPTIME) += uptime.o | ||
22 | PROCPS-$(CONFIG_FUSER) += fuser.o | ||
23 | |||
24 | ifneq ($(strip $(PROCPS-y)),) | ||
25 | libraries-y+=$(PROCPS_DIR)$(PROCPS_AR) | ||
26 | endif | ||
27 | |||
28 | PROCPS_SRC-y:=$(patsubst %.o,$(srcdir)/%.c,$(PROCPS-y)) | ||
29 | PROCPS_SRC-a:=$(wildcard $(srcdir)/*.c) | ||
30 | APPLET_SRC-y+=$(PROCPS_SRC-y) | ||
31 | APPLET_SRC-a+=$(PROCPS_SRC-a) | ||
32 | |||
33 | $(PROCPS_DIR)$(PROCPS_AR): $(patsubst %,$(PROCPS_DIR)%, $(PROCPS-y)) | ||
34 | $(do_ar) | ||
35 | |||
36 | $(PROCPS_DIR)%.o: $(srcdir)/%.c | ||
37 | $(compile.c) | ||
diff --git a/runit/Config.in b/runit/Config.in index 073ca1425..b90b0232e 100644 --- a/runit/Config.in +++ b/runit/Config.in | |||
@@ -5,30 +5,30 @@ | |||
5 | 5 | ||
6 | menu "Runit Utilities" | 6 | menu "Runit Utilities" |
7 | 7 | ||
8 | config CONFIG_CHPST | 8 | config CHPST |
9 | bool "chpst" | 9 | bool "chpst" |
10 | default n | 10 | default n |
11 | help | 11 | help |
12 | chpst changes the process state according to the given options, and | 12 | chpst changes the process state according to the given options, and |
13 | execs specified program. | 13 | execs specified program. |
14 | 14 | ||
15 | config CONFIG_SETUIDGID | 15 | config SETUIDGID |
16 | bool "setuidgid" | 16 | bool "setuidgid" |
17 | help | 17 | help |
18 | Sets soft resource limits as specified by options | 18 | Sets soft resource limits as specified by options |
19 | 19 | ||
20 | config CONFIG_ENVUIDGID | 20 | config ENVUIDGID |
21 | bool "envuidgid" | 21 | bool "envuidgid" |
22 | help | 22 | help |
23 | Sets $UID to account's uid and $GID to account's gid | 23 | Sets $UID to account's uid and $GID to account's gid |
24 | 24 | ||
25 | config CONFIG_ENVDIR | 25 | config ENVDIR |
26 | bool "envdir" | 26 | bool "envdir" |
27 | help | 27 | help |
28 | Sets various environment variables as specified by files | 28 | Sets various environment variables as specified by files |
29 | in the given directory | 29 | in the given directory |
30 | 30 | ||
31 | config CONFIG_SOFTLIMIT | 31 | config SOFTLIMIT |
32 | bool "softlimit" | 32 | bool "softlimit" |
33 | help | 33 | help |
34 | Sets soft resource limits as specified by options | 34 | Sets soft resource limits as specified by options |
diff --git a/runit/Kbuild b/runit/Kbuild new file mode 100644 index 000000000..9fee84224 --- /dev/null +++ b/runit/Kbuild | |||
@@ -0,0 +1,8 @@ | |||
1 | # Makefile for busybox | ||
2 | # | ||
3 | # Copyright (C) 1999-2005 by Erik Andersen <andersen@codepoet.org> | ||
4 | # | ||
5 | # Licensed under the GPL v2, see the file LICENSE in this tarball. | ||
6 | |||
7 | lib-y:= | ||
8 | lib-$(CONFIG_CHPST) += chpst.o uidgid.o | ||
diff --git a/runit/Makefile b/runit/Makefile deleted file mode 100644 index be65856fe..000000000 --- a/runit/Makefile +++ /dev/null | |||
@@ -1,23 +0,0 @@ | |||
1 | # Makefile for busybox | ||
2 | # | ||
3 | # Copyright (C) 1999-2005 by Erik Andersen <andersen@codepoet.org> | ||
4 | # | ||
5 | # Licensed under the GPL v2, see the file LICENSE in this tarball. | ||
6 | |||
7 | ifndef top_srcdir | ||
8 | top_srcdir=.. | ||
9 | endif | ||
10 | ifndef top_builddir | ||
11 | top_builddir=.. | ||
12 | endif | ||
13 | srcdir=$(top_srcdir)/runit | ||
14 | RUNIT_DIR:=./ | ||
15 | include $(top_srcdir)/Rules.mak | ||
16 | include $(top_builddir)/.config | ||
17 | include Makefile.in | ||
18 | all: $(libraries-y) | ||
19 | -include $(top_builddir)/.depend | ||
20 | |||
21 | clean: | ||
22 | rm -f *.o *.a $(AR_TARGET) | ||
23 | |||
diff --git a/runit/Makefile.in b/runit/Makefile.in deleted file mode 100644 index d8cea10c2..000000000 --- a/runit/Makefile.in +++ /dev/null | |||
@@ -1,42 +0,0 @@ | |||
1 | # Makefile for busybox | ||
2 | # | ||
3 | # Copyright (C) 1999-2005 by Erik Andersen <andersen@codepoet.org> | ||
4 | # | ||
5 | # Licensed under the GPL v2, see the file LICENSE in this tarball. | ||
6 | |||
7 | RUNIT_AR:=runit.a | ||
8 | ifndef RUNIT_DIR | ||
9 | RUNIT_DIR:=$(top_builddir)/runit/ | ||
10 | endif | ||
11 | srcdir=$(top_srcdir)/runit | ||
12 | |||
13 | #unix_a:=buffer.o \ | ||
14 | #buffer_get.o buffer_put.o buffer_read.o buffer_write.o coe.o \ | ||
15 | #fd_copy.o fd_move.o fifo.o lock_ex.o lock_exnb.o \ | ||
16 | #ndelay_off.o ndelay_on.o open_append.o open_read.o \ | ||
17 | #open_trunc.o open_write.o openreadclose.o pathexec_env.o \ | ||
18 | #pathexec_run.o prot.o readclose.o seek_set.o sig.o \ | ||
19 | #sig_block.o sig_catch.o sig_pause.o stralloc_cat.o stralloc_catb.o \ | ||
20 | #stralloc_cats.o stralloc_eady.o stralloc_opyb.o stralloc_opys.o \ | ||
21 | #stralloc_pend.o wait_nohang.o \ | ||
22 | #wait_pid.o | ||
23 | |||
24 | RUNIT-y:= | ||
25 | RUNIT-$(CONFIG_CHPST) += chpst.o uidgid.o | ||
26 | |||
27 | RUNIT-y:=$(sort $(RUNIT-y)) | ||
28 | |||
29 | ifneq ($(strip $(RUNIT-y)),) | ||
30 | libraries-y+=$(RUNIT_DIR)$(RUNIT_AR) | ||
31 | endif | ||
32 | |||
33 | RUNIT_SRC-y:=$(patsubst %.o,$(srcdir)/%.c,$(RUNIT-y)) | ||
34 | RUNIT_SRC-a:=$(wildcard $(srcdir)/*.c) | ||
35 | APPLET_SRC-y+=$(RUNIT_SRC-y) | ||
36 | APPLET_SRC-a+=$(RUNIT_SRC-a) | ||
37 | |||
38 | $(RUNIT_DIR)$(RUNIT_AR): $(patsubst %,$(RUNIT_DIR)%, $(RUNIT-y)) | ||
39 | $(do_ar) | ||
40 | |||
41 | $(RUNIT_DIR)%.o: $(srcdir)/%.c | ||
42 | $(compile.c) | ||
diff --git a/scripts/Kbuild b/scripts/Kbuild new file mode 100644 index 000000000..80c60733e --- /dev/null +++ b/scripts/Kbuild | |||
@@ -0,0 +1,11 @@ | |||
1 | ### | ||
2 | # scripts contains sources for various helper programs used throughout | ||
3 | # the kernel for the build process. | ||
4 | # --------------------------------------------------------------------------- | ||
5 | |||
6 | hostprogs-y += usage | ||
7 | |||
8 | always := $(hostprogs-y) | ||
9 | |||
10 | # Let clean descend into subdirs | ||
11 | subdir- += basic kconfig | ||
diff --git a/scripts/Kbuild.include b/scripts/Kbuild.include new file mode 100644 index 000000000..b0d067be7 --- /dev/null +++ b/scripts/Kbuild.include | |||
@@ -0,0 +1,148 @@ | |||
1 | #### | ||
2 | # kbuild: Generic definitions | ||
3 | |||
4 | # Convinient variables | ||
5 | comma := , | ||
6 | squote := ' | ||
7 | empty := | ||
8 | space := $(empty) $(empty) | ||
9 | |||
10 | ### | ||
11 | # The temporary file to save gcc -MD generated dependencies must not | ||
12 | # contain a comma | ||
13 | depfile = $(subst $(comma),_,$(@D)/.$(@F).d) | ||
14 | |||
15 | ### | ||
16 | # Escape single quote for use in echo statements | ||
17 | escsq = $(subst $(squote),'\$(squote)',$1) | ||
18 | |||
19 | ### | ||
20 | # filechk is used to check if the content of a generated file is updated. | ||
21 | # Sample usage: | ||
22 | # define filechk_sample | ||
23 | # echo $KERNELRELEASE | ||
24 | # endef | ||
25 | # version.h : Makefile | ||
26 | # $(call filechk,sample) | ||
27 | # The rule defined shall write to stdout the content of the new file. | ||
28 | # The existing file will be compared with the new one. | ||
29 | # - If no file exist it is created | ||
30 | # - If the content differ the new file is used | ||
31 | # - If they are equal no change, and no timestamp update | ||
32 | # - stdin is piped in from the first prerequisite ($<) so one has | ||
33 | # to specify a valid file as first prerequisite (often the kbuild file) | ||
34 | define filechk | ||
35 | $(Q)set -e; \ | ||
36 | echo ' CHK $@'; \ | ||
37 | mkdir -p $(dir $@); \ | ||
38 | $(filechk_$(1)) < $< > $@.tmp; \ | ||
39 | if [ -r $@ ] && cmp -s $@ $@.tmp; then \ | ||
40 | rm -f $@.tmp; \ | ||
41 | else \ | ||
42 | echo ' UPD $@'; \ | ||
43 | mv -f $@.tmp $@; \ | ||
44 | fi | ||
45 | endef | ||
46 | |||
47 | ###### | ||
48 | # gcc support functions | ||
49 | # See documentation in Documentation/kbuild/makefiles.txt | ||
50 | |||
51 | # as-option | ||
52 | # Usage: cflags-y += $(call as-option, -Wa$(comma)-isa=foo,) | ||
53 | |||
54 | as-option = $(shell if $(CC) $(CFLAGS) $(1) -Wa,-Z -c -o /dev/null \ | ||
55 | -xassembler /dev/null > /dev/null 2>&1; then echo "$(1)"; \ | ||
56 | else echo "$(2)"; fi ;) | ||
57 | |||
58 | # cc-option | ||
59 | # Usage: cflags-y += $(call cc-option, -march=winchip-c6, -march=i586) | ||
60 | |||
61 | cc-option = $(shell if $(CC) $(CFLAGS) $(1) -S -o /dev/null -xc /dev/null \ | ||
62 | > /dev/null 2>&1; then echo "$(1)"; else echo "$(2)"; fi ;) | ||
63 | |||
64 | # cc-option-yn | ||
65 | # Usage: flag := $(call cc-option-yn, -march=winchip-c6) | ||
66 | cc-option-yn = $(shell if $(CC) $(CFLAGS) $(1) -S -o /dev/null -xc /dev/null \ | ||
67 | > /dev/null 2>&1; then echo "y"; else echo "n"; fi;) | ||
68 | |||
69 | # cc-option-align | ||
70 | # Prefix align with either -falign or -malign | ||
71 | cc-option-align = $(subst -functions=0,,\ | ||
72 | $(call cc-option,-falign-functions=0,-malign-functions=0)) | ||
73 | |||
74 | # cc-version | ||
75 | # Usage gcc-ver := $(call cc-version, $(CC)) | ||
76 | cc-version = $(shell $(CONFIG_SHELL) $(srctree)/scripts/gcc-version.sh \ | ||
77 | $(if $(1), $(1), $(CC))) | ||
78 | |||
79 | # cc-ifversion | ||
80 | # Usage: EXTRA_CFLAGS += $(call cc-ifversion, -lt, 0402, -O1) | ||
81 | cc-ifversion = $(shell if [ $(call cc-version, $(CC)) $(1) $(2) ]; then \ | ||
82 | echo $(3); fi;) | ||
83 | |||
84 | ### | ||
85 | # Shorthand for $(Q)$(MAKE) -f scripts/Makefile.build obj= | ||
86 | # Usage: | ||
87 | # $(Q)$(MAKE) $(build)=dir | ||
88 | build := -f $(if $(KBUILD_SRC),$(srctree)/)scripts/Makefile.build obj | ||
89 | |||
90 | # Prefix -I with $(srctree) if it is not an absolute path | ||
91 | addtree = $(if $(filter-out -I/%,$(1)),$(patsubst -I%,-I$(srctree)/%,$(1))) $(1) | ||
92 | # Find all -I options and call addtree | ||
93 | flags = $(foreach o,$($(1)),$(if $(filter -I%,$(o)),$(call addtree,$(o)),$(o))) | ||
94 | |||
95 | # If quiet is set, only print short version of command | ||
96 | cmd = @$(echo-cmd) $(cmd_$(1)) | ||
97 | |||
98 | # Add $(obj)/ for paths that is not absolute | ||
99 | objectify = $(foreach o,$(1),$(if $(filter /%,$(o)),$(o),$(obj)/$(o))) | ||
100 | |||
101 | ### | ||
102 | # if_changed - execute command if any prerequisite is newer than | ||
103 | # target, or command line has changed | ||
104 | # if_changed_dep - as if_changed, but uses fixdep to reveal dependencies | ||
105 | # including used config symbols | ||
106 | # if_changed_rule - as if_changed but execute rule instead | ||
107 | # See Documentation/kbuild/makefiles.txt for more info | ||
108 | |||
109 | ifneq ($(KBUILD_NOCMDDEP),1) | ||
110 | # Check if both arguments has same arguments. Result in empty string if equal | ||
111 | # User may override this check using make KBUILD_NOCMDDEP=1 | ||
112 | arg-check = $(strip $(filter-out $(1), $(2)) $(filter-out $(2), $(1)) ) | ||
113 | endif | ||
114 | |||
115 | # echo command. Short version is $(quiet) equals quiet, otherwise full command | ||
116 | echo-cmd = $(if $($(quiet)cmd_$(1)), \ | ||
117 | echo ' $(call escsq,$($(quiet)cmd_$(1)))';) | ||
118 | |||
119 | make-cmd = $(subst \#,\\\#,$(subst $$,$$$$,$(call escsq,$(cmd_$(1))))) | ||
120 | |||
121 | # function to only execute the passed command if necessary | ||
122 | # >'< substitution is for echo to work, >$< substitution to preserve $ when reloading .cmd file | ||
123 | # note: when using inline perl scripts [perl -e '...$$t=1;...'] in $(cmd_xxx) double $$ your perl vars | ||
124 | # | ||
125 | if_changed = $(if $(strip $(filter-out $(PHONY),$?) \ | ||
126 | $(call arg-check, $(cmd_$(1)), $(cmd_$@)) ), \ | ||
127 | @set -e; \ | ||
128 | $(echo-cmd) $(cmd_$(1)); \ | ||
129 | echo 'cmd_$@ := $(make-cmd)' > $(@D)/.$(@F).cmd) | ||
130 | |||
131 | # execute the command and also postprocess generated .d dependencies | ||
132 | # file | ||
133 | if_changed_dep = $(if $(strip $(filter-out $(PHONY),$?) \ | ||
134 | $(filter-out FORCE $(wildcard $^),$^) \ | ||
135 | $(call arg-check, $(cmd_$(1)), $(cmd_$@)) ), \ | ||
136 | @set -e; \ | ||
137 | $(echo-cmd) $(cmd_$(1)); \ | ||
138 | scripts/basic/fixdep $(depfile) $@ '$(make-cmd)' > $(@D)/.$(@F).tmp; \ | ||
139 | rm -f $(depfile); \ | ||
140 | mv -f $(@D)/.$(@F).tmp $(@D)/.$(@F).cmd) | ||
141 | |||
142 | # Usage: $(call if_changed_rule,foo) | ||
143 | # will check if $(cmd_foo) changed, or any of the prequisites changed, | ||
144 | # and if so will execute $(rule_foo) | ||
145 | if_changed_rule = $(if $(strip $(filter-out $(PHONY),$?) \ | ||
146 | $(call arg-check, $(cmd_$(1)), $(cmd_$@)) ),\ | ||
147 | @set -e; \ | ||
148 | $(rule_$(1))) | ||
diff --git a/scripts/Makefile.build b/scripts/Makefile.build new file mode 100644 index 000000000..e48e60da3 --- /dev/null +++ b/scripts/Makefile.build | |||
@@ -0,0 +1,338 @@ | |||
1 | # ========================================================================== | ||
2 | # Building | ||
3 | # ========================================================================== | ||
4 | |||
5 | src := $(obj) | ||
6 | |||
7 | PHONY := __build | ||
8 | __build: | ||
9 | |||
10 | # Read .config if it exist, otherwise ignore | ||
11 | -include .config | ||
12 | |||
13 | include scripts/Kbuild.include | ||
14 | |||
15 | # The filename Kbuild has precedence over Makefile | ||
16 | kbuild-dir := $(if $(filter /%,$(src)),$(src),$(srctree)/$(src)) | ||
17 | include $(if $(wildcard $(kbuild-dir)/Kbuild), $(kbuild-dir)/Kbuild, $(kbuild-dir)/Makefile) | ||
18 | |||
19 | include scripts/Makefile.lib | ||
20 | |||
21 | ifdef host-progs | ||
22 | ifneq ($(hostprogs-y),$(host-progs)) | ||
23 | $(warning kbuild: $(obj)/Makefile - Usage of host-progs is deprecated. Please replace with hostprogs-y!) | ||
24 | hostprogs-y += $(host-progs) | ||
25 | endif | ||
26 | endif | ||
27 | |||
28 | # Do not include host rules unles needed | ||
29 | ifneq ($(hostprogs-y)$(hostprogs-m),) | ||
30 | include scripts/Makefile.host | ||
31 | endif | ||
32 | |||
33 | ifneq ($(KBUILD_SRC),) | ||
34 | # Create output directory if not already present | ||
35 | _dummy := $(shell [ -d $(obj) ] || mkdir -p $(obj)) | ||
36 | |||
37 | # Create directories for object files if directory does not exist | ||
38 | # Needed when obj-y := dir/file.o syntax is used | ||
39 | _dummy := $(foreach d,$(obj-dirs), $(shell [ -d $(d) ] || mkdir -p $(d))) | ||
40 | endif | ||
41 | |||
42 | |||
43 | ifdef EXTRA_TARGETS | ||
44 | $(warning kbuild: $(obj)/Makefile - Usage of EXTRA_TARGETS is obsolete in 2.6. Please fix!) | ||
45 | endif | ||
46 | |||
47 | ifdef build-targets | ||
48 | $(warning kbuild: $(obj)/Makefile - Usage of build-targets is obsolete in 2.6. Please fix!) | ||
49 | endif | ||
50 | |||
51 | ifdef export-objs | ||
52 | $(warning kbuild: $(obj)/Makefile - Usage of export-objs is obsolete in 2.6. Please fix!) | ||
53 | endif | ||
54 | |||
55 | ifdef O_TARGET | ||
56 | $(warning kbuild: $(obj)/Makefile - Usage of O_TARGET := $(O_TARGET) is obsolete in 2.6. Please fix!) | ||
57 | endif | ||
58 | |||
59 | ifdef L_TARGET | ||
60 | $(error kbuild: $(obj)/Makefile - Use of L_TARGET is replaced by lib-y in 2.6. Please fix!) | ||
61 | endif | ||
62 | |||
63 | ifdef list-multi | ||
64 | $(warning kbuild: $(obj)/Makefile - list-multi := $(list-multi) is obsolete in 2.6. Please fix!) | ||
65 | endif | ||
66 | |||
67 | ifndef obj | ||
68 | $(warning kbuild: Makefile.build is included improperly) | ||
69 | endif | ||
70 | |||
71 | # =========================================================================== | ||
72 | |||
73 | ifneq ($(strip $(lib-y) $(lib-m) $(lib-n) $(lib-)),) | ||
74 | lib-target := $(obj)/lib.a | ||
75 | endif | ||
76 | |||
77 | ifneq ($(strip $(obj-y) $(obj-m) $(obj-n) $(obj-) $(lib-target)),) | ||
78 | builtin-target := $(obj)/built-in.o | ||
79 | endif | ||
80 | |||
81 | # We keep a list of all modules in $(MODVERDIR) | ||
82 | |||
83 | __build: $(if $(KBUILD_BUILTIN),$(builtin-target) $(lib-target) $(extra-y)) \ | ||
84 | $(if $(KBUILD_MODULES),$(obj-m)) \ | ||
85 | $(subdir-ym) $(always) | ||
86 | @: | ||
87 | |||
88 | # Linus' kernel sanity checking tool | ||
89 | ifneq ($(KBUILD_CHECKSRC),0) | ||
90 | ifeq ($(KBUILD_CHECKSRC),2) | ||
91 | quiet_cmd_force_checksrc = CHECK $< | ||
92 | cmd_force_checksrc = $(CHECK) $(CHECKFLAGS) $(c_flags) $< ; | ||
93 | else | ||
94 | quiet_cmd_checksrc = CHECK $< | ||
95 | cmd_checksrc = $(CHECK) $(CHECKFLAGS) $(c_flags) $< ; | ||
96 | endif | ||
97 | endif | ||
98 | |||
99 | |||
100 | # Compile C sources (.c) | ||
101 | # --------------------------------------------------------------------------- | ||
102 | |||
103 | # Default is built-in, unless we know otherwise | ||
104 | modkern_cflags := $(CFLAGS_KERNEL) | ||
105 | quiet_modtag := $(empty) $(empty) | ||
106 | |||
107 | $(real-objs-m) : modkern_cflags := $(CFLAGS_MODULE) | ||
108 | $(real-objs-m:.o=.i) : modkern_cflags := $(CFLAGS_MODULE) | ||
109 | $(real-objs-m:.o=.s) : modkern_cflags := $(CFLAGS_MODULE) | ||
110 | $(real-objs-m:.o=.lst): modkern_cflags := $(CFLAGS_MODULE) | ||
111 | |||
112 | $(real-objs-m) : quiet_modtag := [M] | ||
113 | $(real-objs-m:.o=.i) : quiet_modtag := [M] | ||
114 | $(real-objs-m:.o=.s) : quiet_modtag := [M] | ||
115 | $(real-objs-m:.o=.lst): quiet_modtag := [M] | ||
116 | |||
117 | $(obj-m) : quiet_modtag := [M] | ||
118 | |||
119 | # Default for not multi-part modules | ||
120 | modname = $(*F) | ||
121 | |||
122 | $(multi-objs-m) : modname = $(modname-multi) | ||
123 | $(multi-objs-m:.o=.i) : modname = $(modname-multi) | ||
124 | $(multi-objs-m:.o=.s) : modname = $(modname-multi) | ||
125 | $(multi-objs-m:.o=.lst) : modname = $(modname-multi) | ||
126 | $(multi-objs-y) : modname = $(modname-multi) | ||
127 | $(multi-objs-y:.o=.i) : modname = $(modname-multi) | ||
128 | $(multi-objs-y:.o=.s) : modname = $(modname-multi) | ||
129 | $(multi-objs-y:.o=.lst) : modname = $(modname-multi) | ||
130 | |||
131 | quiet_cmd_cc_s_c = CC $(quiet_modtag) $@ | ||
132 | cmd_cc_s_c = $(CC) $(c_flags) -fverbose-asm -S -o $@ $< | ||
133 | |||
134 | %.s: %.c FORCE | ||
135 | $(call if_changed_dep,cc_s_c) | ||
136 | |||
137 | quiet_cmd_cc_i_c = CPP $(quiet_modtag) $@ | ||
138 | cmd_cc_i_c = $(CPP) $(c_flags) -o $@ $< | ||
139 | |||
140 | %.i: %.c FORCE | ||
141 | $(call if_changed_dep,cc_i_c) | ||
142 | |||
143 | # C (.c) files | ||
144 | # The C file is compiled and updated dependency information is generated. | ||
145 | # (See cmd_cc_o_c + relevant part of rule_cc_o_c) | ||
146 | |||
147 | quiet_cmd_cc_o_c = CC $(quiet_modtag) $@ | ||
148 | |||
149 | ifndef CONFIG_MODVERSIONS | ||
150 | cmd_cc_o_c = $(CC) $(c_flags) -c -o $@ $< | ||
151 | |||
152 | else | ||
153 | # When module versioning is enabled the following steps are executed: | ||
154 | # o compile a .tmp_<file>.o from <file>.c | ||
155 | # o if .tmp_<file>.o doesn't contain a __ksymtab version, i.e. does | ||
156 | # not export symbols, we just rename .tmp_<file>.o to <file>.o and | ||
157 | # are done. | ||
158 | # o otherwise, we calculate symbol versions using the good old | ||
159 | # genksyms on the preprocessed source and postprocess them in a way | ||
160 | # that they are usable as a linker script | ||
161 | # o generate <file>.o from .tmp_<file>.o using the linker to | ||
162 | # replace the unresolved symbols __crc_exported_symbol with | ||
163 | # the actual value of the checksum generated by genksyms | ||
164 | |||
165 | cmd_cc_o_c = $(CC) $(c_flags) -c -o $(@D)/.tmp_$(@F) $< | ||
166 | cmd_modversions = \ | ||
167 | if $(OBJDUMP) -h $(@D)/.tmp_$(@F) | grep -q __ksymtab; then \ | ||
168 | $(CPP) -D__GENKSYMS__ $(c_flags) $< \ | ||
169 | | $(GENKSYMS) -a $(ARCH) \ | ||
170 | > $(@D)/.tmp_$(@F:.o=.ver); \ | ||
171 | \ | ||
172 | $(LD) $(LDFLAGS) -r -o $@ $(@D)/.tmp_$(@F) \ | ||
173 | -T $(@D)/.tmp_$(@F:.o=.ver); \ | ||
174 | rm -f $(@D)/.tmp_$(@F) $(@D)/.tmp_$(@F:.o=.ver); \ | ||
175 | else \ | ||
176 | mv -f $(@D)/.tmp_$(@F) $@; \ | ||
177 | fi; | ||
178 | endif | ||
179 | |||
180 | define rule_cc_o_c | ||
181 | $(call echo-cmd,checksrc) $(cmd_checksrc) \ | ||
182 | $(call echo-cmd,cc_o_c) $(cmd_cc_o_c); \ | ||
183 | $(cmd_modversions) \ | ||
184 | scripts/basic/fixdep $(depfile) $@ '$(call make-cmd,cc_o_c)' > $(@D)/.$(@F).tmp; \ | ||
185 | rm -f $(depfile); \ | ||
186 | mv -f $(@D)/.$(@F).tmp $(@D)/.$(@F).cmd | ||
187 | endef | ||
188 | |||
189 | # Built-in and composite module parts | ||
190 | |||
191 | %.o: %.c FORCE | ||
192 | $(call cmd,force_checksrc) | ||
193 | $(call if_changed_rule,cc_o_c) | ||
194 | |||
195 | # Single-part modules are special since we need to mark them in $(MODVERDIR) | ||
196 | |||
197 | $(single-used-m): %.o: %.c FORCE | ||
198 | $(call cmd,force_checksrc) | ||
199 | $(call if_changed_rule,cc_o_c) | ||
200 | @{ echo $(@:.o=.ko); echo $@; } > $(MODVERDIR)/$(@F:.o=.mod) | ||
201 | |||
202 | quiet_cmd_cc_lst_c = MKLST $@ | ||
203 | cmd_cc_lst_c = $(CC) $(c_flags) -g -c -o $*.o $< && \ | ||
204 | $(CONFIG_SHELL) $(srctree)/scripts/makelst $*.o \ | ||
205 | System.map $(OBJDUMP) > $@ | ||
206 | |||
207 | %.lst: %.c FORCE | ||
208 | $(call if_changed_dep,cc_lst_c) | ||
209 | |||
210 | # Compile assembler sources (.S) | ||
211 | # --------------------------------------------------------------------------- | ||
212 | |||
213 | modkern_aflags := $(AFLAGS_KERNEL) | ||
214 | |||
215 | $(real-objs-m) : modkern_aflags := $(AFLAGS_MODULE) | ||
216 | $(real-objs-m:.o=.s): modkern_aflags := $(AFLAGS_MODULE) | ||
217 | |||
218 | quiet_cmd_as_s_S = CPP $(quiet_modtag) $@ | ||
219 | cmd_as_s_S = $(CPP) $(a_flags) -o $@ $< | ||
220 | |||
221 | %.s: %.S FORCE | ||
222 | $(call if_changed_dep,as_s_S) | ||
223 | |||
224 | quiet_cmd_as_o_S = AS $(quiet_modtag) $@ | ||
225 | cmd_as_o_S = $(CC) $(a_flags) -c -o $@ $< | ||
226 | |||
227 | %.o: %.S FORCE | ||
228 | $(call if_changed_dep,as_o_S) | ||
229 | |||
230 | targets += $(real-objs-y) $(real-objs-m) $(lib-y) | ||
231 | targets += $(extra-y) $(MAKECMDGOALS) $(always) | ||
232 | |||
233 | # Linker scripts preprocessor (.lds.S -> .lds) | ||
234 | # --------------------------------------------------------------------------- | ||
235 | quiet_cmd_cpp_lds_S = LDS $@ | ||
236 | cmd_cpp_lds_S = $(CPP) $(cpp_flags) -D__ASSEMBLY__ -o $@ $< | ||
237 | |||
238 | %.lds: %.lds.S FORCE | ||
239 | $(call if_changed_dep,cpp_lds_S) | ||
240 | |||
241 | # Build the compiled-in targets | ||
242 | # --------------------------------------------------------------------------- | ||
243 | |||
244 | # To build objects in subdirs, we need to descend into the directories | ||
245 | $(sort $(subdir-obj-y)): $(subdir-ym) ; | ||
246 | |||
247 | # | ||
248 | # Rule to compile a set of .o files into one .o file | ||
249 | # | ||
250 | ifdef builtin-target | ||
251 | quiet_cmd_link_o_target = LD $@ | ||
252 | # If the list of objects to link is empty, just create an empty built-in.o | ||
253 | cmd_link_o_target = $(if $(strip $(obj-y)),\ | ||
254 | $(LD) $(ld_flags) -r -o $@ $(filter $(obj-y), $^),\ | ||
255 | rm -f $@; $(AR) rcs $@) | ||
256 | |||
257 | $(builtin-target): $(obj-y) FORCE | ||
258 | $(call if_changed,link_o_target) | ||
259 | |||
260 | targets += $(builtin-target) | ||
261 | endif # builtin-target | ||
262 | |||
263 | # | ||
264 | # Rule to compile a set of .o files into one .a file | ||
265 | # | ||
266 | ifdef lib-target | ||
267 | quiet_cmd_link_l_target = AR $@ | ||
268 | cmd_link_l_target = rm -f $@; $(AR) $(EXTRA_ARFLAGS) rcs $@ $(lib-y) | ||
269 | |||
270 | $(lib-target): $(lib-y) FORCE | ||
271 | $(call if_changed,link_l_target) | ||
272 | |||
273 | targets += $(lib-target) | ||
274 | endif | ||
275 | |||
276 | # | ||
277 | # Rule to link composite objects | ||
278 | # | ||
279 | # Composite objects are specified in kbuild makefile as follows: | ||
280 | # <composite-object>-objs := <list of .o files> | ||
281 | # or | ||
282 | # <composite-object>-y := <list of .o files> | ||
283 | link_multi_deps = \ | ||
284 | $(filter $(addprefix $(obj)/, \ | ||
285 | $($(subst $(obj)/,,$(@:.o=-objs))) \ | ||
286 | $($(subst $(obj)/,,$(@:.o=-y)))), $^) | ||
287 | |||
288 | quiet_cmd_link_multi-y = LD $@ | ||
289 | cmd_link_multi-y = $(LD) $(ld_flags) -r -o $@ $(link_multi_deps) | ||
290 | |||
291 | quiet_cmd_link_multi-m = LD [M] $@ | ||
292 | cmd_link_multi-m = $(LD) $(ld_flags) $(LDFLAGS_MODULE) -o $@ $(link_multi_deps) | ||
293 | |||
294 | # We would rather have a list of rules like | ||
295 | # foo.o: $(foo-objs) | ||
296 | # but that's not so easy, so we rather make all composite objects depend | ||
297 | # on the set of all their parts | ||
298 | $(multi-used-y) : %.o: $(multi-objs-y) FORCE | ||
299 | $(call if_changed,link_multi-y) | ||
300 | |||
301 | $(multi-used-m) : %.o: $(multi-objs-m) FORCE | ||
302 | $(call if_changed,link_multi-m) | ||
303 | @{ echo $(@:.o=.ko); echo $(link_multi_deps); } > $(MODVERDIR)/$(@F:.o=.mod) | ||
304 | |||
305 | targets += $(multi-used-y) $(multi-used-m) | ||
306 | |||
307 | |||
308 | # Descending | ||
309 | # --------------------------------------------------------------------------- | ||
310 | |||
311 | PHONY += $(subdir-ym) | ||
312 | $(subdir-ym): | ||
313 | $(Q)$(MAKE) $(build)=$@ | ||
314 | |||
315 | # Add FORCE to the prequisites of a target to force it to be always rebuilt. | ||
316 | # --------------------------------------------------------------------------- | ||
317 | |||
318 | PHONY += FORCE | ||
319 | |||
320 | FORCE: | ||
321 | |||
322 | # Read all saved command lines and dependencies for the $(targets) we | ||
323 | # may be building above, using $(if_changed{,_dep}). As an | ||
324 | # optimization, we don't need to read them if the target does not | ||
325 | # exist, we will rebuild anyway in that case. | ||
326 | |||
327 | targets := $(wildcard $(sort $(targets))) | ||
328 | cmd_files := $(wildcard $(foreach f,$(targets),$(dir $(f)).$(notdir $(f)).cmd)) | ||
329 | |||
330 | ifneq ($(cmd_files),) | ||
331 | include $(cmd_files) | ||
332 | endif | ||
333 | |||
334 | |||
335 | # Declare the contents of the .PHONY variable as phony. We keep that | ||
336 | # information in a variable se we can use it in if_changed and friends. | ||
337 | |||
338 | .PHONY: $(PHONY) | ||
diff --git a/scripts/Makefile.host b/scripts/Makefile.host new file mode 100644 index 000000000..2d519704b --- /dev/null +++ b/scripts/Makefile.host | |||
@@ -0,0 +1,156 @@ | |||
1 | # ========================================================================== | ||
2 | # Building binaries on the host system | ||
3 | # Binaries are used during the compilation of the kernel, for example | ||
4 | # to preprocess a data file. | ||
5 | # | ||
6 | # Both C and C++ is supported, but preferred language is C for such utilities. | ||
7 | # | ||
8 | # Samle syntax (see Documentation/kbuild/makefile.txt for reference) | ||
9 | # hostprogs-y := bin2hex | ||
10 | # Will compile bin2hex.c and create an executable named bin2hex | ||
11 | # | ||
12 | # hostprogs-y := lxdialog | ||
13 | # lxdialog-objs := checklist.o lxdialog.o | ||
14 | # Will compile lxdialog.c and checklist.c, and then link the executable | ||
15 | # lxdialog, based on checklist.o and lxdialog.o | ||
16 | # | ||
17 | # hostprogs-y := qconf | ||
18 | # qconf-cxxobjs := qconf.o | ||
19 | # qconf-objs := menu.o | ||
20 | # Will compile qconf as a C++ program, and menu as a C program. | ||
21 | # They are linked as C++ code to the executable qconf | ||
22 | |||
23 | # hostprogs-y := conf | ||
24 | # conf-objs := conf.o libkconfig.so | ||
25 | # libkconfig-objs := expr.o type.o | ||
26 | # Will create a shared library named libkconfig.so that consist of | ||
27 | # expr.o and type.o (they are both compiled as C code and the object file | ||
28 | # are made as position independent code). | ||
29 | # conf.c is compiled as a c program, and conf.o is linked together with | ||
30 | # libkconfig.so as the executable conf. | ||
31 | # Note: Shared libraries consisting of C++ files are not supported | ||
32 | |||
33 | __hostprogs := $(sort $(hostprogs-y)$(hostprogs-m)) | ||
34 | |||
35 | # hostprogs-y := tools/build may have been specified. Retreive directory | ||
36 | obj-dirs += $(foreach f,$(__hostprogs), $(if $(dir $(f)),$(dir $(f)))) | ||
37 | obj-dirs := $(strip $(sort $(filter-out ./,$(obj-dirs)))) | ||
38 | |||
39 | |||
40 | # C code | ||
41 | # Executables compiled from a single .c file | ||
42 | host-csingle := $(foreach m,$(__hostprogs),$(if $($(m)-objs),,$(m))) | ||
43 | |||
44 | # C executables linked based on several .o files | ||
45 | host-cmulti := $(foreach m,$(__hostprogs),\ | ||
46 | $(if $($(m)-cxxobjs),,$(if $($(m)-objs),$(m)))) | ||
47 | |||
48 | # Object (.o) files compiled from .c files | ||
49 | host-cobjs := $(sort $(foreach m,$(__hostprogs),$($(m)-objs))) | ||
50 | |||
51 | # C++ code | ||
52 | # C++ executables compiled from at least on .cc file | ||
53 | # and zero or more .c files | ||
54 | host-cxxmulti := $(foreach m,$(__hostprogs),$(if $($(m)-cxxobjs),$(m))) | ||
55 | |||
56 | # C++ Object (.o) files compiled from .cc files | ||
57 | host-cxxobjs := $(sort $(foreach m,$(host-cxxmulti),$($(m)-cxxobjs))) | ||
58 | |||
59 | # Shared libaries (only .c supported) | ||
60 | # Shared libraries (.so) - all .so files referenced in "xxx-objs" | ||
61 | host-cshlib := $(sort $(filter %.so, $(host-cobjs))) | ||
62 | # Remove .so files from "xxx-objs" | ||
63 | host-cobjs := $(filter-out %.so,$(host-cobjs)) | ||
64 | |||
65 | #Object (.o) files used by the shared libaries | ||
66 | host-cshobjs := $(sort $(foreach m,$(host-cshlib),$($(m:.so=-objs)))) | ||
67 | |||
68 | __hostprogs := $(addprefix $(obj)/,$(__hostprogs)) | ||
69 | host-csingle := $(addprefix $(obj)/,$(host-csingle)) | ||
70 | host-cmulti := $(addprefix $(obj)/,$(host-cmulti)) | ||
71 | host-cobjs := $(addprefix $(obj)/,$(host-cobjs)) | ||
72 | host-cxxmulti := $(addprefix $(obj)/,$(host-cxxmulti)) | ||
73 | host-cxxobjs := $(addprefix $(obj)/,$(host-cxxobjs)) | ||
74 | host-cshlib := $(addprefix $(obj)/,$(host-cshlib)) | ||
75 | host-cshobjs := $(addprefix $(obj)/,$(host-cshobjs)) | ||
76 | obj-dirs := $(addprefix $(obj)/,$(obj-dirs)) | ||
77 | |||
78 | ##### | ||
79 | # Handle options to gcc. Support building with separate output directory | ||
80 | |||
81 | _hostc_flags = $(HOSTCFLAGS) $(HOST_EXTRACFLAGS) $(HOSTCFLAGS_$(*F).o) | ||
82 | _hostcxx_flags = $(HOSTCXXFLAGS) $(HOST_EXTRACXXFLAGS) $(HOSTCXXFLAGS_$(*F).o) | ||
83 | |||
84 | ifeq ($(KBUILD_SRC),) | ||
85 | __hostc_flags = $(_hostc_flags) | ||
86 | __hostcxx_flags = $(_hostcxx_flags) | ||
87 | else | ||
88 | __hostc_flags = -I$(obj) $(call flags,_hostc_flags) | ||
89 | __hostcxx_flags = -I$(obj) $(call flags,_hostcxx_flags) | ||
90 | endif | ||
91 | |||
92 | hostc_flags = -Wp,-MD,$(depfile) $(__hostc_flags) | ||
93 | hostcxx_flags = -Wp,-MD,$(depfile) $(__hostcxx_flags) | ||
94 | |||
95 | ##### | ||
96 | # Compile programs on the host | ||
97 | |||
98 | # Create executable from a single .c file | ||
99 | # host-csingle -> Executable | ||
100 | quiet_cmd_host-csingle = HOSTCC $@ | ||
101 | cmd_host-csingle = $(HOSTCC) $(hostc_flags) -o $@ $< \ | ||
102 | $(HOST_LOADLIBES) $(HOSTLOADLIBES_$(@F)) | ||
103 | $(host-csingle): %: %.c FORCE | ||
104 | $(call if_changed_dep,host-csingle) | ||
105 | |||
106 | # Link an executable based on list of .o files, all plain c | ||
107 | # host-cmulti -> executable | ||
108 | quiet_cmd_host-cmulti = HOSTLD $@ | ||
109 | cmd_host-cmulti = $(HOSTCC) $(HOSTLDFLAGS) -o $@ \ | ||
110 | $(addprefix $(obj)/,$($(@F)-objs)) \ | ||
111 | $(HOST_LOADLIBES) $(HOSTLOADLIBES_$(@F)) | ||
112 | $(host-cmulti): %: $(host-cobjs) $(host-cshlib) FORCE | ||
113 | $(call if_changed,host-cmulti) | ||
114 | |||
115 | # Create .o file from a single .c file | ||
116 | # host-cobjs -> .o | ||
117 | quiet_cmd_host-cobjs = HOSTCC $@ | ||
118 | cmd_host-cobjs = $(HOSTCC) $(hostc_flags) -c -o $@ $< | ||
119 | $(host-cobjs): %.o: %.c FORCE | ||
120 | $(call if_changed_dep,host-cobjs) | ||
121 | |||
122 | # Link an executable based on list of .o files, a mixture of .c and .cc | ||
123 | # host-cxxmulti -> executable | ||
124 | quiet_cmd_host-cxxmulti = HOSTLD $@ | ||
125 | cmd_host-cxxmulti = $(HOSTCXX) $(HOSTLDFLAGS) -o $@ \ | ||
126 | $(foreach o,objs cxxobjs,\ | ||
127 | $(addprefix $(obj)/,$($(@F)-$(o)))) \ | ||
128 | $(HOST_LOADLIBES) $(HOSTLOADLIBES_$(@F)) | ||
129 | $(host-cxxmulti): %: $(host-cobjs) $(host-cxxobjs) $(host-cshlib) FORCE | ||
130 | $(call if_changed,host-cxxmulti) | ||
131 | |||
132 | # Create .o file from a single .cc (C++) file | ||
133 | quiet_cmd_host-cxxobjs = HOSTCXX $@ | ||
134 | cmd_host-cxxobjs = $(HOSTCXX) $(hostcxx_flags) -c -o $@ $< | ||
135 | $(host-cxxobjs): %.o: %.cc FORCE | ||
136 | $(call if_changed_dep,host-cxxobjs) | ||
137 | |||
138 | # Compile .c file, create position independent .o file | ||
139 | # host-cshobjs -> .o | ||
140 | quiet_cmd_host-cshobjs = HOSTCC -fPIC $@ | ||
141 | cmd_host-cshobjs = $(HOSTCC) $(hostc_flags) -fPIC -c -o $@ $< | ||
142 | $(host-cshobjs): %.o: %.c FORCE | ||
143 | $(call if_changed_dep,host-cshobjs) | ||
144 | |||
145 | # Link a shared library, based on position independent .o files | ||
146 | # *.o -> .so shared library (host-cshlib) | ||
147 | quiet_cmd_host-cshlib = HOSTLLD -shared $@ | ||
148 | cmd_host-cshlib = $(HOSTCC) $(HOSTLDFLAGS) -shared -o $@ \ | ||
149 | $(addprefix $(obj)/,$($(@F:.so=-objs))) \ | ||
150 | $(HOST_LOADLIBES) $(HOSTLOADLIBES_$(@F)) | ||
151 | $(host-cshlib): %: $(host-cshobjs) FORCE | ||
152 | $(call if_changed,host-cshlib) | ||
153 | |||
154 | targets += $(host-csingle) $(host-cmulti) $(host-cobjs)\ | ||
155 | $(host-cxxmulti) $(host-cxxobjs) $(host-cshlib) $(host-cshobjs) | ||
156 | |||
diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib new file mode 100644 index 000000000..2cb4935e8 --- /dev/null +++ b/scripts/Makefile.lib | |||
@@ -0,0 +1,165 @@ | |||
1 | # Backward compatibility - to be removed... | ||
2 | extra-y += $(EXTRA_TARGETS) | ||
3 | # Figure out what we need to build from the various variables | ||
4 | # =========================================================================== | ||
5 | |||
6 | # When an object is listed to be built compiled-in and modular, | ||
7 | # only build the compiled-in version | ||
8 | |||
9 | obj-m := $(filter-out $(obj-y),$(obj-m)) | ||
10 | |||
11 | # Libraries are always collected in one lib file. | ||
12 | # Filter out objects already built-in | ||
13 | |||
14 | lib-y := $(filter-out $(obj-y), $(sort $(lib-y) $(lib-m))) | ||
15 | |||
16 | |||
17 | # Handle objects in subdirs | ||
18 | # --------------------------------------------------------------------------- | ||
19 | # o if we encounter foo/ in $(obj-y), replace it by foo/built-in.o | ||
20 | # and add the directory to the list of dirs to descend into: $(subdir-y) | ||
21 | # o if we encounter foo/ in $(obj-m), remove it from $(obj-m) | ||
22 | # and add the directory to the list of dirs to descend into: $(subdir-m) | ||
23 | |||
24 | __subdir-y := $(patsubst %/,%,$(filter %/, $(obj-y))) | ||
25 | subdir-y += $(__subdir-y) | ||
26 | __subdir-m := $(patsubst %/,%,$(filter %/, $(obj-m))) | ||
27 | subdir-m += $(__subdir-m) | ||
28 | obj-y := $(patsubst %/, %/built-in.o, $(obj-y)) | ||
29 | obj-m := $(filter-out %/, $(obj-m)) | ||
30 | |||
31 | # Subdirectories we need to descend into | ||
32 | |||
33 | subdir-ym := $(sort $(subdir-y) $(subdir-m)) | ||
34 | |||
35 | # if $(foo-objs) exists, foo.o is a composite object | ||
36 | multi-used-y := $(sort $(foreach m,$(obj-y), $(if $(strip $($(m:.o=-objs)) $($(m:.o=-y))), $(m)))) | ||
37 | multi-used-m := $(sort $(foreach m,$(obj-m), $(if $(strip $($(m:.o=-objs)) $($(m:.o=-y))), $(m)))) | ||
38 | multi-used := $(multi-used-y) $(multi-used-m) | ||
39 | single-used-m := $(sort $(filter-out $(multi-used-m),$(obj-m))) | ||
40 | |||
41 | # Build list of the parts of our composite objects, our composite | ||
42 | # objects depend on those (obviously) | ||
43 | multi-objs-y := $(foreach m, $(multi-used-y), $($(m:.o=-objs)) $($(m:.o=-y))) | ||
44 | multi-objs-m := $(foreach m, $(multi-used-m), $($(m:.o=-objs)) $($(m:.o=-y))) | ||
45 | multi-objs := $(multi-objs-y) $(multi-objs-m) | ||
46 | |||
47 | # $(subdir-obj-y) is the list of objects in $(obj-y) which do not live | ||
48 | # in the local directory | ||
49 | subdir-obj-y := $(foreach o,$(obj-y),$(if $(filter-out $(o),$(notdir $(o))),$(o))) | ||
50 | |||
51 | # $(obj-dirs) is a list of directories that contain object files | ||
52 | obj-dirs := $(dir $(multi-objs) $(subdir-obj-y)) | ||
53 | |||
54 | # Replace multi-part objects by their individual parts, look at local dir only | ||
55 | real-objs-y := $(foreach m, $(filter-out $(subdir-obj-y), $(obj-y)), $(if $(strip $($(m:.o=-objs)) $($(m:.o=-y))),$($(m:.o=-objs)) $($(m:.o=-y)),$(m))) $(extra-y) | ||
56 | real-objs-m := $(foreach m, $(obj-m), $(if $(strip $($(m:.o=-objs)) $($(m:.o=-y))),$($(m:.o=-objs)) $($(m:.o=-y)),$(m))) | ||
57 | |||
58 | # Add subdir path | ||
59 | |||
60 | extra-y := $(addprefix $(obj)/,$(extra-y)) | ||
61 | always := $(addprefix $(obj)/,$(always)) | ||
62 | targets := $(addprefix $(obj)/,$(targets)) | ||
63 | obj-y := $(addprefix $(obj)/,$(obj-y)) | ||
64 | obj-m := $(addprefix $(obj)/,$(obj-m)) | ||
65 | lib-y := $(addprefix $(obj)/,$(lib-y)) | ||
66 | subdir-obj-y := $(addprefix $(obj)/,$(subdir-obj-y)) | ||
67 | real-objs-y := $(addprefix $(obj)/,$(real-objs-y)) | ||
68 | real-objs-m := $(addprefix $(obj)/,$(real-objs-m)) | ||
69 | single-used-m := $(addprefix $(obj)/,$(single-used-m)) | ||
70 | multi-used-y := $(addprefix $(obj)/,$(multi-used-y)) | ||
71 | multi-used-m := $(addprefix $(obj)/,$(multi-used-m)) | ||
72 | multi-objs-y := $(addprefix $(obj)/,$(multi-objs-y)) | ||
73 | multi-objs-m := $(addprefix $(obj)/,$(multi-objs-m)) | ||
74 | subdir-ym := $(addprefix $(obj)/,$(subdir-ym)) | ||
75 | obj-dirs := $(addprefix $(obj)/,$(obj-dirs)) | ||
76 | |||
77 | # These flags are needed for modversions and compiling, so we define them here | ||
78 | # already | ||
79 | # $(modname_flags) #defines KBUILD_MODNAME as the name of the module it will | ||
80 | # end up in (or would, if it gets compiled in) | ||
81 | # Note: It's possible that one object gets potentially linked into more | ||
82 | # than one module. In that case KBUILD_MODNAME will be set to foo_bar, | ||
83 | # where foo and bar are the name of the modules. | ||
84 | name-fix = $(subst $(comma),_,$(subst -,_,$1)) | ||
85 | basename_flags = -D"KBUILD_BASENAME=KBUILD_STR($(call name-fix,$(*F)))" | ||
86 | modname_flags = $(if $(filter 1,$(words $(modname))),\ | ||
87 | -D"KBUILD_MODNAME=KBUILD_STR($(call name-fix,$(modname)))") | ||
88 | |||
89 | _c_flags = $(CFLAGS) $(EXTRA_CFLAGS) $(CFLAGS_$(*F).o) | ||
90 | _a_flags = $(AFLAGS) $(EXTRA_AFLAGS) $(AFLAGS_$(*F).o) | ||
91 | _cpp_flags = $(CPPFLAGS) $(EXTRA_CPPFLAGS) $(CPPFLAGS_$(@F)) | ||
92 | |||
93 | # If building the kernel in a separate objtree expand all occurrences | ||
94 | # of -Idir to -I$(srctree)/dir except for absolute paths (starting with '/'). | ||
95 | |||
96 | ifeq ($(KBUILD_SRC),) | ||
97 | __c_flags = $(_c_flags) | ||
98 | __a_flags = $(_a_flags) | ||
99 | __cpp_flags = $(_cpp_flags) | ||
100 | else | ||
101 | |||
102 | # -I$(obj) locates generated .h files | ||
103 | # $(call addtree,-I$(obj)) locates .h files in srctree, from generated .c files | ||
104 | # and locates generated .h files | ||
105 | # FIXME: Replace both with specific CFLAGS* statements in the makefiles | ||
106 | __c_flags = $(call addtree,-I$(obj)) $(call flags,_c_flags) | ||
107 | __a_flags = $(call flags,_a_flags) | ||
108 | __cpp_flags = $(call flags,_cpp_flags) | ||
109 | endif | ||
110 | |||
111 | c_flags = -Wp,-MD,$(depfile) $(NOSTDINC_FLAGS) $(CPPFLAGS) \ | ||
112 | $(__c_flags) $(modkern_cflags) \ | ||
113 | -D"KBUILD_STR(s)=\#s" $(basename_flags) $(modname_flags) | ||
114 | |||
115 | a_flags = -Wp,-MD,$(depfile) $(NOSTDINC_FLAGS) $(CPPFLAGS) \ | ||
116 | $(__a_flags) $(modkern_aflags) | ||
117 | |||
118 | cpp_flags = -Wp,-MD,$(depfile) $(NOSTDINC_FLAGS) $(__cpp_flags) | ||
119 | |||
120 | ld_flags = $(LDFLAGS) $(EXTRA_LDFLAGS) | ||
121 | |||
122 | # Finds the multi-part object the current object will be linked into | ||
123 | modname-multi = $(sort $(foreach m,$(multi-used),\ | ||
124 | $(if $(filter $(subst $(obj)/,,$*.o), $($(m:.o=-objs)) $($(m:.o=-y))),$(m:.o=)))) | ||
125 | |||
126 | # Shipped files | ||
127 | # =========================================================================== | ||
128 | |||
129 | quiet_cmd_shipped = SHIPPED $@ | ||
130 | cmd_shipped = cat $< > $@ | ||
131 | |||
132 | $(obj)/%:: $(src)/%_shipped | ||
133 | $(call cmd,shipped) | ||
134 | |||
135 | # Commands useful for building a boot image | ||
136 | # =========================================================================== | ||
137 | # | ||
138 | # Use as following: | ||
139 | # | ||
140 | # target: source(s) FORCE | ||
141 | # $(if_changed,ld/objcopy/gzip) | ||
142 | # | ||
143 | # and add target to EXTRA_TARGETS so that we know we have to | ||
144 | # read in the saved command line | ||
145 | |||
146 | # Linking | ||
147 | # --------------------------------------------------------------------------- | ||
148 | |||
149 | quiet_cmd_ld = LD $@ | ||
150 | cmd_ld = $(LD) $(LDFLAGS) $(EXTRA_LDFLAGS) $(LDFLAGS_$(@F)) \ | ||
151 | $(filter-out FORCE,$^) -o $@ | ||
152 | |||
153 | # Objcopy | ||
154 | # --------------------------------------------------------------------------- | ||
155 | |||
156 | quiet_cmd_objcopy = OBJCOPY $@ | ||
157 | cmd_objcopy = $(OBJCOPY) $(OBJCOPYFLAGS) $(OBJCOPYFLAGS_$(@F)) $< $@ | ||
158 | |||
159 | # Gzip | ||
160 | # --------------------------------------------------------------------------- | ||
161 | |||
162 | quiet_cmd_gzip = GZIP $@ | ||
163 | cmd_gzip = gzip -f -9 < $< > $@ | ||
164 | |||
165 | |||
diff --git a/scripts/basic/Makefile b/scripts/basic/Makefile new file mode 100644 index 000000000..f22e94c3a --- /dev/null +++ b/scripts/basic/Makefile | |||
@@ -0,0 +1,18 @@ | |||
1 | ### | ||
2 | # Makefile.basic list the most basic programs used during the build process. | ||
3 | # The programs listed herein is what is needed to do the basic stuff, | ||
4 | # such as splitting .config and fix dependency file. | ||
5 | # This initial step is needed to avoid files to be recompiled | ||
6 | # when kernel configuration changes (which is what happens when | ||
7 | # .config is included by main Makefile. | ||
8 | # --------------------------------------------------------------------------- | ||
9 | # fixdep: Used to generate dependency information during build process | ||
10 | # split-include: Divide all config symbols up in a number of files in | ||
11 | # include/config/... | ||
12 | # docproc: Used in Documentation/docbook | ||
13 | |||
14 | hostprogs-y := fixdep split-include docproc | ||
15 | always := $(hostprogs-y) | ||
16 | |||
17 | # fixdep is needed to compile other host programs | ||
18 | $(addprefix $(obj)/,$(filter-out fixdep,$(always))): $(obj)/fixdep | ||
diff --git a/scripts/basic/docproc.c b/scripts/basic/docproc.c new file mode 100644 index 000000000..cb02baa63 --- /dev/null +++ b/scripts/basic/docproc.c | |||
@@ -0,0 +1,398 @@ | |||
1 | /* | ||
2 | * docproc is a simple preprocessor for the template files | ||
3 | * used as placeholders for the kernel internal documentation. | ||
4 | * docproc is used for documentation-frontend and | ||
5 | * dependency-generator. | ||
6 | * The two usages have in common that they require | ||
7 | * some knowledge of the .tmpl syntax, therefore they | ||
8 | * are kept together. | ||
9 | * | ||
10 | * documentation-frontend | ||
11 | * Scans the template file and call kernel-doc for | ||
12 | * all occurrences of ![EIF]file | ||
13 | * Beforehand each referenced file are scanned for | ||
14 | * any exported sympols "EXPORT_SYMBOL()" statements. | ||
15 | * This is used to create proper -function and | ||
16 | * -nofunction arguments in calls to kernel-doc. | ||
17 | * Usage: docproc doc file.tmpl | ||
18 | * | ||
19 | * dependency-generator: | ||
20 | * Scans the template file and list all files | ||
21 | * referenced in a format recognized by make. | ||
22 | * Usage: docproc depend file.tmpl | ||
23 | * Writes dependency information to stdout | ||
24 | * in the following format: | ||
25 | * file.tmpl src.c src2.c | ||
26 | * The filenames are obtained from the following constructs: | ||
27 | * !Efilename | ||
28 | * !Ifilename | ||
29 | * !Dfilename | ||
30 | * !Ffilename | ||
31 | * | ||
32 | */ | ||
33 | |||
34 | #include <stdio.h> | ||
35 | #include <stdlib.h> | ||
36 | #include <string.h> | ||
37 | #include <ctype.h> | ||
38 | #include <unistd.h> | ||
39 | #include <limits.h> | ||
40 | #include <sys/types.h> | ||
41 | #include <sys/wait.h> | ||
42 | |||
43 | /* exitstatus is used to keep track of any failing calls to kernel-doc, | ||
44 | * but execution continues. */ | ||
45 | int exitstatus = 0; | ||
46 | |||
47 | typedef void DFL(char *); | ||
48 | DFL *defaultline; | ||
49 | |||
50 | typedef void FILEONLY(char * file); | ||
51 | FILEONLY *internalfunctions; | ||
52 | FILEONLY *externalfunctions; | ||
53 | FILEONLY *symbolsonly; | ||
54 | |||
55 | typedef void FILELINE(char * file, char * line); | ||
56 | FILELINE * singlefunctions; | ||
57 | FILELINE * entity_system; | ||
58 | |||
59 | #define MAXLINESZ 2048 | ||
60 | #define MAXFILES 250 | ||
61 | #define KERNELDOCPATH "scripts/" | ||
62 | #define KERNELDOC "kernel-doc" | ||
63 | #define DOCBOOK "-docbook" | ||
64 | #define FUNCTION "-function" | ||
65 | #define NOFUNCTION "-nofunction" | ||
66 | |||
67 | void usage (void) | ||
68 | { | ||
69 | fprintf(stderr, "Usage: docproc {doc|depend} file\n"); | ||
70 | fprintf(stderr, "Input is read from file.tmpl. Output is sent to stdout\n"); | ||
71 | fprintf(stderr, "doc: frontend when generating kernel documentation\n"); | ||
72 | fprintf(stderr, "depend: generate list of files referenced within file\n"); | ||
73 | } | ||
74 | |||
75 | /* | ||
76 | * Execute kernel-doc with parameters givin in svec | ||
77 | */ | ||
78 | void exec_kernel_doc(char **svec) | ||
79 | { | ||
80 | pid_t pid; | ||
81 | int ret; | ||
82 | char real_filename[PATH_MAX + 1]; | ||
83 | /* Make sure output generated so far are flushed */ | ||
84 | fflush(stdout); | ||
85 | switch(pid=fork()) { | ||
86 | case -1: | ||
87 | perror("fork"); | ||
88 | exit(1); | ||
89 | case 0: | ||
90 | memset(real_filename, 0, sizeof(real_filename)); | ||
91 | strncat(real_filename, getenv("SRCTREE"), PATH_MAX); | ||
92 | strncat(real_filename, KERNELDOCPATH KERNELDOC, | ||
93 | PATH_MAX - strlen(real_filename)); | ||
94 | execvp(real_filename, svec); | ||
95 | fprintf(stderr, "exec "); | ||
96 | perror(real_filename); | ||
97 | exit(1); | ||
98 | default: | ||
99 | waitpid(pid, &ret ,0); | ||
100 | } | ||
101 | if (WIFEXITED(ret)) | ||
102 | exitstatus |= WEXITSTATUS(ret); | ||
103 | else | ||
104 | exitstatus = 0xff; | ||
105 | } | ||
106 | |||
107 | /* Types used to create list of all exported symbols in a number of files */ | ||
108 | struct symbols | ||
109 | { | ||
110 | char *name; | ||
111 | }; | ||
112 | |||
113 | struct symfile | ||
114 | { | ||
115 | char *filename; | ||
116 | struct symbols *symbollist; | ||
117 | int symbolcnt; | ||
118 | }; | ||
119 | |||
120 | struct symfile symfilelist[MAXFILES]; | ||
121 | int symfilecnt = 0; | ||
122 | |||
123 | void add_new_symbol(struct symfile *sym, char * symname) | ||
124 | { | ||
125 | sym->symbollist = | ||
126 | realloc(sym->symbollist, (sym->symbolcnt + 1) * sizeof(char *)); | ||
127 | sym->symbollist[sym->symbolcnt++].name = strdup(symname); | ||
128 | } | ||
129 | |||
130 | /* Add a filename to the list */ | ||
131 | struct symfile * add_new_file(char * filename) | ||
132 | { | ||
133 | symfilelist[symfilecnt++].filename = strdup(filename); | ||
134 | return &symfilelist[symfilecnt - 1]; | ||
135 | } | ||
136 | /* Check if file already are present in the list */ | ||
137 | struct symfile * filename_exist(char * filename) | ||
138 | { | ||
139 | int i; | ||
140 | for (i=0; i < symfilecnt; i++) | ||
141 | if (strcmp(symfilelist[i].filename, filename) == 0) | ||
142 | return &symfilelist[i]; | ||
143 | return NULL; | ||
144 | } | ||
145 | |||
146 | /* | ||
147 | * List all files referenced within the template file. | ||
148 | * Files are separated by tabs. | ||
149 | */ | ||
150 | void adddep(char * file) { printf("\t%s", file); } | ||
151 | void adddep2(char * file, char * line) { line = line; adddep(file); } | ||
152 | void noaction(char * line) { line = line; } | ||
153 | void noaction2(char * file, char * line) { file = file; line = line; } | ||
154 | |||
155 | /* Echo the line without further action */ | ||
156 | void printline(char * line) { printf("%s", line); } | ||
157 | |||
158 | /* | ||
159 | * Find all symbols exported with EXPORT_SYMBOL and EXPORT_SYMBOL_GPL | ||
160 | * in filename. | ||
161 | * All symbols located are stored in symfilelist. | ||
162 | */ | ||
163 | void find_export_symbols(char * filename) | ||
164 | { | ||
165 | FILE * fp; | ||
166 | struct symfile *sym; | ||
167 | char line[MAXLINESZ]; | ||
168 | if (filename_exist(filename) == NULL) { | ||
169 | char real_filename[PATH_MAX + 1]; | ||
170 | memset(real_filename, 0, sizeof(real_filename)); | ||
171 | strncat(real_filename, getenv("SRCTREE"), PATH_MAX); | ||
172 | strncat(real_filename, filename, | ||
173 | PATH_MAX - strlen(real_filename)); | ||
174 | sym = add_new_file(filename); | ||
175 | fp = fopen(real_filename, "r"); | ||
176 | if (fp == NULL) | ||
177 | { | ||
178 | fprintf(stderr, "docproc: "); | ||
179 | perror(real_filename); | ||
180 | } | ||
181 | while(fgets(line, MAXLINESZ, fp)) { | ||
182 | char *p; | ||
183 | char *e; | ||
184 | if (((p = strstr(line, "EXPORT_SYMBOL_GPL")) != 0) || | ||
185 | ((p = strstr(line, "EXPORT_SYMBOL")) != 0)) { | ||
186 | /* Skip EXPORT_SYMBOL{_GPL} */ | ||
187 | while (isalnum(*p) || *p == '_') | ||
188 | p++; | ||
189 | /* Remove paranteses and additional ws */ | ||
190 | while (isspace(*p)) | ||
191 | p++; | ||
192 | if (*p != '(') | ||
193 | continue; /* Syntax error? */ | ||
194 | else | ||
195 | p++; | ||
196 | while (isspace(*p)) | ||
197 | p++; | ||
198 | e = p; | ||
199 | while (isalnum(*e) || *e == '_') | ||
200 | e++; | ||
201 | *e = '\0'; | ||
202 | add_new_symbol(sym, p); | ||
203 | } | ||
204 | } | ||
205 | fclose(fp); | ||
206 | } | ||
207 | } | ||
208 | |||
209 | /* | ||
210 | * Document all external or internal functions in a file. | ||
211 | * Call kernel-doc with following parameters: | ||
212 | * kernel-doc -docbook -nofunction function_name1 filename | ||
213 | * function names are obtained from all the the src files | ||
214 | * by find_export_symbols. | ||
215 | * intfunc uses -nofunction | ||
216 | * extfunc uses -function | ||
217 | */ | ||
218 | void docfunctions(char * filename, char * type) | ||
219 | { | ||
220 | int i,j; | ||
221 | int symcnt = 0; | ||
222 | int idx = 0; | ||
223 | char **vec; | ||
224 | |||
225 | for (i=0; i <= symfilecnt; i++) | ||
226 | symcnt += symfilelist[i].symbolcnt; | ||
227 | vec = malloc((2 + 2 * symcnt + 2) * sizeof(char*)); | ||
228 | if (vec == NULL) { | ||
229 | perror("docproc: "); | ||
230 | exit(1); | ||
231 | } | ||
232 | vec[idx++] = KERNELDOC; | ||
233 | vec[idx++] = DOCBOOK; | ||
234 | for (i=0; i < symfilecnt; i++) { | ||
235 | struct symfile * sym = &symfilelist[i]; | ||
236 | for (j=0; j < sym->symbolcnt; j++) { | ||
237 | vec[idx++] = type; | ||
238 | vec[idx++] = sym->symbollist[j].name; | ||
239 | } | ||
240 | } | ||
241 | vec[idx++] = filename; | ||
242 | vec[idx] = NULL; | ||
243 | printf("<!-- %s -->\n", filename); | ||
244 | exec_kernel_doc(vec); | ||
245 | fflush(stdout); | ||
246 | free(vec); | ||
247 | } | ||
248 | void intfunc(char * filename) { docfunctions(filename, NOFUNCTION); } | ||
249 | void extfunc(char * filename) { docfunctions(filename, FUNCTION); } | ||
250 | |||
251 | /* | ||
252 | * Document spåecific function(s) in a file. | ||
253 | * Call kernel-doc with the following parameters: | ||
254 | * kernel-doc -docbook -function function1 [-function function2] | ||
255 | */ | ||
256 | void singfunc(char * filename, char * line) | ||
257 | { | ||
258 | char *vec[200]; /* Enough for specific functions */ | ||
259 | int i, idx = 0; | ||
260 | int startofsym = 1; | ||
261 | vec[idx++] = KERNELDOC; | ||
262 | vec[idx++] = DOCBOOK; | ||
263 | |||
264 | /* Split line up in individual parameters preceeded by FUNCTION */ | ||
265 | for (i=0; line[i]; i++) { | ||
266 | if (isspace(line[i])) { | ||
267 | line[i] = '\0'; | ||
268 | startofsym = 1; | ||
269 | continue; | ||
270 | } | ||
271 | if (startofsym) { | ||
272 | startofsym = 0; | ||
273 | vec[idx++] = FUNCTION; | ||
274 | vec[idx++] = &line[i]; | ||
275 | } | ||
276 | } | ||
277 | vec[idx++] = filename; | ||
278 | vec[idx] = NULL; | ||
279 | exec_kernel_doc(vec); | ||
280 | } | ||
281 | |||
282 | /* | ||
283 | * Parse file, calling action specific functions for: | ||
284 | * 1) Lines containing !E | ||
285 | * 2) Lines containing !I | ||
286 | * 3) Lines containing !D | ||
287 | * 4) Lines containing !F | ||
288 | * 5) Default lines - lines not matching the above | ||
289 | */ | ||
290 | void parse_file(FILE *infile) | ||
291 | { | ||
292 | char line[MAXLINESZ]; | ||
293 | char * s; | ||
294 | while(fgets(line, MAXLINESZ, infile)) { | ||
295 | if (line[0] == '!') { | ||
296 | s = line + 2; | ||
297 | switch (line[1]) { | ||
298 | case 'E': | ||
299 | while (*s && !isspace(*s)) s++; | ||
300 | *s = '\0'; | ||
301 | externalfunctions(line+2); | ||
302 | break; | ||
303 | case 'I': | ||
304 | while (*s && !isspace(*s)) s++; | ||
305 | *s = '\0'; | ||
306 | internalfunctions(line+2); | ||
307 | break; | ||
308 | case 'D': | ||
309 | while (*s && !isspace(*s)) s++; | ||
310 | *s = '\0'; | ||
311 | symbolsonly(line+2); | ||
312 | break; | ||
313 | case 'F': | ||
314 | /* filename */ | ||
315 | while (*s && !isspace(*s)) s++; | ||
316 | *s++ = '\0'; | ||
317 | /* function names */ | ||
318 | while (isspace(*s)) | ||
319 | s++; | ||
320 | singlefunctions(line +2, s); | ||
321 | break; | ||
322 | default: | ||
323 | defaultline(line); | ||
324 | } | ||
325 | } | ||
326 | else { | ||
327 | defaultline(line); | ||
328 | } | ||
329 | } | ||
330 | fflush(stdout); | ||
331 | } | ||
332 | |||
333 | |||
334 | int main(int argc, char *argv[]) | ||
335 | { | ||
336 | FILE * infile; | ||
337 | if (argc != 3) { | ||
338 | usage(); | ||
339 | exit(1); | ||
340 | } | ||
341 | /* Open file, exit on error */ | ||
342 | infile = fopen(argv[2], "r"); | ||
343 | if (infile == NULL) { | ||
344 | fprintf(stderr, "docproc: "); | ||
345 | perror(argv[2]); | ||
346 | exit(2); | ||
347 | } | ||
348 | |||
349 | if (strcmp("doc", argv[1]) == 0) | ||
350 | { | ||
351 | /* Need to do this in two passes. | ||
352 | * First pass is used to collect all symbols exported | ||
353 | * in the various files. | ||
354 | * Second pass generate the documentation. | ||
355 | * This is required because function are declared | ||
356 | * and exported in different files :-(( | ||
357 | */ | ||
358 | /* Collect symbols */ | ||
359 | defaultline = noaction; | ||
360 | internalfunctions = find_export_symbols; | ||
361 | externalfunctions = find_export_symbols; | ||
362 | symbolsonly = find_export_symbols; | ||
363 | singlefunctions = noaction2; | ||
364 | parse_file(infile); | ||
365 | |||
366 | /* Rewind to start from beginning of file again */ | ||
367 | fseek(infile, 0, SEEK_SET); | ||
368 | defaultline = printline; | ||
369 | internalfunctions = intfunc; | ||
370 | externalfunctions = extfunc; | ||
371 | symbolsonly = printline; | ||
372 | singlefunctions = singfunc; | ||
373 | |||
374 | parse_file(infile); | ||
375 | } | ||
376 | else if (strcmp("depend", argv[1]) == 0) | ||
377 | { | ||
378 | /* Create first part of dependency chain | ||
379 | * file.tmpl */ | ||
380 | printf("%s\t", argv[2]); | ||
381 | defaultline = noaction; | ||
382 | internalfunctions = adddep; | ||
383 | externalfunctions = adddep; | ||
384 | symbolsonly = adddep; | ||
385 | singlefunctions = adddep2; | ||
386 | parse_file(infile); | ||
387 | printf("\n"); | ||
388 | } | ||
389 | else | ||
390 | { | ||
391 | fprintf(stderr, "Unknown option: %s\n", argv[1]); | ||
392 | exit(1); | ||
393 | } | ||
394 | fclose(infile); | ||
395 | fflush(stdout); | ||
396 | return exitstatus; | ||
397 | } | ||
398 | |||
diff --git a/scripts/basic/fixdep.c b/scripts/basic/fixdep.c new file mode 100644 index 000000000..cc2c6541b --- /dev/null +++ b/scripts/basic/fixdep.c | |||
@@ -0,0 +1,393 @@ | |||
1 | /* | ||
2 | * "Optimize" a list of dependencies as spit out by gcc -MD | ||
3 | * for the kernel build | ||
4 | * =========================================================================== | ||
5 | * | ||
6 | * Author Kai Germaschewski | ||
7 | * Copyright 2002 by Kai Germaschewski <kai.germaschewski@gmx.de> | ||
8 | * | ||
9 | * This software may be used and distributed according to the terms | ||
10 | * of the GNU General Public License, incorporated herein by reference. | ||
11 | * | ||
12 | * | ||
13 | * Introduction: | ||
14 | * | ||
15 | * gcc produces a very nice and correct list of dependencies which | ||
16 | * tells make when to remake a file. | ||
17 | * | ||
18 | * To use this list as-is however has the drawback that virtually | ||
19 | * every file in the kernel includes <linux/config.h> which then again | ||
20 | * includes <linux/autoconf.h> | ||
21 | * | ||
22 | * If the user re-runs make *config, linux/autoconf.h will be | ||
23 | * regenerated. make notices that and will rebuild every file which | ||
24 | * includes autoconf.h, i.e. basically all files. This is extremely | ||
25 | * annoying if the user just changed CONFIG_HIS_DRIVER from n to m. | ||
26 | * | ||
27 | * So we play the same trick that "mkdep" played before. We replace | ||
28 | * the dependency on linux/autoconf.h by a dependency on every config | ||
29 | * option which is mentioned in any of the listed prequisites. | ||
30 | * | ||
31 | * To be exact, split-include populates a tree in include/config/, | ||
32 | * e.g. include/config/his/driver.h, which contains the #define/#undef | ||
33 | * for the CONFIG_HIS_DRIVER option. | ||
34 | * | ||
35 | * So if the user changes his CONFIG_HIS_DRIVER option, only the objects | ||
36 | * which depend on "include/linux/config/his/driver.h" will be rebuilt, | ||
37 | * so most likely only his driver ;-) | ||
38 | * | ||
39 | * The idea above dates, by the way, back to Michael E Chastain, AFAIK. | ||
40 | * | ||
41 | * So to get dependencies right, there are two issues: | ||
42 | * o if any of the files the compiler read changed, we need to rebuild | ||
43 | * o if the command line given to the compile the file changed, we | ||
44 | * better rebuild as well. | ||
45 | * | ||
46 | * The former is handled by using the -MD output, the later by saving | ||
47 | * the command line used to compile the old object and comparing it | ||
48 | * to the one we would now use. | ||
49 | * | ||
50 | * Again, also this idea is pretty old and has been discussed on | ||
51 | * kbuild-devel a long time ago. I don't have a sensibly working | ||
52 | * internet connection right now, so I rather don't mention names | ||
53 | * without double checking. | ||
54 | * | ||
55 | * This code here has been based partially based on mkdep.c, which | ||
56 | * says the following about its history: | ||
57 | * | ||
58 | * Copyright abandoned, Michael Chastain, <mailto:mec@shout.net>. | ||
59 | * This is a C version of syncdep.pl by Werner Almesberger. | ||
60 | * | ||
61 | * | ||
62 | * It is invoked as | ||
63 | * | ||
64 | * fixdep <depfile> <target> <cmdline> | ||
65 | * | ||
66 | * and will read the dependency file <depfile> | ||
67 | * | ||
68 | * The transformed dependency snipped is written to stdout. | ||
69 | * | ||
70 | * It first generates a line | ||
71 | * | ||
72 | * cmd_<target> = <cmdline> | ||
73 | * | ||
74 | * and then basically copies the .<target>.d file to stdout, in the | ||
75 | * process filtering out the dependency on linux/autoconf.h and adding | ||
76 | * dependencies on include/config/my/option.h for every | ||
77 | * CONFIG_MY_OPTION encountered in any of the prequisites. | ||
78 | * | ||
79 | * It will also filter out all the dependencies on *.ver. We need | ||
80 | * to make sure that the generated version checksum are globally up | ||
81 | * to date before even starting the recursive build, so it's too late | ||
82 | * at this point anyway. | ||
83 | * | ||
84 | * The algorithm to grep for "CONFIG_..." is bit unusual, but should | ||
85 | * be fast ;-) We don't even try to really parse the header files, but | ||
86 | * merely grep, i.e. if CONFIG_FOO is mentioned in a comment, it will | ||
87 | * be picked up as well. It's not a problem with respect to | ||
88 | * correctness, since that can only give too many dependencies, thus | ||
89 | * we cannot miss a rebuild. Since people tend to not mention totally | ||
90 | * unrelated CONFIG_ options all over the place, it's not an | ||
91 | * efficiency problem either. | ||
92 | * | ||
93 | * (Note: it'd be easy to port over the complete mkdep state machine, | ||
94 | * but I don't think the added complexity is worth it) | ||
95 | */ | ||
96 | /* | ||
97 | * Note 2: if somebody writes HELLO_CONFIG_BOOM in a file, it will depend onto | ||
98 | * CONFIG_BOOM. This could seem a bug (not too hard to fix), but please do not | ||
99 | * fix it! Some UserModeLinux files (look at arch/um/) call CONFIG_BOOM as | ||
100 | * UML_CONFIG_BOOM, to avoid conflicts with /usr/include/linux/autoconf.h, | ||
101 | * through arch/um/include/uml-config.h; this fixdep "bug" makes sure that | ||
102 | * those files will have correct dependencies. | ||
103 | */ | ||
104 | |||
105 | #include <sys/types.h> | ||
106 | #include <sys/stat.h> | ||
107 | #include <sys/mman.h> | ||
108 | #include <unistd.h> | ||
109 | #include <fcntl.h> | ||
110 | #include <string.h> | ||
111 | #include <stdlib.h> | ||
112 | #include <stdio.h> | ||
113 | #include <limits.h> | ||
114 | #include <ctype.h> | ||
115 | #include <arpa/inet.h> | ||
116 | |||
117 | #define INT_CONF ntohl(0x434f4e46) | ||
118 | #define INT_ONFI ntohl(0x4f4e4649) | ||
119 | #define INT_NFIG ntohl(0x4e464947) | ||
120 | #define INT_FIG_ ntohl(0x4649475f) | ||
121 | |||
122 | char *target; | ||
123 | char *depfile; | ||
124 | char *cmdline; | ||
125 | |||
126 | void usage(void) | ||
127 | |||
128 | { | ||
129 | fprintf(stderr, "Usage: fixdep <depfile> <target> <cmdline>\n"); | ||
130 | exit(1); | ||
131 | } | ||
132 | |||
133 | /* | ||
134 | * Print out the commandline prefixed with cmd_<target filename> := | ||
135 | */ | ||
136 | void print_cmdline(void) | ||
137 | { | ||
138 | printf("cmd_%s := %s\n\n", target, cmdline); | ||
139 | } | ||
140 | |||
141 | char * str_config = NULL; | ||
142 | int size_config = 0; | ||
143 | int len_config = 0; | ||
144 | |||
145 | /* | ||
146 | * Grow the configuration string to a desired length. | ||
147 | * Usually the first growth is plenty. | ||
148 | */ | ||
149 | void grow_config(int len) | ||
150 | { | ||
151 | while (len_config + len > size_config) { | ||
152 | if (size_config == 0) | ||
153 | size_config = 2048; | ||
154 | str_config = realloc(str_config, size_config *= 2); | ||
155 | if (str_config == NULL) | ||
156 | { perror("fixdep:malloc"); exit(1); } | ||
157 | } | ||
158 | } | ||
159 | |||
160 | |||
161 | |||
162 | /* | ||
163 | * Lookup a value in the configuration string. | ||
164 | */ | ||
165 | int is_defined_config(const char * name, int len) | ||
166 | { | ||
167 | const char * pconfig; | ||
168 | const char * plast = str_config + len_config - len; | ||
169 | for ( pconfig = str_config + 1; pconfig < plast; pconfig++ ) { | ||
170 | if (pconfig[ -1] == '\n' | ||
171 | && pconfig[len] == '\n' | ||
172 | && !memcmp(pconfig, name, len)) | ||
173 | return 1; | ||
174 | } | ||
175 | return 0; | ||
176 | } | ||
177 | |||
178 | /* | ||
179 | * Add a new value to the configuration string. | ||
180 | */ | ||
181 | void define_config(const char * name, int len) | ||
182 | { | ||
183 | grow_config(len + 1); | ||
184 | |||
185 | memcpy(str_config+len_config, name, len); | ||
186 | len_config += len; | ||
187 | str_config[len_config++] = '\n'; | ||
188 | } | ||
189 | |||
190 | /* | ||
191 | * Clear the set of configuration strings. | ||
192 | */ | ||
193 | void clear_config(void) | ||
194 | { | ||
195 | len_config = 0; | ||
196 | define_config("", 0); | ||
197 | } | ||
198 | |||
199 | /* | ||
200 | * Record the use of a CONFIG_* word. | ||
201 | */ | ||
202 | void use_config(char *m, int slen) | ||
203 | { | ||
204 | char s[PATH_MAX]; | ||
205 | char *p; | ||
206 | |||
207 | if (is_defined_config(m, slen)) | ||
208 | return; | ||
209 | |||
210 | define_config(m, slen); | ||
211 | |||
212 | memcpy(s, m, slen); s[slen] = 0; | ||
213 | |||
214 | for (p = s; p < s + slen; p++) { | ||
215 | if (*p == '_') | ||
216 | *p = '/'; | ||
217 | else | ||
218 | *p = tolower((int)*p); | ||
219 | } | ||
220 | printf(" $(wildcard include/config/%s.h) \\\n", s); | ||
221 | } | ||
222 | |||
223 | void parse_config_file(char *map, size_t len) | ||
224 | { | ||
225 | int *end = (int *) (map + len); | ||
226 | /* start at +1, so that p can never be < map */ | ||
227 | int *m = (int *) map + 1; | ||
228 | char *p, *q; | ||
229 | |||
230 | for (; m < end; m++) { | ||
231 | if (*m == INT_CONF) { p = (char *) m ; goto conf; } | ||
232 | if (*m == INT_ONFI) { p = (char *) m-1; goto conf; } | ||
233 | if (*m == INT_NFIG) { p = (char *) m-2; goto conf; } | ||
234 | if (*m == INT_FIG_) { p = (char *) m-3; goto conf; } | ||
235 | continue; | ||
236 | conf: | ||
237 | if (p > map + len - 7) | ||
238 | continue; | ||
239 | if (memcmp(p, "CONFIG_", 7)) | ||
240 | continue; | ||
241 | for (q = p + 7; q < map + len; q++) { | ||
242 | if (!(isalnum(*q) || *q == '_')) | ||
243 | goto found; | ||
244 | } | ||
245 | continue; | ||
246 | |||
247 | found: | ||
248 | use_config(p+7, q-p-7); | ||
249 | } | ||
250 | } | ||
251 | |||
252 | /* test is s ends in sub */ | ||
253 | int strrcmp(char *s, char *sub) | ||
254 | { | ||
255 | int slen = strlen(s); | ||
256 | int sublen = strlen(sub); | ||
257 | |||
258 | if (sublen > slen) | ||
259 | return 1; | ||
260 | |||
261 | return memcmp(s + slen - sublen, sub, sublen); | ||
262 | } | ||
263 | |||
264 | void do_config_file(char *filename) | ||
265 | { | ||
266 | struct stat st; | ||
267 | int fd; | ||
268 | void *map; | ||
269 | |||
270 | fd = open(filename, O_RDONLY); | ||
271 | if (fd < 0) { | ||
272 | fprintf(stderr, "fixdep: "); | ||
273 | perror(filename); | ||
274 | exit(2); | ||
275 | } | ||
276 | fstat(fd, &st); | ||
277 | if (st.st_size == 0) { | ||
278 | close(fd); | ||
279 | return; | ||
280 | } | ||
281 | map = mmap(NULL, st.st_size, PROT_READ, MAP_PRIVATE, fd, 0); | ||
282 | if ((long) map == -1) { | ||
283 | perror("fixdep: mmap"); | ||
284 | close(fd); | ||
285 | return; | ||
286 | } | ||
287 | |||
288 | parse_config_file(map, st.st_size); | ||
289 | |||
290 | munmap(map, st.st_size); | ||
291 | |||
292 | close(fd); | ||
293 | } | ||
294 | |||
295 | void parse_dep_file(void *map, size_t len) | ||
296 | { | ||
297 | char *m = map; | ||
298 | char *end = m + len; | ||
299 | char *p; | ||
300 | char s[PATH_MAX]; | ||
301 | |||
302 | p = strchr(m, ':'); | ||
303 | if (!p) { | ||
304 | fprintf(stderr, "fixdep: parse error\n"); | ||
305 | exit(1); | ||
306 | } | ||
307 | memcpy(s, m, p-m); s[p-m] = 0; | ||
308 | printf("deps_%s := \\\n", target); | ||
309 | m = p+1; | ||
310 | |||
311 | clear_config(); | ||
312 | |||
313 | while (m < end) { | ||
314 | while (m < end && (*m == ' ' || *m == '\\' || *m == '\n')) | ||
315 | m++; | ||
316 | p = m; | ||
317 | while (p < end && *p != ' ') p++; | ||
318 | if (p == end) { | ||
319 | do p--; while (!isalnum(*p)); | ||
320 | p++; | ||
321 | } | ||
322 | memcpy(s, m, p-m); s[p-m] = 0; | ||
323 | if (strrcmp(s, "include/autoconf.h") && | ||
324 | strrcmp(s, "arch/um/include/uml-config.h") && | ||
325 | strrcmp(s, ".ver")) { | ||
326 | printf(" %s \\\n", s); | ||
327 | do_config_file(s); | ||
328 | } | ||
329 | m = p + 1; | ||
330 | } | ||
331 | printf("\n%s: $(deps_%s)\n\n", target, target); | ||
332 | printf("$(deps_%s):\n", target); | ||
333 | } | ||
334 | |||
335 | void print_deps(void) | ||
336 | { | ||
337 | struct stat st; | ||
338 | int fd; | ||
339 | void *map; | ||
340 | |||
341 | fd = open(depfile, O_RDONLY); | ||
342 | if (fd < 0) { | ||
343 | fprintf(stderr, "fixdep: "); | ||
344 | perror(depfile); | ||
345 | exit(2); | ||
346 | } | ||
347 | fstat(fd, &st); | ||
348 | if (st.st_size == 0) { | ||
349 | fprintf(stderr,"fixdep: %s is empty\n",depfile); | ||
350 | close(fd); | ||
351 | return; | ||
352 | } | ||
353 | map = mmap(NULL, st.st_size, PROT_READ, MAP_PRIVATE, fd, 0); | ||
354 | if ((long) map == -1) { | ||
355 | perror("fixdep: mmap"); | ||
356 | close(fd); | ||
357 | return; | ||
358 | } | ||
359 | |||
360 | parse_dep_file(map, st.st_size); | ||
361 | |||
362 | munmap(map, st.st_size); | ||
363 | |||
364 | close(fd); | ||
365 | } | ||
366 | |||
367 | void traps(void) | ||
368 | { | ||
369 | static char test[] __attribute__((aligned(sizeof(int)))) = "CONF"; | ||
370 | |||
371 | if (*(int *)test != INT_CONF) { | ||
372 | fprintf(stderr, "fixdep: sizeof(int) != 4 or wrong endianess? %#x\n", | ||
373 | *(int *)test); | ||
374 | exit(2); | ||
375 | } | ||
376 | } | ||
377 | |||
378 | int main(int argc, char *argv[]) | ||
379 | { | ||
380 | traps(); | ||
381 | |||
382 | if (argc != 4) | ||
383 | usage(); | ||
384 | |||
385 | depfile = argv[1]; | ||
386 | target = argv[2]; | ||
387 | cmdline = argv[3]; | ||
388 | |||
389 | print_cmdline(); | ||
390 | print_deps(); | ||
391 | |||
392 | return 0; | ||
393 | } | ||
diff --git a/scripts/basic/split-include.c b/scripts/basic/split-include.c new file mode 100644 index 000000000..459c45276 --- /dev/null +++ b/scripts/basic/split-include.c | |||
@@ -0,0 +1,226 @@ | |||
1 | /* | ||
2 | * split-include.c | ||
3 | * | ||
4 | * Copyright abandoned, Michael Chastain, <mailto:mec@shout.net>. | ||
5 | * This is a C version of syncdep.pl by Werner Almesberger. | ||
6 | * | ||
7 | * This program takes autoconf.h as input and outputs a directory full | ||
8 | * of one-line include files, merging onto the old values. | ||
9 | * | ||
10 | * Think of the configuration options as key-value pairs. Then there | ||
11 | * are five cases: | ||
12 | * | ||
13 | * key old value new value action | ||
14 | * | ||
15 | * KEY-1 VALUE-1 VALUE-1 leave file alone | ||
16 | * KEY-2 VALUE-2A VALUE-2B write VALUE-2B into file | ||
17 | * KEY-3 - VALUE-3 write VALUE-3 into file | ||
18 | * KEY-4 VALUE-4 - write an empty file | ||
19 | * KEY-5 (empty) - leave old empty file alone | ||
20 | */ | ||
21 | |||
22 | #include <sys/stat.h> | ||
23 | #include <sys/types.h> | ||
24 | |||
25 | #include <ctype.h> | ||
26 | #include <errno.h> | ||
27 | #include <fcntl.h> | ||
28 | #include <stdio.h> | ||
29 | #include <stdlib.h> | ||
30 | #include <string.h> | ||
31 | #include <unistd.h> | ||
32 | |||
33 | #define ERROR_EXIT(strExit) \ | ||
34 | { \ | ||
35 | const int errnoSave = errno; \ | ||
36 | fprintf(stderr, "%s: ", str_my_name); \ | ||
37 | errno = errnoSave; \ | ||
38 | perror((strExit)); \ | ||
39 | exit(1); \ | ||
40 | } | ||
41 | |||
42 | |||
43 | |||
44 | int main(int argc, const char * argv []) | ||
45 | { | ||
46 | const char * str_my_name; | ||
47 | const char * str_file_autoconf; | ||
48 | const char * str_dir_config; | ||
49 | |||
50 | FILE * fp_config; | ||
51 | FILE * fp_target; | ||
52 | FILE * fp_find; | ||
53 | |||
54 | int buffer_size; | ||
55 | |||
56 | char * line; | ||
57 | char * old_line; | ||
58 | char * list_target; | ||
59 | char * ptarget; | ||
60 | |||
61 | struct stat stat_buf; | ||
62 | |||
63 | /* Check arg count. */ | ||
64 | if (argc != 3) | ||
65 | { | ||
66 | fprintf(stderr, "%s: wrong number of arguments.\n", argv[0]); | ||
67 | exit(1); | ||
68 | } | ||
69 | |||
70 | str_my_name = argv[0]; | ||
71 | str_file_autoconf = argv[1]; | ||
72 | str_dir_config = argv[2]; | ||
73 | |||
74 | /* Find a buffer size. */ | ||
75 | if (stat(str_file_autoconf, &stat_buf) != 0) | ||
76 | ERROR_EXIT(str_file_autoconf); | ||
77 | buffer_size = 2 * stat_buf.st_size + 4096; | ||
78 | |||
79 | /* Allocate buffers. */ | ||
80 | if ( (line = malloc(buffer_size)) == NULL | ||
81 | || (old_line = malloc(buffer_size)) == NULL | ||
82 | || (list_target = malloc(buffer_size)) == NULL ) | ||
83 | ERROR_EXIT(str_file_autoconf); | ||
84 | |||
85 | /* Open autoconfig file. */ | ||
86 | if ((fp_config = fopen(str_file_autoconf, "r")) == NULL) | ||
87 | ERROR_EXIT(str_file_autoconf); | ||
88 | |||
89 | /* Make output directory if needed. */ | ||
90 | if (stat(str_dir_config, &stat_buf) != 0) | ||
91 | { | ||
92 | if (mkdir(str_dir_config, 0755) != 0) | ||
93 | ERROR_EXIT(str_dir_config); | ||
94 | } | ||
95 | |||
96 | /* Change to output directory. */ | ||
97 | if (chdir(str_dir_config) != 0) | ||
98 | ERROR_EXIT(str_dir_config); | ||
99 | |||
100 | /* Put initial separator into target list. */ | ||
101 | ptarget = list_target; | ||
102 | *ptarget++ = '\n'; | ||
103 | |||
104 | /* Read config lines. */ | ||
105 | while (fgets(line, buffer_size, fp_config)) | ||
106 | { | ||
107 | const char * str_config; | ||
108 | int is_same; | ||
109 | int itarget; | ||
110 | |||
111 | if (line[0] != '#') | ||
112 | continue; | ||
113 | if ((str_config = strstr(line, "CONFIG_")) == NULL) | ||
114 | continue; | ||
115 | |||
116 | /* Make the output file name. */ | ||
117 | str_config += sizeof("CONFIG_") - 1; | ||
118 | for (itarget = 0; !isspace(str_config[itarget]); itarget++) | ||
119 | { | ||
120 | int c = (unsigned char) str_config[itarget]; | ||
121 | if (isupper(c)) c = tolower(c); | ||
122 | if (c == '_') c = '/'; | ||
123 | ptarget[itarget] = c; | ||
124 | } | ||
125 | ptarget[itarget++] = '.'; | ||
126 | ptarget[itarget++] = 'h'; | ||
127 | ptarget[itarget++] = '\0'; | ||
128 | |||
129 | /* Check for existing file. */ | ||
130 | is_same = 0; | ||
131 | if ((fp_target = fopen(ptarget, "r")) != NULL) | ||
132 | { | ||
133 | fgets(old_line, buffer_size, fp_target); | ||
134 | if (fclose(fp_target) != 0) | ||
135 | ERROR_EXIT(ptarget); | ||
136 | if (!strcmp(line, old_line)) | ||
137 | is_same = 1; | ||
138 | } | ||
139 | |||
140 | if (!is_same) | ||
141 | { | ||
142 | /* Auto-create directories. */ | ||
143 | int islash; | ||
144 | for (islash = 0; islash < itarget; islash++) | ||
145 | { | ||
146 | if (ptarget[islash] == '/') | ||
147 | { | ||
148 | ptarget[islash] = '\0'; | ||
149 | if (stat(ptarget, &stat_buf) != 0 | ||
150 | && mkdir(ptarget, 0755) != 0) | ||
151 | ERROR_EXIT( ptarget ); | ||
152 | ptarget[islash] = '/'; | ||
153 | } | ||
154 | } | ||
155 | |||
156 | /* Write the file. */ | ||
157 | if ((fp_target = fopen(ptarget, "w" )) == NULL) | ||
158 | ERROR_EXIT(ptarget); | ||
159 | fputs(line, fp_target); | ||
160 | if (ferror(fp_target) || fclose(fp_target) != 0) | ||
161 | ERROR_EXIT(ptarget); | ||
162 | } | ||
163 | |||
164 | /* Update target list */ | ||
165 | ptarget += itarget; | ||
166 | *(ptarget-1) = '\n'; | ||
167 | } | ||
168 | |||
169 | /* | ||
170 | * Close autoconfig file. | ||
171 | * Terminate the target list. | ||
172 | */ | ||
173 | if (fclose(fp_config) != 0) | ||
174 | ERROR_EXIT(str_file_autoconf); | ||
175 | *ptarget = '\0'; | ||
176 | |||
177 | /* | ||
178 | * Fix up existing files which have no new value. | ||
179 | * This is Case 4 and Case 5. | ||
180 | * | ||
181 | * I re-read the tree and filter it against list_target. | ||
182 | * This is crude. But it avoids data copies. Also, list_target | ||
183 | * is compact and contiguous, so it easily fits into cache. | ||
184 | * | ||
185 | * Notice that list_target contains strings separated by \n, | ||
186 | * with a \n before the first string and after the last. | ||
187 | * fgets gives the incoming names a terminating \n. | ||
188 | * So by having an initial \n, strstr will find exact matches. | ||
189 | */ | ||
190 | |||
191 | fp_find = popen("find * -type f -name \"*.h\" -print", "r"); | ||
192 | if (fp_find == 0) | ||
193 | ERROR_EXIT( "find" ); | ||
194 | |||
195 | line[0] = '\n'; | ||
196 | while (fgets(line+1, buffer_size, fp_find)) | ||
197 | { | ||
198 | if (strstr(list_target, line) == NULL) | ||
199 | { | ||
200 | /* | ||
201 | * This is an old file with no CONFIG_* flag in autoconf.h. | ||
202 | */ | ||
203 | |||
204 | /* First strip the \n. */ | ||
205 | line[strlen(line)-1] = '\0'; | ||
206 | |||
207 | /* Grab size. */ | ||
208 | if (stat(line+1, &stat_buf) != 0) | ||
209 | ERROR_EXIT(line); | ||
210 | |||
211 | /* If file is not empty, make it empty and give it a fresh date. */ | ||
212 | if (stat_buf.st_size != 0) | ||
213 | { | ||
214 | if ((fp_target = fopen(line+1, "w")) == NULL) | ||
215 | ERROR_EXIT(line); | ||
216 | if (fclose(fp_target) != 0) | ||
217 | ERROR_EXIT(line); | ||
218 | } | ||
219 | } | ||
220 | } | ||
221 | |||
222 | if (pclose(fp_find) != 0) | ||
223 | ERROR_EXIT("find"); | ||
224 | |||
225 | return 0; | ||
226 | } | ||
diff --git a/scripts/kconfig/Makefile b/scripts/kconfig/Makefile new file mode 100644 index 000000000..a28414de8 --- /dev/null +++ b/scripts/kconfig/Makefile | |||
@@ -0,0 +1,254 @@ | |||
1 | # =========================================================================== | ||
2 | # Kernel configuration targets | ||
3 | # These targets are used from top-level makefile | ||
4 | |||
5 | PHONY += oldconfig xconfig gconfig menuconfig config silentoldconfig update-po-config | ||
6 | |||
7 | xconfig: $(obj)/qconf | ||
8 | $< Config.in | ||
9 | |||
10 | gconfig: $(obj)/gconf | ||
11 | $< Config.in | ||
12 | |||
13 | menuconfig: $(obj)/mconf | ||
14 | $(Q)$(MAKE) $(build)=scripts/kconfig/lxdialog | ||
15 | $< Config.in | ||
16 | |||
17 | config: $(obj)/conf | ||
18 | $< Config.in | ||
19 | |||
20 | oldconfig: $(obj)/conf | ||
21 | $< -o Config.in | ||
22 | |||
23 | silentoldconfig: $(obj)/conf | ||
24 | $< -s Config.in | ||
25 | |||
26 | update-po-config: $(obj)/kxgettext | ||
27 | xgettext --default-domain=linux \ | ||
28 | --add-comments --keyword=_ --keyword=N_ \ | ||
29 | --files-from=scripts/kconfig/POTFILES.in \ | ||
30 | --output scripts/kconfig/config.pot | ||
31 | $(Q)ln -fs Kconfig_i386 arch/um/Kconfig_arch | ||
32 | $(Q)for i in `ls arch/`; \ | ||
33 | do \ | ||
34 | scripts/kconfig/kxgettext arch/$$i/Kconfig \ | ||
35 | | msguniq -o scripts/kconfig/linux_$${i}.pot; \ | ||
36 | done | ||
37 | $(Q)msgcat scripts/kconfig/config.pot \ | ||
38 | `find scripts/kconfig/ -type f -name linux_*.pot` \ | ||
39 | --output scripts/kconfig/linux_raw.pot | ||
40 | $(Q)msguniq --sort-by-file scripts/kconfig/linux_raw.pot \ | ||
41 | --output scripts/kconfig/linux.pot | ||
42 | $(Q)rm -f arch/um/Kconfig_arch | ||
43 | $(Q)rm -f scripts/kconfig/linux_*.pot scripts/kconfig/config.pot | ||
44 | |||
45 | PHONY += randconfig allyesconfig allnoconfig allmodconfig defconfig | ||
46 | |||
47 | randconfig: $(obj)/conf | ||
48 | $< -r Config.in | ||
49 | |||
50 | allyesconfig: $(obj)/conf | ||
51 | $< -y Config.in | ||
52 | |||
53 | allnoconfig: $(obj)/conf | ||
54 | $< -n Config.in | ||
55 | |||
56 | allmodconfig: $(obj)/conf | ||
57 | $< -m Config.in | ||
58 | |||
59 | defconfig: $(obj)/conf | ||
60 | ifeq ($(KBUILD_DEFCONFIG),) | ||
61 | $< -d Config.in | ||
62 | else | ||
63 | @echo *** Default configuration is based on '$(KBUILD_DEFCONFIG)' | ||
64 | $(Q)$< -D $(KBUILD_DEFCONFIG) Config.in | ||
65 | endif | ||
66 | |||
67 | %_defconfig: $(obj)/conf | ||
68 | $(Q)$< -D $@ Config.in | ||
69 | |||
70 | # Help text used by make help | ||
71 | help: | ||
72 | @echo ' config - Update current config utilising a line-oriented program' | ||
73 | @echo ' menuconfig - Update current config utilising a menu based program' | ||
74 | @echo ' xconfig - Update current config utilising a QT based front-end' | ||
75 | @echo ' gconfig - Update current config utilising a GTK based front-end' | ||
76 | @echo ' oldconfig - Update current config utilising a provided .config as base' | ||
77 | @echo ' randconfig - New config with random answer to all options' | ||
78 | @echo ' defconfig - New config with default answer to all options' | ||
79 | @echo ' allmodconfig - New config selecting modules when possible' | ||
80 | @echo ' allyesconfig - New config where all options are accepted with yes' | ||
81 | @echo ' allnoconfig - New config where all options are answered with no' | ||
82 | |||
83 | # =========================================================================== | ||
84 | # Shared Makefile for the various kconfig executables: | ||
85 | # conf: Used for defconfig, oldconfig and related targets | ||
86 | # mconf: Used for the mconfig target. | ||
87 | # Utilizes the lxdialog package | ||
88 | # qconf: Used for the xconfig target | ||
89 | # Based on QT which needs to be installed to compile it | ||
90 | # gconf: Used for the gconfig target | ||
91 | # Based on GTK which needs to be installed to compile it | ||
92 | # object files used by all kconfig flavours | ||
93 | |||
94 | hostprogs-y := conf mconf qconf gconf kxgettext | ||
95 | conf-objs := conf.o zconf.tab.o | ||
96 | mconf-objs := mconf.o zconf.tab.o | ||
97 | kxgettext-objs := kxgettext.o zconf.tab.o | ||
98 | |||
99 | ifeq ($(MAKECMDGOALS),xconfig) | ||
100 | qconf-target := 1 | ||
101 | endif | ||
102 | ifeq ($(MAKECMDGOALS),gconfig) | ||
103 | gconf-target := 1 | ||
104 | endif | ||
105 | |||
106 | |||
107 | ifeq ($(qconf-target),1) | ||
108 | qconf-cxxobjs := qconf.o | ||
109 | qconf-objs := kconfig_load.o zconf.tab.o | ||
110 | endif | ||
111 | |||
112 | ifeq ($(gconf-target),1) | ||
113 | gconf-objs := gconf.o kconfig_load.o zconf.tab.o | ||
114 | endif | ||
115 | |||
116 | clean-files := lkc_defs.h qconf.moc .tmp_qtcheck \ | ||
117 | .tmp_gtkcheck zconf.tab.c lex.zconf.c zconf.hash.c | ||
118 | subdir- += lxdialog | ||
119 | |||
120 | # Needed for systems without gettext | ||
121 | KBUILD_HAVE_NLS := $(shell \ | ||
122 | if echo "\#include <libintl.h>" | $(HOSTCC) $(HOSTCFLAGS) -E - > /dev/null 2>&1 ; \ | ||
123 | then echo yes ; \ | ||
124 | else echo no ; fi) | ||
125 | ifeq ($(KBUILD_HAVE_NLS),no) | ||
126 | HOSTCFLAGS += -DKBUILD_NO_NLS | ||
127 | endif | ||
128 | |||
129 | # generated files seem to need this to find local include files | ||
130 | HOSTCFLAGS_lex.zconf.o := -I$(src) | ||
131 | HOSTCFLAGS_zconf.tab.o := -I$(src) | ||
132 | |||
133 | HOSTLOADLIBES_qconf = $(KC_QT_LIBS) -ldl | ||
134 | HOSTCXXFLAGS_qconf.o = $(KC_QT_CFLAGS) -D LKC_DIRECT_LINK | ||
135 | |||
136 | HOSTLOADLIBES_gconf = `pkg-config --libs gtk+-2.0 gmodule-2.0 libglade-2.0` | ||
137 | HOSTCFLAGS_gconf.o = `pkg-config --cflags gtk+-2.0 gmodule-2.0 libglade-2.0` \ | ||
138 | -D LKC_DIRECT_LINK | ||
139 | |||
140 | $(obj)/qconf.o: $(obj)/.tmp_qtcheck | ||
141 | |||
142 | ifeq ($(qconf-target),1) | ||
143 | $(obj)/.tmp_qtcheck: $(src)/Makefile | ||
144 | -include $(obj)/.tmp_qtcheck | ||
145 | |||
146 | # QT needs some extra effort... | ||
147 | $(obj)/.tmp_qtcheck: | ||
148 | @set -e; echo " CHECK qt"; dir=""; pkg=""; \ | ||
149 | pkg-config --exists qt 2> /dev/null && pkg=qt; \ | ||
150 | pkg-config --exists qt-mt 2> /dev/null && pkg=qt-mt; \ | ||
151 | if [ -n "$$pkg" ]; then \ | ||
152 | cflags="\$$(shell pkg-config $$pkg --cflags)"; \ | ||
153 | libs="\$$(shell pkg-config $$pkg --libs)"; \ | ||
154 | moc="\$$(shell pkg-config $$pkg --variable=prefix)/bin/moc"; \ | ||
155 | dir="$$(pkg-config $$pkg --variable=prefix)"; \ | ||
156 | else \ | ||
157 | for d in $$QTDIR /usr/share/qt* /usr/lib/qt*; do \ | ||
158 | if [ -f $$d/include/qconfig.h ]; then dir=$$d; break; fi; \ | ||
159 | done; \ | ||
160 | if [ -z "$$dir" ]; then \ | ||
161 | echo "*"; \ | ||
162 | echo "* Unable to find the QT installation. Please make sure that"; \ | ||
163 | echo "* the QT development package is correctly installed and"; \ | ||
164 | echo "* either install pkg-config or set the QTDIR environment"; \ | ||
165 | echo "* variable to the correct location."; \ | ||
166 | echo "*"; \ | ||
167 | false; \ | ||
168 | fi; \ | ||
169 | libpath=$$dir/lib; lib=qt; osdir=""; \ | ||
170 | $(HOSTCXX) -print-multi-os-directory > /dev/null 2>&1 && \ | ||
171 | osdir=x$$($(HOSTCXX) -print-multi-os-directory); \ | ||
172 | test -d $$libpath/$$osdir && libpath=$$libpath/$$osdir; \ | ||
173 | test -f $$libpath/libqt-mt.so && lib=qt-mt; \ | ||
174 | cflags="-I$$dir/include"; \ | ||
175 | libs="-L$$libpath -Wl,-rpath,$$libpath -l$$lib"; \ | ||
176 | moc="$$dir/bin/moc"; \ | ||
177 | fi; \ | ||
178 | if [ ! -x $$dir/bin/moc -a -x /usr/bin/moc ]; then \ | ||
179 | echo "*"; \ | ||
180 | echo "* Unable to find $$dir/bin/moc, using /usr/bin/moc instead."; \ | ||
181 | echo "*"; \ | ||
182 | moc="/usr/bin/moc"; \ | ||
183 | fi; \ | ||
184 | echo "KC_QT_CFLAGS=$$cflags" > $@; \ | ||
185 | echo "KC_QT_LIBS=$$libs" >> $@; \ | ||
186 | echo "KC_QT_MOC=$$moc" >> $@ | ||
187 | endif | ||
188 | |||
189 | $(obj)/gconf.o: $(obj)/.tmp_gtkcheck | ||
190 | |||
191 | ifeq ($(gconf-target),1) | ||
192 | -include $(obj)/.tmp_gtkcheck | ||
193 | |||
194 | # GTK needs some extra effort, too... | ||
195 | $(obj)/.tmp_gtkcheck: | ||
196 | @if `pkg-config --exists gtk+-2.0 gmodule-2.0 libglade-2.0`; then \ | ||
197 | if `pkg-config --atleast-version=2.0.0 gtk+-2.0`; then \ | ||
198 | touch $@; \ | ||
199 | else \ | ||
200 | echo "*"; \ | ||
201 | echo "* GTK+ is present but version >= 2.0.0 is required."; \ | ||
202 | echo "*"; \ | ||
203 | false; \ | ||
204 | fi \ | ||
205 | else \ | ||
206 | echo "*"; \ | ||
207 | echo "* Unable to find the GTK+ installation. Please make sure that"; \ | ||
208 | echo "* the GTK+ 2.0 development package is correctly installed..."; \ | ||
209 | echo "* You need gtk+-2.0, glib-2.0 and libglade-2.0."; \ | ||
210 | echo "*"; \ | ||
211 | false; \ | ||
212 | fi | ||
213 | endif | ||
214 | |||
215 | $(obj)/zconf.tab.o: $(obj)/lex.zconf.c $(obj)/zconf.hash.c | ||
216 | |||
217 | $(obj)/kconfig_load.o: $(obj)/lkc_defs.h | ||
218 | |||
219 | $(obj)/qconf.o: $(obj)/qconf.moc $(obj)/lkc_defs.h | ||
220 | |||
221 | $(obj)/gconf.o: $(obj)/lkc_defs.h | ||
222 | |||
223 | $(obj)/%.moc: $(src)/%.h | ||
224 | $(KC_QT_MOC) -i $< -o $@ | ||
225 | |||
226 | $(obj)/lkc_defs.h: $(src)/lkc_proto.h | ||
227 | sed < $< > $@ 's/P(\([^,]*\),.*/#define \1 (\*\1_p)/' | ||
228 | |||
229 | |||
230 | ### | ||
231 | # The following requires flex/bison/gperf | ||
232 | # By default we use the _shipped versions, uncomment the following line if | ||
233 | # you are modifying the flex/bison src. | ||
234 | # LKC_GENPARSER := 1 | ||
235 | |||
236 | ifdef LKC_GENPARSER | ||
237 | |||
238 | $(obj)/zconf.tab.c: $(src)/zconf.y | ||
239 | $(obj)/lex.zconf.c: $(src)/zconf.l | ||
240 | $(obj)/zconf.hash.c: $(src)/zconf.gperf | ||
241 | |||
242 | %.tab.c: %.y | ||
243 | bison -l -b $* -p $(notdir $*) $< | ||
244 | cp $@ $@_shipped | ||
245 | |||
246 | lex.%.c: %.l | ||
247 | flex -L -P$(notdir $*) -o$@ $< | ||
248 | cp $@ $@_shipped | ||
249 | |||
250 | %.hash.c: %.gperf | ||
251 | gperf < $< > $@ | ||
252 | cp $@ $@_shipped | ||
253 | |||
254 | endif | ||
diff --git a/scripts/kconfig/POTFILES.in b/scripts/kconfig/POTFILES.in new file mode 100644 index 000000000..cc94e46a7 --- /dev/null +++ b/scripts/kconfig/POTFILES.in | |||
@@ -0,0 +1,5 @@ | |||
1 | scripts/kconfig/mconf.c | ||
2 | scripts/kconfig/conf.c | ||
3 | scripts/kconfig/confdata.c | ||
4 | scripts/kconfig/gconf.c | ||
5 | scripts/kconfig/qconf.cc | ||
diff --git a/scripts/kconfig/conf.c b/scripts/kconfig/conf.c new file mode 100644 index 000000000..8012d1076 --- /dev/null +++ b/scripts/kconfig/conf.c | |||
@@ -0,0 +1,612 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org> | ||
3 | * Released under the terms of the GNU GPL v2.0. | ||
4 | */ | ||
5 | |||
6 | #include <ctype.h> | ||
7 | #include <stdlib.h> | ||
8 | #include <stdio.h> | ||
9 | #include <string.h> | ||
10 | #include <unistd.h> | ||
11 | #include <time.h> | ||
12 | #include <sys/stat.h> | ||
13 | |||
14 | #define LKC_DIRECT_LINK | ||
15 | #include "lkc.h" | ||
16 | |||
17 | static void conf(struct menu *menu); | ||
18 | static void check_conf(struct menu *menu); | ||
19 | |||
20 | enum { | ||
21 | ask_all, | ||
22 | ask_new, | ||
23 | ask_silent, | ||
24 | set_default, | ||
25 | set_yes, | ||
26 | set_mod, | ||
27 | set_no, | ||
28 | set_random | ||
29 | } input_mode = ask_all; | ||
30 | char *defconfig_file; | ||
31 | |||
32 | static int indent = 1; | ||
33 | static int valid_stdin = 1; | ||
34 | static int conf_cnt; | ||
35 | static char line[128]; | ||
36 | static struct menu *rootEntry; | ||
37 | |||
38 | static char nohelp_text[] = N_("Sorry, no help available for this option yet.\n"); | ||
39 | |||
40 | static void strip(char *str) | ||
41 | { | ||
42 | char *p = str; | ||
43 | int l; | ||
44 | |||
45 | while ((isspace(*p))) | ||
46 | p++; | ||
47 | l = strlen(p); | ||
48 | if (p != str) | ||
49 | memmove(str, p, l + 1); | ||
50 | if (!l) | ||
51 | return; | ||
52 | p = str + l - 1; | ||
53 | while ((isspace(*p))) | ||
54 | *p-- = 0; | ||
55 | } | ||
56 | |||
57 | static void check_stdin(void) | ||
58 | { | ||
59 | if (!valid_stdin && input_mode == ask_silent) { | ||
60 | printf(_("aborted!\n\n")); | ||
61 | printf(_("Console input/output is redirected. ")); | ||
62 | printf(_("Run 'make oldconfig' to update configuration.\n\n")); | ||
63 | exit(1); | ||
64 | } | ||
65 | } | ||
66 | |||
67 | static void conf_askvalue(struct symbol *sym, const char *def) | ||
68 | { | ||
69 | enum symbol_type type = sym_get_type(sym); | ||
70 | tristate val; | ||
71 | |||
72 | if (!sym_has_value(sym)) | ||
73 | printf("(NEW) "); | ||
74 | |||
75 | line[0] = '\n'; | ||
76 | line[1] = 0; | ||
77 | |||
78 | if (!sym_is_changable(sym)) { | ||
79 | printf("%s\n", def); | ||
80 | line[0] = '\n'; | ||
81 | line[1] = 0; | ||
82 | return; | ||
83 | } | ||
84 | |||
85 | switch (input_mode) { | ||
86 | case set_no: | ||
87 | case set_mod: | ||
88 | case set_yes: | ||
89 | case set_random: | ||
90 | if (sym_has_value(sym)) { | ||
91 | printf("%s\n", def); | ||
92 | return; | ||
93 | } | ||
94 | break; | ||
95 | case ask_new: | ||
96 | case ask_silent: | ||
97 | if (sym_has_value(sym)) { | ||
98 | printf("%s\n", def); | ||
99 | return; | ||
100 | } | ||
101 | check_stdin(); | ||
102 | case ask_all: | ||
103 | fflush(stdout); | ||
104 | fgets(line, 128, stdin); | ||
105 | return; | ||
106 | case set_default: | ||
107 | printf("%s\n", def); | ||
108 | return; | ||
109 | default: | ||
110 | break; | ||
111 | } | ||
112 | |||
113 | switch (type) { | ||
114 | case S_INT: | ||
115 | case S_HEX: | ||
116 | case S_STRING: | ||
117 | printf("%s\n", def); | ||
118 | return; | ||
119 | default: | ||
120 | ; | ||
121 | } | ||
122 | switch (input_mode) { | ||
123 | case set_yes: | ||
124 | if (sym_tristate_within_range(sym, yes)) { | ||
125 | line[0] = 'y'; | ||
126 | line[1] = '\n'; | ||
127 | line[2] = 0; | ||
128 | break; | ||
129 | } | ||
130 | case set_mod: | ||
131 | if (type == S_TRISTATE) { | ||
132 | if (sym_tristate_within_range(sym, mod)) { | ||
133 | line[0] = 'm'; | ||
134 | line[1] = '\n'; | ||
135 | line[2] = 0; | ||
136 | break; | ||
137 | } | ||
138 | } else { | ||
139 | if (sym_tristate_within_range(sym, yes)) { | ||
140 | line[0] = 'y'; | ||
141 | line[1] = '\n'; | ||
142 | line[2] = 0; | ||
143 | break; | ||
144 | } | ||
145 | } | ||
146 | case set_no: | ||
147 | if (sym_tristate_within_range(sym, no)) { | ||
148 | line[0] = 'n'; | ||
149 | line[1] = '\n'; | ||
150 | line[2] = 0; | ||
151 | break; | ||
152 | } | ||
153 | case set_random: | ||
154 | do { | ||
155 | val = (tristate)(random() % 3); | ||
156 | } while (!sym_tristate_within_range(sym, val)); | ||
157 | switch (val) { | ||
158 | case no: line[0] = 'n'; break; | ||
159 | case mod: line[0] = 'm'; break; | ||
160 | case yes: line[0] = 'y'; break; | ||
161 | } | ||
162 | line[1] = '\n'; | ||
163 | line[2] = 0; | ||
164 | break; | ||
165 | default: | ||
166 | break; | ||
167 | } | ||
168 | printf("%s", line); | ||
169 | } | ||
170 | |||
171 | int conf_string(struct menu *menu) | ||
172 | { | ||
173 | struct symbol *sym = menu->sym; | ||
174 | const char *def, *help; | ||
175 | |||
176 | while (1) { | ||
177 | printf("%*s%s ", indent - 1, "", menu->prompt->text); | ||
178 | printf("(%s) ", sym->name); | ||
179 | def = sym_get_string_value(sym); | ||
180 | if (sym_get_string_value(sym)) | ||
181 | printf("[%s] ", def); | ||
182 | conf_askvalue(sym, def); | ||
183 | switch (line[0]) { | ||
184 | case '\n': | ||
185 | break; | ||
186 | case '?': | ||
187 | /* print help */ | ||
188 | if (line[1] == '\n') { | ||
189 | help = nohelp_text; | ||
190 | if (menu->sym->help) | ||
191 | help = menu->sym->help; | ||
192 | printf("\n%s\n", menu->sym->help); | ||
193 | def = NULL; | ||
194 | break; | ||
195 | } | ||
196 | default: | ||
197 | line[strlen(line)-1] = 0; | ||
198 | def = line; | ||
199 | } | ||
200 | if (def && sym_set_string_value(sym, def)) | ||
201 | return 0; | ||
202 | } | ||
203 | } | ||
204 | |||
205 | static int conf_sym(struct menu *menu) | ||
206 | { | ||
207 | struct symbol *sym = menu->sym; | ||
208 | int type; | ||
209 | tristate oldval, newval; | ||
210 | const char *help; | ||
211 | |||
212 | while (1) { | ||
213 | printf("%*s%s ", indent - 1, "", menu->prompt->text); | ||
214 | if (sym->name) | ||
215 | printf("(%s) ", sym->name); | ||
216 | type = sym_get_type(sym); | ||
217 | putchar('['); | ||
218 | oldval = sym_get_tristate_value(sym); | ||
219 | switch (oldval) { | ||
220 | case no: | ||
221 | putchar('N'); | ||
222 | break; | ||
223 | case mod: | ||
224 | putchar('M'); | ||
225 | break; | ||
226 | case yes: | ||
227 | putchar('Y'); | ||
228 | break; | ||
229 | } | ||
230 | if (oldval != no && sym_tristate_within_range(sym, no)) | ||
231 | printf("/n"); | ||
232 | if (oldval != mod && sym_tristate_within_range(sym, mod)) | ||
233 | printf("/m"); | ||
234 | if (oldval != yes && sym_tristate_within_range(sym, yes)) | ||
235 | printf("/y"); | ||
236 | if (sym->help) | ||
237 | printf("/?"); | ||
238 | printf("] "); | ||
239 | conf_askvalue(sym, sym_get_string_value(sym)); | ||
240 | strip(line); | ||
241 | |||
242 | switch (line[0]) { | ||
243 | case 'n': | ||
244 | case 'N': | ||
245 | newval = no; | ||
246 | if (!line[1] || !strcmp(&line[1], "o")) | ||
247 | break; | ||
248 | continue; | ||
249 | case 'm': | ||
250 | case 'M': | ||
251 | newval = mod; | ||
252 | if (!line[1]) | ||
253 | break; | ||
254 | continue; | ||
255 | case 'y': | ||
256 | case 'Y': | ||
257 | newval = yes; | ||
258 | if (!line[1] || !strcmp(&line[1], "es")) | ||
259 | break; | ||
260 | continue; | ||
261 | case 0: | ||
262 | newval = oldval; | ||
263 | break; | ||
264 | case '?': | ||
265 | goto help; | ||
266 | default: | ||
267 | continue; | ||
268 | } | ||
269 | if (sym_set_tristate_value(sym, newval)) | ||
270 | return 0; | ||
271 | help: | ||
272 | help = nohelp_text; | ||
273 | if (sym->help) | ||
274 | help = sym->help; | ||
275 | printf("\n%s\n", help); | ||
276 | } | ||
277 | } | ||
278 | |||
279 | static int conf_choice(struct menu *menu) | ||
280 | { | ||
281 | struct symbol *sym, *def_sym; | ||
282 | struct menu *child; | ||
283 | int type; | ||
284 | bool is_new; | ||
285 | |||
286 | sym = menu->sym; | ||
287 | type = sym_get_type(sym); | ||
288 | is_new = !sym_has_value(sym); | ||
289 | if (sym_is_changable(sym)) { | ||
290 | conf_sym(menu); | ||
291 | sym_calc_value(sym); | ||
292 | switch (sym_get_tristate_value(sym)) { | ||
293 | case no: | ||
294 | return 1; | ||
295 | case mod: | ||
296 | return 0; | ||
297 | case yes: | ||
298 | break; | ||
299 | } | ||
300 | } else { | ||
301 | switch (sym_get_tristate_value(sym)) { | ||
302 | case no: | ||
303 | return 1; | ||
304 | case mod: | ||
305 | printf("%*s%s\n", indent - 1, "", menu_get_prompt(menu)); | ||
306 | return 0; | ||
307 | case yes: | ||
308 | break; | ||
309 | } | ||
310 | } | ||
311 | |||
312 | while (1) { | ||
313 | int cnt, def; | ||
314 | |||
315 | printf("%*s%s\n", indent - 1, "", menu_get_prompt(menu)); | ||
316 | def_sym = sym_get_choice_value(sym); | ||
317 | cnt = def = 0; | ||
318 | line[0] = 0; | ||
319 | for (child = menu->list; child; child = child->next) { | ||
320 | if (!menu_is_visible(child)) | ||
321 | continue; | ||
322 | if (!child->sym) { | ||
323 | printf("%*c %s\n", indent, '*', menu_get_prompt(child)); | ||
324 | continue; | ||
325 | } | ||
326 | cnt++; | ||
327 | if (child->sym == def_sym) { | ||
328 | def = cnt; | ||
329 | printf("%*c", indent, '>'); | ||
330 | } else | ||
331 | printf("%*c", indent, ' '); | ||
332 | printf(" %d. %s", cnt, menu_get_prompt(child)); | ||
333 | if (child->sym->name) | ||
334 | printf(" (%s)", child->sym->name); | ||
335 | if (!sym_has_value(child->sym)) | ||
336 | printf(" (NEW)"); | ||
337 | printf("\n"); | ||
338 | } | ||
339 | printf("%*schoice", indent - 1, ""); | ||
340 | if (cnt == 1) { | ||
341 | printf("[1]: 1\n"); | ||
342 | goto conf_childs; | ||
343 | } | ||
344 | printf("[1-%d", cnt); | ||
345 | if (sym->help) | ||
346 | printf("?"); | ||
347 | printf("]: "); | ||
348 | switch (input_mode) { | ||
349 | case ask_new: | ||
350 | case ask_silent: | ||
351 | if (!is_new) { | ||
352 | cnt = def; | ||
353 | printf("%d\n", cnt); | ||
354 | break; | ||
355 | } | ||
356 | check_stdin(); | ||
357 | case ask_all: | ||
358 | fflush(stdout); | ||
359 | fgets(line, 128, stdin); | ||
360 | strip(line); | ||
361 | if (line[0] == '?') { | ||
362 | printf("\n%s\n", menu->sym->help ? | ||
363 | menu->sym->help : nohelp_text); | ||
364 | continue; | ||
365 | } | ||
366 | if (!line[0]) | ||
367 | cnt = def; | ||
368 | else if (isdigit(line[0])) | ||
369 | cnt = atoi(line); | ||
370 | else | ||
371 | continue; | ||
372 | break; | ||
373 | case set_random: | ||
374 | def = (random() % cnt) + 1; | ||
375 | case set_default: | ||
376 | case set_yes: | ||
377 | case set_mod: | ||
378 | case set_no: | ||
379 | cnt = def; | ||
380 | printf("%d\n", cnt); | ||
381 | break; | ||
382 | } | ||
383 | |||
384 | conf_childs: | ||
385 | for (child = menu->list; child; child = child->next) { | ||
386 | if (!child->sym || !menu_is_visible(child)) | ||
387 | continue; | ||
388 | if (!--cnt) | ||
389 | break; | ||
390 | } | ||
391 | if (!child) | ||
392 | continue; | ||
393 | if (line[strlen(line) - 1] == '?') { | ||
394 | printf("\n%s\n", child->sym->help ? | ||
395 | child->sym->help : nohelp_text); | ||
396 | continue; | ||
397 | } | ||
398 | sym_set_choice_value(sym, child->sym); | ||
399 | if (child->list) { | ||
400 | indent += 2; | ||
401 | conf(child->list); | ||
402 | indent -= 2; | ||
403 | } | ||
404 | return 1; | ||
405 | } | ||
406 | } | ||
407 | |||
408 | static void conf(struct menu *menu) | ||
409 | { | ||
410 | struct symbol *sym; | ||
411 | struct property *prop; | ||
412 | struct menu *child; | ||
413 | |||
414 | if (!menu_is_visible(menu)) | ||
415 | return; | ||
416 | |||
417 | sym = menu->sym; | ||
418 | prop = menu->prompt; | ||
419 | if (prop) { | ||
420 | const char *prompt; | ||
421 | |||
422 | switch (prop->type) { | ||
423 | case P_MENU: | ||
424 | if (input_mode == ask_silent && rootEntry != menu) { | ||
425 | check_conf(menu); | ||
426 | return; | ||
427 | } | ||
428 | case P_COMMENT: | ||
429 | prompt = menu_get_prompt(menu); | ||
430 | if (prompt) | ||
431 | printf("%*c\n%*c %s\n%*c\n", | ||
432 | indent, '*', | ||
433 | indent, '*', prompt, | ||
434 | indent, '*'); | ||
435 | default: | ||
436 | ; | ||
437 | } | ||
438 | } | ||
439 | |||
440 | if (!sym) | ||
441 | goto conf_childs; | ||
442 | |||
443 | if (sym_is_choice(sym)) { | ||
444 | conf_choice(menu); | ||
445 | if (sym->curr.tri != mod) | ||
446 | return; | ||
447 | goto conf_childs; | ||
448 | } | ||
449 | |||
450 | switch (sym->type) { | ||
451 | case S_INT: | ||
452 | case S_HEX: | ||
453 | case S_STRING: | ||
454 | conf_string(menu); | ||
455 | break; | ||
456 | default: | ||
457 | conf_sym(menu); | ||
458 | break; | ||
459 | } | ||
460 | |||
461 | conf_childs: | ||
462 | if (sym) | ||
463 | indent += 2; | ||
464 | for (child = menu->list; child; child = child->next) | ||
465 | conf(child); | ||
466 | if (sym) | ||
467 | indent -= 2; | ||
468 | } | ||
469 | |||
470 | static void check_conf(struct menu *menu) | ||
471 | { | ||
472 | struct symbol *sym; | ||
473 | struct menu *child; | ||
474 | |||
475 | if (!menu_is_visible(menu)) | ||
476 | return; | ||
477 | |||
478 | sym = menu->sym; | ||
479 | if (sym && !sym_has_value(sym)) { | ||
480 | if (sym_is_changable(sym) || | ||
481 | (sym_is_choice(sym) && sym_get_tristate_value(sym) == yes)) { | ||
482 | if (!conf_cnt++) | ||
483 | printf(_("*\n* Restart config...\n*\n")); | ||
484 | rootEntry = menu_get_parent_menu(menu); | ||
485 | conf(rootEntry); | ||
486 | } | ||
487 | } | ||
488 | |||
489 | for (child = menu->list; child; child = child->next) | ||
490 | check_conf(child); | ||
491 | } | ||
492 | |||
493 | int main(int ac, char **av) | ||
494 | { | ||
495 | int i = 1; | ||
496 | const char *name; | ||
497 | struct stat tmpstat; | ||
498 | |||
499 | if (ac > i && av[i][0] == '-') { | ||
500 | switch (av[i++][1]) { | ||
501 | case 'o': | ||
502 | input_mode = ask_new; | ||
503 | break; | ||
504 | case 's': | ||
505 | input_mode = ask_silent; | ||
506 | valid_stdin = isatty(0) && isatty(1) && isatty(2); | ||
507 | break; | ||
508 | case 'd': | ||
509 | input_mode = set_default; | ||
510 | break; | ||
511 | case 'D': | ||
512 | input_mode = set_default; | ||
513 | defconfig_file = av[i++]; | ||
514 | if (!defconfig_file) { | ||
515 | printf(_("%s: No default config file specified\n"), | ||
516 | av[0]); | ||
517 | exit(1); | ||
518 | } | ||
519 | break; | ||
520 | case 'n': | ||
521 | input_mode = set_no; | ||
522 | break; | ||
523 | case 'm': | ||
524 | input_mode = set_mod; | ||
525 | break; | ||
526 | case 'y': | ||
527 | input_mode = set_yes; | ||
528 | break; | ||
529 | case 'r': | ||
530 | input_mode = set_random; | ||
531 | srandom(time(NULL)); | ||
532 | break; | ||
533 | case 'h': | ||
534 | case '?': | ||
535 | fprintf(stderr, "See README for usage info\n"); | ||
536 | exit(0); | ||
537 | } | ||
538 | } | ||
539 | name = av[i]; | ||
540 | if (!name) { | ||
541 | printf(_("%s: Kconfig file missing\n"), av[0]); | ||
542 | } | ||
543 | conf_parse(name); | ||
544 | //zconfdump(stdout); | ||
545 | switch (input_mode) { | ||
546 | case set_default: | ||
547 | if (!defconfig_file) | ||
548 | defconfig_file = conf_get_default_confname(); | ||
549 | if (conf_read(defconfig_file)) { | ||
550 | printf("***\n" | ||
551 | "*** Can't find default configuration \"%s\"!\n" | ||
552 | "***\n", defconfig_file); | ||
553 | exit(1); | ||
554 | } | ||
555 | break; | ||
556 | case ask_silent: | ||
557 | if (stat(".config", &tmpstat)) { | ||
558 | printf(_("***\n" | ||
559 | "*** You have not yet configured your kernel!\n" | ||
560 | "***\n" | ||
561 | "*** Please run some configurator (e.g. \"make oldconfig\" or\n" | ||
562 | "*** \"make menuconfig\" or \"make xconfig\").\n" | ||
563 | "***\n")); | ||
564 | exit(1); | ||
565 | } | ||
566 | case ask_all: | ||
567 | case ask_new: | ||
568 | conf_read(NULL); | ||
569 | break; | ||
570 | case set_no: | ||
571 | case set_mod: | ||
572 | case set_yes: | ||
573 | case set_random: | ||
574 | name = getenv("KCONFIG_ALLCONFIG"); | ||
575 | if (name && !stat(name, &tmpstat)) { | ||
576 | conf_read_simple(name); | ||
577 | break; | ||
578 | } | ||
579 | switch (input_mode) { | ||
580 | case set_no: name = "allno.config"; break; | ||
581 | case set_mod: name = "allmod.config"; break; | ||
582 | case set_yes: name = "allyes.config"; break; | ||
583 | case set_random: name = "allrandom.config"; break; | ||
584 | default: break; | ||
585 | } | ||
586 | if (!stat(name, &tmpstat)) | ||
587 | conf_read_simple(name); | ||
588 | else if (!stat("all.config", &tmpstat)) | ||
589 | conf_read_simple("all.config"); | ||
590 | break; | ||
591 | default: | ||
592 | break; | ||
593 | } | ||
594 | |||
595 | if (input_mode != ask_silent) { | ||
596 | rootEntry = &rootmenu; | ||
597 | conf(&rootmenu); | ||
598 | if (input_mode == ask_all) { | ||
599 | input_mode = ask_silent; | ||
600 | valid_stdin = 1; | ||
601 | } | ||
602 | } | ||
603 | do { | ||
604 | conf_cnt = 0; | ||
605 | check_conf(&rootmenu); | ||
606 | } while (conf_cnt); | ||
607 | if (conf_write(NULL)) { | ||
608 | fprintf(stderr, _("\n*** Error during writing of the kernel configuration.\n\n")); | ||
609 | return 1; | ||
610 | } | ||
611 | return 0; | ||
612 | } | ||
diff --git a/scripts/kconfig/confdata.c b/scripts/kconfig/confdata.c new file mode 100644 index 000000000..301774f0c --- /dev/null +++ b/scripts/kconfig/confdata.c | |||
@@ -0,0 +1,560 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org> | ||
3 | * Released under the terms of the GNU GPL v2.0. | ||
4 | */ | ||
5 | |||
6 | #include <sys/stat.h> | ||
7 | #include <ctype.h> | ||
8 | #include <stdio.h> | ||
9 | #include <stdlib.h> | ||
10 | #include <string.h> | ||
11 | #include <time.h> | ||
12 | #include <unistd.h> | ||
13 | |||
14 | #define LKC_DIRECT_LINK | ||
15 | #include "lkc.h" | ||
16 | |||
17 | static void conf_warning(const char *fmt, ...) | ||
18 | __attribute__ ((format (printf, 1, 2))); | ||
19 | |||
20 | static const char *conf_filename; | ||
21 | static int conf_lineno, conf_warnings, conf_unsaved; | ||
22 | |||
23 | const char conf_def_filename[] = ".config"; | ||
24 | |||
25 | const char conf_defname[] = "arch/$ARCH/defconfig"; | ||
26 | |||
27 | const char *conf_confnames[] = { | ||
28 | ".config", | ||
29 | "/lib/modules/$UNAME_RELEASE/.config", | ||
30 | "/etc/kernel-config", | ||
31 | "/boot/config-$UNAME_RELEASE", | ||
32 | conf_defname, | ||
33 | NULL, | ||
34 | }; | ||
35 | |||
36 | static void conf_warning(const char *fmt, ...) | ||
37 | { | ||
38 | va_list ap; | ||
39 | va_start(ap, fmt); | ||
40 | fprintf(stderr, "%s:%d:warning: ", conf_filename, conf_lineno); | ||
41 | vfprintf(stderr, fmt, ap); | ||
42 | fprintf(stderr, "\n"); | ||
43 | va_end(ap); | ||
44 | conf_warnings++; | ||
45 | } | ||
46 | |||
47 | static char *conf_expand_value(const char *in) | ||
48 | { | ||
49 | struct symbol *sym; | ||
50 | const char *src; | ||
51 | static char res_value[SYMBOL_MAXLENGTH]; | ||
52 | char *dst, name[SYMBOL_MAXLENGTH]; | ||
53 | |||
54 | res_value[0] = 0; | ||
55 | dst = name; | ||
56 | while ((src = strchr(in, '$'))) { | ||
57 | strncat(res_value, in, src - in); | ||
58 | src++; | ||
59 | dst = name; | ||
60 | while (isalnum(*src) || *src == '_') | ||
61 | *dst++ = *src++; | ||
62 | *dst = 0; | ||
63 | sym = sym_lookup(name, 0); | ||
64 | sym_calc_value(sym); | ||
65 | strcat(res_value, sym_get_string_value(sym)); | ||
66 | in = src; | ||
67 | } | ||
68 | strcat(res_value, in); | ||
69 | |||
70 | return res_value; | ||
71 | } | ||
72 | |||
73 | char *conf_get_default_confname(void) | ||
74 | { | ||
75 | struct stat buf; | ||
76 | static char fullname[PATH_MAX+1]; | ||
77 | char *env, *name; | ||
78 | |||
79 | name = conf_expand_value(conf_defname); | ||
80 | env = getenv(SRCTREE); | ||
81 | if (env) { | ||
82 | sprintf(fullname, "%s/%s", env, name); | ||
83 | if (!stat(fullname, &buf)) | ||
84 | return fullname; | ||
85 | } | ||
86 | return name; | ||
87 | } | ||
88 | |||
89 | int conf_read_simple(const char *name) | ||
90 | { | ||
91 | FILE *in = NULL; | ||
92 | char line[1024]; | ||
93 | char *p, *p2; | ||
94 | struct symbol *sym; | ||
95 | int i; | ||
96 | |||
97 | if (name) { | ||
98 | in = zconf_fopen(name); | ||
99 | } else { | ||
100 | const char **names = conf_confnames; | ||
101 | while ((name = *names++)) { | ||
102 | name = conf_expand_value(name); | ||
103 | in = zconf_fopen(name); | ||
104 | if (in) { | ||
105 | printf(_("#\n" | ||
106 | "# using defaults found in %s\n" | ||
107 | "#\n"), name); | ||
108 | break; | ||
109 | } | ||
110 | } | ||
111 | } | ||
112 | if (!in) | ||
113 | return 1; | ||
114 | |||
115 | conf_filename = name; | ||
116 | conf_lineno = 0; | ||
117 | conf_warnings = 0; | ||
118 | conf_unsaved = 0; | ||
119 | |||
120 | for_all_symbols(i, sym) { | ||
121 | sym->flags |= SYMBOL_NEW | SYMBOL_CHANGED; | ||
122 | if (sym_is_choice(sym)) | ||
123 | sym->flags &= ~SYMBOL_NEW; | ||
124 | sym->flags &= ~SYMBOL_VALID; | ||
125 | switch (sym->type) { | ||
126 | case S_INT: | ||
127 | case S_HEX: | ||
128 | case S_STRING: | ||
129 | if (sym->user.val) | ||
130 | free(sym->user.val); | ||
131 | default: | ||
132 | sym->user.val = NULL; | ||
133 | sym->user.tri = no; | ||
134 | } | ||
135 | } | ||
136 | |||
137 | while (fgets(line, sizeof(line), in)) { | ||
138 | conf_lineno++; | ||
139 | sym = NULL; | ||
140 | switch (line[0]) { | ||
141 | case '#': | ||
142 | if (memcmp(line + 2, "CONFIG_", 7)) | ||
143 | continue; | ||
144 | p = strchr(line + 9, ' '); | ||
145 | if (!p) | ||
146 | continue; | ||
147 | *p++ = 0; | ||
148 | if (strncmp(p, "is not set", 10)) | ||
149 | continue; | ||
150 | sym = sym_find(line + 9); | ||
151 | if (!sym) { | ||
152 | conf_warning("trying to assign nonexistent symbol %s", line + 9); | ||
153 | break; | ||
154 | } else if (!(sym->flags & SYMBOL_NEW)) { | ||
155 | conf_warning("trying to reassign symbol %s", sym->name); | ||
156 | break; | ||
157 | } | ||
158 | switch (sym->type) { | ||
159 | case S_BOOLEAN: | ||
160 | case S_TRISTATE: | ||
161 | sym->user.tri = no; | ||
162 | sym->flags &= ~SYMBOL_NEW; | ||
163 | break; | ||
164 | default: | ||
165 | ; | ||
166 | } | ||
167 | break; | ||
168 | case 'C': | ||
169 | if (memcmp(line, "CONFIG_", 7)) { | ||
170 | conf_warning("unexpected data"); | ||
171 | continue; | ||
172 | } | ||
173 | p = strchr(line + 7, '='); | ||
174 | if (!p) | ||
175 | continue; | ||
176 | *p++ = 0; | ||
177 | p2 = strchr(p, '\n'); | ||
178 | if (p2) | ||
179 | *p2 = 0; | ||
180 | sym = sym_find(line + 7); | ||
181 | if (!sym) { | ||
182 | conf_warning("trying to assign nonexistent symbol %s", line + 7); | ||
183 | break; | ||
184 | } else if (!(sym->flags & SYMBOL_NEW)) { | ||
185 | conf_warning("trying to reassign symbol %s", sym->name); | ||
186 | break; | ||
187 | } | ||
188 | switch (sym->type) { | ||
189 | case S_TRISTATE: | ||
190 | if (p[0] == 'm') { | ||
191 | sym->user.tri = mod; | ||
192 | sym->flags &= ~SYMBOL_NEW; | ||
193 | break; | ||
194 | } | ||
195 | case S_BOOLEAN: | ||
196 | if (p[0] == 'y') { | ||
197 | sym->user.tri = yes; | ||
198 | sym->flags &= ~SYMBOL_NEW; | ||
199 | break; | ||
200 | } | ||
201 | if (p[0] == 'n') { | ||
202 | sym->user.tri = no; | ||
203 | sym->flags &= ~SYMBOL_NEW; | ||
204 | break; | ||
205 | } | ||
206 | conf_warning("symbol value '%s' invalid for %s", p, sym->name); | ||
207 | break; | ||
208 | case S_STRING: | ||
209 | if (*p++ != '"') | ||
210 | break; | ||
211 | for (p2 = p; (p2 = strpbrk(p2, "\"\\")); p2++) { | ||
212 | if (*p2 == '"') { | ||
213 | *p2 = 0; | ||
214 | break; | ||
215 | } | ||
216 | memmove(p2, p2 + 1, strlen(p2)); | ||
217 | } | ||
218 | if (!p2) { | ||
219 | conf_warning("invalid string found"); | ||
220 | continue; | ||
221 | } | ||
222 | case S_INT: | ||
223 | case S_HEX: | ||
224 | if (sym_string_valid(sym, p)) { | ||
225 | sym->user.val = strdup(p); | ||
226 | sym->flags &= ~SYMBOL_NEW; | ||
227 | } else { | ||
228 | conf_warning("symbol value '%s' invalid for %s", p, sym->name); | ||
229 | continue; | ||
230 | } | ||
231 | break; | ||
232 | default: | ||
233 | ; | ||
234 | } | ||
235 | break; | ||
236 | case '\n': | ||
237 | break; | ||
238 | default: | ||
239 | conf_warning("unexpected data"); | ||
240 | continue; | ||
241 | } | ||
242 | if (sym && sym_is_choice_value(sym)) { | ||
243 | struct symbol *cs = prop_get_symbol(sym_get_choice_prop(sym)); | ||
244 | switch (sym->user.tri) { | ||
245 | case no: | ||
246 | break; | ||
247 | case mod: | ||
248 | if (cs->user.tri == yes) { | ||
249 | conf_warning("%s creates inconsistent choice state", sym->name); | ||
250 | cs->flags |= SYMBOL_NEW; | ||
251 | } | ||
252 | break; | ||
253 | case yes: | ||
254 | if (cs->user.tri != no) { | ||
255 | conf_warning("%s creates inconsistent choice state", sym->name); | ||
256 | cs->flags |= SYMBOL_NEW; | ||
257 | } else | ||
258 | cs->user.val = sym; | ||
259 | break; | ||
260 | } | ||
261 | cs->user.tri = E_OR(cs->user.tri, sym->user.tri); | ||
262 | } | ||
263 | } | ||
264 | fclose(in); | ||
265 | |||
266 | if (modules_sym) | ||
267 | sym_calc_value(modules_sym); | ||
268 | return 0; | ||
269 | } | ||
270 | |||
271 | int conf_read(const char *name) | ||
272 | { | ||
273 | struct symbol *sym; | ||
274 | struct property *prop; | ||
275 | struct expr *e; | ||
276 | int i; | ||
277 | |||
278 | if (conf_read_simple(name)) | ||
279 | return 1; | ||
280 | |||
281 | for_all_symbols(i, sym) { | ||
282 | sym_calc_value(sym); | ||
283 | if (sym_is_choice(sym) || (sym->flags & SYMBOL_AUTO)) | ||
284 | goto sym_ok; | ||
285 | if (sym_has_value(sym) && (sym->flags & SYMBOL_WRITE)) { | ||
286 | /* check that calculated value agrees with saved value */ | ||
287 | switch (sym->type) { | ||
288 | case S_BOOLEAN: | ||
289 | case S_TRISTATE: | ||
290 | if (sym->user.tri != sym_get_tristate_value(sym)) | ||
291 | break; | ||
292 | if (!sym_is_choice(sym)) | ||
293 | goto sym_ok; | ||
294 | default: | ||
295 | if (!strcmp(sym->curr.val, sym->user.val)) | ||
296 | goto sym_ok; | ||
297 | break; | ||
298 | } | ||
299 | } else if (!sym_has_value(sym) && !(sym->flags & SYMBOL_WRITE)) | ||
300 | /* no previous value and not saved */ | ||
301 | goto sym_ok; | ||
302 | conf_unsaved++; | ||
303 | /* maybe print value in verbose mode... */ | ||
304 | sym_ok: | ||
305 | if (sym_has_value(sym) && !sym_is_choice_value(sym)) { | ||
306 | if (sym->visible == no) | ||
307 | sym->flags |= SYMBOL_NEW; | ||
308 | switch (sym->type) { | ||
309 | case S_STRING: | ||
310 | case S_INT: | ||
311 | case S_HEX: | ||
312 | if (!sym_string_within_range(sym, sym->user.val)) { | ||
313 | sym->flags |= SYMBOL_NEW; | ||
314 | sym->flags &= ~SYMBOL_VALID; | ||
315 | } | ||
316 | default: | ||
317 | break; | ||
318 | } | ||
319 | } | ||
320 | if (!sym_is_choice(sym)) | ||
321 | continue; | ||
322 | prop = sym_get_choice_prop(sym); | ||
323 | for (e = prop->expr; e; e = e->left.expr) | ||
324 | if (e->right.sym->visible != no) | ||
325 | sym->flags |= e->right.sym->flags & SYMBOL_NEW; | ||
326 | } | ||
327 | |||
328 | sym_change_count = conf_warnings || conf_unsaved; | ||
329 | |||
330 | return 0; | ||
331 | } | ||
332 | |||
333 | int conf_write(const char *name) | ||
334 | { | ||
335 | FILE *out, *out_h; | ||
336 | struct symbol *sym; | ||
337 | struct menu *menu; | ||
338 | const char *basename; | ||
339 | char dirname[128], tmpname[128], newname[128]; | ||
340 | int type, l; | ||
341 | const char *str; | ||
342 | time_t now; | ||
343 | int use_timestamp = 1; | ||
344 | char *env; | ||
345 | |||
346 | dirname[0] = 0; | ||
347 | if (name && name[0]) { | ||
348 | struct stat st; | ||
349 | char *slash; | ||
350 | |||
351 | if (!stat(name, &st) && S_ISDIR(st.st_mode)) { | ||
352 | strcpy(dirname, name); | ||
353 | strcat(dirname, "/"); | ||
354 | basename = conf_def_filename; | ||
355 | } else if ((slash = strrchr(name, '/'))) { | ||
356 | int size = slash - name + 1; | ||
357 | memcpy(dirname, name, size); | ||
358 | dirname[size] = 0; | ||
359 | if (slash[1]) | ||
360 | basename = slash + 1; | ||
361 | else | ||
362 | basename = conf_def_filename; | ||
363 | } else | ||
364 | basename = name; | ||
365 | } else | ||
366 | basename = conf_def_filename; | ||
367 | |||
368 | sprintf(newname, "%s.tmpconfig.%d", dirname, (int)getpid()); | ||
369 | out = fopen(newname, "w"); | ||
370 | if (!out) | ||
371 | return 1; | ||
372 | out_h = NULL; | ||
373 | if (!name) { | ||
374 | out_h = fopen(".tmpconfig.h", "w"); | ||
375 | if (!out_h) | ||
376 | return 1; | ||
377 | file_write_dep(NULL); | ||
378 | } | ||
379 | sym = sym_lookup("KERNELVERSION", 0); | ||
380 | sym_calc_value(sym); | ||
381 | time(&now); | ||
382 | env = getenv("KCONFIG_NOTIMESTAMP"); | ||
383 | if (env && *env) | ||
384 | use_timestamp = 0; | ||
385 | |||
386 | fprintf(out, _("#\n" | ||
387 | "# Automatically generated make config: don't edit\n" | ||
388 | "# Linux kernel version: %s\n" | ||
389 | "%s%s" | ||
390 | "#\n"), | ||
391 | sym_get_string_value(sym), | ||
392 | use_timestamp ? "# " : "", | ||
393 | use_timestamp ? ctime(&now) : ""); | ||
394 | if (out_h) { | ||
395 | char buf[sizeof("#define AUTOCONF_TIMESTAMP " | ||
396 | "\"YYYY-MM-DD HH:MM:SS some_timezone\"\n")]; | ||
397 | buf[0] = '\0'; | ||
398 | if (use_timestamp) | ||
399 | strftime(buf, sizeof(buf), "#define AUTOCONF_TIMESTAMP " | ||
400 | "\"%Y-%m-%d %H:%M:%S %Z\"\n", localtime(&now)); | ||
401 | fprintf(out_h, "/*\n" | ||
402 | " * Automatically generated C config: don't edit\n" | ||
403 | " * Linux kernel version: %s\n" | ||
404 | " */\n" | ||
405 | "%s" | ||
406 | "#define AUTOCONF_INCLUDED\n", | ||
407 | sym_get_string_value(sym), | ||
408 | buf); | ||
409 | } | ||
410 | if (!sym_change_count) | ||
411 | sym_clear_all_valid(); | ||
412 | |||
413 | menu = rootmenu.list; | ||
414 | while (menu) { | ||
415 | sym = menu->sym; | ||
416 | if (!sym) { | ||
417 | if (!menu_is_visible(menu)) | ||
418 | goto next; | ||
419 | str = menu_get_prompt(menu); | ||
420 | fprintf(out, "\n" | ||
421 | "#\n" | ||
422 | "# %s\n" | ||
423 | "#\n", str); | ||
424 | if (out_h) | ||
425 | fprintf(out_h, "\n" | ||
426 | "/*\n" | ||
427 | " * %s\n" | ||
428 | " */\n", str); | ||
429 | } else if (!(sym->flags & SYMBOL_CHOICE)) { | ||
430 | sym_calc_value(sym); | ||
431 | if (!(sym->flags & SYMBOL_WRITE)) | ||
432 | goto next; | ||
433 | sym->flags &= ~SYMBOL_WRITE; | ||
434 | type = sym->type; | ||
435 | if (type == S_TRISTATE) { | ||
436 | sym_calc_value(modules_sym); | ||
437 | if (modules_sym->curr.tri == no) | ||
438 | type = S_BOOLEAN; | ||
439 | } | ||
440 | switch (type) { | ||
441 | case S_BOOLEAN: | ||
442 | case S_TRISTATE: | ||
443 | switch (sym_get_tristate_value(sym)) { | ||
444 | case no: | ||
445 | fprintf(out, "# CONFIG_%s is not set\n", sym->name); | ||
446 | if (out_h) { | ||
447 | fprintf(out_h, "#undef CONFIG_%s\n", sym->name); | ||
448 | /* bbox */ | ||
449 | fprintf(out_h, "#define ENABLE_%s 0\n", sym->name); | ||
450 | fprintf(out_h, "#define USE_%s(...)\n", sym->name); | ||
451 | fprintf(out_h, "#define SKIP_%s(...) __VA_ARGS__\n", sym->name); | ||
452 | } | ||
453 | break; | ||
454 | case mod: | ||
455 | fprintf(out, "CONFIG_%s=m\n", sym->name); | ||
456 | if (out_h) | ||
457 | fprintf(out_h, "#define CONFIG_%s_MODULE 1\n", sym->name); | ||
458 | break; | ||
459 | case yes: | ||
460 | fprintf(out, "CONFIG_%s=y\n", sym->name); | ||
461 | if (out_h) { | ||
462 | fprintf(out_h, "#define CONFIG_%s 1\n", sym->name); | ||
463 | /* bbox */ | ||
464 | fprintf(out_h, "#define ENABLE_%s 1\n", sym->name); | ||
465 | fprintf(out_h, "#define USE_%s(...) __VA_ARGS__\n", sym->name); | ||
466 | fprintf(out_h, "#define SKIP_%s(...)\n", sym->name); | ||
467 | } | ||
468 | break; | ||
469 | } | ||
470 | break; | ||
471 | case S_STRING: | ||
472 | // fix me | ||
473 | str = sym_get_string_value(sym); | ||
474 | fprintf(out, "CONFIG_%s=\"", sym->name); | ||
475 | if (out_h) | ||
476 | fprintf(out_h, "#define CONFIG_%s \"", sym->name); | ||
477 | do { | ||
478 | l = strcspn(str, "\"\\"); | ||
479 | if (l) { | ||
480 | fwrite(str, l, 1, out); | ||
481 | if (out_h) | ||
482 | fwrite(str, l, 1, out_h); | ||
483 | } | ||
484 | str += l; | ||
485 | while (*str == '\\' || *str == '"') { | ||
486 | fprintf(out, "\\%c", *str); | ||
487 | if (out_h) | ||
488 | fprintf(out_h, "\\%c", *str); | ||
489 | str++; | ||
490 | } | ||
491 | } while (*str); | ||
492 | fputs("\"\n", out); | ||
493 | if (out_h) { | ||
494 | fputs("\"\n", out_h); | ||
495 | /* bbox */ | ||
496 | fprintf(out_h, "#define ENABLE_%s 1\n", sym->name); | ||
497 | fprintf(out_h, "#define USE_%s(...) __VA_ARGS__\n", sym->name); | ||
498 | fprintf(out_h, "#define SKIP_%s(...)\n", sym->name); | ||
499 | } | ||
500 | break; | ||
501 | case S_HEX: | ||
502 | str = sym_get_string_value(sym); | ||
503 | if (str[0] != '0' || (str[1] != 'x' && str[1] != 'X')) { | ||
504 | fprintf(out, "CONFIG_%s=%s\n", sym->name, str); | ||
505 | if (out_h) { | ||
506 | fprintf(out_h, "#define CONFIG_%s 0x%s\n", sym->name, str); | ||
507 | /* bbox */ | ||
508 | fprintf(out_h, "#define ENABLE_%s 1\n", sym->name); | ||
509 | fprintf(out_h, "#define USE_%s(...) __VA_ARGS__\n", sym->name); | ||
510 | fprintf(out_h, "#define SKIP_%s(...)\n", sym->name); | ||
511 | } | ||
512 | break; | ||
513 | } | ||
514 | case S_INT: | ||
515 | str = sym_get_string_value(sym); | ||
516 | fprintf(out, "CONFIG_%s=%s\n", sym->name, str); | ||
517 | if (out_h) { | ||
518 | fprintf(out_h, "#define CONFIG_%s %s\n", sym->name, str); | ||
519 | /* bbox */ | ||
520 | fprintf(out_h, "#define ENABLE_%s 1\n", sym->name); | ||
521 | fprintf(out_h, "#define USE_%s(...) __VA_ARGS__\n", sym->name); | ||
522 | fprintf(out_h, "#define SKIP_%s(...)\n", sym->name); | ||
523 | } | ||
524 | break; | ||
525 | } | ||
526 | } | ||
527 | |||
528 | next: | ||
529 | if (menu->list) { | ||
530 | menu = menu->list; | ||
531 | continue; | ||
532 | } | ||
533 | if (menu->next) | ||
534 | menu = menu->next; | ||
535 | else while ((menu = menu->parent)) { | ||
536 | if (menu->next) { | ||
537 | menu = menu->next; | ||
538 | break; | ||
539 | } | ||
540 | } | ||
541 | } | ||
542 | fclose(out); | ||
543 | if (out_h) { | ||
544 | fclose(out_h); | ||
545 | rename(".tmpconfig.h", "include/autoconf.h"); | ||
546 | } | ||
547 | if (!name || basename != conf_def_filename) { | ||
548 | if (!name) | ||
549 | name = conf_def_filename; | ||
550 | sprintf(tmpname, "%s.old", name); | ||
551 | rename(name, tmpname); | ||
552 | } | ||
553 | sprintf(tmpname, "%s%s", dirname, basename); | ||
554 | if (rename(newname, tmpname)) | ||
555 | return 1; | ||
556 | |||
557 | sym_change_count = 0; | ||
558 | |||
559 | return 0; | ||
560 | } | ||
diff --git a/scripts/kconfig/expr.c b/scripts/kconfig/expr.c new file mode 100644 index 000000000..30e4f9d69 --- /dev/null +++ b/scripts/kconfig/expr.c | |||
@@ -0,0 +1,1099 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org> | ||
3 | * Released under the terms of the GNU GPL v2.0. | ||
4 | */ | ||
5 | |||
6 | #include <stdio.h> | ||
7 | #include <stdlib.h> | ||
8 | #include <string.h> | ||
9 | |||
10 | #define LKC_DIRECT_LINK | ||
11 | #include "lkc.h" | ||
12 | |||
13 | #define DEBUG_EXPR 0 | ||
14 | |||
15 | struct expr *expr_alloc_symbol(struct symbol *sym) | ||
16 | { | ||
17 | struct expr *e = malloc(sizeof(*e)); | ||
18 | memset(e, 0, sizeof(*e)); | ||
19 | e->type = E_SYMBOL; | ||
20 | e->left.sym = sym; | ||
21 | return e; | ||
22 | } | ||
23 | |||
24 | struct expr *expr_alloc_one(enum expr_type type, struct expr *ce) | ||
25 | { | ||
26 | struct expr *e = malloc(sizeof(*e)); | ||
27 | memset(e, 0, sizeof(*e)); | ||
28 | e->type = type; | ||
29 | e->left.expr = ce; | ||
30 | return e; | ||
31 | } | ||
32 | |||
33 | struct expr *expr_alloc_two(enum expr_type type, struct expr *e1, struct expr *e2) | ||
34 | { | ||
35 | struct expr *e = malloc(sizeof(*e)); | ||
36 | memset(e, 0, sizeof(*e)); | ||
37 | e->type = type; | ||
38 | e->left.expr = e1; | ||
39 | e->right.expr = e2; | ||
40 | return e; | ||
41 | } | ||
42 | |||
43 | struct expr *expr_alloc_comp(enum expr_type type, struct symbol *s1, struct symbol *s2) | ||
44 | { | ||
45 | struct expr *e = malloc(sizeof(*e)); | ||
46 | memset(e, 0, sizeof(*e)); | ||
47 | e->type = type; | ||
48 | e->left.sym = s1; | ||
49 | e->right.sym = s2; | ||
50 | return e; | ||
51 | } | ||
52 | |||
53 | struct expr *expr_alloc_and(struct expr *e1, struct expr *e2) | ||
54 | { | ||
55 | if (!e1) | ||
56 | return e2; | ||
57 | return e2 ? expr_alloc_two(E_AND, e1, e2) : e1; | ||
58 | } | ||
59 | |||
60 | struct expr *expr_alloc_or(struct expr *e1, struct expr *e2) | ||
61 | { | ||
62 | if (!e1) | ||
63 | return e2; | ||
64 | return e2 ? expr_alloc_two(E_OR, e1, e2) : e1; | ||
65 | } | ||
66 | |||
67 | struct expr *expr_copy(struct expr *org) | ||
68 | { | ||
69 | struct expr *e; | ||
70 | |||
71 | if (!org) | ||
72 | return NULL; | ||
73 | |||
74 | e = malloc(sizeof(*org)); | ||
75 | memcpy(e, org, sizeof(*org)); | ||
76 | switch (org->type) { | ||
77 | case E_SYMBOL: | ||
78 | e->left = org->left; | ||
79 | break; | ||
80 | case E_NOT: | ||
81 | e->left.expr = expr_copy(org->left.expr); | ||
82 | break; | ||
83 | case E_EQUAL: | ||
84 | case E_UNEQUAL: | ||
85 | e->left.sym = org->left.sym; | ||
86 | e->right.sym = org->right.sym; | ||
87 | break; | ||
88 | case E_AND: | ||
89 | case E_OR: | ||
90 | case E_CHOICE: | ||
91 | e->left.expr = expr_copy(org->left.expr); | ||
92 | e->right.expr = expr_copy(org->right.expr); | ||
93 | break; | ||
94 | default: | ||
95 | printf("can't copy type %d\n", e->type); | ||
96 | free(e); | ||
97 | e = NULL; | ||
98 | break; | ||
99 | } | ||
100 | |||
101 | return e; | ||
102 | } | ||
103 | |||
104 | void expr_free(struct expr *e) | ||
105 | { | ||
106 | if (!e) | ||
107 | return; | ||
108 | |||
109 | switch (e->type) { | ||
110 | case E_SYMBOL: | ||
111 | break; | ||
112 | case E_NOT: | ||
113 | expr_free(e->left.expr); | ||
114 | return; | ||
115 | case E_EQUAL: | ||
116 | case E_UNEQUAL: | ||
117 | break; | ||
118 | case E_OR: | ||
119 | case E_AND: | ||
120 | expr_free(e->left.expr); | ||
121 | expr_free(e->right.expr); | ||
122 | break; | ||
123 | default: | ||
124 | printf("how to free type %d?\n", e->type); | ||
125 | break; | ||
126 | } | ||
127 | free(e); | ||
128 | } | ||
129 | |||
130 | static int trans_count; | ||
131 | |||
132 | #define e1 (*ep1) | ||
133 | #define e2 (*ep2) | ||
134 | |||
135 | static void __expr_eliminate_eq(enum expr_type type, struct expr **ep1, struct expr **ep2) | ||
136 | { | ||
137 | if (e1->type == type) { | ||
138 | __expr_eliminate_eq(type, &e1->left.expr, &e2); | ||
139 | __expr_eliminate_eq(type, &e1->right.expr, &e2); | ||
140 | return; | ||
141 | } | ||
142 | if (e2->type == type) { | ||
143 | __expr_eliminate_eq(type, &e1, &e2->left.expr); | ||
144 | __expr_eliminate_eq(type, &e1, &e2->right.expr); | ||
145 | return; | ||
146 | } | ||
147 | if (e1->type == E_SYMBOL && e2->type == E_SYMBOL && | ||
148 | e1->left.sym == e2->left.sym && (e1->left.sym->flags & (SYMBOL_YES|SYMBOL_NO))) | ||
149 | return; | ||
150 | if (!expr_eq(e1, e2)) | ||
151 | return; | ||
152 | trans_count++; | ||
153 | expr_free(e1); expr_free(e2); | ||
154 | switch (type) { | ||
155 | case E_OR: | ||
156 | e1 = expr_alloc_symbol(&symbol_no); | ||
157 | e2 = expr_alloc_symbol(&symbol_no); | ||
158 | break; | ||
159 | case E_AND: | ||
160 | e1 = expr_alloc_symbol(&symbol_yes); | ||
161 | e2 = expr_alloc_symbol(&symbol_yes); | ||
162 | break; | ||
163 | default: | ||
164 | ; | ||
165 | } | ||
166 | } | ||
167 | |||
168 | void expr_eliminate_eq(struct expr **ep1, struct expr **ep2) | ||
169 | { | ||
170 | if (!e1 || !e2) | ||
171 | return; | ||
172 | switch (e1->type) { | ||
173 | case E_OR: | ||
174 | case E_AND: | ||
175 | __expr_eliminate_eq(e1->type, ep1, ep2); | ||
176 | default: | ||
177 | ; | ||
178 | } | ||
179 | if (e1->type != e2->type) switch (e2->type) { | ||
180 | case E_OR: | ||
181 | case E_AND: | ||
182 | __expr_eliminate_eq(e2->type, ep1, ep2); | ||
183 | default: | ||
184 | ; | ||
185 | } | ||
186 | e1 = expr_eliminate_yn(e1); | ||
187 | e2 = expr_eliminate_yn(e2); | ||
188 | } | ||
189 | |||
190 | #undef e1 | ||
191 | #undef e2 | ||
192 | |||
193 | int expr_eq(struct expr *e1, struct expr *e2) | ||
194 | { | ||
195 | int res, old_count; | ||
196 | |||
197 | if (e1->type != e2->type) | ||
198 | return 0; | ||
199 | switch (e1->type) { | ||
200 | case E_EQUAL: | ||
201 | case E_UNEQUAL: | ||
202 | return e1->left.sym == e2->left.sym && e1->right.sym == e2->right.sym; | ||
203 | case E_SYMBOL: | ||
204 | return e1->left.sym == e2->left.sym; | ||
205 | case E_NOT: | ||
206 | return expr_eq(e1->left.expr, e2->left.expr); | ||
207 | case E_AND: | ||
208 | case E_OR: | ||
209 | e1 = expr_copy(e1); | ||
210 | e2 = expr_copy(e2); | ||
211 | old_count = trans_count; | ||
212 | expr_eliminate_eq(&e1, &e2); | ||
213 | res = (e1->type == E_SYMBOL && e2->type == E_SYMBOL && | ||
214 | e1->left.sym == e2->left.sym); | ||
215 | expr_free(e1); | ||
216 | expr_free(e2); | ||
217 | trans_count = old_count; | ||
218 | return res; | ||
219 | case E_CHOICE: | ||
220 | case E_RANGE: | ||
221 | case E_NONE: | ||
222 | /* panic */; | ||
223 | } | ||
224 | |||
225 | if (DEBUG_EXPR) { | ||
226 | expr_fprint(e1, stdout); | ||
227 | printf(" = "); | ||
228 | expr_fprint(e2, stdout); | ||
229 | printf(" ?\n"); | ||
230 | } | ||
231 | |||
232 | return 0; | ||
233 | } | ||
234 | |||
235 | struct expr *expr_eliminate_yn(struct expr *e) | ||
236 | { | ||
237 | struct expr *tmp; | ||
238 | |||
239 | if (e) switch (e->type) { | ||
240 | case E_AND: | ||
241 | e->left.expr = expr_eliminate_yn(e->left.expr); | ||
242 | e->right.expr = expr_eliminate_yn(e->right.expr); | ||
243 | if (e->left.expr->type == E_SYMBOL) { | ||
244 | if (e->left.expr->left.sym == &symbol_no) { | ||
245 | expr_free(e->left.expr); | ||
246 | expr_free(e->right.expr); | ||
247 | e->type = E_SYMBOL; | ||
248 | e->left.sym = &symbol_no; | ||
249 | e->right.expr = NULL; | ||
250 | return e; | ||
251 | } else if (e->left.expr->left.sym == &symbol_yes) { | ||
252 | free(e->left.expr); | ||
253 | tmp = e->right.expr; | ||
254 | *e = *(e->right.expr); | ||
255 | free(tmp); | ||
256 | return e; | ||
257 | } | ||
258 | } | ||
259 | if (e->right.expr->type == E_SYMBOL) { | ||
260 | if (e->right.expr->left.sym == &symbol_no) { | ||
261 | expr_free(e->left.expr); | ||
262 | expr_free(e->right.expr); | ||
263 | e->type = E_SYMBOL; | ||
264 | e->left.sym = &symbol_no; | ||
265 | e->right.expr = NULL; | ||
266 | return e; | ||
267 | } else if (e->right.expr->left.sym == &symbol_yes) { | ||
268 | free(e->right.expr); | ||
269 | tmp = e->left.expr; | ||
270 | *e = *(e->left.expr); | ||
271 | free(tmp); | ||
272 | return e; | ||
273 | } | ||
274 | } | ||
275 | break; | ||
276 | case E_OR: | ||
277 | e->left.expr = expr_eliminate_yn(e->left.expr); | ||
278 | e->right.expr = expr_eliminate_yn(e->right.expr); | ||
279 | if (e->left.expr->type == E_SYMBOL) { | ||
280 | if (e->left.expr->left.sym == &symbol_no) { | ||
281 | free(e->left.expr); | ||
282 | tmp = e->right.expr; | ||
283 | *e = *(e->right.expr); | ||
284 | free(tmp); | ||
285 | return e; | ||
286 | } else if (e->left.expr->left.sym == &symbol_yes) { | ||
287 | expr_free(e->left.expr); | ||
288 | expr_free(e->right.expr); | ||
289 | e->type = E_SYMBOL; | ||
290 | e->left.sym = &symbol_yes; | ||
291 | e->right.expr = NULL; | ||
292 | return e; | ||
293 | } | ||
294 | } | ||
295 | if (e->right.expr->type == E_SYMBOL) { | ||
296 | if (e->right.expr->left.sym == &symbol_no) { | ||
297 | free(e->right.expr); | ||
298 | tmp = e->left.expr; | ||
299 | *e = *(e->left.expr); | ||
300 | free(tmp); | ||
301 | return e; | ||
302 | } else if (e->right.expr->left.sym == &symbol_yes) { | ||
303 | expr_free(e->left.expr); | ||
304 | expr_free(e->right.expr); | ||
305 | e->type = E_SYMBOL; | ||
306 | e->left.sym = &symbol_yes; | ||
307 | e->right.expr = NULL; | ||
308 | return e; | ||
309 | } | ||
310 | } | ||
311 | break; | ||
312 | default: | ||
313 | ; | ||
314 | } | ||
315 | return e; | ||
316 | } | ||
317 | |||
318 | /* | ||
319 | * bool FOO!=n => FOO | ||
320 | */ | ||
321 | struct expr *expr_trans_bool(struct expr *e) | ||
322 | { | ||
323 | if (!e) | ||
324 | return NULL; | ||
325 | switch (e->type) { | ||
326 | case E_AND: | ||
327 | case E_OR: | ||
328 | case E_NOT: | ||
329 | e->left.expr = expr_trans_bool(e->left.expr); | ||
330 | e->right.expr = expr_trans_bool(e->right.expr); | ||
331 | break; | ||
332 | case E_UNEQUAL: | ||
333 | // FOO!=n -> FOO | ||
334 | if (e->left.sym->type == S_TRISTATE) { | ||
335 | if (e->right.sym == &symbol_no) { | ||
336 | e->type = E_SYMBOL; | ||
337 | e->right.sym = NULL; | ||
338 | } | ||
339 | } | ||
340 | break; | ||
341 | default: | ||
342 | ; | ||
343 | } | ||
344 | return e; | ||
345 | } | ||
346 | |||
347 | /* | ||
348 | * e1 || e2 -> ? | ||
349 | */ | ||
350 | struct expr *expr_join_or(struct expr *e1, struct expr *e2) | ||
351 | { | ||
352 | struct expr *tmp; | ||
353 | struct symbol *sym1, *sym2; | ||
354 | |||
355 | if (expr_eq(e1, e2)) | ||
356 | return expr_copy(e1); | ||
357 | if (e1->type != E_EQUAL && e1->type != E_UNEQUAL && e1->type != E_SYMBOL && e1->type != E_NOT) | ||
358 | return NULL; | ||
359 | if (e2->type != E_EQUAL && e2->type != E_UNEQUAL && e2->type != E_SYMBOL && e2->type != E_NOT) | ||
360 | return NULL; | ||
361 | if (e1->type == E_NOT) { | ||
362 | tmp = e1->left.expr; | ||
363 | if (tmp->type != E_EQUAL && tmp->type != E_UNEQUAL && tmp->type != E_SYMBOL) | ||
364 | return NULL; | ||
365 | sym1 = tmp->left.sym; | ||
366 | } else | ||
367 | sym1 = e1->left.sym; | ||
368 | if (e2->type == E_NOT) { | ||
369 | if (e2->left.expr->type != E_SYMBOL) | ||
370 | return NULL; | ||
371 | sym2 = e2->left.expr->left.sym; | ||
372 | } else | ||
373 | sym2 = e2->left.sym; | ||
374 | if (sym1 != sym2) | ||
375 | return NULL; | ||
376 | if (sym1->type != S_BOOLEAN && sym1->type != S_TRISTATE) | ||
377 | return NULL; | ||
378 | if (sym1->type == S_TRISTATE) { | ||
379 | if (e1->type == E_EQUAL && e2->type == E_EQUAL && | ||
380 | ((e1->right.sym == &symbol_yes && e2->right.sym == &symbol_mod) || | ||
381 | (e1->right.sym == &symbol_mod && e2->right.sym == &symbol_yes))) { | ||
382 | // (a='y') || (a='m') -> (a!='n') | ||
383 | return expr_alloc_comp(E_UNEQUAL, sym1, &symbol_no); | ||
384 | } | ||
385 | if (e1->type == E_EQUAL && e2->type == E_EQUAL && | ||
386 | ((e1->right.sym == &symbol_yes && e2->right.sym == &symbol_no) || | ||
387 | (e1->right.sym == &symbol_no && e2->right.sym == &symbol_yes))) { | ||
388 | // (a='y') || (a='n') -> (a!='m') | ||
389 | return expr_alloc_comp(E_UNEQUAL, sym1, &symbol_mod); | ||
390 | } | ||
391 | if (e1->type == E_EQUAL && e2->type == E_EQUAL && | ||
392 | ((e1->right.sym == &symbol_mod && e2->right.sym == &symbol_no) || | ||
393 | (e1->right.sym == &symbol_no && e2->right.sym == &symbol_mod))) { | ||
394 | // (a='m') || (a='n') -> (a!='y') | ||
395 | return expr_alloc_comp(E_UNEQUAL, sym1, &symbol_yes); | ||
396 | } | ||
397 | } | ||
398 | if (sym1->type == S_BOOLEAN && sym1 == sym2) { | ||
399 | if ((e1->type == E_NOT && e1->left.expr->type == E_SYMBOL && e2->type == E_SYMBOL) || | ||
400 | (e2->type == E_NOT && e2->left.expr->type == E_SYMBOL && e1->type == E_SYMBOL)) | ||
401 | return expr_alloc_symbol(&symbol_yes); | ||
402 | } | ||
403 | |||
404 | if (DEBUG_EXPR) { | ||
405 | printf("optimize ("); | ||
406 | expr_fprint(e1, stdout); | ||
407 | printf(") || ("); | ||
408 | expr_fprint(e2, stdout); | ||
409 | printf(")?\n"); | ||
410 | } | ||
411 | return NULL; | ||
412 | } | ||
413 | |||
414 | struct expr *expr_join_and(struct expr *e1, struct expr *e2) | ||
415 | { | ||
416 | struct expr *tmp; | ||
417 | struct symbol *sym1, *sym2; | ||
418 | |||
419 | if (expr_eq(e1, e2)) | ||
420 | return expr_copy(e1); | ||
421 | if (e1->type != E_EQUAL && e1->type != E_UNEQUAL && e1->type != E_SYMBOL && e1->type != E_NOT) | ||
422 | return NULL; | ||
423 | if (e2->type != E_EQUAL && e2->type != E_UNEQUAL && e2->type != E_SYMBOL && e2->type != E_NOT) | ||
424 | return NULL; | ||
425 | if (e1->type == E_NOT) { | ||
426 | tmp = e1->left.expr; | ||
427 | if (tmp->type != E_EQUAL && tmp->type != E_UNEQUAL && tmp->type != E_SYMBOL) | ||
428 | return NULL; | ||
429 | sym1 = tmp->left.sym; | ||
430 | } else | ||
431 | sym1 = e1->left.sym; | ||
432 | if (e2->type == E_NOT) { | ||
433 | if (e2->left.expr->type != E_SYMBOL) | ||
434 | return NULL; | ||
435 | sym2 = e2->left.expr->left.sym; | ||
436 | } else | ||
437 | sym2 = e2->left.sym; | ||
438 | if (sym1 != sym2) | ||
439 | return NULL; | ||
440 | if (sym1->type != S_BOOLEAN && sym1->type != S_TRISTATE) | ||
441 | return NULL; | ||
442 | |||
443 | if ((e1->type == E_SYMBOL && e2->type == E_EQUAL && e2->right.sym == &symbol_yes) || | ||
444 | (e2->type == E_SYMBOL && e1->type == E_EQUAL && e1->right.sym == &symbol_yes)) | ||
445 | // (a) && (a='y') -> (a='y') | ||
446 | return expr_alloc_comp(E_EQUAL, sym1, &symbol_yes); | ||
447 | |||
448 | if ((e1->type == E_SYMBOL && e2->type == E_UNEQUAL && e2->right.sym == &symbol_no) || | ||
449 | (e2->type == E_SYMBOL && e1->type == E_UNEQUAL && e1->right.sym == &symbol_no)) | ||
450 | // (a) && (a!='n') -> (a) | ||
451 | return expr_alloc_symbol(sym1); | ||
452 | |||
453 | if ((e1->type == E_SYMBOL && e2->type == E_UNEQUAL && e2->right.sym == &symbol_mod) || | ||
454 | (e2->type == E_SYMBOL && e1->type == E_UNEQUAL && e1->right.sym == &symbol_mod)) | ||
455 | // (a) && (a!='m') -> (a='y') | ||
456 | return expr_alloc_comp(E_EQUAL, sym1, &symbol_yes); | ||
457 | |||
458 | if (sym1->type == S_TRISTATE) { | ||
459 | if (e1->type == E_EQUAL && e2->type == E_UNEQUAL) { | ||
460 | // (a='b') && (a!='c') -> 'b'='c' ? 'n' : a='b' | ||
461 | sym2 = e1->right.sym; | ||
462 | if ((e2->right.sym->flags & SYMBOL_CONST) && (sym2->flags & SYMBOL_CONST)) | ||
463 | return sym2 != e2->right.sym ? expr_alloc_comp(E_EQUAL, sym1, sym2) | ||
464 | : expr_alloc_symbol(&symbol_no); | ||
465 | } | ||
466 | if (e1->type == E_UNEQUAL && e2->type == E_EQUAL) { | ||
467 | // (a='b') && (a!='c') -> 'b'='c' ? 'n' : a='b' | ||
468 | sym2 = e2->right.sym; | ||
469 | if ((e1->right.sym->flags & SYMBOL_CONST) && (sym2->flags & SYMBOL_CONST)) | ||
470 | return sym2 != e1->right.sym ? expr_alloc_comp(E_EQUAL, sym1, sym2) | ||
471 | : expr_alloc_symbol(&symbol_no); | ||
472 | } | ||
473 | if (e1->type == E_UNEQUAL && e2->type == E_UNEQUAL && | ||
474 | ((e1->right.sym == &symbol_yes && e2->right.sym == &symbol_no) || | ||
475 | (e1->right.sym == &symbol_no && e2->right.sym == &symbol_yes))) | ||
476 | // (a!='y') && (a!='n') -> (a='m') | ||
477 | return expr_alloc_comp(E_EQUAL, sym1, &symbol_mod); | ||
478 | |||
479 | if (e1->type == E_UNEQUAL && e2->type == E_UNEQUAL && | ||
480 | ((e1->right.sym == &symbol_yes && e2->right.sym == &symbol_mod) || | ||
481 | (e1->right.sym == &symbol_mod && e2->right.sym == &symbol_yes))) | ||
482 | // (a!='y') && (a!='m') -> (a='n') | ||
483 | return expr_alloc_comp(E_EQUAL, sym1, &symbol_no); | ||
484 | |||
485 | if (e1->type == E_UNEQUAL && e2->type == E_UNEQUAL && | ||
486 | ((e1->right.sym == &symbol_mod && e2->right.sym == &symbol_no) || | ||
487 | (e1->right.sym == &symbol_no && e2->right.sym == &symbol_mod))) | ||
488 | // (a!='m') && (a!='n') -> (a='m') | ||
489 | return expr_alloc_comp(E_EQUAL, sym1, &symbol_yes); | ||
490 | |||
491 | if ((e1->type == E_SYMBOL && e2->type == E_EQUAL && e2->right.sym == &symbol_mod) || | ||
492 | (e2->type == E_SYMBOL && e1->type == E_EQUAL && e1->right.sym == &symbol_mod) || | ||
493 | (e1->type == E_SYMBOL && e2->type == E_UNEQUAL && e2->right.sym == &symbol_yes) || | ||
494 | (e2->type == E_SYMBOL && e1->type == E_UNEQUAL && e1->right.sym == &symbol_yes)) | ||
495 | return NULL; | ||
496 | } | ||
497 | |||
498 | if (DEBUG_EXPR) { | ||
499 | printf("optimize ("); | ||
500 | expr_fprint(e1, stdout); | ||
501 | printf(") && ("); | ||
502 | expr_fprint(e2, stdout); | ||
503 | printf(")?\n"); | ||
504 | } | ||
505 | return NULL; | ||
506 | } | ||
507 | |||
508 | static void expr_eliminate_dups1(enum expr_type type, struct expr **ep1, struct expr **ep2) | ||
509 | { | ||
510 | #define e1 (*ep1) | ||
511 | #define e2 (*ep2) | ||
512 | struct expr *tmp; | ||
513 | |||
514 | if (e1->type == type) { | ||
515 | expr_eliminate_dups1(type, &e1->left.expr, &e2); | ||
516 | expr_eliminate_dups1(type, &e1->right.expr, &e2); | ||
517 | return; | ||
518 | } | ||
519 | if (e2->type == type) { | ||
520 | expr_eliminate_dups1(type, &e1, &e2->left.expr); | ||
521 | expr_eliminate_dups1(type, &e1, &e2->right.expr); | ||
522 | return; | ||
523 | } | ||
524 | if (e1 == e2) | ||
525 | return; | ||
526 | |||
527 | switch (e1->type) { | ||
528 | case E_OR: case E_AND: | ||
529 | expr_eliminate_dups1(e1->type, &e1, &e1); | ||
530 | default: | ||
531 | ; | ||
532 | } | ||
533 | |||
534 | switch (type) { | ||
535 | case E_OR: | ||
536 | tmp = expr_join_or(e1, e2); | ||
537 | if (tmp) { | ||
538 | expr_free(e1); expr_free(e2); | ||
539 | e1 = expr_alloc_symbol(&symbol_no); | ||
540 | e2 = tmp; | ||
541 | trans_count++; | ||
542 | } | ||
543 | break; | ||
544 | case E_AND: | ||
545 | tmp = expr_join_and(e1, e2); | ||
546 | if (tmp) { | ||
547 | expr_free(e1); expr_free(e2); | ||
548 | e1 = expr_alloc_symbol(&symbol_yes); | ||
549 | e2 = tmp; | ||
550 | trans_count++; | ||
551 | } | ||
552 | break; | ||
553 | default: | ||
554 | ; | ||
555 | } | ||
556 | #undef e1 | ||
557 | #undef e2 | ||
558 | } | ||
559 | |||
560 | static void expr_eliminate_dups2(enum expr_type type, struct expr **ep1, struct expr **ep2) | ||
561 | { | ||
562 | #define e1 (*ep1) | ||
563 | #define e2 (*ep2) | ||
564 | struct expr *tmp, *tmp1, *tmp2; | ||
565 | |||
566 | if (e1->type == type) { | ||
567 | expr_eliminate_dups2(type, &e1->left.expr, &e2); | ||
568 | expr_eliminate_dups2(type, &e1->right.expr, &e2); | ||
569 | return; | ||
570 | } | ||
571 | if (e2->type == type) { | ||
572 | expr_eliminate_dups2(type, &e1, &e2->left.expr); | ||
573 | expr_eliminate_dups2(type, &e1, &e2->right.expr); | ||
574 | } | ||
575 | if (e1 == e2) | ||
576 | return; | ||
577 | |||
578 | switch (e1->type) { | ||
579 | case E_OR: | ||
580 | expr_eliminate_dups2(e1->type, &e1, &e1); | ||
581 | // (FOO || BAR) && (!FOO && !BAR) -> n | ||
582 | tmp1 = expr_transform(expr_alloc_one(E_NOT, expr_copy(e1))); | ||
583 | tmp2 = expr_copy(e2); | ||
584 | tmp = expr_extract_eq_and(&tmp1, &tmp2); | ||
585 | if (expr_is_yes(tmp1)) { | ||
586 | expr_free(e1); | ||
587 | e1 = expr_alloc_symbol(&symbol_no); | ||
588 | trans_count++; | ||
589 | } | ||
590 | expr_free(tmp2); | ||
591 | expr_free(tmp1); | ||
592 | expr_free(tmp); | ||
593 | break; | ||
594 | case E_AND: | ||
595 | expr_eliminate_dups2(e1->type, &e1, &e1); | ||
596 | // (FOO && BAR) || (!FOO || !BAR) -> y | ||
597 | tmp1 = expr_transform(expr_alloc_one(E_NOT, expr_copy(e1))); | ||
598 | tmp2 = expr_copy(e2); | ||
599 | tmp = expr_extract_eq_or(&tmp1, &tmp2); | ||
600 | if (expr_is_no(tmp1)) { | ||
601 | expr_free(e1); | ||
602 | e1 = expr_alloc_symbol(&symbol_yes); | ||
603 | trans_count++; | ||
604 | } | ||
605 | expr_free(tmp2); | ||
606 | expr_free(tmp1); | ||
607 | expr_free(tmp); | ||
608 | break; | ||
609 | default: | ||
610 | ; | ||
611 | } | ||
612 | #undef e1 | ||
613 | #undef e2 | ||
614 | } | ||
615 | |||
616 | struct expr *expr_eliminate_dups(struct expr *e) | ||
617 | { | ||
618 | int oldcount; | ||
619 | if (!e) | ||
620 | return e; | ||
621 | |||
622 | oldcount = trans_count; | ||
623 | while (1) { | ||
624 | trans_count = 0; | ||
625 | switch (e->type) { | ||
626 | case E_OR: case E_AND: | ||
627 | expr_eliminate_dups1(e->type, &e, &e); | ||
628 | expr_eliminate_dups2(e->type, &e, &e); | ||
629 | default: | ||
630 | ; | ||
631 | } | ||
632 | if (!trans_count) | ||
633 | break; | ||
634 | e = expr_eliminate_yn(e); | ||
635 | } | ||
636 | trans_count = oldcount; | ||
637 | return e; | ||
638 | } | ||
639 | |||
640 | struct expr *expr_transform(struct expr *e) | ||
641 | { | ||
642 | struct expr *tmp; | ||
643 | |||
644 | if (!e) | ||
645 | return NULL; | ||
646 | switch (e->type) { | ||
647 | case E_EQUAL: | ||
648 | case E_UNEQUAL: | ||
649 | case E_SYMBOL: | ||
650 | case E_CHOICE: | ||
651 | break; | ||
652 | default: | ||
653 | e->left.expr = expr_transform(e->left.expr); | ||
654 | e->right.expr = expr_transform(e->right.expr); | ||
655 | } | ||
656 | |||
657 | switch (e->type) { | ||
658 | case E_EQUAL: | ||
659 | if (e->left.sym->type != S_BOOLEAN) | ||
660 | break; | ||
661 | if (e->right.sym == &symbol_no) { | ||
662 | e->type = E_NOT; | ||
663 | e->left.expr = expr_alloc_symbol(e->left.sym); | ||
664 | e->right.sym = NULL; | ||
665 | break; | ||
666 | } | ||
667 | if (e->right.sym == &symbol_mod) { | ||
668 | printf("boolean symbol %s tested for 'm'? test forced to 'n'\n", e->left.sym->name); | ||
669 | e->type = E_SYMBOL; | ||
670 | e->left.sym = &symbol_no; | ||
671 | e->right.sym = NULL; | ||
672 | break; | ||
673 | } | ||
674 | if (e->right.sym == &symbol_yes) { | ||
675 | e->type = E_SYMBOL; | ||
676 | e->right.sym = NULL; | ||
677 | break; | ||
678 | } | ||
679 | break; | ||
680 | case E_UNEQUAL: | ||
681 | if (e->left.sym->type != S_BOOLEAN) | ||
682 | break; | ||
683 | if (e->right.sym == &symbol_no) { | ||
684 | e->type = E_SYMBOL; | ||
685 | e->right.sym = NULL; | ||
686 | break; | ||
687 | } | ||
688 | if (e->right.sym == &symbol_mod) { | ||
689 | printf("boolean symbol %s tested for 'm'? test forced to 'y'\n", e->left.sym->name); | ||
690 | e->type = E_SYMBOL; | ||
691 | e->left.sym = &symbol_yes; | ||
692 | e->right.sym = NULL; | ||
693 | break; | ||
694 | } | ||
695 | if (e->right.sym == &symbol_yes) { | ||
696 | e->type = E_NOT; | ||
697 | e->left.expr = expr_alloc_symbol(e->left.sym); | ||
698 | e->right.sym = NULL; | ||
699 | break; | ||
700 | } | ||
701 | break; | ||
702 | case E_NOT: | ||
703 | switch (e->left.expr->type) { | ||
704 | case E_NOT: | ||
705 | // !!a -> a | ||
706 | tmp = e->left.expr->left.expr; | ||
707 | free(e->left.expr); | ||
708 | free(e); | ||
709 | e = tmp; | ||
710 | e = expr_transform(e); | ||
711 | break; | ||
712 | case E_EQUAL: | ||
713 | case E_UNEQUAL: | ||
714 | // !a='x' -> a!='x' | ||
715 | tmp = e->left.expr; | ||
716 | free(e); | ||
717 | e = tmp; | ||
718 | e->type = e->type == E_EQUAL ? E_UNEQUAL : E_EQUAL; | ||
719 | break; | ||
720 | case E_OR: | ||
721 | // !(a || b) -> !a && !b | ||
722 | tmp = e->left.expr; | ||
723 | e->type = E_AND; | ||
724 | e->right.expr = expr_alloc_one(E_NOT, tmp->right.expr); | ||
725 | tmp->type = E_NOT; | ||
726 | tmp->right.expr = NULL; | ||
727 | e = expr_transform(e); | ||
728 | break; | ||
729 | case E_AND: | ||
730 | // !(a && b) -> !a || !b | ||
731 | tmp = e->left.expr; | ||
732 | e->type = E_OR; | ||
733 | e->right.expr = expr_alloc_one(E_NOT, tmp->right.expr); | ||
734 | tmp->type = E_NOT; | ||
735 | tmp->right.expr = NULL; | ||
736 | e = expr_transform(e); | ||
737 | break; | ||
738 | case E_SYMBOL: | ||
739 | if (e->left.expr->left.sym == &symbol_yes) { | ||
740 | // !'y' -> 'n' | ||
741 | tmp = e->left.expr; | ||
742 | free(e); | ||
743 | e = tmp; | ||
744 | e->type = E_SYMBOL; | ||
745 | e->left.sym = &symbol_no; | ||
746 | break; | ||
747 | } | ||
748 | if (e->left.expr->left.sym == &symbol_mod) { | ||
749 | // !'m' -> 'm' | ||
750 | tmp = e->left.expr; | ||
751 | free(e); | ||
752 | e = tmp; | ||
753 | e->type = E_SYMBOL; | ||
754 | e->left.sym = &symbol_mod; | ||
755 | break; | ||
756 | } | ||
757 | if (e->left.expr->left.sym == &symbol_no) { | ||
758 | // !'n' -> 'y' | ||
759 | tmp = e->left.expr; | ||
760 | free(e); | ||
761 | e = tmp; | ||
762 | e->type = E_SYMBOL; | ||
763 | e->left.sym = &symbol_yes; | ||
764 | break; | ||
765 | } | ||
766 | break; | ||
767 | default: | ||
768 | ; | ||
769 | } | ||
770 | break; | ||
771 | default: | ||
772 | ; | ||
773 | } | ||
774 | return e; | ||
775 | } | ||
776 | |||
777 | int expr_contains_symbol(struct expr *dep, struct symbol *sym) | ||
778 | { | ||
779 | if (!dep) | ||
780 | return 0; | ||
781 | |||
782 | switch (dep->type) { | ||
783 | case E_AND: | ||
784 | case E_OR: | ||
785 | return expr_contains_symbol(dep->left.expr, sym) || | ||
786 | expr_contains_symbol(dep->right.expr, sym); | ||
787 | case E_SYMBOL: | ||
788 | return dep->left.sym == sym; | ||
789 | case E_EQUAL: | ||
790 | case E_UNEQUAL: | ||
791 | return dep->left.sym == sym || | ||
792 | dep->right.sym == sym; | ||
793 | case E_NOT: | ||
794 | return expr_contains_symbol(dep->left.expr, sym); | ||
795 | default: | ||
796 | ; | ||
797 | } | ||
798 | return 0; | ||
799 | } | ||
800 | |||
801 | bool expr_depends_symbol(struct expr *dep, struct symbol *sym) | ||
802 | { | ||
803 | if (!dep) | ||
804 | return false; | ||
805 | |||
806 | switch (dep->type) { | ||
807 | case E_AND: | ||
808 | return expr_depends_symbol(dep->left.expr, sym) || | ||
809 | expr_depends_symbol(dep->right.expr, sym); | ||
810 | case E_SYMBOL: | ||
811 | return dep->left.sym == sym; | ||
812 | case E_EQUAL: | ||
813 | if (dep->left.sym == sym) { | ||
814 | if (dep->right.sym == &symbol_yes || dep->right.sym == &symbol_mod) | ||
815 | return true; | ||
816 | } | ||
817 | break; | ||
818 | case E_UNEQUAL: | ||
819 | if (dep->left.sym == sym) { | ||
820 | if (dep->right.sym == &symbol_no) | ||
821 | return true; | ||
822 | } | ||
823 | break; | ||
824 | default: | ||
825 | ; | ||
826 | } | ||
827 | return false; | ||
828 | } | ||
829 | |||
830 | struct expr *expr_extract_eq_and(struct expr **ep1, struct expr **ep2) | ||
831 | { | ||
832 | struct expr *tmp = NULL; | ||
833 | expr_extract_eq(E_AND, &tmp, ep1, ep2); | ||
834 | if (tmp) { | ||
835 | *ep1 = expr_eliminate_yn(*ep1); | ||
836 | *ep2 = expr_eliminate_yn(*ep2); | ||
837 | } | ||
838 | return tmp; | ||
839 | } | ||
840 | |||
841 | struct expr *expr_extract_eq_or(struct expr **ep1, struct expr **ep2) | ||
842 | { | ||
843 | struct expr *tmp = NULL; | ||
844 | expr_extract_eq(E_OR, &tmp, ep1, ep2); | ||
845 | if (tmp) { | ||
846 | *ep1 = expr_eliminate_yn(*ep1); | ||
847 | *ep2 = expr_eliminate_yn(*ep2); | ||
848 | } | ||
849 | return tmp; | ||
850 | } | ||
851 | |||
852 | void expr_extract_eq(enum expr_type type, struct expr **ep, struct expr **ep1, struct expr **ep2) | ||
853 | { | ||
854 | #define e1 (*ep1) | ||
855 | #define e2 (*ep2) | ||
856 | if (e1->type == type) { | ||
857 | expr_extract_eq(type, ep, &e1->left.expr, &e2); | ||
858 | expr_extract_eq(type, ep, &e1->right.expr, &e2); | ||
859 | return; | ||
860 | } | ||
861 | if (e2->type == type) { | ||
862 | expr_extract_eq(type, ep, ep1, &e2->left.expr); | ||
863 | expr_extract_eq(type, ep, ep1, &e2->right.expr); | ||
864 | return; | ||
865 | } | ||
866 | if (expr_eq(e1, e2)) { | ||
867 | *ep = *ep ? expr_alloc_two(type, *ep, e1) : e1; | ||
868 | expr_free(e2); | ||
869 | if (type == E_AND) { | ||
870 | e1 = expr_alloc_symbol(&symbol_yes); | ||
871 | e2 = expr_alloc_symbol(&symbol_yes); | ||
872 | } else if (type == E_OR) { | ||
873 | e1 = expr_alloc_symbol(&symbol_no); | ||
874 | e2 = expr_alloc_symbol(&symbol_no); | ||
875 | } | ||
876 | } | ||
877 | #undef e1 | ||
878 | #undef e2 | ||
879 | } | ||
880 | |||
881 | struct expr *expr_trans_compare(struct expr *e, enum expr_type type, struct symbol *sym) | ||
882 | { | ||
883 | struct expr *e1, *e2; | ||
884 | |||
885 | if (!e) { | ||
886 | e = expr_alloc_symbol(sym); | ||
887 | if (type == E_UNEQUAL) | ||
888 | e = expr_alloc_one(E_NOT, e); | ||
889 | return e; | ||
890 | } | ||
891 | switch (e->type) { | ||
892 | case E_AND: | ||
893 | e1 = expr_trans_compare(e->left.expr, E_EQUAL, sym); | ||
894 | e2 = expr_trans_compare(e->right.expr, E_EQUAL, sym); | ||
895 | if (sym == &symbol_yes) | ||
896 | e = expr_alloc_two(E_AND, e1, e2); | ||
897 | if (sym == &symbol_no) | ||
898 | e = expr_alloc_two(E_OR, e1, e2); | ||
899 | if (type == E_UNEQUAL) | ||
900 | e = expr_alloc_one(E_NOT, e); | ||
901 | return e; | ||
902 | case E_OR: | ||
903 | e1 = expr_trans_compare(e->left.expr, E_EQUAL, sym); | ||
904 | e2 = expr_trans_compare(e->right.expr, E_EQUAL, sym); | ||
905 | if (sym == &symbol_yes) | ||
906 | e = expr_alloc_two(E_OR, e1, e2); | ||
907 | if (sym == &symbol_no) | ||
908 | e = expr_alloc_two(E_AND, e1, e2); | ||
909 | if (type == E_UNEQUAL) | ||
910 | e = expr_alloc_one(E_NOT, e); | ||
911 | return e; | ||
912 | case E_NOT: | ||
913 | return expr_trans_compare(e->left.expr, type == E_EQUAL ? E_UNEQUAL : E_EQUAL, sym); | ||
914 | case E_UNEQUAL: | ||
915 | case E_EQUAL: | ||
916 | if (type == E_EQUAL) { | ||
917 | if (sym == &symbol_yes) | ||
918 | return expr_copy(e); | ||
919 | if (sym == &symbol_mod) | ||
920 | return expr_alloc_symbol(&symbol_no); | ||
921 | if (sym == &symbol_no) | ||
922 | return expr_alloc_one(E_NOT, expr_copy(e)); | ||
923 | } else { | ||
924 | if (sym == &symbol_yes) | ||
925 | return expr_alloc_one(E_NOT, expr_copy(e)); | ||
926 | if (sym == &symbol_mod) | ||
927 | return expr_alloc_symbol(&symbol_yes); | ||
928 | if (sym == &symbol_no) | ||
929 | return expr_copy(e); | ||
930 | } | ||
931 | break; | ||
932 | case E_SYMBOL: | ||
933 | return expr_alloc_comp(type, e->left.sym, sym); | ||
934 | case E_CHOICE: | ||
935 | case E_RANGE: | ||
936 | case E_NONE: | ||
937 | /* panic */; | ||
938 | } | ||
939 | return NULL; | ||
940 | } | ||
941 | |||
942 | tristate expr_calc_value(struct expr *e) | ||
943 | { | ||
944 | tristate val1, val2; | ||
945 | const char *str1, *str2; | ||
946 | |||
947 | if (!e) | ||
948 | return yes; | ||
949 | |||
950 | switch (e->type) { | ||
951 | case E_SYMBOL: | ||
952 | sym_calc_value(e->left.sym); | ||
953 | return e->left.sym->curr.tri; | ||
954 | case E_AND: | ||
955 | val1 = expr_calc_value(e->left.expr); | ||
956 | val2 = expr_calc_value(e->right.expr); | ||
957 | return E_AND(val1, val2); | ||
958 | case E_OR: | ||
959 | val1 = expr_calc_value(e->left.expr); | ||
960 | val2 = expr_calc_value(e->right.expr); | ||
961 | return E_OR(val1, val2); | ||
962 | case E_NOT: | ||
963 | val1 = expr_calc_value(e->left.expr); | ||
964 | return E_NOT(val1); | ||
965 | case E_EQUAL: | ||
966 | sym_calc_value(e->left.sym); | ||
967 | sym_calc_value(e->right.sym); | ||
968 | str1 = sym_get_string_value(e->left.sym); | ||
969 | str2 = sym_get_string_value(e->right.sym); | ||
970 | return !strcmp(str1, str2) ? yes : no; | ||
971 | case E_UNEQUAL: | ||
972 | sym_calc_value(e->left.sym); | ||
973 | sym_calc_value(e->right.sym); | ||
974 | str1 = sym_get_string_value(e->left.sym); | ||
975 | str2 = sym_get_string_value(e->right.sym); | ||
976 | return !strcmp(str1, str2) ? no : yes; | ||
977 | default: | ||
978 | printf("expr_calc_value: %d?\n", e->type); | ||
979 | return no; | ||
980 | } | ||
981 | } | ||
982 | |||
983 | int expr_compare_type(enum expr_type t1, enum expr_type t2) | ||
984 | { | ||
985 | #if 0 | ||
986 | return 1; | ||
987 | #else | ||
988 | if (t1 == t2) | ||
989 | return 0; | ||
990 | switch (t1) { | ||
991 | case E_EQUAL: | ||
992 | case E_UNEQUAL: | ||
993 | if (t2 == E_NOT) | ||
994 | return 1; | ||
995 | case E_NOT: | ||
996 | if (t2 == E_AND) | ||
997 | return 1; | ||
998 | case E_AND: | ||
999 | if (t2 == E_OR) | ||
1000 | return 1; | ||
1001 | case E_OR: | ||
1002 | if (t2 == E_CHOICE) | ||
1003 | return 1; | ||
1004 | case E_CHOICE: | ||
1005 | if (t2 == 0) | ||
1006 | return 1; | ||
1007 | default: | ||
1008 | return -1; | ||
1009 | } | ||
1010 | printf("[%dgt%d?]", t1, t2); | ||
1011 | return 0; | ||
1012 | #endif | ||
1013 | } | ||
1014 | |||
1015 | void expr_print(struct expr *e, void (*fn)(void *, const char *), void *data, int prevtoken) | ||
1016 | { | ||
1017 | if (!e) { | ||
1018 | fn(data, "y"); | ||
1019 | return; | ||
1020 | } | ||
1021 | |||
1022 | if (expr_compare_type(prevtoken, e->type) > 0) | ||
1023 | fn(data, "("); | ||
1024 | switch (e->type) { | ||
1025 | case E_SYMBOL: | ||
1026 | if (e->left.sym->name) | ||
1027 | fn(data, e->left.sym->name); | ||
1028 | else | ||
1029 | fn(data, "<choice>"); | ||
1030 | break; | ||
1031 | case E_NOT: | ||
1032 | fn(data, "!"); | ||
1033 | expr_print(e->left.expr, fn, data, E_NOT); | ||
1034 | break; | ||
1035 | case E_EQUAL: | ||
1036 | fn(data, e->left.sym->name); | ||
1037 | fn(data, "="); | ||
1038 | fn(data, e->right.sym->name); | ||
1039 | break; | ||
1040 | case E_UNEQUAL: | ||
1041 | fn(data, e->left.sym->name); | ||
1042 | fn(data, "!="); | ||
1043 | fn(data, e->right.sym->name); | ||
1044 | break; | ||
1045 | case E_OR: | ||
1046 | expr_print(e->left.expr, fn, data, E_OR); | ||
1047 | fn(data, " || "); | ||
1048 | expr_print(e->right.expr, fn, data, E_OR); | ||
1049 | break; | ||
1050 | case E_AND: | ||
1051 | expr_print(e->left.expr, fn, data, E_AND); | ||
1052 | fn(data, " && "); | ||
1053 | expr_print(e->right.expr, fn, data, E_AND); | ||
1054 | break; | ||
1055 | case E_CHOICE: | ||
1056 | fn(data, e->right.sym->name); | ||
1057 | if (e->left.expr) { | ||
1058 | fn(data, " ^ "); | ||
1059 | expr_print(e->left.expr, fn, data, E_CHOICE); | ||
1060 | } | ||
1061 | break; | ||
1062 | case E_RANGE: | ||
1063 | fn(data, "["); | ||
1064 | fn(data, e->left.sym->name); | ||
1065 | fn(data, " "); | ||
1066 | fn(data, e->right.sym->name); | ||
1067 | fn(data, "]"); | ||
1068 | break; | ||
1069 | default: | ||
1070 | { | ||
1071 | char buf[32]; | ||
1072 | sprintf(buf, "<unknown type %d>", e->type); | ||
1073 | fn(data, buf); | ||
1074 | break; | ||
1075 | } | ||
1076 | } | ||
1077 | if (expr_compare_type(prevtoken, e->type) > 0) | ||
1078 | fn(data, ")"); | ||
1079 | } | ||
1080 | |||
1081 | static void expr_print_file_helper(void *data, const char *str) | ||
1082 | { | ||
1083 | fwrite(str, strlen(str), 1, data); | ||
1084 | } | ||
1085 | |||
1086 | void expr_fprint(struct expr *e, FILE *out) | ||
1087 | { | ||
1088 | expr_print(e, expr_print_file_helper, out, E_NONE); | ||
1089 | } | ||
1090 | |||
1091 | static void expr_print_gstr_helper(void *data, const char *str) | ||
1092 | { | ||
1093 | str_append((struct gstr*)data, str); | ||
1094 | } | ||
1095 | |||
1096 | void expr_gstr_print(struct expr *e, struct gstr *gs) | ||
1097 | { | ||
1098 | expr_print(e, expr_print_gstr_helper, gs, E_NONE); | ||
1099 | } | ||
diff --git a/scripts/kconfig/expr.h b/scripts/kconfig/expr.h new file mode 100644 index 000000000..1b36ef18c --- /dev/null +++ b/scripts/kconfig/expr.h | |||
@@ -0,0 +1,194 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org> | ||
3 | * Released under the terms of the GNU GPL v2.0. | ||
4 | */ | ||
5 | |||
6 | #ifndef EXPR_H | ||
7 | #define EXPR_H | ||
8 | |||
9 | #ifdef __cplusplus | ||
10 | extern "C" { | ||
11 | #endif | ||
12 | |||
13 | #include <stdio.h> | ||
14 | #ifndef __cplusplus | ||
15 | #include <stdbool.h> | ||
16 | #endif | ||
17 | |||
18 | struct file { | ||
19 | struct file *next; | ||
20 | struct file *parent; | ||
21 | char *name; | ||
22 | int lineno; | ||
23 | int flags; | ||
24 | }; | ||
25 | |||
26 | #define FILE_BUSY 0x0001 | ||
27 | #define FILE_SCANNED 0x0002 | ||
28 | #define FILE_PRINTED 0x0004 | ||
29 | |||
30 | typedef enum tristate { | ||
31 | no, mod, yes | ||
32 | } tristate; | ||
33 | |||
34 | enum expr_type { | ||
35 | E_NONE, E_OR, E_AND, E_NOT, E_EQUAL, E_UNEQUAL, E_CHOICE, E_SYMBOL, E_RANGE | ||
36 | }; | ||
37 | |||
38 | union expr_data { | ||
39 | struct expr *expr; | ||
40 | struct symbol *sym; | ||
41 | }; | ||
42 | |||
43 | struct expr { | ||
44 | enum expr_type type; | ||
45 | union expr_data left, right; | ||
46 | }; | ||
47 | |||
48 | #define E_OR(dep1, dep2) (((dep1)>(dep2))?(dep1):(dep2)) | ||
49 | #define E_AND(dep1, dep2) (((dep1)<(dep2))?(dep1):(dep2)) | ||
50 | #define E_NOT(dep) (2-(dep)) | ||
51 | |||
52 | struct expr_value { | ||
53 | struct expr *expr; | ||
54 | tristate tri; | ||
55 | }; | ||
56 | |||
57 | struct symbol_value { | ||
58 | void *val; | ||
59 | tristate tri; | ||
60 | }; | ||
61 | |||
62 | enum symbol_type { | ||
63 | S_UNKNOWN, S_BOOLEAN, S_TRISTATE, S_INT, S_HEX, S_STRING, S_OTHER | ||
64 | }; | ||
65 | |||
66 | struct symbol { | ||
67 | struct symbol *next; | ||
68 | char *name; | ||
69 | char *help; | ||
70 | enum symbol_type type; | ||
71 | struct symbol_value curr, user; | ||
72 | tristate visible; | ||
73 | int flags; | ||
74 | struct property *prop; | ||
75 | struct expr *dep, *dep2; | ||
76 | struct expr_value rev_dep; | ||
77 | }; | ||
78 | |||
79 | #define for_all_symbols(i, sym) for (i = 0; i < 257; i++) for (sym = symbol_hash[i]; sym; sym = sym->next) if (sym->type != S_OTHER) | ||
80 | |||
81 | #define SYMBOL_YES 0x0001 | ||
82 | #define SYMBOL_MOD 0x0002 | ||
83 | #define SYMBOL_NO 0x0004 | ||
84 | #define SYMBOL_CONST 0x0007 | ||
85 | #define SYMBOL_CHECK 0x0008 | ||
86 | #define SYMBOL_CHOICE 0x0010 | ||
87 | #define SYMBOL_CHOICEVAL 0x0020 | ||
88 | #define SYMBOL_PRINTED 0x0040 | ||
89 | #define SYMBOL_VALID 0x0080 | ||
90 | #define SYMBOL_OPTIONAL 0x0100 | ||
91 | #define SYMBOL_WRITE 0x0200 | ||
92 | #define SYMBOL_CHANGED 0x0400 | ||
93 | #define SYMBOL_NEW 0x0800 | ||
94 | #define SYMBOL_AUTO 0x1000 | ||
95 | #define SYMBOL_CHECKED 0x2000 | ||
96 | #define SYMBOL_WARNED 0x8000 | ||
97 | |||
98 | #define SYMBOL_MAXLENGTH 256 | ||
99 | #define SYMBOL_HASHSIZE 257 | ||
100 | #define SYMBOL_HASHMASK 0xff | ||
101 | |||
102 | enum prop_type { | ||
103 | P_UNKNOWN, P_PROMPT, P_COMMENT, P_MENU, P_DEFAULT, P_CHOICE, P_SELECT, P_RANGE | ||
104 | }; | ||
105 | |||
106 | struct property { | ||
107 | struct property *next; | ||
108 | struct symbol *sym; | ||
109 | enum prop_type type; | ||
110 | const char *text; | ||
111 | struct expr_value visible; | ||
112 | struct expr *expr; | ||
113 | struct menu *menu; | ||
114 | struct file *file; | ||
115 | int lineno; | ||
116 | }; | ||
117 | |||
118 | #define for_all_properties(sym, st, tok) \ | ||
119 | for (st = sym->prop; st; st = st->next) \ | ||
120 | if (st->type == (tok)) | ||
121 | #define for_all_defaults(sym, st) for_all_properties(sym, st, P_DEFAULT) | ||
122 | #define for_all_choices(sym, st) for_all_properties(sym, st, P_CHOICE) | ||
123 | #define for_all_prompts(sym, st) \ | ||
124 | for (st = sym->prop; st; st = st->next) \ | ||
125 | if (st->text) | ||
126 | |||
127 | struct menu { | ||
128 | struct menu *next; | ||
129 | struct menu *parent; | ||
130 | struct menu *list; | ||
131 | struct symbol *sym; | ||
132 | struct property *prompt; | ||
133 | struct expr *dep; | ||
134 | unsigned int flags; | ||
135 | //char *help; | ||
136 | struct file *file; | ||
137 | int lineno; | ||
138 | void *data; | ||
139 | }; | ||
140 | |||
141 | #define MENU_CHANGED 0x0001 | ||
142 | #define MENU_ROOT 0x0002 | ||
143 | |||
144 | #ifndef SWIG | ||
145 | |||
146 | extern struct file *file_list; | ||
147 | extern struct file *current_file; | ||
148 | struct file *lookup_file(const char *name); | ||
149 | |||
150 | extern struct symbol symbol_yes, symbol_no, symbol_mod; | ||
151 | extern struct symbol *modules_sym; | ||
152 | extern int cdebug; | ||
153 | struct expr *expr_alloc_symbol(struct symbol *sym); | ||
154 | struct expr *expr_alloc_one(enum expr_type type, struct expr *ce); | ||
155 | struct expr *expr_alloc_two(enum expr_type type, struct expr *e1, struct expr *e2); | ||
156 | struct expr *expr_alloc_comp(enum expr_type type, struct symbol *s1, struct symbol *s2); | ||
157 | struct expr *expr_alloc_and(struct expr *e1, struct expr *e2); | ||
158 | struct expr *expr_alloc_or(struct expr *e1, struct expr *e2); | ||
159 | struct expr *expr_copy(struct expr *org); | ||
160 | void expr_free(struct expr *e); | ||
161 | int expr_eq(struct expr *e1, struct expr *e2); | ||
162 | void expr_eliminate_eq(struct expr **ep1, struct expr **ep2); | ||
163 | tristate expr_calc_value(struct expr *e); | ||
164 | struct expr *expr_eliminate_yn(struct expr *e); | ||
165 | struct expr *expr_trans_bool(struct expr *e); | ||
166 | struct expr *expr_eliminate_dups(struct expr *e); | ||
167 | struct expr *expr_transform(struct expr *e); | ||
168 | int expr_contains_symbol(struct expr *dep, struct symbol *sym); | ||
169 | bool expr_depends_symbol(struct expr *dep, struct symbol *sym); | ||
170 | struct expr *expr_extract_eq_and(struct expr **ep1, struct expr **ep2); | ||
171 | struct expr *expr_extract_eq_or(struct expr **ep1, struct expr **ep2); | ||
172 | void expr_extract_eq(enum expr_type type, struct expr **ep, struct expr **ep1, struct expr **ep2); | ||
173 | struct expr *expr_trans_compare(struct expr *e, enum expr_type type, struct symbol *sym); | ||
174 | |||
175 | void expr_fprint(struct expr *e, FILE *out); | ||
176 | struct gstr; /* forward */ | ||
177 | void expr_gstr_print(struct expr *e, struct gstr *gs); | ||
178 | |||
179 | static inline int expr_is_yes(struct expr *e) | ||
180 | { | ||
181 | return !e || (e->type == E_SYMBOL && e->left.sym == &symbol_yes); | ||
182 | } | ||
183 | |||
184 | static inline int expr_is_no(struct expr *e) | ||
185 | { | ||
186 | return e && (e->type == E_SYMBOL && e->left.sym == &symbol_no); | ||
187 | } | ||
188 | #endif | ||
189 | |||
190 | #ifdef __cplusplus | ||
191 | } | ||
192 | #endif | ||
193 | |||
194 | #endif /* EXPR_H */ | ||
diff --git a/scripts/kconfig/gconf.c b/scripts/kconfig/gconf.c new file mode 100644 index 000000000..665bd5300 --- /dev/null +++ b/scripts/kconfig/gconf.c | |||
@@ -0,0 +1,1645 @@ | |||
1 | /* Hey EMACS -*- linux-c -*- */ | ||
2 | /* | ||
3 | * | ||
4 | * Copyright (C) 2002-2003 Romain Lievin <roms@tilp.info> | ||
5 | * Released under the terms of the GNU GPL v2.0. | ||
6 | * | ||
7 | */ | ||
8 | |||
9 | #ifdef HAVE_CONFIG_H | ||
10 | # include <config.h> | ||
11 | #endif | ||
12 | |||
13 | #include "lkc.h" | ||
14 | #include "images.c" | ||
15 | |||
16 | #include <glade/glade.h> | ||
17 | #include <gtk/gtk.h> | ||
18 | #include <glib.h> | ||
19 | #include <gdk/gdkkeysyms.h> | ||
20 | |||
21 | #include <stdio.h> | ||
22 | #include <string.h> | ||
23 | #include <unistd.h> | ||
24 | #include <time.h> | ||
25 | #include <stdlib.h> | ||
26 | |||
27 | //#define DEBUG | ||
28 | |||
29 | enum { | ||
30 | SINGLE_VIEW, SPLIT_VIEW, FULL_VIEW | ||
31 | }; | ||
32 | |||
33 | static gint view_mode = FULL_VIEW; | ||
34 | static gboolean show_name = TRUE; | ||
35 | static gboolean show_range = TRUE; | ||
36 | static gboolean show_value = TRUE; | ||
37 | static gboolean show_all = FALSE; | ||
38 | static gboolean show_debug = FALSE; | ||
39 | static gboolean resizeable = FALSE; | ||
40 | |||
41 | static gboolean config_changed = FALSE; | ||
42 | |||
43 | static char nohelp_text[] = | ||
44 | N_("Sorry, no help available for this option yet.\n"); | ||
45 | |||
46 | GtkWidget *main_wnd = NULL; | ||
47 | GtkWidget *tree1_w = NULL; // left frame | ||
48 | GtkWidget *tree2_w = NULL; // right frame | ||
49 | GtkWidget *text_w = NULL; | ||
50 | GtkWidget *hpaned = NULL; | ||
51 | GtkWidget *vpaned = NULL; | ||
52 | GtkWidget *back_btn = NULL; | ||
53 | |||
54 | GtkTextTag *tag1, *tag2; | ||
55 | GdkColor color; | ||
56 | |||
57 | GtkTreeStore *tree1, *tree2, *tree; | ||
58 | GtkTreeModel *model1, *model2; | ||
59 | static GtkTreeIter *parents[256]; | ||
60 | static gint indent; | ||
61 | |||
62 | static struct menu *current; // current node for SINGLE view | ||
63 | static struct menu *browsed; // browsed node for SPLIT view | ||
64 | |||
65 | enum { | ||
66 | COL_OPTION, COL_NAME, COL_NO, COL_MOD, COL_YES, COL_VALUE, | ||
67 | COL_MENU, COL_COLOR, COL_EDIT, COL_PIXBUF, | ||
68 | COL_PIXVIS, COL_BTNVIS, COL_BTNACT, COL_BTNINC, COL_BTNRAD, | ||
69 | COL_NUMBER | ||
70 | }; | ||
71 | |||
72 | static void display_list(void); | ||
73 | static void display_tree(struct menu *menu); | ||
74 | static void display_tree_part(void); | ||
75 | static void update_tree(struct menu *src, GtkTreeIter * dst); | ||
76 | static void set_node(GtkTreeIter * node, struct menu *menu, gchar ** row); | ||
77 | static gchar **fill_row(struct menu *menu); | ||
78 | |||
79 | |||
80 | /* Helping/Debugging Functions */ | ||
81 | |||
82 | |||
83 | const char *dbg_print_stype(int val) | ||
84 | { | ||
85 | static char buf[256]; | ||
86 | |||
87 | bzero(buf, 256); | ||
88 | |||
89 | if (val == S_UNKNOWN) | ||
90 | strcpy(buf, "unknown"); | ||
91 | if (val == S_BOOLEAN) | ||
92 | strcpy(buf, "boolean"); | ||
93 | if (val == S_TRISTATE) | ||
94 | strcpy(buf, "tristate"); | ||
95 | if (val == S_INT) | ||
96 | strcpy(buf, "int"); | ||
97 | if (val == S_HEX) | ||
98 | strcpy(buf, "hex"); | ||
99 | if (val == S_STRING) | ||
100 | strcpy(buf, "string"); | ||
101 | if (val == S_OTHER) | ||
102 | strcpy(buf, "other"); | ||
103 | |||
104 | #ifdef DEBUG | ||
105 | printf("%s", buf); | ||
106 | #endif | ||
107 | |||
108 | return buf; | ||
109 | } | ||
110 | |||
111 | const char *dbg_print_flags(int val) | ||
112 | { | ||
113 | static char buf[256]; | ||
114 | |||
115 | bzero(buf, 256); | ||
116 | |||
117 | if (val & SYMBOL_YES) | ||
118 | strcat(buf, "yes/"); | ||
119 | if (val & SYMBOL_MOD) | ||
120 | strcat(buf, "mod/"); | ||
121 | if (val & SYMBOL_NO) | ||
122 | strcat(buf, "no/"); | ||
123 | if (val & SYMBOL_CONST) | ||
124 | strcat(buf, "const/"); | ||
125 | if (val & SYMBOL_CHECK) | ||
126 | strcat(buf, "check/"); | ||
127 | if (val & SYMBOL_CHOICE) | ||
128 | strcat(buf, "choice/"); | ||
129 | if (val & SYMBOL_CHOICEVAL) | ||
130 | strcat(buf, "choiceval/"); | ||
131 | if (val & SYMBOL_PRINTED) | ||
132 | strcat(buf, "printed/"); | ||
133 | if (val & SYMBOL_VALID) | ||
134 | strcat(buf, "valid/"); | ||
135 | if (val & SYMBOL_OPTIONAL) | ||
136 | strcat(buf, "optional/"); | ||
137 | if (val & SYMBOL_WRITE) | ||
138 | strcat(buf, "write/"); | ||
139 | if (val & SYMBOL_CHANGED) | ||
140 | strcat(buf, "changed/"); | ||
141 | if (val & SYMBOL_NEW) | ||
142 | strcat(buf, "new/"); | ||
143 | if (val & SYMBOL_AUTO) | ||
144 | strcat(buf, "auto/"); | ||
145 | |||
146 | buf[strlen(buf) - 1] = '\0'; | ||
147 | #ifdef DEBUG | ||
148 | printf("%s", buf); | ||
149 | #endif | ||
150 | |||
151 | return buf; | ||
152 | } | ||
153 | |||
154 | const char *dbg_print_ptype(int val) | ||
155 | { | ||
156 | static char buf[256]; | ||
157 | |||
158 | bzero(buf, 256); | ||
159 | |||
160 | if (val == P_UNKNOWN) | ||
161 | strcpy(buf, "unknown"); | ||
162 | if (val == P_PROMPT) | ||
163 | strcpy(buf, "prompt"); | ||
164 | if (val == P_COMMENT) | ||
165 | strcpy(buf, "comment"); | ||
166 | if (val == P_MENU) | ||
167 | strcpy(buf, "menu"); | ||
168 | if (val == P_DEFAULT) | ||
169 | strcpy(buf, "default"); | ||
170 | if (val == P_CHOICE) | ||
171 | strcpy(buf, "choice"); | ||
172 | |||
173 | #ifdef DEBUG | ||
174 | printf("%s", buf); | ||
175 | #endif | ||
176 | |||
177 | return buf; | ||
178 | } | ||
179 | |||
180 | |||
181 | void replace_button_icon(GladeXML * xml, GdkDrawable * window, | ||
182 | GtkStyle * style, gchar * btn_name, gchar ** xpm) | ||
183 | { | ||
184 | GdkPixmap *pixmap; | ||
185 | GdkBitmap *mask; | ||
186 | GtkToolButton *button; | ||
187 | GtkWidget *image; | ||
188 | |||
189 | pixmap = gdk_pixmap_create_from_xpm_d(window, &mask, | ||
190 | &style->bg[GTK_STATE_NORMAL], | ||
191 | xpm); | ||
192 | |||
193 | button = GTK_TOOL_BUTTON(glade_xml_get_widget(xml, btn_name)); | ||
194 | image = gtk_image_new_from_pixmap(pixmap, mask); | ||
195 | gtk_widget_show(image); | ||
196 | gtk_tool_button_set_icon_widget(button, image); | ||
197 | } | ||
198 | |||
199 | /* Main Window Initialization */ | ||
200 | void init_main_window(const gchar * glade_file) | ||
201 | { | ||
202 | GladeXML *xml; | ||
203 | GtkWidget *widget; | ||
204 | GtkTextBuffer *txtbuf; | ||
205 | char title[256]; | ||
206 | GtkStyle *style; | ||
207 | |||
208 | xml = glade_xml_new(glade_file, "window1", NULL); | ||
209 | if (!xml) | ||
210 | g_error(_("GUI loading failed !\n")); | ||
211 | glade_xml_signal_autoconnect(xml); | ||
212 | |||
213 | main_wnd = glade_xml_get_widget(xml, "window1"); | ||
214 | hpaned = glade_xml_get_widget(xml, "hpaned1"); | ||
215 | vpaned = glade_xml_get_widget(xml, "vpaned1"); | ||
216 | tree1_w = glade_xml_get_widget(xml, "treeview1"); | ||
217 | tree2_w = glade_xml_get_widget(xml, "treeview2"); | ||
218 | text_w = glade_xml_get_widget(xml, "textview3"); | ||
219 | |||
220 | back_btn = glade_xml_get_widget(xml, "button1"); | ||
221 | gtk_widget_set_sensitive(back_btn, FALSE); | ||
222 | |||
223 | widget = glade_xml_get_widget(xml, "show_name1"); | ||
224 | gtk_check_menu_item_set_active((GtkCheckMenuItem *) widget, | ||
225 | show_name); | ||
226 | |||
227 | widget = glade_xml_get_widget(xml, "show_range1"); | ||
228 | gtk_check_menu_item_set_active((GtkCheckMenuItem *) widget, | ||
229 | show_range); | ||
230 | |||
231 | widget = glade_xml_get_widget(xml, "show_data1"); | ||
232 | gtk_check_menu_item_set_active((GtkCheckMenuItem *) widget, | ||
233 | show_value); | ||
234 | |||
235 | style = gtk_widget_get_style(main_wnd); | ||
236 | widget = glade_xml_get_widget(xml, "toolbar1"); | ||
237 | |||
238 | #if 0 /* Use stock Gtk icons instead */ | ||
239 | replace_button_icon(xml, main_wnd->window, style, | ||
240 | "button1", (gchar **) xpm_back); | ||
241 | replace_button_icon(xml, main_wnd->window, style, | ||
242 | "button2", (gchar **) xpm_load); | ||
243 | replace_button_icon(xml, main_wnd->window, style, | ||
244 | "button3", (gchar **) xpm_save); | ||
245 | #endif | ||
246 | replace_button_icon(xml, main_wnd->window, style, | ||
247 | "button4", (gchar **) xpm_single_view); | ||
248 | replace_button_icon(xml, main_wnd->window, style, | ||
249 | "button5", (gchar **) xpm_split_view); | ||
250 | replace_button_icon(xml, main_wnd->window, style, | ||
251 | "button6", (gchar **) xpm_tree_view); | ||
252 | |||
253 | #if 0 | ||
254 | switch (view_mode) { | ||
255 | case SINGLE_VIEW: | ||
256 | widget = glade_xml_get_widget(xml, "button4"); | ||
257 | g_signal_emit_by_name(widget, "clicked"); | ||
258 | break; | ||
259 | case SPLIT_VIEW: | ||
260 | widget = glade_xml_get_widget(xml, "button5"); | ||
261 | g_signal_emit_by_name(widget, "clicked"); | ||
262 | break; | ||
263 | case FULL_VIEW: | ||
264 | widget = glade_xml_get_widget(xml, "button6"); | ||
265 | g_signal_emit_by_name(widget, "clicked"); | ||
266 | break; | ||
267 | } | ||
268 | #endif | ||
269 | txtbuf = gtk_text_view_get_buffer(GTK_TEXT_VIEW(text_w)); | ||
270 | tag1 = gtk_text_buffer_create_tag(txtbuf, "mytag1", | ||
271 | "foreground", "red", | ||
272 | "weight", PANGO_WEIGHT_BOLD, | ||
273 | NULL); | ||
274 | tag2 = gtk_text_buffer_create_tag(txtbuf, "mytag2", | ||
275 | /*"style", PANGO_STYLE_OBLIQUE, */ | ||
276 | NULL); | ||
277 | |||
278 | sprintf(title, _("Linux Kernel v%s Configuration"), | ||
279 | getenv("KERNELVERSION")); | ||
280 | gtk_window_set_title(GTK_WINDOW(main_wnd), title); | ||
281 | |||
282 | gtk_widget_show(main_wnd); | ||
283 | } | ||
284 | |||
285 | void init_tree_model(void) | ||
286 | { | ||
287 | gint i; | ||
288 | |||
289 | tree = tree2 = gtk_tree_store_new(COL_NUMBER, | ||
290 | G_TYPE_STRING, G_TYPE_STRING, | ||
291 | G_TYPE_STRING, G_TYPE_STRING, | ||
292 | G_TYPE_STRING, G_TYPE_STRING, | ||
293 | G_TYPE_POINTER, GDK_TYPE_COLOR, | ||
294 | G_TYPE_BOOLEAN, GDK_TYPE_PIXBUF, | ||
295 | G_TYPE_BOOLEAN, G_TYPE_BOOLEAN, | ||
296 | G_TYPE_BOOLEAN, G_TYPE_BOOLEAN, | ||
297 | G_TYPE_BOOLEAN); | ||
298 | model2 = GTK_TREE_MODEL(tree2); | ||
299 | |||
300 | for (parents[0] = NULL, i = 1; i < 256; i++) | ||
301 | parents[i] = (GtkTreeIter *) g_malloc(sizeof(GtkTreeIter)); | ||
302 | |||
303 | tree1 = gtk_tree_store_new(COL_NUMBER, | ||
304 | G_TYPE_STRING, G_TYPE_STRING, | ||
305 | G_TYPE_STRING, G_TYPE_STRING, | ||
306 | G_TYPE_STRING, G_TYPE_STRING, | ||
307 | G_TYPE_POINTER, GDK_TYPE_COLOR, | ||
308 | G_TYPE_BOOLEAN, GDK_TYPE_PIXBUF, | ||
309 | G_TYPE_BOOLEAN, G_TYPE_BOOLEAN, | ||
310 | G_TYPE_BOOLEAN, G_TYPE_BOOLEAN, | ||
311 | G_TYPE_BOOLEAN); | ||
312 | model1 = GTK_TREE_MODEL(tree1); | ||
313 | } | ||
314 | |||
315 | void init_left_tree(void) | ||
316 | { | ||
317 | GtkTreeView *view = GTK_TREE_VIEW(tree1_w); | ||
318 | GtkCellRenderer *renderer; | ||
319 | GtkTreeSelection *sel; | ||
320 | GtkTreeViewColumn *column; | ||
321 | |||
322 | gtk_tree_view_set_model(view, model1); | ||
323 | gtk_tree_view_set_headers_visible(view, TRUE); | ||
324 | gtk_tree_view_set_rules_hint(view, FALSE); | ||
325 | |||
326 | column = gtk_tree_view_column_new(); | ||
327 | gtk_tree_view_append_column(view, column); | ||
328 | gtk_tree_view_column_set_title(column, _("Options")); | ||
329 | |||
330 | renderer = gtk_cell_renderer_toggle_new(); | ||
331 | gtk_tree_view_column_pack_start(GTK_TREE_VIEW_COLUMN(column), | ||
332 | renderer, FALSE); | ||
333 | gtk_tree_view_column_set_attributes(GTK_TREE_VIEW_COLUMN(column), | ||
334 | renderer, | ||
335 | "active", COL_BTNACT, | ||
336 | "inconsistent", COL_BTNINC, | ||
337 | "visible", COL_BTNVIS, | ||
338 | "radio", COL_BTNRAD, NULL); | ||
339 | renderer = gtk_cell_renderer_text_new(); | ||
340 | gtk_tree_view_column_pack_start(GTK_TREE_VIEW_COLUMN(column), | ||
341 | renderer, FALSE); | ||
342 | gtk_tree_view_column_set_attributes(GTK_TREE_VIEW_COLUMN(column), | ||
343 | renderer, | ||
344 | "text", COL_OPTION, | ||
345 | "foreground-gdk", | ||
346 | COL_COLOR, NULL); | ||
347 | |||
348 | sel = gtk_tree_view_get_selection(view); | ||
349 | gtk_tree_selection_set_mode(sel, GTK_SELECTION_SINGLE); | ||
350 | gtk_widget_realize(tree1_w); | ||
351 | } | ||
352 | |||
353 | static void renderer_edited(GtkCellRendererText * cell, | ||
354 | const gchar * path_string, | ||
355 | const gchar * new_text, gpointer user_data); | ||
356 | static void renderer_toggled(GtkCellRendererToggle * cellrenderertoggle, | ||
357 | gchar * arg1, gpointer user_data); | ||
358 | |||
359 | void init_right_tree(void) | ||
360 | { | ||
361 | GtkTreeView *view = GTK_TREE_VIEW(tree2_w); | ||
362 | GtkCellRenderer *renderer; | ||
363 | GtkTreeSelection *sel; | ||
364 | GtkTreeViewColumn *column; | ||
365 | gint i; | ||
366 | |||
367 | gtk_tree_view_set_model(view, model2); | ||
368 | gtk_tree_view_set_headers_visible(view, TRUE); | ||
369 | gtk_tree_view_set_rules_hint(view, FALSE); | ||
370 | |||
371 | column = gtk_tree_view_column_new(); | ||
372 | gtk_tree_view_append_column(view, column); | ||
373 | gtk_tree_view_column_set_title(column, _("Options")); | ||
374 | |||
375 | renderer = gtk_cell_renderer_pixbuf_new(); | ||
376 | gtk_tree_view_column_pack_start(GTK_TREE_VIEW_COLUMN(column), | ||
377 | renderer, FALSE); | ||
378 | gtk_tree_view_column_set_attributes(GTK_TREE_VIEW_COLUMN(column), | ||
379 | renderer, | ||
380 | "pixbuf", COL_PIXBUF, | ||
381 | "visible", COL_PIXVIS, NULL); | ||
382 | renderer = gtk_cell_renderer_toggle_new(); | ||
383 | gtk_tree_view_column_pack_start(GTK_TREE_VIEW_COLUMN(column), | ||
384 | renderer, FALSE); | ||
385 | gtk_tree_view_column_set_attributes(GTK_TREE_VIEW_COLUMN(column), | ||
386 | renderer, | ||
387 | "active", COL_BTNACT, | ||
388 | "inconsistent", COL_BTNINC, | ||
389 | "visible", COL_BTNVIS, | ||
390 | "radio", COL_BTNRAD, NULL); | ||
391 | /*g_signal_connect(G_OBJECT(renderer), "toggled", | ||
392 | G_CALLBACK(renderer_toggled), NULL); */ | ||
393 | renderer = gtk_cell_renderer_text_new(); | ||
394 | gtk_tree_view_column_pack_start(GTK_TREE_VIEW_COLUMN(column), | ||
395 | renderer, FALSE); | ||
396 | gtk_tree_view_column_set_attributes(GTK_TREE_VIEW_COLUMN(column), | ||
397 | renderer, | ||
398 | "text", COL_OPTION, | ||
399 | "foreground-gdk", | ||
400 | COL_COLOR, NULL); | ||
401 | |||
402 | renderer = gtk_cell_renderer_text_new(); | ||
403 | gtk_tree_view_insert_column_with_attributes(view, -1, | ||
404 | _("Name"), renderer, | ||
405 | "text", COL_NAME, | ||
406 | "foreground-gdk", | ||
407 | COL_COLOR, NULL); | ||
408 | renderer = gtk_cell_renderer_text_new(); | ||
409 | gtk_tree_view_insert_column_with_attributes(view, -1, | ||
410 | "N", renderer, | ||
411 | "text", COL_NO, | ||
412 | "foreground-gdk", | ||
413 | COL_COLOR, NULL); | ||
414 | renderer = gtk_cell_renderer_text_new(); | ||
415 | gtk_tree_view_insert_column_with_attributes(view, -1, | ||
416 | "M", renderer, | ||
417 | "text", COL_MOD, | ||
418 | "foreground-gdk", | ||
419 | COL_COLOR, NULL); | ||
420 | renderer = gtk_cell_renderer_text_new(); | ||
421 | gtk_tree_view_insert_column_with_attributes(view, -1, | ||
422 | "Y", renderer, | ||
423 | "text", COL_YES, | ||
424 | "foreground-gdk", | ||
425 | COL_COLOR, NULL); | ||
426 | renderer = gtk_cell_renderer_text_new(); | ||
427 | gtk_tree_view_insert_column_with_attributes(view, -1, | ||
428 | _("Value"), renderer, | ||
429 | "text", COL_VALUE, | ||
430 | "editable", | ||
431 | COL_EDIT, | ||
432 | "foreground-gdk", | ||
433 | COL_COLOR, NULL); | ||
434 | g_signal_connect(G_OBJECT(renderer), "edited", | ||
435 | G_CALLBACK(renderer_edited), NULL); | ||
436 | |||
437 | column = gtk_tree_view_get_column(view, COL_NAME); | ||
438 | gtk_tree_view_column_set_visible(column, show_name); | ||
439 | column = gtk_tree_view_get_column(view, COL_NO); | ||
440 | gtk_tree_view_column_set_visible(column, show_range); | ||
441 | column = gtk_tree_view_get_column(view, COL_MOD); | ||
442 | gtk_tree_view_column_set_visible(column, show_range); | ||
443 | column = gtk_tree_view_get_column(view, COL_YES); | ||
444 | gtk_tree_view_column_set_visible(column, show_range); | ||
445 | column = gtk_tree_view_get_column(view, COL_VALUE); | ||
446 | gtk_tree_view_column_set_visible(column, show_value); | ||
447 | |||
448 | if (resizeable) { | ||
449 | for (i = 0; i < COL_VALUE; i++) { | ||
450 | column = gtk_tree_view_get_column(view, i); | ||
451 | gtk_tree_view_column_set_resizable(column, TRUE); | ||
452 | } | ||
453 | } | ||
454 | |||
455 | sel = gtk_tree_view_get_selection(view); | ||
456 | gtk_tree_selection_set_mode(sel, GTK_SELECTION_SINGLE); | ||
457 | } | ||
458 | |||
459 | |||
460 | /* Utility Functions */ | ||
461 | |||
462 | |||
463 | static void text_insert_help(struct menu *menu) | ||
464 | { | ||
465 | GtkTextBuffer *buffer; | ||
466 | GtkTextIter start, end; | ||
467 | const char *prompt = menu_get_prompt(menu); | ||
468 | gchar *name; | ||
469 | const char *help = _(nohelp_text); | ||
470 | |||
471 | if (!menu->sym) | ||
472 | help = ""; | ||
473 | else if (menu->sym->help) | ||
474 | help = _(menu->sym->help); | ||
475 | |||
476 | if (menu->sym && menu->sym->name) | ||
477 | name = g_strdup_printf(_(menu->sym->name)); | ||
478 | else | ||
479 | name = g_strdup(""); | ||
480 | |||
481 | buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(text_w)); | ||
482 | gtk_text_buffer_get_bounds(buffer, &start, &end); | ||
483 | gtk_text_buffer_delete(buffer, &start, &end); | ||
484 | gtk_text_view_set_left_margin(GTK_TEXT_VIEW(text_w), 15); | ||
485 | |||
486 | gtk_text_buffer_get_end_iter(buffer, &end); | ||
487 | gtk_text_buffer_insert_with_tags(buffer, &end, prompt, -1, tag1, | ||
488 | NULL); | ||
489 | gtk_text_buffer_insert_at_cursor(buffer, " ", 1); | ||
490 | gtk_text_buffer_get_end_iter(buffer, &end); | ||
491 | gtk_text_buffer_insert_with_tags(buffer, &end, name, -1, tag1, | ||
492 | NULL); | ||
493 | gtk_text_buffer_insert_at_cursor(buffer, "\n\n", 2); | ||
494 | gtk_text_buffer_get_end_iter(buffer, &end); | ||
495 | gtk_text_buffer_insert_with_tags(buffer, &end, help, -1, tag2, | ||
496 | NULL); | ||
497 | } | ||
498 | |||
499 | |||
500 | static void text_insert_msg(const char *title, const char *message) | ||
501 | { | ||
502 | GtkTextBuffer *buffer; | ||
503 | GtkTextIter start, end; | ||
504 | const char *msg = message; | ||
505 | |||
506 | buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(text_w)); | ||
507 | gtk_text_buffer_get_bounds(buffer, &start, &end); | ||
508 | gtk_text_buffer_delete(buffer, &start, &end); | ||
509 | gtk_text_view_set_left_margin(GTK_TEXT_VIEW(text_w), 15); | ||
510 | |||
511 | gtk_text_buffer_get_end_iter(buffer, &end); | ||
512 | gtk_text_buffer_insert_with_tags(buffer, &end, title, -1, tag1, | ||
513 | NULL); | ||
514 | gtk_text_buffer_insert_at_cursor(buffer, "\n\n", 2); | ||
515 | gtk_text_buffer_get_end_iter(buffer, &end); | ||
516 | gtk_text_buffer_insert_with_tags(buffer, &end, msg, -1, tag2, | ||
517 | NULL); | ||
518 | } | ||
519 | |||
520 | |||
521 | /* Main Windows Callbacks */ | ||
522 | |||
523 | void on_save1_activate(GtkMenuItem * menuitem, gpointer user_data); | ||
524 | gboolean on_window1_delete_event(GtkWidget * widget, GdkEvent * event, | ||
525 | gpointer user_data) | ||
526 | { | ||
527 | GtkWidget *dialog, *label; | ||
528 | gint result; | ||
529 | |||
530 | if (config_changed == FALSE) | ||
531 | return FALSE; | ||
532 | |||
533 | dialog = gtk_dialog_new_with_buttons(_("Warning !"), | ||
534 | GTK_WINDOW(main_wnd), | ||
535 | (GtkDialogFlags) | ||
536 | (GTK_DIALOG_MODAL | | ||
537 | GTK_DIALOG_DESTROY_WITH_PARENT), | ||
538 | GTK_STOCK_OK, | ||
539 | GTK_RESPONSE_YES, | ||
540 | GTK_STOCK_NO, | ||
541 | GTK_RESPONSE_NO, | ||
542 | GTK_STOCK_CANCEL, | ||
543 | GTK_RESPONSE_CANCEL, NULL); | ||
544 | gtk_dialog_set_default_response(GTK_DIALOG(dialog), | ||
545 | GTK_RESPONSE_CANCEL); | ||
546 | |||
547 | label = gtk_label_new(_("\nSave configuration ?\n")); | ||
548 | gtk_container_add(GTK_CONTAINER(GTK_DIALOG(dialog)->vbox), label); | ||
549 | gtk_widget_show(label); | ||
550 | |||
551 | result = gtk_dialog_run(GTK_DIALOG(dialog)); | ||
552 | switch (result) { | ||
553 | case GTK_RESPONSE_YES: | ||
554 | on_save1_activate(NULL, NULL); | ||
555 | return FALSE; | ||
556 | case GTK_RESPONSE_NO: | ||
557 | return FALSE; | ||
558 | case GTK_RESPONSE_CANCEL: | ||
559 | case GTK_RESPONSE_DELETE_EVENT: | ||
560 | default: | ||
561 | gtk_widget_destroy(dialog); | ||
562 | return TRUE; | ||
563 | } | ||
564 | |||
565 | return FALSE; | ||
566 | } | ||
567 | |||
568 | |||
569 | void on_window1_destroy(GtkObject * object, gpointer user_data) | ||
570 | { | ||
571 | gtk_main_quit(); | ||
572 | } | ||
573 | |||
574 | |||
575 | void | ||
576 | on_window1_size_request(GtkWidget * widget, | ||
577 | GtkRequisition * requisition, gpointer user_data) | ||
578 | { | ||
579 | static gint old_h; | ||
580 | gint w, h; | ||
581 | |||
582 | if (widget->window == NULL) | ||
583 | gtk_window_get_default_size(GTK_WINDOW(main_wnd), &w, &h); | ||
584 | else | ||
585 | gdk_window_get_size(widget->window, &w, &h); | ||
586 | |||
587 | if (h == old_h) | ||
588 | return; | ||
589 | old_h = h; | ||
590 | |||
591 | gtk_paned_set_position(GTK_PANED(vpaned), 2 * h / 3); | ||
592 | } | ||
593 | |||
594 | |||
595 | /* Menu & Toolbar Callbacks */ | ||
596 | |||
597 | |||
598 | static void | ||
599 | load_filename(GtkFileSelection * file_selector, gpointer user_data) | ||
600 | { | ||
601 | const gchar *fn; | ||
602 | |||
603 | fn = gtk_file_selection_get_filename(GTK_FILE_SELECTION | ||
604 | (user_data)); | ||
605 | |||
606 | if (conf_read(fn)) | ||
607 | text_insert_msg(_("Error"), _("Unable to load configuration !")); | ||
608 | else | ||
609 | display_tree(&rootmenu); | ||
610 | } | ||
611 | |||
612 | void on_load1_activate(GtkMenuItem * menuitem, gpointer user_data) | ||
613 | { | ||
614 | GtkWidget *fs; | ||
615 | |||
616 | fs = gtk_file_selection_new(_("Load file...")); | ||
617 | g_signal_connect(GTK_OBJECT(GTK_FILE_SELECTION(fs)->ok_button), | ||
618 | "clicked", | ||
619 | G_CALLBACK(load_filename), (gpointer) fs); | ||
620 | g_signal_connect_swapped(GTK_OBJECT | ||
621 | (GTK_FILE_SELECTION(fs)->ok_button), | ||
622 | "clicked", G_CALLBACK(gtk_widget_destroy), | ||
623 | (gpointer) fs); | ||
624 | g_signal_connect_swapped(GTK_OBJECT | ||
625 | (GTK_FILE_SELECTION(fs)->cancel_button), | ||
626 | "clicked", G_CALLBACK(gtk_widget_destroy), | ||
627 | (gpointer) fs); | ||
628 | gtk_widget_show(fs); | ||
629 | } | ||
630 | |||
631 | |||
632 | void on_save1_activate(GtkMenuItem * menuitem, gpointer user_data) | ||
633 | { | ||
634 | if (conf_write(NULL)) | ||
635 | text_insert_msg(_("Error"), _("Unable to save configuration !")); | ||
636 | |||
637 | config_changed = FALSE; | ||
638 | } | ||
639 | |||
640 | |||
641 | static void | ||
642 | store_filename(GtkFileSelection * file_selector, gpointer user_data) | ||
643 | { | ||
644 | const gchar *fn; | ||
645 | |||
646 | fn = gtk_file_selection_get_filename(GTK_FILE_SELECTION | ||
647 | (user_data)); | ||
648 | |||
649 | if (conf_write(fn)) | ||
650 | text_insert_msg(_("Error"), _("Unable to save configuration !")); | ||
651 | |||
652 | gtk_widget_destroy(GTK_WIDGET(user_data)); | ||
653 | } | ||
654 | |||
655 | void on_save_as1_activate(GtkMenuItem * menuitem, gpointer user_data) | ||
656 | { | ||
657 | GtkWidget *fs; | ||
658 | |||
659 | fs = gtk_file_selection_new(_("Save file as...")); | ||
660 | g_signal_connect(GTK_OBJECT(GTK_FILE_SELECTION(fs)->ok_button), | ||
661 | "clicked", | ||
662 | G_CALLBACK(store_filename), (gpointer) fs); | ||
663 | g_signal_connect_swapped(GTK_OBJECT | ||
664 | (GTK_FILE_SELECTION(fs)->ok_button), | ||
665 | "clicked", G_CALLBACK(gtk_widget_destroy), | ||
666 | (gpointer) fs); | ||
667 | g_signal_connect_swapped(GTK_OBJECT | ||
668 | (GTK_FILE_SELECTION(fs)->cancel_button), | ||
669 | "clicked", G_CALLBACK(gtk_widget_destroy), | ||
670 | (gpointer) fs); | ||
671 | gtk_widget_show(fs); | ||
672 | } | ||
673 | |||
674 | |||
675 | void on_quit1_activate(GtkMenuItem * menuitem, gpointer user_data) | ||
676 | { | ||
677 | if (!on_window1_delete_event(NULL, NULL, NULL)) | ||
678 | gtk_widget_destroy(GTK_WIDGET(main_wnd)); | ||
679 | } | ||
680 | |||
681 | |||
682 | void on_show_name1_activate(GtkMenuItem * menuitem, gpointer user_data) | ||
683 | { | ||
684 | GtkTreeViewColumn *col; | ||
685 | |||
686 | show_name = GTK_CHECK_MENU_ITEM(menuitem)->active; | ||
687 | col = gtk_tree_view_get_column(GTK_TREE_VIEW(tree2_w), COL_NAME); | ||
688 | if (col) | ||
689 | gtk_tree_view_column_set_visible(col, show_name); | ||
690 | } | ||
691 | |||
692 | |||
693 | void on_show_range1_activate(GtkMenuItem * menuitem, gpointer user_data) | ||
694 | { | ||
695 | GtkTreeViewColumn *col; | ||
696 | |||
697 | show_range = GTK_CHECK_MENU_ITEM(menuitem)->active; | ||
698 | col = gtk_tree_view_get_column(GTK_TREE_VIEW(tree2_w), COL_NO); | ||
699 | if (col) | ||
700 | gtk_tree_view_column_set_visible(col, show_range); | ||
701 | col = gtk_tree_view_get_column(GTK_TREE_VIEW(tree2_w), COL_MOD); | ||
702 | if (col) | ||
703 | gtk_tree_view_column_set_visible(col, show_range); | ||
704 | col = gtk_tree_view_get_column(GTK_TREE_VIEW(tree2_w), COL_YES); | ||
705 | if (col) | ||
706 | gtk_tree_view_column_set_visible(col, show_range); | ||
707 | |||
708 | } | ||
709 | |||
710 | |||
711 | void on_show_data1_activate(GtkMenuItem * menuitem, gpointer user_data) | ||
712 | { | ||
713 | GtkTreeViewColumn *col; | ||
714 | |||
715 | show_value = GTK_CHECK_MENU_ITEM(menuitem)->active; | ||
716 | col = gtk_tree_view_get_column(GTK_TREE_VIEW(tree2_w), COL_VALUE); | ||
717 | if (col) | ||
718 | gtk_tree_view_column_set_visible(col, show_value); | ||
719 | } | ||
720 | |||
721 | |||
722 | void | ||
723 | on_show_all_options1_activate(GtkMenuItem * menuitem, gpointer user_data) | ||
724 | { | ||
725 | show_all = GTK_CHECK_MENU_ITEM(menuitem)->active; | ||
726 | |||
727 | gtk_tree_store_clear(tree2); | ||
728 | display_tree(&rootmenu); // instead of update_tree to speed-up | ||
729 | } | ||
730 | |||
731 | |||
732 | void | ||
733 | on_show_debug_info1_activate(GtkMenuItem * menuitem, gpointer user_data) | ||
734 | { | ||
735 | show_debug = GTK_CHECK_MENU_ITEM(menuitem)->active; | ||
736 | update_tree(&rootmenu, NULL); | ||
737 | } | ||
738 | |||
739 | |||
740 | void on_introduction1_activate(GtkMenuItem * menuitem, gpointer user_data) | ||
741 | { | ||
742 | GtkWidget *dialog; | ||
743 | const gchar *intro_text = _( | ||
744 | "Welcome to gkc, the GTK+ graphical kernel configuration tool\n" | ||
745 | "for Linux.\n" | ||
746 | "For each option, a blank box indicates the feature is disabled, a\n" | ||
747 | "check indicates it is enabled, and a dot indicates that it is to\n" | ||
748 | "be compiled as a module. Clicking on the box will cycle through the three states.\n" | ||
749 | "\n" | ||
750 | "If you do not see an option (e.g., a device driver) that you\n" | ||
751 | "believe should be present, try turning on Show All Options\n" | ||
752 | "under the Options menu.\n" | ||
753 | "Although there is no cross reference yet to help you figure out\n" | ||
754 | "what other options must be enabled to support the option you\n" | ||
755 | "are interested in, you can still view the help of a grayed-out\n" | ||
756 | "option.\n" | ||
757 | "\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."); | ||
760 | |||
761 | dialog = gtk_message_dialog_new(GTK_WINDOW(main_wnd), | ||
762 | GTK_DIALOG_DESTROY_WITH_PARENT, | ||
763 | GTK_MESSAGE_INFO, | ||
764 | GTK_BUTTONS_CLOSE, intro_text); | ||
765 | g_signal_connect_swapped(GTK_OBJECT(dialog), "response", | ||
766 | G_CALLBACK(gtk_widget_destroy), | ||
767 | GTK_OBJECT(dialog)); | ||
768 | gtk_widget_show_all(dialog); | ||
769 | } | ||
770 | |||
771 | |||
772 | void on_about1_activate(GtkMenuItem * menuitem, gpointer user_data) | ||
773 | { | ||
774 | GtkWidget *dialog; | ||
775 | const gchar *about_text = | ||
776 | _("gkc is copyright (c) 2002 Romain Lievin <roms@lpg.ticalc.org>.\n" | ||
777 | "Based on the source code from Roman Zippel.\n"); | ||
778 | |||
779 | dialog = gtk_message_dialog_new(GTK_WINDOW(main_wnd), | ||
780 | GTK_DIALOG_DESTROY_WITH_PARENT, | ||
781 | GTK_MESSAGE_INFO, | ||
782 | GTK_BUTTONS_CLOSE, about_text); | ||
783 | g_signal_connect_swapped(GTK_OBJECT(dialog), "response", | ||
784 | G_CALLBACK(gtk_widget_destroy), | ||
785 | GTK_OBJECT(dialog)); | ||
786 | gtk_widget_show_all(dialog); | ||
787 | } | ||
788 | |||
789 | |||
790 | void on_license1_activate(GtkMenuItem * menuitem, gpointer user_data) | ||
791 | { | ||
792 | GtkWidget *dialog; | ||
793 | const gchar *license_text = | ||
794 | _("gkc is released under the terms of the GNU GPL v2.\n" | ||
795 | "For more information, please see the source code or\n" | ||
796 | "visit http://www.fsf.org/licenses/licenses.html\n"); | ||
797 | |||
798 | dialog = gtk_message_dialog_new(GTK_WINDOW(main_wnd), | ||
799 | GTK_DIALOG_DESTROY_WITH_PARENT, | ||
800 | GTK_MESSAGE_INFO, | ||
801 | GTK_BUTTONS_CLOSE, license_text); | ||
802 | g_signal_connect_swapped(GTK_OBJECT(dialog), "response", | ||
803 | G_CALLBACK(gtk_widget_destroy), | ||
804 | GTK_OBJECT(dialog)); | ||
805 | gtk_widget_show_all(dialog); | ||
806 | } | ||
807 | |||
808 | |||
809 | void on_back_clicked(GtkButton * button, gpointer user_data) | ||
810 | { | ||
811 | enum prop_type ptype; | ||
812 | |||
813 | current = current->parent; | ||
814 | ptype = current->prompt ? current->prompt->type : P_UNKNOWN; | ||
815 | if (ptype != P_MENU) | ||
816 | current = current->parent; | ||
817 | display_tree_part(); | ||
818 | |||
819 | if (current == &rootmenu) | ||
820 | gtk_widget_set_sensitive(back_btn, FALSE); | ||
821 | } | ||
822 | |||
823 | |||
824 | void on_load_clicked(GtkButton * button, gpointer user_data) | ||
825 | { | ||
826 | on_load1_activate(NULL, user_data); | ||
827 | } | ||
828 | |||
829 | |||
830 | void on_save_clicked(GtkButton * button, gpointer user_data) | ||
831 | { | ||
832 | on_save1_activate(NULL, user_data); | ||
833 | } | ||
834 | |||
835 | |||
836 | void on_single_clicked(GtkButton * button, gpointer user_data) | ||
837 | { | ||
838 | view_mode = SINGLE_VIEW; | ||
839 | gtk_paned_set_position(GTK_PANED(hpaned), 0); | ||
840 | gtk_widget_hide(tree1_w); | ||
841 | current = &rootmenu; | ||
842 | display_tree_part(); | ||
843 | } | ||
844 | |||
845 | |||
846 | void on_split_clicked(GtkButton * button, gpointer user_data) | ||
847 | { | ||
848 | gint w, h; | ||
849 | view_mode = SPLIT_VIEW; | ||
850 | gtk_widget_show(tree1_w); | ||
851 | gtk_window_get_default_size(GTK_WINDOW(main_wnd), &w, &h); | ||
852 | gtk_paned_set_position(GTK_PANED(hpaned), w / 2); | ||
853 | if (tree2) | ||
854 | gtk_tree_store_clear(tree2); | ||
855 | display_list(); | ||
856 | |||
857 | /* Disable back btn, like in full mode. */ | ||
858 | gtk_widget_set_sensitive(back_btn, FALSE); | ||
859 | } | ||
860 | |||
861 | |||
862 | void on_full_clicked(GtkButton * button, gpointer user_data) | ||
863 | { | ||
864 | view_mode = FULL_VIEW; | ||
865 | gtk_paned_set_position(GTK_PANED(hpaned), 0); | ||
866 | gtk_widget_hide(tree1_w); | ||
867 | if (tree2) | ||
868 | gtk_tree_store_clear(tree2); | ||
869 | display_tree(&rootmenu); | ||
870 | gtk_widget_set_sensitive(back_btn, FALSE); | ||
871 | } | ||
872 | |||
873 | |||
874 | void on_collapse_clicked(GtkButton * button, gpointer user_data) | ||
875 | { | ||
876 | gtk_tree_view_collapse_all(GTK_TREE_VIEW(tree2_w)); | ||
877 | } | ||
878 | |||
879 | |||
880 | void on_expand_clicked(GtkButton * button, gpointer user_data) | ||
881 | { | ||
882 | gtk_tree_view_expand_all(GTK_TREE_VIEW(tree2_w)); | ||
883 | } | ||
884 | |||
885 | |||
886 | /* CTree Callbacks */ | ||
887 | |||
888 | /* Change hex/int/string value in the cell */ | ||
889 | static void renderer_edited(GtkCellRendererText * cell, | ||
890 | const gchar * path_string, | ||
891 | const gchar * new_text, gpointer user_data) | ||
892 | { | ||
893 | GtkTreePath *path = gtk_tree_path_new_from_string(path_string); | ||
894 | GtkTreeIter iter; | ||
895 | const char *old_def, *new_def; | ||
896 | struct menu *menu; | ||
897 | struct symbol *sym; | ||
898 | |||
899 | if (!gtk_tree_model_get_iter(model2, &iter, path)) | ||
900 | return; | ||
901 | |||
902 | gtk_tree_model_get(model2, &iter, COL_MENU, &menu, -1); | ||
903 | sym = menu->sym; | ||
904 | |||
905 | gtk_tree_model_get(model2, &iter, COL_VALUE, &old_def, -1); | ||
906 | new_def = new_text; | ||
907 | |||
908 | sym_set_string_value(sym, new_def); | ||
909 | |||
910 | config_changed = TRUE; | ||
911 | update_tree(&rootmenu, NULL); | ||
912 | |||
913 | gtk_tree_path_free(path); | ||
914 | } | ||
915 | |||
916 | /* Change the value of a symbol and update the tree */ | ||
917 | static void change_sym_value(struct menu *menu, gint col) | ||
918 | { | ||
919 | struct symbol *sym = menu->sym; | ||
920 | tristate oldval, newval; | ||
921 | |||
922 | if (!sym) | ||
923 | return; | ||
924 | |||
925 | if (col == COL_NO) | ||
926 | newval = no; | ||
927 | else if (col == COL_MOD) | ||
928 | newval = mod; | ||
929 | else if (col == COL_YES) | ||
930 | newval = yes; | ||
931 | else | ||
932 | return; | ||
933 | |||
934 | switch (sym_get_type(sym)) { | ||
935 | case S_BOOLEAN: | ||
936 | case S_TRISTATE: | ||
937 | oldval = sym_get_tristate_value(sym); | ||
938 | if (!sym_tristate_within_range(sym, newval)) | ||
939 | newval = yes; | ||
940 | sym_set_tristate_value(sym, newval); | ||
941 | config_changed = TRUE; | ||
942 | if (view_mode == FULL_VIEW) | ||
943 | update_tree(&rootmenu, NULL); | ||
944 | else if (view_mode == SPLIT_VIEW) { | ||
945 | update_tree(browsed, NULL); | ||
946 | display_list(); | ||
947 | } | ||
948 | else if (view_mode == SINGLE_VIEW) | ||
949 | display_tree_part(); //fixme: keep exp/coll | ||
950 | break; | ||
951 | case S_INT: | ||
952 | case S_HEX: | ||
953 | case S_STRING: | ||
954 | default: | ||
955 | break; | ||
956 | } | ||
957 | } | ||
958 | |||
959 | static void toggle_sym_value(struct menu *menu) | ||
960 | { | ||
961 | if (!menu->sym) | ||
962 | return; | ||
963 | |||
964 | sym_toggle_tristate_value(menu->sym); | ||
965 | if (view_mode == FULL_VIEW) | ||
966 | update_tree(&rootmenu, NULL); | ||
967 | else if (view_mode == SPLIT_VIEW) { | ||
968 | update_tree(browsed, NULL); | ||
969 | display_list(); | ||
970 | } | ||
971 | else if (view_mode == SINGLE_VIEW) | ||
972 | display_tree_part(); //fixme: keep exp/coll | ||
973 | } | ||
974 | |||
975 | static void renderer_toggled(GtkCellRendererToggle * cell, | ||
976 | gchar * path_string, gpointer user_data) | ||
977 | { | ||
978 | GtkTreePath *path, *sel_path = NULL; | ||
979 | GtkTreeIter iter, sel_iter; | ||
980 | GtkTreeSelection *sel; | ||
981 | struct menu *menu; | ||
982 | |||
983 | path = gtk_tree_path_new_from_string(path_string); | ||
984 | if (!gtk_tree_model_get_iter(model2, &iter, path)) | ||
985 | return; | ||
986 | |||
987 | sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(tree2_w)); | ||
988 | if (gtk_tree_selection_get_selected(sel, NULL, &sel_iter)) | ||
989 | sel_path = gtk_tree_model_get_path(model2, &sel_iter); | ||
990 | if (!sel_path) | ||
991 | goto out1; | ||
992 | if (gtk_tree_path_compare(path, sel_path)) | ||
993 | goto out2; | ||
994 | |||
995 | gtk_tree_model_get(model2, &iter, COL_MENU, &menu, -1); | ||
996 | toggle_sym_value(menu); | ||
997 | |||
998 | out2: | ||
999 | gtk_tree_path_free(sel_path); | ||
1000 | out1: | ||
1001 | gtk_tree_path_free(path); | ||
1002 | } | ||
1003 | |||
1004 | static gint column2index(GtkTreeViewColumn * column) | ||
1005 | { | ||
1006 | gint i; | ||
1007 | |||
1008 | for (i = 0; i < COL_NUMBER; i++) { | ||
1009 | GtkTreeViewColumn *col; | ||
1010 | |||
1011 | col = gtk_tree_view_get_column(GTK_TREE_VIEW(tree2_w), i); | ||
1012 | if (col == column) | ||
1013 | return i; | ||
1014 | } | ||
1015 | |||
1016 | return -1; | ||
1017 | } | ||
1018 | |||
1019 | |||
1020 | /* User click: update choice (full) or goes down (single) */ | ||
1021 | gboolean | ||
1022 | on_treeview2_button_press_event(GtkWidget * widget, | ||
1023 | GdkEventButton * event, gpointer user_data) | ||
1024 | { | ||
1025 | GtkTreeView *view = GTK_TREE_VIEW(widget); | ||
1026 | GtkTreePath *path; | ||
1027 | GtkTreeViewColumn *column; | ||
1028 | GtkTreeIter iter; | ||
1029 | struct menu *menu; | ||
1030 | gint col; | ||
1031 | |||
1032 | #if GTK_CHECK_VERSION(2,1,4) // bug in ctree with earlier version of GTK | ||
1033 | gint tx = (gint) event->x; | ||
1034 | gint ty = (gint) event->y; | ||
1035 | gint cx, cy; | ||
1036 | |||
1037 | gtk_tree_view_get_path_at_pos(view, tx, ty, &path, &column, &cx, | ||
1038 | &cy); | ||
1039 | #else | ||
1040 | gtk_tree_view_get_cursor(view, &path, &column); | ||
1041 | #endif | ||
1042 | if (path == NULL) | ||
1043 | return FALSE; | ||
1044 | |||
1045 | if (!gtk_tree_model_get_iter(model2, &iter, path)) | ||
1046 | return FALSE; | ||
1047 | gtk_tree_model_get(model2, &iter, COL_MENU, &menu, -1); | ||
1048 | |||
1049 | col = column2index(column); | ||
1050 | if (event->type == GDK_2BUTTON_PRESS) { | ||
1051 | enum prop_type ptype; | ||
1052 | ptype = menu->prompt ? menu->prompt->type : P_UNKNOWN; | ||
1053 | |||
1054 | if (ptype == P_MENU && view_mode != FULL_VIEW && col == COL_OPTION) { | ||
1055 | // goes down into menu | ||
1056 | current = menu; | ||
1057 | display_tree_part(); | ||
1058 | gtk_widget_set_sensitive(back_btn, TRUE); | ||
1059 | } else if ((col == COL_OPTION)) { | ||
1060 | toggle_sym_value(menu); | ||
1061 | gtk_tree_view_expand_row(view, path, TRUE); | ||
1062 | } | ||
1063 | } else { | ||
1064 | if (col == COL_VALUE) { | ||
1065 | toggle_sym_value(menu); | ||
1066 | gtk_tree_view_expand_row(view, path, TRUE); | ||
1067 | } else if (col == COL_NO || col == COL_MOD | ||
1068 | || col == COL_YES) { | ||
1069 | change_sym_value(menu, col); | ||
1070 | gtk_tree_view_expand_row(view, path, TRUE); | ||
1071 | } | ||
1072 | } | ||
1073 | |||
1074 | return FALSE; | ||
1075 | } | ||
1076 | |||
1077 | /* Key pressed: update choice */ | ||
1078 | gboolean | ||
1079 | on_treeview2_key_press_event(GtkWidget * widget, | ||
1080 | GdkEventKey * event, gpointer user_data) | ||
1081 | { | ||
1082 | GtkTreeView *view = GTK_TREE_VIEW(widget); | ||
1083 | GtkTreePath *path; | ||
1084 | GtkTreeViewColumn *column; | ||
1085 | GtkTreeIter iter; | ||
1086 | struct menu *menu; | ||
1087 | gint col; | ||
1088 | |||
1089 | gtk_tree_view_get_cursor(view, &path, &column); | ||
1090 | if (path == NULL) | ||
1091 | return FALSE; | ||
1092 | |||
1093 | if (event->keyval == GDK_space) { | ||
1094 | if (gtk_tree_view_row_expanded(view, path)) | ||
1095 | gtk_tree_view_collapse_row(view, path); | ||
1096 | else | ||
1097 | gtk_tree_view_expand_row(view, path, FALSE); | ||
1098 | return TRUE; | ||
1099 | } | ||
1100 | if (event->keyval == GDK_KP_Enter) { | ||
1101 | } | ||
1102 | if (widget == tree1_w) | ||
1103 | return FALSE; | ||
1104 | |||
1105 | gtk_tree_model_get_iter(model2, &iter, path); | ||
1106 | gtk_tree_model_get(model2, &iter, COL_MENU, &menu, -1); | ||
1107 | |||
1108 | if (!strcasecmp(event->string, "n")) | ||
1109 | col = COL_NO; | ||
1110 | else if (!strcasecmp(event->string, "m")) | ||
1111 | col = COL_MOD; | ||
1112 | else if (!strcasecmp(event->string, "y")) | ||
1113 | col = COL_YES; | ||
1114 | else | ||
1115 | col = -1; | ||
1116 | change_sym_value(menu, col); | ||
1117 | |||
1118 | return FALSE; | ||
1119 | } | ||
1120 | |||
1121 | |||
1122 | /* Row selection changed: update help */ | ||
1123 | void | ||
1124 | on_treeview2_cursor_changed(GtkTreeView * treeview, gpointer user_data) | ||
1125 | { | ||
1126 | GtkTreeSelection *selection; | ||
1127 | GtkTreeIter iter; | ||
1128 | struct menu *menu; | ||
1129 | |||
1130 | selection = gtk_tree_view_get_selection(treeview); | ||
1131 | if (gtk_tree_selection_get_selected(selection, &model2, &iter)) { | ||
1132 | gtk_tree_model_get(model2, &iter, COL_MENU, &menu, -1); | ||
1133 | text_insert_help(menu); | ||
1134 | } | ||
1135 | } | ||
1136 | |||
1137 | |||
1138 | /* User click: display sub-tree in the right frame. */ | ||
1139 | gboolean | ||
1140 | on_treeview1_button_press_event(GtkWidget * widget, | ||
1141 | GdkEventButton * event, gpointer user_data) | ||
1142 | { | ||
1143 | GtkTreeView *view = GTK_TREE_VIEW(widget); | ||
1144 | GtkTreePath *path; | ||
1145 | GtkTreeViewColumn *column; | ||
1146 | GtkTreeIter iter; | ||
1147 | struct menu *menu; | ||
1148 | |||
1149 | gint tx = (gint) event->x; | ||
1150 | gint ty = (gint) event->y; | ||
1151 | gint cx, cy; | ||
1152 | |||
1153 | gtk_tree_view_get_path_at_pos(view, tx, ty, &path, &column, &cx, | ||
1154 | &cy); | ||
1155 | if (path == NULL) | ||
1156 | return FALSE; | ||
1157 | |||
1158 | gtk_tree_model_get_iter(model1, &iter, path); | ||
1159 | gtk_tree_model_get(model1, &iter, COL_MENU, &menu, -1); | ||
1160 | |||
1161 | if (event->type == GDK_2BUTTON_PRESS) { | ||
1162 | toggle_sym_value(menu); | ||
1163 | current = menu; | ||
1164 | display_tree_part(); | ||
1165 | } else { | ||
1166 | browsed = menu; | ||
1167 | display_tree_part(); | ||
1168 | } | ||
1169 | |||
1170 | gtk_widget_realize(tree2_w); | ||
1171 | gtk_tree_view_set_cursor(view, path, NULL, FALSE); | ||
1172 | gtk_widget_grab_focus(tree2_w); | ||
1173 | |||
1174 | return FALSE; | ||
1175 | } | ||
1176 | |||
1177 | |||
1178 | /* Fill a row of strings */ | ||
1179 | static gchar **fill_row(struct menu *menu) | ||
1180 | { | ||
1181 | static gchar *row[COL_NUMBER]; | ||
1182 | struct symbol *sym = menu->sym; | ||
1183 | const char *def; | ||
1184 | int stype; | ||
1185 | tristate val; | ||
1186 | enum prop_type ptype; | ||
1187 | int i; | ||
1188 | |||
1189 | for (i = COL_OPTION; i <= COL_COLOR; i++) | ||
1190 | g_free(row[i]); | ||
1191 | bzero(row, sizeof(row)); | ||
1192 | |||
1193 | row[COL_OPTION] = | ||
1194 | g_strdup_printf("%s %s", menu_get_prompt(menu), | ||
1195 | sym ? (sym-> | ||
1196 | flags & SYMBOL_NEW ? "(NEW)" : "") : | ||
1197 | ""); | ||
1198 | |||
1199 | if (show_all && !menu_is_visible(menu)) | ||
1200 | row[COL_COLOR] = g_strdup("DarkGray"); | ||
1201 | else | ||
1202 | row[COL_COLOR] = g_strdup("Black"); | ||
1203 | |||
1204 | ptype = menu->prompt ? menu->prompt->type : P_UNKNOWN; | ||
1205 | switch (ptype) { | ||
1206 | case P_MENU: | ||
1207 | row[COL_PIXBUF] = (gchar *) xpm_menu; | ||
1208 | if (view_mode == SINGLE_VIEW) | ||
1209 | row[COL_PIXVIS] = GINT_TO_POINTER(TRUE); | ||
1210 | row[COL_BTNVIS] = GINT_TO_POINTER(FALSE); | ||
1211 | break; | ||
1212 | case P_COMMENT: | ||
1213 | row[COL_PIXBUF] = (gchar *) xpm_void; | ||
1214 | row[COL_PIXVIS] = GINT_TO_POINTER(FALSE); | ||
1215 | row[COL_BTNVIS] = GINT_TO_POINTER(FALSE); | ||
1216 | break; | ||
1217 | default: | ||
1218 | row[COL_PIXBUF] = (gchar *) xpm_void; | ||
1219 | row[COL_PIXVIS] = GINT_TO_POINTER(FALSE); | ||
1220 | row[COL_BTNVIS] = GINT_TO_POINTER(TRUE); | ||
1221 | break; | ||
1222 | } | ||
1223 | |||
1224 | if (!sym) | ||
1225 | return row; | ||
1226 | row[COL_NAME] = g_strdup(sym->name); | ||
1227 | |||
1228 | sym_calc_value(sym); | ||
1229 | sym->flags &= ~SYMBOL_CHANGED; | ||
1230 | |||
1231 | if (sym_is_choice(sym)) { // parse childs for getting final value | ||
1232 | struct menu *child; | ||
1233 | struct symbol *def_sym = sym_get_choice_value(sym); | ||
1234 | struct menu *def_menu = NULL; | ||
1235 | |||
1236 | row[COL_BTNVIS] = GINT_TO_POINTER(FALSE); | ||
1237 | |||
1238 | for (child = menu->list; child; child = child->next) { | ||
1239 | if (menu_is_visible(child) | ||
1240 | && child->sym == def_sym) | ||
1241 | def_menu = child; | ||
1242 | } | ||
1243 | |||
1244 | if (def_menu) | ||
1245 | row[COL_VALUE] = | ||
1246 | g_strdup(menu_get_prompt(def_menu)); | ||
1247 | } | ||
1248 | if (sym->flags & SYMBOL_CHOICEVAL) | ||
1249 | row[COL_BTNRAD] = GINT_TO_POINTER(TRUE); | ||
1250 | |||
1251 | stype = sym_get_type(sym); | ||
1252 | switch (stype) { | ||
1253 | case S_BOOLEAN: | ||
1254 | if (GPOINTER_TO_INT(row[COL_PIXVIS]) == FALSE) | ||
1255 | row[COL_BTNVIS] = GINT_TO_POINTER(TRUE); | ||
1256 | if (sym_is_choice(sym)) | ||
1257 | break; | ||
1258 | case S_TRISTATE: | ||
1259 | val = sym_get_tristate_value(sym); | ||
1260 | switch (val) { | ||
1261 | case no: | ||
1262 | row[COL_NO] = g_strdup("N"); | ||
1263 | row[COL_VALUE] = g_strdup("N"); | ||
1264 | row[COL_BTNACT] = GINT_TO_POINTER(FALSE); | ||
1265 | row[COL_BTNINC] = GINT_TO_POINTER(FALSE); | ||
1266 | break; | ||
1267 | case mod: | ||
1268 | row[COL_MOD] = g_strdup("M"); | ||
1269 | row[COL_VALUE] = g_strdup("M"); | ||
1270 | row[COL_BTNINC] = GINT_TO_POINTER(TRUE); | ||
1271 | break; | ||
1272 | case yes: | ||
1273 | row[COL_YES] = g_strdup("Y"); | ||
1274 | row[COL_VALUE] = g_strdup("Y"); | ||
1275 | row[COL_BTNACT] = GINT_TO_POINTER(TRUE); | ||
1276 | row[COL_BTNINC] = GINT_TO_POINTER(FALSE); | ||
1277 | break; | ||
1278 | } | ||
1279 | |||
1280 | if (val != no && sym_tristate_within_range(sym, no)) | ||
1281 | row[COL_NO] = g_strdup("_"); | ||
1282 | if (val != mod && sym_tristate_within_range(sym, mod)) | ||
1283 | row[COL_MOD] = g_strdup("_"); | ||
1284 | if (val != yes && sym_tristate_within_range(sym, yes)) | ||
1285 | row[COL_YES] = g_strdup("_"); | ||
1286 | break; | ||
1287 | case S_INT: | ||
1288 | case S_HEX: | ||
1289 | case S_STRING: | ||
1290 | def = sym_get_string_value(sym); | ||
1291 | row[COL_VALUE] = g_strdup(def); | ||
1292 | row[COL_EDIT] = GINT_TO_POINTER(TRUE); | ||
1293 | row[COL_BTNVIS] = GINT_TO_POINTER(FALSE); | ||
1294 | break; | ||
1295 | } | ||
1296 | |||
1297 | return row; | ||
1298 | } | ||
1299 | |||
1300 | |||
1301 | /* Set the node content with a row of strings */ | ||
1302 | static void set_node(GtkTreeIter * node, struct menu *menu, gchar ** row) | ||
1303 | { | ||
1304 | GdkColor color; | ||
1305 | gboolean success; | ||
1306 | GdkPixbuf *pix; | ||
1307 | |||
1308 | pix = gdk_pixbuf_new_from_xpm_data((const char **) | ||
1309 | row[COL_PIXBUF]); | ||
1310 | |||
1311 | gdk_color_parse(row[COL_COLOR], &color); | ||
1312 | gdk_colormap_alloc_colors(gdk_colormap_get_system(), &color, 1, | ||
1313 | FALSE, FALSE, &success); | ||
1314 | |||
1315 | gtk_tree_store_set(tree, node, | ||
1316 | COL_OPTION, row[COL_OPTION], | ||
1317 | COL_NAME, row[COL_NAME], | ||
1318 | COL_NO, row[COL_NO], | ||
1319 | COL_MOD, row[COL_MOD], | ||
1320 | COL_YES, row[COL_YES], | ||
1321 | COL_VALUE, row[COL_VALUE], | ||
1322 | COL_MENU, (gpointer) menu, | ||
1323 | COL_COLOR, &color, | ||
1324 | COL_EDIT, GPOINTER_TO_INT(row[COL_EDIT]), | ||
1325 | COL_PIXBUF, pix, | ||
1326 | COL_PIXVIS, GPOINTER_TO_INT(row[COL_PIXVIS]), | ||
1327 | COL_BTNVIS, GPOINTER_TO_INT(row[COL_BTNVIS]), | ||
1328 | COL_BTNACT, GPOINTER_TO_INT(row[COL_BTNACT]), | ||
1329 | COL_BTNINC, GPOINTER_TO_INT(row[COL_BTNINC]), | ||
1330 | COL_BTNRAD, GPOINTER_TO_INT(row[COL_BTNRAD]), | ||
1331 | -1); | ||
1332 | |||
1333 | g_object_unref(pix); | ||
1334 | } | ||
1335 | |||
1336 | |||
1337 | /* Add a node to the tree */ | ||
1338 | static void place_node(struct menu *menu, char **row) | ||
1339 | { | ||
1340 | GtkTreeIter *parent = parents[indent - 1]; | ||
1341 | GtkTreeIter *node = parents[indent]; | ||
1342 | |||
1343 | gtk_tree_store_append(tree, node, parent); | ||
1344 | set_node(node, menu, row); | ||
1345 | } | ||
1346 | |||
1347 | |||
1348 | /* Find a node in the GTK+ tree */ | ||
1349 | static GtkTreeIter found; | ||
1350 | |||
1351 | /* | ||
1352 | * Find a menu in the GtkTree starting at parent. | ||
1353 | */ | ||
1354 | GtkTreeIter *gtktree_iter_find_node(GtkTreeIter * parent, | ||
1355 | struct menu *tofind) | ||
1356 | { | ||
1357 | GtkTreeIter iter; | ||
1358 | GtkTreeIter *child = &iter; | ||
1359 | gboolean valid; | ||
1360 | GtkTreeIter *ret; | ||
1361 | |||
1362 | valid = gtk_tree_model_iter_children(model2, child, parent); | ||
1363 | while (valid) { | ||
1364 | struct menu *menu; | ||
1365 | |||
1366 | gtk_tree_model_get(model2, child, 6, &menu, -1); | ||
1367 | |||
1368 | if (menu == tofind) { | ||
1369 | memcpy(&found, child, sizeof(GtkTreeIter)); | ||
1370 | return &found; | ||
1371 | } | ||
1372 | |||
1373 | ret = gtktree_iter_find_node(child, tofind); | ||
1374 | if (ret) | ||
1375 | return ret; | ||
1376 | |||
1377 | valid = gtk_tree_model_iter_next(model2, child); | ||
1378 | } | ||
1379 | |||
1380 | return NULL; | ||
1381 | } | ||
1382 | |||
1383 | |||
1384 | /* | ||
1385 | * Update the tree by adding/removing entries | ||
1386 | * Does not change other nodes | ||
1387 | */ | ||
1388 | static void update_tree(struct menu *src, GtkTreeIter * dst) | ||
1389 | { | ||
1390 | struct menu *child1; | ||
1391 | GtkTreeIter iter, tmp; | ||
1392 | GtkTreeIter *child2 = &iter; | ||
1393 | gboolean valid; | ||
1394 | GtkTreeIter *sibling; | ||
1395 | struct symbol *sym; | ||
1396 | struct property *prop; | ||
1397 | struct menu *menu1, *menu2; | ||
1398 | |||
1399 | if (src == &rootmenu) | ||
1400 | indent = 1; | ||
1401 | |||
1402 | valid = gtk_tree_model_iter_children(model2, child2, dst); | ||
1403 | for (child1 = src->list; child1; child1 = child1->next) { | ||
1404 | |||
1405 | prop = child1->prompt; | ||
1406 | sym = child1->sym; | ||
1407 | |||
1408 | reparse: | ||
1409 | menu1 = child1; | ||
1410 | if (valid) | ||
1411 | gtk_tree_model_get(model2, child2, COL_MENU, | ||
1412 | &menu2, -1); | ||
1413 | else | ||
1414 | menu2 = NULL; // force adding of a first child | ||
1415 | |||
1416 | #ifdef DEBUG | ||
1417 | printf("%*c%s | %s\n", indent, ' ', | ||
1418 | menu1 ? menu_get_prompt(menu1) : "nil", | ||
1419 | menu2 ? menu_get_prompt(menu2) : "nil"); | ||
1420 | #endif | ||
1421 | |||
1422 | if (!menu_is_visible(child1) && !show_all) { // remove node | ||
1423 | if (gtktree_iter_find_node(dst, menu1) != NULL) { | ||
1424 | memcpy(&tmp, child2, sizeof(GtkTreeIter)); | ||
1425 | valid = gtk_tree_model_iter_next(model2, | ||
1426 | child2); | ||
1427 | gtk_tree_store_remove(tree2, &tmp); | ||
1428 | if (!valid) | ||
1429 | return; // next parent | ||
1430 | else | ||
1431 | goto reparse; // next child | ||
1432 | } else | ||
1433 | continue; | ||
1434 | } | ||
1435 | |||
1436 | if (menu1 != menu2) { | ||
1437 | if (gtktree_iter_find_node(dst, menu1) == NULL) { // add node | ||
1438 | if (!valid && !menu2) | ||
1439 | sibling = NULL; | ||
1440 | else | ||
1441 | sibling = child2; | ||
1442 | gtk_tree_store_insert_before(tree2, | ||
1443 | child2, | ||
1444 | dst, sibling); | ||
1445 | set_node(child2, menu1, fill_row(menu1)); | ||
1446 | if (menu2 == NULL) | ||
1447 | valid = TRUE; | ||
1448 | } else { // remove node | ||
1449 | memcpy(&tmp, child2, sizeof(GtkTreeIter)); | ||
1450 | valid = gtk_tree_model_iter_next(model2, | ||
1451 | child2); | ||
1452 | gtk_tree_store_remove(tree2, &tmp); | ||
1453 | if (!valid) | ||
1454 | return; // next parent | ||
1455 | else | ||
1456 | goto reparse; // next child | ||
1457 | } | ||
1458 | } else if (sym && (sym->flags & SYMBOL_CHANGED)) { | ||
1459 | set_node(child2, menu1, fill_row(menu1)); | ||
1460 | } | ||
1461 | |||
1462 | indent++; | ||
1463 | update_tree(child1, child2); | ||
1464 | indent--; | ||
1465 | |||
1466 | valid = gtk_tree_model_iter_next(model2, child2); | ||
1467 | } | ||
1468 | } | ||
1469 | |||
1470 | |||
1471 | /* Display the whole tree (single/split/full view) */ | ||
1472 | static void display_tree(struct menu *menu) | ||
1473 | { | ||
1474 | struct symbol *sym; | ||
1475 | struct property *prop; | ||
1476 | struct menu *child; | ||
1477 | enum prop_type ptype; | ||
1478 | |||
1479 | if (menu == &rootmenu) { | ||
1480 | indent = 1; | ||
1481 | current = &rootmenu; | ||
1482 | } | ||
1483 | |||
1484 | for (child = menu->list; child; child = child->next) { | ||
1485 | prop = child->prompt; | ||
1486 | sym = child->sym; | ||
1487 | ptype = prop ? prop->type : P_UNKNOWN; | ||
1488 | |||
1489 | if (sym) | ||
1490 | sym->flags &= ~SYMBOL_CHANGED; | ||
1491 | |||
1492 | if ((view_mode == SPLIT_VIEW) | ||
1493 | && !(child->flags & MENU_ROOT) && (tree == tree1)) | ||
1494 | continue; | ||
1495 | |||
1496 | if ((view_mode == SPLIT_VIEW) && (child->flags & MENU_ROOT) | ||
1497 | && (tree == tree2)) | ||
1498 | continue; | ||
1499 | |||
1500 | if (menu_is_visible(child) || show_all) | ||
1501 | place_node(child, fill_row(child)); | ||
1502 | #ifdef DEBUG | ||
1503 | printf("%*c%s: ", indent, ' ', menu_get_prompt(child)); | ||
1504 | printf("%s", child->flags & MENU_ROOT ? "rootmenu | " : ""); | ||
1505 | dbg_print_ptype(ptype); | ||
1506 | printf(" | "); | ||
1507 | if (sym) { | ||
1508 | dbg_print_stype(sym->type); | ||
1509 | printf(" | "); | ||
1510 | dbg_print_flags(sym->flags); | ||
1511 | printf("\n"); | ||
1512 | } else | ||
1513 | printf("\n"); | ||
1514 | #endif | ||
1515 | if ((view_mode != FULL_VIEW) && (ptype == P_MENU) | ||
1516 | && (tree == tree2)) | ||
1517 | continue; | ||
1518 | /* | ||
1519 | if (((menu != &rootmenu) && !(menu->flags & MENU_ROOT)) | ||
1520 | || (view_mode == FULL_VIEW) | ||
1521 | || (view_mode == SPLIT_VIEW))*/ | ||
1522 | if (((view_mode == SINGLE_VIEW) && (menu->flags & MENU_ROOT)) | ||
1523 | || (view_mode == FULL_VIEW) | ||
1524 | || (view_mode == SPLIT_VIEW)) { | ||
1525 | indent++; | ||
1526 | display_tree(child); | ||
1527 | indent--; | ||
1528 | } | ||
1529 | } | ||
1530 | } | ||
1531 | |||
1532 | /* Display a part of the tree starting at current node (single/split view) */ | ||
1533 | static void display_tree_part(void) | ||
1534 | { | ||
1535 | if (tree2) | ||
1536 | gtk_tree_store_clear(tree2); | ||
1537 | if (view_mode == SINGLE_VIEW) | ||
1538 | display_tree(current); | ||
1539 | else if (view_mode == SPLIT_VIEW) | ||
1540 | display_tree(browsed); | ||
1541 | gtk_tree_view_expand_all(GTK_TREE_VIEW(tree2_w)); | ||
1542 | } | ||
1543 | |||
1544 | /* Display the list in the left frame (split view) */ | ||
1545 | static void display_list(void) | ||
1546 | { | ||
1547 | if (tree1) | ||
1548 | gtk_tree_store_clear(tree1); | ||
1549 | |||
1550 | tree = tree1; | ||
1551 | display_tree(&rootmenu); | ||
1552 | gtk_tree_view_expand_all(GTK_TREE_VIEW(tree1_w)); | ||
1553 | tree = tree2; | ||
1554 | } | ||
1555 | |||
1556 | void fixup_rootmenu(struct menu *menu) | ||
1557 | { | ||
1558 | struct menu *child; | ||
1559 | static int menu_cnt = 0; | ||
1560 | |||
1561 | menu->flags |= MENU_ROOT; | ||
1562 | for (child = menu->list; child; child = child->next) { | ||
1563 | if (child->prompt && child->prompt->type == P_MENU) { | ||
1564 | menu_cnt++; | ||
1565 | fixup_rootmenu(child); | ||
1566 | menu_cnt--; | ||
1567 | } else if (!menu_cnt) | ||
1568 | fixup_rootmenu(child); | ||
1569 | } | ||
1570 | } | ||
1571 | |||
1572 | |||
1573 | /* Main */ | ||
1574 | int main(int ac, char *av[]) | ||
1575 | { | ||
1576 | const char *name; | ||
1577 | char *env; | ||
1578 | gchar *glade_file; | ||
1579 | |||
1580 | #ifndef LKC_DIRECT_LINK | ||
1581 | kconfig_load(); | ||
1582 | #endif | ||
1583 | |||
1584 | bindtextdomain(PACKAGE, LOCALEDIR); | ||
1585 | bind_textdomain_codeset(PACKAGE, "UTF-8"); | ||
1586 | textdomain(PACKAGE); | ||
1587 | |||
1588 | /* GTK stuffs */ | ||
1589 | gtk_set_locale(); | ||
1590 | gtk_init(&ac, &av); | ||
1591 | glade_init(); | ||
1592 | |||
1593 | //add_pixmap_directory (PACKAGE_DATA_DIR "/" PACKAGE "/pixmaps"); | ||
1594 | //add_pixmap_directory (PACKAGE_SOURCE_DIR "/pixmaps"); | ||
1595 | |||
1596 | /* Determine GUI path */ | ||
1597 | env = getenv(SRCTREE); | ||
1598 | if (env) | ||
1599 | glade_file = g_strconcat(env, "/scripts/kconfig/gconf.glade", NULL); | ||
1600 | else if (av[0][0] == '/') | ||
1601 | glade_file = g_strconcat(av[0], ".glade", NULL); | ||
1602 | else | ||
1603 | glade_file = g_strconcat(g_get_current_dir(), "/", av[0], ".glade", NULL); | ||
1604 | |||
1605 | /* Load the interface and connect signals */ | ||
1606 | init_main_window(glade_file); | ||
1607 | init_tree_model(); | ||
1608 | init_left_tree(); | ||
1609 | init_right_tree(); | ||
1610 | |||
1611 | /* Conf stuffs */ | ||
1612 | if (ac > 1 && av[1][0] == '-') { | ||
1613 | switch (av[1][1]) { | ||
1614 | case 'a': | ||
1615 | //showAll = 1; | ||
1616 | break; | ||
1617 | case 'h': | ||
1618 | case '?': | ||
1619 | printf("%s <config>\n", av[0]); | ||
1620 | exit(0); | ||
1621 | } | ||
1622 | name = av[2]; | ||
1623 | } else | ||
1624 | name = av[1]; | ||
1625 | |||
1626 | conf_parse(name); | ||
1627 | fixup_rootmenu(&rootmenu); | ||
1628 | conf_read(NULL); | ||
1629 | |||
1630 | switch (view_mode) { | ||
1631 | case SINGLE_VIEW: | ||
1632 | display_tree_part(); | ||
1633 | break; | ||
1634 | case SPLIT_VIEW: | ||
1635 | display_list(); | ||
1636 | break; | ||
1637 | case FULL_VIEW: | ||
1638 | display_tree(&rootmenu); | ||
1639 | break; | ||
1640 | } | ||
1641 | |||
1642 | gtk_main(); | ||
1643 | |||
1644 | return 0; | ||
1645 | } | ||
diff --git a/scripts/kconfig/gconf.glade b/scripts/kconfig/gconf.glade new file mode 100644 index 000000000..f8744ed64 --- /dev/null +++ b/scripts/kconfig/gconf.glade | |||
@@ -0,0 +1,648 @@ | |||
1 | <?xml version="1.0" standalone="no"?> <!--*- mode: xml -*--> | ||
2 | <!DOCTYPE glade-interface SYSTEM "http://glade.gnome.org/glade-2.0.dtd"> | ||
3 | |||
4 | <glade-interface> | ||
5 | |||
6 | <widget class="GtkWindow" id="window1"> | ||
7 | <property name="visible">True</property> | ||
8 | <property name="title" translatable="yes">Gtk Kernel Configurator</property> | ||
9 | <property name="type">GTK_WINDOW_TOPLEVEL</property> | ||
10 | <property name="window_position">GTK_WIN_POS_NONE</property> | ||
11 | <property name="modal">False</property> | ||
12 | <property name="default_width">640</property> | ||
13 | <property name="default_height">480</property> | ||
14 | <property name="resizable">True</property> | ||
15 | <property name="destroy_with_parent">False</property> | ||
16 | <property name="decorated">True</property> | ||
17 | <property name="skip_taskbar_hint">False</property> | ||
18 | <property name="skip_pager_hint">False</property> | ||
19 | <property name="type_hint">GDK_WINDOW_TYPE_HINT_NORMAL</property> | ||
20 | <property name="gravity">GDK_GRAVITY_NORTH_WEST</property> | ||
21 | <signal name="destroy" handler="on_window1_destroy" object="window1"/> | ||
22 | <signal name="size_request" handler="on_window1_size_request" object="vpaned1" last_modification_time="Fri, 11 Jan 2002 16:17:11 GMT"/> | ||
23 | <signal name="delete_event" handler="on_window1_delete_event" object="window1" last_modification_time="Sun, 09 Mar 2003 19:42:46 GMT"/> | ||
24 | |||
25 | <child> | ||
26 | <widget class="GtkVBox" id="vbox1"> | ||
27 | <property name="visible">True</property> | ||
28 | <property name="homogeneous">False</property> | ||
29 | <property name="spacing">0</property> | ||
30 | |||
31 | <child> | ||
32 | <widget class="GtkMenuBar" id="menubar1"> | ||
33 | <property name="visible">True</property> | ||
34 | |||
35 | <child> | ||
36 | <widget class="GtkMenuItem" id="file1"> | ||
37 | <property name="visible">True</property> | ||
38 | <property name="label" translatable="yes">_File</property> | ||
39 | <property name="use_underline">True</property> | ||
40 | |||
41 | <child> | ||
42 | <widget class="GtkMenu" id="file1_menu"> | ||
43 | |||
44 | <child> | ||
45 | <widget class="GtkImageMenuItem" id="load1"> | ||
46 | <property name="visible">True</property> | ||
47 | <property name="tooltip" translatable="yes">Load a config file</property> | ||
48 | <property name="label" translatable="yes">_Load</property> | ||
49 | <property name="use_underline">True</property> | ||
50 | <signal name="activate" handler="on_load1_activate"/> | ||
51 | <accelerator key="L" modifiers="GDK_CONTROL_MASK" signal="activate"/> | ||
52 | |||
53 | <child internal-child="image"> | ||
54 | <widget class="GtkImage" id="image39"> | ||
55 | <property name="visible">True</property> | ||
56 | <property name="stock">gtk-open</property> | ||
57 | <property name="icon_size">1</property> | ||
58 | <property name="xalign">0.5</property> | ||
59 | <property name="yalign">0.5</property> | ||
60 | <property name="xpad">0</property> | ||
61 | <property name="ypad">0</property> | ||
62 | </widget> | ||
63 | </child> | ||
64 | </widget> | ||
65 | </child> | ||
66 | |||
67 | <child> | ||
68 | <widget class="GtkImageMenuItem" id="save1"> | ||
69 | <property name="visible">True</property> | ||
70 | <property name="tooltip" translatable="yes">Save the config in .config</property> | ||
71 | <property name="label" translatable="yes">_Save</property> | ||
72 | <property name="use_underline">True</property> | ||
73 | <signal name="activate" handler="on_save1_activate"/> | ||
74 | <accelerator key="S" modifiers="GDK_CONTROL_MASK" signal="activate"/> | ||
75 | |||
76 | <child internal-child="image"> | ||
77 | <widget class="GtkImage" id="image40"> | ||
78 | <property name="visible">True</property> | ||
79 | <property name="stock">gtk-save</property> | ||
80 | <property name="icon_size">1</property> | ||
81 | <property name="xalign">0.5</property> | ||
82 | <property name="yalign">0.5</property> | ||
83 | <property name="xpad">0</property> | ||
84 | <property name="ypad">0</property> | ||
85 | </widget> | ||
86 | </child> | ||
87 | </widget> | ||
88 | </child> | ||
89 | |||
90 | <child> | ||
91 | <widget class="GtkImageMenuItem" id="save_as1"> | ||
92 | <property name="visible">True</property> | ||
93 | <property name="tooltip" translatable="yes">Save the config in a file</property> | ||
94 | <property name="label" translatable="yes">Save _as</property> | ||
95 | <property name="use_underline">True</property> | ||
96 | <signal name="activate" handler="on_save_as1_activate"/> | ||
97 | |||
98 | <child internal-child="image"> | ||
99 | <widget class="GtkImage" id="image41"> | ||
100 | <property name="visible">True</property> | ||
101 | <property name="stock">gtk-save-as</property> | ||
102 | <property name="icon_size">1</property> | ||
103 | <property name="xalign">0.5</property> | ||
104 | <property name="yalign">0.5</property> | ||
105 | <property name="xpad">0</property> | ||
106 | <property name="ypad">0</property> | ||
107 | </widget> | ||
108 | </child> | ||
109 | </widget> | ||
110 | </child> | ||
111 | |||
112 | <child> | ||
113 | <widget class="GtkSeparatorMenuItem" id="separator1"> | ||
114 | <property name="visible">True</property> | ||
115 | </widget> | ||
116 | </child> | ||
117 | |||
118 | <child> | ||
119 | <widget class="GtkImageMenuItem" id="quit1"> | ||
120 | <property name="visible">True</property> | ||
121 | <property name="label" translatable="yes">_Quit</property> | ||
122 | <property name="use_underline">True</property> | ||
123 | <signal name="activate" handler="on_quit1_activate"/> | ||
124 | <accelerator key="Q" modifiers="GDK_CONTROL_MASK" signal="activate"/> | ||
125 | |||
126 | <child internal-child="image"> | ||
127 | <widget class="GtkImage" id="image42"> | ||
128 | <property name="visible">True</property> | ||
129 | <property name="stock">gtk-quit</property> | ||
130 | <property name="icon_size">1</property> | ||
131 | <property name="xalign">0.5</property> | ||
132 | <property name="yalign">0.5</property> | ||
133 | <property name="xpad">0</property> | ||
134 | <property name="ypad">0</property> | ||
135 | </widget> | ||
136 | </child> | ||
137 | </widget> | ||
138 | </child> | ||
139 | </widget> | ||
140 | </child> | ||
141 | </widget> | ||
142 | </child> | ||
143 | |||
144 | <child> | ||
145 | <widget class="GtkMenuItem" id="options1"> | ||
146 | <property name="visible">True</property> | ||
147 | <property name="label" translatable="yes">_Options</property> | ||
148 | <property name="use_underline">True</property> | ||
149 | |||
150 | <child> | ||
151 | <widget class="GtkMenu" id="options1_menu"> | ||
152 | |||
153 | <child> | ||
154 | <widget class="GtkCheckMenuItem" id="show_name1"> | ||
155 | <property name="visible">True</property> | ||
156 | <property name="tooltip" translatable="yes">Show name</property> | ||
157 | <property name="label" translatable="yes">Show _name</property> | ||
158 | <property name="use_underline">True</property> | ||
159 | <property name="active">False</property> | ||
160 | <signal name="activate" handler="on_show_name1_activate"/> | ||
161 | </widget> | ||
162 | </child> | ||
163 | |||
164 | <child> | ||
165 | <widget class="GtkCheckMenuItem" id="show_range1"> | ||
166 | <property name="visible">True</property> | ||
167 | <property name="tooltip" translatable="yes">Show range (Y/M/N)</property> | ||
168 | <property name="label" translatable="yes">Show _range</property> | ||
169 | <property name="use_underline">True</property> | ||
170 | <property name="active">False</property> | ||
171 | <signal name="activate" handler="on_show_range1_activate"/> | ||
172 | </widget> | ||
173 | </child> | ||
174 | |||
175 | <child> | ||
176 | <widget class="GtkCheckMenuItem" id="show_data1"> | ||
177 | <property name="visible">True</property> | ||
178 | <property name="tooltip" translatable="yes">Show value of the option</property> | ||
179 | <property name="label" translatable="yes">Show _data</property> | ||
180 | <property name="use_underline">True</property> | ||
181 | <property name="active">False</property> | ||
182 | <signal name="activate" handler="on_show_data1_activate"/> | ||
183 | </widget> | ||
184 | </child> | ||
185 | |||
186 | <child> | ||
187 | <widget class="GtkSeparatorMenuItem" id="separator2"> | ||
188 | <property name="visible">True</property> | ||
189 | </widget> | ||
190 | </child> | ||
191 | |||
192 | <child> | ||
193 | <widget class="GtkCheckMenuItem" id="show_all_options1"> | ||
194 | <property name="visible">True</property> | ||
195 | <property name="tooltip" translatable="yes">Show all options</property> | ||
196 | <property name="label" translatable="yes">Show all _options</property> | ||
197 | <property name="use_underline">True</property> | ||
198 | <property name="active">False</property> | ||
199 | <signal name="activate" handler="on_show_all_options1_activate"/> | ||
200 | </widget> | ||
201 | </child> | ||
202 | |||
203 | <child> | ||
204 | <widget class="GtkCheckMenuItem" id="show_debug_info1"> | ||
205 | <property name="visible">True</property> | ||
206 | <property name="tooltip" translatable="yes">Show masked options</property> | ||
207 | <property name="label" translatable="yes">Show _debug info</property> | ||
208 | <property name="use_underline">True</property> | ||
209 | <property name="active">False</property> | ||
210 | <signal name="activate" handler="on_show_debug_info1_activate"/> | ||
211 | </widget> | ||
212 | </child> | ||
213 | </widget> | ||
214 | </child> | ||
215 | </widget> | ||
216 | </child> | ||
217 | |||
218 | <child> | ||
219 | <widget class="GtkMenuItem" id="help1"> | ||
220 | <property name="visible">True</property> | ||
221 | <property name="label" translatable="yes">_Help</property> | ||
222 | <property name="use_underline">True</property> | ||
223 | |||
224 | <child> | ||
225 | <widget class="GtkMenu" id="help1_menu"> | ||
226 | |||
227 | <child> | ||
228 | <widget class="GtkImageMenuItem" id="introduction1"> | ||
229 | <property name="visible">True</property> | ||
230 | <property name="label" translatable="yes">_Introduction</property> | ||
231 | <property name="use_underline">True</property> | ||
232 | <signal name="activate" handler="on_introduction1_activate" last_modification_time="Fri, 15 Nov 2002 20:26:30 GMT"/> | ||
233 | <accelerator key="I" modifiers="GDK_CONTROL_MASK" signal="activate"/> | ||
234 | |||
235 | <child internal-child="image"> | ||
236 | <widget class="GtkImage" id="image43"> | ||
237 | <property name="visible">True</property> | ||
238 | <property name="stock">gtk-dialog-question</property> | ||
239 | <property name="icon_size">1</property> | ||
240 | <property name="xalign">0.5</property> | ||
241 | <property name="yalign">0.5</property> | ||
242 | <property name="xpad">0</property> | ||
243 | <property name="ypad">0</property> | ||
244 | </widget> | ||
245 | </child> | ||
246 | </widget> | ||
247 | </child> | ||
248 | |||
249 | <child> | ||
250 | <widget class="GtkImageMenuItem" id="about1"> | ||
251 | <property name="visible">True</property> | ||
252 | <property name="label" translatable="yes">_About</property> | ||
253 | <property name="use_underline">True</property> | ||
254 | <signal name="activate" handler="on_about1_activate" last_modification_time="Fri, 15 Nov 2002 20:26:30 GMT"/> | ||
255 | <accelerator key="A" modifiers="GDK_CONTROL_MASK" signal="activate"/> | ||
256 | |||
257 | <child internal-child="image"> | ||
258 | <widget class="GtkImage" id="image44"> | ||
259 | <property name="visible">True</property> | ||
260 | <property name="stock">gtk-properties</property> | ||
261 | <property name="icon_size">1</property> | ||
262 | <property name="xalign">0.5</property> | ||
263 | <property name="yalign">0.5</property> | ||
264 | <property name="xpad">0</property> | ||
265 | <property name="ypad">0</property> | ||
266 | </widget> | ||
267 | </child> | ||
268 | </widget> | ||
269 | </child> | ||
270 | |||
271 | <child> | ||
272 | <widget class="GtkImageMenuItem" id="license1"> | ||
273 | <property name="visible">True</property> | ||
274 | <property name="label" translatable="yes">_License</property> | ||
275 | <property name="use_underline">True</property> | ||
276 | <signal name="activate" handler="on_license1_activate" last_modification_time="Fri, 15 Nov 2002 20:26:30 GMT"/> | ||
277 | |||
278 | <child internal-child="image"> | ||
279 | <widget class="GtkImage" id="image45"> | ||
280 | <property name="visible">True</property> | ||
281 | <property name="stock">gtk-justify-fill</property> | ||
282 | <property name="icon_size">1</property> | ||
283 | <property name="xalign">0.5</property> | ||
284 | <property name="yalign">0.5</property> | ||
285 | <property name="xpad">0</property> | ||
286 | <property name="ypad">0</property> | ||
287 | </widget> | ||
288 | </child> | ||
289 | </widget> | ||
290 | </child> | ||
291 | </widget> | ||
292 | </child> | ||
293 | </widget> | ||
294 | </child> | ||
295 | </widget> | ||
296 | <packing> | ||
297 | <property name="padding">0</property> | ||
298 | <property name="expand">False</property> | ||
299 | <property name="fill">False</property> | ||
300 | </packing> | ||
301 | </child> | ||
302 | |||
303 | <child> | ||
304 | <widget class="GtkHandleBox" id="handlebox1"> | ||
305 | <property name="visible">True</property> | ||
306 | <property name="shadow_type">GTK_SHADOW_OUT</property> | ||
307 | <property name="handle_position">GTK_POS_LEFT</property> | ||
308 | <property name="snap_edge">GTK_POS_TOP</property> | ||
309 | |||
310 | <child> | ||
311 | <widget class="GtkToolbar" id="toolbar1"> | ||
312 | <property name="visible">True</property> | ||
313 | <property name="orientation">GTK_ORIENTATION_HORIZONTAL</property> | ||
314 | <property name="toolbar_style">GTK_TOOLBAR_BOTH</property> | ||
315 | <property name="tooltips">True</property> | ||
316 | <property name="show_arrow">True</property> | ||
317 | |||
318 | <child> | ||
319 | <widget class="GtkToolButton" id="button1"> | ||
320 | <property name="visible">True</property> | ||
321 | <property name="tooltip" translatable="yes">Goes up of one level (single view)</property> | ||
322 | <property name="label" translatable="yes">Back</property> | ||
323 | <property name="use_underline">True</property> | ||
324 | <property name="stock_id">gtk-undo</property> | ||
325 | <property name="visible_horizontal">True</property> | ||
326 | <property name="visible_vertical">True</property> | ||
327 | <property name="is_important">False</property> | ||
328 | <signal name="clicked" handler="on_back_clicked"/> | ||
329 | </widget> | ||
330 | <packing> | ||
331 | <property name="expand">False</property> | ||
332 | <property name="homogeneous">True</property> | ||
333 | </packing> | ||
334 | </child> | ||
335 | |||
336 | <child> | ||
337 | <widget class="GtkToolItem" id="toolitem1"> | ||
338 | <property name="visible">True</property> | ||
339 | <property name="visible_horizontal">True</property> | ||
340 | <property name="visible_vertical">True</property> | ||
341 | <property name="is_important">False</property> | ||
342 | |||
343 | <child> | ||
344 | <widget class="GtkVSeparator" id="vseparator1"> | ||
345 | <property name="visible">True</property> | ||
346 | </widget> | ||
347 | </child> | ||
348 | </widget> | ||
349 | <packing> | ||
350 | <property name="expand">False</property> | ||
351 | <property name="homogeneous">False</property> | ||
352 | </packing> | ||
353 | </child> | ||
354 | |||
355 | <child> | ||
356 | <widget class="GtkToolButton" id="button2"> | ||
357 | <property name="visible">True</property> | ||
358 | <property name="tooltip" translatable="yes">Load a config file</property> | ||
359 | <property name="label" translatable="yes">Load</property> | ||
360 | <property name="use_underline">True</property> | ||
361 | <property name="stock_id">gtk-open</property> | ||
362 | <property name="visible_horizontal">True</property> | ||
363 | <property name="visible_vertical">True</property> | ||
364 | <property name="is_important">False</property> | ||
365 | <signal name="clicked" handler="on_load_clicked"/> | ||
366 | </widget> | ||
367 | <packing> | ||
368 | <property name="expand">False</property> | ||
369 | <property name="homogeneous">True</property> | ||
370 | </packing> | ||
371 | </child> | ||
372 | |||
373 | <child> | ||
374 | <widget class="GtkToolButton" id="button3"> | ||
375 | <property name="visible">True</property> | ||
376 | <property name="tooltip" translatable="yes">Save a config file</property> | ||
377 | <property name="label" translatable="yes">Save</property> | ||
378 | <property name="use_underline">True</property> | ||
379 | <property name="stock_id">gtk-save</property> | ||
380 | <property name="visible_horizontal">True</property> | ||
381 | <property name="visible_vertical">True</property> | ||
382 | <property name="is_important">False</property> | ||
383 | <signal name="clicked" handler="on_save_clicked"/> | ||
384 | </widget> | ||
385 | <packing> | ||
386 | <property name="expand">False</property> | ||
387 | <property name="homogeneous">True</property> | ||
388 | </packing> | ||
389 | </child> | ||
390 | |||
391 | <child> | ||
392 | <widget class="GtkToolItem" id="toolitem2"> | ||
393 | <property name="visible">True</property> | ||
394 | <property name="visible_horizontal">True</property> | ||
395 | <property name="visible_vertical">True</property> | ||
396 | <property name="is_important">False</property> | ||
397 | |||
398 | <child> | ||
399 | <widget class="GtkVSeparator" id="vseparator2"> | ||
400 | <property name="visible">True</property> | ||
401 | </widget> | ||
402 | </child> | ||
403 | </widget> | ||
404 | <packing> | ||
405 | <property name="expand">False</property> | ||
406 | <property name="homogeneous">False</property> | ||
407 | </packing> | ||
408 | </child> | ||
409 | |||
410 | <child> | ||
411 | <widget class="GtkToolButton" id="button4"> | ||
412 | <property name="visible">True</property> | ||
413 | <property name="tooltip" translatable="yes">Single view</property> | ||
414 | <property name="label" translatable="yes">Single</property> | ||
415 | <property name="use_underline">True</property> | ||
416 | <property name="stock_id">gtk-missing-image</property> | ||
417 | <property name="visible_horizontal">True</property> | ||
418 | <property name="visible_vertical">True</property> | ||
419 | <property name="is_important">False</property> | ||
420 | <signal name="clicked" handler="on_single_clicked" last_modification_time="Sun, 12 Jan 2003 14:28:39 GMT"/> | ||
421 | </widget> | ||
422 | <packing> | ||
423 | <property name="expand">False</property> | ||
424 | <property name="homogeneous">True</property> | ||
425 | </packing> | ||
426 | </child> | ||
427 | |||
428 | <child> | ||
429 | <widget class="GtkToolButton" id="button5"> | ||
430 | <property name="visible">True</property> | ||
431 | <property name="tooltip" translatable="yes">Split view</property> | ||
432 | <property name="label" translatable="yes">Split</property> | ||
433 | <property name="use_underline">True</property> | ||
434 | <property name="stock_id">gtk-missing-image</property> | ||
435 | <property name="visible_horizontal">True</property> | ||
436 | <property name="visible_vertical">True</property> | ||
437 | <property name="is_important">False</property> | ||
438 | <signal name="clicked" handler="on_split_clicked" last_modification_time="Sun, 12 Jan 2003 14:28:45 GMT"/> | ||
439 | </widget> | ||
440 | <packing> | ||
441 | <property name="expand">False</property> | ||
442 | <property name="homogeneous">True</property> | ||
443 | </packing> | ||
444 | </child> | ||
445 | |||
446 | <child> | ||
447 | <widget class="GtkToolButton" id="button6"> | ||
448 | <property name="visible">True</property> | ||
449 | <property name="tooltip" translatable="yes">Full view</property> | ||
450 | <property name="label" translatable="yes">Full</property> | ||
451 | <property name="use_underline">True</property> | ||
452 | <property name="stock_id">gtk-missing-image</property> | ||
453 | <property name="visible_horizontal">True</property> | ||
454 | <property name="visible_vertical">True</property> | ||
455 | <property name="is_important">False</property> | ||
456 | <signal name="clicked" handler="on_full_clicked" last_modification_time="Sun, 12 Jan 2003 14:28:50 GMT"/> | ||
457 | </widget> | ||
458 | <packing> | ||
459 | <property name="expand">False</property> | ||
460 | <property name="homogeneous">True</property> | ||
461 | </packing> | ||
462 | </child> | ||
463 | |||
464 | <child> | ||
465 | <widget class="GtkToolItem" id="toolitem3"> | ||
466 | <property name="visible">True</property> | ||
467 | <property name="visible_horizontal">True</property> | ||
468 | <property name="visible_vertical">True</property> | ||
469 | <property name="is_important">False</property> | ||
470 | |||
471 | <child> | ||
472 | <widget class="GtkVSeparator" id="vseparator3"> | ||
473 | <property name="visible">True</property> | ||
474 | </widget> | ||
475 | </child> | ||
476 | </widget> | ||
477 | <packing> | ||
478 | <property name="expand">False</property> | ||
479 | <property name="homogeneous">False</property> | ||
480 | </packing> | ||
481 | </child> | ||
482 | |||
483 | <child> | ||
484 | <widget class="GtkToolButton" id="button7"> | ||
485 | <property name="visible">True</property> | ||
486 | <property name="tooltip" translatable="yes">Collapse the whole tree in the right frame</property> | ||
487 | <property name="label" translatable="yes">Collapse</property> | ||
488 | <property name="use_underline">True</property> | ||
489 | <property name="stock_id">gtk-remove</property> | ||
490 | <property name="visible_horizontal">True</property> | ||
491 | <property name="visible_vertical">True</property> | ||
492 | <property name="is_important">False</property> | ||
493 | <signal name="clicked" handler="on_collapse_clicked"/> | ||
494 | </widget> | ||
495 | <packing> | ||
496 | <property name="expand">False</property> | ||
497 | <property name="homogeneous">True</property> | ||
498 | </packing> | ||
499 | </child> | ||
500 | |||
501 | <child> | ||
502 | <widget class="GtkToolButton" id="button8"> | ||
503 | <property name="visible">True</property> | ||
504 | <property name="tooltip" translatable="yes">Expand the whole tree in the right frame</property> | ||
505 | <property name="label" translatable="yes">Expand</property> | ||
506 | <property name="use_underline">True</property> | ||
507 | <property name="stock_id">gtk-add</property> | ||
508 | <property name="visible_horizontal">True</property> | ||
509 | <property name="visible_vertical">True</property> | ||
510 | <property name="is_important">False</property> | ||
511 | <signal name="clicked" handler="on_expand_clicked"/> | ||
512 | </widget> | ||
513 | <packing> | ||
514 | <property name="expand">False</property> | ||
515 | <property name="homogeneous">True</property> | ||
516 | </packing> | ||
517 | </child> | ||
518 | </widget> | ||
519 | </child> | ||
520 | </widget> | ||
521 | <packing> | ||
522 | <property name="padding">0</property> | ||
523 | <property name="expand">False</property> | ||
524 | <property name="fill">False</property> | ||
525 | </packing> | ||
526 | </child> | ||
527 | |||
528 | <child> | ||
529 | <widget class="GtkHPaned" id="hpaned1"> | ||
530 | <property name="width_request">1</property> | ||
531 | <property name="visible">True</property> | ||
532 | <property name="can_focus">True</property> | ||
533 | <property name="position">0</property> | ||
534 | |||
535 | <child> | ||
536 | <widget class="GtkScrolledWindow" id="scrolledwindow1"> | ||
537 | <property name="visible">True</property> | ||
538 | <property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property> | ||
539 | <property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property> | ||
540 | <property name="shadow_type">GTK_SHADOW_IN</property> | ||
541 | <property name="window_placement">GTK_CORNER_TOP_LEFT</property> | ||
542 | |||
543 | <child> | ||
544 | <widget class="GtkTreeView" id="treeview1"> | ||
545 | <property name="visible">True</property> | ||
546 | <property name="can_focus">True</property> | ||
547 | <property name="headers_visible">True</property> | ||
548 | <property name="rules_hint">False</property> | ||
549 | <property name="reorderable">False</property> | ||
550 | <property name="enable_search">True</property> | ||
551 | <signal name="cursor_changed" handler="on_treeview2_cursor_changed" last_modification_time="Sun, 12 Jan 2003 15:58:22 GMT"/> | ||
552 | <signal name="button_press_event" handler="on_treeview1_button_press_event" last_modification_time="Sun, 12 Jan 2003 16:03:52 GMT"/> | ||
553 | <signal name="key_press_event" handler="on_treeview2_key_press_event" last_modification_time="Sun, 12 Jan 2003 16:11:44 GMT"/> | ||
554 | </widget> | ||
555 | </child> | ||
556 | </widget> | ||
557 | <packing> | ||
558 | <property name="shrink">True</property> | ||
559 | <property name="resize">False</property> | ||
560 | </packing> | ||
561 | </child> | ||
562 | |||
563 | <child> | ||
564 | <widget class="GtkVPaned" id="vpaned1"> | ||
565 | <property name="visible">True</property> | ||
566 | <property name="can_focus">True</property> | ||
567 | <property name="position">0</property> | ||
568 | |||
569 | <child> | ||
570 | <widget class="GtkScrolledWindow" id="scrolledwindow2"> | ||
571 | <property name="visible">True</property> | ||
572 | <property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property> | ||
573 | <property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property> | ||
574 | <property name="shadow_type">GTK_SHADOW_IN</property> | ||
575 | <property name="window_placement">GTK_CORNER_TOP_LEFT</property> | ||
576 | |||
577 | <child> | ||
578 | <widget class="GtkTreeView" id="treeview2"> | ||
579 | <property name="visible">True</property> | ||
580 | <property name="can_focus">True</property> | ||
581 | <property name="has_focus">True</property> | ||
582 | <property name="headers_visible">True</property> | ||
583 | <property name="rules_hint">False</property> | ||
584 | <property name="reorderable">False</property> | ||
585 | <property name="enable_search">True</property> | ||
586 | <signal name="cursor_changed" handler="on_treeview2_cursor_changed" last_modification_time="Sun, 12 Jan 2003 15:57:55 GMT"/> | ||
587 | <signal name="button_press_event" handler="on_treeview2_button_press_event" last_modification_time="Sun, 12 Jan 2003 15:57:58 GMT"/> | ||
588 | <signal name="key_press_event" handler="on_treeview2_key_press_event" last_modification_time="Sun, 12 Jan 2003 15:58:01 GMT"/> | ||
589 | </widget> | ||
590 | </child> | ||
591 | </widget> | ||
592 | <packing> | ||
593 | <property name="shrink">True</property> | ||
594 | <property name="resize">False</property> | ||
595 | </packing> | ||
596 | </child> | ||
597 | |||
598 | <child> | ||
599 | <widget class="GtkScrolledWindow" id="scrolledwindow3"> | ||
600 | <property name="visible">True</property> | ||
601 | <property name="hscrollbar_policy">GTK_POLICY_NEVER</property> | ||
602 | <property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property> | ||
603 | <property name="shadow_type">GTK_SHADOW_IN</property> | ||
604 | <property name="window_placement">GTK_CORNER_TOP_LEFT</property> | ||
605 | |||
606 | <child> | ||
607 | <widget class="GtkTextView" id="textview3"> | ||
608 | <property name="visible">True</property> | ||
609 | <property name="can_focus">True</property> | ||
610 | <property name="editable">False</property> | ||
611 | <property name="overwrite">False</property> | ||
612 | <property name="accepts_tab">True</property> | ||
613 | <property name="justification">GTK_JUSTIFY_LEFT</property> | ||
614 | <property name="wrap_mode">GTK_WRAP_WORD</property> | ||
615 | <property name="cursor_visible">True</property> | ||
616 | <property name="pixels_above_lines">0</property> | ||
617 | <property name="pixels_below_lines">0</property> | ||
618 | <property name="pixels_inside_wrap">0</property> | ||
619 | <property name="left_margin">0</property> | ||
620 | <property name="right_margin">0</property> | ||
621 | <property name="indent">0</property> | ||
622 | <property name="text" translatable="yes">Sorry, no help available for this option yet.</property> | ||
623 | </widget> | ||
624 | </child> | ||
625 | </widget> | ||
626 | <packing> | ||
627 | <property name="shrink">True</property> | ||
628 | <property name="resize">True</property> | ||
629 | </packing> | ||
630 | </child> | ||
631 | </widget> | ||
632 | <packing> | ||
633 | <property name="shrink">True</property> | ||
634 | <property name="resize">True</property> | ||
635 | </packing> | ||
636 | </child> | ||
637 | </widget> | ||
638 | <packing> | ||
639 | <property name="padding">0</property> | ||
640 | <property name="expand">True</property> | ||
641 | <property name="fill">True</property> | ||
642 | </packing> | ||
643 | </child> | ||
644 | </widget> | ||
645 | </child> | ||
646 | </widget> | ||
647 | |||
648 | </glade-interface> | ||
diff --git a/scripts/kconfig/images.c b/scripts/kconfig/images.c new file mode 100644 index 000000000..d4f84bd4a --- /dev/null +++ b/scripts/kconfig/images.c | |||
@@ -0,0 +1,326 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org> | ||
3 | * Released under the terms of the GNU GPL v2.0. | ||
4 | */ | ||
5 | |||
6 | static const char *xpm_load[] = { | ||
7 | "22 22 5 1", | ||
8 | ". c None", | ||
9 | "# c #000000", | ||
10 | "c c #838100", | ||
11 | "a c #ffff00", | ||
12 | "b c #ffffff", | ||
13 | "......................", | ||
14 | "......................", | ||
15 | "......................", | ||
16 | "............####....#.", | ||
17 | "...........#....##.##.", | ||
18 | "..................###.", | ||
19 | ".................####.", | ||
20 | ".####...........#####.", | ||
21 | "#abab##########.......", | ||
22 | "#babababababab#.......", | ||
23 | "#ababababababa#.......", | ||
24 | "#babababababab#.......", | ||
25 | "#ababab###############", | ||
26 | "#babab##cccccccccccc##", | ||
27 | "#abab##cccccccccccc##.", | ||
28 | "#bab##cccccccccccc##..", | ||
29 | "#ab##cccccccccccc##...", | ||
30 | "#b##cccccccccccc##....", | ||
31 | "###cccccccccccc##.....", | ||
32 | "##cccccccccccc##......", | ||
33 | "###############.......", | ||
34 | "......................"}; | ||
35 | |||
36 | static const char *xpm_save[] = { | ||
37 | "22 22 5 1", | ||
38 | ". c None", | ||
39 | "# c #000000", | ||
40 | "a c #838100", | ||
41 | "b c #c5c2c5", | ||
42 | "c c #cdb6d5", | ||
43 | "......................", | ||
44 | ".####################.", | ||
45 | ".#aa#bbbbbbbbbbbb#bb#.", | ||
46 | ".#aa#bbbbbbbbbbbb#bb#.", | ||
47 | ".#aa#bbbbbbbbbcbb####.", | ||
48 | ".#aa#bbbccbbbbbbb#aa#.", | ||
49 | ".#aa#bbbccbbbbbbb#aa#.", | ||
50 | ".#aa#bbbbbbbbbbbb#aa#.", | ||
51 | ".#aa#bbbbbbbbbbbb#aa#.", | ||
52 | ".#aa#bbbbbbbbbbbb#aa#.", | ||
53 | ".#aa#bbbbbbbbbbbb#aa#.", | ||
54 | ".#aaa############aaa#.", | ||
55 | ".#aaaaaaaaaaaaaaaaaa#.", | ||
56 | ".#aaaaaaaaaaaaaaaaaa#.", | ||
57 | ".#aaa#############aa#.", | ||
58 | ".#aaa#########bbb#aa#.", | ||
59 | ".#aaa#########bbb#aa#.", | ||
60 | ".#aaa#########bbb#aa#.", | ||
61 | ".#aaa#########bbb#aa#.", | ||
62 | ".#aaa#########bbb#aa#.", | ||
63 | "..##################..", | ||
64 | "......................"}; | ||
65 | |||
66 | static const char *xpm_back[] = { | ||
67 | "22 22 3 1", | ||
68 | ". c None", | ||
69 | "# c #000083", | ||
70 | "a c #838183", | ||
71 | "......................", | ||
72 | "......................", | ||
73 | "......................", | ||
74 | "......................", | ||
75 | "......................", | ||
76 | "...........######a....", | ||
77 | "..#......##########...", | ||
78 | "..##...####......##a..", | ||
79 | "..###.###.........##..", | ||
80 | "..######..........##..", | ||
81 | "..#####...........##..", | ||
82 | "..######..........##..", | ||
83 | "..#######.........##..", | ||
84 | "..########.......##a..", | ||
85 | "...............a###...", | ||
86 | "...............###....", | ||
87 | "......................", | ||
88 | "......................", | ||
89 | "......................", | ||
90 | "......................", | ||
91 | "......................", | ||
92 | "......................"}; | ||
93 | |||
94 | static const char *xpm_tree_view[] = { | ||
95 | "22 22 2 1", | ||
96 | ". c None", | ||
97 | "# c #000000", | ||
98 | "......................", | ||
99 | "......................", | ||
100 | "......#...............", | ||
101 | "......#...............", | ||
102 | "......#...............", | ||
103 | "......#...............", | ||
104 | "......#...............", | ||
105 | "......########........", | ||
106 | "......#...............", | ||
107 | "......#...............", | ||
108 | "......#...............", | ||
109 | "......#...............", | ||
110 | "......#...............", | ||
111 | "......########........", | ||
112 | "......#...............", | ||
113 | "......#...............", | ||
114 | "......#...............", | ||
115 | "......#...............", | ||
116 | "......#...............", | ||
117 | "......########........", | ||
118 | "......................", | ||
119 | "......................"}; | ||
120 | |||
121 | static const char *xpm_single_view[] = { | ||
122 | "22 22 2 1", | ||
123 | ". c None", | ||
124 | "# c #000000", | ||
125 | "......................", | ||
126 | "......................", | ||
127 | "..........#...........", | ||
128 | "..........#...........", | ||
129 | "..........#...........", | ||
130 | "..........#...........", | ||
131 | "..........#...........", | ||
132 | "..........#...........", | ||
133 | "..........#...........", | ||
134 | "..........#...........", | ||
135 | "..........#...........", | ||
136 | "..........#...........", | ||
137 | "..........#...........", | ||
138 | "..........#...........", | ||
139 | "..........#...........", | ||
140 | "..........#...........", | ||
141 | "..........#...........", | ||
142 | "..........#...........", | ||
143 | "..........#...........", | ||
144 | "..........#...........", | ||
145 | "......................", | ||
146 | "......................"}; | ||
147 | |||
148 | static const char *xpm_split_view[] = { | ||
149 | "22 22 2 1", | ||
150 | ". c None", | ||
151 | "# c #000000", | ||
152 | "......................", | ||
153 | "......................", | ||
154 | "......#......#........", | ||
155 | "......#......#........", | ||
156 | "......#......#........", | ||
157 | "......#......#........", | ||
158 | "......#......#........", | ||
159 | "......#......#........", | ||
160 | "......#......#........", | ||
161 | "......#......#........", | ||
162 | "......#......#........", | ||
163 | "......#......#........", | ||
164 | "......#......#........", | ||
165 | "......#......#........", | ||
166 | "......#......#........", | ||
167 | "......#......#........", | ||
168 | "......#......#........", | ||
169 | "......#......#........", | ||
170 | "......#......#........", | ||
171 | "......#......#........", | ||
172 | "......................", | ||
173 | "......................"}; | ||
174 | |||
175 | static const char *xpm_symbol_no[] = { | ||
176 | "12 12 2 1", | ||
177 | " c white", | ||
178 | ". c black", | ||
179 | " ", | ||
180 | " .......... ", | ||
181 | " . . ", | ||
182 | " . . ", | ||
183 | " . . ", | ||
184 | " . . ", | ||
185 | " . . ", | ||
186 | " . . ", | ||
187 | " . . ", | ||
188 | " . . ", | ||
189 | " .......... ", | ||
190 | " "}; | ||
191 | |||
192 | static const char *xpm_symbol_mod[] = { | ||
193 | "12 12 2 1", | ||
194 | " c white", | ||
195 | ". c black", | ||
196 | " ", | ||
197 | " .......... ", | ||
198 | " . . ", | ||
199 | " . . ", | ||
200 | " . .. . ", | ||
201 | " . .... . ", | ||
202 | " . .... . ", | ||
203 | " . .. . ", | ||
204 | " . . ", | ||
205 | " . . ", | ||
206 | " .......... ", | ||
207 | " "}; | ||
208 | |||
209 | static const char *xpm_symbol_yes[] = { | ||
210 | "12 12 2 1", | ||
211 | " c white", | ||
212 | ". c black", | ||
213 | " ", | ||
214 | " .......... ", | ||
215 | " . . ", | ||
216 | " . . ", | ||
217 | " . . . ", | ||
218 | " . .. . ", | ||
219 | " . . .. . ", | ||
220 | " . .... . ", | ||
221 | " . .. . ", | ||
222 | " . . ", | ||
223 | " .......... ", | ||
224 | " "}; | ||
225 | |||
226 | static const char *xpm_choice_no[] = { | ||
227 | "12 12 2 1", | ||
228 | " c white", | ||
229 | ". c black", | ||
230 | " ", | ||
231 | " .... ", | ||
232 | " .. .. ", | ||
233 | " . . ", | ||
234 | " . . ", | ||
235 | " . . ", | ||
236 | " . . ", | ||
237 | " . . ", | ||
238 | " . . ", | ||
239 | " .. .. ", | ||
240 | " .... ", | ||
241 | " "}; | ||
242 | |||
243 | static const char *xpm_choice_yes[] = { | ||
244 | "12 12 2 1", | ||
245 | " c white", | ||
246 | ". c black", | ||
247 | " ", | ||
248 | " .... ", | ||
249 | " .. .. ", | ||
250 | " . . ", | ||
251 | " . .. . ", | ||
252 | " . .... . ", | ||
253 | " . .... . ", | ||
254 | " . .. . ", | ||
255 | " . . ", | ||
256 | " .. .. ", | ||
257 | " .... ", | ||
258 | " "}; | ||
259 | |||
260 | static const char *xpm_menu[] = { | ||
261 | "12 12 2 1", | ||
262 | " c white", | ||
263 | ". c black", | ||
264 | " ", | ||
265 | " .......... ", | ||
266 | " . . ", | ||
267 | " . .. . ", | ||
268 | " . .... . ", | ||
269 | " . ...... . ", | ||
270 | " . ...... . ", | ||
271 | " . .... . ", | ||
272 | " . .. . ", | ||
273 | " . . ", | ||
274 | " .......... ", | ||
275 | " "}; | ||
276 | |||
277 | static const char *xpm_menu_inv[] = { | ||
278 | "12 12 2 1", | ||
279 | " c white", | ||
280 | ". c black", | ||
281 | " ", | ||
282 | " .......... ", | ||
283 | " .......... ", | ||
284 | " .. ...... ", | ||
285 | " .. .... ", | ||
286 | " .. .. ", | ||
287 | " .. .. ", | ||
288 | " .. .... ", | ||
289 | " .. ...... ", | ||
290 | " .......... ", | ||
291 | " .......... ", | ||
292 | " "}; | ||
293 | |||
294 | static const char *xpm_menuback[] = { | ||
295 | "12 12 2 1", | ||
296 | " c white", | ||
297 | ". c black", | ||
298 | " ", | ||
299 | " .......... ", | ||
300 | " . . ", | ||
301 | " . .. . ", | ||
302 | " . .... . ", | ||
303 | " . ...... . ", | ||
304 | " . ...... . ", | ||
305 | " . .... . ", | ||
306 | " . .. . ", | ||
307 | " . . ", | ||
308 | " .......... ", | ||
309 | " "}; | ||
310 | |||
311 | static const char *xpm_void[] = { | ||
312 | "12 12 2 1", | ||
313 | " c white", | ||
314 | ". c black", | ||
315 | " ", | ||
316 | " ", | ||
317 | " ", | ||
318 | " ", | ||
319 | " ", | ||
320 | " ", | ||
321 | " ", | ||
322 | " ", | ||
323 | " ", | ||
324 | " ", | ||
325 | " ", | ||
326 | " "}; | ||
diff --git a/scripts/kconfig/kconfig_load.c b/scripts/kconfig/kconfig_load.c new file mode 100644 index 000000000..dbdcaad82 --- /dev/null +++ b/scripts/kconfig/kconfig_load.c | |||
@@ -0,0 +1,35 @@ | |||
1 | #include <dlfcn.h> | ||
2 | #include <stdio.h> | ||
3 | #include <stdlib.h> | ||
4 | |||
5 | #include "lkc.h" | ||
6 | |||
7 | #define P(name,type,arg) type (*name ## _p) arg | ||
8 | #include "lkc_proto.h" | ||
9 | #undef P | ||
10 | |||
11 | void kconfig_load(void) | ||
12 | { | ||
13 | void *handle; | ||
14 | char *error; | ||
15 | |||
16 | handle = dlopen("./libkconfig.so", RTLD_LAZY); | ||
17 | if (!handle) { | ||
18 | handle = dlopen("./scripts/kconfig/libkconfig.so", RTLD_LAZY); | ||
19 | if (!handle) { | ||
20 | fprintf(stderr, "%s\n", dlerror()); | ||
21 | exit(1); | ||
22 | } | ||
23 | } | ||
24 | |||
25 | #define P(name,type,arg) \ | ||
26 | { \ | ||
27 | name ## _p = dlsym(handle, #name); \ | ||
28 | if ((error = dlerror())) { \ | ||
29 | fprintf(stderr, "%s\n", error); \ | ||
30 | exit(1); \ | ||
31 | } \ | ||
32 | } | ||
33 | #include "lkc_proto.h" | ||
34 | #undef P | ||
35 | } | ||
diff --git a/scripts/kconfig/kxgettext.c b/scripts/kconfig/kxgettext.c new file mode 100644 index 000000000..abee55ca6 --- /dev/null +++ b/scripts/kconfig/kxgettext.c | |||
@@ -0,0 +1,227 @@ | |||
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 | |||
13 | static char *escape(const char* text, char *bf, int len) | ||
14 | { | ||
15 | char *bfp = bf; | ||
16 | int multiline = strchr(text, '\n') != NULL; | ||
17 | int eol = 0; | ||
18 | int textlen = strlen(text); | ||
19 | |||
20 | if ((textlen > 0) && (text[textlen-1] == '\n')) | ||
21 | eol = 1; | ||
22 | |||
23 | *bfp++ = '"'; | ||
24 | --len; | ||
25 | |||
26 | if (multiline) { | ||
27 | *bfp++ = '"'; | ||
28 | *bfp++ = '\n'; | ||
29 | *bfp++ = '"'; | ||
30 | len -= 3; | ||
31 | } | ||
32 | |||
33 | while (*text != '\0' && len > 1) { | ||
34 | if (*text == '"') | ||
35 | *bfp++ = '\\'; | ||
36 | else if (*text == '\n') { | ||
37 | *bfp++ = '\\'; | ||
38 | *bfp++ = 'n'; | ||
39 | *bfp++ = '"'; | ||
40 | *bfp++ = '\n'; | ||
41 | *bfp++ = '"'; | ||
42 | len -= 5; | ||
43 | ++text; | ||
44 | goto next; | ||
45 | } | ||
46 | *bfp++ = *text++; | ||
47 | next: | ||
48 | --len; | ||
49 | } | ||
50 | |||
51 | if (multiline && eol) | ||
52 | bfp -= 3; | ||
53 | |||
54 | *bfp++ = '"'; | ||
55 | *bfp = '\0'; | ||
56 | |||
57 | return bf; | ||
58 | } | ||
59 | |||
60 | struct file_line { | ||
61 | struct file_line *next; | ||
62 | char* file; | ||
63 | int lineno; | ||
64 | }; | ||
65 | |||
66 | static struct file_line *file_line__new(char *file, int lineno) | ||
67 | { | ||
68 | struct file_line *self = malloc(sizeof(*self)); | ||
69 | |||
70 | if (self == NULL) | ||
71 | goto out; | ||
72 | |||
73 | self->file = file; | ||
74 | self->lineno = lineno; | ||
75 | self->next = NULL; | ||
76 | out: | ||
77 | return self; | ||
78 | } | ||
79 | |||
80 | struct message { | ||
81 | const char *msg; | ||
82 | const char *option; | ||
83 | struct message *next; | ||
84 | struct file_line *files; | ||
85 | }; | ||
86 | |||
87 | static struct message *message__list; | ||
88 | |||
89 | static struct message *message__new(const char *msg, char *option, char *file, int lineno) | ||
90 | { | ||
91 | struct message *self = malloc(sizeof(*self)); | ||
92 | |||
93 | if (self == NULL) | ||
94 | goto out; | ||
95 | |||
96 | self->files = file_line__new(file, lineno); | ||
97 | if (self->files == NULL) | ||
98 | goto out_fail; | ||
99 | |||
100 | self->msg = strdup(msg); | ||
101 | if (self->msg == NULL) | ||
102 | goto out_fail_msg; | ||
103 | |||
104 | self->option = option; | ||
105 | self->next = NULL; | ||
106 | out: | ||
107 | return self; | ||
108 | out_fail_msg: | ||
109 | free(self->files); | ||
110 | out_fail: | ||
111 | free(self); | ||
112 | self = NULL; | ||
113 | goto out; | ||
114 | } | ||
115 | |||
116 | static struct message *mesage__find(const char *msg) | ||
117 | { | ||
118 | struct message *m = message__list; | ||
119 | |||
120 | while (m != NULL) { | ||
121 | if (strcmp(m->msg, msg) == 0) | ||
122 | break; | ||
123 | m = m->next; | ||
124 | } | ||
125 | |||
126 | return m; | ||
127 | } | ||
128 | |||
129 | static int message__add_file_line(struct message *self, char *file, int lineno) | ||
130 | { | ||
131 | int rc = -1; | ||
132 | struct file_line *fl = file_line__new(file, lineno); | ||
133 | |||
134 | if (fl == NULL) | ||
135 | goto out; | ||
136 | |||
137 | fl->next = self->files; | ||
138 | self->files = fl; | ||
139 | rc = 0; | ||
140 | out: | ||
141 | return rc; | ||
142 | } | ||
143 | |||
144 | static int message__add(const char *msg, char *option, char *file, int lineno) | ||
145 | { | ||
146 | int rc = 0; | ||
147 | char bf[16384]; | ||
148 | char *escaped = escape(msg, bf, sizeof(bf)); | ||
149 | struct message *m = mesage__find(escaped); | ||
150 | |||
151 | if (m != NULL) | ||
152 | rc = message__add_file_line(m, file, lineno); | ||
153 | else { | ||
154 | m = message__new(escaped, option, file, lineno); | ||
155 | |||
156 | if (m != NULL) { | ||
157 | m->next = message__list; | ||
158 | message__list = m; | ||
159 | } else | ||
160 | rc = -1; | ||
161 | } | ||
162 | return rc; | ||
163 | } | ||
164 | |||
165 | void menu_build_message_list(struct menu *menu) | ||
166 | { | ||
167 | struct menu *child; | ||
168 | |||
169 | message__add(menu_get_prompt(menu), NULL, | ||
170 | menu->file == NULL ? "Root Menu" : menu->file->name, | ||
171 | menu->lineno); | ||
172 | |||
173 | if (menu->sym != NULL && menu->sym->help != NULL) | ||
174 | message__add(menu->sym->help, menu->sym->name, | ||
175 | menu->file == NULL ? "Root Menu" : menu->file->name, | ||
176 | menu->lineno); | ||
177 | |||
178 | for (child = menu->list; child != NULL; child = child->next) | ||
179 | if (child->prompt != NULL) | ||
180 | menu_build_message_list(child); | ||
181 | } | ||
182 | |||
183 | static void message__print_file_lineno(struct message *self) | ||
184 | { | ||
185 | struct file_line *fl = self->files; | ||
186 | |||
187 | putchar('\n'); | ||
188 | if (self->option != NULL) | ||
189 | printf("# %s:00000\n", self->option); | ||
190 | |||
191 | printf("#: %s:%d", fl->file, fl->lineno); | ||
192 | fl = fl->next; | ||
193 | |||
194 | while (fl != NULL) { | ||
195 | printf(", %s:%d", fl->file, fl->lineno); | ||
196 | fl = fl->next; | ||
197 | } | ||
198 | |||
199 | putchar('\n'); | ||
200 | } | ||
201 | |||
202 | static void message__print_gettext_msgid_msgstr(struct message *self) | ||
203 | { | ||
204 | message__print_file_lineno(self); | ||
205 | |||
206 | printf("msgid %s\n" | ||
207 | "msgstr \"\"\n", self->msg); | ||
208 | } | ||
209 | |||
210 | void menu__xgettext(void) | ||
211 | { | ||
212 | struct message *m = message__list; | ||
213 | |||
214 | while (m != NULL) { | ||
215 | message__print_gettext_msgid_msgstr(m); | ||
216 | m = m->next; | ||
217 | } | ||
218 | } | ||
219 | |||
220 | int main(int ac, char **av) | ||
221 | { | ||
222 | conf_parse(av[1]); | ||
223 | |||
224 | menu_build_message_list(menu_get_root_menu(NULL)); | ||
225 | menu__xgettext(); | ||
226 | return 0; | ||
227 | } | ||
diff --git a/scripts/kconfig/lex.zconf.c_shipped b/scripts/kconfig/lex.zconf.c_shipped new file mode 100644 index 000000000..24e3c8cbb --- /dev/null +++ b/scripts/kconfig/lex.zconf.c_shipped | |||
@@ -0,0 +1,2317 @@ | |||
1 | |||
2 | #line 3 "scripts/kconfig/lex.zconf.c" | ||
3 | |||
4 | #define YY_INT_ALIGNED short int | ||
5 | |||
6 | /* A lexical scanner generated by flex */ | ||
7 | |||
8 | #define FLEX_SCANNER | ||
9 | #define YY_FLEX_MAJOR_VERSION 2 | ||
10 | #define YY_FLEX_MINOR_VERSION 5 | ||
11 | #define YY_FLEX_SUBMINOR_VERSION 31 | ||
12 | #if YY_FLEX_SUBMINOR_VERSION > 0 | ||
13 | #define FLEX_BETA | ||
14 | #endif | ||
15 | |||
16 | /* First, we deal with platform-specific or compiler-specific issues. */ | ||
17 | |||
18 | /* begin standard C headers. */ | ||
19 | #include <stdio.h> | ||
20 | #include <string.h> | ||
21 | #include <errno.h> | ||
22 | #include <stdlib.h> | ||
23 | |||
24 | /* end standard C headers. */ | ||
25 | |||
26 | /* flex integer type definitions */ | ||
27 | |||
28 | #ifndef FLEXINT_H | ||
29 | #define FLEXINT_H | ||
30 | |||
31 | /* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */ | ||
32 | |||
33 | #if defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L | ||
34 | #include <inttypes.h> | ||
35 | typedef int8_t flex_int8_t; | ||
36 | typedef uint8_t flex_uint8_t; | ||
37 | typedef int16_t flex_int16_t; | ||
38 | typedef uint16_t flex_uint16_t; | ||
39 | typedef int32_t flex_int32_t; | ||
40 | typedef uint32_t flex_uint32_t; | ||
41 | #else | ||
42 | typedef signed char flex_int8_t; | ||
43 | typedef short int flex_int16_t; | ||
44 | typedef int flex_int32_t; | ||
45 | typedef unsigned char flex_uint8_t; | ||
46 | typedef unsigned short int flex_uint16_t; | ||
47 | typedef unsigned int flex_uint32_t; | ||
48 | #endif /* ! C99 */ | ||
49 | |||
50 | /* Limits of integral types. */ | ||
51 | #ifndef INT8_MIN | ||
52 | #define INT8_MIN (-128) | ||
53 | #endif | ||
54 | #ifndef INT16_MIN | ||
55 | #define INT16_MIN (-32767-1) | ||
56 | #endif | ||
57 | #ifndef INT32_MIN | ||
58 | #define INT32_MIN (-2147483647-1) | ||
59 | #endif | ||
60 | #ifndef INT8_MAX | ||
61 | #define INT8_MAX (127) | ||
62 | #endif | ||
63 | #ifndef INT16_MAX | ||
64 | #define INT16_MAX (32767) | ||
65 | #endif | ||
66 | #ifndef INT32_MAX | ||
67 | #define INT32_MAX (2147483647) | ||
68 | #endif | ||
69 | #ifndef UINT8_MAX | ||
70 | #define UINT8_MAX (255U) | ||
71 | #endif | ||
72 | #ifndef UINT16_MAX | ||
73 | #define UINT16_MAX (65535U) | ||
74 | #endif | ||
75 | #ifndef UINT32_MAX | ||
76 | #define UINT32_MAX (4294967295U) | ||
77 | #endif | ||
78 | |||
79 | #endif /* ! FLEXINT_H */ | ||
80 | |||
81 | #ifdef __cplusplus | ||
82 | |||
83 | /* The "const" storage-class-modifier is valid. */ | ||
84 | #define YY_USE_CONST | ||
85 | |||
86 | #else /* ! __cplusplus */ | ||
87 | |||
88 | #if __STDC__ | ||
89 | |||
90 | #define YY_USE_CONST | ||
91 | |||
92 | #endif /* __STDC__ */ | ||
93 | #endif /* ! __cplusplus */ | ||
94 | |||
95 | #ifdef YY_USE_CONST | ||
96 | #define yyconst const | ||
97 | #else | ||
98 | #define yyconst | ||
99 | #endif | ||
100 | |||
101 | /* Returned upon end-of-file. */ | ||
102 | #define YY_NULL 0 | ||
103 | |||
104 | /* Promotes a possibly negative, possibly signed char to an unsigned | ||
105 | * integer for use as an array index. If the signed char is negative, | ||
106 | * we want to instead treat it as an 8-bit unsigned char, hence the | ||
107 | * double cast. | ||
108 | */ | ||
109 | #define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c) | ||
110 | |||
111 | /* Enter a start condition. This macro really ought to take a parameter, | ||
112 | * but we do it the disgusting crufty way forced on us by the ()-less | ||
113 | * definition of BEGIN. | ||
114 | */ | ||
115 | #define BEGIN (yy_start) = 1 + 2 * | ||
116 | |||
117 | /* Translate the current start state into a value that can be later handed | ||
118 | * to BEGIN to return to the state. The YYSTATE alias is for lex | ||
119 | * compatibility. | ||
120 | */ | ||
121 | #define YY_START (((yy_start) - 1) / 2) | ||
122 | #define YYSTATE YY_START | ||
123 | |||
124 | /* Action number for EOF rule of a given start state. */ | ||
125 | #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1) | ||
126 | |||
127 | /* Special action meaning "start processing a new file". */ | ||
128 | #define YY_NEW_FILE zconfrestart(zconfin ) | ||
129 | |||
130 | #define YY_END_OF_BUFFER_CHAR 0 | ||
131 | |||
132 | /* Size of default input buffer. */ | ||
133 | #ifndef YY_BUF_SIZE | ||
134 | #define YY_BUF_SIZE 16384 | ||
135 | #endif | ||
136 | |||
137 | #ifndef YY_TYPEDEF_YY_BUFFER_STATE | ||
138 | #define YY_TYPEDEF_YY_BUFFER_STATE | ||
139 | typedef struct yy_buffer_state *YY_BUFFER_STATE; | ||
140 | #endif | ||
141 | |||
142 | extern int zconfleng; | ||
143 | |||
144 | extern FILE *zconfin, *zconfout; | ||
145 | |||
146 | #define EOB_ACT_CONTINUE_SCAN 0 | ||
147 | #define EOB_ACT_END_OF_FILE 1 | ||
148 | #define EOB_ACT_LAST_MATCH 2 | ||
149 | |||
150 | #define YY_LESS_LINENO(n) | ||
151 | |||
152 | /* Return all but the first "n" matched characters back to the input stream. */ | ||
153 | #define yyless(n) \ | ||
154 | do \ | ||
155 | { \ | ||
156 | /* Undo effects of setting up zconftext. */ \ | ||
157 | int yyless_macro_arg = (n); \ | ||
158 | YY_LESS_LINENO(yyless_macro_arg);\ | ||
159 | *yy_cp = (yy_hold_char); \ | ||
160 | YY_RESTORE_YY_MORE_OFFSET \ | ||
161 | (yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \ | ||
162 | YY_DO_BEFORE_ACTION; /* set up zconftext again */ \ | ||
163 | } \ | ||
164 | while ( 0 ) | ||
165 | |||
166 | #define unput(c) yyunput( c, (yytext_ptr) ) | ||
167 | |||
168 | /* The following is because we cannot portably get our hands on size_t | ||
169 | * (without autoconf's help, which isn't available because we want | ||
170 | * flex-generated scanners to compile on their own). | ||
171 | */ | ||
172 | |||
173 | #ifndef YY_TYPEDEF_YY_SIZE_T | ||
174 | #define YY_TYPEDEF_YY_SIZE_T | ||
175 | typedef unsigned int yy_size_t; | ||
176 | #endif | ||
177 | |||
178 | #ifndef YY_STRUCT_YY_BUFFER_STATE | ||
179 | #define YY_STRUCT_YY_BUFFER_STATE | ||
180 | struct yy_buffer_state | ||
181 | { | ||
182 | FILE *yy_input_file; | ||
183 | |||
184 | char *yy_ch_buf; /* input buffer */ | ||
185 | char *yy_buf_pos; /* current position in input buffer */ | ||
186 | |||
187 | /* Size of input buffer in bytes, not including room for EOB | ||
188 | * characters. | ||
189 | */ | ||
190 | yy_size_t yy_buf_size; | ||
191 | |||
192 | /* Number of characters read into yy_ch_buf, not including EOB | ||
193 | * characters. | ||
194 | */ | ||
195 | int yy_n_chars; | ||
196 | |||
197 | /* Whether we "own" the buffer - i.e., we know we created it, | ||
198 | * and can realloc() it to grow it, and should free() it to | ||
199 | * delete it. | ||
200 | */ | ||
201 | int yy_is_our_buffer; | ||
202 | |||
203 | /* Whether this is an "interactive" input source; if so, and | ||
204 | * if we're using stdio for input, then we want to use getc() | ||
205 | * instead of fread(), to make sure we stop fetching input after | ||
206 | * each newline. | ||
207 | */ | ||
208 | int yy_is_interactive; | ||
209 | |||
210 | /* Whether we're considered to be at the beginning of a line. | ||
211 | * If so, '^' rules will be active on the next match, otherwise | ||
212 | * not. | ||
213 | */ | ||
214 | int yy_at_bol; | ||
215 | |||
216 | int yy_bs_lineno; /**< The line count. */ | ||
217 | int yy_bs_column; /**< The column count. */ | ||
218 | |||
219 | /* Whether to try to fill the input buffer when we reach the | ||
220 | * end of it. | ||
221 | */ | ||
222 | int yy_fill_buffer; | ||
223 | |||
224 | int yy_buffer_status; | ||
225 | |||
226 | #define YY_BUFFER_NEW 0 | ||
227 | #define YY_BUFFER_NORMAL 1 | ||
228 | /* When an EOF's been seen but there's still some text to process | ||
229 | * then we mark the buffer as YY_EOF_PENDING, to indicate that we | ||
230 | * shouldn't try reading from the input source any more. We might | ||
231 | * still have a bunch of tokens to match, though, because of | ||
232 | * possible backing-up. | ||
233 | * | ||
234 | * When we actually see the EOF, we change the status to "new" | ||
235 | * (via zconfrestart()), so that the user can continue scanning by | ||
236 | * just pointing zconfin at a new input file. | ||
237 | */ | ||
238 | #define YY_BUFFER_EOF_PENDING 2 | ||
239 | |||
240 | }; | ||
241 | #endif /* !YY_STRUCT_YY_BUFFER_STATE */ | ||
242 | |||
243 | /* Stack of input buffers. */ | ||
244 | static size_t yy_buffer_stack_top = 0; /**< index of top of stack. */ | ||
245 | static size_t yy_buffer_stack_max = 0; /**< capacity of stack. */ | ||
246 | static YY_BUFFER_STATE * yy_buffer_stack = 0; /**< Stack as an array. */ | ||
247 | |||
248 | /* We provide macros for accessing buffer states in case in the | ||
249 | * future we want to put the buffer states in a more general | ||
250 | * "scanner state". | ||
251 | * | ||
252 | * Returns the top of the stack, or NULL. | ||
253 | */ | ||
254 | #define YY_CURRENT_BUFFER ( (yy_buffer_stack) \ | ||
255 | ? (yy_buffer_stack)[(yy_buffer_stack_top)] \ | ||
256 | : NULL) | ||
257 | |||
258 | /* Same as previous macro, but useful when we know that the buffer stack is not | ||
259 | * NULL or when we need an lvalue. For internal use only. | ||
260 | */ | ||
261 | #define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)] | ||
262 | |||
263 | /* yy_hold_char holds the character lost when zconftext is formed. */ | ||
264 | static char yy_hold_char; | ||
265 | static int yy_n_chars; /* number of characters read into yy_ch_buf */ | ||
266 | int zconfleng; | ||
267 | |||
268 | /* Points to current character in buffer. */ | ||
269 | static char *yy_c_buf_p = (char *) 0; | ||
270 | static int yy_init = 1; /* whether we need to initialize */ | ||
271 | static int yy_start = 0; /* start state number */ | ||
272 | |||
273 | /* Flag which is used to allow zconfwrap()'s to do buffer switches | ||
274 | * instead of setting up a fresh zconfin. A bit of a hack ... | ||
275 | */ | ||
276 | static int yy_did_buffer_switch_on_eof; | ||
277 | |||
278 | void zconfrestart (FILE *input_file ); | ||
279 | void zconf_switch_to_buffer (YY_BUFFER_STATE new_buffer ); | ||
280 | YY_BUFFER_STATE zconf_create_buffer (FILE *file,int size ); | ||
281 | void zconf_delete_buffer (YY_BUFFER_STATE b ); | ||
282 | void zconf_flush_buffer (YY_BUFFER_STATE b ); | ||
283 | void zconfpush_buffer_state (YY_BUFFER_STATE new_buffer ); | ||
284 | void zconfpop_buffer_state (void ); | ||
285 | |||
286 | static void zconfensure_buffer_stack (void ); | ||
287 | static void zconf_load_buffer_state (void ); | ||
288 | static void zconf_init_buffer (YY_BUFFER_STATE b,FILE *file ); | ||
289 | |||
290 | #define YY_FLUSH_BUFFER zconf_flush_buffer(YY_CURRENT_BUFFER ) | ||
291 | |||
292 | YY_BUFFER_STATE zconf_scan_buffer (char *base,yy_size_t size ); | ||
293 | YY_BUFFER_STATE zconf_scan_string (yyconst char *yy_str ); | ||
294 | YY_BUFFER_STATE zconf_scan_bytes (yyconst char *bytes,int len ); | ||
295 | |||
296 | void *zconfalloc (yy_size_t ); | ||
297 | void *zconfrealloc (void *,yy_size_t ); | ||
298 | void zconffree (void * ); | ||
299 | |||
300 | #define yy_new_buffer zconf_create_buffer | ||
301 | |||
302 | #define yy_set_interactive(is_interactive) \ | ||
303 | { \ | ||
304 | if ( ! YY_CURRENT_BUFFER ){ \ | ||
305 | zconfensure_buffer_stack (); \ | ||
306 | YY_CURRENT_BUFFER_LVALUE = \ | ||
307 | zconf_create_buffer(zconfin,YY_BUF_SIZE ); \ | ||
308 | } \ | ||
309 | YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \ | ||
310 | } | ||
311 | |||
312 | #define yy_set_bol(at_bol) \ | ||
313 | { \ | ||
314 | if ( ! YY_CURRENT_BUFFER ){\ | ||
315 | zconfensure_buffer_stack (); \ | ||
316 | YY_CURRENT_BUFFER_LVALUE = \ | ||
317 | zconf_create_buffer(zconfin,YY_BUF_SIZE ); \ | ||
318 | } \ | ||
319 | YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \ | ||
320 | } | ||
321 | |||
322 | #define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol) | ||
323 | |||
324 | /* Begin user sect3 */ | ||
325 | |||
326 | #define zconfwrap() 1 | ||
327 | #define YY_SKIP_YYWRAP | ||
328 | |||
329 | typedef unsigned char YY_CHAR; | ||
330 | |||
331 | FILE *zconfin = (FILE *) 0, *zconfout = (FILE *) 0; | ||
332 | |||
333 | typedef int yy_state_type; | ||
334 | |||
335 | extern int zconflineno; | ||
336 | |||
337 | int zconflineno = 1; | ||
338 | |||
339 | extern char *zconftext; | ||
340 | #define yytext_ptr zconftext | ||
341 | static yyconst flex_int16_t yy_nxt[][17] = | ||
342 | { | ||
343 | { | ||
344 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | ||
345 | 0, 0, 0, 0, 0, 0, 0 | ||
346 | }, | ||
347 | |||
348 | { | ||
349 | 11, 12, 13, 14, 12, 12, 15, 12, 12, 12, | ||
350 | 12, 12, 12, 12, 12, 12, 12 | ||
351 | }, | ||
352 | |||
353 | { | ||
354 | 11, 12, 13, 14, 12, 12, 15, 12, 12, 12, | ||
355 | 12, 12, 12, 12, 12, 12, 12 | ||
356 | }, | ||
357 | |||
358 | { | ||
359 | 11, 16, 16, 17, 16, 16, 16, 16, 16, 16, | ||
360 | 16, 16, 16, 18, 16, 16, 16 | ||
361 | }, | ||
362 | |||
363 | { | ||
364 | 11, 16, 16, 17, 16, 16, 16, 16, 16, 16, | ||
365 | 16, 16, 16, 18, 16, 16, 16 | ||
366 | |||
367 | }, | ||
368 | |||
369 | { | ||
370 | 11, 19, 20, 21, 19, 19, 19, 19, 19, 19, | ||
371 | 19, 19, 19, 19, 19, 19, 19 | ||
372 | }, | ||
373 | |||
374 | { | ||
375 | 11, 19, 20, 21, 19, 19, 19, 19, 19, 19, | ||
376 | 19, 19, 19, 19, 19, 19, 19 | ||
377 | }, | ||
378 | |||
379 | { | ||
380 | 11, 22, 22, 23, 22, 24, 22, 22, 24, 22, | ||
381 | 22, 22, 22, 22, 22, 25, 22 | ||
382 | }, | ||
383 | |||
384 | { | ||
385 | 11, 22, 22, 23, 22, 24, 22, 22, 24, 22, | ||
386 | 22, 22, 22, 22, 22, 25, 22 | ||
387 | }, | ||
388 | |||
389 | { | ||
390 | 11, 26, 26, 27, 28, 29, 30, 31, 29, 32, | ||
391 | 33, 34, 35, 35, 36, 37, 38 | ||
392 | |||
393 | }, | ||
394 | |||
395 | { | ||
396 | 11, 26, 26, 27, 28, 29, 30, 31, 29, 32, | ||
397 | 33, 34, 35, 35, 36, 37, 38 | ||
398 | }, | ||
399 | |||
400 | { | ||
401 | -11, -11, -11, -11, -11, -11, -11, -11, -11, -11, | ||
402 | -11, -11, -11, -11, -11, -11, -11 | ||
403 | }, | ||
404 | |||
405 | { | ||
406 | 11, -12, -12, -12, -12, -12, -12, -12, -12, -12, | ||
407 | -12, -12, -12, -12, -12, -12, -12 | ||
408 | }, | ||
409 | |||
410 | { | ||
411 | 11, -13, 39, 40, -13, -13, 41, -13, -13, -13, | ||
412 | -13, -13, -13, -13, -13, -13, -13 | ||
413 | }, | ||
414 | |||
415 | { | ||
416 | 11, -14, -14, -14, -14, -14, -14, -14, -14, -14, | ||
417 | -14, -14, -14, -14, -14, -14, -14 | ||
418 | |||
419 | }, | ||
420 | |||
421 | { | ||
422 | 11, 42, 42, 43, 42, 42, 42, 42, 42, 42, | ||
423 | 42, 42, 42, 42, 42, 42, 42 | ||
424 | }, | ||
425 | |||
426 | { | ||
427 | 11, -16, -16, -16, -16, -16, -16, -16, -16, -16, | ||
428 | -16, -16, -16, -16, -16, -16, -16 | ||
429 | }, | ||
430 | |||
431 | { | ||
432 | 11, -17, -17, -17, -17, -17, -17, -17, -17, -17, | ||
433 | -17, -17, -17, -17, -17, -17, -17 | ||
434 | }, | ||
435 | |||
436 | { | ||
437 | 11, -18, -18, -18, -18, -18, -18, -18, -18, -18, | ||
438 | -18, -18, -18, 44, -18, -18, -18 | ||
439 | }, | ||
440 | |||
441 | { | ||
442 | 11, 45, 45, -19, 45, 45, 45, 45, 45, 45, | ||
443 | 45, 45, 45, 45, 45, 45, 45 | ||
444 | |||
445 | }, | ||
446 | |||
447 | { | ||
448 | 11, -20, 46, 47, -20, -20, -20, -20, -20, -20, | ||
449 | -20, -20, -20, -20, -20, -20, -20 | ||
450 | }, | ||
451 | |||
452 | { | ||
453 | 11, 48, -21, -21, 48, 48, 48, 48, 48, 48, | ||
454 | 48, 48, 48, 48, 48, 48, 48 | ||
455 | }, | ||
456 | |||
457 | { | ||
458 | 11, 49, 49, 50, 49, -22, 49, 49, -22, 49, | ||
459 | 49, 49, 49, 49, 49, -22, 49 | ||
460 | }, | ||
461 | |||
462 | { | ||
463 | 11, -23, -23, -23, -23, -23, -23, -23, -23, -23, | ||
464 | -23, -23, -23, -23, -23, -23, -23 | ||
465 | }, | ||
466 | |||
467 | { | ||
468 | 11, -24, -24, -24, -24, -24, -24, -24, -24, -24, | ||
469 | -24, -24, -24, -24, -24, -24, -24 | ||
470 | |||
471 | }, | ||
472 | |||
473 | { | ||
474 | 11, 51, 51, 52, 51, 51, 51, 51, 51, 51, | ||
475 | 51, 51, 51, 51, 51, 51, 51 | ||
476 | }, | ||
477 | |||
478 | { | ||
479 | 11, -26, -26, -26, -26, -26, -26, -26, -26, -26, | ||
480 | -26, -26, -26, -26, -26, -26, -26 | ||
481 | }, | ||
482 | |||
483 | { | ||
484 | 11, -27, -27, -27, -27, -27, -27, -27, -27, -27, | ||
485 | -27, -27, -27, -27, -27, -27, -27 | ||
486 | }, | ||
487 | |||
488 | { | ||
489 | 11, -28, -28, -28, -28, -28, -28, -28, -28, -28, | ||
490 | -28, -28, -28, -28, 53, -28, -28 | ||
491 | }, | ||
492 | |||
493 | { | ||
494 | 11, -29, -29, -29, -29, -29, -29, -29, -29, -29, | ||
495 | -29, -29, -29, -29, -29, -29, -29 | ||
496 | |||
497 | }, | ||
498 | |||
499 | { | ||
500 | 11, 54, 54, -30, 54, 54, 54, 54, 54, 54, | ||
501 | 54, 54, 54, 54, 54, 54, 54 | ||
502 | }, | ||
503 | |||
504 | { | ||
505 | 11, -31, -31, -31, -31, -31, -31, 55, -31, -31, | ||
506 | -31, -31, -31, -31, -31, -31, -31 | ||
507 | }, | ||
508 | |||
509 | { | ||
510 | 11, -32, -32, -32, -32, -32, -32, -32, -32, -32, | ||
511 | -32, -32, -32, -32, -32, -32, -32 | ||
512 | }, | ||
513 | |||
514 | { | ||
515 | 11, -33, -33, -33, -33, -33, -33, -33, -33, -33, | ||
516 | -33, -33, -33, -33, -33, -33, -33 | ||
517 | }, | ||
518 | |||
519 | { | ||
520 | 11, -34, -34, -34, -34, -34, -34, -34, -34, -34, | ||
521 | -34, 56, 57, 57, -34, -34, -34 | ||
522 | |||
523 | }, | ||
524 | |||
525 | { | ||
526 | 11, -35, -35, -35, -35, -35, -35, -35, -35, -35, | ||
527 | -35, 57, 57, 57, -35, -35, -35 | ||
528 | }, | ||
529 | |||
530 | { | ||
531 | 11, -36, -36, -36, -36, -36, -36, -36, -36, -36, | ||
532 | -36, -36, -36, -36, -36, -36, -36 | ||
533 | }, | ||
534 | |||
535 | { | ||
536 | 11, -37, -37, 58, -37, -37, -37, -37, -37, -37, | ||
537 | -37, -37, -37, -37, -37, -37, -37 | ||
538 | }, | ||
539 | |||
540 | { | ||
541 | 11, -38, -38, -38, -38, -38, -38, -38, -38, -38, | ||
542 | -38, -38, -38, -38, -38, -38, 59 | ||
543 | }, | ||
544 | |||
545 | { | ||
546 | 11, -39, 39, 40, -39, -39, 41, -39, -39, -39, | ||
547 | -39, -39, -39, -39, -39, -39, -39 | ||
548 | |||
549 | }, | ||
550 | |||
551 | { | ||
552 | 11, -40, -40, -40, -40, -40, -40, -40, -40, -40, | ||
553 | -40, -40, -40, -40, -40, -40, -40 | ||
554 | }, | ||
555 | |||
556 | { | ||
557 | 11, 42, 42, 43, 42, 42, 42, 42, 42, 42, | ||
558 | 42, 42, 42, 42, 42, 42, 42 | ||
559 | }, | ||
560 | |||
561 | { | ||
562 | 11, 42, 42, 43, 42, 42, 42, 42, 42, 42, | ||
563 | 42, 42, 42, 42, 42, 42, 42 | ||
564 | }, | ||
565 | |||
566 | { | ||
567 | 11, -43, -43, -43, -43, -43, -43, -43, -43, -43, | ||
568 | -43, -43, -43, -43, -43, -43, -43 | ||
569 | }, | ||
570 | |||
571 | { | ||
572 | 11, -44, -44, -44, -44, -44, -44, -44, -44, -44, | ||
573 | -44, -44, -44, 44, -44, -44, -44 | ||
574 | |||
575 | }, | ||
576 | |||
577 | { | ||
578 | 11, 45, 45, -45, 45, 45, 45, 45, 45, 45, | ||
579 | 45, 45, 45, 45, 45, 45, 45 | ||
580 | }, | ||
581 | |||
582 | { | ||
583 | 11, -46, 46, 47, -46, -46, -46, -46, -46, -46, | ||
584 | -46, -46, -46, -46, -46, -46, -46 | ||
585 | }, | ||
586 | |||
587 | { | ||
588 | 11, 48, -47, -47, 48, 48, 48, 48, 48, 48, | ||
589 | 48, 48, 48, 48, 48, 48, 48 | ||
590 | }, | ||
591 | |||
592 | { | ||
593 | 11, -48, -48, -48, -48, -48, -48, -48, -48, -48, | ||
594 | -48, -48, -48, -48, -48, -48, -48 | ||
595 | }, | ||
596 | |||
597 | { | ||
598 | 11, 49, 49, 50, 49, -49, 49, 49, -49, 49, | ||
599 | 49, 49, 49, 49, 49, -49, 49 | ||
600 | |||
601 | }, | ||
602 | |||
603 | { | ||
604 | 11, -50, -50, -50, -50, -50, -50, -50, -50, -50, | ||
605 | -50, -50, -50, -50, -50, -50, -50 | ||
606 | }, | ||
607 | |||
608 | { | ||
609 | 11, -51, -51, 52, -51, -51, -51, -51, -51, -51, | ||
610 | -51, -51, -51, -51, -51, -51, -51 | ||
611 | }, | ||
612 | |||
613 | { | ||
614 | 11, -52, -52, -52, -52, -52, -52, -52, -52, -52, | ||
615 | -52, -52, -52, -52, -52, -52, -52 | ||
616 | }, | ||
617 | |||
618 | { | ||
619 | 11, -53, -53, -53, -53, -53, -53, -53, -53, -53, | ||
620 | -53, -53, -53, -53, -53, -53, -53 | ||
621 | }, | ||
622 | |||
623 | { | ||
624 | 11, 54, 54, -54, 54, 54, 54, 54, 54, 54, | ||
625 | 54, 54, 54, 54, 54, 54, 54 | ||
626 | |||
627 | }, | ||
628 | |||
629 | { | ||
630 | 11, -55, -55, -55, -55, -55, -55, -55, -55, -55, | ||
631 | -55, -55, -55, -55, -55, -55, -55 | ||
632 | }, | ||
633 | |||
634 | { | ||
635 | 11, -56, -56, -56, -56, -56, -56, -56, -56, -56, | ||
636 | -56, 60, 57, 57, -56, -56, -56 | ||
637 | }, | ||
638 | |||
639 | { | ||
640 | 11, -57, -57, -57, -57, -57, -57, -57, -57, -57, | ||
641 | -57, 57, 57, 57, -57, -57, -57 | ||
642 | }, | ||
643 | |||
644 | { | ||
645 | 11, -58, -58, -58, -58, -58, -58, -58, -58, -58, | ||
646 | -58, -58, -58, -58, -58, -58, -58 | ||
647 | }, | ||
648 | |||
649 | { | ||
650 | 11, -59, -59, -59, -59, -59, -59, -59, -59, -59, | ||
651 | -59, -59, -59, -59, -59, -59, -59 | ||
652 | |||
653 | }, | ||
654 | |||
655 | { | ||
656 | 11, -60, -60, -60, -60, -60, -60, -60, -60, -60, | ||
657 | -60, 57, 57, 57, -60, -60, -60 | ||
658 | }, | ||
659 | |||
660 | } ; | ||
661 | |||
662 | static yy_state_type yy_get_previous_state (void ); | ||
663 | static yy_state_type yy_try_NUL_trans (yy_state_type current_state ); | ||
664 | static int yy_get_next_buffer (void ); | ||
665 | static void yy_fatal_error (yyconst char msg[] ); | ||
666 | |||
667 | /* Done after the current pattern has been matched and before the | ||
668 | * corresponding action - sets up zconftext. | ||
669 | */ | ||
670 | #define YY_DO_BEFORE_ACTION \ | ||
671 | (yytext_ptr) = yy_bp; \ | ||
672 | zconfleng = (size_t) (yy_cp - yy_bp); \ | ||
673 | (yy_hold_char) = *yy_cp; \ | ||
674 | *yy_cp = '\0'; \ | ||
675 | (yy_c_buf_p) = yy_cp; | ||
676 | |||
677 | #define YY_NUM_RULES 33 | ||
678 | #define YY_END_OF_BUFFER 34 | ||
679 | /* This struct is not used in this scanner, | ||
680 | but its presence is necessary. */ | ||
681 | struct yy_trans_info | ||
682 | { | ||
683 | flex_int32_t yy_verify; | ||
684 | flex_int32_t yy_nxt; | ||
685 | }; | ||
686 | static yyconst flex_int16_t yy_accept[61] = | ||
687 | { 0, | ||
688 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | ||
689 | 34, 5, 4, 2, 3, 7, 8, 6, 32, 29, | ||
690 | 31, 24, 28, 27, 26, 22, 17, 13, 16, 20, | ||
691 | 22, 11, 12, 19, 19, 14, 22, 22, 4, 2, | ||
692 | 3, 3, 1, 6, 32, 29, 31, 30, 24, 23, | ||
693 | 26, 25, 15, 20, 9, 19, 19, 21, 10, 18 | ||
694 | } ; | ||
695 | |||
696 | static yyconst flex_int32_t yy_ec[256] = | ||
697 | { 0, | ||
698 | 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, | ||
699 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, | ||
700 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, | ||
701 | 1, 2, 4, 5, 6, 1, 1, 7, 8, 9, | ||
702 | 10, 1, 1, 1, 11, 12, 12, 13, 13, 13, | ||
703 | 13, 13, 13, 13, 13, 13, 13, 1, 1, 1, | ||
704 | 14, 1, 1, 1, 13, 13, 13, 13, 13, 13, | ||
705 | 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, | ||
706 | 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, | ||
707 | 1, 15, 1, 1, 13, 1, 13, 13, 13, 13, | ||
708 | |||
709 | 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, | ||
710 | 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, | ||
711 | 13, 13, 1, 16, 1, 1, 1, 1, 1, 1, | ||
712 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, | ||
713 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, | ||
714 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, | ||
715 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, | ||
716 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, | ||
717 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, | ||
718 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, | ||
719 | |||
720 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, | ||
721 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, | ||
722 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, | ||
723 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, | ||
724 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, | ||
725 | 1, 1, 1, 1, 1 | ||
726 | } ; | ||
727 | |||
728 | extern int zconf_flex_debug; | ||
729 | int zconf_flex_debug = 0; | ||
730 | |||
731 | /* The intent behind this definition is that it'll catch | ||
732 | * any uses of REJECT which flex missed. | ||
733 | */ | ||
734 | #define REJECT reject_used_but_not_detected | ||
735 | #define yymore() yymore_used_but_not_detected | ||
736 | #define YY_MORE_ADJ 0 | ||
737 | #define YY_RESTORE_YY_MORE_OFFSET | ||
738 | char *zconftext; | ||
739 | |||
740 | /* | ||
741 | * Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org> | ||
742 | * Released under the terms of the GNU GPL v2.0. | ||
743 | */ | ||
744 | |||
745 | #include <limits.h> | ||
746 | #include <stdio.h> | ||
747 | #include <stdlib.h> | ||
748 | #include <string.h> | ||
749 | #include <unistd.h> | ||
750 | |||
751 | #define LKC_DIRECT_LINK | ||
752 | #include "lkc.h" | ||
753 | |||
754 | #define START_STRSIZE 16 | ||
755 | |||
756 | static struct { | ||
757 | struct file *file; | ||
758 | int lineno; | ||
759 | } current_pos; | ||
760 | |||
761 | static char *text; | ||
762 | static int text_size, text_asize; | ||
763 | |||
764 | struct buffer { | ||
765 | struct buffer *parent; | ||
766 | YY_BUFFER_STATE state; | ||
767 | }; | ||
768 | |||
769 | struct buffer *current_buf; | ||
770 | |||
771 | static int last_ts, first_ts; | ||
772 | |||
773 | static void zconf_endhelp(void); | ||
774 | static void zconf_endfile(void); | ||
775 | |||
776 | void new_string(void) | ||
777 | { | ||
778 | text = malloc(START_STRSIZE); | ||
779 | text_asize = START_STRSIZE; | ||
780 | text_size = 0; | ||
781 | *text = 0; | ||
782 | } | ||
783 | |||
784 | void append_string(const char *str, int size) | ||
785 | { | ||
786 | int new_size = text_size + size + 1; | ||
787 | if (new_size > text_asize) { | ||
788 | new_size += START_STRSIZE - 1; | ||
789 | new_size &= -START_STRSIZE; | ||
790 | text = realloc(text, new_size); | ||
791 | text_asize = new_size; | ||
792 | } | ||
793 | memcpy(text + text_size, str, size); | ||
794 | text_size += size; | ||
795 | text[text_size] = 0; | ||
796 | } | ||
797 | |||
798 | void alloc_string(const char *str, int size) | ||
799 | { | ||
800 | text = malloc(size + 1); | ||
801 | memcpy(text, str, size); | ||
802 | text[size] = 0; | ||
803 | } | ||
804 | |||
805 | #define INITIAL 0 | ||
806 | #define COMMAND 1 | ||
807 | #define HELP 2 | ||
808 | #define STRING 3 | ||
809 | #define PARAM 4 | ||
810 | |||
811 | #ifndef YY_NO_UNISTD_H | ||
812 | /* Special case for "unistd.h", since it is non-ANSI. We include it way | ||
813 | * down here because we want the user's section 1 to have been scanned first. | ||
814 | * The user has a chance to override it with an option. | ||
815 | */ | ||
816 | #include <unistd.h> | ||
817 | #endif | ||
818 | |||
819 | #ifndef YY_EXTRA_TYPE | ||
820 | #define YY_EXTRA_TYPE void * | ||
821 | #endif | ||
822 | |||
823 | /* Macros after this point can all be overridden by user definitions in | ||
824 | * section 1. | ||
825 | */ | ||
826 | |||
827 | #ifndef YY_SKIP_YYWRAP | ||
828 | #ifdef __cplusplus | ||
829 | extern "C" int zconfwrap (void ); | ||
830 | #else | ||
831 | extern int zconfwrap (void ); | ||
832 | #endif | ||
833 | #endif | ||
834 | |||
835 | static void yyunput (int c,char *buf_ptr ); | ||
836 | |||
837 | #ifndef yytext_ptr | ||
838 | static void yy_flex_strncpy (char *,yyconst char *,int ); | ||
839 | #endif | ||
840 | |||
841 | #ifdef YY_NEED_STRLEN | ||
842 | static int yy_flex_strlen (yyconst char * ); | ||
843 | #endif | ||
844 | |||
845 | #ifndef YY_NO_INPUT | ||
846 | |||
847 | #ifdef __cplusplus | ||
848 | static int yyinput (void ); | ||
849 | #else | ||
850 | static int input (void ); | ||
851 | #endif | ||
852 | |||
853 | #endif | ||
854 | |||
855 | /* Amount of stuff to slurp up with each read. */ | ||
856 | #ifndef YY_READ_BUF_SIZE | ||
857 | #define YY_READ_BUF_SIZE 8192 | ||
858 | #endif | ||
859 | |||
860 | /* Copy whatever the last rule matched to the standard output. */ | ||
861 | #ifndef ECHO | ||
862 | /* This used to be an fputs(), but since the string might contain NUL's, | ||
863 | * we now use fwrite(). | ||
864 | */ | ||
865 | #define ECHO (void) fwrite( zconftext, zconfleng, 1, zconfout ) | ||
866 | #endif | ||
867 | |||
868 | /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, | ||
869 | * is returned in "result". | ||
870 | */ | ||
871 | #ifndef YY_INPUT | ||
872 | #define YY_INPUT(buf,result,max_size) \ | ||
873 | errno=0; \ | ||
874 | while ( (result = read( fileno(zconfin), (char *) buf, max_size )) < 0 ) \ | ||
875 | { \ | ||
876 | if( errno != EINTR) \ | ||
877 | { \ | ||
878 | YY_FATAL_ERROR( "input in flex scanner failed" ); \ | ||
879 | break; \ | ||
880 | } \ | ||
881 | errno=0; \ | ||
882 | clearerr(zconfin); \ | ||
883 | }\ | ||
884 | \ | ||
885 | |||
886 | #endif | ||
887 | |||
888 | /* No semi-colon after return; correct usage is to write "yyterminate();" - | ||
889 | * we don't want an extra ';' after the "return" because that will cause | ||
890 | * some compilers to complain about unreachable statements. | ||
891 | */ | ||
892 | #ifndef yyterminate | ||
893 | #define yyterminate() return YY_NULL | ||
894 | #endif | ||
895 | |||
896 | /* Number of entries by which start-condition stack grows. */ | ||
897 | #ifndef YY_START_STACK_INCR | ||
898 | #define YY_START_STACK_INCR 25 | ||
899 | #endif | ||
900 | |||
901 | /* Report a fatal error. */ | ||
902 | #ifndef YY_FATAL_ERROR | ||
903 | #define YY_FATAL_ERROR(msg) yy_fatal_error( msg ) | ||
904 | #endif | ||
905 | |||
906 | /* end tables serialization structures and prototypes */ | ||
907 | |||
908 | /* Default declaration of generated scanner - a define so the user can | ||
909 | * easily add parameters. | ||
910 | */ | ||
911 | #ifndef YY_DECL | ||
912 | #define YY_DECL_IS_OURS 1 | ||
913 | |||
914 | extern int zconflex (void); | ||
915 | |||
916 | #define YY_DECL int zconflex (void) | ||
917 | #endif /* !YY_DECL */ | ||
918 | |||
919 | /* Code executed at the beginning of each rule, after zconftext and zconfleng | ||
920 | * have been set up. | ||
921 | */ | ||
922 | #ifndef YY_USER_ACTION | ||
923 | #define YY_USER_ACTION | ||
924 | #endif | ||
925 | |||
926 | /* Code executed at the end of each rule. */ | ||
927 | #ifndef YY_BREAK | ||
928 | #define YY_BREAK break; | ||
929 | #endif | ||
930 | |||
931 | #define YY_RULE_SETUP \ | ||
932 | YY_USER_ACTION | ||
933 | |||
934 | /** The main scanner function which does all the work. | ||
935 | */ | ||
936 | YY_DECL | ||
937 | { | ||
938 | register yy_state_type yy_current_state; | ||
939 | register char *yy_cp, *yy_bp; | ||
940 | register int yy_act; | ||
941 | |||
942 | int str = 0; | ||
943 | int ts, i; | ||
944 | |||
945 | if ( (yy_init) ) | ||
946 | { | ||
947 | (yy_init) = 0; | ||
948 | |||
949 | #ifdef YY_USER_INIT | ||
950 | YY_USER_INIT; | ||
951 | #endif | ||
952 | |||
953 | if ( ! (yy_start) ) | ||
954 | (yy_start) = 1; /* first start state */ | ||
955 | |||
956 | if ( ! zconfin ) | ||
957 | zconfin = stdin; | ||
958 | |||
959 | if ( ! zconfout ) | ||
960 | zconfout = stdout; | ||
961 | |||
962 | if ( ! YY_CURRENT_BUFFER ) { | ||
963 | zconfensure_buffer_stack (); | ||
964 | YY_CURRENT_BUFFER_LVALUE = | ||
965 | zconf_create_buffer(zconfin,YY_BUF_SIZE ); | ||
966 | } | ||
967 | |||
968 | zconf_load_buffer_state( ); | ||
969 | } | ||
970 | |||
971 | while ( 1 ) /* loops until end-of-file is reached */ | ||
972 | { | ||
973 | yy_cp = (yy_c_buf_p); | ||
974 | |||
975 | /* Support of zconftext. */ | ||
976 | *yy_cp = (yy_hold_char); | ||
977 | |||
978 | /* yy_bp points to the position in yy_ch_buf of the start of | ||
979 | * the current run. | ||
980 | */ | ||
981 | yy_bp = yy_cp; | ||
982 | |||
983 | yy_current_state = (yy_start); | ||
984 | yy_match: | ||
985 | while ( (yy_current_state = yy_nxt[yy_current_state][ yy_ec[YY_SC_TO_UI(*yy_cp)] ]) > 0 ) | ||
986 | ++yy_cp; | ||
987 | |||
988 | yy_current_state = -yy_current_state; | ||
989 | |||
990 | yy_find_action: | ||
991 | yy_act = yy_accept[yy_current_state]; | ||
992 | |||
993 | YY_DO_BEFORE_ACTION; | ||
994 | |||
995 | do_action: /* This label is used only to access EOF actions. */ | ||
996 | |||
997 | switch ( yy_act ) | ||
998 | { /* beginning of action switch */ | ||
999 | case 1: | ||
1000 | /* rule 1 can match eol */ | ||
1001 | case 2: | ||
1002 | /* rule 2 can match eol */ | ||
1003 | YY_RULE_SETUP | ||
1004 | { | ||
1005 | current_file->lineno++; | ||
1006 | return T_EOL; | ||
1007 | } | ||
1008 | YY_BREAK | ||
1009 | case 3: | ||
1010 | YY_RULE_SETUP | ||
1011 | |||
1012 | YY_BREAK | ||
1013 | case 4: | ||
1014 | YY_RULE_SETUP | ||
1015 | { | ||
1016 | BEGIN(COMMAND); | ||
1017 | } | ||
1018 | YY_BREAK | ||
1019 | case 5: | ||
1020 | YY_RULE_SETUP | ||
1021 | { | ||
1022 | unput(zconftext[0]); | ||
1023 | BEGIN(COMMAND); | ||
1024 | } | ||
1025 | YY_BREAK | ||
1026 | |||
1027 | case 6: | ||
1028 | YY_RULE_SETUP | ||
1029 | { | ||
1030 | struct kconf_id *id = kconf_id_lookup(zconftext, zconfleng); | ||
1031 | BEGIN(PARAM); | ||
1032 | current_pos.file = current_file; | ||
1033 | current_pos.lineno = current_file->lineno; | ||
1034 | if (id && id->flags & TF_COMMAND) { | ||
1035 | zconflval.id = id; | ||
1036 | return id->token; | ||
1037 | } | ||
1038 | alloc_string(zconftext, zconfleng); | ||
1039 | zconflval.string = text; | ||
1040 | return T_WORD; | ||
1041 | } | ||
1042 | YY_BREAK | ||
1043 | case 7: | ||
1044 | YY_RULE_SETUP | ||
1045 | |||
1046 | YY_BREAK | ||
1047 | case 8: | ||
1048 | /* rule 8 can match eol */ | ||
1049 | YY_RULE_SETUP | ||
1050 | { | ||
1051 | BEGIN(INITIAL); | ||
1052 | current_file->lineno++; | ||
1053 | return T_EOL; | ||
1054 | } | ||
1055 | YY_BREAK | ||
1056 | |||
1057 | case 9: | ||
1058 | YY_RULE_SETUP | ||
1059 | return T_AND; | ||
1060 | YY_BREAK | ||
1061 | case 10: | ||
1062 | YY_RULE_SETUP | ||
1063 | return T_OR; | ||
1064 | YY_BREAK | ||
1065 | case 11: | ||
1066 | YY_RULE_SETUP | ||
1067 | return T_OPEN_PAREN; | ||
1068 | YY_BREAK | ||
1069 | case 12: | ||
1070 | YY_RULE_SETUP | ||
1071 | return T_CLOSE_PAREN; | ||
1072 | YY_BREAK | ||
1073 | case 13: | ||
1074 | YY_RULE_SETUP | ||
1075 | return T_NOT; | ||
1076 | YY_BREAK | ||
1077 | case 14: | ||
1078 | YY_RULE_SETUP | ||
1079 | return T_EQUAL; | ||
1080 | YY_BREAK | ||
1081 | case 15: | ||
1082 | YY_RULE_SETUP | ||
1083 | return T_UNEQUAL; | ||
1084 | YY_BREAK | ||
1085 | case 16: | ||
1086 | YY_RULE_SETUP | ||
1087 | { | ||
1088 | str = zconftext[0]; | ||
1089 | new_string(); | ||
1090 | BEGIN(STRING); | ||
1091 | } | ||
1092 | YY_BREAK | ||
1093 | case 17: | ||
1094 | /* rule 17 can match eol */ | ||
1095 | YY_RULE_SETUP | ||
1096 | BEGIN(INITIAL); current_file->lineno++; return T_EOL; | ||
1097 | YY_BREAK | ||
1098 | case 18: | ||
1099 | YY_RULE_SETUP | ||
1100 | /* ignore */ | ||
1101 | YY_BREAK | ||
1102 | case 19: | ||
1103 | YY_RULE_SETUP | ||
1104 | { | ||
1105 | struct kconf_id *id = kconf_id_lookup(zconftext, zconfleng); | ||
1106 | if (id && id->flags & TF_PARAM) { | ||
1107 | zconflval.id = id; | ||
1108 | return id->token; | ||
1109 | } | ||
1110 | alloc_string(zconftext, zconfleng); | ||
1111 | zconflval.string = text; | ||
1112 | return T_WORD; | ||
1113 | } | ||
1114 | YY_BREAK | ||
1115 | case 20: | ||
1116 | YY_RULE_SETUP | ||
1117 | /* comment */ | ||
1118 | YY_BREAK | ||
1119 | case 21: | ||
1120 | /* rule 21 can match eol */ | ||
1121 | YY_RULE_SETUP | ||
1122 | current_file->lineno++; | ||
1123 | YY_BREAK | ||
1124 | case 22: | ||
1125 | YY_RULE_SETUP | ||
1126 | |||
1127 | YY_BREAK | ||
1128 | case YY_STATE_EOF(PARAM): | ||
1129 | { | ||
1130 | BEGIN(INITIAL); | ||
1131 | } | ||
1132 | YY_BREAK | ||
1133 | |||
1134 | case 23: | ||
1135 | /* rule 23 can match eol */ | ||
1136 | *yy_cp = (yy_hold_char); /* undo effects of setting up zconftext */ | ||
1137 | (yy_c_buf_p) = yy_cp -= 1; | ||
1138 | YY_DO_BEFORE_ACTION; /* set up zconftext again */ | ||
1139 | YY_RULE_SETUP | ||
1140 | { | ||
1141 | append_string(zconftext, zconfleng); | ||
1142 | zconflval.string = text; | ||
1143 | return T_WORD_QUOTE; | ||
1144 | } | ||
1145 | YY_BREAK | ||
1146 | case 24: | ||
1147 | YY_RULE_SETUP | ||
1148 | { | ||
1149 | append_string(zconftext, zconfleng); | ||
1150 | } | ||
1151 | YY_BREAK | ||
1152 | case 25: | ||
1153 | /* rule 25 can match eol */ | ||
1154 | *yy_cp = (yy_hold_char); /* undo effects of setting up zconftext */ | ||
1155 | (yy_c_buf_p) = yy_cp -= 1; | ||
1156 | YY_DO_BEFORE_ACTION; /* set up zconftext again */ | ||
1157 | YY_RULE_SETUP | ||
1158 | { | ||
1159 | append_string(zconftext + 1, zconfleng - 1); | ||
1160 | zconflval.string = text; | ||
1161 | return T_WORD_QUOTE; | ||
1162 | } | ||
1163 | YY_BREAK | ||
1164 | case 26: | ||
1165 | YY_RULE_SETUP | ||
1166 | { | ||
1167 | append_string(zconftext + 1, zconfleng - 1); | ||
1168 | } | ||
1169 | YY_BREAK | ||
1170 | case 27: | ||
1171 | YY_RULE_SETUP | ||
1172 | { | ||
1173 | if (str == zconftext[0]) { | ||
1174 | BEGIN(PARAM); | ||
1175 | zconflval.string = text; | ||
1176 | return T_WORD_QUOTE; | ||
1177 | } else | ||
1178 | append_string(zconftext, 1); | ||
1179 | } | ||
1180 | YY_BREAK | ||
1181 | case 28: | ||
1182 | /* rule 28 can match eol */ | ||
1183 | YY_RULE_SETUP | ||
1184 | { | ||
1185 | printf("%s:%d:warning: multi-line strings not supported\n", zconf_curname(), zconf_lineno()); | ||
1186 | current_file->lineno++; | ||
1187 | BEGIN(INITIAL); | ||
1188 | return T_EOL; | ||
1189 | } | ||
1190 | YY_BREAK | ||
1191 | case YY_STATE_EOF(STRING): | ||
1192 | { | ||
1193 | BEGIN(INITIAL); | ||
1194 | } | ||
1195 | YY_BREAK | ||
1196 | |||
1197 | case 29: | ||
1198 | YY_RULE_SETUP | ||
1199 | { | ||
1200 | ts = 0; | ||
1201 | for (i = 0; i < zconfleng; i++) { | ||
1202 | if (zconftext[i] == '\t') | ||
1203 | ts = (ts & ~7) + 8; | ||
1204 | else | ||
1205 | ts++; | ||
1206 | } | ||
1207 | last_ts = ts; | ||
1208 | if (first_ts) { | ||
1209 | if (ts < first_ts) { | ||
1210 | zconf_endhelp(); | ||
1211 | return T_HELPTEXT; | ||
1212 | } | ||
1213 | ts -= first_ts; | ||
1214 | while (ts > 8) { | ||
1215 | append_string(" ", 8); | ||
1216 | ts -= 8; | ||
1217 | } | ||
1218 | append_string(" ", ts); | ||
1219 | } | ||
1220 | } | ||
1221 | YY_BREAK | ||
1222 | case 30: | ||
1223 | /* rule 30 can match eol */ | ||
1224 | *yy_cp = (yy_hold_char); /* undo effects of setting up zconftext */ | ||
1225 | (yy_c_buf_p) = yy_cp -= 1; | ||
1226 | YY_DO_BEFORE_ACTION; /* set up zconftext again */ | ||
1227 | YY_RULE_SETUP | ||
1228 | { | ||
1229 | current_file->lineno++; | ||
1230 | zconf_endhelp(); | ||
1231 | return T_HELPTEXT; | ||
1232 | } | ||
1233 | YY_BREAK | ||
1234 | case 31: | ||
1235 | /* rule 31 can match eol */ | ||
1236 | YY_RULE_SETUP | ||
1237 | { | ||
1238 | current_file->lineno++; | ||
1239 | append_string("\n", 1); | ||
1240 | } | ||
1241 | YY_BREAK | ||
1242 | case 32: | ||
1243 | YY_RULE_SETUP | ||
1244 | { | ||
1245 | append_string(zconftext, zconfleng); | ||
1246 | if (!first_ts) | ||
1247 | first_ts = last_ts; | ||
1248 | } | ||
1249 | YY_BREAK | ||
1250 | case YY_STATE_EOF(HELP): | ||
1251 | { | ||
1252 | zconf_endhelp(); | ||
1253 | return T_HELPTEXT; | ||
1254 | } | ||
1255 | YY_BREAK | ||
1256 | |||
1257 | case YY_STATE_EOF(INITIAL): | ||
1258 | case YY_STATE_EOF(COMMAND): | ||
1259 | { | ||
1260 | if (current_file) { | ||
1261 | zconf_endfile(); | ||
1262 | return T_EOL; | ||
1263 | } | ||
1264 | fclose(zconfin); | ||
1265 | yyterminate(); | ||
1266 | } | ||
1267 | YY_BREAK | ||
1268 | case 33: | ||
1269 | YY_RULE_SETUP | ||
1270 | YY_FATAL_ERROR( "flex scanner jammed" ); | ||
1271 | YY_BREAK | ||
1272 | |||
1273 | case YY_END_OF_BUFFER: | ||
1274 | { | ||
1275 | /* Amount of text matched not including the EOB char. */ | ||
1276 | int yy_amount_of_matched_text = (int) (yy_cp - (yytext_ptr)) - 1; | ||
1277 | |||
1278 | /* Undo the effects of YY_DO_BEFORE_ACTION. */ | ||
1279 | *yy_cp = (yy_hold_char); | ||
1280 | YY_RESTORE_YY_MORE_OFFSET | ||
1281 | |||
1282 | if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW ) | ||
1283 | { | ||
1284 | /* We're scanning a new file or input source. It's | ||
1285 | * possible that this happened because the user | ||
1286 | * just pointed zconfin at a new source and called | ||
1287 | * zconflex(). If so, then we have to assure | ||
1288 | * consistency between YY_CURRENT_BUFFER and our | ||
1289 | * globals. Here is the right place to do so, because | ||
1290 | * this is the first action (other than possibly a | ||
1291 | * back-up) that will match for the new input source. | ||
1292 | */ | ||
1293 | (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; | ||
1294 | YY_CURRENT_BUFFER_LVALUE->yy_input_file = zconfin; | ||
1295 | YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL; | ||
1296 | } | ||
1297 | |||
1298 | /* Note that here we test for yy_c_buf_p "<=" to the position | ||
1299 | * of the first EOB in the buffer, since yy_c_buf_p will | ||
1300 | * already have been incremented past the NUL character | ||
1301 | * (since all states make transitions on EOB to the | ||
1302 | * end-of-buffer state). Contrast this with the test | ||
1303 | * in input(). | ||
1304 | */ | ||
1305 | if ( (yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] ) | ||
1306 | { /* This was really a NUL. */ | ||
1307 | yy_state_type yy_next_state; | ||
1308 | |||
1309 | (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text; | ||
1310 | |||
1311 | yy_current_state = yy_get_previous_state( ); | ||
1312 | |||
1313 | /* Okay, we're now positioned to make the NUL | ||
1314 | * transition. We couldn't have | ||
1315 | * yy_get_previous_state() go ahead and do it | ||
1316 | * for us because it doesn't know how to deal | ||
1317 | * with the possibility of jamming (and we don't | ||
1318 | * want to build jamming into it because then it | ||
1319 | * will run more slowly). | ||
1320 | */ | ||
1321 | |||
1322 | yy_next_state = yy_try_NUL_trans( yy_current_state ); | ||
1323 | |||
1324 | yy_bp = (yytext_ptr) + YY_MORE_ADJ; | ||
1325 | |||
1326 | if ( yy_next_state ) | ||
1327 | { | ||
1328 | /* Consume the NUL. */ | ||
1329 | yy_cp = ++(yy_c_buf_p); | ||
1330 | yy_current_state = yy_next_state; | ||
1331 | goto yy_match; | ||
1332 | } | ||
1333 | |||
1334 | else | ||
1335 | { | ||
1336 | yy_cp = (yy_c_buf_p); | ||
1337 | goto yy_find_action; | ||
1338 | } | ||
1339 | } | ||
1340 | |||
1341 | else switch ( yy_get_next_buffer( ) ) | ||
1342 | { | ||
1343 | case EOB_ACT_END_OF_FILE: | ||
1344 | { | ||
1345 | (yy_did_buffer_switch_on_eof) = 0; | ||
1346 | |||
1347 | if ( zconfwrap( ) ) | ||
1348 | { | ||
1349 | /* Note: because we've taken care in | ||
1350 | * yy_get_next_buffer() to have set up | ||
1351 | * zconftext, we can now set up | ||
1352 | * yy_c_buf_p so that if some total | ||
1353 | * hoser (like flex itself) wants to | ||
1354 | * call the scanner after we return the | ||
1355 | * YY_NULL, it'll still work - another | ||
1356 | * YY_NULL will get returned. | ||
1357 | */ | ||
1358 | (yy_c_buf_p) = (yytext_ptr) + YY_MORE_ADJ; | ||
1359 | |||
1360 | yy_act = YY_STATE_EOF(YY_START); | ||
1361 | goto do_action; | ||
1362 | } | ||
1363 | |||
1364 | else | ||
1365 | { | ||
1366 | if ( ! (yy_did_buffer_switch_on_eof) ) | ||
1367 | YY_NEW_FILE; | ||
1368 | } | ||
1369 | break; | ||
1370 | } | ||
1371 | |||
1372 | case EOB_ACT_CONTINUE_SCAN: | ||
1373 | (yy_c_buf_p) = | ||
1374 | (yytext_ptr) + yy_amount_of_matched_text; | ||
1375 | |||
1376 | yy_current_state = yy_get_previous_state( ); | ||
1377 | |||
1378 | yy_cp = (yy_c_buf_p); | ||
1379 | yy_bp = (yytext_ptr) + YY_MORE_ADJ; | ||
1380 | goto yy_match; | ||
1381 | |||
1382 | case EOB_ACT_LAST_MATCH: | ||
1383 | (yy_c_buf_p) = | ||
1384 | &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)]; | ||
1385 | |||
1386 | yy_current_state = yy_get_previous_state( ); | ||
1387 | |||
1388 | yy_cp = (yy_c_buf_p); | ||
1389 | yy_bp = (yytext_ptr) + YY_MORE_ADJ; | ||
1390 | goto yy_find_action; | ||
1391 | } | ||
1392 | break; | ||
1393 | } | ||
1394 | |||
1395 | default: | ||
1396 | YY_FATAL_ERROR( | ||
1397 | "fatal flex scanner internal error--no action found" ); | ||
1398 | } /* end of action switch */ | ||
1399 | } /* end of scanning one token */ | ||
1400 | } /* end of zconflex */ | ||
1401 | |||
1402 | /* yy_get_next_buffer - try to read in a new buffer | ||
1403 | * | ||
1404 | * Returns a code representing an action: | ||
1405 | * EOB_ACT_LAST_MATCH - | ||
1406 | * EOB_ACT_CONTINUE_SCAN - continue scanning from current position | ||
1407 | * EOB_ACT_END_OF_FILE - end of file | ||
1408 | */ | ||
1409 | static int yy_get_next_buffer (void) | ||
1410 | { | ||
1411 | register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf; | ||
1412 | register char *source = (yytext_ptr); | ||
1413 | register int number_to_move, i; | ||
1414 | int ret_val; | ||
1415 | |||
1416 | if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] ) | ||
1417 | YY_FATAL_ERROR( | ||
1418 | "fatal flex scanner internal error--end of buffer missed" ); | ||
1419 | |||
1420 | if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 ) | ||
1421 | { /* Don't try to fill the buffer, so this is an EOF. */ | ||
1422 | if ( (yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1 ) | ||
1423 | { | ||
1424 | /* We matched a single character, the EOB, so | ||
1425 | * treat this as a final EOF. | ||
1426 | */ | ||
1427 | return EOB_ACT_END_OF_FILE; | ||
1428 | } | ||
1429 | |||
1430 | else | ||
1431 | { | ||
1432 | /* We matched some text prior to the EOB, first | ||
1433 | * process it. | ||
1434 | */ | ||
1435 | return EOB_ACT_LAST_MATCH; | ||
1436 | } | ||
1437 | } | ||
1438 | |||
1439 | /* Try to read more data. */ | ||
1440 | |||
1441 | /* First move last chars to start of buffer. */ | ||
1442 | number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr)) - 1; | ||
1443 | |||
1444 | for ( i = 0; i < number_to_move; ++i ) | ||
1445 | *(dest++) = *(source++); | ||
1446 | |||
1447 | if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING ) | ||
1448 | /* don't do the read, it's not guaranteed to return an EOF, | ||
1449 | * just force an EOF | ||
1450 | */ | ||
1451 | YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0; | ||
1452 | |||
1453 | else | ||
1454 | { | ||
1455 | size_t num_to_read = | ||
1456 | YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1; | ||
1457 | |||
1458 | while ( num_to_read <= 0 ) | ||
1459 | { /* Not enough room in the buffer - grow it. */ | ||
1460 | |||
1461 | /* just a shorter name for the current buffer */ | ||
1462 | YY_BUFFER_STATE b = YY_CURRENT_BUFFER; | ||
1463 | |||
1464 | int yy_c_buf_p_offset = | ||
1465 | (int) ((yy_c_buf_p) - b->yy_ch_buf); | ||
1466 | |||
1467 | if ( b->yy_is_our_buffer ) | ||
1468 | { | ||
1469 | int new_size = b->yy_buf_size * 2; | ||
1470 | |||
1471 | if ( new_size <= 0 ) | ||
1472 | b->yy_buf_size += b->yy_buf_size / 8; | ||
1473 | else | ||
1474 | b->yy_buf_size *= 2; | ||
1475 | |||
1476 | b->yy_ch_buf = (char *) | ||
1477 | /* Include room in for 2 EOB chars. */ | ||
1478 | zconfrealloc((void *) b->yy_ch_buf,b->yy_buf_size + 2 ); | ||
1479 | } | ||
1480 | else | ||
1481 | /* Can't grow it, we don't own it. */ | ||
1482 | b->yy_ch_buf = 0; | ||
1483 | |||
1484 | if ( ! b->yy_ch_buf ) | ||
1485 | YY_FATAL_ERROR( | ||
1486 | "fatal error - scanner input buffer overflow" ); | ||
1487 | |||
1488 | (yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset]; | ||
1489 | |||
1490 | num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size - | ||
1491 | number_to_move - 1; | ||
1492 | |||
1493 | } | ||
1494 | |||
1495 | if ( num_to_read > YY_READ_BUF_SIZE ) | ||
1496 | num_to_read = YY_READ_BUF_SIZE; | ||
1497 | |||
1498 | /* Read in more data. */ | ||
1499 | YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]), | ||
1500 | (yy_n_chars), num_to_read ); | ||
1501 | |||
1502 | YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); | ||
1503 | } | ||
1504 | |||
1505 | if ( (yy_n_chars) == 0 ) | ||
1506 | { | ||
1507 | if ( number_to_move == YY_MORE_ADJ ) | ||
1508 | { | ||
1509 | ret_val = EOB_ACT_END_OF_FILE; | ||
1510 | zconfrestart(zconfin ); | ||
1511 | } | ||
1512 | |||
1513 | else | ||
1514 | { | ||
1515 | ret_val = EOB_ACT_LAST_MATCH; | ||
1516 | YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = | ||
1517 | YY_BUFFER_EOF_PENDING; | ||
1518 | } | ||
1519 | } | ||
1520 | |||
1521 | else | ||
1522 | ret_val = EOB_ACT_CONTINUE_SCAN; | ||
1523 | |||
1524 | (yy_n_chars) += number_to_move; | ||
1525 | YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR; | ||
1526 | YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR; | ||
1527 | |||
1528 | (yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0]; | ||
1529 | |||
1530 | return ret_val; | ||
1531 | } | ||
1532 | |||
1533 | /* yy_get_previous_state - get the state just before the EOB char was reached */ | ||
1534 | |||
1535 | static yy_state_type yy_get_previous_state (void) | ||
1536 | { | ||
1537 | register yy_state_type yy_current_state; | ||
1538 | register char *yy_cp; | ||
1539 | |||
1540 | yy_current_state = (yy_start); | ||
1541 | |||
1542 | for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp ) | ||
1543 | { | ||
1544 | yy_current_state = yy_nxt[yy_current_state][(*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1)]; | ||
1545 | } | ||
1546 | |||
1547 | return yy_current_state; | ||
1548 | } | ||
1549 | |||
1550 | /* yy_try_NUL_trans - try to make a transition on the NUL character | ||
1551 | * | ||
1552 | * synopsis | ||
1553 | * next_state = yy_try_NUL_trans( current_state ); | ||
1554 | */ | ||
1555 | static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state ) | ||
1556 | { | ||
1557 | register int yy_is_jam; | ||
1558 | |||
1559 | yy_current_state = yy_nxt[yy_current_state][1]; | ||
1560 | yy_is_jam = (yy_current_state <= 0); | ||
1561 | |||
1562 | return yy_is_jam ? 0 : yy_current_state; | ||
1563 | } | ||
1564 | |||
1565 | static void yyunput (int c, register char * yy_bp ) | ||
1566 | { | ||
1567 | register char *yy_cp; | ||
1568 | |||
1569 | yy_cp = (yy_c_buf_p); | ||
1570 | |||
1571 | /* undo effects of setting up zconftext */ | ||
1572 | *yy_cp = (yy_hold_char); | ||
1573 | |||
1574 | if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 ) | ||
1575 | { /* need to shift things up to make room */ | ||
1576 | /* +2 for EOB chars. */ | ||
1577 | register int number_to_move = (yy_n_chars) + 2; | ||
1578 | register char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[ | ||
1579 | YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2]; | ||
1580 | register char *source = | ||
1581 | &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]; | ||
1582 | |||
1583 | while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) | ||
1584 | *--dest = *--source; | ||
1585 | |||
1586 | yy_cp += (int) (dest - source); | ||
1587 | yy_bp += (int) (dest - source); | ||
1588 | YY_CURRENT_BUFFER_LVALUE->yy_n_chars = | ||
1589 | (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_buf_size; | ||
1590 | |||
1591 | if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 ) | ||
1592 | YY_FATAL_ERROR( "flex scanner push-back overflow" ); | ||
1593 | } | ||
1594 | |||
1595 | *--yy_cp = (char) c; | ||
1596 | |||
1597 | (yytext_ptr) = yy_bp; | ||
1598 | (yy_hold_char) = *yy_cp; | ||
1599 | (yy_c_buf_p) = yy_cp; | ||
1600 | } | ||
1601 | |||
1602 | #ifndef YY_NO_INPUT | ||
1603 | #ifdef __cplusplus | ||
1604 | static int yyinput (void) | ||
1605 | #else | ||
1606 | static int input (void) | ||
1607 | #endif | ||
1608 | |||
1609 | { | ||
1610 | int c; | ||
1611 | |||
1612 | *(yy_c_buf_p) = (yy_hold_char); | ||
1613 | |||
1614 | if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR ) | ||
1615 | { | ||
1616 | /* yy_c_buf_p now points to the character we want to return. | ||
1617 | * If this occurs *before* the EOB characters, then it's a | ||
1618 | * valid NUL; if not, then we've hit the end of the buffer. | ||
1619 | */ | ||
1620 | if ( (yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] ) | ||
1621 | /* This was really a NUL. */ | ||
1622 | *(yy_c_buf_p) = '\0'; | ||
1623 | |||
1624 | else | ||
1625 | { /* need more input */ | ||
1626 | int offset = (yy_c_buf_p) - (yytext_ptr); | ||
1627 | ++(yy_c_buf_p); | ||
1628 | |||
1629 | switch ( yy_get_next_buffer( ) ) | ||
1630 | { | ||
1631 | case EOB_ACT_LAST_MATCH: | ||
1632 | /* This happens because yy_g_n_b() | ||
1633 | * sees that we've accumulated a | ||
1634 | * token and flags that we need to | ||
1635 | * try matching the token before | ||
1636 | * proceeding. But for input(), | ||
1637 | * there's no matching to consider. | ||
1638 | * So convert the EOB_ACT_LAST_MATCH | ||
1639 | * to EOB_ACT_END_OF_FILE. | ||
1640 | */ | ||
1641 | |||
1642 | /* Reset buffer status. */ | ||
1643 | zconfrestart(zconfin ); | ||
1644 | |||
1645 | /*FALLTHROUGH*/ | ||
1646 | |||
1647 | case EOB_ACT_END_OF_FILE: | ||
1648 | { | ||
1649 | if ( zconfwrap( ) ) | ||
1650 | return EOF; | ||
1651 | |||
1652 | if ( ! (yy_did_buffer_switch_on_eof) ) | ||
1653 | YY_NEW_FILE; | ||
1654 | #ifdef __cplusplus | ||
1655 | return yyinput(); | ||
1656 | #else | ||
1657 | return input(); | ||
1658 | #endif | ||
1659 | } | ||
1660 | |||
1661 | case EOB_ACT_CONTINUE_SCAN: | ||
1662 | (yy_c_buf_p) = (yytext_ptr) + offset; | ||
1663 | break; | ||
1664 | } | ||
1665 | } | ||
1666 | } | ||
1667 | |||
1668 | c = *(unsigned char *) (yy_c_buf_p); /* cast for 8-bit char's */ | ||
1669 | *(yy_c_buf_p) = '\0'; /* preserve zconftext */ | ||
1670 | (yy_hold_char) = *++(yy_c_buf_p); | ||
1671 | |||
1672 | return c; | ||
1673 | } | ||
1674 | #endif /* ifndef YY_NO_INPUT */ | ||
1675 | |||
1676 | /** Immediately switch to a different input stream. | ||
1677 | * @param input_file A readable stream. | ||
1678 | * | ||
1679 | * @note This function does not reset the start condition to @c INITIAL . | ||
1680 | */ | ||
1681 | void zconfrestart (FILE * input_file ) | ||
1682 | { | ||
1683 | |||
1684 | if ( ! YY_CURRENT_BUFFER ){ | ||
1685 | zconfensure_buffer_stack (); | ||
1686 | YY_CURRENT_BUFFER_LVALUE = | ||
1687 | zconf_create_buffer(zconfin,YY_BUF_SIZE ); | ||
1688 | } | ||
1689 | |||
1690 | zconf_init_buffer(YY_CURRENT_BUFFER,input_file ); | ||
1691 | zconf_load_buffer_state( ); | ||
1692 | } | ||
1693 | |||
1694 | /** Switch to a different input buffer. | ||
1695 | * @param new_buffer The new input buffer. | ||
1696 | * | ||
1697 | */ | ||
1698 | void zconf_switch_to_buffer (YY_BUFFER_STATE new_buffer ) | ||
1699 | { | ||
1700 | |||
1701 | /* TODO. We should be able to replace this entire function body | ||
1702 | * with | ||
1703 | * zconfpop_buffer_state(); | ||
1704 | * zconfpush_buffer_state(new_buffer); | ||
1705 | */ | ||
1706 | zconfensure_buffer_stack (); | ||
1707 | if ( YY_CURRENT_BUFFER == new_buffer ) | ||
1708 | return; | ||
1709 | |||
1710 | if ( YY_CURRENT_BUFFER ) | ||
1711 | { | ||
1712 | /* Flush out information for old buffer. */ | ||
1713 | *(yy_c_buf_p) = (yy_hold_char); | ||
1714 | YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p); | ||
1715 | YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); | ||
1716 | } | ||
1717 | |||
1718 | YY_CURRENT_BUFFER_LVALUE = new_buffer; | ||
1719 | zconf_load_buffer_state( ); | ||
1720 | |||
1721 | /* We don't actually know whether we did this switch during | ||
1722 | * EOF (zconfwrap()) processing, but the only time this flag | ||
1723 | * is looked at is after zconfwrap() is called, so it's safe | ||
1724 | * to go ahead and always set it. | ||
1725 | */ | ||
1726 | (yy_did_buffer_switch_on_eof) = 1; | ||
1727 | } | ||
1728 | |||
1729 | static void zconf_load_buffer_state (void) | ||
1730 | { | ||
1731 | (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; | ||
1732 | (yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos; | ||
1733 | zconfin = YY_CURRENT_BUFFER_LVALUE->yy_input_file; | ||
1734 | (yy_hold_char) = *(yy_c_buf_p); | ||
1735 | } | ||
1736 | |||
1737 | /** Allocate and initialize an input buffer state. | ||
1738 | * @param file A readable stream. | ||
1739 | * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE. | ||
1740 | * | ||
1741 | * @return the allocated buffer state. | ||
1742 | */ | ||
1743 | YY_BUFFER_STATE zconf_create_buffer (FILE * file, int size ) | ||
1744 | { | ||
1745 | YY_BUFFER_STATE b; | ||
1746 | |||
1747 | b = (YY_BUFFER_STATE) zconfalloc(sizeof( struct yy_buffer_state ) ); | ||
1748 | if ( ! b ) | ||
1749 | YY_FATAL_ERROR( "out of dynamic memory in zconf_create_buffer()" ); | ||
1750 | |||
1751 | b->yy_buf_size = size; | ||
1752 | |||
1753 | /* yy_ch_buf has to be 2 characters longer than the size given because | ||
1754 | * we need to put in 2 end-of-buffer characters. | ||
1755 | */ | ||
1756 | b->yy_ch_buf = (char *) zconfalloc(b->yy_buf_size + 2 ); | ||
1757 | if ( ! b->yy_ch_buf ) | ||
1758 | YY_FATAL_ERROR( "out of dynamic memory in zconf_create_buffer()" ); | ||
1759 | |||
1760 | b->yy_is_our_buffer = 1; | ||
1761 | |||
1762 | zconf_init_buffer(b,file ); | ||
1763 | |||
1764 | return b; | ||
1765 | } | ||
1766 | |||
1767 | /** Destroy the buffer. | ||
1768 | * @param b a buffer created with zconf_create_buffer() | ||
1769 | * | ||
1770 | */ | ||
1771 | void zconf_delete_buffer (YY_BUFFER_STATE b ) | ||
1772 | { | ||
1773 | |||
1774 | if ( ! b ) | ||
1775 | return; | ||
1776 | |||
1777 | if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */ | ||
1778 | YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0; | ||
1779 | |||
1780 | if ( b->yy_is_our_buffer ) | ||
1781 | zconffree((void *) b->yy_ch_buf ); | ||
1782 | |||
1783 | zconffree((void *) b ); | ||
1784 | } | ||
1785 | |||
1786 | /* Initializes or reinitializes a buffer. | ||
1787 | * This function is sometimes called more than once on the same buffer, | ||
1788 | * such as during a zconfrestart() or at EOF. | ||
1789 | */ | ||
1790 | static void zconf_init_buffer (YY_BUFFER_STATE b, FILE * file ) | ||
1791 | |||
1792 | { | ||
1793 | int oerrno = errno; | ||
1794 | |||
1795 | zconf_flush_buffer(b ); | ||
1796 | |||
1797 | b->yy_input_file = file; | ||
1798 | b->yy_fill_buffer = 1; | ||
1799 | |||
1800 | /* If b is the current buffer, then zconf_init_buffer was _probably_ | ||
1801 | * called from zconfrestart() or through yy_get_next_buffer. | ||
1802 | * In that case, we don't want to reset the lineno or column. | ||
1803 | */ | ||
1804 | if (b != YY_CURRENT_BUFFER){ | ||
1805 | b->yy_bs_lineno = 1; | ||
1806 | b->yy_bs_column = 0; | ||
1807 | } | ||
1808 | |||
1809 | b->yy_is_interactive = 0; | ||
1810 | |||
1811 | errno = oerrno; | ||
1812 | } | ||
1813 | |||
1814 | /** Discard all buffered characters. On the next scan, YY_INPUT will be called. | ||
1815 | * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER. | ||
1816 | * | ||
1817 | */ | ||
1818 | void zconf_flush_buffer (YY_BUFFER_STATE b ) | ||
1819 | { | ||
1820 | if ( ! b ) | ||
1821 | return; | ||
1822 | |||
1823 | b->yy_n_chars = 0; | ||
1824 | |||
1825 | /* We always need two end-of-buffer characters. The first causes | ||
1826 | * a transition to the end-of-buffer state. The second causes | ||
1827 | * a jam in that state. | ||
1828 | */ | ||
1829 | b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR; | ||
1830 | b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR; | ||
1831 | |||
1832 | b->yy_buf_pos = &b->yy_ch_buf[0]; | ||
1833 | |||
1834 | b->yy_at_bol = 1; | ||
1835 | b->yy_buffer_status = YY_BUFFER_NEW; | ||
1836 | |||
1837 | if ( b == YY_CURRENT_BUFFER ) | ||
1838 | zconf_load_buffer_state( ); | ||
1839 | } | ||
1840 | |||
1841 | /** Pushes the new state onto the stack. The new state becomes | ||
1842 | * the current state. This function will allocate the stack | ||
1843 | * if necessary. | ||
1844 | * @param new_buffer The new state. | ||
1845 | * | ||
1846 | */ | ||
1847 | void zconfpush_buffer_state (YY_BUFFER_STATE new_buffer ) | ||
1848 | { | ||
1849 | if (new_buffer == NULL) | ||
1850 | return; | ||
1851 | |||
1852 | zconfensure_buffer_stack(); | ||
1853 | |||
1854 | /* This block is copied from zconf_switch_to_buffer. */ | ||
1855 | if ( YY_CURRENT_BUFFER ) | ||
1856 | { | ||
1857 | /* Flush out information for old buffer. */ | ||
1858 | *(yy_c_buf_p) = (yy_hold_char); | ||
1859 | YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p); | ||
1860 | YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); | ||
1861 | } | ||
1862 | |||
1863 | /* Only push if top exists. Otherwise, replace top. */ | ||
1864 | if (YY_CURRENT_BUFFER) | ||
1865 | (yy_buffer_stack_top)++; | ||
1866 | YY_CURRENT_BUFFER_LVALUE = new_buffer; | ||
1867 | |||
1868 | /* copied from zconf_switch_to_buffer. */ | ||
1869 | zconf_load_buffer_state( ); | ||
1870 | (yy_did_buffer_switch_on_eof) = 1; | ||
1871 | } | ||
1872 | |||
1873 | /** Removes and deletes the top of the stack, if present. | ||
1874 | * The next element becomes the new top. | ||
1875 | * | ||
1876 | */ | ||
1877 | void zconfpop_buffer_state (void) | ||
1878 | { | ||
1879 | if (!YY_CURRENT_BUFFER) | ||
1880 | return; | ||
1881 | |||
1882 | zconf_delete_buffer(YY_CURRENT_BUFFER ); | ||
1883 | YY_CURRENT_BUFFER_LVALUE = NULL; | ||
1884 | if ((yy_buffer_stack_top) > 0) | ||
1885 | --(yy_buffer_stack_top); | ||
1886 | |||
1887 | if (YY_CURRENT_BUFFER) { | ||
1888 | zconf_load_buffer_state( ); | ||
1889 | (yy_did_buffer_switch_on_eof) = 1; | ||
1890 | } | ||
1891 | } | ||
1892 | |||
1893 | /* Allocates the stack if it does not exist. | ||
1894 | * Guarantees space for at least one push. | ||
1895 | */ | ||
1896 | static void zconfensure_buffer_stack (void) | ||
1897 | { | ||
1898 | int num_to_alloc; | ||
1899 | |||
1900 | if (!(yy_buffer_stack)) { | ||
1901 | |||
1902 | /* First allocation is just for 2 elements, since we don't know if this | ||
1903 | * scanner will even need a stack. We use 2 instead of 1 to avoid an | ||
1904 | * immediate realloc on the next call. | ||
1905 | */ | ||
1906 | num_to_alloc = 1; | ||
1907 | (yy_buffer_stack) = (struct yy_buffer_state**)zconfalloc | ||
1908 | (num_to_alloc * sizeof(struct yy_buffer_state*) | ||
1909 | ); | ||
1910 | |||
1911 | memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*)); | ||
1912 | |||
1913 | (yy_buffer_stack_max) = num_to_alloc; | ||
1914 | (yy_buffer_stack_top) = 0; | ||
1915 | return; | ||
1916 | } | ||
1917 | |||
1918 | if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){ | ||
1919 | |||
1920 | /* Increase the buffer to prepare for a possible push. */ | ||
1921 | int grow_size = 8 /* arbitrary grow size */; | ||
1922 | |||
1923 | num_to_alloc = (yy_buffer_stack_max) + grow_size; | ||
1924 | (yy_buffer_stack) = (struct yy_buffer_state**)zconfrealloc | ||
1925 | ((yy_buffer_stack), | ||
1926 | num_to_alloc * sizeof(struct yy_buffer_state*) | ||
1927 | ); | ||
1928 | |||
1929 | /* zero only the new slots.*/ | ||
1930 | memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*)); | ||
1931 | (yy_buffer_stack_max) = num_to_alloc; | ||
1932 | } | ||
1933 | } | ||
1934 | |||
1935 | /** Setup the input buffer state to scan directly from a user-specified character buffer. | ||
1936 | * @param base the character buffer | ||
1937 | * @param size the size in bytes of the character buffer | ||
1938 | * | ||
1939 | * @return the newly allocated buffer state object. | ||
1940 | */ | ||
1941 | YY_BUFFER_STATE zconf_scan_buffer (char * base, yy_size_t size ) | ||
1942 | { | ||
1943 | YY_BUFFER_STATE b; | ||
1944 | |||
1945 | if ( size < 2 || | ||
1946 | base[size-2] != YY_END_OF_BUFFER_CHAR || | ||
1947 | base[size-1] != YY_END_OF_BUFFER_CHAR ) | ||
1948 | /* They forgot to leave room for the EOB's. */ | ||
1949 | return 0; | ||
1950 | |||
1951 | b = (YY_BUFFER_STATE) zconfalloc(sizeof( struct yy_buffer_state ) ); | ||
1952 | if ( ! b ) | ||
1953 | YY_FATAL_ERROR( "out of dynamic memory in zconf_scan_buffer()" ); | ||
1954 | |||
1955 | b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */ | ||
1956 | b->yy_buf_pos = b->yy_ch_buf = base; | ||
1957 | b->yy_is_our_buffer = 0; | ||
1958 | b->yy_input_file = 0; | ||
1959 | b->yy_n_chars = b->yy_buf_size; | ||
1960 | b->yy_is_interactive = 0; | ||
1961 | b->yy_at_bol = 1; | ||
1962 | b->yy_fill_buffer = 0; | ||
1963 | b->yy_buffer_status = YY_BUFFER_NEW; | ||
1964 | |||
1965 | zconf_switch_to_buffer(b ); | ||
1966 | |||
1967 | return b; | ||
1968 | } | ||
1969 | |||
1970 | /** Setup the input buffer state to scan a string. The next call to zconflex() will | ||
1971 | * scan from a @e copy of @a str. | ||
1972 | * @param yy_str a NUL-terminated string to scan | ||
1973 | * | ||
1974 | * @return the newly allocated buffer state object. | ||
1975 | * @note If you want to scan bytes that may contain NUL values, then use | ||
1976 | * zconf_scan_bytes() instead. | ||
1977 | */ | ||
1978 | YY_BUFFER_STATE zconf_scan_string (yyconst char * yy_str ) | ||
1979 | { | ||
1980 | |||
1981 | return zconf_scan_bytes(yy_str,strlen(yy_str) ); | ||
1982 | } | ||
1983 | |||
1984 | /** Setup the input buffer state to scan the given bytes. The next call to zconflex() will | ||
1985 | * scan from a @e copy of @a bytes. | ||
1986 | * @param bytes the byte buffer to scan | ||
1987 | * @param len the number of bytes in the buffer pointed to by @a bytes. | ||
1988 | * | ||
1989 | * @return the newly allocated buffer state object. | ||
1990 | */ | ||
1991 | YY_BUFFER_STATE zconf_scan_bytes (yyconst char * bytes, int len ) | ||
1992 | { | ||
1993 | YY_BUFFER_STATE b; | ||
1994 | char *buf; | ||
1995 | yy_size_t n; | ||
1996 | int i; | ||
1997 | |||
1998 | /* Get memory for full buffer, including space for trailing EOB's. */ | ||
1999 | n = len + 2; | ||
2000 | buf = (char *) zconfalloc(n ); | ||
2001 | if ( ! buf ) | ||
2002 | YY_FATAL_ERROR( "out of dynamic memory in zconf_scan_bytes()" ); | ||
2003 | |||
2004 | for ( i = 0; i < len; ++i ) | ||
2005 | buf[i] = bytes[i]; | ||
2006 | |||
2007 | buf[len] = buf[len+1] = YY_END_OF_BUFFER_CHAR; | ||
2008 | |||
2009 | b = zconf_scan_buffer(buf,n ); | ||
2010 | if ( ! b ) | ||
2011 | YY_FATAL_ERROR( "bad buffer in zconf_scan_bytes()" ); | ||
2012 | |||
2013 | /* It's okay to grow etc. this buffer, and we should throw it | ||
2014 | * away when we're done. | ||
2015 | */ | ||
2016 | b->yy_is_our_buffer = 1; | ||
2017 | |||
2018 | return b; | ||
2019 | } | ||
2020 | |||
2021 | #ifndef YY_EXIT_FAILURE | ||
2022 | #define YY_EXIT_FAILURE 2 | ||
2023 | #endif | ||
2024 | |||
2025 | static void yy_fatal_error (yyconst char* msg ) | ||
2026 | { | ||
2027 | (void) fprintf( stderr, "%s\n", msg ); | ||
2028 | exit( YY_EXIT_FAILURE ); | ||
2029 | } | ||
2030 | |||
2031 | /* Redefine yyless() so it works in section 3 code. */ | ||
2032 | |||
2033 | #undef yyless | ||
2034 | #define yyless(n) \ | ||
2035 | do \ | ||
2036 | { \ | ||
2037 | /* Undo effects of setting up zconftext. */ \ | ||
2038 | int yyless_macro_arg = (n); \ | ||
2039 | YY_LESS_LINENO(yyless_macro_arg);\ | ||
2040 | zconftext[zconfleng] = (yy_hold_char); \ | ||
2041 | (yy_c_buf_p) = zconftext + yyless_macro_arg; \ | ||
2042 | (yy_hold_char) = *(yy_c_buf_p); \ | ||
2043 | *(yy_c_buf_p) = '\0'; \ | ||
2044 | zconfleng = yyless_macro_arg; \ | ||
2045 | } \ | ||
2046 | while ( 0 ) | ||
2047 | |||
2048 | /* Accessor methods (get/set functions) to struct members. */ | ||
2049 | |||
2050 | /** Get the current line number. | ||
2051 | * | ||
2052 | */ | ||
2053 | int zconfget_lineno (void) | ||
2054 | { | ||
2055 | |||
2056 | return zconflineno; | ||
2057 | } | ||
2058 | |||
2059 | /** Get the input stream. | ||
2060 | * | ||
2061 | */ | ||
2062 | FILE *zconfget_in (void) | ||
2063 | { | ||
2064 | return zconfin; | ||
2065 | } | ||
2066 | |||
2067 | /** Get the output stream. | ||
2068 | * | ||
2069 | */ | ||
2070 | FILE *zconfget_out (void) | ||
2071 | { | ||
2072 | return zconfout; | ||
2073 | } | ||
2074 | |||
2075 | /** Get the length of the current token. | ||
2076 | * | ||
2077 | */ | ||
2078 | int zconfget_leng (void) | ||
2079 | { | ||
2080 | return zconfleng; | ||
2081 | } | ||
2082 | |||
2083 | /** Get the current token. | ||
2084 | * | ||
2085 | */ | ||
2086 | |||
2087 | char *zconfget_text (void) | ||
2088 | { | ||
2089 | return zconftext; | ||
2090 | } | ||
2091 | |||
2092 | /** Set the current line number. | ||
2093 | * @param line_number | ||
2094 | * | ||
2095 | */ | ||
2096 | void zconfset_lineno (int line_number ) | ||
2097 | { | ||
2098 | |||
2099 | zconflineno = line_number; | ||
2100 | } | ||
2101 | |||
2102 | /** Set the input stream. This does not discard the current | ||
2103 | * input buffer. | ||
2104 | * @param in_str A readable stream. | ||
2105 | * | ||
2106 | * @see zconf_switch_to_buffer | ||
2107 | */ | ||
2108 | void zconfset_in (FILE * in_str ) | ||
2109 | { | ||
2110 | zconfin = in_str ; | ||
2111 | } | ||
2112 | |||
2113 | void zconfset_out (FILE * out_str ) | ||
2114 | { | ||
2115 | zconfout = out_str ; | ||
2116 | } | ||
2117 | |||
2118 | int zconfget_debug (void) | ||
2119 | { | ||
2120 | return zconf_flex_debug; | ||
2121 | } | ||
2122 | |||
2123 | void zconfset_debug (int bdebug ) | ||
2124 | { | ||
2125 | zconf_flex_debug = bdebug ; | ||
2126 | } | ||
2127 | |||
2128 | /* zconflex_destroy is for both reentrant and non-reentrant scanners. */ | ||
2129 | int zconflex_destroy (void) | ||
2130 | { | ||
2131 | |||
2132 | /* Pop the buffer stack, destroying each element. */ | ||
2133 | while(YY_CURRENT_BUFFER){ | ||
2134 | zconf_delete_buffer(YY_CURRENT_BUFFER ); | ||
2135 | YY_CURRENT_BUFFER_LVALUE = NULL; | ||
2136 | zconfpop_buffer_state(); | ||
2137 | } | ||
2138 | |||
2139 | /* Destroy the stack itself. */ | ||
2140 | zconffree((yy_buffer_stack) ); | ||
2141 | (yy_buffer_stack) = NULL; | ||
2142 | |||
2143 | return 0; | ||
2144 | } | ||
2145 | |||
2146 | /* | ||
2147 | * Internal utility routines. | ||
2148 | */ | ||
2149 | |||
2150 | #ifndef yytext_ptr | ||
2151 | static void yy_flex_strncpy (char* s1, yyconst char * s2, int n ) | ||
2152 | { | ||
2153 | register int i; | ||
2154 | for ( i = 0; i < n; ++i ) | ||
2155 | s1[i] = s2[i]; | ||
2156 | } | ||
2157 | #endif | ||
2158 | |||
2159 | #ifdef YY_NEED_STRLEN | ||
2160 | static int yy_flex_strlen (yyconst char * s ) | ||
2161 | { | ||
2162 | register int n; | ||
2163 | for ( n = 0; s[n]; ++n ) | ||
2164 | ; | ||
2165 | |||
2166 | return n; | ||
2167 | } | ||
2168 | #endif | ||
2169 | |||
2170 | void *zconfalloc (yy_size_t size ) | ||
2171 | { | ||
2172 | return (void *) malloc( size ); | ||
2173 | } | ||
2174 | |||
2175 | void *zconfrealloc (void * ptr, yy_size_t size ) | ||
2176 | { | ||
2177 | /* The cast to (char *) in the following accommodates both | ||
2178 | * implementations that use char* generic pointers, and those | ||
2179 | * that use void* generic pointers. It works with the latter | ||
2180 | * because both ANSI C and C++ allow castless assignment from | ||
2181 | * any pointer type to void*, and deal with argument conversions | ||
2182 | * as though doing an assignment. | ||
2183 | */ | ||
2184 | return (void *) realloc( (char *) ptr, size ); | ||
2185 | } | ||
2186 | |||
2187 | void zconffree (void * ptr ) | ||
2188 | { | ||
2189 | free( (char *) ptr ); /* see zconfrealloc() for (char *) cast */ | ||
2190 | } | ||
2191 | |||
2192 | #define YYTABLES_NAME "yytables" | ||
2193 | |||
2194 | #undef YY_NEW_FILE | ||
2195 | #undef YY_FLUSH_BUFFER | ||
2196 | #undef yy_set_bol | ||
2197 | #undef yy_new_buffer | ||
2198 | #undef yy_set_interactive | ||
2199 | #undef yytext_ptr | ||
2200 | #undef YY_DO_BEFORE_ACTION | ||
2201 | |||
2202 | #ifdef YY_DECL_IS_OURS | ||
2203 | #undef YY_DECL_IS_OURS | ||
2204 | #undef YY_DECL | ||
2205 | #endif | ||
2206 | |||
2207 | void zconf_starthelp(void) | ||
2208 | { | ||
2209 | new_string(); | ||
2210 | last_ts = first_ts = 0; | ||
2211 | BEGIN(HELP); | ||
2212 | } | ||
2213 | |||
2214 | static void zconf_endhelp(void) | ||
2215 | { | ||
2216 | zconflval.string = text; | ||
2217 | BEGIN(INITIAL); | ||
2218 | } | ||
2219 | |||
2220 | /* | ||
2221 | * Try to open specified file with following names: | ||
2222 | * ./name | ||
2223 | * $(srctree)/name | ||
2224 | * The latter is used when srctree is separate from objtree | ||
2225 | * when compiling the kernel. | ||
2226 | * Return NULL if file is not found. | ||
2227 | */ | ||
2228 | FILE *zconf_fopen(const char *name) | ||
2229 | { | ||
2230 | char *env, fullname[PATH_MAX+1]; | ||
2231 | FILE *f; | ||
2232 | |||
2233 | f = fopen(name, "r"); | ||
2234 | if (!f && name[0] != '/') { | ||
2235 | env = getenv(SRCTREE); | ||
2236 | if (env) { | ||
2237 | sprintf(fullname, "%s/%s", env, name); | ||
2238 | f = fopen(fullname, "r"); | ||
2239 | } | ||
2240 | } | ||
2241 | return f; | ||
2242 | } | ||
2243 | |||
2244 | void zconf_initscan(const char *name) | ||
2245 | { | ||
2246 | zconfin = zconf_fopen(name); | ||
2247 | if (!zconfin) { | ||
2248 | printf("can't find file %s\n", name); | ||
2249 | exit(1); | ||
2250 | } | ||
2251 | |||
2252 | current_buf = malloc(sizeof(*current_buf)); | ||
2253 | memset(current_buf, 0, sizeof(*current_buf)); | ||
2254 | |||
2255 | current_file = file_lookup(name); | ||
2256 | current_file->lineno = 1; | ||
2257 | current_file->flags = FILE_BUSY; | ||
2258 | } | ||
2259 | |||
2260 | void zconf_nextfile(const char *name) | ||
2261 | { | ||
2262 | struct file *file = file_lookup(name); | ||
2263 | struct buffer *buf = malloc(sizeof(*buf)); | ||
2264 | memset(buf, 0, sizeof(*buf)); | ||
2265 | |||
2266 | current_buf->state = YY_CURRENT_BUFFER; | ||
2267 | zconfin = zconf_fopen(name); | ||
2268 | if (!zconfin) { | ||
2269 | printf("%s:%d: can't open file \"%s\"\n", zconf_curname(), zconf_lineno(), name); | ||
2270 | exit(1); | ||
2271 | } | ||
2272 | zconf_switch_to_buffer(zconf_create_buffer(zconfin,YY_BUF_SIZE)); | ||
2273 | buf->parent = current_buf; | ||
2274 | current_buf = buf; | ||
2275 | |||
2276 | if (file->flags & FILE_BUSY) { | ||
2277 | printf("recursive scan (%s)?\n", name); | ||
2278 | exit(1); | ||
2279 | } | ||
2280 | if (file->flags & FILE_SCANNED) { | ||
2281 | printf("file %s already scanned?\n", name); | ||
2282 | exit(1); | ||
2283 | } | ||
2284 | file->flags |= FILE_BUSY; | ||
2285 | file->lineno = 1; | ||
2286 | file->parent = current_file; | ||
2287 | current_file = file; | ||
2288 | } | ||
2289 | |||
2290 | static void zconf_endfile(void) | ||
2291 | { | ||
2292 | struct buffer *parent; | ||
2293 | |||
2294 | current_file->flags |= FILE_SCANNED; | ||
2295 | current_file->flags &= ~FILE_BUSY; | ||
2296 | current_file = current_file->parent; | ||
2297 | |||
2298 | parent = current_buf->parent; | ||
2299 | if (parent) { | ||
2300 | fclose(zconfin); | ||
2301 | zconf_delete_buffer(YY_CURRENT_BUFFER); | ||
2302 | zconf_switch_to_buffer(parent->state); | ||
2303 | } | ||
2304 | free(current_buf); | ||
2305 | current_buf = parent; | ||
2306 | } | ||
2307 | |||
2308 | int zconf_lineno(void) | ||
2309 | { | ||
2310 | return current_pos.lineno; | ||
2311 | } | ||
2312 | |||
2313 | char *zconf_curname(void) | ||
2314 | { | ||
2315 | return current_pos.file ? current_pos.file->name : "<none>"; | ||
2316 | } | ||
2317 | |||
diff --git a/scripts/kconfig/lkc.h b/scripts/kconfig/lkc.h new file mode 100644 index 000000000..527f60c99 --- /dev/null +++ b/scripts/kconfig/lkc.h | |||
@@ -0,0 +1,147 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org> | ||
3 | * Released under the terms of the GNU GPL v2.0. | ||
4 | */ | ||
5 | |||
6 | #ifndef LKC_H | ||
7 | #define LKC_H | ||
8 | |||
9 | #include "expr.h" | ||
10 | |||
11 | #ifndef KBUILD_NO_NLS | ||
12 | # include <libintl.h> | ||
13 | #else | ||
14 | # define gettext(Msgid) ((const char *) (Msgid)) | ||
15 | # define textdomain(Domainname) ((const char *) (Domainname)) | ||
16 | # define bindtextdomain(Domainname, Dirname) ((const char *) (Dirname)) | ||
17 | #endif | ||
18 | |||
19 | #ifdef __cplusplus | ||
20 | extern "C" { | ||
21 | #endif | ||
22 | |||
23 | #ifdef LKC_DIRECT_LINK | ||
24 | #define P(name,type,arg) extern type name arg | ||
25 | #else | ||
26 | #include "lkc_defs.h" | ||
27 | #define P(name,type,arg) extern type (*name ## _p) arg | ||
28 | #endif | ||
29 | #include "lkc_proto.h" | ||
30 | #undef P | ||
31 | |||
32 | #define SRCTREE "srctree" | ||
33 | |||
34 | #define PACKAGE "linux" | ||
35 | #define LOCALEDIR "/usr/share/locale" | ||
36 | |||
37 | #define _(text) gettext(text) | ||
38 | #define N_(text) (text) | ||
39 | |||
40 | |||
41 | #define TF_COMMAND 0x0001 | ||
42 | #define TF_PARAM 0x0002 | ||
43 | |||
44 | struct kconf_id { | ||
45 | int name; | ||
46 | int token; | ||
47 | unsigned int flags; | ||
48 | enum symbol_type stype; | ||
49 | }; | ||
50 | |||
51 | int zconfparse(void); | ||
52 | void zconfdump(FILE *out); | ||
53 | |||
54 | extern int zconfdebug; | ||
55 | void zconf_starthelp(void); | ||
56 | FILE *zconf_fopen(const char *name); | ||
57 | void zconf_initscan(const char *name); | ||
58 | void zconf_nextfile(const char *name); | ||
59 | int zconf_lineno(void); | ||
60 | char *zconf_curname(void); | ||
61 | |||
62 | /* confdata.c */ | ||
63 | extern const char conf_def_filename[]; | ||
64 | |||
65 | char *conf_get_default_confname(void); | ||
66 | |||
67 | /* kconfig_load.c */ | ||
68 | void kconfig_load(void); | ||
69 | |||
70 | /* menu.c */ | ||
71 | void menu_init(void); | ||
72 | struct menu *menu_add_menu(void); | ||
73 | void menu_end_menu(void); | ||
74 | void menu_add_entry(struct symbol *sym); | ||
75 | void menu_end_entry(void); | ||
76 | void menu_add_dep(struct expr *dep); | ||
77 | struct property *menu_add_prop(enum prop_type type, char *prompt, struct expr *expr, struct expr *dep); | ||
78 | struct property *menu_add_prompt(enum prop_type type, char *prompt, struct expr *dep); | ||
79 | void menu_add_expr(enum prop_type type, struct expr *expr, struct expr *dep); | ||
80 | void menu_add_symbol(enum prop_type type, struct symbol *sym, struct expr *dep); | ||
81 | void menu_finalize(struct menu *parent); | ||
82 | void menu_set_type(int type); | ||
83 | |||
84 | /* util.c */ | ||
85 | struct file *file_lookup(const char *name); | ||
86 | int file_write_dep(const char *name); | ||
87 | |||
88 | struct gstr { | ||
89 | size_t len; | ||
90 | char *s; | ||
91 | }; | ||
92 | struct gstr str_new(void); | ||
93 | struct gstr str_assign(const char *s); | ||
94 | void str_free(struct gstr *gs); | ||
95 | void str_append(struct gstr *gs, const char *s); | ||
96 | void str_printf(struct gstr *gs, const char *fmt, ...); | ||
97 | const char *str_get(struct gstr *gs); | ||
98 | |||
99 | /* symbol.c */ | ||
100 | void sym_init(void); | ||
101 | void sym_clear_all_valid(void); | ||
102 | void sym_set_changed(struct symbol *sym); | ||
103 | struct symbol *sym_check_deps(struct symbol *sym); | ||
104 | struct property *prop_alloc(enum prop_type type, struct symbol *sym); | ||
105 | struct symbol *prop_get_symbol(struct property *prop); | ||
106 | |||
107 | static inline tristate sym_get_tristate_value(struct symbol *sym) | ||
108 | { | ||
109 | return sym->curr.tri; | ||
110 | } | ||
111 | |||
112 | |||
113 | static inline struct symbol *sym_get_choice_value(struct symbol *sym) | ||
114 | { | ||
115 | return (struct symbol *)sym->curr.val; | ||
116 | } | ||
117 | |||
118 | static inline bool sym_set_choice_value(struct symbol *ch, struct symbol *chval) | ||
119 | { | ||
120 | return sym_set_tristate_value(chval, yes); | ||
121 | } | ||
122 | |||
123 | static inline bool sym_is_choice(struct symbol *sym) | ||
124 | { | ||
125 | return sym->flags & SYMBOL_CHOICE ? true : false; | ||
126 | } | ||
127 | |||
128 | static inline bool sym_is_choice_value(struct symbol *sym) | ||
129 | { | ||
130 | return sym->flags & SYMBOL_CHOICEVAL ? true : false; | ||
131 | } | ||
132 | |||
133 | static inline bool sym_is_optional(struct symbol *sym) | ||
134 | { | ||
135 | return sym->flags & SYMBOL_OPTIONAL ? true : false; | ||
136 | } | ||
137 | |||
138 | static inline bool sym_has_value(struct symbol *sym) | ||
139 | { | ||
140 | return sym->flags & SYMBOL_NEW ? false : true; | ||
141 | } | ||
142 | |||
143 | #ifdef __cplusplus | ||
144 | } | ||
145 | #endif | ||
146 | |||
147 | #endif /* LKC_H */ | ||
diff --git a/scripts/kconfig/lkc_proto.h b/scripts/kconfig/lkc_proto.h new file mode 100644 index 000000000..b6a389c5f --- /dev/null +++ b/scripts/kconfig/lkc_proto.h | |||
@@ -0,0 +1,41 @@ | |||
1 | |||
2 | /* confdata.c */ | ||
3 | P(conf_parse,void,(const char *name)); | ||
4 | P(conf_read,int,(const char *name)); | ||
5 | P(conf_read_simple,int,(const char *name)); | ||
6 | P(conf_write,int,(const char *name)); | ||
7 | |||
8 | /* menu.c */ | ||
9 | P(rootmenu,struct menu,); | ||
10 | |||
11 | P(menu_is_visible,bool,(struct menu *menu)); | ||
12 | P(menu_get_prompt,const char *,(struct menu *menu)); | ||
13 | P(menu_get_root_menu,struct menu *,(struct menu *menu)); | ||
14 | P(menu_get_parent_menu,struct menu *,(struct menu *menu)); | ||
15 | |||
16 | /* symbol.c */ | ||
17 | P(symbol_hash,struct symbol *,[SYMBOL_HASHSIZE]); | ||
18 | P(sym_change_count,int,); | ||
19 | |||
20 | P(sym_lookup,struct symbol *,(const char *name, int isconst)); | ||
21 | P(sym_find,struct symbol *,(const char *name)); | ||
22 | P(sym_re_search,struct symbol **,(const char *pattern)); | ||
23 | P(sym_type_name,const char *,(enum symbol_type type)); | ||
24 | P(sym_calc_value,void,(struct symbol *sym)); | ||
25 | P(sym_get_type,enum symbol_type,(struct symbol *sym)); | ||
26 | P(sym_tristate_within_range,bool,(struct symbol *sym,tristate tri)); | ||
27 | P(sym_set_tristate_value,bool,(struct symbol *sym,tristate tri)); | ||
28 | P(sym_toggle_tristate_value,tristate,(struct symbol *sym)); | ||
29 | P(sym_string_valid,bool,(struct symbol *sym, const char *newval)); | ||
30 | P(sym_string_within_range,bool,(struct symbol *sym, const char *str)); | ||
31 | P(sym_set_string_value,bool,(struct symbol *sym, const char *newval)); | ||
32 | P(sym_is_changable,bool,(struct symbol *sym)); | ||
33 | P(sym_get_choice_prop,struct property *,(struct symbol *sym)); | ||
34 | P(sym_get_default_prop,struct property *,(struct symbol *sym)); | ||
35 | P(sym_get_string_value,const char *,(struct symbol *sym)); | ||
36 | |||
37 | P(prop_get_type_name,const char *,(enum prop_type type)); | ||
38 | |||
39 | /* expr.c */ | ||
40 | P(expr_compare_type,int,(enum expr_type t1, enum expr_type t2)); | ||
41 | P(expr_print,void,(struct expr *e, void (*fn)(void *, const char *), void *data, int prevtoken)); | ||
diff --git a/scripts/kconfig/lxdialog/BIG.FAT.WARNING b/scripts/kconfig/lxdialog/BIG.FAT.WARNING new file mode 100644 index 000000000..a8999d82b --- /dev/null +++ b/scripts/kconfig/lxdialog/BIG.FAT.WARNING | |||
@@ -0,0 +1,4 @@ | |||
1 | This is NOT the official version of dialog. This version has been | ||
2 | significantly modified from the original. It is for use by the Linux | ||
3 | kernel configuration script. Please do not bother Savio Lam with | ||
4 | questions about this program. | ||
diff --git a/scripts/kconfig/lxdialog/Makefile b/scripts/kconfig/lxdialog/Makefile new file mode 100644 index 000000000..a8b026326 --- /dev/null +++ b/scripts/kconfig/lxdialog/Makefile | |||
@@ -0,0 +1,21 @@ | |||
1 | # Makefile to build lxdialog package | ||
2 | # | ||
3 | |||
4 | check-lxdialog := $(srctree)/$(src)/check-lxdialog.sh | ||
5 | |||
6 | # Use reursively expanded variables so we do not call gcc unless | ||
7 | # we really need to do so. (Do not call gcc as part of make mrproper) | ||
8 | HOST_EXTRACFLAGS = $(shell $(CONFIG_SHELL) $(check-lxdialog) -ccflags) | ||
9 | HOST_LOADLIBES = $(shell $(CONFIG_SHELL) $(check-lxdialog) -ldflags $(HOSTCC)) | ||
10 | |||
11 | HOST_EXTRACFLAGS += -DLOCALE | ||
12 | |||
13 | PHONY += dochecklxdialog | ||
14 | $(obj)/dochecklxdialog: | ||
15 | $(Q)$(CONFIG_SHELL) $(check-lxdialog) -check $(HOSTCC) $(HOST_LOADLIBES) | ||
16 | |||
17 | hostprogs-y := lxdialog | ||
18 | always := $(hostprogs-y) dochecklxdialog | ||
19 | |||
20 | lxdialog-objs := checklist.o menubox.o textbox.o yesno.o inputbox.o \ | ||
21 | util.o lxdialog.o msgbox.o | ||
diff --git a/scripts/kconfig/lxdialog/check-lxdialog.sh b/scripts/kconfig/lxdialog/check-lxdialog.sh new file mode 100644 index 000000000..120d624e6 --- /dev/null +++ b/scripts/kconfig/lxdialog/check-lxdialog.sh | |||
@@ -0,0 +1,84 @@ | |||
1 | #!/bin/sh | ||
2 | # Check ncurses compatibility | ||
3 | |||
4 | # What library to link | ||
5 | ldflags() | ||
6 | { | ||
7 | $cc -print-file-name=libncursesw.so | grep -q / | ||
8 | if [ $? -eq 0 ]; then | ||
9 | echo '-lncursesw' | ||
10 | exit | ||
11 | fi | ||
12 | $cc -print-file-name=libncurses.so | grep -q / | ||
13 | if [ $? -eq 0 ]; then | ||
14 | echo '-lncurses' | ||
15 | exit | ||
16 | fi | ||
17 | $cc -print-file-name=libcurses.so | grep -q / | ||
18 | if [ $? -eq 0 ]; then | ||
19 | echo '-lcurses' | ||
20 | exit | ||
21 | fi | ||
22 | exit 1 | ||
23 | } | ||
24 | |||
25 | # Where is ncurses.h? | ||
26 | ccflags() | ||
27 | { | ||
28 | if [ -f /usr/include/ncurses/ncurses.h ]; then | ||
29 | echo '-I/usr/include/ncurses -DCURSES_LOC="<ncurses.h>"' | ||
30 | elif [ -f /usr/include/ncurses/curses.h ]; then | ||
31 | echo '-I/usr/include/ncurses -DCURSES_LOC="<ncurses/curses.h>"' | ||
32 | elif [ -f /usr/include/ncurses.h ]; then | ||
33 | echo '-DCURSES_LOC="<ncurses.h>"' | ||
34 | else | ||
35 | echo '-DCURSES_LOC="<curses.h>"' | ||
36 | fi | ||
37 | } | ||
38 | |||
39 | # Temp file, try to clean up after us | ||
40 | tmp=.lxdialog.tmp | ||
41 | trap "rm -f $tmp" 0 1 2 3 15 | ||
42 | |||
43 | # Check if we can link to ncurses | ||
44 | check() { | ||
45 | echo "main() {}" | $cc -xc - -o $tmp 2> /dev/null | ||
46 | if [ $? != 0 ]; then | ||
47 | echo " *** Unable to find the ncurses libraries." 1>&2 | ||
48 | echo " *** make menuconfig require the ncurses libraries" 1>&2 | ||
49 | echo " *** " 1>&2 | ||
50 | echo " *** Install ncurses (ncurses-devel) and try again" 1>&2 | ||
51 | echo " *** " 1>&2 | ||
52 | exit 1 | ||
53 | fi | ||
54 | } | ||
55 | |||
56 | usage() { | ||
57 | printf "Usage: $0 [-check compiler options|-header|-library]\n" | ||
58 | } | ||
59 | |||
60 | if [ $# == 0 ]; then | ||
61 | usage | ||
62 | exit 1 | ||
63 | fi | ||
64 | |||
65 | cc="" | ||
66 | case "$1" in | ||
67 | "-check") | ||
68 | shift | ||
69 | cc="$@" | ||
70 | check | ||
71 | ;; | ||
72 | "-ccflags") | ||
73 | ccflags | ||
74 | ;; | ||
75 | "-ldflags") | ||
76 | shift | ||
77 | cc="$@" | ||
78 | ldflags | ||
79 | ;; | ||
80 | "*") | ||
81 | usage | ||
82 | exit 1 | ||
83 | ;; | ||
84 | esac | ||
diff --git a/scripts/kconfig/lxdialog/checklist.c b/scripts/kconfig/lxdialog/checklist.c new file mode 100644 index 000000000..be0200e9c --- /dev/null +++ b/scripts/kconfig/lxdialog/checklist.c | |||
@@ -0,0 +1,333 @@ | |||
1 | /* | ||
2 | * checklist.c -- implements the checklist box | ||
3 | * | ||
4 | * ORIGINAL AUTHOR: Savio Lam (lam836@cs.cuhk.hk) | ||
5 | * Stuart Herbert - S.Herbert@sheffield.ac.uk: radiolist extension | ||
6 | * Alessandro Rubini - rubini@ipvvis.unipv.it: merged the two | ||
7 | * MODIFIED FOR LINUX KERNEL CONFIG BY: William Roadcap (roadcap@cfw.com) | ||
8 | * | ||
9 | * This program is free software; you can redistribute it and/or | ||
10 | * modify it under the terms of the GNU General Public License | ||
11 | * as published by the Free Software Foundation; either version 2 | ||
12 | * of the License, or (at your option) any later version. | ||
13 | * | ||
14 | * This program is distributed in the hope that it will be useful, | ||
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
17 | * GNU General Public License for more details. | ||
18 | * | ||
19 | * You should have received a copy of the GNU General Public License | ||
20 | * along with this program; if not, write to the Free Software | ||
21 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
22 | */ | ||
23 | |||
24 | #include "dialog.h" | ||
25 | |||
26 | static int list_width, check_x, item_x; | ||
27 | |||
28 | /* | ||
29 | * Print list item | ||
30 | */ | ||
31 | static void print_item(WINDOW * win, const char *item, int status, int choice, | ||
32 | int selected) | ||
33 | { | ||
34 | int i; | ||
35 | |||
36 | /* Clear 'residue' of last item */ | ||
37 | wattrset(win, menubox_attr); | ||
38 | wmove(win, choice, 0); | ||
39 | for (i = 0; i < list_width; i++) | ||
40 | waddch(win, ' '); | ||
41 | |||
42 | wmove(win, choice, check_x); | ||
43 | wattrset(win, selected ? check_selected_attr : check_attr); | ||
44 | wprintw(win, "(%c)", status ? 'X' : ' '); | ||
45 | |||
46 | wattrset(win, selected ? tag_selected_attr : tag_attr); | ||
47 | mvwaddch(win, choice, item_x, item[0]); | ||
48 | wattrset(win, selected ? item_selected_attr : item_attr); | ||
49 | waddstr(win, (char *)item + 1); | ||
50 | if (selected) { | ||
51 | wmove(win, choice, check_x + 1); | ||
52 | wrefresh(win); | ||
53 | } | ||
54 | } | ||
55 | |||
56 | /* | ||
57 | * Print the scroll indicators. | ||
58 | */ | ||
59 | static void print_arrows(WINDOW * win, int choice, int item_no, int scroll, | ||
60 | int y, int x, int height) | ||
61 | { | ||
62 | wmove(win, y, x); | ||
63 | |||
64 | if (scroll > 0) { | ||
65 | wattrset(win, uarrow_attr); | ||
66 | waddch(win, ACS_UARROW); | ||
67 | waddstr(win, "(-)"); | ||
68 | } else { | ||
69 | wattrset(win, menubox_attr); | ||
70 | waddch(win, ACS_HLINE); | ||
71 | waddch(win, ACS_HLINE); | ||
72 | waddch(win, ACS_HLINE); | ||
73 | waddch(win, ACS_HLINE); | ||
74 | } | ||
75 | |||
76 | y = y + height + 1; | ||
77 | wmove(win, y, x); | ||
78 | |||
79 | if ((height < item_no) && (scroll + choice < item_no - 1)) { | ||
80 | wattrset(win, darrow_attr); | ||
81 | waddch(win, ACS_DARROW); | ||
82 | waddstr(win, "(+)"); | ||
83 | } else { | ||
84 | wattrset(win, menubox_border_attr); | ||
85 | waddch(win, ACS_HLINE); | ||
86 | waddch(win, ACS_HLINE); | ||
87 | waddch(win, ACS_HLINE); | ||
88 | waddch(win, ACS_HLINE); | ||
89 | } | ||
90 | } | ||
91 | |||
92 | /* | ||
93 | * Display the termination buttons | ||
94 | */ | ||
95 | static void print_buttons(WINDOW * dialog, int height, int width, int selected) | ||
96 | { | ||
97 | int x = width / 2 - 11; | ||
98 | int y = height - 2; | ||
99 | |||
100 | print_button(dialog, "Select", y, x, selected == 0); | ||
101 | print_button(dialog, " Help ", y, x + 14, selected == 1); | ||
102 | |||
103 | wmove(dialog, y, x + 1 + 14 * selected); | ||
104 | wrefresh(dialog); | ||
105 | } | ||
106 | |||
107 | /* | ||
108 | * Display a dialog box with a list of options that can be turned on or off | ||
109 | * in the style of radiolist (only one option turned on at a time). | ||
110 | */ | ||
111 | int dialog_checklist(const char *title, const char *prompt, int height, | ||
112 | int width, int list_height, int item_no, | ||
113 | const char *const *items) | ||
114 | { | ||
115 | int i, x, y, box_x, box_y; | ||
116 | int key = 0, button = 0, choice = 0, scroll = 0, max_choice, *status; | ||
117 | WINDOW *dialog, *list; | ||
118 | |||
119 | /* Allocate space for storing item on/off status */ | ||
120 | if ((status = malloc(sizeof(int) * item_no)) == NULL) { | ||
121 | endwin(); | ||
122 | fprintf(stderr, | ||
123 | "\nCan't allocate memory in dialog_checklist().\n"); | ||
124 | exit(-1); | ||
125 | } | ||
126 | |||
127 | /* Initializes status */ | ||
128 | for (i = 0; i < item_no; i++) { | ||
129 | status[i] = !strcasecmp(items[i * 3 + 2], "on"); | ||
130 | if ((!choice && status[i]) | ||
131 | || !strcasecmp(items[i * 3 + 2], "selected")) | ||
132 | choice = i + 1; | ||
133 | } | ||
134 | if (choice) | ||
135 | choice--; | ||
136 | |||
137 | max_choice = MIN(list_height, item_no); | ||
138 | |||
139 | /* center dialog box on screen */ | ||
140 | x = (COLS - width) / 2; | ||
141 | y = (LINES - height) / 2; | ||
142 | |||
143 | draw_shadow(stdscr, y, x, height, width); | ||
144 | |||
145 | dialog = newwin(height, width, y, x); | ||
146 | keypad(dialog, TRUE); | ||
147 | |||
148 | draw_box(dialog, 0, 0, height, width, dialog_attr, border_attr); | ||
149 | wattrset(dialog, border_attr); | ||
150 | mvwaddch(dialog, height - 3, 0, ACS_LTEE); | ||
151 | for (i = 0; i < width - 2; i++) | ||
152 | waddch(dialog, ACS_HLINE); | ||
153 | wattrset(dialog, dialog_attr); | ||
154 | waddch(dialog, ACS_RTEE); | ||
155 | |||
156 | print_title(dialog, title, width); | ||
157 | |||
158 | wattrset(dialog, dialog_attr); | ||
159 | print_autowrap(dialog, prompt, width - 2, 1, 3); | ||
160 | |||
161 | list_width = width - 6; | ||
162 | box_y = height - list_height - 5; | ||
163 | box_x = (width - list_width) / 2 - 1; | ||
164 | |||
165 | /* create new window for the list */ | ||
166 | list = subwin(dialog, list_height, list_width, y + box_y + 1, | ||
167 | x + box_x + 1); | ||
168 | |||
169 | keypad(list, TRUE); | ||
170 | |||
171 | /* draw a box around the list items */ | ||
172 | draw_box(dialog, box_y, box_x, list_height + 2, list_width + 2, | ||
173 | menubox_border_attr, menubox_attr); | ||
174 | |||
175 | /* Find length of longest item in order to center checklist */ | ||
176 | check_x = 0; | ||
177 | for (i = 0; i < item_no; i++) | ||
178 | check_x = MAX(check_x, +strlen(items[i * 3 + 1]) + 4); | ||
179 | |||
180 | check_x = (list_width - check_x) / 2; | ||
181 | item_x = check_x + 4; | ||
182 | |||
183 | if (choice >= list_height) { | ||
184 | scroll = choice - list_height + 1; | ||
185 | choice -= scroll; | ||
186 | } | ||
187 | |||
188 | /* Print the list */ | ||
189 | for (i = 0; i < max_choice; i++) { | ||
190 | print_item(list, items[(scroll + i) * 3 + 1], | ||
191 | status[i + scroll], i, i == choice); | ||
192 | } | ||
193 | |||
194 | print_arrows(dialog, choice, item_no, scroll, | ||
195 | box_y, box_x + check_x + 5, list_height); | ||
196 | |||
197 | print_buttons(dialog, height, width, 0); | ||
198 | |||
199 | wnoutrefresh(dialog); | ||
200 | wnoutrefresh(list); | ||
201 | doupdate(); | ||
202 | |||
203 | while (key != ESC) { | ||
204 | key = wgetch(dialog); | ||
205 | |||
206 | for (i = 0; i < max_choice; i++) | ||
207 | if (toupper(key) == | ||
208 | toupper(items[(scroll + i) * 3 + 1][0])) | ||
209 | break; | ||
210 | |||
211 | if (i < max_choice || key == KEY_UP || key == KEY_DOWN || | ||
212 | key == '+' || key == '-') { | ||
213 | if (key == KEY_UP || key == '-') { | ||
214 | if (!choice) { | ||
215 | if (!scroll) | ||
216 | continue; | ||
217 | /* Scroll list down */ | ||
218 | if (list_height > 1) { | ||
219 | /* De-highlight current first item */ | ||
220 | print_item(list, items[scroll * 3 + 1], | ||
221 | status[scroll], 0, FALSE); | ||
222 | scrollok(list, TRUE); | ||
223 | wscrl(list, -1); | ||
224 | scrollok(list, FALSE); | ||
225 | } | ||
226 | scroll--; | ||
227 | print_item(list, items[scroll * 3 + 1], status[scroll], 0, TRUE); | ||
228 | print_arrows(dialog, choice, item_no, | ||
229 | scroll, box_y, box_x + check_x + 5, list_height); | ||
230 | |||
231 | wnoutrefresh(dialog); | ||
232 | wrefresh(list); | ||
233 | |||
234 | continue; /* wait for another key press */ | ||
235 | } else | ||
236 | i = choice - 1; | ||
237 | } else if (key == KEY_DOWN || key == '+') { | ||
238 | if (choice == max_choice - 1) { | ||
239 | if (scroll + choice >= item_no - 1) | ||
240 | continue; | ||
241 | /* Scroll list up */ | ||
242 | if (list_height > 1) { | ||
243 | /* De-highlight current last item before scrolling up */ | ||
244 | print_item(list, items[(scroll + max_choice - 1) * 3 + 1], | ||
245 | status[scroll + max_choice - 1], | ||
246 | max_choice - 1, FALSE); | ||
247 | scrollok(list, TRUE); | ||
248 | wscrl(list, 1); | ||
249 | scrollok(list, FALSE); | ||
250 | } | ||
251 | scroll++; | ||
252 | print_item(list, items[(scroll + max_choice - 1) * 3 + 1], | ||
253 | status[scroll + max_choice - 1], max_choice - 1, TRUE); | ||
254 | |||
255 | print_arrows(dialog, choice, item_no, | ||
256 | scroll, box_y, box_x + check_x + 5, list_height); | ||
257 | |||
258 | wnoutrefresh(dialog); | ||
259 | wrefresh(list); | ||
260 | |||
261 | continue; /* wait for another key press */ | ||
262 | } else | ||
263 | i = choice + 1; | ||
264 | } | ||
265 | if (i != choice) { | ||
266 | /* De-highlight current item */ | ||
267 | print_item(list, items[(scroll + choice) * 3 + 1], | ||
268 | status[scroll + choice], choice, FALSE); | ||
269 | /* Highlight new item */ | ||
270 | choice = i; | ||
271 | print_item(list, items[(scroll + choice) * 3 + 1], | ||
272 | status[scroll + choice], choice, TRUE); | ||
273 | wnoutrefresh(dialog); | ||
274 | wrefresh(list); | ||
275 | } | ||
276 | continue; /* wait for another key press */ | ||
277 | } | ||
278 | switch (key) { | ||
279 | case 'H': | ||
280 | case 'h': | ||
281 | case '?': | ||
282 | fprintf(stderr, "%s", items[(scroll + choice) * 3]); | ||
283 | delwin(dialog); | ||
284 | free(status); | ||
285 | return 1; | ||
286 | case TAB: | ||
287 | case KEY_LEFT: | ||
288 | case KEY_RIGHT: | ||
289 | button = ((key == KEY_LEFT ? --button : ++button) < 0) | ||
290 | ? 1 : (button > 1 ? 0 : button); | ||
291 | |||
292 | print_buttons(dialog, height, width, button); | ||
293 | wrefresh(dialog); | ||
294 | break; | ||
295 | case 'S': | ||
296 | case 's': | ||
297 | case ' ': | ||
298 | case '\n': | ||
299 | if (!button) { | ||
300 | if (!status[scroll + choice]) { | ||
301 | for (i = 0; i < item_no; i++) | ||
302 | status[i] = 0; | ||
303 | status[scroll + choice] = 1; | ||
304 | for (i = 0; i < max_choice; i++) | ||
305 | print_item(list, items[(scroll + i) * 3 + 1], | ||
306 | status[scroll + i], i, i == choice); | ||
307 | } | ||
308 | wnoutrefresh(dialog); | ||
309 | wrefresh(list); | ||
310 | |||
311 | for (i = 0; i < item_no; i++) | ||
312 | if (status[i]) | ||
313 | fprintf(stderr, "%s", items[i * 3]); | ||
314 | } else | ||
315 | fprintf(stderr, "%s", items[(scroll + choice) * 3]); | ||
316 | delwin(dialog); | ||
317 | free(status); | ||
318 | return button; | ||
319 | case 'X': | ||
320 | case 'x': | ||
321 | key = ESC; | ||
322 | case ESC: | ||
323 | break; | ||
324 | } | ||
325 | |||
326 | /* Now, update everything... */ | ||
327 | doupdate(); | ||
328 | } | ||
329 | |||
330 | delwin(dialog); | ||
331 | free(status); | ||
332 | return -1; /* ESC pressed */ | ||
333 | } | ||
diff --git a/scripts/kconfig/lxdialog/colors.h b/scripts/kconfig/lxdialog/colors.h new file mode 100644 index 000000000..db071df12 --- /dev/null +++ b/scripts/kconfig/lxdialog/colors.h | |||
@@ -0,0 +1,154 @@ | |||
1 | /* | ||
2 | * colors.h -- color attribute definitions | ||
3 | * | ||
4 | * AUTHOR: Savio Lam (lam836@cs.cuhk.hk) | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or | ||
7 | * modify it under the terms of the GNU General Public License | ||
8 | * as published by the Free Software Foundation; either version 2 | ||
9 | * of the License, or (at your option) any later version. | ||
10 | * | ||
11 | * This program is distributed in the hope that it will be useful, | ||
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
14 | * GNU General Public License for more details. | ||
15 | * | ||
16 | * You should have received a copy of the GNU General Public License | ||
17 | * along with this program; if not, write to the Free Software | ||
18 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
19 | */ | ||
20 | |||
21 | /* | ||
22 | * Default color definitions | ||
23 | * | ||
24 | * *_FG = foreground | ||
25 | * *_BG = background | ||
26 | * *_HL = highlight? | ||
27 | */ | ||
28 | #define SCREEN_FG COLOR_CYAN | ||
29 | #define SCREEN_BG COLOR_BLUE | ||
30 | #define SCREEN_HL TRUE | ||
31 | |||
32 | #define SHADOW_FG COLOR_BLACK | ||
33 | #define SHADOW_BG COLOR_BLACK | ||
34 | #define SHADOW_HL TRUE | ||
35 | |||
36 | #define DIALOG_FG COLOR_BLACK | ||
37 | #define DIALOG_BG COLOR_WHITE | ||
38 | #define DIALOG_HL FALSE | ||
39 | |||
40 | #define TITLE_FG COLOR_YELLOW | ||
41 | #define TITLE_BG COLOR_WHITE | ||
42 | #define TITLE_HL TRUE | ||
43 | |||
44 | #define BORDER_FG COLOR_WHITE | ||
45 | #define BORDER_BG COLOR_WHITE | ||
46 | #define BORDER_HL TRUE | ||
47 | |||
48 | #define BUTTON_ACTIVE_FG COLOR_WHITE | ||
49 | #define BUTTON_ACTIVE_BG COLOR_BLUE | ||
50 | #define BUTTON_ACTIVE_HL TRUE | ||
51 | |||
52 | #define BUTTON_INACTIVE_FG COLOR_BLACK | ||
53 | #define BUTTON_INACTIVE_BG COLOR_WHITE | ||
54 | #define BUTTON_INACTIVE_HL FALSE | ||
55 | |||
56 | #define BUTTON_KEY_ACTIVE_FG COLOR_WHITE | ||
57 | #define BUTTON_KEY_ACTIVE_BG COLOR_BLUE | ||
58 | #define BUTTON_KEY_ACTIVE_HL TRUE | ||
59 | |||
60 | #define BUTTON_KEY_INACTIVE_FG COLOR_RED | ||
61 | #define BUTTON_KEY_INACTIVE_BG COLOR_WHITE | ||
62 | #define BUTTON_KEY_INACTIVE_HL FALSE | ||
63 | |||
64 | #define BUTTON_LABEL_ACTIVE_FG COLOR_YELLOW | ||
65 | #define BUTTON_LABEL_ACTIVE_BG COLOR_BLUE | ||
66 | #define BUTTON_LABEL_ACTIVE_HL TRUE | ||
67 | |||
68 | #define BUTTON_LABEL_INACTIVE_FG COLOR_BLACK | ||
69 | #define BUTTON_LABEL_INACTIVE_BG COLOR_WHITE | ||
70 | #define BUTTON_LABEL_INACTIVE_HL TRUE | ||
71 | |||
72 | #define INPUTBOX_FG COLOR_BLACK | ||
73 | #define INPUTBOX_BG COLOR_WHITE | ||
74 | #define INPUTBOX_HL FALSE | ||
75 | |||
76 | #define INPUTBOX_BORDER_FG COLOR_BLACK | ||
77 | #define INPUTBOX_BORDER_BG COLOR_WHITE | ||
78 | #define INPUTBOX_BORDER_HL FALSE | ||
79 | |||
80 | #define SEARCHBOX_FG COLOR_BLACK | ||
81 | #define SEARCHBOX_BG COLOR_WHITE | ||
82 | #define SEARCHBOX_HL FALSE | ||
83 | |||
84 | #define SEARCHBOX_TITLE_FG COLOR_YELLOW | ||
85 | #define SEARCHBOX_TITLE_BG COLOR_WHITE | ||
86 | #define SEARCHBOX_TITLE_HL TRUE | ||
87 | |||
88 | #define SEARCHBOX_BORDER_FG COLOR_WHITE | ||
89 | #define SEARCHBOX_BORDER_BG COLOR_WHITE | ||
90 | #define SEARCHBOX_BORDER_HL TRUE | ||
91 | |||
92 | #define POSITION_INDICATOR_FG COLOR_YELLOW | ||
93 | #define POSITION_INDICATOR_BG COLOR_WHITE | ||
94 | #define POSITION_INDICATOR_HL TRUE | ||
95 | |||
96 | #define MENUBOX_FG COLOR_BLACK | ||
97 | #define MENUBOX_BG COLOR_WHITE | ||
98 | #define MENUBOX_HL FALSE | ||
99 | |||
100 | #define MENUBOX_BORDER_FG COLOR_WHITE | ||
101 | #define MENUBOX_BORDER_BG COLOR_WHITE | ||
102 | #define MENUBOX_BORDER_HL TRUE | ||
103 | |||
104 | #define ITEM_FG COLOR_BLACK | ||
105 | #define ITEM_BG COLOR_WHITE | ||
106 | #define ITEM_HL FALSE | ||
107 | |||
108 | #define ITEM_SELECTED_FG COLOR_WHITE | ||
109 | #define ITEM_SELECTED_BG COLOR_BLUE | ||
110 | #define ITEM_SELECTED_HL TRUE | ||
111 | |||
112 | #define TAG_FG COLOR_YELLOW | ||
113 | #define TAG_BG COLOR_WHITE | ||
114 | #define TAG_HL TRUE | ||
115 | |||
116 | #define TAG_SELECTED_FG COLOR_YELLOW | ||
117 | #define TAG_SELECTED_BG COLOR_BLUE | ||
118 | #define TAG_SELECTED_HL TRUE | ||
119 | |||
120 | #define TAG_KEY_FG COLOR_YELLOW | ||
121 | #define TAG_KEY_BG COLOR_WHITE | ||
122 | #define TAG_KEY_HL TRUE | ||
123 | |||
124 | #define TAG_KEY_SELECTED_FG COLOR_YELLOW | ||
125 | #define TAG_KEY_SELECTED_BG COLOR_BLUE | ||
126 | #define TAG_KEY_SELECTED_HL TRUE | ||
127 | |||
128 | #define CHECK_FG COLOR_BLACK | ||
129 | #define CHECK_BG COLOR_WHITE | ||
130 | #define CHECK_HL FALSE | ||
131 | |||
132 | #define CHECK_SELECTED_FG COLOR_WHITE | ||
133 | #define CHECK_SELECTED_BG COLOR_BLUE | ||
134 | #define CHECK_SELECTED_HL TRUE | ||
135 | |||
136 | #define UARROW_FG COLOR_GREEN | ||
137 | #define UARROW_BG COLOR_WHITE | ||
138 | #define UARROW_HL TRUE | ||
139 | |||
140 | #define DARROW_FG COLOR_GREEN | ||
141 | #define DARROW_BG COLOR_WHITE | ||
142 | #define DARROW_HL TRUE | ||
143 | |||
144 | /* End of default color definitions */ | ||
145 | |||
146 | #define C_ATTR(x,y) ((x ? A_BOLD : 0) | COLOR_PAIR((y))) | ||
147 | #define COLOR_NAME_LEN 10 | ||
148 | #define COLOR_COUNT 8 | ||
149 | |||
150 | /* | ||
151 | * Global variables | ||
152 | */ | ||
153 | |||
154 | extern int color_table[][3]; | ||
diff --git a/scripts/kconfig/lxdialog/dialog.h b/scripts/kconfig/lxdialog/dialog.h new file mode 100644 index 000000000..af3cf716e --- /dev/null +++ b/scripts/kconfig/lxdialog/dialog.h | |||
@@ -0,0 +1,177 @@ | |||
1 | /* | ||
2 | * dialog.h -- common declarations for all dialog modules | ||
3 | * | ||
4 | * AUTHOR: Savio Lam (lam836@cs.cuhk.hk) | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or | ||
7 | * modify it under the terms of the GNU General Public License | ||
8 | * as published by the Free Software Foundation; either version 2 | ||
9 | * of the License, or (at your option) any later version. | ||
10 | * | ||
11 | * This program is distributed in the hope that it will be useful, | ||
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
14 | * GNU General Public License for more details. | ||
15 | * | ||
16 | * You should have received a copy of the GNU General Public License | ||
17 | * along with this program; if not, write to the Free Software | ||
18 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
19 | */ | ||
20 | |||
21 | #include <sys/types.h> | ||
22 | #include <fcntl.h> | ||
23 | #include <unistd.h> | ||
24 | #include <ctype.h> | ||
25 | #include <stdlib.h> | ||
26 | #include <string.h> | ||
27 | |||
28 | #ifdef __sun__ | ||
29 | #define CURS_MACROS | ||
30 | #endif | ||
31 | #include CURSES_LOC | ||
32 | |||
33 | /* | ||
34 | * Colors in ncurses 1.9.9e do not work properly since foreground and | ||
35 | * background colors are OR'd rather than separately masked. This version | ||
36 | * of dialog was hacked to work with ncurses 1.9.9e, making it incompatible | ||
37 | * with standard curses. The simplest fix (to make this work with standard | ||
38 | * curses) uses the wbkgdset() function, not used in the original hack. | ||
39 | * Turn it off if we're building with 1.9.9e, since it just confuses things. | ||
40 | */ | ||
41 | #if defined(NCURSES_VERSION) && defined(_NEED_WRAP) && !defined(GCC_PRINTFLIKE) | ||
42 | #define OLD_NCURSES 1 | ||
43 | #undef wbkgdset | ||
44 | #define wbkgdset(w,p) /*nothing */ | ||
45 | #else | ||
46 | #define OLD_NCURSES 0 | ||
47 | #endif | ||
48 | |||
49 | #define TR(params) _tracef params | ||
50 | |||
51 | #define ESC 27 | ||
52 | #define TAB 9 | ||
53 | #define MAX_LEN 2048 | ||
54 | #define BUF_SIZE (10*1024) | ||
55 | #define MIN(x,y) (x < y ? x : y) | ||
56 | #define MAX(x,y) (x > y ? x : y) | ||
57 | |||
58 | #ifndef ACS_ULCORNER | ||
59 | #define ACS_ULCORNER '+' | ||
60 | #endif | ||
61 | #ifndef ACS_LLCORNER | ||
62 | #define ACS_LLCORNER '+' | ||
63 | #endif | ||
64 | #ifndef ACS_URCORNER | ||
65 | #define ACS_URCORNER '+' | ||
66 | #endif | ||
67 | #ifndef ACS_LRCORNER | ||
68 | #define ACS_LRCORNER '+' | ||
69 | #endif | ||
70 | #ifndef ACS_HLINE | ||
71 | #define ACS_HLINE '-' | ||
72 | #endif | ||
73 | #ifndef ACS_VLINE | ||
74 | #define ACS_VLINE '|' | ||
75 | #endif | ||
76 | #ifndef ACS_LTEE | ||
77 | #define ACS_LTEE '+' | ||
78 | #endif | ||
79 | #ifndef ACS_RTEE | ||
80 | #define ACS_RTEE '+' | ||
81 | #endif | ||
82 | #ifndef ACS_UARROW | ||
83 | #define ACS_UARROW '^' | ||
84 | #endif | ||
85 | #ifndef ACS_DARROW | ||
86 | #define ACS_DARROW 'v' | ||
87 | #endif | ||
88 | |||
89 | /* | ||
90 | * Attribute names | ||
91 | */ | ||
92 | #define screen_attr attributes[0] | ||
93 | #define shadow_attr attributes[1] | ||
94 | #define dialog_attr attributes[2] | ||
95 | #define title_attr attributes[3] | ||
96 | #define border_attr attributes[4] | ||
97 | #define button_active_attr attributes[5] | ||
98 | #define button_inactive_attr attributes[6] | ||
99 | #define button_key_active_attr attributes[7] | ||
100 | #define button_key_inactive_attr attributes[8] | ||
101 | #define button_label_active_attr attributes[9] | ||
102 | #define button_label_inactive_attr attributes[10] | ||
103 | #define inputbox_attr attributes[11] | ||
104 | #define inputbox_border_attr attributes[12] | ||
105 | #define searchbox_attr attributes[13] | ||
106 | #define searchbox_title_attr attributes[14] | ||
107 | #define searchbox_border_attr attributes[15] | ||
108 | #define position_indicator_attr attributes[16] | ||
109 | #define menubox_attr attributes[17] | ||
110 | #define menubox_border_attr attributes[18] | ||
111 | #define item_attr attributes[19] | ||
112 | #define item_selected_attr attributes[20] | ||
113 | #define tag_attr attributes[21] | ||
114 | #define tag_selected_attr attributes[22] | ||
115 | #define tag_key_attr attributes[23] | ||
116 | #define tag_key_selected_attr attributes[24] | ||
117 | #define check_attr attributes[25] | ||
118 | #define check_selected_attr attributes[26] | ||
119 | #define uarrow_attr attributes[27] | ||
120 | #define darrow_attr attributes[28] | ||
121 | |||
122 | /* number of attributes */ | ||
123 | #define ATTRIBUTE_COUNT 29 | ||
124 | |||
125 | /* | ||
126 | * Global variables | ||
127 | */ | ||
128 | extern bool use_colors; | ||
129 | extern bool use_shadow; | ||
130 | |||
131 | extern chtype attributes[]; | ||
132 | |||
133 | extern const char *backtitle; | ||
134 | |||
135 | /* | ||
136 | * Function prototypes | ||
137 | */ | ||
138 | extern void create_rc(const char *filename); | ||
139 | extern int parse_rc(void); | ||
140 | |||
141 | void init_dialog(void); | ||
142 | void end_dialog(void); | ||
143 | void attr_clear(WINDOW * win, int height, int width, chtype attr); | ||
144 | void dialog_clear(void); | ||
145 | void color_setup(void); | ||
146 | void print_autowrap(WINDOW * win, const char *prompt, int width, int y, int x); | ||
147 | void print_button(WINDOW * win, const char *label, int y, int x, int selected); | ||
148 | void print_title(WINDOW *dialog, const char *title, int width); | ||
149 | void draw_box(WINDOW * win, int y, int x, int height, int width, chtype box, | ||
150 | chtype border); | ||
151 | void draw_shadow(WINDOW * win, int y, int x, int height, int width); | ||
152 | |||
153 | int first_alpha(const char *string, const char *exempt); | ||
154 | int dialog_yesno(const char *title, const char *prompt, int height, int width); | ||
155 | int dialog_msgbox(const char *title, const char *prompt, int height, | ||
156 | int width, int pause); | ||
157 | int dialog_textbox(const char *title, const char *file, int height, int width); | ||
158 | int dialog_menu(const char *title, const char *prompt, int height, int width, | ||
159 | int menu_height, const char *choice, int item_no, | ||
160 | const char *const *items); | ||
161 | int dialog_checklist(const char *title, const char *prompt, int height, | ||
162 | int width, int list_height, int item_no, | ||
163 | const char *const *items); | ||
164 | extern char dialog_input_result[]; | ||
165 | int dialog_inputbox(const char *title, const char *prompt, int height, | ||
166 | int width, const char *init); | ||
167 | |||
168 | /* | ||
169 | * This is the base for fictitious keys, which activate | ||
170 | * the buttons. | ||
171 | * | ||
172 | * Mouse-generated keys are the following: | ||
173 | * -- the first 32 are used as numbers, in addition to '0'-'9' | ||
174 | * -- the lowercase are used to signal mouse-enter events (M_EVENT + 'o') | ||
175 | * -- uppercase chars are used to invoke the button (M_EVENT + 'O') | ||
176 | */ | ||
177 | #define M_EVENT (KEY_MAX+1) | ||
diff --git a/scripts/kconfig/lxdialog/inputbox.c b/scripts/kconfig/lxdialog/inputbox.c new file mode 100644 index 000000000..779503726 --- /dev/null +++ b/scripts/kconfig/lxdialog/inputbox.c | |||
@@ -0,0 +1,224 @@ | |||
1 | /* | ||
2 | * inputbox.c -- implements the input box | ||
3 | * | ||
4 | * ORIGINAL AUTHOR: Savio Lam (lam836@cs.cuhk.hk) | ||
5 | * MODIFIED FOR LINUX KERNEL CONFIG BY: William Roadcap (roadcap@cfw.com) | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or | ||
8 | * modify it under the terms of the GNU General Public License | ||
9 | * as published by the Free Software Foundation; either version 2 | ||
10 | * of the License, or (at your option) any later version. | ||
11 | * | ||
12 | * This program is distributed in the hope that it will be useful, | ||
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
15 | * GNU General Public License for more details. | ||
16 | * | ||
17 | * You should have received a copy of the GNU General Public License | ||
18 | * along with this program; if not, write to the Free Software | ||
19 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
20 | */ | ||
21 | |||
22 | #include "dialog.h" | ||
23 | |||
24 | char dialog_input_result[MAX_LEN + 1]; | ||
25 | |||
26 | /* | ||
27 | * Print the termination buttons | ||
28 | */ | ||
29 | static void print_buttons(WINDOW * dialog, int height, int width, int selected) | ||
30 | { | ||
31 | int x = width / 2 - 11; | ||
32 | int y = height - 2; | ||
33 | |||
34 | print_button(dialog, " Ok ", y, x, selected == 0); | ||
35 | print_button(dialog, " Help ", y, x + 14, selected == 1); | ||
36 | |||
37 | wmove(dialog, y, x + 1 + 14 * selected); | ||
38 | wrefresh(dialog); | ||
39 | } | ||
40 | |||
41 | /* | ||
42 | * Display a dialog box for inputing a string | ||
43 | */ | ||
44 | int dialog_inputbox(const char *title, const char *prompt, int height, int width, | ||
45 | const char *init) | ||
46 | { | ||
47 | int i, x, y, box_y, box_x, box_width; | ||
48 | int input_x = 0, scroll = 0, key = 0, button = -1; | ||
49 | char *instr = dialog_input_result; | ||
50 | WINDOW *dialog; | ||
51 | |||
52 | /* center dialog box on screen */ | ||
53 | x = (COLS - width) / 2; | ||
54 | y = (LINES - height) / 2; | ||
55 | |||
56 | draw_shadow(stdscr, y, x, height, width); | ||
57 | |||
58 | dialog = newwin(height, width, y, x); | ||
59 | keypad(dialog, TRUE); | ||
60 | |||
61 | draw_box(dialog, 0, 0, height, width, dialog_attr, border_attr); | ||
62 | wattrset(dialog, border_attr); | ||
63 | mvwaddch(dialog, height - 3, 0, ACS_LTEE); | ||
64 | for (i = 0; i < width - 2; i++) | ||
65 | waddch(dialog, ACS_HLINE); | ||
66 | wattrset(dialog, dialog_attr); | ||
67 | waddch(dialog, ACS_RTEE); | ||
68 | |||
69 | print_title(dialog, title, width); | ||
70 | |||
71 | wattrset(dialog, dialog_attr); | ||
72 | print_autowrap(dialog, prompt, width - 2, 1, 3); | ||
73 | |||
74 | /* Draw the input field box */ | ||
75 | box_width = width - 6; | ||
76 | getyx(dialog, y, x); | ||
77 | box_y = y + 2; | ||
78 | box_x = (width - box_width) / 2; | ||
79 | draw_box(dialog, y + 1, box_x - 1, 3, box_width + 2, border_attr, dialog_attr); | ||
80 | |||
81 | print_buttons(dialog, height, width, 0); | ||
82 | |||
83 | /* Set up the initial value */ | ||
84 | wmove(dialog, box_y, box_x); | ||
85 | wattrset(dialog, inputbox_attr); | ||
86 | |||
87 | if (!init) | ||
88 | instr[0] = '\0'; | ||
89 | else | ||
90 | strcpy(instr, init); | ||
91 | |||
92 | input_x = strlen(instr); | ||
93 | |||
94 | if (input_x >= box_width) { | ||
95 | scroll = input_x - box_width + 1; | ||
96 | input_x = box_width - 1; | ||
97 | for (i = 0; i < box_width - 1; i++) | ||
98 | waddch(dialog, instr[scroll + i]); | ||
99 | } else { | ||
100 | waddstr(dialog, instr); | ||
101 | } | ||
102 | |||
103 | wmove(dialog, box_y, box_x + input_x); | ||
104 | |||
105 | wrefresh(dialog); | ||
106 | |||
107 | while (key != ESC) { | ||
108 | key = wgetch(dialog); | ||
109 | |||
110 | if (button == -1) { /* Input box selected */ | ||
111 | switch (key) { | ||
112 | case TAB: | ||
113 | case KEY_UP: | ||
114 | case KEY_DOWN: | ||
115 | break; | ||
116 | case KEY_LEFT: | ||
117 | continue; | ||
118 | case KEY_RIGHT: | ||
119 | continue; | ||
120 | case KEY_BACKSPACE: | ||
121 | case 127: | ||
122 | if (input_x || scroll) { | ||
123 | wattrset(dialog, inputbox_attr); | ||
124 | if (!input_x) { | ||
125 | scroll = scroll < box_width - 1 ? 0 : scroll - (box_width - 1); | ||
126 | wmove(dialog, box_y, box_x); | ||
127 | for (i = 0; i < box_width; i++) | ||
128 | waddch(dialog, | ||
129 | instr[scroll + input_x + i] ? | ||
130 | instr[scroll + input_x + i] : ' '); | ||
131 | input_x = strlen(instr) - scroll; | ||
132 | } else | ||
133 | input_x--; | ||
134 | instr[scroll + input_x] = '\0'; | ||
135 | mvwaddch(dialog, box_y, input_x + box_x, ' '); | ||
136 | wmove(dialog, box_y, input_x + box_x); | ||
137 | wrefresh(dialog); | ||
138 | } | ||
139 | continue; | ||
140 | default: | ||
141 | if (key < 0x100 && isprint(key)) { | ||
142 | if (scroll + input_x < MAX_LEN) { | ||
143 | wattrset(dialog, inputbox_attr); | ||
144 | instr[scroll + input_x] = key; | ||
145 | instr[scroll + input_x + 1] = '\0'; | ||
146 | if (input_x == box_width - 1) { | ||
147 | scroll++; | ||
148 | wmove(dialog, box_y, box_x); | ||
149 | for (i = 0; i < box_width - 1; i++) | ||
150 | waddch(dialog, instr [scroll + i]); | ||
151 | } else { | ||
152 | wmove(dialog, box_y, input_x++ + box_x); | ||
153 | waddch(dialog, key); | ||
154 | } | ||
155 | wrefresh(dialog); | ||
156 | } else | ||
157 | flash(); /* Alarm user about overflow */ | ||
158 | continue; | ||
159 | } | ||
160 | } | ||
161 | } | ||
162 | switch (key) { | ||
163 | case 'O': | ||
164 | case 'o': | ||
165 | delwin(dialog); | ||
166 | return 0; | ||
167 | case 'H': | ||
168 | case 'h': | ||
169 | delwin(dialog); | ||
170 | return 1; | ||
171 | case KEY_UP: | ||
172 | case KEY_LEFT: | ||
173 | switch (button) { | ||
174 | case -1: | ||
175 | button = 1; /* Indicates "Cancel" button is selected */ | ||
176 | print_buttons(dialog, height, width, 1); | ||
177 | break; | ||
178 | case 0: | ||
179 | button = -1; /* Indicates input box is selected */ | ||
180 | print_buttons(dialog, height, width, 0); | ||
181 | wmove(dialog, box_y, box_x + input_x); | ||
182 | wrefresh(dialog); | ||
183 | break; | ||
184 | case 1: | ||
185 | button = 0; /* Indicates "OK" button is selected */ | ||
186 | print_buttons(dialog, height, width, 0); | ||
187 | break; | ||
188 | } | ||
189 | break; | ||
190 | case TAB: | ||
191 | case KEY_DOWN: | ||
192 | case KEY_RIGHT: | ||
193 | switch (button) { | ||
194 | case -1: | ||
195 | button = 0; /* Indicates "OK" button is selected */ | ||
196 | print_buttons(dialog, height, width, 0); | ||
197 | break; | ||
198 | case 0: | ||
199 | button = 1; /* Indicates "Cancel" button is selected */ | ||
200 | print_buttons(dialog, height, width, 1); | ||
201 | break; | ||
202 | case 1: | ||
203 | button = -1; /* Indicates input box is selected */ | ||
204 | print_buttons(dialog, height, width, 0); | ||
205 | wmove(dialog, box_y, box_x + input_x); | ||
206 | wrefresh(dialog); | ||
207 | break; | ||
208 | } | ||
209 | break; | ||
210 | case ' ': | ||
211 | case '\n': | ||
212 | delwin(dialog); | ||
213 | return (button == -1 ? 0 : button); | ||
214 | case 'X': | ||
215 | case 'x': | ||
216 | key = ESC; | ||
217 | case ESC: | ||
218 | break; | ||
219 | } | ||
220 | } | ||
221 | |||
222 | delwin(dialog); | ||
223 | return -1; /* ESC pressed */ | ||
224 | } | ||
diff --git a/scripts/kconfig/lxdialog/lxdialog.c b/scripts/kconfig/lxdialog/lxdialog.c new file mode 100644 index 000000000..79f6c5fb5 --- /dev/null +++ b/scripts/kconfig/lxdialog/lxdialog.c | |||
@@ -0,0 +1,204 @@ | |||
1 | /* | ||
2 | * dialog - Display simple dialog boxes from shell scripts | ||
3 | * | ||
4 | * ORIGINAL AUTHOR: Savio Lam (lam836@cs.cuhk.hk) | ||
5 | * MODIFIED FOR LINUX KERNEL CONFIG BY: William Roadcap (roadcap@cfw.com) | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or | ||
8 | * modify it under the terms of the GNU General Public License | ||
9 | * as published by the Free Software Foundation; either version 2 | ||
10 | * of the License, or (at your option) any later version. | ||
11 | * | ||
12 | * This program is distributed in the hope that it will be useful, | ||
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
15 | * GNU General Public License for more details. | ||
16 | * | ||
17 | * You should have received a copy of the GNU General Public License | ||
18 | * along with this program; if not, write to the Free Software | ||
19 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
20 | */ | ||
21 | |||
22 | #include "dialog.h" | ||
23 | |||
24 | static void Usage(const char *name); | ||
25 | |||
26 | typedef int (jumperFn) (const char *title, int argc, const char *const *argv); | ||
27 | |||
28 | struct Mode { | ||
29 | char *name; | ||
30 | int argmin, argmax, argmod; | ||
31 | jumperFn *jumper; | ||
32 | }; | ||
33 | |||
34 | jumperFn j_menu, j_radiolist, j_yesno, j_textbox, j_inputbox; | ||
35 | jumperFn j_msgbox, j_infobox; | ||
36 | |||
37 | static struct Mode modes[] = { | ||
38 | {"--menu", 9, 0, 3, j_menu}, | ||
39 | {"--radiolist", 9, 0, 3, j_radiolist}, | ||
40 | {"--yesno", 5, 5, 1, j_yesno}, | ||
41 | {"--textbox", 5, 5, 1, j_textbox}, | ||
42 | {"--inputbox", 5, 6, 1, j_inputbox}, | ||
43 | {"--msgbox", 5, 5, 1, j_msgbox}, | ||
44 | {"--infobox", 5, 5, 1, j_infobox}, | ||
45 | {NULL, 0, 0, 0, NULL} | ||
46 | }; | ||
47 | |||
48 | static struct Mode *modePtr; | ||
49 | |||
50 | #ifdef LOCALE | ||
51 | #include <locale.h> | ||
52 | #endif | ||
53 | |||
54 | int main(int argc, const char *const *argv) | ||
55 | { | ||
56 | int offset = 0, opt_clear = 0, end_common_opts = 0, retval; | ||
57 | const char *title = NULL; | ||
58 | |||
59 | #ifdef LOCALE | ||
60 | (void)setlocale(LC_ALL, ""); | ||
61 | #endif | ||
62 | |||
63 | #ifdef TRACE | ||
64 | trace(TRACE_CALLS | TRACE_UPDATE); | ||
65 | #endif | ||
66 | if (argc < 2) { | ||
67 | Usage(argv[0]); | ||
68 | exit(-1); | ||
69 | } | ||
70 | |||
71 | while (offset < argc - 1 && !end_common_opts) { /* Common options */ | ||
72 | if (!strcmp(argv[offset + 1], "--title")) { | ||
73 | if (argc - offset < 3 || title != NULL) { | ||
74 | Usage(argv[0]); | ||
75 | exit(-1); | ||
76 | } else { | ||
77 | title = argv[offset + 2]; | ||
78 | offset += 2; | ||
79 | } | ||
80 | } else if (!strcmp(argv[offset + 1], "--backtitle")) { | ||
81 | if (backtitle != NULL) { | ||
82 | Usage(argv[0]); | ||
83 | exit(-1); | ||
84 | } else { | ||
85 | backtitle = argv[offset + 2]; | ||
86 | offset += 2; | ||
87 | } | ||
88 | } else if (!strcmp(argv[offset + 1], "--clear")) { | ||
89 | if (opt_clear) { /* Hey, "--clear" can't appear twice! */ | ||
90 | Usage(argv[0]); | ||
91 | exit(-1); | ||
92 | } else if (argc == 2) { /* we only want to clear the screen */ | ||
93 | init_dialog(); | ||
94 | refresh(); /* init_dialog() will clear the screen for us */ | ||
95 | end_dialog(); | ||
96 | return 0; | ||
97 | } else { | ||
98 | opt_clear = 1; | ||
99 | offset++; | ||
100 | } | ||
101 | } else /* no more common options */ | ||
102 | end_common_opts = 1; | ||
103 | } | ||
104 | |||
105 | if (argc - 1 == offset) { /* no more options */ | ||
106 | Usage(argv[0]); | ||
107 | exit(-1); | ||
108 | } | ||
109 | /* use a table to look for the requested mode, to avoid code duplication */ | ||
110 | |||
111 | for (modePtr = modes; modePtr->name; modePtr++) /* look for the mode */ | ||
112 | if (!strcmp(argv[offset + 1], modePtr->name)) | ||
113 | break; | ||
114 | |||
115 | if (!modePtr->name) | ||
116 | Usage(argv[0]); | ||
117 | if (argc - offset < modePtr->argmin) | ||
118 | Usage(argv[0]); | ||
119 | if (modePtr->argmax && argc - offset > modePtr->argmax) | ||
120 | Usage(argv[0]); | ||
121 | |||
122 | init_dialog(); | ||
123 | retval = (*(modePtr->jumper)) (title, argc - offset, argv + offset); | ||
124 | |||
125 | if (opt_clear) { /* clear screen before exit */ | ||
126 | attr_clear(stdscr, LINES, COLS, screen_attr); | ||
127 | refresh(); | ||
128 | } | ||
129 | end_dialog(); | ||
130 | |||
131 | exit(retval); | ||
132 | } | ||
133 | |||
134 | /* | ||
135 | * Print program usage | ||
136 | */ | ||
137 | static void Usage(const char *name) | ||
138 | { | ||
139 | fprintf(stderr, "\ | ||
140 | \ndialog, by Savio Lam (lam836@cs.cuhk.hk).\ | ||
141 | \n patched by Stuart Herbert (S.Herbert@shef.ac.uk)\ | ||
142 | \n modified/gutted for use as a Linux kernel config tool by \ | ||
143 | \n William Roadcap (roadcapw@cfw.com)\ | ||
144 | \n\ | ||
145 | \n* Display dialog boxes from shell scripts *\ | ||
146 | \n\ | ||
147 | \nUsage: %s --clear\ | ||
148 | \n %s [--title <title>] [--backtitle <backtitle>] --clear <Box options>\ | ||
149 | \n\ | ||
150 | \nBox options:\ | ||
151 | \n\ | ||
152 | \n --menu <text> <height> <width> <menu height> <tag1> <item1>...\ | ||
153 | \n --radiolist <text> <height> <width> <list height> <tag1> <item1> <status1>...\ | ||
154 | \n --textbox <file> <height> <width>\ | ||
155 | \n --inputbox <text> <height> <width> [<init>]\ | ||
156 | \n --yesno <text> <height> <width>\ | ||
157 | \n", name, name); | ||
158 | exit(-1); | ||
159 | } | ||
160 | |||
161 | /* | ||
162 | * These are the program jumpers | ||
163 | */ | ||
164 | |||
165 | int j_menu(const char *t, int ac, const char *const *av) | ||
166 | { | ||
167 | return dialog_menu(t, av[2], atoi(av[3]), atoi(av[4]), | ||
168 | atoi(av[5]), av[6], (ac - 6) / 2, av + 7); | ||
169 | } | ||
170 | |||
171 | int j_radiolist(const char *t, int ac, const char *const *av) | ||
172 | { | ||
173 | return dialog_checklist(t, av[2], atoi(av[3]), atoi(av[4]), | ||
174 | atoi(av[5]), (ac - 6) / 3, av + 6); | ||
175 | } | ||
176 | |||
177 | int j_textbox(const char *t, int ac, const char *const *av) | ||
178 | { | ||
179 | return dialog_textbox(t, av[2], atoi(av[3]), atoi(av[4])); | ||
180 | } | ||
181 | |||
182 | int j_yesno(const char *t, int ac, const char *const *av) | ||
183 | { | ||
184 | return dialog_yesno(t, av[2], atoi(av[3]), atoi(av[4])); | ||
185 | } | ||
186 | |||
187 | int j_inputbox(const char *t, int ac, const char *const *av) | ||
188 | { | ||
189 | int ret = dialog_inputbox(t, av[2], atoi(av[3]), atoi(av[4]), | ||
190 | ac == 6 ? av[5] : (char *)NULL); | ||
191 | if (ret == 0) | ||
192 | fprintf(stderr, dialog_input_result); | ||
193 | return ret; | ||
194 | } | ||
195 | |||
196 | int j_msgbox(const char *t, int ac, const char *const *av) | ||
197 | { | ||
198 | return dialog_msgbox(t, av[2], atoi(av[3]), atoi(av[4]), 1); | ||
199 | } | ||
200 | |||
201 | int j_infobox(const char *t, int ac, const char *const *av) | ||
202 | { | ||
203 | return dialog_msgbox(t, av[2], atoi(av[3]), atoi(av[4]), 0); | ||
204 | } | ||
diff --git a/scripts/kconfig/lxdialog/menubox.c b/scripts/kconfig/lxdialog/menubox.c new file mode 100644 index 000000000..bf8052f4f --- /dev/null +++ b/scripts/kconfig/lxdialog/menubox.c | |||
@@ -0,0 +1,426 @@ | |||
1 | /* | ||
2 | * menubox.c -- implements the menu box | ||
3 | * | ||
4 | * ORIGINAL AUTHOR: Savio Lam (lam836@cs.cuhk.hk) | ||
5 | * MODIFIED FOR LINUX KERNEL CONFIG BY: William Roadcap (roadcapw@cfw.com) | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or | ||
8 | * modify it under the terms of the GNU General Public License | ||
9 | * as published by the Free Software Foundation; either version 2 | ||
10 | * of the License, or (at your option) any later version. | ||
11 | * | ||
12 | * This program is distributed in the hope that it will be useful, | ||
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
15 | * GNU General Public License for more details. | ||
16 | * | ||
17 | * You should have received a copy of the GNU General Public License | ||
18 | * along with this program; if not, write to the Free Software | ||
19 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
20 | */ | ||
21 | |||
22 | /* | ||
23 | * Changes by Clifford Wolf (god@clifford.at) | ||
24 | * | ||
25 | * [ 1998-06-13 ] | ||
26 | * | ||
27 | * *) A bugfix for the Page-Down problem | ||
28 | * | ||
29 | * *) Formerly when I used Page Down and Page Up, the cursor would be set | ||
30 | * to the first position in the menu box. Now lxdialog is a bit | ||
31 | * smarter and works more like other menu systems (just have a look at | ||
32 | * it). | ||
33 | * | ||
34 | * *) Formerly if I selected something my scrolling would be broken because | ||
35 | * lxdialog is re-invoked by the Menuconfig shell script, can't | ||
36 | * remember the last scrolling position, and just sets it so that the | ||
37 | * cursor is at the bottom of the box. Now it writes the temporary file | ||
38 | * lxdialog.scrltmp which contains this information. The file is | ||
39 | * deleted by lxdialog if the user leaves a submenu or enters a new | ||
40 | * one, but it would be nice if Menuconfig could make another "rm -f" | ||
41 | * just to be sure. Just try it out - you will recognise a difference! | ||
42 | * | ||
43 | * [ 1998-06-14 ] | ||
44 | * | ||
45 | * *) Now lxdialog is crash-safe against broken "lxdialog.scrltmp" files | ||
46 | * and menus change their size on the fly. | ||
47 | * | ||
48 | * *) If for some reason the last scrolling position is not saved by | ||
49 | * lxdialog, it sets the scrolling so that the selected item is in the | ||
50 | * middle of the menu box, not at the bottom. | ||
51 | * | ||
52 | * 02 January 1999, Michael Elizabeth Chastain (mec@shout.net) | ||
53 | * Reset 'scroll' to 0 if the value from lxdialog.scrltmp is bogus. | ||
54 | * This fixes a bug in Menuconfig where using ' ' to descend into menus | ||
55 | * would leave mis-synchronized lxdialog.scrltmp files lying around, | ||
56 | * fscanf would read in 'scroll', and eventually that value would get used. | ||
57 | */ | ||
58 | |||
59 | #include "dialog.h" | ||
60 | |||
61 | static int menu_width, item_x; | ||
62 | |||
63 | /* | ||
64 | * Print menu item | ||
65 | */ | ||
66 | static void do_print_item(WINDOW * win, const char *item, int choice, | ||
67 | int selected, int hotkey) | ||
68 | { | ||
69 | int j; | ||
70 | char *menu_item = malloc(menu_width + 1); | ||
71 | |||
72 | strncpy(menu_item, item, menu_width - item_x); | ||
73 | menu_item[menu_width] = 0; | ||
74 | j = first_alpha(menu_item, "YyNnMmHh"); | ||
75 | |||
76 | /* Clear 'residue' of last item */ | ||
77 | wattrset(win, menubox_attr); | ||
78 | wmove(win, choice, 0); | ||
79 | #if OLD_NCURSES | ||
80 | { | ||
81 | int i; | ||
82 | for (i = 0; i < menu_width; i++) | ||
83 | waddch(win, ' '); | ||
84 | } | ||
85 | #else | ||
86 | wclrtoeol(win); | ||
87 | #endif | ||
88 | wattrset(win, selected ? item_selected_attr : item_attr); | ||
89 | mvwaddstr(win, choice, item_x, menu_item); | ||
90 | if (hotkey) { | ||
91 | wattrset(win, selected ? tag_key_selected_attr : tag_key_attr); | ||
92 | mvwaddch(win, choice, item_x + j, menu_item[j]); | ||
93 | } | ||
94 | if (selected) { | ||
95 | wmove(win, choice, item_x + 1); | ||
96 | } | ||
97 | free(menu_item); | ||
98 | wrefresh(win); | ||
99 | } | ||
100 | |||
101 | #define print_item(index, choice, selected) \ | ||
102 | do {\ | ||
103 | int hotkey = (items[(index) * 2][0] != ':'); \ | ||
104 | do_print_item(menu, items[(index) * 2 + 1], choice, selected, hotkey); \ | ||
105 | } while (0) | ||
106 | |||
107 | /* | ||
108 | * Print the scroll indicators. | ||
109 | */ | ||
110 | static void print_arrows(WINDOW * win, int item_no, int scroll, int y, int x, | ||
111 | int height) | ||
112 | { | ||
113 | int cur_y, cur_x; | ||
114 | |||
115 | getyx(win, cur_y, cur_x); | ||
116 | |||
117 | wmove(win, y, x); | ||
118 | |||
119 | if (scroll > 0) { | ||
120 | wattrset(win, uarrow_attr); | ||
121 | waddch(win, ACS_UARROW); | ||
122 | waddstr(win, "(-)"); | ||
123 | } else { | ||
124 | wattrset(win, menubox_attr); | ||
125 | waddch(win, ACS_HLINE); | ||
126 | waddch(win, ACS_HLINE); | ||
127 | waddch(win, ACS_HLINE); | ||
128 | waddch(win, ACS_HLINE); | ||
129 | } | ||
130 | |||
131 | y = y + height + 1; | ||
132 | wmove(win, y, x); | ||
133 | wrefresh(win); | ||
134 | |||
135 | if ((height < item_no) && (scroll + height < item_no)) { | ||
136 | wattrset(win, darrow_attr); | ||
137 | waddch(win, ACS_DARROW); | ||
138 | waddstr(win, "(+)"); | ||
139 | } else { | ||
140 | wattrset(win, menubox_border_attr); | ||
141 | waddch(win, ACS_HLINE); | ||
142 | waddch(win, ACS_HLINE); | ||
143 | waddch(win, ACS_HLINE); | ||
144 | waddch(win, ACS_HLINE); | ||
145 | } | ||
146 | |||
147 | wmove(win, cur_y, cur_x); | ||
148 | wrefresh(win); | ||
149 | } | ||
150 | |||
151 | /* | ||
152 | * Display the termination buttons. | ||
153 | */ | ||
154 | static void print_buttons(WINDOW * win, int height, int width, int selected) | ||
155 | { | ||
156 | int x = width / 2 - 16; | ||
157 | int y = height - 2; | ||
158 | |||
159 | print_button(win, "Select", y, x, selected == 0); | ||
160 | print_button(win, " Exit ", y, x + 12, selected == 1); | ||
161 | print_button(win, " Help ", y, x + 24, selected == 2); | ||
162 | |||
163 | wmove(win, y, x + 1 + 12 * selected); | ||
164 | wrefresh(win); | ||
165 | } | ||
166 | |||
167 | /* scroll up n lines (n may be negative) */ | ||
168 | static void do_scroll(WINDOW *win, int *scroll, int n) | ||
169 | { | ||
170 | /* Scroll menu up */ | ||
171 | scrollok(win, TRUE); | ||
172 | wscrl(win, n); | ||
173 | scrollok(win, FALSE); | ||
174 | *scroll = *scroll + n; | ||
175 | wrefresh(win); | ||
176 | } | ||
177 | |||
178 | /* | ||
179 | * Display a menu for choosing among a number of options | ||
180 | */ | ||
181 | int dialog_menu(const char *title, const char *prompt, int height, int width, | ||
182 | int menu_height, const char *current, int item_no, | ||
183 | const char *const *items) | ||
184 | { | ||
185 | int i, j, x, y, box_x, box_y; | ||
186 | int key = 0, button = 0, scroll = 0, choice = 0; | ||
187 | int first_item = 0, max_choice; | ||
188 | WINDOW *dialog, *menu; | ||
189 | FILE *f; | ||
190 | |||
191 | max_choice = MIN(menu_height, item_no); | ||
192 | |||
193 | /* center dialog box on screen */ | ||
194 | x = (COLS - width) / 2; | ||
195 | y = (LINES - height) / 2; | ||
196 | |||
197 | draw_shadow(stdscr, y, x, height, width); | ||
198 | |||
199 | dialog = newwin(height, width, y, x); | ||
200 | keypad(dialog, TRUE); | ||
201 | |||
202 | draw_box(dialog, 0, 0, height, width, dialog_attr, border_attr); | ||
203 | wattrset(dialog, border_attr); | ||
204 | mvwaddch(dialog, height - 3, 0, ACS_LTEE); | ||
205 | for (i = 0; i < width - 2; i++) | ||
206 | waddch(dialog, ACS_HLINE); | ||
207 | wattrset(dialog, dialog_attr); | ||
208 | wbkgdset(dialog, dialog_attr & A_COLOR); | ||
209 | waddch(dialog, ACS_RTEE); | ||
210 | |||
211 | print_title(dialog, title, width); | ||
212 | |||
213 | wattrset(dialog, dialog_attr); | ||
214 | print_autowrap(dialog, prompt, width - 2, 1, 3); | ||
215 | |||
216 | menu_width = width - 6; | ||
217 | box_y = height - menu_height - 5; | ||
218 | box_x = (width - menu_width) / 2 - 1; | ||
219 | |||
220 | /* create new window for the menu */ | ||
221 | menu = subwin(dialog, menu_height, menu_width, | ||
222 | y + box_y + 1, x + box_x + 1); | ||
223 | keypad(menu, TRUE); | ||
224 | |||
225 | /* draw a box around the menu items */ | ||
226 | draw_box(dialog, box_y, box_x, menu_height + 2, menu_width + 2, | ||
227 | menubox_border_attr, menubox_attr); | ||
228 | |||
229 | item_x = (menu_width - 70) / 2; | ||
230 | |||
231 | /* Set choice to default item */ | ||
232 | for (i = 0; i < item_no; i++) | ||
233 | if (strcmp(current, items[i * 2]) == 0) | ||
234 | choice = i; | ||
235 | |||
236 | /* get the scroll info from the temp file */ | ||
237 | if ((f = fopen("lxdialog.scrltmp", "r")) != NULL) { | ||
238 | if ((fscanf(f, "%d\n", &scroll) == 1) && (scroll <= choice) && | ||
239 | (scroll + max_choice > choice) && (scroll >= 0) && | ||
240 | (scroll + max_choice <= item_no)) { | ||
241 | first_item = scroll; | ||
242 | choice = choice - scroll; | ||
243 | fclose(f); | ||
244 | } else { | ||
245 | scroll = 0; | ||
246 | remove("lxdialog.scrltmp"); | ||
247 | fclose(f); | ||
248 | f = NULL; | ||
249 | } | ||
250 | } | ||
251 | if ((choice >= max_choice) || (f == NULL && choice >= max_choice / 2)) { | ||
252 | if (choice >= item_no - max_choice / 2) | ||
253 | scroll = first_item = item_no - max_choice; | ||
254 | else | ||
255 | scroll = first_item = choice - max_choice / 2; | ||
256 | choice = choice - scroll; | ||
257 | } | ||
258 | |||
259 | /* Print the menu */ | ||
260 | for (i = 0; i < max_choice; i++) { | ||
261 | print_item(first_item + i, i, i == choice); | ||
262 | } | ||
263 | |||
264 | wnoutrefresh(menu); | ||
265 | |||
266 | print_arrows(dialog, item_no, scroll, | ||
267 | box_y, box_x + item_x + 1, menu_height); | ||
268 | |||
269 | print_buttons(dialog, height, width, 0); | ||
270 | wmove(menu, choice, item_x + 1); | ||
271 | wrefresh(menu); | ||
272 | |||
273 | while (key != ESC) { | ||
274 | key = wgetch(menu); | ||
275 | |||
276 | if (key < 256 && isalpha(key)) | ||
277 | key = tolower(key); | ||
278 | |||
279 | if (strchr("ynmh", key)) | ||
280 | i = max_choice; | ||
281 | else { | ||
282 | for (i = choice + 1; i < max_choice; i++) { | ||
283 | j = first_alpha(items[(scroll + i) * 2 + 1], "YyNnMmHh"); | ||
284 | if (key == tolower(items[(scroll + i) * 2 + 1][j])) | ||
285 | break; | ||
286 | } | ||
287 | if (i == max_choice) | ||
288 | for (i = 0; i < max_choice; i++) { | ||
289 | j = first_alpha(items [(scroll + i) * 2 + 1], "YyNnMmHh"); | ||
290 | if (key == tolower(items[(scroll + i) * 2 + 1][j])) | ||
291 | break; | ||
292 | } | ||
293 | } | ||
294 | |||
295 | if (i < max_choice || | ||
296 | key == KEY_UP || key == KEY_DOWN || | ||
297 | key == '-' || key == '+' || | ||
298 | key == KEY_PPAGE || key == KEY_NPAGE) { | ||
299 | /* Remove highligt of current item */ | ||
300 | print_item(scroll + choice, choice, FALSE); | ||
301 | |||
302 | if (key == KEY_UP || key == '-') { | ||
303 | if (choice < 2 && scroll) { | ||
304 | /* Scroll menu down */ | ||
305 | do_scroll(menu, &scroll, -1); | ||
306 | |||
307 | print_item(scroll, 0, FALSE); | ||
308 | } else | ||
309 | choice = MAX(choice - 1, 0); | ||
310 | |||
311 | } else if (key == KEY_DOWN || key == '+') { | ||
312 | print_item(scroll+choice, choice, FALSE); | ||
313 | |||
314 | if ((choice > max_choice - 3) && | ||
315 | (scroll + max_choice < item_no)) { | ||
316 | /* Scroll menu up */ | ||
317 | do_scroll(menu, &scroll, 1); | ||
318 | |||
319 | print_item(scroll+max_choice - 1, | ||
320 | max_choice - 1, FALSE); | ||
321 | } else | ||
322 | choice = MIN(choice + 1, max_choice - 1); | ||
323 | |||
324 | } else if (key == KEY_PPAGE) { | ||
325 | scrollok(menu, TRUE); | ||
326 | for (i = 0; (i < max_choice); i++) { | ||
327 | if (scroll > 0) { | ||
328 | do_scroll(menu, &scroll, -1); | ||
329 | print_item(scroll, 0, FALSE); | ||
330 | } else { | ||
331 | if (choice > 0) | ||
332 | choice--; | ||
333 | } | ||
334 | } | ||
335 | |||
336 | } else if (key == KEY_NPAGE) { | ||
337 | for (i = 0; (i < max_choice); i++) { | ||
338 | if (scroll + max_choice < item_no) { | ||
339 | do_scroll(menu, &scroll, 1); | ||
340 | print_item(scroll+max_choice-1, | ||
341 | max_choice - 1, FALSE); | ||
342 | } else { | ||
343 | if (choice + 1 < max_choice) | ||
344 | choice++; | ||
345 | } | ||
346 | } | ||
347 | } else | ||
348 | choice = i; | ||
349 | |||
350 | print_item(scroll + choice, choice, TRUE); | ||
351 | |||
352 | print_arrows(dialog, item_no, scroll, | ||
353 | box_y, box_x + item_x + 1, menu_height); | ||
354 | |||
355 | wnoutrefresh(dialog); | ||
356 | wrefresh(menu); | ||
357 | |||
358 | continue; /* wait for another key press */ | ||
359 | } | ||
360 | |||
361 | switch (key) { | ||
362 | case KEY_LEFT: | ||
363 | case TAB: | ||
364 | case KEY_RIGHT: | ||
365 | button = ((key == KEY_LEFT ? --button : ++button) < 0) | ||
366 | ? 2 : (button > 2 ? 0 : button); | ||
367 | |||
368 | print_buttons(dialog, height, width, button); | ||
369 | wrefresh(menu); | ||
370 | break; | ||
371 | case ' ': | ||
372 | case 's': | ||
373 | case 'y': | ||
374 | case 'n': | ||
375 | case 'm': | ||
376 | case '/': | ||
377 | /* save scroll info */ | ||
378 | if ((f = fopen("lxdialog.scrltmp", "w")) != NULL) { | ||
379 | fprintf(f, "%d\n", scroll); | ||
380 | fclose(f); | ||
381 | } | ||
382 | delwin(dialog); | ||
383 | fprintf(stderr, "%s\n", items[(scroll + choice) * 2]); | ||
384 | switch (key) { | ||
385 | case 's': | ||
386 | return 3; | ||
387 | case 'y': | ||
388 | return 3; | ||
389 | case 'n': | ||
390 | return 4; | ||
391 | case 'm': | ||
392 | return 5; | ||
393 | case ' ': | ||
394 | return 6; | ||
395 | case '/': | ||
396 | return 7; | ||
397 | } | ||
398 | return 0; | ||
399 | case 'h': | ||
400 | case '?': | ||
401 | button = 2; | ||
402 | case '\n': | ||
403 | delwin(dialog); | ||
404 | if (button == 2) | ||
405 | fprintf(stderr, "%s \"%s\"\n", | ||
406 | items[(scroll + choice) * 2], | ||
407 | items[(scroll + choice) * 2 + 1] + | ||
408 | first_alpha(items [(scroll + choice) * 2 + 1], "")); | ||
409 | else | ||
410 | fprintf(stderr, "%s\n", | ||
411 | items[(scroll + choice) * 2]); | ||
412 | |||
413 | remove("lxdialog.scrltmp"); | ||
414 | return button; | ||
415 | case 'e': | ||
416 | case 'x': | ||
417 | key = ESC; | ||
418 | case ESC: | ||
419 | break; | ||
420 | } | ||
421 | } | ||
422 | |||
423 | delwin(dialog); | ||
424 | remove("lxdialog.scrltmp"); | ||
425 | return -1; /* ESC pressed */ | ||
426 | } | ||
diff --git a/scripts/kconfig/lxdialog/msgbox.c b/scripts/kconfig/lxdialog/msgbox.c new file mode 100644 index 000000000..7323f5471 --- /dev/null +++ b/scripts/kconfig/lxdialog/msgbox.c | |||
@@ -0,0 +1,71 @@ | |||
1 | /* | ||
2 | * msgbox.c -- implements the message box and info box | ||
3 | * | ||
4 | * ORIGINAL AUTHOR: Savio Lam (lam836@cs.cuhk.hk) | ||
5 | * MODIFIED FOR LINUX KERNEL CONFIG BY: William Roadcap (roadcapw@cfw.com) | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or | ||
8 | * modify it under the terms of the GNU General Public License | ||
9 | * as published by the Free Software Foundation; either version 2 | ||
10 | * of the License, or (at your option) any later version. | ||
11 | * | ||
12 | * This program is distributed in the hope that it will be useful, | ||
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
15 | * GNU General Public License for more details. | ||
16 | * | ||
17 | * You should have received a copy of the GNU General Public License | ||
18 | * along with this program; if not, write to the Free Software | ||
19 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
20 | */ | ||
21 | |||
22 | #include "dialog.h" | ||
23 | |||
24 | /* | ||
25 | * Display a message box. Program will pause and display an "OK" button | ||
26 | * if the parameter 'pause' is non-zero. | ||
27 | */ | ||
28 | int dialog_msgbox(const char *title, const char *prompt, int height, int width, | ||
29 | int pause) | ||
30 | { | ||
31 | int i, x, y, key = 0; | ||
32 | WINDOW *dialog; | ||
33 | |||
34 | /* center dialog box on screen */ | ||
35 | x = (COLS - width) / 2; | ||
36 | y = (LINES - height) / 2; | ||
37 | |||
38 | draw_shadow(stdscr, y, x, height, width); | ||
39 | |||
40 | dialog = newwin(height, width, y, x); | ||
41 | keypad(dialog, TRUE); | ||
42 | |||
43 | draw_box(dialog, 0, 0, height, width, dialog_attr, border_attr); | ||
44 | |||
45 | print_title(dialog, title, width); | ||
46 | |||
47 | wattrset(dialog, dialog_attr); | ||
48 | print_autowrap(dialog, prompt, width - 2, 1, 2); | ||
49 | |||
50 | if (pause) { | ||
51 | wattrset(dialog, border_attr); | ||
52 | mvwaddch(dialog, height - 3, 0, ACS_LTEE); | ||
53 | for (i = 0; i < width - 2; i++) | ||
54 | waddch(dialog, ACS_HLINE); | ||
55 | wattrset(dialog, dialog_attr); | ||
56 | waddch(dialog, ACS_RTEE); | ||
57 | |||
58 | print_button(dialog, " Ok ", height - 2, width / 2 - 4, TRUE); | ||
59 | |||
60 | wrefresh(dialog); | ||
61 | while (key != ESC && key != '\n' && key != ' ' && | ||
62 | key != 'O' && key != 'o' && key != 'X' && key != 'x') | ||
63 | key = wgetch(dialog); | ||
64 | } else { | ||
65 | key = '\n'; | ||
66 | wrefresh(dialog); | ||
67 | } | ||
68 | |||
69 | delwin(dialog); | ||
70 | return key == ESC ? -1 : 0; | ||
71 | } | ||
diff --git a/scripts/kconfig/lxdialog/textbox.c b/scripts/kconfig/lxdialog/textbox.c new file mode 100644 index 000000000..77848bb8e --- /dev/null +++ b/scripts/kconfig/lxdialog/textbox.c | |||
@@ -0,0 +1,533 @@ | |||
1 | /* | ||
2 | * textbox.c -- implements the text box | ||
3 | * | ||
4 | * ORIGINAL AUTHOR: Savio Lam (lam836@cs.cuhk.hk) | ||
5 | * MODIFIED FOR LINUX KERNEL CONFIG BY: William Roadcap (roadcap@cfw.com) | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or | ||
8 | * modify it under the terms of the GNU General Public License | ||
9 | * as published by the Free Software Foundation; either version 2 | ||
10 | * of the License, or (at your option) any later version. | ||
11 | * | ||
12 | * This program is distributed in the hope that it will be useful, | ||
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
15 | * GNU General Public License for more details. | ||
16 | * | ||
17 | * You should have received a copy of the GNU General Public License | ||
18 | * along with this program; if not, write to the Free Software | ||
19 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
20 | */ | ||
21 | |||
22 | #include "dialog.h" | ||
23 | |||
24 | static void back_lines(int n); | ||
25 | static void print_page(WINDOW * win, int height, int width); | ||
26 | static void print_line(WINDOW * win, int row, int width); | ||
27 | static char *get_line(void); | ||
28 | static void print_position(WINDOW * win, int height, int width); | ||
29 | |||
30 | static int hscroll, fd, file_size, bytes_read; | ||
31 | static int begin_reached = 1, end_reached, page_length; | ||
32 | static char *buf, *page; | ||
33 | |||
34 | /* | ||
35 | * Display text from a file in a dialog box. | ||
36 | */ | ||
37 | int dialog_textbox(const char *title, const char *file, int height, int width) | ||
38 | { | ||
39 | int i, x, y, cur_x, cur_y, fpos, key = 0; | ||
40 | int passed_end; | ||
41 | char search_term[MAX_LEN + 1]; | ||
42 | WINDOW *dialog, *text; | ||
43 | |||
44 | search_term[0] = '\0'; /* no search term entered yet */ | ||
45 | |||
46 | /* Open input file for reading */ | ||
47 | if ((fd = open(file, O_RDONLY)) == -1) { | ||
48 | endwin(); | ||
49 | fprintf(stderr, "\nCan't open input file in dialog_textbox().\n"); | ||
50 | exit(-1); | ||
51 | } | ||
52 | /* Get file size. Actually, 'file_size' is the real file size - 1, | ||
53 | since it's only the last byte offset from the beginning */ | ||
54 | if ((file_size = lseek(fd, 0, SEEK_END)) == -1) { | ||
55 | endwin(); | ||
56 | fprintf(stderr, "\nError getting file size in dialog_textbox().\n"); | ||
57 | exit(-1); | ||
58 | } | ||
59 | /* Restore file pointer to beginning of file after getting file size */ | ||
60 | if (lseek(fd, 0, SEEK_SET) == -1) { | ||
61 | endwin(); | ||
62 | fprintf(stderr, "\nError moving file pointer in dialog_textbox().\n"); | ||
63 | exit(-1); | ||
64 | } | ||
65 | /* Allocate space for read buffer */ | ||
66 | if ((buf = malloc(BUF_SIZE + 1)) == NULL) { | ||
67 | endwin(); | ||
68 | fprintf(stderr, "\nCan't allocate memory in dialog_textbox().\n"); | ||
69 | exit(-1); | ||
70 | } | ||
71 | if ((bytes_read = read(fd, buf, BUF_SIZE)) == -1) { | ||
72 | endwin(); | ||
73 | fprintf(stderr, "\nError reading file in dialog_textbox().\n"); | ||
74 | exit(-1); | ||
75 | } | ||
76 | buf[bytes_read] = '\0'; /* mark end of valid data */ | ||
77 | page = buf; /* page is pointer to start of page to be displayed */ | ||
78 | |||
79 | /* center dialog box on screen */ | ||
80 | x = (COLS - width) / 2; | ||
81 | y = (LINES - height) / 2; | ||
82 | |||
83 | draw_shadow(stdscr, y, x, height, width); | ||
84 | |||
85 | dialog = newwin(height, width, y, x); | ||
86 | keypad(dialog, TRUE); | ||
87 | |||
88 | /* Create window for text region, used for scrolling text */ | ||
89 | text = subwin(dialog, height - 4, width - 2, y + 1, x + 1); | ||
90 | wattrset(text, dialog_attr); | ||
91 | wbkgdset(text, dialog_attr & A_COLOR); | ||
92 | |||
93 | keypad(text, TRUE); | ||
94 | |||
95 | /* register the new window, along with its borders */ | ||
96 | draw_box(dialog, 0, 0, height, width, dialog_attr, border_attr); | ||
97 | |||
98 | wattrset(dialog, border_attr); | ||
99 | mvwaddch(dialog, height - 3, 0, ACS_LTEE); | ||
100 | for (i = 0; i < width - 2; i++) | ||
101 | waddch(dialog, ACS_HLINE); | ||
102 | wattrset(dialog, dialog_attr); | ||
103 | wbkgdset(dialog, dialog_attr & A_COLOR); | ||
104 | waddch(dialog, ACS_RTEE); | ||
105 | |||
106 | print_title(dialog, title, width); | ||
107 | |||
108 | print_button(dialog, " Exit ", height - 2, width / 2 - 4, TRUE); | ||
109 | wnoutrefresh(dialog); | ||
110 | getyx(dialog, cur_y, cur_x); /* Save cursor position */ | ||
111 | |||
112 | /* Print first page of text */ | ||
113 | attr_clear(text, height - 4, width - 2, dialog_attr); | ||
114 | print_page(text, height - 4, width - 2); | ||
115 | print_position(dialog, height, width); | ||
116 | wmove(dialog, cur_y, cur_x); /* Restore cursor position */ | ||
117 | wrefresh(dialog); | ||
118 | |||
119 | while ((key != ESC) && (key != '\n')) { | ||
120 | key = wgetch(dialog); | ||
121 | switch (key) { | ||
122 | case 'E': /* Exit */ | ||
123 | case 'e': | ||
124 | case 'X': | ||
125 | case 'x': | ||
126 | delwin(dialog); | ||
127 | free(buf); | ||
128 | close(fd); | ||
129 | return 0; | ||
130 | case 'g': /* First page */ | ||
131 | case KEY_HOME: | ||
132 | if (!begin_reached) { | ||
133 | begin_reached = 1; | ||
134 | /* First page not in buffer? */ | ||
135 | if ((fpos = lseek(fd, 0, SEEK_CUR)) == -1) { | ||
136 | endwin(); | ||
137 | fprintf(stderr, "\nError moving file pointer in dialog_textbox().\n"); | ||
138 | exit(-1); | ||
139 | } | ||
140 | if (fpos > bytes_read) { /* Yes, we have to read it in */ | ||
141 | if (lseek(fd, 0, SEEK_SET) == -1) { | ||
142 | endwin(); | ||
143 | fprintf(stderr, "\nError moving file pointer in " | ||
144 | "dialog_textbox().\n"); | ||
145 | exit(-1); | ||
146 | } | ||
147 | if ((bytes_read = | ||
148 | read(fd, buf, BUF_SIZE)) == -1) { | ||
149 | endwin(); | ||
150 | fprintf(stderr, "\nError reading file in dialog_textbox().\n"); | ||
151 | exit(-1); | ||
152 | } | ||
153 | buf[bytes_read] = '\0'; | ||
154 | } | ||
155 | page = buf; | ||
156 | print_page(text, height - 4, width - 2); | ||
157 | print_position(dialog, height, width); | ||
158 | wmove(dialog, cur_y, cur_x); /* Restore cursor position */ | ||
159 | wrefresh(dialog); | ||
160 | } | ||
161 | break; | ||
162 | case 'G': /* Last page */ | ||
163 | case KEY_END: | ||
164 | |||
165 | end_reached = 1; | ||
166 | /* Last page not in buffer? */ | ||
167 | if ((fpos = lseek(fd, 0, SEEK_CUR)) == -1) { | ||
168 | endwin(); | ||
169 | fprintf(stderr, "\nError moving file pointer in dialog_textbox().\n"); | ||
170 | exit(-1); | ||
171 | } | ||
172 | if (fpos < file_size) { /* Yes, we have to read it in */ | ||
173 | if (lseek(fd, -BUF_SIZE, SEEK_END) == -1) { | ||
174 | endwin(); | ||
175 | fprintf(stderr, "\nError moving file pointer in dialog_textbox().\n"); | ||
176 | exit(-1); | ||
177 | } | ||
178 | if ((bytes_read = | ||
179 | read(fd, buf, BUF_SIZE)) == -1) { | ||
180 | endwin(); | ||
181 | fprintf(stderr, "\nError reading file in dialog_textbox().\n"); | ||
182 | exit(-1); | ||
183 | } | ||
184 | buf[bytes_read] = '\0'; | ||
185 | } | ||
186 | page = buf + bytes_read; | ||
187 | back_lines(height - 4); | ||
188 | print_page(text, height - 4, width - 2); | ||
189 | print_position(dialog, height, width); | ||
190 | wmove(dialog, cur_y, cur_x); /* Restore cursor position */ | ||
191 | wrefresh(dialog); | ||
192 | break; | ||
193 | case 'K': /* Previous line */ | ||
194 | case 'k': | ||
195 | case KEY_UP: | ||
196 | if (!begin_reached) { | ||
197 | back_lines(page_length + 1); | ||
198 | |||
199 | /* We don't call print_page() here but use scrolling to ensure | ||
200 | faster screen update. However, 'end_reached' and | ||
201 | 'page_length' should still be updated, and 'page' should | ||
202 | point to start of next page. This is done by calling | ||
203 | get_line() in the following 'for' loop. */ | ||
204 | scrollok(text, TRUE); | ||
205 | wscrl(text, -1); /* Scroll text region down one line */ | ||
206 | scrollok(text, FALSE); | ||
207 | page_length = 0; | ||
208 | passed_end = 0; | ||
209 | for (i = 0; i < height - 4; i++) { | ||
210 | if (!i) { | ||
211 | /* print first line of page */ | ||
212 | print_line(text, 0, width - 2); | ||
213 | wnoutrefresh(text); | ||
214 | } else | ||
215 | /* Called to update 'end_reached' and 'page' */ | ||
216 | get_line(); | ||
217 | if (!passed_end) | ||
218 | page_length++; | ||
219 | if (end_reached && !passed_end) | ||
220 | passed_end = 1; | ||
221 | } | ||
222 | |||
223 | print_position(dialog, height, width); | ||
224 | wmove(dialog, cur_y, cur_x); /* Restore cursor position */ | ||
225 | wrefresh(dialog); | ||
226 | } | ||
227 | break; | ||
228 | case 'B': /* Previous page */ | ||
229 | case 'b': | ||
230 | case KEY_PPAGE: | ||
231 | if (begin_reached) | ||
232 | break; | ||
233 | back_lines(page_length + height - 4); | ||
234 | print_page(text, height - 4, width - 2); | ||
235 | print_position(dialog, height, width); | ||
236 | wmove(dialog, cur_y, cur_x); | ||
237 | wrefresh(dialog); | ||
238 | break; | ||
239 | case 'J': /* Next line */ | ||
240 | case 'j': | ||
241 | case KEY_DOWN: | ||
242 | if (!end_reached) { | ||
243 | begin_reached = 0; | ||
244 | scrollok(text, TRUE); | ||
245 | scroll(text); /* Scroll text region up one line */ | ||
246 | scrollok(text, FALSE); | ||
247 | print_line(text, height - 5, width - 2); | ||
248 | wnoutrefresh(text); | ||
249 | print_position(dialog, height, width); | ||
250 | wmove(dialog, cur_y, cur_x); /* Restore cursor position */ | ||
251 | wrefresh(dialog); | ||
252 | } | ||
253 | break; | ||
254 | case KEY_NPAGE: /* Next page */ | ||
255 | case ' ': | ||
256 | if (end_reached) | ||
257 | break; | ||
258 | |||
259 | begin_reached = 0; | ||
260 | print_page(text, height - 4, width - 2); | ||
261 | print_position(dialog, height, width); | ||
262 | wmove(dialog, cur_y, cur_x); | ||
263 | wrefresh(dialog); | ||
264 | break; | ||
265 | case '0': /* Beginning of line */ | ||
266 | case 'H': /* Scroll left */ | ||
267 | case 'h': | ||
268 | case KEY_LEFT: | ||
269 | if (hscroll <= 0) | ||
270 | break; | ||
271 | |||
272 | if (key == '0') | ||
273 | hscroll = 0; | ||
274 | else | ||
275 | hscroll--; | ||
276 | /* Reprint current page to scroll horizontally */ | ||
277 | back_lines(page_length); | ||
278 | print_page(text, height - 4, width - 2); | ||
279 | wmove(dialog, cur_y, cur_x); | ||
280 | wrefresh(dialog); | ||
281 | break; | ||
282 | case 'L': /* Scroll right */ | ||
283 | case 'l': | ||
284 | case KEY_RIGHT: | ||
285 | if (hscroll >= MAX_LEN) | ||
286 | break; | ||
287 | hscroll++; | ||
288 | /* Reprint current page to scroll horizontally */ | ||
289 | back_lines(page_length); | ||
290 | print_page(text, height - 4, width - 2); | ||
291 | wmove(dialog, cur_y, cur_x); | ||
292 | wrefresh(dialog); | ||
293 | break; | ||
294 | case ESC: | ||
295 | break; | ||
296 | } | ||
297 | } | ||
298 | |||
299 | delwin(dialog); | ||
300 | free(buf); | ||
301 | close(fd); | ||
302 | return -1; /* ESC pressed */ | ||
303 | } | ||
304 | |||
305 | /* | ||
306 | * Go back 'n' lines in text file. Called by dialog_textbox(). | ||
307 | * 'page' will be updated to point to the desired line in 'buf'. | ||
308 | */ | ||
309 | static void back_lines(int n) | ||
310 | { | ||
311 | int i, fpos; | ||
312 | |||
313 | begin_reached = 0; | ||
314 | /* We have to distinguish between end_reached and !end_reached | ||
315 | since at end of file, the line is not ended by a '\n'. | ||
316 | The code inside 'if' basically does a '--page' to move one | ||
317 | character backward so as to skip '\n' of the previous line */ | ||
318 | if (!end_reached) { | ||
319 | /* Either beginning of buffer or beginning of file reached? */ | ||
320 | if (page == buf) { | ||
321 | if ((fpos = lseek(fd, 0, SEEK_CUR)) == -1) { | ||
322 | endwin(); | ||
323 | fprintf(stderr, "\nError moving file pointer in " | ||
324 | "back_lines().\n"); | ||
325 | exit(-1); | ||
326 | } | ||
327 | if (fpos > bytes_read) { /* Not beginning of file yet */ | ||
328 | /* We've reached beginning of buffer, but not beginning of | ||
329 | file yet, so read previous part of file into buffer. | ||
330 | Note that we only move backward for BUF_SIZE/2 bytes, | ||
331 | but not BUF_SIZE bytes to avoid re-reading again in | ||
332 | print_page() later */ | ||
333 | /* Really possible to move backward BUF_SIZE/2 bytes? */ | ||
334 | if (fpos < BUF_SIZE / 2 + bytes_read) { | ||
335 | /* No, move less then */ | ||
336 | if (lseek(fd, 0, SEEK_SET) == -1) { | ||
337 | endwin(); | ||
338 | fprintf(stderr, "\nError moving file pointer in " | ||
339 | "back_lines().\n"); | ||
340 | exit(-1); | ||
341 | } | ||
342 | page = buf + fpos - bytes_read; | ||
343 | } else { /* Move backward BUF_SIZE/2 bytes */ | ||
344 | if (lseek (fd, -(BUF_SIZE / 2 + bytes_read), SEEK_CUR) == -1) { | ||
345 | endwin(); | ||
346 | fprintf(stderr, "\nError moving file pointer " | ||
347 | "in back_lines().\n"); | ||
348 | exit(-1); | ||
349 | } | ||
350 | page = buf + BUF_SIZE / 2; | ||
351 | } | ||
352 | if ((bytes_read = | ||
353 | read(fd, buf, BUF_SIZE)) == -1) { | ||
354 | endwin(); | ||
355 | fprintf(stderr, "\nError reading file in back_lines().\n"); | ||
356 | exit(-1); | ||
357 | } | ||
358 | buf[bytes_read] = '\0'; | ||
359 | } else { /* Beginning of file reached */ | ||
360 | begin_reached = 1; | ||
361 | return; | ||
362 | } | ||
363 | } | ||
364 | if (*(--page) != '\n') { /* '--page' here */ | ||
365 | /* Something's wrong... */ | ||
366 | endwin(); | ||
367 | fprintf(stderr, "\nInternal error in back_lines().\n"); | ||
368 | exit(-1); | ||
369 | } | ||
370 | } | ||
371 | /* Go back 'n' lines */ | ||
372 | for (i = 0; i < n; i++) | ||
373 | do { | ||
374 | if (page == buf) { | ||
375 | if ((fpos = lseek(fd, 0, SEEK_CUR)) == -1) { | ||
376 | endwin(); | ||
377 | fprintf(stderr, "\nError moving file pointer in back_lines().\n"); | ||
378 | exit(-1); | ||
379 | } | ||
380 | if (fpos > bytes_read) { | ||
381 | /* Really possible to move backward BUF_SIZE/2 bytes? */ | ||
382 | if (fpos < BUF_SIZE / 2 + bytes_read) { | ||
383 | /* No, move less then */ | ||
384 | if (lseek(fd, 0, SEEK_SET) == -1) { | ||
385 | endwin(); | ||
386 | fprintf(stderr, "\nError moving file pointer " | ||
387 | "in back_lines().\n"); | ||
388 | exit(-1); | ||
389 | } | ||
390 | page = buf + fpos - bytes_read; | ||
391 | } else { /* Move backward BUF_SIZE/2 bytes */ | ||
392 | if (lseek (fd, -(BUF_SIZE / 2 + bytes_read), SEEK_CUR) == -1) { | ||
393 | endwin(); | ||
394 | fprintf(stderr, "\nError moving file pointer" | ||
395 | " in back_lines().\n"); | ||
396 | exit(-1); | ||
397 | } | ||
398 | page = buf + BUF_SIZE / 2; | ||
399 | } | ||
400 | if ((bytes_read = | ||
401 | read(fd, buf, BUF_SIZE)) == -1) { | ||
402 | endwin(); | ||
403 | fprintf(stderr, "\nError reading file in " | ||
404 | "back_lines().\n"); | ||
405 | exit(-1); | ||
406 | } | ||
407 | buf[bytes_read] = '\0'; | ||
408 | } else { /* Beginning of file reached */ | ||
409 | begin_reached = 1; | ||
410 | return; | ||
411 | } | ||
412 | } | ||
413 | } while (*(--page) != '\n'); | ||
414 | page++; | ||
415 | } | ||
416 | |||
417 | /* | ||
418 | * Print a new page of text. Called by dialog_textbox(). | ||
419 | */ | ||
420 | static void print_page(WINDOW * win, int height, int width) | ||
421 | { | ||
422 | int i, passed_end = 0; | ||
423 | |||
424 | page_length = 0; | ||
425 | for (i = 0; i < height; i++) { | ||
426 | print_line(win, i, width); | ||
427 | if (!passed_end) | ||
428 | page_length++; | ||
429 | if (end_reached && !passed_end) | ||
430 | passed_end = 1; | ||
431 | } | ||
432 | wnoutrefresh(win); | ||
433 | } | ||
434 | |||
435 | /* | ||
436 | * Print a new line of text. Called by dialog_textbox() and print_page(). | ||
437 | */ | ||
438 | static void print_line(WINDOW * win, int row, int width) | ||
439 | { | ||
440 | int y, x; | ||
441 | char *line; | ||
442 | |||
443 | line = get_line(); | ||
444 | line += MIN(strlen(line), hscroll); /* Scroll horizontally */ | ||
445 | wmove(win, row, 0); /* move cursor to correct line */ | ||
446 | waddch(win, ' '); | ||
447 | waddnstr(win, line, MIN(strlen(line), width - 2)); | ||
448 | |||
449 | getyx(win, y, x); | ||
450 | /* Clear 'residue' of previous line */ | ||
451 | #if OLD_NCURSES | ||
452 | { | ||
453 | int i; | ||
454 | for (i = 0; i < width - x; i++) | ||
455 | waddch(win, ' '); | ||
456 | } | ||
457 | #else | ||
458 | wclrtoeol(win); | ||
459 | #endif | ||
460 | } | ||
461 | |||
462 | /* | ||
463 | * Return current line of text. Called by dialog_textbox() and print_line(). | ||
464 | * 'page' should point to start of current line before calling, and will be | ||
465 | * updated to point to start of next line. | ||
466 | */ | ||
467 | static char *get_line(void) | ||
468 | { | ||
469 | int i = 0, fpos; | ||
470 | static char line[MAX_LEN + 1]; | ||
471 | |||
472 | end_reached = 0; | ||
473 | while (*page != '\n') { | ||
474 | if (*page == '\0') { | ||
475 | /* Either end of file or end of buffer reached */ | ||
476 | if ((fpos = lseek(fd, 0, SEEK_CUR)) == -1) { | ||
477 | endwin(); | ||
478 | fprintf(stderr, "\nError moving file pointer in " | ||
479 | "get_line().\n"); | ||
480 | exit(-1); | ||
481 | } | ||
482 | if (fpos < file_size) { /* Not end of file yet */ | ||
483 | /* We've reached end of buffer, but not end of file yet, | ||
484 | so read next part of file into buffer */ | ||
485 | if ((bytes_read = | ||
486 | read(fd, buf, BUF_SIZE)) == -1) { | ||
487 | endwin(); | ||
488 | fprintf(stderr, "\nError reading file in get_line().\n"); | ||
489 | exit(-1); | ||
490 | } | ||
491 | buf[bytes_read] = '\0'; | ||
492 | page = buf; | ||
493 | } else { | ||
494 | if (!end_reached) | ||
495 | end_reached = 1; | ||
496 | break; | ||
497 | } | ||
498 | } else if (i < MAX_LEN) | ||
499 | line[i++] = *(page++); | ||
500 | else { | ||
501 | /* Truncate lines longer than MAX_LEN characters */ | ||
502 | if (i == MAX_LEN) | ||
503 | line[i++] = '\0'; | ||
504 | page++; | ||
505 | } | ||
506 | } | ||
507 | if (i <= MAX_LEN) | ||
508 | line[i] = '\0'; | ||
509 | if (!end_reached) | ||
510 | page++; /* move pass '\n' */ | ||
511 | |||
512 | return line; | ||
513 | } | ||
514 | |||
515 | /* | ||
516 | * Print current position | ||
517 | */ | ||
518 | static void print_position(WINDOW * win, int height, int width) | ||
519 | { | ||
520 | int fpos, percent; | ||
521 | |||
522 | if ((fpos = lseek(fd, 0, SEEK_CUR)) == -1) { | ||
523 | endwin(); | ||
524 | fprintf(stderr, "\nError moving file pointer in print_position().\n"); | ||
525 | exit(-1); | ||
526 | } | ||
527 | wattrset(win, position_indicator_attr); | ||
528 | wbkgdset(win, position_indicator_attr & A_COLOR); | ||
529 | percent = !file_size ? | ||
530 | 100 : ((fpos - bytes_read + page - buf) * 100) / file_size; | ||
531 | wmove(win, height - 3, width - 9); | ||
532 | wprintw(win, "(%3d%%)", percent); | ||
533 | } | ||
diff --git a/scripts/kconfig/lxdialog/util.c b/scripts/kconfig/lxdialog/util.c new file mode 100644 index 000000000..f82cebb9f --- /dev/null +++ b/scripts/kconfig/lxdialog/util.c | |||
@@ -0,0 +1,362 @@ | |||
1 | /* | ||
2 | * util.c | ||
3 | * | ||
4 | * ORIGINAL AUTHOR: Savio Lam (lam836@cs.cuhk.hk) | ||
5 | * MODIFIED FOR LINUX KERNEL CONFIG BY: William Roadcap (roadcap@cfw.com) | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or | ||
8 | * modify it under the terms of the GNU General Public License | ||
9 | * as published by the Free Software Foundation; either version 2 | ||
10 | * of the License, or (at your option) any later version. | ||
11 | * | ||
12 | * This program is distributed in the hope that it will be useful, | ||
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
15 | * GNU General Public License for more details. | ||
16 | * | ||
17 | * You should have received a copy of the GNU General Public License | ||
18 | * along with this program; if not, write to the Free Software | ||
19 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
20 | */ | ||
21 | |||
22 | #include "dialog.h" | ||
23 | |||
24 | /* use colors by default? */ | ||
25 | bool use_colors = 1; | ||
26 | |||
27 | const char *backtitle = NULL; | ||
28 | |||
29 | /* | ||
30 | * Attribute values, default is for mono display | ||
31 | */ | ||
32 | chtype attributes[] = { | ||
33 | A_NORMAL, /* screen_attr */ | ||
34 | A_NORMAL, /* shadow_attr */ | ||
35 | A_NORMAL, /* dialog_attr */ | ||
36 | A_BOLD, /* title_attr */ | ||
37 | A_NORMAL, /* border_attr */ | ||
38 | A_REVERSE, /* button_active_attr */ | ||
39 | A_DIM, /* button_inactive_attr */ | ||
40 | A_REVERSE, /* button_key_active_attr */ | ||
41 | A_BOLD, /* button_key_inactive_attr */ | ||
42 | A_REVERSE, /* button_label_active_attr */ | ||
43 | A_NORMAL, /* button_label_inactive_attr */ | ||
44 | A_NORMAL, /* inputbox_attr */ | ||
45 | A_NORMAL, /* inputbox_border_attr */ | ||
46 | A_NORMAL, /* searchbox_attr */ | ||
47 | A_BOLD, /* searchbox_title_attr */ | ||
48 | A_NORMAL, /* searchbox_border_attr */ | ||
49 | A_BOLD, /* position_indicator_attr */ | ||
50 | A_NORMAL, /* menubox_attr */ | ||
51 | A_NORMAL, /* menubox_border_attr */ | ||
52 | A_NORMAL, /* item_attr */ | ||
53 | A_REVERSE, /* item_selected_attr */ | ||
54 | A_BOLD, /* tag_attr */ | ||
55 | A_REVERSE, /* tag_selected_attr */ | ||
56 | A_BOLD, /* tag_key_attr */ | ||
57 | A_REVERSE, /* tag_key_selected_attr */ | ||
58 | A_BOLD, /* check_attr */ | ||
59 | A_REVERSE, /* check_selected_attr */ | ||
60 | A_BOLD, /* uarrow_attr */ | ||
61 | A_BOLD /* darrow_attr */ | ||
62 | }; | ||
63 | |||
64 | #include "colors.h" | ||
65 | |||
66 | /* | ||
67 | * Table of color values | ||
68 | */ | ||
69 | int color_table[][3] = { | ||
70 | {SCREEN_FG, SCREEN_BG, SCREEN_HL}, | ||
71 | {SHADOW_FG, SHADOW_BG, SHADOW_HL}, | ||
72 | {DIALOG_FG, DIALOG_BG, DIALOG_HL}, | ||
73 | {TITLE_FG, TITLE_BG, TITLE_HL}, | ||
74 | {BORDER_FG, BORDER_BG, BORDER_HL}, | ||
75 | {BUTTON_ACTIVE_FG, BUTTON_ACTIVE_BG, BUTTON_ACTIVE_HL}, | ||
76 | {BUTTON_INACTIVE_FG, BUTTON_INACTIVE_BG, BUTTON_INACTIVE_HL}, | ||
77 | {BUTTON_KEY_ACTIVE_FG, BUTTON_KEY_ACTIVE_BG, BUTTON_KEY_ACTIVE_HL}, | ||
78 | {BUTTON_KEY_INACTIVE_FG, BUTTON_KEY_INACTIVE_BG, | ||
79 | BUTTON_KEY_INACTIVE_HL}, | ||
80 | {BUTTON_LABEL_ACTIVE_FG, BUTTON_LABEL_ACTIVE_BG, | ||
81 | BUTTON_LABEL_ACTIVE_HL}, | ||
82 | {BUTTON_LABEL_INACTIVE_FG, BUTTON_LABEL_INACTIVE_BG, | ||
83 | BUTTON_LABEL_INACTIVE_HL}, | ||
84 | {INPUTBOX_FG, INPUTBOX_BG, INPUTBOX_HL}, | ||
85 | {INPUTBOX_BORDER_FG, INPUTBOX_BORDER_BG, INPUTBOX_BORDER_HL}, | ||
86 | {SEARCHBOX_FG, SEARCHBOX_BG, SEARCHBOX_HL}, | ||
87 | {SEARCHBOX_TITLE_FG, SEARCHBOX_TITLE_BG, SEARCHBOX_TITLE_HL}, | ||
88 | {SEARCHBOX_BORDER_FG, SEARCHBOX_BORDER_BG, SEARCHBOX_BORDER_HL}, | ||
89 | {POSITION_INDICATOR_FG, POSITION_INDICATOR_BG, POSITION_INDICATOR_HL}, | ||
90 | {MENUBOX_FG, MENUBOX_BG, MENUBOX_HL}, | ||
91 | {MENUBOX_BORDER_FG, MENUBOX_BORDER_BG, MENUBOX_BORDER_HL}, | ||
92 | {ITEM_FG, ITEM_BG, ITEM_HL}, | ||
93 | {ITEM_SELECTED_FG, ITEM_SELECTED_BG, ITEM_SELECTED_HL}, | ||
94 | {TAG_FG, TAG_BG, TAG_HL}, | ||
95 | {TAG_SELECTED_FG, TAG_SELECTED_BG, TAG_SELECTED_HL}, | ||
96 | {TAG_KEY_FG, TAG_KEY_BG, TAG_KEY_HL}, | ||
97 | {TAG_KEY_SELECTED_FG, TAG_KEY_SELECTED_BG, TAG_KEY_SELECTED_HL}, | ||
98 | {CHECK_FG, CHECK_BG, CHECK_HL}, | ||
99 | {CHECK_SELECTED_FG, CHECK_SELECTED_BG, CHECK_SELECTED_HL}, | ||
100 | {UARROW_FG, UARROW_BG, UARROW_HL}, | ||
101 | {DARROW_FG, DARROW_BG, DARROW_HL}, | ||
102 | }; /* color_table */ | ||
103 | |||
104 | /* | ||
105 | * Set window to attribute 'attr' | ||
106 | */ | ||
107 | void attr_clear(WINDOW * win, int height, int width, chtype attr) | ||
108 | { | ||
109 | int i, j; | ||
110 | |||
111 | wattrset(win, attr); | ||
112 | for (i = 0; i < height; i++) { | ||
113 | wmove(win, i, 0); | ||
114 | for (j = 0; j < width; j++) | ||
115 | waddch(win, ' '); | ||
116 | } | ||
117 | touchwin(win); | ||
118 | } | ||
119 | |||
120 | void dialog_clear(void) | ||
121 | { | ||
122 | attr_clear(stdscr, LINES, COLS, screen_attr); | ||
123 | /* Display background title if it exists ... - SLH */ | ||
124 | if (backtitle != NULL) { | ||
125 | int i; | ||
126 | |||
127 | wattrset(stdscr, screen_attr); | ||
128 | mvwaddstr(stdscr, 0, 1, (char *)backtitle); | ||
129 | wmove(stdscr, 1, 1); | ||
130 | for (i = 1; i < COLS - 1; i++) | ||
131 | waddch(stdscr, ACS_HLINE); | ||
132 | } | ||
133 | wnoutrefresh(stdscr); | ||
134 | } | ||
135 | |||
136 | /* | ||
137 | * Do some initialization for dialog | ||
138 | */ | ||
139 | void init_dialog(void) | ||
140 | { | ||
141 | initscr(); /* Init curses */ | ||
142 | keypad(stdscr, TRUE); | ||
143 | cbreak(); | ||
144 | noecho(); | ||
145 | |||
146 | if (use_colors) /* Set up colors */ | ||
147 | color_setup(); | ||
148 | |||
149 | dialog_clear(); | ||
150 | } | ||
151 | |||
152 | /* | ||
153 | * Setup for color display | ||
154 | */ | ||
155 | void color_setup(void) | ||
156 | { | ||
157 | int i; | ||
158 | |||
159 | if (has_colors()) { /* Terminal supports color? */ | ||
160 | start_color(); | ||
161 | |||
162 | /* Initialize color pairs */ | ||
163 | for (i = 0; i < ATTRIBUTE_COUNT; i++) | ||
164 | init_pair(i + 1, color_table[i][0], color_table[i][1]); | ||
165 | |||
166 | /* Setup color attributes */ | ||
167 | for (i = 0; i < ATTRIBUTE_COUNT; i++) | ||
168 | attributes[i] = C_ATTR(color_table[i][2], i + 1); | ||
169 | } | ||
170 | } | ||
171 | |||
172 | /* | ||
173 | * End using dialog functions. | ||
174 | */ | ||
175 | void end_dialog(void) | ||
176 | { | ||
177 | endwin(); | ||
178 | } | ||
179 | |||
180 | /* Print the title of the dialog. Center the title and truncate | ||
181 | * tile if wider than dialog (- 2 chars). | ||
182 | **/ | ||
183 | void print_title(WINDOW *dialog, const char *title, int width) | ||
184 | { | ||
185 | if (title) { | ||
186 | int tlen = MIN(width - 2, strlen(title)); | ||
187 | wattrset(dialog, title_attr); | ||
188 | mvwaddch(dialog, 0, (width - tlen) / 2 - 1, ' '); | ||
189 | mvwaddnstr(dialog, 0, (width - tlen)/2, title, tlen); | ||
190 | waddch(dialog, ' '); | ||
191 | } | ||
192 | } | ||
193 | |||
194 | /* | ||
195 | * Print a string of text in a window, automatically wrap around to the | ||
196 | * next line if the string is too long to fit on one line. Newline | ||
197 | * characters '\n' are replaced by spaces. We start on a new line | ||
198 | * if there is no room for at least 4 nonblanks following a double-space. | ||
199 | */ | ||
200 | void print_autowrap(WINDOW * win, const char *prompt, int width, int y, int x) | ||
201 | { | ||
202 | int newl, cur_x, cur_y; | ||
203 | int i, prompt_len, room, wlen; | ||
204 | char tempstr[MAX_LEN + 1], *word, *sp, *sp2; | ||
205 | |||
206 | strcpy(tempstr, prompt); | ||
207 | |||
208 | prompt_len = strlen(tempstr); | ||
209 | |||
210 | /* | ||
211 | * Remove newlines | ||
212 | */ | ||
213 | for (i = 0; i < prompt_len; i++) { | ||
214 | if (tempstr[i] == '\n') | ||
215 | tempstr[i] = ' '; | ||
216 | } | ||
217 | |||
218 | if (prompt_len <= width - x * 2) { /* If prompt is short */ | ||
219 | wmove(win, y, (width - prompt_len) / 2); | ||
220 | waddstr(win, tempstr); | ||
221 | } else { | ||
222 | cur_x = x; | ||
223 | cur_y = y; | ||
224 | newl = 1; | ||
225 | word = tempstr; | ||
226 | while (word && *word) { | ||
227 | sp = index(word, ' '); | ||
228 | if (sp) | ||
229 | *sp++ = 0; | ||
230 | |||
231 | /* Wrap to next line if either the word does not fit, | ||
232 | or it is the first word of a new sentence, and it is | ||
233 | short, and the next word does not fit. */ | ||
234 | room = width - cur_x; | ||
235 | wlen = strlen(word); | ||
236 | if (wlen > room || | ||
237 | (newl && wlen < 4 && sp | ||
238 | && wlen + 1 + strlen(sp) > room | ||
239 | && (!(sp2 = index(sp, ' ')) | ||
240 | || wlen + 1 + (sp2 - sp) > room))) { | ||
241 | cur_y++; | ||
242 | cur_x = x; | ||
243 | } | ||
244 | wmove(win, cur_y, cur_x); | ||
245 | waddstr(win, word); | ||
246 | getyx(win, cur_y, cur_x); | ||
247 | cur_x++; | ||
248 | if (sp && *sp == ' ') { | ||
249 | cur_x++; /* double space */ | ||
250 | while (*++sp == ' ') ; | ||
251 | newl = 1; | ||
252 | } else | ||
253 | newl = 0; | ||
254 | word = sp; | ||
255 | } | ||
256 | } | ||
257 | } | ||
258 | |||
259 | /* | ||
260 | * Print a button | ||
261 | */ | ||
262 | void print_button(WINDOW * win, const char *label, int y, int x, int selected) | ||
263 | { | ||
264 | int i, temp; | ||
265 | |||
266 | wmove(win, y, x); | ||
267 | wattrset(win, selected ? button_active_attr : button_inactive_attr); | ||
268 | waddstr(win, "<"); | ||
269 | temp = strspn(label, " "); | ||
270 | label += temp; | ||
271 | wattrset(win, selected ? button_label_active_attr | ||
272 | : button_label_inactive_attr); | ||
273 | for (i = 0; i < temp; i++) | ||
274 | waddch(win, ' '); | ||
275 | wattrset(win, selected ? button_key_active_attr | ||
276 | : button_key_inactive_attr); | ||
277 | waddch(win, label[0]); | ||
278 | wattrset(win, selected ? button_label_active_attr | ||
279 | : button_label_inactive_attr); | ||
280 | waddstr(win, (char *)label + 1); | ||
281 | wattrset(win, selected ? button_active_attr : button_inactive_attr); | ||
282 | waddstr(win, ">"); | ||
283 | wmove(win, y, x + temp + 1); | ||
284 | } | ||
285 | |||
286 | /* | ||
287 | * Draw a rectangular box with line drawing characters | ||
288 | */ | ||
289 | void | ||
290 | draw_box(WINDOW * win, int y, int x, int height, int width, | ||
291 | chtype box, chtype border) | ||
292 | { | ||
293 | int i, j; | ||
294 | |||
295 | wattrset(win, 0); | ||
296 | for (i = 0; i < height; i++) { | ||
297 | wmove(win, y + i, x); | ||
298 | for (j = 0; j < width; j++) | ||
299 | if (!i && !j) | ||
300 | waddch(win, border | ACS_ULCORNER); | ||
301 | else if (i == height - 1 && !j) | ||
302 | waddch(win, border | ACS_LLCORNER); | ||
303 | else if (!i && j == width - 1) | ||
304 | waddch(win, box | ACS_URCORNER); | ||
305 | else if (i == height - 1 && j == width - 1) | ||
306 | waddch(win, box | ACS_LRCORNER); | ||
307 | else if (!i) | ||
308 | waddch(win, border | ACS_HLINE); | ||
309 | else if (i == height - 1) | ||
310 | waddch(win, box | ACS_HLINE); | ||
311 | else if (!j) | ||
312 | waddch(win, border | ACS_VLINE); | ||
313 | else if (j == width - 1) | ||
314 | waddch(win, box | ACS_VLINE); | ||
315 | else | ||
316 | waddch(win, box | ' '); | ||
317 | } | ||
318 | } | ||
319 | |||
320 | /* | ||
321 | * Draw shadows along the right and bottom edge to give a more 3D look | ||
322 | * to the boxes | ||
323 | */ | ||
324 | void draw_shadow(WINDOW * win, int y, int x, int height, int width) | ||
325 | { | ||
326 | int i; | ||
327 | |||
328 | if (has_colors()) { /* Whether terminal supports color? */ | ||
329 | wattrset(win, shadow_attr); | ||
330 | wmove(win, y + height, x + 2); | ||
331 | for (i = 0; i < width; i++) | ||
332 | waddch(win, winch(win) & A_CHARTEXT); | ||
333 | for (i = y + 1; i < y + height + 1; i++) { | ||
334 | wmove(win, i, x + width); | ||
335 | waddch(win, winch(win) & A_CHARTEXT); | ||
336 | waddch(win, winch(win) & A_CHARTEXT); | ||
337 | } | ||
338 | wnoutrefresh(win); | ||
339 | } | ||
340 | } | ||
341 | |||
342 | /* | ||
343 | * Return the position of the first alphabetic character in a string. | ||
344 | */ | ||
345 | int first_alpha(const char *string, const char *exempt) | ||
346 | { | ||
347 | int i, in_paren = 0, c; | ||
348 | |||
349 | for (i = 0; i < strlen(string); i++) { | ||
350 | c = tolower(string[i]); | ||
351 | |||
352 | if (strchr("<[(", c)) | ||
353 | ++in_paren; | ||
354 | if (strchr(">])", c) && in_paren > 0) | ||
355 | --in_paren; | ||
356 | |||
357 | if ((!in_paren) && isalpha(c) && strchr(exempt, c) == 0) | ||
358 | return i; | ||
359 | } | ||
360 | |||
361 | return 0; | ||
362 | } | ||
diff --git a/scripts/kconfig/lxdialog/yesno.c b/scripts/kconfig/lxdialog/yesno.c new file mode 100644 index 000000000..cb2568aae --- /dev/null +++ b/scripts/kconfig/lxdialog/yesno.c | |||
@@ -0,0 +1,102 @@ | |||
1 | /* | ||
2 | * yesno.c -- implements the yes/no box | ||
3 | * | ||
4 | * ORIGINAL AUTHOR: Savio Lam (lam836@cs.cuhk.hk) | ||
5 | * MODIFIED FOR LINUX KERNEL CONFIG BY: William Roadcap (roadcap@cfw.com) | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or | ||
8 | * modify it under the terms of the GNU General Public License | ||
9 | * as published by the Free Software Foundation; either version 2 | ||
10 | * of the License, or (at your option) any later version. | ||
11 | * | ||
12 | * This program is distributed in the hope that it will be useful, | ||
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
15 | * GNU General Public License for more details. | ||
16 | * | ||
17 | * You should have received a copy of the GNU General Public License | ||
18 | * along with this program; if not, write to the Free Software | ||
19 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
20 | */ | ||
21 | |||
22 | #include "dialog.h" | ||
23 | |||
24 | /* | ||
25 | * Display termination buttons | ||
26 | */ | ||
27 | static void print_buttons(WINDOW * dialog, int height, int width, int selected) | ||
28 | { | ||
29 | int x = width / 2 - 10; | ||
30 | int y = height - 2; | ||
31 | |||
32 | print_button(dialog, " Yes ", y, x, selected == 0); | ||
33 | print_button(dialog, " No ", y, x + 13, selected == 1); | ||
34 | |||
35 | wmove(dialog, y, x + 1 + 13 * selected); | ||
36 | wrefresh(dialog); | ||
37 | } | ||
38 | |||
39 | /* | ||
40 | * Display a dialog box with two buttons - Yes and No | ||
41 | */ | ||
42 | int dialog_yesno(const char *title, const char *prompt, int height, int width) | ||
43 | { | ||
44 | int i, x, y, key = 0, button = 0; | ||
45 | WINDOW *dialog; | ||
46 | |||
47 | /* center dialog box on screen */ | ||
48 | x = (COLS - width) / 2; | ||
49 | y = (LINES - height) / 2; | ||
50 | |||
51 | draw_shadow(stdscr, y, x, height, width); | ||
52 | |||
53 | dialog = newwin(height, width, y, x); | ||
54 | keypad(dialog, TRUE); | ||
55 | |||
56 | draw_box(dialog, 0, 0, height, width, dialog_attr, border_attr); | ||
57 | wattrset(dialog, border_attr); | ||
58 | mvwaddch(dialog, height - 3, 0, ACS_LTEE); | ||
59 | for (i = 0; i < width - 2; i++) | ||
60 | waddch(dialog, ACS_HLINE); | ||
61 | wattrset(dialog, dialog_attr); | ||
62 | waddch(dialog, ACS_RTEE); | ||
63 | |||
64 | print_title(dialog, title, width); | ||
65 | |||
66 | wattrset(dialog, dialog_attr); | ||
67 | print_autowrap(dialog, prompt, width - 2, 1, 3); | ||
68 | |||
69 | print_buttons(dialog, height, width, 0); | ||
70 | |||
71 | while (key != ESC) { | ||
72 | key = wgetch(dialog); | ||
73 | switch (key) { | ||
74 | case 'Y': | ||
75 | case 'y': | ||
76 | delwin(dialog); | ||
77 | return 0; | ||
78 | case 'N': | ||
79 | case 'n': | ||
80 | delwin(dialog); | ||
81 | return 1; | ||
82 | |||
83 | case TAB: | ||
84 | case KEY_LEFT: | ||
85 | case KEY_RIGHT: | ||
86 | button = ((key == KEY_LEFT ? --button : ++button) < 0) ? 1 : (button > 1 ? 0 : button); | ||
87 | |||
88 | print_buttons(dialog, height, width, button); | ||
89 | wrefresh(dialog); | ||
90 | break; | ||
91 | case ' ': | ||
92 | case '\n': | ||
93 | delwin(dialog); | ||
94 | return button; | ||
95 | case ESC: | ||
96 | break; | ||
97 | } | ||
98 | } | ||
99 | |||
100 | delwin(dialog); | ||
101 | return -1; /* ESC pressed */ | ||
102 | } | ||
diff --git a/scripts/kconfig/mconf.c b/scripts/kconfig/mconf.c new file mode 100644 index 000000000..7f973195e --- /dev/null +++ b/scripts/kconfig/mconf.c | |||
@@ -0,0 +1,1098 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org> | ||
3 | * Released under the terms of the GNU GPL v2.0. | ||
4 | * | ||
5 | * Introduced single menu mode (show all sub-menus in one large tree). | ||
6 | * 2002-11-06 Petr Baudis <pasky@ucw.cz> | ||
7 | * | ||
8 | * i18n, 2005, Arnaldo Carvalho de Melo <acme@conectiva.com.br> | ||
9 | */ | ||
10 | |||
11 | #include <sys/ioctl.h> | ||
12 | #include <sys/wait.h> | ||
13 | #include <ctype.h> | ||
14 | #include <errno.h> | ||
15 | #include <fcntl.h> | ||
16 | #include <limits.h> | ||
17 | #include <signal.h> | ||
18 | #include <stdarg.h> | ||
19 | #include <stdlib.h> | ||
20 | #include <string.h> | ||
21 | #include <termios.h> | ||
22 | #include <unistd.h> | ||
23 | #include <locale.h> | ||
24 | |||
25 | #define LKC_DIRECT_LINK | ||
26 | #include "lkc.h" | ||
27 | |||
28 | static char menu_backtitle[128]; | ||
29 | static const char mconf_readme[] = N_( | ||
30 | "Overview\n" | ||
31 | "--------\n" | ||
32 | "Some kernel features may be built directly into the kernel.\n" | ||
33 | "Some may be made into loadable runtime modules. Some features\n" | ||
34 | "may be completely removed altogether. There are also certain\n" | ||
35 | "kernel parameters which are not really features, but must be\n" | ||
36 | "entered in as decimal or hexadecimal numbers or possibly text.\n" | ||
37 | "\n" | ||
38 | "Menu items beginning with [*], <M> or [ ] represent features\n" | ||
39 | "configured to be built in, modularized or removed respectively.\n" | ||
40 | "Pointed brackets <> represent module capable features.\n" | ||
41 | "\n" | ||
42 | "To change any of these features, highlight it with the cursor\n" | ||
43 | "keys and press <Y> to build it in, <M> to make it a module or\n" | ||
44 | "<N> to removed it. You may also press the <Space Bar> to cycle\n" | ||
45 | "through the available options (ie. Y->N->M->Y).\n" | ||
46 | "\n" | ||
47 | "Some additional keyboard hints:\n" | ||
48 | "\n" | ||
49 | "Menus\n" | ||
50 | "----------\n" | ||
51 | "o Use the Up/Down arrow keys (cursor keys) to highlight the item\n" | ||
52 | " you wish to change or submenu wish to select and press <Enter>.\n" | ||
53 | " Submenus are designated by \"--->\".\n" | ||
54 | "\n" | ||
55 | " Shortcut: Press the option's highlighted letter (hotkey).\n" | ||
56 | " Pressing a hotkey more than once will sequence\n" | ||
57 | " through all visible items which use that hotkey.\n" | ||
58 | "\n" | ||
59 | " You may also use the <PAGE UP> and <PAGE DOWN> keys to scroll\n" | ||
60 | " unseen options into view.\n" | ||
61 | "\n" | ||
62 | "o To exit a menu use the cursor keys to highlight the <Exit> button\n" | ||
63 | " and press <ENTER>.\n" | ||
64 | "\n" | ||
65 | " Shortcut: Press <ESC><ESC> or <E> or <X> if there is no hotkey\n" | ||
66 | " using those letters. You may press a single <ESC>, but\n" | ||
67 | " there is a delayed response which you may find annoying.\n" | ||
68 | "\n" | ||
69 | " Also, the <TAB> and cursor keys will cycle between <Select>,\n" | ||
70 | " <Exit> and <Help>\n" | ||
71 | "\n" | ||
72 | "o To get help with an item, use the cursor keys to highlight <Help>\n" | ||
73 | " and Press <ENTER>.\n" | ||
74 | "\n" | ||
75 | " Shortcut: Press <H> or <?>.\n" | ||
76 | "\n" | ||
77 | "\n" | ||
78 | "Radiolists (Choice lists)\n" | ||
79 | "-----------\n" | ||
80 | "o Use the cursor keys to select the option you wish to set and press\n" | ||
81 | " <S> or the <SPACE BAR>.\n" | ||
82 | "\n" | ||
83 | " Shortcut: Press the first letter of the option you wish to set then\n" | ||
84 | " press <S> or <SPACE BAR>.\n" | ||
85 | "\n" | ||
86 | "o To see available help for the item, use the cursor keys to highlight\n" | ||
87 | " <Help> and Press <ENTER>.\n" | ||
88 | "\n" | ||
89 | " Shortcut: Press <H> or <?>.\n" | ||
90 | "\n" | ||
91 | " Also, the <TAB> and cursor keys will cycle between <Select> and\n" | ||
92 | " <Help>\n" | ||
93 | "\n" | ||
94 | "\n" | ||
95 | "Data Entry\n" | ||
96 | "-----------\n" | ||
97 | "o Enter the requested information and press <ENTER>\n" | ||
98 | " If you are entering hexadecimal values, it is not necessary to\n" | ||
99 | " add the '0x' prefix to the entry.\n" | ||
100 | "\n" | ||
101 | "o For help, use the <TAB> or cursor keys to highlight the help option\n" | ||
102 | " and press <ENTER>. You can try <TAB><H> as well.\n" | ||
103 | "\n" | ||
104 | "\n" | ||
105 | "Text Box (Help Window)\n" | ||
106 | "--------\n" | ||
107 | "o Use the cursor keys to scroll up/down/left/right. The VI editor\n" | ||
108 | " keys h,j,k,l function here as do <SPACE BAR> and <B> for those\n" | ||
109 | " who are familiar with less and lynx.\n" | ||
110 | "\n" | ||
111 | "o Press <E>, <X>, <Enter> or <Esc><Esc> to exit.\n" | ||
112 | "\n" | ||
113 | "\n" | ||
114 | "Alternate Configuration Files\n" | ||
115 | "-----------------------------\n" | ||
116 | "Menuconfig supports the use of alternate configuration files for\n" | ||
117 | "those who, for various reasons, find it necessary to switch\n" | ||
118 | "between different kernel configurations.\n" | ||
119 | "\n" | ||
120 | "At the end of the main menu you will find two options. One is\n" | ||
121 | "for saving the current configuration to a file of your choosing.\n" | ||
122 | "The other option is for loading a previously saved alternate\n" | ||
123 | "configuration.\n" | ||
124 | "\n" | ||
125 | "Even if you don't use alternate configuration files, but you\n" | ||
126 | "find during a Menuconfig session that you have completely messed\n" | ||
127 | "up your settings, you may use the \"Load Alternate...\" option to\n" | ||
128 | "restore your previously saved settings from \".config\" without\n" | ||
129 | "restarting Menuconfig.\n" | ||
130 | "\n" | ||
131 | "Other information\n" | ||
132 | "-----------------\n" | ||
133 | "If you use Menuconfig in an XTERM window make sure you have your\n" | ||
134 | "$TERM variable set to point to a xterm definition which supports color.\n" | ||
135 | "Otherwise, Menuconfig will look rather bad. Menuconfig will not\n" | ||
136 | "display correctly in a RXVT window because rxvt displays only one\n" | ||
137 | "intensity of color, bright.\n" | ||
138 | "\n" | ||
139 | "Menuconfig will display larger menus on screens or xterms which are\n" | ||
140 | "set to display more than the standard 25 row by 80 column geometry.\n" | ||
141 | "In order for this to work, the \"stty size\" command must be able to\n" | ||
142 | "display the screen's current row and column geometry. I STRONGLY\n" | ||
143 | "RECOMMEND that you make sure you do NOT have the shell variables\n" | ||
144 | "LINES and COLUMNS exported into your environment. Some distributions\n" | ||
145 | "export those variables via /etc/profile. Some ncurses programs can\n" | ||
146 | "become confused when those variables (LINES & COLUMNS) don't reflect\n" | ||
147 | "the true screen size.\n" | ||
148 | "\n" | ||
149 | "Optional personality available\n" | ||
150 | "------------------------------\n" | ||
151 | "If you prefer to have all of the kernel options listed in a single\n" | ||
152 | "menu, rather than the default multimenu hierarchy, run the menuconfig\n" | ||
153 | "with MENUCONFIG_MODE environment variable set to single_menu. Example:\n" | ||
154 | "\n" | ||
155 | "make MENUCONFIG_MODE=single_menu menuconfig\n" | ||
156 | "\n" | ||
157 | "<Enter> will then unroll the appropriate category, or enfold it if it\n" | ||
158 | "is already unrolled.\n" | ||
159 | "\n" | ||
160 | "Note that this mode can eventually be a little more CPU expensive\n" | ||
161 | "(especially with a larger number of unrolled categories) than the\n" | ||
162 | "default mode.\n"), | ||
163 | menu_instructions[] = N_( | ||
164 | "Arrow keys navigate the menu. " | ||
165 | "<Enter> selects submenus --->. " | ||
166 | "Highlighted letters are hotkeys. " | ||
167 | "Pressing <Y> includes, <N> excludes, <M> modularizes features. " | ||
168 | "Press <Esc><Esc> to exit, <?> for Help, </> for Search. " | ||
169 | "Legend: [*] built-in [ ] excluded <M> module < > module capable"), | ||
170 | radiolist_instructions[] = N_( | ||
171 | "Use the arrow keys to navigate this window or " | ||
172 | "press the hotkey of the item you wish to select " | ||
173 | "followed by the <SPACE BAR>. " | ||
174 | "Press <?> for additional information about this option."), | ||
175 | inputbox_instructions_int[] = N_( | ||
176 | "Please enter a decimal value. " | ||
177 | "Fractions will not be accepted. " | ||
178 | "Use the <TAB> key to move from the input field to the buttons below it."), | ||
179 | inputbox_instructions_hex[] = N_( | ||
180 | "Please enter a hexadecimal value. " | ||
181 | "Use the <TAB> key to move from the input field to the buttons below it."), | ||
182 | inputbox_instructions_string[] = N_( | ||
183 | "Please enter a string value. " | ||
184 | "Use the <TAB> key to move from the input field to the buttons below it."), | ||
185 | setmod_text[] = N_( | ||
186 | "This feature depends on another which has been configured as a module.\n" | ||
187 | "As a result, this feature will be built as a module."), | ||
188 | nohelp_text[] = N_( | ||
189 | "There is no help available for this kernel option.\n"), | ||
190 | load_config_text[] = N_( | ||
191 | "Enter the name of the configuration file you wish to load. " | ||
192 | "Accept the name shown to restore the configuration you " | ||
193 | "last retrieved. Leave blank to abort."), | ||
194 | load_config_help[] = N_( | ||
195 | "\n" | ||
196 | "For various reasons, one may wish to keep several different kernel\n" | ||
197 | "configurations available on a single machine.\n" | ||
198 | "\n" | ||
199 | "If you have saved a previous configuration in a file other than the\n" | ||
200 | "kernel's default, entering the name of the file here will allow you\n" | ||
201 | "to modify that configuration.\n" | ||
202 | "\n" | ||
203 | "If you are uncertain, then you have probably never used alternate\n" | ||
204 | "configuration files. You should therefor leave this blank to abort.\n"), | ||
205 | save_config_text[] = N_( | ||
206 | "Enter a filename to which this configuration should be saved " | ||
207 | "as an alternate. Leave blank to abort."), | ||
208 | save_config_help[] = N_( | ||
209 | "\n" | ||
210 | "For various reasons, one may wish to keep different kernel\n" | ||
211 | "configurations available on a single machine.\n" | ||
212 | "\n" | ||
213 | "Entering a file name here will allow you to later retrieve, modify\n" | ||
214 | "and use the current configuration as an alternate to whatever\n" | ||
215 | "configuration options you have selected at that time.\n" | ||
216 | "\n" | ||
217 | "If you are uncertain what all this means then you should probably\n" | ||
218 | "leave this blank.\n"), | ||
219 | search_help[] = N_( | ||
220 | "\n" | ||
221 | "Search for CONFIG_ symbols and display their relations.\n" | ||
222 | "Regular expressions are allowed.\n" | ||
223 | "Example: search for \"^FOO\"\n" | ||
224 | "Result:\n" | ||
225 | "-----------------------------------------------------------------\n" | ||
226 | "Symbol: FOO [=m]\n" | ||
227 | "Prompt: Foo bus is used to drive the bar HW\n" | ||
228 | "Defined at drivers/pci/Kconfig:47\n" | ||
229 | "Depends on: X86_LOCAL_APIC && X86_IO_APIC || IA64\n" | ||
230 | "Location:\n" | ||
231 | " -> Bus options (PCI, PCMCIA, EISA, MCA, ISA)\n" | ||
232 | " -> PCI support (PCI [=y])\n" | ||
233 | " -> PCI access mode (<choice> [=y])\n" | ||
234 | "Selects: LIBCRC32\n" | ||
235 | "Selected by: BAR\n" | ||
236 | "-----------------------------------------------------------------\n" | ||
237 | "o The line 'Prompt:' shows the text used in the menu structure for\n" | ||
238 | " this CONFIG_ symbol\n" | ||
239 | "o The 'Defined at' line tell at what file / line number the symbol\n" | ||
240 | " is defined\n" | ||
241 | "o The 'Depends on:' line tell what symbols needs to be defined for\n" | ||
242 | " this symbol to be visible in the menu (selectable)\n" | ||
243 | "o The 'Location:' lines tell where in the menu structure this symbol\n" | ||
244 | " is located\n" | ||
245 | " A location followed by a [=y] indicate that this is a selectable\n" | ||
246 | " menu item - and current value is displayed inside brackets.\n" | ||
247 | "o The 'Selects:' line tell what symbol will be automatically\n" | ||
248 | " selected if this symbol is selected (y or m)\n" | ||
249 | "o The 'Selected by' line tell what symbol has selected this symbol\n" | ||
250 | "\n" | ||
251 | "Only relevant lines are shown.\n" | ||
252 | "\n\n" | ||
253 | "Search examples:\n" | ||
254 | "Examples: USB => find all CONFIG_ symbols containing USB\n" | ||
255 | " ^USB => find all CONFIG_ symbols starting with USB\n" | ||
256 | " USB$ => find all CONFIG_ symbols ending with USB\n" | ||
257 | "\n"); | ||
258 | |||
259 | static char buf[4096], *bufptr = buf; | ||
260 | static char input_buf[4096]; | ||
261 | static char filename[PATH_MAX+1] = ".config"; | ||
262 | static char *args[1024], **argptr = args; | ||
263 | static int indent; | ||
264 | static struct termios ios_org; | ||
265 | static int rows = 0, cols = 0; | ||
266 | static struct menu *current_menu; | ||
267 | static int child_count; | ||
268 | static int do_resize; | ||
269 | static int single_menu_mode; | ||
270 | |||
271 | static void conf(struct menu *menu); | ||
272 | static void conf_choice(struct menu *menu); | ||
273 | static void conf_string(struct menu *menu); | ||
274 | static void conf_load(void); | ||
275 | static void conf_save(void); | ||
276 | static void show_textbox(const char *title, const char *text, int r, int c); | ||
277 | static void show_helptext(const char *title, const char *text); | ||
278 | static void show_help(struct menu *menu); | ||
279 | static void show_file(const char *filename, const char *title, int r, int c); | ||
280 | |||
281 | static void cprint_init(void); | ||
282 | static int cprint1(const char *fmt, ...); | ||
283 | static void cprint_done(void); | ||
284 | static int cprint(const char *fmt, ...); | ||
285 | |||
286 | static void init_wsize(void) | ||
287 | { | ||
288 | struct winsize ws; | ||
289 | char *env; | ||
290 | |||
291 | if (!ioctl(STDIN_FILENO, TIOCGWINSZ, &ws)) { | ||
292 | rows = ws.ws_row; | ||
293 | cols = ws.ws_col; | ||
294 | } | ||
295 | |||
296 | if (!rows) { | ||
297 | env = getenv("LINES"); | ||
298 | if (env) | ||
299 | rows = atoi(env); | ||
300 | if (!rows) | ||
301 | rows = 24; | ||
302 | } | ||
303 | if (!cols) { | ||
304 | env = getenv("COLUMNS"); | ||
305 | if (env) | ||
306 | cols = atoi(env); | ||
307 | if (!cols) | ||
308 | cols = 80; | ||
309 | } | ||
310 | |||
311 | if (rows < 19 || cols < 80) { | ||
312 | fprintf(stderr, N_("Your display is too small to run Menuconfig!\n")); | ||
313 | fprintf(stderr, N_("It must be at least 19 lines by 80 columns.\n")); | ||
314 | exit(1); | ||
315 | } | ||
316 | |||
317 | rows -= 4; | ||
318 | cols -= 5; | ||
319 | } | ||
320 | |||
321 | static void cprint_init(void) | ||
322 | { | ||
323 | bufptr = buf; | ||
324 | argptr = args; | ||
325 | memset(args, 0, sizeof(args)); | ||
326 | indent = 0; | ||
327 | child_count = 0; | ||
328 | cprint("./scripts/kconfig/lxdialog/lxdialog"); | ||
329 | cprint("--backtitle"); | ||
330 | cprint(menu_backtitle); | ||
331 | } | ||
332 | |||
333 | static int cprint1(const char *fmt, ...) | ||
334 | { | ||
335 | va_list ap; | ||
336 | int res; | ||
337 | |||
338 | if (!*argptr) | ||
339 | *argptr = bufptr; | ||
340 | va_start(ap, fmt); | ||
341 | res = vsprintf(bufptr, fmt, ap); | ||
342 | va_end(ap); | ||
343 | bufptr += res; | ||
344 | |||
345 | return res; | ||
346 | } | ||
347 | |||
348 | static void cprint_done(void) | ||
349 | { | ||
350 | *bufptr++ = 0; | ||
351 | argptr++; | ||
352 | } | ||
353 | |||
354 | static int cprint(const char *fmt, ...) | ||
355 | { | ||
356 | va_list ap; | ||
357 | int res; | ||
358 | |||
359 | *argptr++ = bufptr; | ||
360 | va_start(ap, fmt); | ||
361 | res = vsprintf(bufptr, fmt, ap); | ||
362 | va_end(ap); | ||
363 | bufptr += res; | ||
364 | *bufptr++ = 0; | ||
365 | |||
366 | return res; | ||
367 | } | ||
368 | |||
369 | static void get_prompt_str(struct gstr *r, struct property *prop) | ||
370 | { | ||
371 | int i, j; | ||
372 | struct menu *submenu[8], *menu; | ||
373 | |||
374 | str_printf(r, "Prompt: %s\n", prop->text); | ||
375 | str_printf(r, " Defined at %s:%d\n", prop->menu->file->name, | ||
376 | prop->menu->lineno); | ||
377 | if (!expr_is_yes(prop->visible.expr)) { | ||
378 | str_append(r, " Depends on: "); | ||
379 | expr_gstr_print(prop->visible.expr, r); | ||
380 | str_append(r, "\n"); | ||
381 | } | ||
382 | menu = prop->menu->parent; | ||
383 | for (i = 0; menu != &rootmenu && i < 8; menu = menu->parent) | ||
384 | submenu[i++] = menu; | ||
385 | if (i > 0) { | ||
386 | str_printf(r, " Location:\n"); | ||
387 | for (j = 4; --i >= 0; j += 2) { | ||
388 | menu = submenu[i]; | ||
389 | str_printf(r, "%*c-> %s", j, ' ', menu_get_prompt(menu)); | ||
390 | if (menu->sym) { | ||
391 | str_printf(r, " (%s [=%s])", menu->sym->name ? | ||
392 | menu->sym->name : "<choice>", | ||
393 | sym_get_string_value(menu->sym)); | ||
394 | } | ||
395 | str_append(r, "\n"); | ||
396 | } | ||
397 | } | ||
398 | } | ||
399 | |||
400 | static void get_symbol_str(struct gstr *r, struct symbol *sym) | ||
401 | { | ||
402 | bool hit; | ||
403 | struct property *prop; | ||
404 | |||
405 | str_printf(r, "Symbol: %s [=%s]\n", sym->name, | ||
406 | sym_get_string_value(sym)); | ||
407 | for_all_prompts(sym, prop) | ||
408 | get_prompt_str(r, prop); | ||
409 | hit = false; | ||
410 | for_all_properties(sym, prop, P_SELECT) { | ||
411 | if (!hit) { | ||
412 | str_append(r, " Selects: "); | ||
413 | hit = true; | ||
414 | } else | ||
415 | str_printf(r, " && "); | ||
416 | expr_gstr_print(prop->expr, r); | ||
417 | } | ||
418 | if (hit) | ||
419 | str_append(r, "\n"); | ||
420 | if (sym->rev_dep.expr) { | ||
421 | str_append(r, " Selected by: "); | ||
422 | expr_gstr_print(sym->rev_dep.expr, r); | ||
423 | str_append(r, "\n"); | ||
424 | } | ||
425 | str_append(r, "\n\n"); | ||
426 | } | ||
427 | |||
428 | static struct gstr get_relations_str(struct symbol **sym_arr) | ||
429 | { | ||
430 | struct symbol *sym; | ||
431 | struct gstr res = str_new(); | ||
432 | int i; | ||
433 | |||
434 | for (i = 0; sym_arr && (sym = sym_arr[i]); i++) | ||
435 | get_symbol_str(&res, sym); | ||
436 | if (!i) | ||
437 | str_append(&res, "No matches found.\n"); | ||
438 | return res; | ||
439 | } | ||
440 | |||
441 | pid_t pid; | ||
442 | |||
443 | static void winch_handler(int sig) | ||
444 | { | ||
445 | if (!do_resize) { | ||
446 | kill(pid, SIGINT); | ||
447 | do_resize = 1; | ||
448 | } | ||
449 | } | ||
450 | |||
451 | static int exec_conf(void) | ||
452 | { | ||
453 | int pipefd[2], stat, size; | ||
454 | struct sigaction sa; | ||
455 | sigset_t sset, osset; | ||
456 | |||
457 | sigemptyset(&sset); | ||
458 | sigaddset(&sset, SIGINT); | ||
459 | sigprocmask(SIG_BLOCK, &sset, &osset); | ||
460 | |||
461 | signal(SIGINT, SIG_DFL); | ||
462 | |||
463 | sa.sa_handler = winch_handler; | ||
464 | sigemptyset(&sa.sa_mask); | ||
465 | sa.sa_flags = SA_RESTART; | ||
466 | sigaction(SIGWINCH, &sa, NULL); | ||
467 | |||
468 | *argptr++ = NULL; | ||
469 | |||
470 | pipe(pipefd); | ||
471 | pid = fork(); | ||
472 | if (pid == 0) { | ||
473 | sigprocmask(SIG_SETMASK, &osset, NULL); | ||
474 | dup2(pipefd[1], 2); | ||
475 | close(pipefd[0]); | ||
476 | close(pipefd[1]); | ||
477 | execv(args[0], args); | ||
478 | _exit(EXIT_FAILURE); | ||
479 | } | ||
480 | |||
481 | close(pipefd[1]); | ||
482 | bufptr = input_buf; | ||
483 | while (1) { | ||
484 | size = input_buf + sizeof(input_buf) - bufptr; | ||
485 | size = read(pipefd[0], bufptr, size); | ||
486 | if (size <= 0) { | ||
487 | if (size < 0) { | ||
488 | if (errno == EINTR || errno == EAGAIN) | ||
489 | continue; | ||
490 | perror("read"); | ||
491 | } | ||
492 | break; | ||
493 | } | ||
494 | bufptr += size; | ||
495 | } | ||
496 | *bufptr++ = 0; | ||
497 | close(pipefd[0]); | ||
498 | waitpid(pid, &stat, 0); | ||
499 | |||
500 | if (do_resize) { | ||
501 | init_wsize(); | ||
502 | do_resize = 0; | ||
503 | sigprocmask(SIG_SETMASK, &osset, NULL); | ||
504 | return -1; | ||
505 | } | ||
506 | if (WIFSIGNALED(stat)) { | ||
507 | printf("\finterrupted(%d)\n", WTERMSIG(stat)); | ||
508 | exit(1); | ||
509 | } | ||
510 | #if 0 | ||
511 | printf("\fexit state: %d\nexit data: '%s'\n", WEXITSTATUS(stat), input_buf); | ||
512 | sleep(1); | ||
513 | #endif | ||
514 | sigpending(&sset); | ||
515 | if (sigismember(&sset, SIGINT)) { | ||
516 | printf("\finterrupted\n"); | ||
517 | exit(1); | ||
518 | } | ||
519 | sigprocmask(SIG_SETMASK, &osset, NULL); | ||
520 | |||
521 | return WEXITSTATUS(stat); | ||
522 | } | ||
523 | |||
524 | static void search_conf(void) | ||
525 | { | ||
526 | struct symbol **sym_arr; | ||
527 | int stat; | ||
528 | struct gstr res; | ||
529 | |||
530 | again: | ||
531 | cprint_init(); | ||
532 | cprint("--title"); | ||
533 | cprint(_("Search Configuration Parameter")); | ||
534 | cprint("--inputbox"); | ||
535 | cprint(_("Enter CONFIG_ (sub)string to search for (omit CONFIG_)")); | ||
536 | cprint("10"); | ||
537 | cprint("75"); | ||
538 | cprint(""); | ||
539 | stat = exec_conf(); | ||
540 | if (stat < 0) | ||
541 | goto again; | ||
542 | switch (stat) { | ||
543 | case 0: | ||
544 | break; | ||
545 | case 1: | ||
546 | show_helptext(_("Search Configuration"), search_help); | ||
547 | goto again; | ||
548 | default: | ||
549 | return; | ||
550 | } | ||
551 | |||
552 | sym_arr = sym_re_search(input_buf); | ||
553 | res = get_relations_str(sym_arr); | ||
554 | free(sym_arr); | ||
555 | show_textbox(_("Search Results"), str_get(&res), 0, 0); | ||
556 | str_free(&res); | ||
557 | } | ||
558 | |||
559 | static void build_conf(struct menu *menu) | ||
560 | { | ||
561 | struct symbol *sym; | ||
562 | struct property *prop; | ||
563 | struct menu *child; | ||
564 | int type, tmp, doint = 2; | ||
565 | tristate val; | ||
566 | char ch; | ||
567 | |||
568 | if (!menu_is_visible(menu)) | ||
569 | return; | ||
570 | |||
571 | sym = menu->sym; | ||
572 | prop = menu->prompt; | ||
573 | if (!sym) { | ||
574 | if (prop && menu != current_menu) { | ||
575 | const char *prompt = menu_get_prompt(menu); | ||
576 | switch (prop->type) { | ||
577 | case P_MENU: | ||
578 | child_count++; | ||
579 | cprint("m%p", menu); | ||
580 | |||
581 | if (single_menu_mode) { | ||
582 | cprint1("%s%*c%s", | ||
583 | menu->data ? "-->" : "++>", | ||
584 | indent + 1, ' ', prompt); | ||
585 | } else | ||
586 | cprint1(" %*c%s --->", indent + 1, ' ', prompt); | ||
587 | |||
588 | cprint_done(); | ||
589 | if (single_menu_mode && menu->data) | ||
590 | goto conf_childs; | ||
591 | return; | ||
592 | default: | ||
593 | if (prompt) { | ||
594 | child_count++; | ||
595 | cprint(":%p", menu); | ||
596 | cprint("---%*c%s", indent + 1, ' ', prompt); | ||
597 | } | ||
598 | } | ||
599 | } else | ||
600 | doint = 0; | ||
601 | goto conf_childs; | ||
602 | } | ||
603 | |||
604 | type = sym_get_type(sym); | ||
605 | if (sym_is_choice(sym)) { | ||
606 | struct symbol *def_sym = sym_get_choice_value(sym); | ||
607 | struct menu *def_menu = NULL; | ||
608 | |||
609 | child_count++; | ||
610 | for (child = menu->list; child; child = child->next) { | ||
611 | if (menu_is_visible(child) && child->sym == def_sym) | ||
612 | def_menu = child; | ||
613 | } | ||
614 | |||
615 | val = sym_get_tristate_value(sym); | ||
616 | if (sym_is_changable(sym)) { | ||
617 | cprint("t%p", menu); | ||
618 | switch (type) { | ||
619 | case S_BOOLEAN: | ||
620 | cprint1("[%c]", val == no ? ' ' : '*'); | ||
621 | break; | ||
622 | case S_TRISTATE: | ||
623 | switch (val) { | ||
624 | case yes: ch = '*'; break; | ||
625 | case mod: ch = 'M'; break; | ||
626 | default: ch = ' '; break; | ||
627 | } | ||
628 | cprint1("<%c>", ch); | ||
629 | break; | ||
630 | } | ||
631 | } else { | ||
632 | cprint("%c%p", def_menu ? 't' : ':', menu); | ||
633 | cprint1(" "); | ||
634 | } | ||
635 | |||
636 | cprint1("%*c%s", indent + 1, ' ', menu_get_prompt(menu)); | ||
637 | if (val == yes) { | ||
638 | if (def_menu) { | ||
639 | cprint1(" (%s)", menu_get_prompt(def_menu)); | ||
640 | cprint1(" --->"); | ||
641 | cprint_done(); | ||
642 | if (def_menu->list) { | ||
643 | indent += 2; | ||
644 | build_conf(def_menu); | ||
645 | indent -= 2; | ||
646 | } | ||
647 | } else | ||
648 | cprint_done(); | ||
649 | return; | ||
650 | } | ||
651 | cprint_done(); | ||
652 | } else { | ||
653 | if (menu == current_menu) { | ||
654 | cprint(":%p", menu); | ||
655 | cprint("---%*c%s", indent + 1, ' ', menu_get_prompt(menu)); | ||
656 | goto conf_childs; | ||
657 | } | ||
658 | child_count++; | ||
659 | val = sym_get_tristate_value(sym); | ||
660 | if (sym_is_choice_value(sym) && val == yes) { | ||
661 | cprint(":%p", menu); | ||
662 | cprint1(" "); | ||
663 | } else { | ||
664 | switch (type) { | ||
665 | case S_BOOLEAN: | ||
666 | cprint("t%p", menu); | ||
667 | if (sym_is_changable(sym)) | ||
668 | cprint1("[%c]", val == no ? ' ' : '*'); | ||
669 | else | ||
670 | cprint1("---"); | ||
671 | break; | ||
672 | case S_TRISTATE: | ||
673 | cprint("t%p", menu); | ||
674 | switch (val) { | ||
675 | case yes: ch = '*'; break; | ||
676 | case mod: ch = 'M'; break; | ||
677 | default: ch = ' '; break; | ||
678 | } | ||
679 | if (sym_is_changable(sym)) | ||
680 | cprint1("<%c>", ch); | ||
681 | else | ||
682 | cprint1("---"); | ||
683 | break; | ||
684 | default: | ||
685 | cprint("s%p", menu); | ||
686 | tmp = cprint1("(%s)", sym_get_string_value(sym)); | ||
687 | tmp = indent - tmp + 4; | ||
688 | if (tmp < 0) | ||
689 | tmp = 0; | ||
690 | cprint1("%*c%s%s", tmp, ' ', menu_get_prompt(menu), | ||
691 | (sym_has_value(sym) || !sym_is_changable(sym)) ? | ||
692 | "" : " (NEW)"); | ||
693 | cprint_done(); | ||
694 | goto conf_childs; | ||
695 | } | ||
696 | } | ||
697 | cprint1("%*c%s%s", indent + 1, ' ', menu_get_prompt(menu), | ||
698 | (sym_has_value(sym) || !sym_is_changable(sym)) ? | ||
699 | "" : " (NEW)"); | ||
700 | if (menu->prompt->type == P_MENU) { | ||
701 | cprint1(" --->"); | ||
702 | cprint_done(); | ||
703 | return; | ||
704 | } | ||
705 | cprint_done(); | ||
706 | } | ||
707 | |||
708 | conf_childs: | ||
709 | indent += doint; | ||
710 | for (child = menu->list; child; child = child->next) | ||
711 | build_conf(child); | ||
712 | indent -= doint; | ||
713 | } | ||
714 | |||
715 | static void conf(struct menu *menu) | ||
716 | { | ||
717 | struct menu *submenu; | ||
718 | const char *prompt = menu_get_prompt(menu); | ||
719 | struct symbol *sym; | ||
720 | char active_entry[40]; | ||
721 | int stat, type, i; | ||
722 | |||
723 | unlink("lxdialog.scrltmp"); | ||
724 | active_entry[0] = 0; | ||
725 | while (1) { | ||
726 | cprint_init(); | ||
727 | cprint("--title"); | ||
728 | cprint("%s", prompt ? prompt : _("Main Menu")); | ||
729 | cprint("--menu"); | ||
730 | cprint(_(menu_instructions)); | ||
731 | cprint("%d", rows); | ||
732 | cprint("%d", cols); | ||
733 | cprint("%d", rows - 10); | ||
734 | cprint("%s", active_entry); | ||
735 | current_menu = menu; | ||
736 | build_conf(menu); | ||
737 | if (!child_count) | ||
738 | break; | ||
739 | if (menu == &rootmenu) { | ||
740 | cprint(":"); | ||
741 | cprint("--- "); | ||
742 | cprint("L"); | ||
743 | cprint(_(" Load an Alternate Configuration File")); | ||
744 | cprint("S"); | ||
745 | cprint(_(" Save Configuration to an Alternate File")); | ||
746 | } | ||
747 | stat = exec_conf(); | ||
748 | if (stat < 0) | ||
749 | continue; | ||
750 | |||
751 | if (stat == 1 || stat == 255) | ||
752 | break; | ||
753 | |||
754 | type = input_buf[0]; | ||
755 | if (!type) | ||
756 | continue; | ||
757 | |||
758 | for (i = 0; input_buf[i] && !isspace(input_buf[i]); i++) | ||
759 | ; | ||
760 | if (i >= sizeof(active_entry)) | ||
761 | i = sizeof(active_entry) - 1; | ||
762 | input_buf[i] = 0; | ||
763 | strcpy(active_entry, input_buf); | ||
764 | |||
765 | sym = NULL; | ||
766 | submenu = NULL; | ||
767 | if (sscanf(input_buf + 1, "%p", &submenu) == 1) | ||
768 | sym = submenu->sym; | ||
769 | |||
770 | switch (stat) { | ||
771 | case 0: | ||
772 | switch (type) { | ||
773 | case 'm': | ||
774 | if (single_menu_mode) | ||
775 | submenu->data = (void *) (long) !submenu->data; | ||
776 | else | ||
777 | conf(submenu); | ||
778 | break; | ||
779 | case 't': | ||
780 | if (sym_is_choice(sym) && sym_get_tristate_value(sym) == yes) | ||
781 | conf_choice(submenu); | ||
782 | else if (submenu->prompt->type == P_MENU) | ||
783 | conf(submenu); | ||
784 | break; | ||
785 | case 's': | ||
786 | conf_string(submenu); | ||
787 | break; | ||
788 | case 'L': | ||
789 | conf_load(); | ||
790 | break; | ||
791 | case 'S': | ||
792 | conf_save(); | ||
793 | break; | ||
794 | } | ||
795 | break; | ||
796 | case 2: | ||
797 | if (sym) | ||
798 | show_help(submenu); | ||
799 | else | ||
800 | show_helptext("README", _(mconf_readme)); | ||
801 | break; | ||
802 | case 3: | ||
803 | if (type == 't') { | ||
804 | if (sym_set_tristate_value(sym, yes)) | ||
805 | break; | ||
806 | if (sym_set_tristate_value(sym, mod)) | ||
807 | show_textbox(NULL, setmod_text, 6, 74); | ||
808 | } | ||
809 | break; | ||
810 | case 4: | ||
811 | if (type == 't') | ||
812 | sym_set_tristate_value(sym, no); | ||
813 | break; | ||
814 | case 5: | ||
815 | if (type == 't') | ||
816 | sym_set_tristate_value(sym, mod); | ||
817 | break; | ||
818 | case 6: | ||
819 | if (type == 't') | ||
820 | sym_toggle_tristate_value(sym); | ||
821 | else if (type == 'm') | ||
822 | conf(submenu); | ||
823 | break; | ||
824 | case 7: | ||
825 | search_conf(); | ||
826 | break; | ||
827 | } | ||
828 | } | ||
829 | } | ||
830 | |||
831 | static void show_textbox(const char *title, const char *text, int r, int c) | ||
832 | { | ||
833 | int fd; | ||
834 | |||
835 | fd = creat(".help.tmp", 0777); | ||
836 | write(fd, text, strlen(text)); | ||
837 | close(fd); | ||
838 | show_file(".help.tmp", title, r, c); | ||
839 | unlink(".help.tmp"); | ||
840 | } | ||
841 | |||
842 | static void show_helptext(const char *title, const char *text) | ||
843 | { | ||
844 | show_textbox(title, text, 0, 0); | ||
845 | } | ||
846 | |||
847 | static void show_help(struct menu *menu) | ||
848 | { | ||
849 | struct gstr help = str_new(); | ||
850 | struct symbol *sym = menu->sym; | ||
851 | |||
852 | if (sym->help) | ||
853 | { | ||
854 | if (sym->name) { | ||
855 | str_printf(&help, "CONFIG_%s:\n\n", sym->name); | ||
856 | str_append(&help, _(sym->help)); | ||
857 | str_append(&help, "\n"); | ||
858 | } | ||
859 | } else { | ||
860 | str_append(&help, nohelp_text); | ||
861 | } | ||
862 | get_symbol_str(&help, sym); | ||
863 | show_helptext(menu_get_prompt(menu), str_get(&help)); | ||
864 | str_free(&help); | ||
865 | } | ||
866 | |||
867 | static void show_file(const char *filename, const char *title, int r, int c) | ||
868 | { | ||
869 | do { | ||
870 | cprint_init(); | ||
871 | if (title) { | ||
872 | cprint("--title"); | ||
873 | cprint("%s", title); | ||
874 | } | ||
875 | cprint("--textbox"); | ||
876 | cprint("%s", filename); | ||
877 | cprint("%d", r ? r : rows); | ||
878 | cprint("%d", c ? c : cols); | ||
879 | } while (exec_conf() < 0); | ||
880 | } | ||
881 | |||
882 | static void conf_choice(struct menu *menu) | ||
883 | { | ||
884 | const char *prompt = menu_get_prompt(menu); | ||
885 | struct menu *child; | ||
886 | struct symbol *active; | ||
887 | int stat; | ||
888 | |||
889 | active = sym_get_choice_value(menu->sym); | ||
890 | while (1) { | ||
891 | cprint_init(); | ||
892 | cprint("--title"); | ||
893 | cprint("%s", prompt ? prompt : _("Main Menu")); | ||
894 | cprint("--radiolist"); | ||
895 | cprint(_(radiolist_instructions)); | ||
896 | cprint("15"); | ||
897 | cprint("70"); | ||
898 | cprint("6"); | ||
899 | |||
900 | current_menu = menu; | ||
901 | for (child = menu->list; child; child = child->next) { | ||
902 | if (!menu_is_visible(child)) | ||
903 | continue; | ||
904 | cprint("%p", child); | ||
905 | cprint("%s", menu_get_prompt(child)); | ||
906 | if (child->sym == sym_get_choice_value(menu->sym)) | ||
907 | cprint("ON"); | ||
908 | else if (child->sym == active) | ||
909 | cprint("SELECTED"); | ||
910 | else | ||
911 | cprint("OFF"); | ||
912 | } | ||
913 | |||
914 | stat = exec_conf(); | ||
915 | switch (stat) { | ||
916 | case 0: | ||
917 | if (sscanf(input_buf, "%p", &child) != 1) | ||
918 | break; | ||
919 | sym_set_tristate_value(child->sym, yes); | ||
920 | return; | ||
921 | case 1: | ||
922 | if (sscanf(input_buf, "%p", &child) == 1) { | ||
923 | show_help(child); | ||
924 | active = child->sym; | ||
925 | } else | ||
926 | show_help(menu); | ||
927 | break; | ||
928 | case 255: | ||
929 | return; | ||
930 | } | ||
931 | } | ||
932 | } | ||
933 | |||
934 | static void conf_string(struct menu *menu) | ||
935 | { | ||
936 | const char *prompt = menu_get_prompt(menu); | ||
937 | int stat; | ||
938 | |||
939 | while (1) { | ||
940 | cprint_init(); | ||
941 | cprint("--title"); | ||
942 | cprint("%s", prompt ? prompt : _("Main Menu")); | ||
943 | cprint("--inputbox"); | ||
944 | switch (sym_get_type(menu->sym)) { | ||
945 | case S_INT: | ||
946 | cprint(_(inputbox_instructions_int)); | ||
947 | break; | ||
948 | case S_HEX: | ||
949 | cprint(_(inputbox_instructions_hex)); | ||
950 | break; | ||
951 | case S_STRING: | ||
952 | cprint(_(inputbox_instructions_string)); | ||
953 | break; | ||
954 | default: | ||
955 | /* panic? */; | ||
956 | } | ||
957 | cprint("10"); | ||
958 | cprint("75"); | ||
959 | cprint("%s", sym_get_string_value(menu->sym)); | ||
960 | stat = exec_conf(); | ||
961 | switch (stat) { | ||
962 | case 0: | ||
963 | if (sym_set_string_value(menu->sym, input_buf)) | ||
964 | return; | ||
965 | show_textbox(NULL, _("You have made an invalid entry."), 5, 43); | ||
966 | break; | ||
967 | case 1: | ||
968 | show_help(menu); | ||
969 | break; | ||
970 | case 255: | ||
971 | return; | ||
972 | } | ||
973 | } | ||
974 | } | ||
975 | |||
976 | static void conf_load(void) | ||
977 | { | ||
978 | int stat; | ||
979 | |||
980 | while (1) { | ||
981 | cprint_init(); | ||
982 | cprint("--inputbox"); | ||
983 | cprint(load_config_text); | ||
984 | cprint("11"); | ||
985 | cprint("55"); | ||
986 | cprint("%s", filename); | ||
987 | stat = exec_conf(); | ||
988 | switch(stat) { | ||
989 | case 0: | ||
990 | if (!input_buf[0]) | ||
991 | return; | ||
992 | if (!conf_read(input_buf)) | ||
993 | return; | ||
994 | show_textbox(NULL, _("File does not exist!"), 5, 38); | ||
995 | break; | ||
996 | case 1: | ||
997 | show_helptext(_("Load Alternate Configuration"), load_config_help); | ||
998 | break; | ||
999 | case 255: | ||
1000 | return; | ||
1001 | } | ||
1002 | } | ||
1003 | } | ||
1004 | |||
1005 | static void conf_save(void) | ||
1006 | { | ||
1007 | int stat; | ||
1008 | |||
1009 | while (1) { | ||
1010 | cprint_init(); | ||
1011 | cprint("--inputbox"); | ||
1012 | cprint(save_config_text); | ||
1013 | cprint("11"); | ||
1014 | cprint("55"); | ||
1015 | cprint("%s", filename); | ||
1016 | stat = exec_conf(); | ||
1017 | switch(stat) { | ||
1018 | case 0: | ||
1019 | if (!input_buf[0]) | ||
1020 | return; | ||
1021 | if (!conf_write(input_buf)) | ||
1022 | return; | ||
1023 | show_textbox(NULL, _("Can't create file! Probably a nonexistent directory."), 5, 60); | ||
1024 | break; | ||
1025 | case 1: | ||
1026 | show_helptext(_("Save Alternate Configuration"), save_config_help); | ||
1027 | break; | ||
1028 | case 255: | ||
1029 | return; | ||
1030 | } | ||
1031 | } | ||
1032 | } | ||
1033 | |||
1034 | static void conf_cleanup(void) | ||
1035 | { | ||
1036 | tcsetattr(1, TCSAFLUSH, &ios_org); | ||
1037 | unlink(".help.tmp"); | ||
1038 | unlink("lxdialog.scrltmp"); | ||
1039 | } | ||
1040 | |||
1041 | int main(int ac, char **av) | ||
1042 | { | ||
1043 | struct symbol *sym; | ||
1044 | char *mode; | ||
1045 | int stat; | ||
1046 | |||
1047 | setlocale(LC_ALL, ""); | ||
1048 | bindtextdomain(PACKAGE, LOCALEDIR); | ||
1049 | textdomain(PACKAGE); | ||
1050 | |||
1051 | conf_parse(av[1]); | ||
1052 | conf_read(NULL); | ||
1053 | |||
1054 | sym = sym_lookup("KERNELVERSION", 0); | ||
1055 | sym_calc_value(sym); | ||
1056 | sprintf(menu_backtitle, _("Linux Kernel v%s Configuration"), | ||
1057 | sym_get_string_value(sym)); | ||
1058 | |||
1059 | mode = getenv("MENUCONFIG_MODE"); | ||
1060 | if (mode) { | ||
1061 | if (!strcasecmp(mode, "single_menu")) | ||
1062 | single_menu_mode = 1; | ||
1063 | } | ||
1064 | |||
1065 | tcgetattr(1, &ios_org); | ||
1066 | atexit(conf_cleanup); | ||
1067 | init_wsize(); | ||
1068 | conf(&rootmenu); | ||
1069 | |||
1070 | do { | ||
1071 | cprint_init(); | ||
1072 | cprint("--yesno"); | ||
1073 | cprint(_("Do you wish to save your new kernel configuration?")); | ||
1074 | cprint("5"); | ||
1075 | cprint("60"); | ||
1076 | stat = exec_conf(); | ||
1077 | } while (stat < 0); | ||
1078 | |||
1079 | if (stat == 0) { | ||
1080 | if (conf_write(NULL)) { | ||
1081 | fprintf(stderr, _("\n\n" | ||
1082 | "Error during writing of the kernel configuration.\n" | ||
1083 | "Your kernel configuration changes were NOT saved." | ||
1084 | "\n\n")); | ||
1085 | return 1; | ||
1086 | } | ||
1087 | printf(_("\n\n" | ||
1088 | "*** End of Linux kernel configuration.\n" | ||
1089 | "*** Execute 'make' to build the kernel or try 'make help'." | ||
1090 | "\n\n")); | ||
1091 | } else { | ||
1092 | fprintf(stderr, _("\n\n" | ||
1093 | "Your kernel configuration changes were NOT saved." | ||
1094 | "\n\n")); | ||
1095 | } | ||
1096 | |||
1097 | return 0; | ||
1098 | } | ||
diff --git a/scripts/kconfig/menu.c b/scripts/kconfig/menu.c new file mode 100644 index 000000000..0fce20cb7 --- /dev/null +++ b/scripts/kconfig/menu.c | |||
@@ -0,0 +1,397 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org> | ||
3 | * Released under the terms of the GNU GPL v2.0. | ||
4 | */ | ||
5 | |||
6 | #include <stdlib.h> | ||
7 | #include <string.h> | ||
8 | |||
9 | #define LKC_DIRECT_LINK | ||
10 | #include "lkc.h" | ||
11 | |||
12 | struct menu rootmenu; | ||
13 | static struct menu **last_entry_ptr; | ||
14 | |||
15 | struct file *file_list; | ||
16 | struct file *current_file; | ||
17 | |||
18 | static void menu_warn(struct menu *menu, const char *fmt, ...) | ||
19 | { | ||
20 | va_list ap; | ||
21 | va_start(ap, fmt); | ||
22 | fprintf(stderr, "%s:%d:warning: ", menu->file->name, menu->lineno); | ||
23 | vfprintf(stderr, fmt, ap); | ||
24 | fprintf(stderr, "\n"); | ||
25 | va_end(ap); | ||
26 | } | ||
27 | |||
28 | static void prop_warn(struct property *prop, const char *fmt, ...) | ||
29 | { | ||
30 | va_list ap; | ||
31 | va_start(ap, fmt); | ||
32 | fprintf(stderr, "%s:%d:warning: ", prop->file->name, prop->lineno); | ||
33 | vfprintf(stderr, fmt, ap); | ||
34 | fprintf(stderr, "\n"); | ||
35 | va_end(ap); | ||
36 | } | ||
37 | |||
38 | void menu_init(void) | ||
39 | { | ||
40 | current_entry = current_menu = &rootmenu; | ||
41 | last_entry_ptr = &rootmenu.list; | ||
42 | } | ||
43 | |||
44 | void menu_add_entry(struct symbol *sym) | ||
45 | { | ||
46 | struct menu *menu; | ||
47 | |||
48 | menu = malloc(sizeof(*menu)); | ||
49 | memset(menu, 0, sizeof(*menu)); | ||
50 | menu->sym = sym; | ||
51 | menu->parent = current_menu; | ||
52 | menu->file = current_file; | ||
53 | menu->lineno = zconf_lineno(); | ||
54 | |||
55 | *last_entry_ptr = menu; | ||
56 | last_entry_ptr = &menu->next; | ||
57 | current_entry = menu; | ||
58 | } | ||
59 | |||
60 | void menu_end_entry(void) | ||
61 | { | ||
62 | } | ||
63 | |||
64 | struct menu *menu_add_menu(void) | ||
65 | { | ||
66 | menu_end_entry(); | ||
67 | last_entry_ptr = ¤t_entry->list; | ||
68 | return current_menu = current_entry; | ||
69 | } | ||
70 | |||
71 | void menu_end_menu(void) | ||
72 | { | ||
73 | last_entry_ptr = ¤t_menu->next; | ||
74 | current_menu = current_menu->parent; | ||
75 | } | ||
76 | |||
77 | struct expr *menu_check_dep(struct expr *e) | ||
78 | { | ||
79 | if (!e) | ||
80 | return e; | ||
81 | |||
82 | switch (e->type) { | ||
83 | case E_NOT: | ||
84 | e->left.expr = menu_check_dep(e->left.expr); | ||
85 | break; | ||
86 | case E_OR: | ||
87 | case E_AND: | ||
88 | e->left.expr = menu_check_dep(e->left.expr); | ||
89 | e->right.expr = menu_check_dep(e->right.expr); | ||
90 | break; | ||
91 | case E_SYMBOL: | ||
92 | /* change 'm' into 'm' && MODULES */ | ||
93 | if (e->left.sym == &symbol_mod) | ||
94 | return expr_alloc_and(e, expr_alloc_symbol(modules_sym)); | ||
95 | break; | ||
96 | default: | ||
97 | break; | ||
98 | } | ||
99 | return e; | ||
100 | } | ||
101 | |||
102 | void menu_add_dep(struct expr *dep) | ||
103 | { | ||
104 | current_entry->dep = expr_alloc_and(current_entry->dep, menu_check_dep(dep)); | ||
105 | } | ||
106 | |||
107 | void menu_set_type(int type) | ||
108 | { | ||
109 | struct symbol *sym = current_entry->sym; | ||
110 | |||
111 | if (sym->type == type) | ||
112 | return; | ||
113 | if (sym->type == S_UNKNOWN) { | ||
114 | sym->type = type; | ||
115 | return; | ||
116 | } | ||
117 | menu_warn(current_entry, "type of '%s' redefined from '%s' to '%s'\n", | ||
118 | sym->name ? sym->name : "<choice>", | ||
119 | sym_type_name(sym->type), sym_type_name(type)); | ||
120 | } | ||
121 | |||
122 | struct property *menu_add_prop(enum prop_type type, char *prompt, struct expr *expr, struct expr *dep) | ||
123 | { | ||
124 | struct property *prop = prop_alloc(type, current_entry->sym); | ||
125 | |||
126 | prop->menu = current_entry; | ||
127 | prop->text = prompt; | ||
128 | prop->expr = expr; | ||
129 | prop->visible.expr = menu_check_dep(dep); | ||
130 | |||
131 | if (prompt) { | ||
132 | if (current_entry->prompt) | ||
133 | menu_warn(current_entry, "prompt redefined\n"); | ||
134 | current_entry->prompt = prop; | ||
135 | } | ||
136 | |||
137 | return prop; | ||
138 | } | ||
139 | |||
140 | struct property *menu_add_prompt(enum prop_type type, char *prompt, struct expr *dep) | ||
141 | { | ||
142 | return menu_add_prop(type, prompt, NULL, dep); | ||
143 | } | ||
144 | |||
145 | void menu_add_expr(enum prop_type type, struct expr *expr, struct expr *dep) | ||
146 | { | ||
147 | menu_add_prop(type, NULL, expr, dep); | ||
148 | } | ||
149 | |||
150 | void menu_add_symbol(enum prop_type type, struct symbol *sym, struct expr *dep) | ||
151 | { | ||
152 | menu_add_prop(type, NULL, expr_alloc_symbol(sym), dep); | ||
153 | } | ||
154 | |||
155 | static int menu_range_valid_sym(struct symbol *sym, struct symbol *sym2) | ||
156 | { | ||
157 | return sym2->type == S_INT || sym2->type == S_HEX || | ||
158 | (sym2->type == S_UNKNOWN && sym_string_valid(sym, sym2->name)); | ||
159 | } | ||
160 | |||
161 | void sym_check_prop(struct symbol *sym) | ||
162 | { | ||
163 | struct property *prop; | ||
164 | struct symbol *sym2; | ||
165 | for (prop = sym->prop; prop; prop = prop->next) { | ||
166 | switch (prop->type) { | ||
167 | case P_DEFAULT: | ||
168 | if ((sym->type == S_STRING || sym->type == S_INT || sym->type == S_HEX) && | ||
169 | prop->expr->type != E_SYMBOL) | ||
170 | prop_warn(prop, | ||
171 | "default for config symbol '%'" | ||
172 | " must be a single symbol", sym->name); | ||
173 | break; | ||
174 | case P_SELECT: | ||
175 | sym2 = prop_get_symbol(prop); | ||
176 | if (sym->type != S_BOOLEAN && sym->type != S_TRISTATE) | ||
177 | prop_warn(prop, | ||
178 | "config symbol '%s' uses select, but is " | ||
179 | "not boolean or tristate", sym->name); | ||
180 | else if (sym2->type == S_UNKNOWN) | ||
181 | prop_warn(prop, | ||
182 | "'select' used by config symbol '%s' " | ||
183 | "refer to undefined symbol '%s'", | ||
184 | sym->name, sym2->name); | ||
185 | else if (sym2->type != S_BOOLEAN && sym2->type != S_TRISTATE) | ||
186 | prop_warn(prop, | ||
187 | "'%s' has wrong type. 'select' only " | ||
188 | "accept arguments of boolean and " | ||
189 | "tristate type", sym2->name); | ||
190 | break; | ||
191 | case P_RANGE: | ||
192 | if (sym->type != S_INT && sym->type != S_HEX) | ||
193 | prop_warn(prop, "range is only allowed " | ||
194 | "for int or hex symbols"); | ||
195 | if (!menu_range_valid_sym(sym, prop->expr->left.sym) || | ||
196 | !menu_range_valid_sym(sym, prop->expr->right.sym)) | ||
197 | prop_warn(prop, "range is invalid"); | ||
198 | break; | ||
199 | default: | ||
200 | ; | ||
201 | } | ||
202 | } | ||
203 | } | ||
204 | |||
205 | void menu_finalize(struct menu *parent) | ||
206 | { | ||
207 | struct menu *menu, *last_menu; | ||
208 | struct symbol *sym; | ||
209 | struct property *prop; | ||
210 | struct expr *parentdep, *basedep, *dep, *dep2, **ep; | ||
211 | |||
212 | sym = parent->sym; | ||
213 | if (parent->list) { | ||
214 | if (sym && sym_is_choice(sym)) { | ||
215 | /* find the first choice value and find out choice type */ | ||
216 | for (menu = parent->list; menu; menu = menu->next) { | ||
217 | if (menu->sym) { | ||
218 | current_entry = parent; | ||
219 | menu_set_type(menu->sym->type); | ||
220 | current_entry = menu; | ||
221 | menu_set_type(sym->type); | ||
222 | break; | ||
223 | } | ||
224 | } | ||
225 | parentdep = expr_alloc_symbol(sym); | ||
226 | } else if (parent->prompt) | ||
227 | parentdep = parent->prompt->visible.expr; | ||
228 | else | ||
229 | parentdep = parent->dep; | ||
230 | |||
231 | for (menu = parent->list; menu; menu = menu->next) { | ||
232 | basedep = expr_transform(menu->dep); | ||
233 | basedep = expr_alloc_and(expr_copy(parentdep), basedep); | ||
234 | basedep = expr_eliminate_dups(basedep); | ||
235 | menu->dep = basedep; | ||
236 | if (menu->sym) | ||
237 | prop = menu->sym->prop; | ||
238 | else | ||
239 | prop = menu->prompt; | ||
240 | for (; prop; prop = prop->next) { | ||
241 | if (prop->menu != menu) | ||
242 | continue; | ||
243 | dep = expr_transform(prop->visible.expr); | ||
244 | dep = expr_alloc_and(expr_copy(basedep), dep); | ||
245 | dep = expr_eliminate_dups(dep); | ||
246 | if (menu->sym && menu->sym->type != S_TRISTATE) | ||
247 | dep = expr_trans_bool(dep); | ||
248 | prop->visible.expr = dep; | ||
249 | if (prop->type == P_SELECT) { | ||
250 | struct symbol *es = prop_get_symbol(prop); | ||
251 | es->rev_dep.expr = expr_alloc_or(es->rev_dep.expr, | ||
252 | expr_alloc_and(expr_alloc_symbol(menu->sym), expr_copy(dep))); | ||
253 | } | ||
254 | } | ||
255 | } | ||
256 | for (menu = parent->list; menu; menu = menu->next) | ||
257 | menu_finalize(menu); | ||
258 | } else if (sym) { | ||
259 | basedep = parent->prompt ? parent->prompt->visible.expr : NULL; | ||
260 | basedep = expr_trans_compare(basedep, E_UNEQUAL, &symbol_no); | ||
261 | basedep = expr_eliminate_dups(expr_transform(basedep)); | ||
262 | last_menu = NULL; | ||
263 | for (menu = parent->next; menu; menu = menu->next) { | ||
264 | dep = menu->prompt ? menu->prompt->visible.expr : menu->dep; | ||
265 | if (!expr_contains_symbol(dep, sym)) | ||
266 | break; | ||
267 | if (expr_depends_symbol(dep, sym)) | ||
268 | goto next; | ||
269 | dep = expr_trans_compare(dep, E_UNEQUAL, &symbol_no); | ||
270 | dep = expr_eliminate_dups(expr_transform(dep)); | ||
271 | dep2 = expr_copy(basedep); | ||
272 | expr_eliminate_eq(&dep, &dep2); | ||
273 | expr_free(dep); | ||
274 | if (!expr_is_yes(dep2)) { | ||
275 | expr_free(dep2); | ||
276 | break; | ||
277 | } | ||
278 | expr_free(dep2); | ||
279 | next: | ||
280 | menu_finalize(menu); | ||
281 | menu->parent = parent; | ||
282 | last_menu = menu; | ||
283 | } | ||
284 | if (last_menu) { | ||
285 | parent->list = parent->next; | ||
286 | parent->next = last_menu->next; | ||
287 | last_menu->next = NULL; | ||
288 | } | ||
289 | } | ||
290 | for (menu = parent->list; menu; menu = menu->next) { | ||
291 | if (sym && sym_is_choice(sym) && menu->sym) { | ||
292 | menu->sym->flags |= SYMBOL_CHOICEVAL; | ||
293 | if (!menu->prompt) | ||
294 | menu_warn(menu, "choice value must have a prompt"); | ||
295 | for (prop = menu->sym->prop; prop; prop = prop->next) { | ||
296 | if (prop->type == P_PROMPT && prop->menu != menu) { | ||
297 | prop_warn(prop, "choice values " | ||
298 | "currently only support a " | ||
299 | "single prompt"); | ||
300 | } | ||
301 | if (prop->type == P_DEFAULT) | ||
302 | prop_warn(prop, "defaults for choice " | ||
303 | "values not supported"); | ||
304 | } | ||
305 | current_entry = menu; | ||
306 | menu_set_type(sym->type); | ||
307 | menu_add_symbol(P_CHOICE, sym, NULL); | ||
308 | prop = sym_get_choice_prop(sym); | ||
309 | for (ep = &prop->expr; *ep; ep = &(*ep)->left.expr) | ||
310 | ; | ||
311 | *ep = expr_alloc_one(E_CHOICE, NULL); | ||
312 | (*ep)->right.sym = menu->sym; | ||
313 | } | ||
314 | if (menu->list && (!menu->prompt || !menu->prompt->text)) { | ||
315 | for (last_menu = menu->list; ; last_menu = last_menu->next) { | ||
316 | last_menu->parent = parent; | ||
317 | if (!last_menu->next) | ||
318 | break; | ||
319 | } | ||
320 | last_menu->next = menu->next; | ||
321 | menu->next = menu->list; | ||
322 | menu->list = NULL; | ||
323 | } | ||
324 | } | ||
325 | |||
326 | if (sym && !(sym->flags & SYMBOL_WARNED)) { | ||
327 | if (sym->type == S_UNKNOWN) | ||
328 | menu_warn(parent, "config symbol defined " | ||
329 | "without type\n"); | ||
330 | |||
331 | if (sym_is_choice(sym) && !parent->prompt) | ||
332 | menu_warn(parent, "choice must have a prompt\n"); | ||
333 | |||
334 | /* Check properties connected to this symbol */ | ||
335 | sym_check_prop(sym); | ||
336 | sym->flags |= SYMBOL_WARNED; | ||
337 | } | ||
338 | |||
339 | if (sym && !sym_is_optional(sym) && parent->prompt) { | ||
340 | sym->rev_dep.expr = expr_alloc_or(sym->rev_dep.expr, | ||
341 | expr_alloc_and(parent->prompt->visible.expr, | ||
342 | expr_alloc_symbol(&symbol_mod))); | ||
343 | } | ||
344 | } | ||
345 | |||
346 | bool menu_is_visible(struct menu *menu) | ||
347 | { | ||
348 | struct menu *child; | ||
349 | struct symbol *sym; | ||
350 | tristate visible; | ||
351 | |||
352 | if (!menu->prompt) | ||
353 | return false; | ||
354 | sym = menu->sym; | ||
355 | if (sym) { | ||
356 | sym_calc_value(sym); | ||
357 | visible = menu->prompt->visible.tri; | ||
358 | } else | ||
359 | visible = menu->prompt->visible.tri = expr_calc_value(menu->prompt->visible.expr); | ||
360 | |||
361 | if (visible != no) | ||
362 | return true; | ||
363 | if (!sym || sym_get_tristate_value(menu->sym) == no) | ||
364 | return false; | ||
365 | |||
366 | for (child = menu->list; child; child = child->next) | ||
367 | if (menu_is_visible(child)) | ||
368 | return true; | ||
369 | return false; | ||
370 | } | ||
371 | |||
372 | const char *menu_get_prompt(struct menu *menu) | ||
373 | { | ||
374 | if (menu->prompt) | ||
375 | return _(menu->prompt->text); | ||
376 | else if (menu->sym) | ||
377 | return _(menu->sym->name); | ||
378 | return NULL; | ||
379 | } | ||
380 | |||
381 | struct menu *menu_get_root_menu(struct menu *menu) | ||
382 | { | ||
383 | return &rootmenu; | ||
384 | } | ||
385 | |||
386 | struct menu *menu_get_parent_menu(struct menu *menu) | ||
387 | { | ||
388 | enum prop_type type; | ||
389 | |||
390 | for (; menu != &rootmenu; menu = menu->parent) { | ||
391 | type = menu->prompt ? menu->prompt->type : 0; | ||
392 | if (type == P_MENU) | ||
393 | break; | ||
394 | } | ||
395 | return menu; | ||
396 | } | ||
397 | |||
diff --git a/scripts/kconfig/qconf.cc b/scripts/kconfig/qconf.cc new file mode 100644 index 000000000..4590cd316 --- /dev/null +++ b/scripts/kconfig/qconf.cc | |||
@@ -0,0 +1,1426 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org> | ||
3 | * Released under the terms of the GNU GPL v2.0. | ||
4 | */ | ||
5 | |||
6 | #include <qapplication.h> | ||
7 | #include <qmainwindow.h> | ||
8 | #include <qtoolbar.h> | ||
9 | #include <qvbox.h> | ||
10 | #include <qsplitter.h> | ||
11 | #include <qlistview.h> | ||
12 | #include <qtextview.h> | ||
13 | #include <qlineedit.h> | ||
14 | #include <qmenubar.h> | ||
15 | #include <qmessagebox.h> | ||
16 | #include <qaction.h> | ||
17 | #include <qheader.h> | ||
18 | #include <qfiledialog.h> | ||
19 | #include <qregexp.h> | ||
20 | |||
21 | #include <stdlib.h> | ||
22 | |||
23 | #include "lkc.h" | ||
24 | #include "qconf.h" | ||
25 | |||
26 | #include "qconf.moc" | ||
27 | #include "images.c" | ||
28 | |||
29 | #ifdef _ | ||
30 | # undef _ | ||
31 | # define _ qgettext | ||
32 | #endif | ||
33 | |||
34 | static QApplication *configApp; | ||
35 | |||
36 | static inline QString qgettext(const char* str) | ||
37 | { | ||
38 | return QString::fromLocal8Bit(gettext(str)); | ||
39 | } | ||
40 | |||
41 | static inline QString qgettext(const QString& str) | ||
42 | { | ||
43 | return QString::fromLocal8Bit(gettext(str.latin1())); | ||
44 | } | ||
45 | |||
46 | ConfigSettings::ConfigSettings() | ||
47 | : showAll(false), showName(false), showRange(false), showData(false) | ||
48 | { | ||
49 | } | ||
50 | |||
51 | #if QT_VERSION >= 300 | ||
52 | /** | ||
53 | * Reads the list column settings from the application settings. | ||
54 | */ | ||
55 | void ConfigSettings::readListSettings() | ||
56 | { | ||
57 | showAll = readBoolEntry("/kconfig/qconf/showAll", false); | ||
58 | showName = readBoolEntry("/kconfig/qconf/showName", false); | ||
59 | showRange = readBoolEntry("/kconfig/qconf/showRange", false); | ||
60 | showData = readBoolEntry("/kconfig/qconf/showData", false); | ||
61 | } | ||
62 | |||
63 | /** | ||
64 | * Reads a list of integer values from the application settings. | ||
65 | */ | ||
66 | QValueList<int> ConfigSettings::readSizes(const QString& key, bool *ok) | ||
67 | { | ||
68 | QValueList<int> result; | ||
69 | QStringList entryList = readListEntry(key, ok); | ||
70 | if (ok) { | ||
71 | QStringList::Iterator it; | ||
72 | for (it = entryList.begin(); it != entryList.end(); ++it) | ||
73 | result.push_back((*it).toInt()); | ||
74 | } | ||
75 | |||
76 | return result; | ||
77 | } | ||
78 | |||
79 | /** | ||
80 | * Writes a list of integer values to the application settings. | ||
81 | */ | ||
82 | bool ConfigSettings::writeSizes(const QString& key, const QValueList<int>& value) | ||
83 | { | ||
84 | QStringList stringList; | ||
85 | QValueList<int>::ConstIterator it; | ||
86 | |||
87 | for (it = value.begin(); it != value.end(); ++it) | ||
88 | stringList.push_back(QString::number(*it)); | ||
89 | return writeEntry(key, stringList); | ||
90 | } | ||
91 | #endif | ||
92 | |||
93 | |||
94 | /* | ||
95 | * update all the children of a menu entry | ||
96 | * removes/adds the entries from the parent widget as necessary | ||
97 | * | ||
98 | * parent: either the menu list widget or a menu entry widget | ||
99 | * menu: entry to be updated | ||
100 | */ | ||
101 | template <class P> | ||
102 | void ConfigList::updateMenuList(P* parent, struct menu* menu) | ||
103 | { | ||
104 | struct menu* child; | ||
105 | ConfigItem* item; | ||
106 | ConfigItem* last; | ||
107 | bool visible; | ||
108 | enum prop_type type; | ||
109 | |||
110 | if (!menu) { | ||
111 | while ((item = parent->firstChild())) | ||
112 | delete item; | ||
113 | return; | ||
114 | } | ||
115 | |||
116 | last = parent->firstChild(); | ||
117 | if (last && !last->goParent) | ||
118 | last = 0; | ||
119 | for (child = menu->list; child; child = child->next) { | ||
120 | item = last ? last->nextSibling() : parent->firstChild(); | ||
121 | type = child->prompt ? child->prompt->type : P_UNKNOWN; | ||
122 | |||
123 | switch (mode) { | ||
124 | case menuMode: | ||
125 | if (!(child->flags & MENU_ROOT)) | ||
126 | goto hide; | ||
127 | break; | ||
128 | case symbolMode: | ||
129 | if (child->flags & MENU_ROOT) | ||
130 | goto hide; | ||
131 | break; | ||
132 | default: | ||
133 | break; | ||
134 | } | ||
135 | |||
136 | visible = menu_is_visible(child); | ||
137 | if (showAll || visible) { | ||
138 | if (!item || item->menu != child) | ||
139 | item = new ConfigItem(parent, last, child, visible); | ||
140 | else | ||
141 | item->testUpdateMenu(visible); | ||
142 | |||
143 | if (mode == fullMode || mode == menuMode || type != P_MENU) | ||
144 | updateMenuList(item, child); | ||
145 | else | ||
146 | updateMenuList(item, 0); | ||
147 | last = item; | ||
148 | continue; | ||
149 | } | ||
150 | hide: | ||
151 | if (item && item->menu == child) { | ||
152 | last = parent->firstChild(); | ||
153 | if (last == item) | ||
154 | last = 0; | ||
155 | else while (last->nextSibling() != item) | ||
156 | last = last->nextSibling(); | ||
157 | delete item; | ||
158 | } | ||
159 | } | ||
160 | } | ||
161 | |||
162 | #if QT_VERSION >= 300 | ||
163 | /* | ||
164 | * set the new data | ||
165 | * TODO check the value | ||
166 | */ | ||
167 | void ConfigItem::okRename(int col) | ||
168 | { | ||
169 | Parent::okRename(col); | ||
170 | sym_set_string_value(menu->sym, text(dataColIdx).latin1()); | ||
171 | } | ||
172 | #endif | ||
173 | |||
174 | /* | ||
175 | * update the displayed of a menu entry | ||
176 | */ | ||
177 | void ConfigItem::updateMenu(void) | ||
178 | { | ||
179 | ConfigList* list; | ||
180 | struct symbol* sym; | ||
181 | struct property *prop; | ||
182 | QString prompt; | ||
183 | int type; | ||
184 | tristate expr; | ||
185 | |||
186 | list = listView(); | ||
187 | if (goParent) { | ||
188 | setPixmap(promptColIdx, list->menuBackPix); | ||
189 | prompt = ".."; | ||
190 | goto set_prompt; | ||
191 | } | ||
192 | |||
193 | sym = menu->sym; | ||
194 | prop = menu->prompt; | ||
195 | prompt = QString::fromLocal8Bit(menu_get_prompt(menu)); | ||
196 | |||
197 | if (prop) switch (prop->type) { | ||
198 | case P_MENU: | ||
199 | if (list->mode == singleMode || list->mode == symbolMode) { | ||
200 | /* a menuconfig entry is displayed differently | ||
201 | * depending whether it's at the view root or a child. | ||
202 | */ | ||
203 | if (sym && list->rootEntry == menu) | ||
204 | break; | ||
205 | setPixmap(promptColIdx, list->menuPix); | ||
206 | } else { | ||
207 | if (sym) | ||
208 | break; | ||
209 | setPixmap(promptColIdx, 0); | ||
210 | } | ||
211 | goto set_prompt; | ||
212 | case P_COMMENT: | ||
213 | setPixmap(promptColIdx, 0); | ||
214 | goto set_prompt; | ||
215 | default: | ||
216 | ; | ||
217 | } | ||
218 | if (!sym) | ||
219 | goto set_prompt; | ||
220 | |||
221 | setText(nameColIdx, QString::fromLocal8Bit(sym->name)); | ||
222 | |||
223 | type = sym_get_type(sym); | ||
224 | switch (type) { | ||
225 | case S_BOOLEAN: | ||
226 | case S_TRISTATE: | ||
227 | char ch; | ||
228 | |||
229 | if (!sym_is_changable(sym) && !list->showAll) { | ||
230 | setPixmap(promptColIdx, 0); | ||
231 | setText(noColIdx, QString::null); | ||
232 | setText(modColIdx, QString::null); | ||
233 | setText(yesColIdx, QString::null); | ||
234 | break; | ||
235 | } | ||
236 | expr = sym_get_tristate_value(sym); | ||
237 | switch (expr) { | ||
238 | case yes: | ||
239 | if (sym_is_choice_value(sym) && type == S_BOOLEAN) | ||
240 | setPixmap(promptColIdx, list->choiceYesPix); | ||
241 | else | ||
242 | setPixmap(promptColIdx, list->symbolYesPix); | ||
243 | setText(yesColIdx, "Y"); | ||
244 | ch = 'Y'; | ||
245 | break; | ||
246 | case mod: | ||
247 | setPixmap(promptColIdx, list->symbolModPix); | ||
248 | setText(modColIdx, "M"); | ||
249 | ch = 'M'; | ||
250 | break; | ||
251 | default: | ||
252 | if (sym_is_choice_value(sym) && type == S_BOOLEAN) | ||
253 | setPixmap(promptColIdx, list->choiceNoPix); | ||
254 | else | ||
255 | setPixmap(promptColIdx, list->symbolNoPix); | ||
256 | setText(noColIdx, "N"); | ||
257 | ch = 'N'; | ||
258 | break; | ||
259 | } | ||
260 | if (expr != no) | ||
261 | setText(noColIdx, sym_tristate_within_range(sym, no) ? "_" : 0); | ||
262 | if (expr != mod) | ||
263 | setText(modColIdx, sym_tristate_within_range(sym, mod) ? "_" : 0); | ||
264 | if (expr != yes) | ||
265 | setText(yesColIdx, sym_tristate_within_range(sym, yes) ? "_" : 0); | ||
266 | |||
267 | setText(dataColIdx, QChar(ch)); | ||
268 | break; | ||
269 | case S_INT: | ||
270 | case S_HEX: | ||
271 | case S_STRING: | ||
272 | const char* data; | ||
273 | |||
274 | data = sym_get_string_value(sym); | ||
275 | |||
276 | #if QT_VERSION >= 300 | ||
277 | int i = list->mapIdx(dataColIdx); | ||
278 | if (i >= 0) | ||
279 | setRenameEnabled(i, TRUE); | ||
280 | #endif | ||
281 | setText(dataColIdx, data); | ||
282 | if (type == S_STRING) | ||
283 | prompt = QString("%1: %2").arg(prompt).arg(data); | ||
284 | else | ||
285 | prompt = QString("(%2) %1").arg(prompt).arg(data); | ||
286 | break; | ||
287 | } | ||
288 | if (!sym_has_value(sym) && visible) | ||
289 | prompt += " (NEW)"; | ||
290 | set_prompt: | ||
291 | setText(promptColIdx, prompt); | ||
292 | } | ||
293 | |||
294 | void ConfigItem::testUpdateMenu(bool v) | ||
295 | { | ||
296 | ConfigItem* i; | ||
297 | |||
298 | visible = v; | ||
299 | if (!menu) | ||
300 | return; | ||
301 | |||
302 | sym_calc_value(menu->sym); | ||
303 | if (menu->flags & MENU_CHANGED) { | ||
304 | /* the menu entry changed, so update all list items */ | ||
305 | menu->flags &= ~MENU_CHANGED; | ||
306 | for (i = (ConfigItem*)menu->data; i; i = i->nextItem) | ||
307 | i->updateMenu(); | ||
308 | } else if (listView()->updateAll) | ||
309 | updateMenu(); | ||
310 | } | ||
311 | |||
312 | void ConfigItem::paintCell(QPainter* p, const QColorGroup& cg, int column, int width, int align) | ||
313 | { | ||
314 | ConfigList* list = listView(); | ||
315 | |||
316 | if (visible) { | ||
317 | if (isSelected() && !list->hasFocus() && list->mode == menuMode) | ||
318 | Parent::paintCell(p, list->inactivedColorGroup, column, width, align); | ||
319 | else | ||
320 | Parent::paintCell(p, cg, column, width, align); | ||
321 | } else | ||
322 | Parent::paintCell(p, list->disabledColorGroup, column, width, align); | ||
323 | } | ||
324 | |||
325 | /* | ||
326 | * construct a menu entry | ||
327 | */ | ||
328 | void ConfigItem::init(void) | ||
329 | { | ||
330 | if (menu) { | ||
331 | ConfigList* list = listView(); | ||
332 | nextItem = (ConfigItem*)menu->data; | ||
333 | menu->data = this; | ||
334 | |||
335 | if (list->mode != fullMode) | ||
336 | setOpen(TRUE); | ||
337 | sym_calc_value(menu->sym); | ||
338 | } | ||
339 | updateMenu(); | ||
340 | } | ||
341 | |||
342 | /* | ||
343 | * destruct a menu entry | ||
344 | */ | ||
345 | ConfigItem::~ConfigItem(void) | ||
346 | { | ||
347 | if (menu) { | ||
348 | ConfigItem** ip = (ConfigItem**)&menu->data; | ||
349 | for (; *ip; ip = &(*ip)->nextItem) { | ||
350 | if (*ip == this) { | ||
351 | *ip = nextItem; | ||
352 | break; | ||
353 | } | ||
354 | } | ||
355 | } | ||
356 | } | ||
357 | |||
358 | void ConfigLineEdit::show(ConfigItem* i) | ||
359 | { | ||
360 | item = i; | ||
361 | if (sym_get_string_value(item->menu->sym)) | ||
362 | setText(QString::fromLocal8Bit(sym_get_string_value(item->menu->sym))); | ||
363 | else | ||
364 | setText(QString::null); | ||
365 | Parent::show(); | ||
366 | setFocus(); | ||
367 | } | ||
368 | |||
369 | void ConfigLineEdit::keyPressEvent(QKeyEvent* e) | ||
370 | { | ||
371 | switch (e->key()) { | ||
372 | case Key_Escape: | ||
373 | break; | ||
374 | case Key_Return: | ||
375 | case Key_Enter: | ||
376 | sym_set_string_value(item->menu->sym, text().latin1()); | ||
377 | parent()->updateList(item); | ||
378 | break; | ||
379 | default: | ||
380 | Parent::keyPressEvent(e); | ||
381 | return; | ||
382 | } | ||
383 | e->accept(); | ||
384 | parent()->list->setFocus(); | ||
385 | hide(); | ||
386 | } | ||
387 | |||
388 | ConfigList::ConfigList(ConfigView* p, ConfigMainWindow* cv, ConfigSettings* configSettings) | ||
389 | : Parent(p), cview(cv), | ||
390 | updateAll(false), | ||
391 | symbolYesPix(xpm_symbol_yes), symbolModPix(xpm_symbol_mod), symbolNoPix(xpm_symbol_no), | ||
392 | choiceYesPix(xpm_choice_yes), choiceNoPix(xpm_choice_no), | ||
393 | menuPix(xpm_menu), menuInvPix(xpm_menu_inv), menuBackPix(xpm_menuback), voidPix(xpm_void), | ||
394 | showAll(false), showName(false), showRange(false), showData(false), | ||
395 | rootEntry(0) | ||
396 | { | ||
397 | int i; | ||
398 | |||
399 | setSorting(-1); | ||
400 | setRootIsDecorated(TRUE); | ||
401 | disabledColorGroup = palette().active(); | ||
402 | disabledColorGroup.setColor(QColorGroup::Text, palette().disabled().text()); | ||
403 | inactivedColorGroup = palette().active(); | ||
404 | inactivedColorGroup.setColor(QColorGroup::Highlight, palette().disabled().highlight()); | ||
405 | |||
406 | connect(this, SIGNAL(selectionChanged(void)), | ||
407 | SLOT(updateSelection(void))); | ||
408 | |||
409 | if (configSettings) { | ||
410 | showAll = configSettings->showAll; | ||
411 | showName = configSettings->showName; | ||
412 | showRange = configSettings->showRange; | ||
413 | showData = configSettings->showData; | ||
414 | } | ||
415 | |||
416 | for (i = 0; i < colNr; i++) | ||
417 | colMap[i] = colRevMap[i] = -1; | ||
418 | addColumn(promptColIdx, "Option"); | ||
419 | |||
420 | reinit(); | ||
421 | } | ||
422 | |||
423 | void ConfigList::reinit(void) | ||
424 | { | ||
425 | removeColumn(dataColIdx); | ||
426 | removeColumn(yesColIdx); | ||
427 | removeColumn(modColIdx); | ||
428 | removeColumn(noColIdx); | ||
429 | removeColumn(nameColIdx); | ||
430 | |||
431 | if (showName) | ||
432 | addColumn(nameColIdx, "Name"); | ||
433 | if (showRange) { | ||
434 | addColumn(noColIdx, "N"); | ||
435 | addColumn(modColIdx, "M"); | ||
436 | addColumn(yesColIdx, "Y"); | ||
437 | } | ||
438 | if (showData) | ||
439 | addColumn(dataColIdx, "Value"); | ||
440 | |||
441 | updateListAll(); | ||
442 | } | ||
443 | |||
444 | void ConfigList::updateSelection(void) | ||
445 | { | ||
446 | struct menu *menu; | ||
447 | enum prop_type type; | ||
448 | |||
449 | ConfigItem* item = (ConfigItem*)selectedItem(); | ||
450 | if (!item) | ||
451 | return; | ||
452 | |||
453 | cview->setHelp(item); | ||
454 | |||
455 | menu = item->menu; | ||
456 | if (!menu) | ||
457 | return; | ||
458 | type = menu->prompt ? menu->prompt->type : P_UNKNOWN; | ||
459 | if (mode == menuMode && type == P_MENU) | ||
460 | emit menuSelected(menu); | ||
461 | } | ||
462 | |||
463 | void ConfigList::updateList(ConfigItem* item) | ||
464 | { | ||
465 | ConfigItem* last = 0; | ||
466 | |||
467 | if (!rootEntry) | ||
468 | goto update; | ||
469 | |||
470 | if (rootEntry != &rootmenu && (mode == singleMode || | ||
471 | (mode == symbolMode && rootEntry->parent != &rootmenu))) { | ||
472 | item = firstChild(); | ||
473 | if (!item) | ||
474 | item = new ConfigItem(this, 0, true); | ||
475 | last = item; | ||
476 | } | ||
477 | if ((mode == singleMode || (mode == symbolMode && !(rootEntry->flags & MENU_ROOT))) && | ||
478 | rootEntry->sym && rootEntry->prompt) { | ||
479 | item = last ? last->nextSibling() : firstChild(); | ||
480 | if (!item) | ||
481 | item = new ConfigItem(this, last, rootEntry, true); | ||
482 | else | ||
483 | item->testUpdateMenu(true); | ||
484 | |||
485 | updateMenuList(item, rootEntry); | ||
486 | triggerUpdate(); | ||
487 | return; | ||
488 | } | ||
489 | update: | ||
490 | updateMenuList(this, rootEntry); | ||
491 | triggerUpdate(); | ||
492 | } | ||
493 | |||
494 | void ConfigList::setAllOpen(bool open) | ||
495 | { | ||
496 | QListViewItemIterator it(this); | ||
497 | |||
498 | for (; it.current(); it++) | ||
499 | it.current()->setOpen(open); | ||
500 | } | ||
501 | |||
502 | void ConfigList::setValue(ConfigItem* item, tristate val) | ||
503 | { | ||
504 | struct symbol* sym; | ||
505 | int type; | ||
506 | tristate oldval; | ||
507 | |||
508 | sym = item->menu ? item->menu->sym : 0; | ||
509 | if (!sym) | ||
510 | return; | ||
511 | |||
512 | type = sym_get_type(sym); | ||
513 | switch (type) { | ||
514 | case S_BOOLEAN: | ||
515 | case S_TRISTATE: | ||
516 | oldval = sym_get_tristate_value(sym); | ||
517 | |||
518 | if (!sym_set_tristate_value(sym, val)) | ||
519 | return; | ||
520 | if (oldval == no && item->menu->list) | ||
521 | item->setOpen(TRUE); | ||
522 | parent()->updateList(item); | ||
523 | break; | ||
524 | } | ||
525 | } | ||
526 | |||
527 | void ConfigList::changeValue(ConfigItem* item) | ||
528 | { | ||
529 | struct symbol* sym; | ||
530 | struct menu* menu; | ||
531 | int type, oldexpr, newexpr; | ||
532 | |||
533 | menu = item->menu; | ||
534 | if (!menu) | ||
535 | return; | ||
536 | sym = menu->sym; | ||
537 | if (!sym) { | ||
538 | if (item->menu->list) | ||
539 | item->setOpen(!item->isOpen()); | ||
540 | return; | ||
541 | } | ||
542 | |||
543 | type = sym_get_type(sym); | ||
544 | switch (type) { | ||
545 | case S_BOOLEAN: | ||
546 | case S_TRISTATE: | ||
547 | oldexpr = sym_get_tristate_value(sym); | ||
548 | newexpr = sym_toggle_tristate_value(sym); | ||
549 | if (item->menu->list) { | ||
550 | if (oldexpr == newexpr) | ||
551 | item->setOpen(!item->isOpen()); | ||
552 | else if (oldexpr == no) | ||
553 | item->setOpen(TRUE); | ||
554 | } | ||
555 | if (oldexpr != newexpr) | ||
556 | parent()->updateList(item); | ||
557 | break; | ||
558 | case S_INT: | ||
559 | case S_HEX: | ||
560 | case S_STRING: | ||
561 | #if QT_VERSION >= 300 | ||
562 | if (colMap[dataColIdx] >= 0) | ||
563 | item->startRename(colMap[dataColIdx]); | ||
564 | else | ||
565 | #endif | ||
566 | parent()->lineEdit->show(item); | ||
567 | break; | ||
568 | } | ||
569 | } | ||
570 | |||
571 | void ConfigList::setRootMenu(struct menu *menu) | ||
572 | { | ||
573 | enum prop_type type; | ||
574 | |||
575 | if (rootEntry == menu) | ||
576 | return; | ||
577 | type = menu && menu->prompt ? menu->prompt->type : P_UNKNOWN; | ||
578 | if (type != P_MENU) | ||
579 | return; | ||
580 | updateMenuList(this, 0); | ||
581 | rootEntry = menu; | ||
582 | updateListAll(); | ||
583 | setSelected(currentItem(), hasFocus()); | ||
584 | } | ||
585 | |||
586 | void ConfigList::setParentMenu(void) | ||
587 | { | ||
588 | ConfigItem* item; | ||
589 | struct menu *oldroot; | ||
590 | |||
591 | oldroot = rootEntry; | ||
592 | if (rootEntry == &rootmenu) | ||
593 | return; | ||
594 | setRootMenu(menu_get_parent_menu(rootEntry->parent)); | ||
595 | |||
596 | QListViewItemIterator it(this); | ||
597 | for (; (item = (ConfigItem*)it.current()); it++) { | ||
598 | if (item->menu == oldroot) { | ||
599 | setCurrentItem(item); | ||
600 | ensureItemVisible(item); | ||
601 | break; | ||
602 | } | ||
603 | } | ||
604 | } | ||
605 | |||
606 | void ConfigList::keyPressEvent(QKeyEvent* ev) | ||
607 | { | ||
608 | QListViewItem* i = currentItem(); | ||
609 | ConfigItem* item; | ||
610 | struct menu *menu; | ||
611 | enum prop_type type; | ||
612 | |||
613 | if (ev->key() == Key_Escape && mode != fullMode) { | ||
614 | emit parentSelected(); | ||
615 | ev->accept(); | ||
616 | return; | ||
617 | } | ||
618 | |||
619 | if (!i) { | ||
620 | Parent::keyPressEvent(ev); | ||
621 | return; | ||
622 | } | ||
623 | item = (ConfigItem*)i; | ||
624 | |||
625 | switch (ev->key()) { | ||
626 | case Key_Return: | ||
627 | case Key_Enter: | ||
628 | if (item->goParent) { | ||
629 | emit parentSelected(); | ||
630 | break; | ||
631 | } | ||
632 | menu = item->menu; | ||
633 | if (!menu) | ||
634 | break; | ||
635 | type = menu->prompt ? menu->prompt->type : P_UNKNOWN; | ||
636 | if (type == P_MENU && rootEntry != menu && | ||
637 | mode != fullMode && mode != menuMode) { | ||
638 | emit menuSelected(menu); | ||
639 | break; | ||
640 | } | ||
641 | case Key_Space: | ||
642 | changeValue(item); | ||
643 | break; | ||
644 | case Key_N: | ||
645 | setValue(item, no); | ||
646 | break; | ||
647 | case Key_M: | ||
648 | setValue(item, mod); | ||
649 | break; | ||
650 | case Key_Y: | ||
651 | setValue(item, yes); | ||
652 | break; | ||
653 | default: | ||
654 | Parent::keyPressEvent(ev); | ||
655 | return; | ||
656 | } | ||
657 | ev->accept(); | ||
658 | } | ||
659 | |||
660 | void ConfigList::contentsMousePressEvent(QMouseEvent* e) | ||
661 | { | ||
662 | //QPoint p(contentsToViewport(e->pos())); | ||
663 | //printf("contentsMousePressEvent: %d,%d\n", p.x(), p.y()); | ||
664 | Parent::contentsMousePressEvent(e); | ||
665 | } | ||
666 | |||
667 | void ConfigList::contentsMouseReleaseEvent(QMouseEvent* e) | ||
668 | { | ||
669 | QPoint p(contentsToViewport(e->pos())); | ||
670 | ConfigItem* item = (ConfigItem*)itemAt(p); | ||
671 | struct menu *menu; | ||
672 | enum prop_type ptype; | ||
673 | const QPixmap* pm; | ||
674 | int idx, x; | ||
675 | |||
676 | if (!item) | ||
677 | goto skip; | ||
678 | |||
679 | menu = item->menu; | ||
680 | x = header()->offset() + p.x(); | ||
681 | idx = colRevMap[header()->sectionAt(x)]; | ||
682 | switch (idx) { | ||
683 | case promptColIdx: | ||
684 | pm = item->pixmap(promptColIdx); | ||
685 | if (pm) { | ||
686 | int off = header()->sectionPos(0) + itemMargin() + | ||
687 | treeStepSize() * (item->depth() + (rootIsDecorated() ? 1 : 0)); | ||
688 | if (x >= off && x < off + pm->width()) { | ||
689 | if (item->goParent) { | ||
690 | emit parentSelected(); | ||
691 | break; | ||
692 | } else if (!menu) | ||
693 | break; | ||
694 | ptype = menu->prompt ? menu->prompt->type : P_UNKNOWN; | ||
695 | if (ptype == P_MENU && rootEntry != menu && | ||
696 | mode != fullMode && mode != menuMode) | ||
697 | emit menuSelected(menu); | ||
698 | else | ||
699 | changeValue(item); | ||
700 | } | ||
701 | } | ||
702 | break; | ||
703 | case noColIdx: | ||
704 | setValue(item, no); | ||
705 | break; | ||
706 | case modColIdx: | ||
707 | setValue(item, mod); | ||
708 | break; | ||
709 | case yesColIdx: | ||
710 | setValue(item, yes); | ||
711 | break; | ||
712 | case dataColIdx: | ||
713 | changeValue(item); | ||
714 | break; | ||
715 | } | ||
716 | |||
717 | skip: | ||
718 | //printf("contentsMouseReleaseEvent: %d,%d\n", p.x(), p.y()); | ||
719 | Parent::contentsMouseReleaseEvent(e); | ||
720 | } | ||
721 | |||
722 | void ConfigList::contentsMouseMoveEvent(QMouseEvent* e) | ||
723 | { | ||
724 | //QPoint p(contentsToViewport(e->pos())); | ||
725 | //printf("contentsMouseMoveEvent: %d,%d\n", p.x(), p.y()); | ||
726 | Parent::contentsMouseMoveEvent(e); | ||
727 | } | ||
728 | |||
729 | void ConfigList::contentsMouseDoubleClickEvent(QMouseEvent* e) | ||
730 | { | ||
731 | QPoint p(contentsToViewport(e->pos())); | ||
732 | ConfigItem* item = (ConfigItem*)itemAt(p); | ||
733 | struct menu *menu; | ||
734 | enum prop_type ptype; | ||
735 | |||
736 | if (!item) | ||
737 | goto skip; | ||
738 | if (item->goParent) { | ||
739 | emit parentSelected(); | ||
740 | goto skip; | ||
741 | } | ||
742 | menu = item->menu; | ||
743 | if (!menu) | ||
744 | goto skip; | ||
745 | ptype = menu->prompt ? menu->prompt->type : P_UNKNOWN; | ||
746 | if (ptype == P_MENU && (mode == singleMode || mode == symbolMode)) | ||
747 | emit menuSelected(menu); | ||
748 | else if (menu->sym) | ||
749 | changeValue(item); | ||
750 | |||
751 | skip: | ||
752 | //printf("contentsMouseDoubleClickEvent: %d,%d\n", p.x(), p.y()); | ||
753 | Parent::contentsMouseDoubleClickEvent(e); | ||
754 | } | ||
755 | |||
756 | void ConfigList::focusInEvent(QFocusEvent *e) | ||
757 | { | ||
758 | Parent::focusInEvent(e); | ||
759 | |||
760 | QListViewItem* item = currentItem(); | ||
761 | if (!item) | ||
762 | return; | ||
763 | |||
764 | setSelected(item, TRUE); | ||
765 | emit gotFocus(); | ||
766 | } | ||
767 | |||
768 | ConfigView* ConfigView::viewList; | ||
769 | |||
770 | ConfigView::ConfigView(QWidget* parent, ConfigMainWindow* cview, | ||
771 | ConfigSettings *configSettings) | ||
772 | : Parent(parent) | ||
773 | { | ||
774 | list = new ConfigList(this, cview, configSettings); | ||
775 | lineEdit = new ConfigLineEdit(this); | ||
776 | lineEdit->hide(); | ||
777 | |||
778 | this->nextView = viewList; | ||
779 | viewList = this; | ||
780 | } | ||
781 | |||
782 | ConfigView::~ConfigView(void) | ||
783 | { | ||
784 | ConfigView** vp; | ||
785 | |||
786 | for (vp = &viewList; *vp; vp = &(*vp)->nextView) { | ||
787 | if (*vp == this) { | ||
788 | *vp = nextView; | ||
789 | break; | ||
790 | } | ||
791 | } | ||
792 | } | ||
793 | |||
794 | void ConfigView::updateList(ConfigItem* item) | ||
795 | { | ||
796 | ConfigView* v; | ||
797 | |||
798 | for (v = viewList; v; v = v->nextView) | ||
799 | v->list->updateList(item); | ||
800 | } | ||
801 | |||
802 | void ConfigView::updateListAll(void) | ||
803 | { | ||
804 | ConfigView* v; | ||
805 | |||
806 | for (v = viewList; v; v = v->nextView) | ||
807 | v->list->updateListAll(); | ||
808 | } | ||
809 | |||
810 | /* | ||
811 | * Construct the complete config widget | ||
812 | */ | ||
813 | ConfigMainWindow::ConfigMainWindow(void) | ||
814 | { | ||
815 | QMenuBar* menu; | ||
816 | bool ok; | ||
817 | int x, y, width, height; | ||
818 | |||
819 | QWidget *d = configApp->desktop(); | ||
820 | |||
821 | ConfigSettings* configSettings = new ConfigSettings(); | ||
822 | #if QT_VERSION >= 300 | ||
823 | width = configSettings->readNumEntry("/kconfig/qconf/window width", d->width() - 64); | ||
824 | height = configSettings->readNumEntry("/kconfig/qconf/window height", d->height() - 64); | ||
825 | resize(width, height); | ||
826 | x = configSettings->readNumEntry("/kconfig/qconf/window x", 0, &ok); | ||
827 | if (ok) | ||
828 | y = configSettings->readNumEntry("/kconfig/qconf/window y", 0, &ok); | ||
829 | if (ok) | ||
830 | move(x, y); | ||
831 | showDebug = configSettings->readBoolEntry("/kconfig/qconf/showDebug", false); | ||
832 | |||
833 | // read list settings into configSettings, will be used later for ConfigList setup | ||
834 | configSettings->readListSettings(); | ||
835 | #else | ||
836 | width = d->width() - 64; | ||
837 | height = d->height() - 64; | ||
838 | resize(width, height); | ||
839 | showDebug = false; | ||
840 | #endif | ||
841 | |||
842 | split1 = new QSplitter(this); | ||
843 | split1->setOrientation(QSplitter::Horizontal); | ||
844 | setCentralWidget(split1); | ||
845 | |||
846 | menuView = new ConfigView(split1, this, configSettings); | ||
847 | menuList = menuView->list; | ||
848 | |||
849 | split2 = new QSplitter(split1); | ||
850 | split2->setOrientation(QSplitter::Vertical); | ||
851 | |||
852 | // create config tree | ||
853 | configView = new ConfigView(split2, this, configSettings); | ||
854 | configList = configView->list; | ||
855 | |||
856 | helpText = new QTextView(split2); | ||
857 | helpText->setTextFormat(Qt::RichText); | ||
858 | |||
859 | setTabOrder(configList, helpText); | ||
860 | configList->setFocus(); | ||
861 | |||
862 | menu = menuBar(); | ||
863 | toolBar = new QToolBar("Tools", this); | ||
864 | |||
865 | backAction = new QAction("Back", QPixmap(xpm_back), "Back", 0, this); | ||
866 | connect(backAction, SIGNAL(activated()), SLOT(goBack())); | ||
867 | backAction->setEnabled(FALSE); | ||
868 | QAction *quitAction = new QAction("Quit", "&Quit", CTRL+Key_Q, this); | ||
869 | connect(quitAction, SIGNAL(activated()), SLOT(close())); | ||
870 | QAction *loadAction = new QAction("Load", QPixmap(xpm_load), "&Load", CTRL+Key_L, this); | ||
871 | connect(loadAction, SIGNAL(activated()), SLOT(loadConfig())); | ||
872 | QAction *saveAction = new QAction("Save", QPixmap(xpm_save), "&Save", CTRL+Key_S, this); | ||
873 | connect(saveAction, SIGNAL(activated()), SLOT(saveConfig())); | ||
874 | QAction *saveAsAction = new QAction("Save As...", "Save &As...", 0, this); | ||
875 | connect(saveAsAction, SIGNAL(activated()), SLOT(saveConfigAs())); | ||
876 | QAction *singleViewAction = new QAction("Single View", QPixmap(xpm_single_view), "Split View", 0, this); | ||
877 | connect(singleViewAction, SIGNAL(activated()), SLOT(showSingleView())); | ||
878 | QAction *splitViewAction = new QAction("Split View", QPixmap(xpm_split_view), "Split View", 0, this); | ||
879 | connect(splitViewAction, SIGNAL(activated()), SLOT(showSplitView())); | ||
880 | QAction *fullViewAction = new QAction("Full View", QPixmap(xpm_tree_view), "Full View", 0, this); | ||
881 | connect(fullViewAction, SIGNAL(activated()), SLOT(showFullView())); | ||
882 | |||
883 | QAction *showNameAction = new QAction(NULL, "Show Name", 0, this); | ||
884 | showNameAction->setToggleAction(TRUE); | ||
885 | showNameAction->setOn(configList->showName); | ||
886 | connect(showNameAction, SIGNAL(toggled(bool)), SLOT(setShowName(bool))); | ||
887 | QAction *showRangeAction = new QAction(NULL, "Show Range", 0, this); | ||
888 | showRangeAction->setToggleAction(TRUE); | ||
889 | showRangeAction->setOn(configList->showRange); | ||
890 | connect(showRangeAction, SIGNAL(toggled(bool)), SLOT(setShowRange(bool))); | ||
891 | QAction *showDataAction = new QAction(NULL, "Show Data", 0, this); | ||
892 | showDataAction->setToggleAction(TRUE); | ||
893 | showDataAction->setOn(configList->showData); | ||
894 | connect(showDataAction, SIGNAL(toggled(bool)), SLOT(setShowData(bool))); | ||
895 | QAction *showAllAction = new QAction(NULL, "Show All Options", 0, this); | ||
896 | showAllAction->setToggleAction(TRUE); | ||
897 | showAllAction->setOn(configList->showAll); | ||
898 | connect(showAllAction, SIGNAL(toggled(bool)), SLOT(setShowAll(bool))); | ||
899 | QAction *showDebugAction = new QAction(NULL, "Show Debug Info", 0, this); | ||
900 | showDebugAction->setToggleAction(TRUE); | ||
901 | showDebugAction->setOn(showDebug); | ||
902 | connect(showDebugAction, SIGNAL(toggled(bool)), SLOT(setShowDebug(bool))); | ||
903 | |||
904 | QAction *showIntroAction = new QAction(NULL, "Introduction", 0, this); | ||
905 | connect(showIntroAction, SIGNAL(activated()), SLOT(showIntro())); | ||
906 | QAction *showAboutAction = new QAction(NULL, "About", 0, this); | ||
907 | connect(showAboutAction, SIGNAL(activated()), SLOT(showAbout())); | ||
908 | |||
909 | // init tool bar | ||
910 | backAction->addTo(toolBar); | ||
911 | toolBar->addSeparator(); | ||
912 | loadAction->addTo(toolBar); | ||
913 | saveAction->addTo(toolBar); | ||
914 | toolBar->addSeparator(); | ||
915 | singleViewAction->addTo(toolBar); | ||
916 | splitViewAction->addTo(toolBar); | ||
917 | fullViewAction->addTo(toolBar); | ||
918 | |||
919 | // create config menu | ||
920 | QPopupMenu* config = new QPopupMenu(this); | ||
921 | menu->insertItem("&File", config); | ||
922 | loadAction->addTo(config); | ||
923 | saveAction->addTo(config); | ||
924 | saveAsAction->addTo(config); | ||
925 | config->insertSeparator(); | ||
926 | quitAction->addTo(config); | ||
927 | |||
928 | // create options menu | ||
929 | QPopupMenu* optionMenu = new QPopupMenu(this); | ||
930 | menu->insertItem("&Option", optionMenu); | ||
931 | showNameAction->addTo(optionMenu); | ||
932 | showRangeAction->addTo(optionMenu); | ||
933 | showDataAction->addTo(optionMenu); | ||
934 | optionMenu->insertSeparator(); | ||
935 | showAllAction->addTo(optionMenu); | ||
936 | showDebugAction->addTo(optionMenu); | ||
937 | |||
938 | // create help menu | ||
939 | QPopupMenu* helpMenu = new QPopupMenu(this); | ||
940 | menu->insertSeparator(); | ||
941 | menu->insertItem("&Help", helpMenu); | ||
942 | showIntroAction->addTo(helpMenu); | ||
943 | showAboutAction->addTo(helpMenu); | ||
944 | |||
945 | connect(configList, SIGNAL(menuSelected(struct menu *)), | ||
946 | SLOT(changeMenu(struct menu *))); | ||
947 | connect(configList, SIGNAL(parentSelected()), | ||
948 | SLOT(goBack())); | ||
949 | connect(menuList, SIGNAL(menuSelected(struct menu *)), | ||
950 | SLOT(changeMenu(struct menu *))); | ||
951 | |||
952 | connect(configList, SIGNAL(gotFocus(void)), | ||
953 | SLOT(listFocusChanged(void))); | ||
954 | connect(menuList, SIGNAL(gotFocus(void)), | ||
955 | SLOT(listFocusChanged(void))); | ||
956 | |||
957 | #if QT_VERSION >= 300 | ||
958 | QString listMode = configSettings->readEntry("/kconfig/qconf/listMode", "symbol"); | ||
959 | if (listMode == "single") | ||
960 | showSingleView(); | ||
961 | else if (listMode == "full") | ||
962 | showFullView(); | ||
963 | else /*if (listMode == "split")*/ | ||
964 | showSplitView(); | ||
965 | |||
966 | // UI setup done, restore splitter positions | ||
967 | QValueList<int> sizes = configSettings->readSizes("/kconfig/qconf/split1", &ok); | ||
968 | if (ok) | ||
969 | split1->setSizes(sizes); | ||
970 | |||
971 | sizes = configSettings->readSizes("/kconfig/qconf/split2", &ok); | ||
972 | if (ok) | ||
973 | split2->setSizes(sizes); | ||
974 | #else | ||
975 | showSplitView(); | ||
976 | #endif | ||
977 | delete configSettings; | ||
978 | } | ||
979 | |||
980 | static QString print_filter(const QString &str) | ||
981 | { | ||
982 | QRegExp re("[<>&\"\\n]"); | ||
983 | QString res = str; | ||
984 | for (int i = 0; (i = res.find(re, i)) >= 0;) { | ||
985 | switch (res[i].latin1()) { | ||
986 | case '<': | ||
987 | res.replace(i, 1, "<"); | ||
988 | i += 4; | ||
989 | break; | ||
990 | case '>': | ||
991 | res.replace(i, 1, ">"); | ||
992 | i += 4; | ||
993 | break; | ||
994 | case '&': | ||
995 | res.replace(i, 1, "&"); | ||
996 | i += 5; | ||
997 | break; | ||
998 | case '"': | ||
999 | res.replace(i, 1, """); | ||
1000 | i += 6; | ||
1001 | break; | ||
1002 | case '\n': | ||
1003 | res.replace(i, 1, "<br>"); | ||
1004 | i += 4; | ||
1005 | break; | ||
1006 | } | ||
1007 | } | ||
1008 | return res; | ||
1009 | } | ||
1010 | |||
1011 | static void expr_print_help(void *data, const char *str) | ||
1012 | { | ||
1013 | reinterpret_cast<QString*>(data)->append(print_filter(str)); | ||
1014 | } | ||
1015 | |||
1016 | /* | ||
1017 | * display a new help entry as soon as a new menu entry is selected | ||
1018 | */ | ||
1019 | void ConfigMainWindow::setHelp(QListViewItem* item) | ||
1020 | { | ||
1021 | struct symbol* sym; | ||
1022 | struct menu* menu = 0; | ||
1023 | |||
1024 | configList->parent()->lineEdit->hide(); | ||
1025 | if (item) | ||
1026 | menu = ((ConfigItem*)item)->menu; | ||
1027 | if (!menu) { | ||
1028 | helpText->setText(QString::null); | ||
1029 | return; | ||
1030 | } | ||
1031 | |||
1032 | QString head, debug, help; | ||
1033 | menu = ((ConfigItem*)item)->menu; | ||
1034 | sym = menu->sym; | ||
1035 | if (sym) { | ||
1036 | if (menu->prompt) { | ||
1037 | head += "<big><b>"; | ||
1038 | head += print_filter(_(menu->prompt->text)); | ||
1039 | head += "</b></big>"; | ||
1040 | if (sym->name) { | ||
1041 | head += " ("; | ||
1042 | head += print_filter(_(sym->name)); | ||
1043 | head += ")"; | ||
1044 | } | ||
1045 | } else if (sym->name) { | ||
1046 | head += "<big><b>"; | ||
1047 | head += print_filter(_(sym->name)); | ||
1048 | head += "</b></big>"; | ||
1049 | } | ||
1050 | head += "<br><br>"; | ||
1051 | |||
1052 | if (showDebug) { | ||
1053 | debug += "type: "; | ||
1054 | debug += print_filter(sym_type_name(sym->type)); | ||
1055 | if (sym_is_choice(sym)) | ||
1056 | debug += " (choice)"; | ||
1057 | debug += "<br>"; | ||
1058 | if (sym->rev_dep.expr) { | ||
1059 | debug += "reverse dep: "; | ||
1060 | expr_print(sym->rev_dep.expr, expr_print_help, &debug, E_NONE); | ||
1061 | debug += "<br>"; | ||
1062 | } | ||
1063 | for (struct property *prop = sym->prop; prop; prop = prop->next) { | ||
1064 | switch (prop->type) { | ||
1065 | case P_PROMPT: | ||
1066 | case P_MENU: | ||
1067 | debug += "prompt: "; | ||
1068 | debug += print_filter(_(prop->text)); | ||
1069 | debug += "<br>"; | ||
1070 | break; | ||
1071 | case P_DEFAULT: | ||
1072 | debug += "default: "; | ||
1073 | expr_print(prop->expr, expr_print_help, &debug, E_NONE); | ||
1074 | debug += "<br>"; | ||
1075 | break; | ||
1076 | case P_CHOICE: | ||
1077 | if (sym_is_choice(sym)) { | ||
1078 | debug += "choice: "; | ||
1079 | expr_print(prop->expr, expr_print_help, &debug, E_NONE); | ||
1080 | debug += "<br>"; | ||
1081 | } | ||
1082 | break; | ||
1083 | case P_SELECT: | ||
1084 | debug += "select: "; | ||
1085 | expr_print(prop->expr, expr_print_help, &debug, E_NONE); | ||
1086 | debug += "<br>"; | ||
1087 | break; | ||
1088 | case P_RANGE: | ||
1089 | debug += "range: "; | ||
1090 | expr_print(prop->expr, expr_print_help, &debug, E_NONE); | ||
1091 | debug += "<br>"; | ||
1092 | break; | ||
1093 | default: | ||
1094 | debug += "unknown property: "; | ||
1095 | debug += prop_get_type_name(prop->type); | ||
1096 | debug += "<br>"; | ||
1097 | } | ||
1098 | if (prop->visible.expr) { | ||
1099 | debug += " dep: "; | ||
1100 | expr_print(prop->visible.expr, expr_print_help, &debug, E_NONE); | ||
1101 | debug += "<br>"; | ||
1102 | } | ||
1103 | } | ||
1104 | debug += "<br>"; | ||
1105 | } | ||
1106 | |||
1107 | help = print_filter(_(sym->help)); | ||
1108 | } else if (menu->prompt) { | ||
1109 | head += "<big><b>"; | ||
1110 | head += print_filter(_(menu->prompt->text)); | ||
1111 | head += "</b></big><br><br>"; | ||
1112 | if (showDebug) { | ||
1113 | if (menu->prompt->visible.expr) { | ||
1114 | debug += " dep: "; | ||
1115 | expr_print(menu->prompt->visible.expr, expr_print_help, &debug, E_NONE); | ||
1116 | debug += "<br><br>"; | ||
1117 | } | ||
1118 | } | ||
1119 | } | ||
1120 | if (showDebug) | ||
1121 | debug += QString().sprintf("defined at %s:%d<br><br>", menu->file->name, menu->lineno); | ||
1122 | helpText->setText(head + debug + help); | ||
1123 | } | ||
1124 | |||
1125 | void ConfigMainWindow::loadConfig(void) | ||
1126 | { | ||
1127 | QString s = QFileDialog::getOpenFileName(".config", NULL, this); | ||
1128 | if (s.isNull()) | ||
1129 | return; | ||
1130 | if (conf_read(QFile::encodeName(s))) | ||
1131 | QMessageBox::information(this, "qconf", "Unable to load configuration!"); | ||
1132 | ConfigView::updateListAll(); | ||
1133 | } | ||
1134 | |||
1135 | void ConfigMainWindow::saveConfig(void) | ||
1136 | { | ||
1137 | if (conf_write(NULL)) | ||
1138 | QMessageBox::information(this, "qconf", "Unable to save configuration!"); | ||
1139 | } | ||
1140 | |||
1141 | void ConfigMainWindow::saveConfigAs(void) | ||
1142 | { | ||
1143 | QString s = QFileDialog::getSaveFileName(".config", NULL, this); | ||
1144 | if (s.isNull()) | ||
1145 | return; | ||
1146 | if (conf_write(QFile::encodeName(s))) | ||
1147 | QMessageBox::information(this, "qconf", "Unable to save configuration!"); | ||
1148 | } | ||
1149 | |||
1150 | void ConfigMainWindow::changeMenu(struct menu *menu) | ||
1151 | { | ||
1152 | configList->setRootMenu(menu); | ||
1153 | backAction->setEnabled(TRUE); | ||
1154 | } | ||
1155 | |||
1156 | void ConfigMainWindow::listFocusChanged(void) | ||
1157 | { | ||
1158 | if (menuList->hasFocus()) { | ||
1159 | if (menuList->mode == menuMode) | ||
1160 | configList->clearSelection(); | ||
1161 | setHelp(menuList->selectedItem()); | ||
1162 | } else if (configList->hasFocus()) { | ||
1163 | setHelp(configList->selectedItem()); | ||
1164 | } | ||
1165 | } | ||
1166 | |||
1167 | void ConfigMainWindow::goBack(void) | ||
1168 | { | ||
1169 | ConfigItem* item; | ||
1170 | |||
1171 | configList->setParentMenu(); | ||
1172 | if (configList->rootEntry == &rootmenu) | ||
1173 | backAction->setEnabled(FALSE); | ||
1174 | item = (ConfigItem*)menuList->selectedItem(); | ||
1175 | while (item) { | ||
1176 | if (item->menu == configList->rootEntry) { | ||
1177 | menuList->setSelected(item, TRUE); | ||
1178 | break; | ||
1179 | } | ||
1180 | item = (ConfigItem*)item->parent(); | ||
1181 | } | ||
1182 | } | ||
1183 | |||
1184 | void ConfigMainWindow::showSingleView(void) | ||
1185 | { | ||
1186 | menuView->hide(); | ||
1187 | menuList->setRootMenu(0); | ||
1188 | configList->mode = singleMode; | ||
1189 | if (configList->rootEntry == &rootmenu) | ||
1190 | configList->updateListAll(); | ||
1191 | else | ||
1192 | configList->setRootMenu(&rootmenu); | ||
1193 | configList->setAllOpen(TRUE); | ||
1194 | configList->setFocus(); | ||
1195 | } | ||
1196 | |||
1197 | void ConfigMainWindow::showSplitView(void) | ||
1198 | { | ||
1199 | configList->mode = symbolMode; | ||
1200 | if (configList->rootEntry == &rootmenu) | ||
1201 | configList->updateListAll(); | ||
1202 | else | ||
1203 | configList->setRootMenu(&rootmenu); | ||
1204 | configList->setAllOpen(TRUE); | ||
1205 | configApp->processEvents(); | ||
1206 | menuList->mode = menuMode; | ||
1207 | menuList->setRootMenu(&rootmenu); | ||
1208 | menuList->setAllOpen(TRUE); | ||
1209 | menuView->show(); | ||
1210 | menuList->setFocus(); | ||
1211 | } | ||
1212 | |||
1213 | void ConfigMainWindow::showFullView(void) | ||
1214 | { | ||
1215 | menuView->hide(); | ||
1216 | menuList->setRootMenu(0); | ||
1217 | configList->mode = fullMode; | ||
1218 | if (configList->rootEntry == &rootmenu) | ||
1219 | configList->updateListAll(); | ||
1220 | else | ||
1221 | configList->setRootMenu(&rootmenu); | ||
1222 | configList->setAllOpen(FALSE); | ||
1223 | configList->setFocus(); | ||
1224 | } | ||
1225 | |||
1226 | void ConfigMainWindow::setShowAll(bool b) | ||
1227 | { | ||
1228 | if (configList->showAll == b) | ||
1229 | return; | ||
1230 | configList->showAll = b; | ||
1231 | configList->updateListAll(); | ||
1232 | menuList->showAll = b; | ||
1233 | menuList->updateListAll(); | ||
1234 | } | ||
1235 | |||
1236 | void ConfigMainWindow::setShowDebug(bool b) | ||
1237 | { | ||
1238 | if (showDebug == b) | ||
1239 | return; | ||
1240 | showDebug = b; | ||
1241 | } | ||
1242 | |||
1243 | void ConfigMainWindow::setShowName(bool b) | ||
1244 | { | ||
1245 | if (configList->showName == b) | ||
1246 | return; | ||
1247 | configList->showName = b; | ||
1248 | configList->reinit(); | ||
1249 | menuList->showName = b; | ||
1250 | menuList->reinit(); | ||
1251 | } | ||
1252 | |||
1253 | void ConfigMainWindow::setShowRange(bool b) | ||
1254 | { | ||
1255 | if (configList->showRange == b) | ||
1256 | return; | ||
1257 | configList->showRange = b; | ||
1258 | configList->reinit(); | ||
1259 | menuList->showRange = b; | ||
1260 | menuList->reinit(); | ||
1261 | } | ||
1262 | |||
1263 | void ConfigMainWindow::setShowData(bool b) | ||
1264 | { | ||
1265 | if (configList->showData == b) | ||
1266 | return; | ||
1267 | configList->showData = b; | ||
1268 | configList->reinit(); | ||
1269 | menuList->showData = b; | ||
1270 | menuList->reinit(); | ||
1271 | } | ||
1272 | |||
1273 | /* | ||
1274 | * ask for saving configuration before quitting | ||
1275 | * TODO ask only when something changed | ||
1276 | */ | ||
1277 | void ConfigMainWindow::closeEvent(QCloseEvent* e) | ||
1278 | { | ||
1279 | if (!sym_change_count) { | ||
1280 | e->accept(); | ||
1281 | return; | ||
1282 | } | ||
1283 | QMessageBox mb("qconf", "Save configuration?", QMessageBox::Warning, | ||
1284 | QMessageBox::Yes | QMessageBox::Default, QMessageBox::No, QMessageBox::Cancel | QMessageBox::Escape); | ||
1285 | mb.setButtonText(QMessageBox::Yes, "&Save Changes"); | ||
1286 | mb.setButtonText(QMessageBox::No, "&Discard Changes"); | ||
1287 | mb.setButtonText(QMessageBox::Cancel, "Cancel Exit"); | ||
1288 | switch (mb.exec()) { | ||
1289 | case QMessageBox::Yes: | ||
1290 | conf_write(NULL); | ||
1291 | case QMessageBox::No: | ||
1292 | e->accept(); | ||
1293 | break; | ||
1294 | case QMessageBox::Cancel: | ||
1295 | e->ignore(); | ||
1296 | break; | ||
1297 | } | ||
1298 | } | ||
1299 | |||
1300 | void ConfigMainWindow::showIntro(void) | ||
1301 | { | ||
1302 | static char str[] = "Welcome to the qconf graphical kernel configuration tool for Linux.\n\n" | ||
1303 | "For each option, a blank box indicates the feature is disabled, a check\n" | ||
1304 | "indicates it is enabled, and a dot indicates that it is to be compiled\n" | ||
1305 | "as a module. Clicking on the box will cycle through the three states.\n\n" | ||
1306 | "If you do not see an option (e.g., a device driver) that you believe\n" | ||
1307 | "should be present, try turning on Show All Options under the Options menu.\n" | ||
1308 | "Although there is no cross reference yet to help you figure out what other\n" | ||
1309 | "options must be enabled to support the option you are interested in, you can\n" | ||
1310 | "still view the help of a grayed-out option.\n\n" | ||
1311 | "Toggling Show Debug Info under the Options menu will show the dependencies,\n" | ||
1312 | "which you can then match by examining other options.\n\n"; | ||
1313 | |||
1314 | QMessageBox::information(this, "qconf", str); | ||
1315 | } | ||
1316 | |||
1317 | void ConfigMainWindow::showAbout(void) | ||
1318 | { | ||
1319 | static char str[] = "qconf is Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org>.\n\n" | ||
1320 | "Bug reports and feature request can also be entered at http://bugzilla.kernel.org/\n"; | ||
1321 | |||
1322 | QMessageBox::information(this, "qconf", str); | ||
1323 | } | ||
1324 | |||
1325 | void ConfigMainWindow::saveSettings(void) | ||
1326 | { | ||
1327 | #if QT_VERSION >= 300 | ||
1328 | ConfigSettings *configSettings = new ConfigSettings; | ||
1329 | configSettings->writeEntry("/kconfig/qconf/window x", pos().x()); | ||
1330 | configSettings->writeEntry("/kconfig/qconf/window y", pos().y()); | ||
1331 | configSettings->writeEntry("/kconfig/qconf/window width", size().width()); | ||
1332 | configSettings->writeEntry("/kconfig/qconf/window height", size().height()); | ||
1333 | configSettings->writeEntry("/kconfig/qconf/showName", configList->showName); | ||
1334 | configSettings->writeEntry("/kconfig/qconf/showRange", configList->showRange); | ||
1335 | configSettings->writeEntry("/kconfig/qconf/showData", configList->showData); | ||
1336 | configSettings->writeEntry("/kconfig/qconf/showAll", configList->showAll); | ||
1337 | configSettings->writeEntry("/kconfig/qconf/showDebug", showDebug); | ||
1338 | |||
1339 | QString entry; | ||
1340 | switch(configList->mode) { | ||
1341 | case singleMode : | ||
1342 | entry = "single"; | ||
1343 | break; | ||
1344 | |||
1345 | case symbolMode : | ||
1346 | entry = "split"; | ||
1347 | break; | ||
1348 | |||
1349 | case fullMode : | ||
1350 | entry = "full"; | ||
1351 | break; | ||
1352 | } | ||
1353 | configSettings->writeEntry("/kconfig/qconf/listMode", entry); | ||
1354 | |||
1355 | configSettings->writeSizes("/kconfig/qconf/split1", split1->sizes()); | ||
1356 | configSettings->writeSizes("/kconfig/qconf/split2", split2->sizes()); | ||
1357 | |||
1358 | delete configSettings; | ||
1359 | #endif | ||
1360 | } | ||
1361 | |||
1362 | void fixup_rootmenu(struct menu *menu) | ||
1363 | { | ||
1364 | struct menu *child; | ||
1365 | static int menu_cnt = 0; | ||
1366 | |||
1367 | menu->flags |= MENU_ROOT; | ||
1368 | for (child = menu->list; child; child = child->next) { | ||
1369 | if (child->prompt && child->prompt->type == P_MENU) { | ||
1370 | menu_cnt++; | ||
1371 | fixup_rootmenu(child); | ||
1372 | menu_cnt--; | ||
1373 | } else if (!menu_cnt) | ||
1374 | fixup_rootmenu(child); | ||
1375 | } | ||
1376 | } | ||
1377 | |||
1378 | static const char *progname; | ||
1379 | |||
1380 | static void usage(void) | ||
1381 | { | ||
1382 | printf("%s <config>\n", progname); | ||
1383 | exit(0); | ||
1384 | } | ||
1385 | |||
1386 | int main(int ac, char** av) | ||
1387 | { | ||
1388 | ConfigMainWindow* v; | ||
1389 | const char *name; | ||
1390 | |||
1391 | bindtextdomain(PACKAGE, LOCALEDIR); | ||
1392 | textdomain(PACKAGE); | ||
1393 | |||
1394 | #ifndef LKC_DIRECT_LINK | ||
1395 | kconfig_load(); | ||
1396 | #endif | ||
1397 | |||
1398 | progname = av[0]; | ||
1399 | configApp = new QApplication(ac, av); | ||
1400 | if (ac > 1 && av[1][0] == '-') { | ||
1401 | switch (av[1][1]) { | ||
1402 | case 'h': | ||
1403 | case '?': | ||
1404 | usage(); | ||
1405 | } | ||
1406 | name = av[2]; | ||
1407 | } else | ||
1408 | name = av[1]; | ||
1409 | if (!name) | ||
1410 | usage(); | ||
1411 | |||
1412 | conf_parse(name); | ||
1413 | fixup_rootmenu(&rootmenu); | ||
1414 | conf_read(NULL); | ||
1415 | //zconfdump(stdout); | ||
1416 | |||
1417 | v = new ConfigMainWindow(); | ||
1418 | |||
1419 | //zconfdump(stdout); | ||
1420 | v->show(); | ||
1421 | configApp->connect(configApp, SIGNAL(lastWindowClosed()), SLOT(quit())); | ||
1422 | configApp->connect(configApp, SIGNAL(aboutToQuit()), v, SLOT(saveSettings())); | ||
1423 | configApp->exec(); | ||
1424 | |||
1425 | return 0; | ||
1426 | } | ||
diff --git a/scripts/kconfig/qconf.h b/scripts/kconfig/qconf.h new file mode 100644 index 000000000..e52f3e90b --- /dev/null +++ b/scripts/kconfig/qconf.h | |||
@@ -0,0 +1,263 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org> | ||
3 | * Released under the terms of the GNU GPL v2.0. | ||
4 | */ | ||
5 | |||
6 | #include <qlistview.h> | ||
7 | #if QT_VERSION >= 300 | ||
8 | #include <qsettings.h> | ||
9 | #else | ||
10 | class QSettings { }; | ||
11 | #endif | ||
12 | |||
13 | class ConfigList; | ||
14 | class ConfigItem; | ||
15 | class ConfigLineEdit; | ||
16 | class ConfigMainWindow; | ||
17 | |||
18 | |||
19 | class ConfigSettings : public QSettings { | ||
20 | public: | ||
21 | ConfigSettings(); | ||
22 | |||
23 | #if QT_VERSION >= 300 | ||
24 | void readListSettings(); | ||
25 | QValueList<int> readSizes(const QString& key, bool *ok); | ||
26 | bool writeSizes(const QString& key, const QValueList<int>& value); | ||
27 | #endif | ||
28 | |||
29 | bool showAll; | ||
30 | bool showName; | ||
31 | bool showRange; | ||
32 | bool showData; | ||
33 | }; | ||
34 | |||
35 | class ConfigView : public QVBox { | ||
36 | Q_OBJECT | ||
37 | typedef class QVBox Parent; | ||
38 | public: | ||
39 | ConfigView(QWidget* parent, ConfigMainWindow* cview, ConfigSettings* configSettings); | ||
40 | ~ConfigView(void); | ||
41 | static void updateList(ConfigItem* item); | ||
42 | static void updateListAll(void); | ||
43 | |||
44 | public: | ||
45 | ConfigList* list; | ||
46 | ConfigLineEdit* lineEdit; | ||
47 | |||
48 | static ConfigView* viewList; | ||
49 | ConfigView* nextView; | ||
50 | }; | ||
51 | |||
52 | enum colIdx { | ||
53 | promptColIdx, nameColIdx, noColIdx, modColIdx, yesColIdx, dataColIdx, colNr | ||
54 | }; | ||
55 | enum listMode { | ||
56 | singleMode, menuMode, symbolMode, fullMode | ||
57 | }; | ||
58 | |||
59 | class ConfigList : public QListView { | ||
60 | Q_OBJECT | ||
61 | typedef class QListView Parent; | ||
62 | public: | ||
63 | ConfigList(ConfigView* p, ConfigMainWindow* cview, ConfigSettings *configSettings); | ||
64 | void reinit(void); | ||
65 | ConfigView* parent(void) const | ||
66 | { | ||
67 | return (ConfigView*)Parent::parent(); | ||
68 | } | ||
69 | |||
70 | protected: | ||
71 | ConfigMainWindow* cview; | ||
72 | |||
73 | void keyPressEvent(QKeyEvent *e); | ||
74 | void contentsMousePressEvent(QMouseEvent *e); | ||
75 | void contentsMouseReleaseEvent(QMouseEvent *e); | ||
76 | void contentsMouseMoveEvent(QMouseEvent *e); | ||
77 | void contentsMouseDoubleClickEvent(QMouseEvent *e); | ||
78 | void focusInEvent(QFocusEvent *e); | ||
79 | public slots: | ||
80 | void setRootMenu(struct menu *menu); | ||
81 | |||
82 | void updateList(ConfigItem *item); | ||
83 | void setValue(ConfigItem* item, tristate val); | ||
84 | void changeValue(ConfigItem* item); | ||
85 | void updateSelection(void); | ||
86 | signals: | ||
87 | void menuSelected(struct menu *menu); | ||
88 | void parentSelected(void); | ||
89 | void gotFocus(void); | ||
90 | |||
91 | public: | ||
92 | void updateListAll(void) | ||
93 | { | ||
94 | updateAll = true; | ||
95 | updateList(NULL); | ||
96 | updateAll = false; | ||
97 | } | ||
98 | ConfigList* listView() | ||
99 | { | ||
100 | return this; | ||
101 | } | ||
102 | ConfigItem* firstChild() const | ||
103 | { | ||
104 | return (ConfigItem *)Parent::firstChild(); | ||
105 | } | ||
106 | int mapIdx(colIdx idx) | ||
107 | { | ||
108 | return colMap[idx]; | ||
109 | } | ||
110 | void addColumn(colIdx idx, const QString& label) | ||
111 | { | ||
112 | colMap[idx] = Parent::addColumn(label); | ||
113 | colRevMap[colMap[idx]] = idx; | ||
114 | } | ||
115 | void removeColumn(colIdx idx) | ||
116 | { | ||
117 | int col = colMap[idx]; | ||
118 | if (col >= 0) { | ||
119 | Parent::removeColumn(col); | ||
120 | colRevMap[col] = colMap[idx] = -1; | ||
121 | } | ||
122 | } | ||
123 | void setAllOpen(bool open); | ||
124 | void setParentMenu(void); | ||
125 | |||
126 | template <class P> | ||
127 | void updateMenuList(P*, struct menu*); | ||
128 | |||
129 | bool updateAll; | ||
130 | |||
131 | QPixmap symbolYesPix, symbolModPix, symbolNoPix; | ||
132 | QPixmap choiceYesPix, choiceNoPix; | ||
133 | QPixmap menuPix, menuInvPix, menuBackPix, voidPix; | ||
134 | |||
135 | bool showAll, showName, showRange, showData; | ||
136 | enum listMode mode; | ||
137 | struct menu *rootEntry; | ||
138 | QColorGroup disabledColorGroup; | ||
139 | QColorGroup inactivedColorGroup; | ||
140 | |||
141 | private: | ||
142 | int colMap[colNr]; | ||
143 | int colRevMap[colNr]; | ||
144 | }; | ||
145 | |||
146 | class ConfigItem : public QListViewItem { | ||
147 | typedef class QListViewItem Parent; | ||
148 | public: | ||
149 | ConfigItem(QListView *parent, ConfigItem *after, struct menu *m, bool v) | ||
150 | : Parent(parent, after), menu(m), visible(v), goParent(false) | ||
151 | { | ||
152 | init(); | ||
153 | } | ||
154 | ConfigItem(ConfigItem *parent, ConfigItem *after, struct menu *m, bool v) | ||
155 | : Parent(parent, after), menu(m), visible(v), goParent(false) | ||
156 | { | ||
157 | init(); | ||
158 | } | ||
159 | ConfigItem(QListView *parent, ConfigItem *after, bool v) | ||
160 | : Parent(parent, after), menu(0), visible(v), goParent(true) | ||
161 | { | ||
162 | init(); | ||
163 | } | ||
164 | ~ConfigItem(void); | ||
165 | void init(void); | ||
166 | #if QT_VERSION >= 300 | ||
167 | void okRename(int col); | ||
168 | #endif | ||
169 | void updateMenu(void); | ||
170 | void testUpdateMenu(bool v); | ||
171 | ConfigList* listView() const | ||
172 | { | ||
173 | return (ConfigList*)Parent::listView(); | ||
174 | } | ||
175 | ConfigItem* firstChild() const | ||
176 | { | ||
177 | return (ConfigItem *)Parent::firstChild(); | ||
178 | } | ||
179 | ConfigItem* nextSibling() const | ||
180 | { | ||
181 | return (ConfigItem *)Parent::nextSibling(); | ||
182 | } | ||
183 | void setText(colIdx idx, const QString& text) | ||
184 | { | ||
185 | Parent::setText(listView()->mapIdx(idx), text); | ||
186 | } | ||
187 | QString text(colIdx idx) const | ||
188 | { | ||
189 | return Parent::text(listView()->mapIdx(idx)); | ||
190 | } | ||
191 | void setPixmap(colIdx idx, const QPixmap& pm) | ||
192 | { | ||
193 | Parent::setPixmap(listView()->mapIdx(idx), pm); | ||
194 | } | ||
195 | const QPixmap* pixmap(colIdx idx) const | ||
196 | { | ||
197 | return Parent::pixmap(listView()->mapIdx(idx)); | ||
198 | } | ||
199 | void paintCell(QPainter* p, const QColorGroup& cg, int column, int width, int align); | ||
200 | |||
201 | ConfigItem* nextItem; | ||
202 | struct menu *menu; | ||
203 | bool visible; | ||
204 | bool goParent; | ||
205 | }; | ||
206 | |||
207 | class ConfigLineEdit : public QLineEdit { | ||
208 | Q_OBJECT | ||
209 | typedef class QLineEdit Parent; | ||
210 | public: | ||
211 | ConfigLineEdit(ConfigView* parent) | ||
212 | : Parent(parent) | ||
213 | { } | ||
214 | ConfigView* parent(void) const | ||
215 | { | ||
216 | return (ConfigView*)Parent::parent(); | ||
217 | } | ||
218 | void show(ConfigItem *i); | ||
219 | void keyPressEvent(QKeyEvent *e); | ||
220 | |||
221 | public: | ||
222 | ConfigItem *item; | ||
223 | }; | ||
224 | |||
225 | class ConfigMainWindow : public QMainWindow { | ||
226 | Q_OBJECT | ||
227 | public: | ||
228 | ConfigMainWindow(void); | ||
229 | public slots: | ||
230 | void setHelp(QListViewItem* item); | ||
231 | void changeMenu(struct menu *); | ||
232 | void listFocusChanged(void); | ||
233 | void goBack(void); | ||
234 | void loadConfig(void); | ||
235 | void saveConfig(void); | ||
236 | void saveConfigAs(void); | ||
237 | void showSingleView(void); | ||
238 | void showSplitView(void); | ||
239 | void showFullView(void); | ||
240 | void setShowAll(bool); | ||
241 | void setShowDebug(bool); | ||
242 | void setShowRange(bool); | ||
243 | void setShowName(bool); | ||
244 | void setShowData(bool); | ||
245 | void showIntro(void); | ||
246 | void showAbout(void); | ||
247 | void saveSettings(void); | ||
248 | |||
249 | protected: | ||
250 | void closeEvent(QCloseEvent *e); | ||
251 | |||
252 | ConfigView *menuView; | ||
253 | ConfigList *menuList; | ||
254 | ConfigView *configView; | ||
255 | ConfigList *configList; | ||
256 | QTextView *helpText; | ||
257 | QToolBar *toolBar; | ||
258 | QAction *backAction; | ||
259 | QSplitter* split1; | ||
260 | QSplitter* split2; | ||
261 | |||
262 | bool showDebug; | ||
263 | }; | ||
diff --git a/scripts/kconfig/symbol.c b/scripts/kconfig/symbol.c new file mode 100644 index 000000000..3d7877afc --- /dev/null +++ b/scripts/kconfig/symbol.c | |||
@@ -0,0 +1,882 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org> | ||
3 | * Released under the terms of the GNU GPL v2.0. | ||
4 | */ | ||
5 | |||
6 | #include <ctype.h> | ||
7 | #include <stdlib.h> | ||
8 | #include <string.h> | ||
9 | #include <regex.h> | ||
10 | #include <sys/utsname.h> | ||
11 | |||
12 | #define LKC_DIRECT_LINK | ||
13 | #include "lkc.h" | ||
14 | |||
15 | struct symbol symbol_yes = { | ||
16 | .name = "y", | ||
17 | .curr = { "y", yes }, | ||
18 | .flags = SYMBOL_YES|SYMBOL_VALID, | ||
19 | }, symbol_mod = { | ||
20 | .name = "m", | ||
21 | .curr = { "m", mod }, | ||
22 | .flags = SYMBOL_MOD|SYMBOL_VALID, | ||
23 | }, symbol_no = { | ||
24 | .name = "n", | ||
25 | .curr = { "n", no }, | ||
26 | .flags = SYMBOL_NO|SYMBOL_VALID, | ||
27 | }, symbol_empty = { | ||
28 | .name = "", | ||
29 | .curr = { "", no }, | ||
30 | .flags = SYMBOL_VALID, | ||
31 | }; | ||
32 | |||
33 | int sym_change_count; | ||
34 | struct symbol *modules_sym; | ||
35 | tristate modules_val; | ||
36 | |||
37 | void sym_add_default(struct symbol *sym, const char *def) | ||
38 | { | ||
39 | struct property *prop = prop_alloc(P_DEFAULT, sym); | ||
40 | |||
41 | prop->expr = expr_alloc_symbol(sym_lookup(def, 1)); | ||
42 | } | ||
43 | |||
44 | void sym_init(void) | ||
45 | { | ||
46 | struct symbol *sym; | ||
47 | struct utsname uts; | ||
48 | char *p; | ||
49 | static bool inited = false; | ||
50 | |||
51 | if (inited) | ||
52 | return; | ||
53 | inited = true; | ||
54 | |||
55 | uname(&uts); | ||
56 | |||
57 | sym = sym_lookup("ARCH", 0); | ||
58 | sym->type = S_STRING; | ||
59 | sym->flags |= SYMBOL_AUTO; | ||
60 | p = getenv("ARCH"); | ||
61 | if (p) | ||
62 | sym_add_default(sym, p); | ||
63 | |||
64 | sym = sym_lookup("KERNELVERSION", 0); | ||
65 | sym->type = S_STRING; | ||
66 | sym->flags |= SYMBOL_AUTO; | ||
67 | p = getenv("KERNELVERSION"); | ||
68 | if (p) | ||
69 | sym_add_default(sym, p); | ||
70 | |||
71 | sym = sym_lookup("UNAME_RELEASE", 0); | ||
72 | sym->type = S_STRING; | ||
73 | sym->flags |= SYMBOL_AUTO; | ||
74 | sym_add_default(sym, uts.release); | ||
75 | } | ||
76 | |||
77 | enum symbol_type sym_get_type(struct symbol *sym) | ||
78 | { | ||
79 | enum symbol_type type = sym->type; | ||
80 | |||
81 | if (type == S_TRISTATE) { | ||
82 | if (sym_is_choice_value(sym) && sym->visible == yes) | ||
83 | type = S_BOOLEAN; | ||
84 | else if (modules_val == no) | ||
85 | type = S_BOOLEAN; | ||
86 | } | ||
87 | return type; | ||
88 | } | ||
89 | |||
90 | const char *sym_type_name(enum symbol_type type) | ||
91 | { | ||
92 | switch (type) { | ||
93 | case S_BOOLEAN: | ||
94 | return "boolean"; | ||
95 | case S_TRISTATE: | ||
96 | return "tristate"; | ||
97 | case S_INT: | ||
98 | return "integer"; | ||
99 | case S_HEX: | ||
100 | return "hex"; | ||
101 | case S_STRING: | ||
102 | return "string"; | ||
103 | case S_UNKNOWN: | ||
104 | return "unknown"; | ||
105 | case S_OTHER: | ||
106 | break; | ||
107 | } | ||
108 | return "???"; | ||
109 | } | ||
110 | |||
111 | struct property *sym_get_choice_prop(struct symbol *sym) | ||
112 | { | ||
113 | struct property *prop; | ||
114 | |||
115 | for_all_choices(sym, prop) | ||
116 | return prop; | ||
117 | return NULL; | ||
118 | } | ||
119 | |||
120 | struct property *sym_get_default_prop(struct symbol *sym) | ||
121 | { | ||
122 | struct property *prop; | ||
123 | |||
124 | for_all_defaults(sym, prop) { | ||
125 | prop->visible.tri = expr_calc_value(prop->visible.expr); | ||
126 | if (prop->visible.tri != no) | ||
127 | return prop; | ||
128 | } | ||
129 | return NULL; | ||
130 | } | ||
131 | |||
132 | struct property *sym_get_range_prop(struct symbol *sym) | ||
133 | { | ||
134 | struct property *prop; | ||
135 | |||
136 | for_all_properties(sym, prop, P_RANGE) { | ||
137 | prop->visible.tri = expr_calc_value(prop->visible.expr); | ||
138 | if (prop->visible.tri != no) | ||
139 | return prop; | ||
140 | } | ||
141 | return NULL; | ||
142 | } | ||
143 | |||
144 | static int sym_get_range_val(struct symbol *sym, int base) | ||
145 | { | ||
146 | sym_calc_value(sym); | ||
147 | switch (sym->type) { | ||
148 | case S_INT: | ||
149 | base = 10; | ||
150 | break; | ||
151 | case S_HEX: | ||
152 | base = 16; | ||
153 | break; | ||
154 | default: | ||
155 | break; | ||
156 | } | ||
157 | return strtol(sym->curr.val, NULL, base); | ||
158 | } | ||
159 | |||
160 | static void sym_validate_range(struct symbol *sym) | ||
161 | { | ||
162 | struct property *prop; | ||
163 | int base, val, val2; | ||
164 | char str[64]; | ||
165 | |||
166 | switch (sym->type) { | ||
167 | case S_INT: | ||
168 | base = 10; | ||
169 | break; | ||
170 | case S_HEX: | ||
171 | base = 16; | ||
172 | break; | ||
173 | default: | ||
174 | return; | ||
175 | } | ||
176 | prop = sym_get_range_prop(sym); | ||
177 | if (!prop) | ||
178 | return; | ||
179 | val = strtol(sym->curr.val, NULL, base); | ||
180 | val2 = sym_get_range_val(prop->expr->left.sym, base); | ||
181 | if (val >= val2) { | ||
182 | val2 = sym_get_range_val(prop->expr->right.sym, base); | ||
183 | if (val <= val2) | ||
184 | return; | ||
185 | } | ||
186 | if (sym->type == S_INT) | ||
187 | sprintf(str, "%d", val2); | ||
188 | else | ||
189 | sprintf(str, "0x%x", val2); | ||
190 | sym->curr.val = strdup(str); | ||
191 | } | ||
192 | |||
193 | static void sym_calc_visibility(struct symbol *sym) | ||
194 | { | ||
195 | struct property *prop; | ||
196 | tristate tri; | ||
197 | |||
198 | /* any prompt visible? */ | ||
199 | tri = no; | ||
200 | for_all_prompts(sym, prop) { | ||
201 | prop->visible.tri = expr_calc_value(prop->visible.expr); | ||
202 | tri = E_OR(tri, prop->visible.tri); | ||
203 | } | ||
204 | if (tri == mod && (sym->type != S_TRISTATE || modules_val == no)) | ||
205 | tri = yes; | ||
206 | if (sym->visible != tri) { | ||
207 | sym->visible = tri; | ||
208 | sym_set_changed(sym); | ||
209 | } | ||
210 | if (sym_is_choice_value(sym)) | ||
211 | return; | ||
212 | tri = no; | ||
213 | if (sym->rev_dep.expr) | ||
214 | tri = expr_calc_value(sym->rev_dep.expr); | ||
215 | if (tri == mod && sym_get_type(sym) == S_BOOLEAN) | ||
216 | tri = yes; | ||
217 | if (sym->rev_dep.tri != tri) { | ||
218 | sym->rev_dep.tri = tri; | ||
219 | sym_set_changed(sym); | ||
220 | } | ||
221 | } | ||
222 | |||
223 | static struct symbol *sym_calc_choice(struct symbol *sym) | ||
224 | { | ||
225 | struct symbol *def_sym; | ||
226 | struct property *prop; | ||
227 | struct expr *e; | ||
228 | |||
229 | /* is the user choice visible? */ | ||
230 | def_sym = sym->user.val; | ||
231 | if (def_sym) { | ||
232 | sym_calc_visibility(def_sym); | ||
233 | if (def_sym->visible != no) | ||
234 | return def_sym; | ||
235 | } | ||
236 | |||
237 | /* any of the defaults visible? */ | ||
238 | for_all_defaults(sym, prop) { | ||
239 | prop->visible.tri = expr_calc_value(prop->visible.expr); | ||
240 | if (prop->visible.tri == no) | ||
241 | continue; | ||
242 | def_sym = prop_get_symbol(prop); | ||
243 | sym_calc_visibility(def_sym); | ||
244 | if (def_sym->visible != no) | ||
245 | return def_sym; | ||
246 | } | ||
247 | |||
248 | /* just get the first visible value */ | ||
249 | prop = sym_get_choice_prop(sym); | ||
250 | for (e = prop->expr; e; e = e->left.expr) { | ||
251 | def_sym = e->right.sym; | ||
252 | sym_calc_visibility(def_sym); | ||
253 | if (def_sym->visible != no) | ||
254 | return def_sym; | ||
255 | } | ||
256 | |||
257 | /* no choice? reset tristate value */ | ||
258 | sym->curr.tri = no; | ||
259 | return NULL; | ||
260 | } | ||
261 | |||
262 | void sym_calc_value(struct symbol *sym) | ||
263 | { | ||
264 | struct symbol_value newval, oldval; | ||
265 | struct property *prop; | ||
266 | struct expr *e; | ||
267 | |||
268 | if (!sym) | ||
269 | return; | ||
270 | |||
271 | if (sym->flags & SYMBOL_VALID) | ||
272 | return; | ||
273 | sym->flags |= SYMBOL_VALID; | ||
274 | |||
275 | oldval = sym->curr; | ||
276 | |||
277 | switch (sym->type) { | ||
278 | case S_INT: | ||
279 | case S_HEX: | ||
280 | case S_STRING: | ||
281 | newval = symbol_empty.curr; | ||
282 | break; | ||
283 | case S_BOOLEAN: | ||
284 | case S_TRISTATE: | ||
285 | newval = symbol_no.curr; | ||
286 | break; | ||
287 | default: | ||
288 | sym->curr.val = sym->name; | ||
289 | sym->curr.tri = no; | ||
290 | return; | ||
291 | } | ||
292 | if (!sym_is_choice_value(sym)) | ||
293 | sym->flags &= ~SYMBOL_WRITE; | ||
294 | |||
295 | sym_calc_visibility(sym); | ||
296 | |||
297 | /* set default if recursively called */ | ||
298 | sym->curr = newval; | ||
299 | |||
300 | switch (sym_get_type(sym)) { | ||
301 | case S_BOOLEAN: | ||
302 | case S_TRISTATE: | ||
303 | if (sym_is_choice_value(sym) && sym->visible == yes) { | ||
304 | prop = sym_get_choice_prop(sym); | ||
305 | newval.tri = (prop_get_symbol(prop)->curr.val == sym) ? yes : no; | ||
306 | } else if (E_OR(sym->visible, sym->rev_dep.tri) != no) { | ||
307 | sym->flags |= SYMBOL_WRITE; | ||
308 | if (sym_has_value(sym)) | ||
309 | newval.tri = sym->user.tri; | ||
310 | else if (!sym_is_choice(sym)) { | ||
311 | prop = sym_get_default_prop(sym); | ||
312 | if (prop) | ||
313 | newval.tri = expr_calc_value(prop->expr); | ||
314 | } | ||
315 | newval.tri = E_OR(E_AND(newval.tri, sym->visible), sym->rev_dep.tri); | ||
316 | } else if (!sym_is_choice(sym)) { | ||
317 | prop = sym_get_default_prop(sym); | ||
318 | if (prop) { | ||
319 | sym->flags |= SYMBOL_WRITE; | ||
320 | newval.tri = expr_calc_value(prop->expr); | ||
321 | } | ||
322 | } | ||
323 | if (newval.tri == mod && sym_get_type(sym) == S_BOOLEAN) | ||
324 | newval.tri = yes; | ||
325 | break; | ||
326 | case S_STRING: | ||
327 | case S_HEX: | ||
328 | case S_INT: | ||
329 | if (sym->visible != no) { | ||
330 | sym->flags |= SYMBOL_WRITE; | ||
331 | if (sym_has_value(sym)) { | ||
332 | newval.val = sym->user.val; | ||
333 | break; | ||
334 | } | ||
335 | } | ||
336 | prop = sym_get_default_prop(sym); | ||
337 | if (prop) { | ||
338 | struct symbol *ds = prop_get_symbol(prop); | ||
339 | if (ds) { | ||
340 | sym->flags |= SYMBOL_WRITE; | ||
341 | sym_calc_value(ds); | ||
342 | newval.val = ds->curr.val; | ||
343 | } | ||
344 | } | ||
345 | break; | ||
346 | default: | ||
347 | ; | ||
348 | } | ||
349 | |||
350 | sym->curr = newval; | ||
351 | if (sym_is_choice(sym) && newval.tri == yes) | ||
352 | sym->curr.val = sym_calc_choice(sym); | ||
353 | sym_validate_range(sym); | ||
354 | |||
355 | if (memcmp(&oldval, &sym->curr, sizeof(oldval))) | ||
356 | sym_set_changed(sym); | ||
357 | if (modules_sym == sym) | ||
358 | modules_val = modules_sym->curr.tri; | ||
359 | |||
360 | if (sym_is_choice(sym)) { | ||
361 | int flags = sym->flags & (SYMBOL_CHANGED | SYMBOL_WRITE); | ||
362 | prop = sym_get_choice_prop(sym); | ||
363 | for (e = prop->expr; e; e = e->left.expr) { | ||
364 | e->right.sym->flags |= flags; | ||
365 | if (flags & SYMBOL_CHANGED) | ||
366 | sym_set_changed(e->right.sym); | ||
367 | } | ||
368 | } | ||
369 | } | ||
370 | |||
371 | void sym_clear_all_valid(void) | ||
372 | { | ||
373 | struct symbol *sym; | ||
374 | int i; | ||
375 | |||
376 | for_all_symbols(i, sym) | ||
377 | sym->flags &= ~SYMBOL_VALID; | ||
378 | sym_change_count++; | ||
379 | if (modules_sym) | ||
380 | sym_calc_value(modules_sym); | ||
381 | } | ||
382 | |||
383 | void sym_set_changed(struct symbol *sym) | ||
384 | { | ||
385 | struct property *prop; | ||
386 | |||
387 | sym->flags |= SYMBOL_CHANGED; | ||
388 | for (prop = sym->prop; prop; prop = prop->next) { | ||
389 | if (prop->menu) | ||
390 | prop->menu->flags |= MENU_CHANGED; | ||
391 | } | ||
392 | } | ||
393 | |||
394 | void sym_set_all_changed(void) | ||
395 | { | ||
396 | struct symbol *sym; | ||
397 | int i; | ||
398 | |||
399 | for_all_symbols(i, sym) | ||
400 | sym_set_changed(sym); | ||
401 | } | ||
402 | |||
403 | bool sym_tristate_within_range(struct symbol *sym, tristate val) | ||
404 | { | ||
405 | int type = sym_get_type(sym); | ||
406 | |||
407 | if (sym->visible == no) | ||
408 | return false; | ||
409 | |||
410 | if (type != S_BOOLEAN && type != S_TRISTATE) | ||
411 | return false; | ||
412 | |||
413 | if (type == S_BOOLEAN && val == mod) | ||
414 | return false; | ||
415 | if (sym->visible <= sym->rev_dep.tri) | ||
416 | return false; | ||
417 | if (sym_is_choice_value(sym) && sym->visible == yes) | ||
418 | return val == yes; | ||
419 | return val >= sym->rev_dep.tri && val <= sym->visible; | ||
420 | } | ||
421 | |||
422 | bool sym_set_tristate_value(struct symbol *sym, tristate val) | ||
423 | { | ||
424 | tristate oldval = sym_get_tristate_value(sym); | ||
425 | |||
426 | if (oldval != val && !sym_tristate_within_range(sym, val)) | ||
427 | return false; | ||
428 | |||
429 | if (sym->flags & SYMBOL_NEW) { | ||
430 | sym->flags &= ~SYMBOL_NEW; | ||
431 | sym_set_changed(sym); | ||
432 | } | ||
433 | /* | ||
434 | * setting a choice value also resets the new flag of the choice | ||
435 | * symbol and all other choice values. | ||
436 | */ | ||
437 | if (sym_is_choice_value(sym) && val == yes) { | ||
438 | struct symbol *cs = prop_get_symbol(sym_get_choice_prop(sym)); | ||
439 | struct property *prop; | ||
440 | struct expr *e; | ||
441 | |||
442 | cs->user.val = sym; | ||
443 | cs->flags &= ~SYMBOL_NEW; | ||
444 | prop = sym_get_choice_prop(cs); | ||
445 | for (e = prop->expr; e; e = e->left.expr) { | ||
446 | if (e->right.sym->visible != no) | ||
447 | e->right.sym->flags &= ~SYMBOL_NEW; | ||
448 | } | ||
449 | } | ||
450 | |||
451 | sym->user.tri = val; | ||
452 | if (oldval != val) { | ||
453 | sym_clear_all_valid(); | ||
454 | if (sym == modules_sym) | ||
455 | sym_set_all_changed(); | ||
456 | } | ||
457 | |||
458 | return true; | ||
459 | } | ||
460 | |||
461 | tristate sym_toggle_tristate_value(struct symbol *sym) | ||
462 | { | ||
463 | tristate oldval, newval; | ||
464 | |||
465 | oldval = newval = sym_get_tristate_value(sym); | ||
466 | do { | ||
467 | switch (newval) { | ||
468 | case no: | ||
469 | newval = mod; | ||
470 | break; | ||
471 | case mod: | ||
472 | newval = yes; | ||
473 | break; | ||
474 | case yes: | ||
475 | newval = no; | ||
476 | break; | ||
477 | } | ||
478 | if (sym_set_tristate_value(sym, newval)) | ||
479 | break; | ||
480 | } while (oldval != newval); | ||
481 | return newval; | ||
482 | } | ||
483 | |||
484 | bool sym_string_valid(struct symbol *sym, const char *str) | ||
485 | { | ||
486 | signed char ch; | ||
487 | |||
488 | switch (sym->type) { | ||
489 | case S_STRING: | ||
490 | return true; | ||
491 | case S_INT: | ||
492 | ch = *str++; | ||
493 | if (ch == '-') | ||
494 | ch = *str++; | ||
495 | if (!isdigit(ch)) | ||
496 | return false; | ||
497 | if (ch == '0' && *str != 0) | ||
498 | return false; | ||
499 | while ((ch = *str++)) { | ||
500 | if (!isdigit(ch)) | ||
501 | return false; | ||
502 | } | ||
503 | return true; | ||
504 | case S_HEX: | ||
505 | if (str[0] == '0' && (str[1] == 'x' || str[1] == 'X')) | ||
506 | str += 2; | ||
507 | ch = *str++; | ||
508 | do { | ||
509 | if (!isxdigit(ch)) | ||
510 | return false; | ||
511 | } while ((ch = *str++)); | ||
512 | return true; | ||
513 | case S_BOOLEAN: | ||
514 | case S_TRISTATE: | ||
515 | switch (str[0]) { | ||
516 | case 'y': case 'Y': | ||
517 | case 'm': case 'M': | ||
518 | case 'n': case 'N': | ||
519 | return true; | ||
520 | } | ||
521 | return false; | ||
522 | default: | ||
523 | return false; | ||
524 | } | ||
525 | } | ||
526 | |||
527 | bool sym_string_within_range(struct symbol *sym, const char *str) | ||
528 | { | ||
529 | struct property *prop; | ||
530 | int val; | ||
531 | |||
532 | switch (sym->type) { | ||
533 | case S_STRING: | ||
534 | return sym_string_valid(sym, str); | ||
535 | case S_INT: | ||
536 | if (!sym_string_valid(sym, str)) | ||
537 | return false; | ||
538 | prop = sym_get_range_prop(sym); | ||
539 | if (!prop) | ||
540 | return true; | ||
541 | val = strtol(str, NULL, 10); | ||
542 | return val >= sym_get_range_val(prop->expr->left.sym, 10) && | ||
543 | val <= sym_get_range_val(prop->expr->right.sym, 10); | ||
544 | case S_HEX: | ||
545 | if (!sym_string_valid(sym, str)) | ||
546 | return false; | ||
547 | prop = sym_get_range_prop(sym); | ||
548 | if (!prop) | ||
549 | return true; | ||
550 | val = strtol(str, NULL, 16); | ||
551 | return val >= sym_get_range_val(prop->expr->left.sym, 16) && | ||
552 | val <= sym_get_range_val(prop->expr->right.sym, 16); | ||
553 | case S_BOOLEAN: | ||
554 | case S_TRISTATE: | ||
555 | switch (str[0]) { | ||
556 | case 'y': case 'Y': | ||
557 | return sym_tristate_within_range(sym, yes); | ||
558 | case 'm': case 'M': | ||
559 | return sym_tristate_within_range(sym, mod); | ||
560 | case 'n': case 'N': | ||
561 | return sym_tristate_within_range(sym, no); | ||
562 | } | ||
563 | return false; | ||
564 | default: | ||
565 | return false; | ||
566 | } | ||
567 | } | ||
568 | |||
569 | bool sym_set_string_value(struct symbol *sym, const char *newval) | ||
570 | { | ||
571 | const char *oldval; | ||
572 | char *val; | ||
573 | int size; | ||
574 | |||
575 | switch (sym->type) { | ||
576 | case S_BOOLEAN: | ||
577 | case S_TRISTATE: | ||
578 | switch (newval[0]) { | ||
579 | case 'y': case 'Y': | ||
580 | return sym_set_tristate_value(sym, yes); | ||
581 | case 'm': case 'M': | ||
582 | return sym_set_tristate_value(sym, mod); | ||
583 | case 'n': case 'N': | ||
584 | return sym_set_tristate_value(sym, no); | ||
585 | } | ||
586 | return false; | ||
587 | default: | ||
588 | ; | ||
589 | } | ||
590 | |||
591 | if (!sym_string_within_range(sym, newval)) | ||
592 | return false; | ||
593 | |||
594 | if (sym->flags & SYMBOL_NEW) { | ||
595 | sym->flags &= ~SYMBOL_NEW; | ||
596 | sym_set_changed(sym); | ||
597 | } | ||
598 | |||
599 | oldval = sym->user.val; | ||
600 | size = strlen(newval) + 1; | ||
601 | if (sym->type == S_HEX && (newval[0] != '0' || (newval[1] != 'x' && newval[1] != 'X'))) { | ||
602 | size += 2; | ||
603 | sym->user.val = val = malloc(size); | ||
604 | *val++ = '0'; | ||
605 | *val++ = 'x'; | ||
606 | } else if (!oldval || strcmp(oldval, newval)) | ||
607 | sym->user.val = val = malloc(size); | ||
608 | else | ||
609 | return true; | ||
610 | |||
611 | strcpy(val, newval); | ||
612 | free((void *)oldval); | ||
613 | sym_clear_all_valid(); | ||
614 | |||
615 | return true; | ||
616 | } | ||
617 | |||
618 | const char *sym_get_string_value(struct symbol *sym) | ||
619 | { | ||
620 | tristate val; | ||
621 | |||
622 | switch (sym->type) { | ||
623 | case S_BOOLEAN: | ||
624 | case S_TRISTATE: | ||
625 | val = sym_get_tristate_value(sym); | ||
626 | switch (val) { | ||
627 | case no: | ||
628 | return "n"; | ||
629 | case mod: | ||
630 | return "m"; | ||
631 | case yes: | ||
632 | return "y"; | ||
633 | } | ||
634 | break; | ||
635 | default: | ||
636 | ; | ||
637 | } | ||
638 | return (const char *)sym->curr.val; | ||
639 | } | ||
640 | |||
641 | bool sym_is_changable(struct symbol *sym) | ||
642 | { | ||
643 | return sym->visible > sym->rev_dep.tri; | ||
644 | } | ||
645 | |||
646 | struct symbol *sym_lookup(const char *name, int isconst) | ||
647 | { | ||
648 | struct symbol *symbol; | ||
649 | const char *ptr; | ||
650 | char *new_name; | ||
651 | int hash = 0; | ||
652 | |||
653 | if (name) { | ||
654 | if (name[0] && !name[1]) { | ||
655 | switch (name[0]) { | ||
656 | case 'y': return &symbol_yes; | ||
657 | case 'm': return &symbol_mod; | ||
658 | case 'n': return &symbol_no; | ||
659 | } | ||
660 | } | ||
661 | for (ptr = name; *ptr; ptr++) | ||
662 | hash += *ptr; | ||
663 | hash &= 0xff; | ||
664 | |||
665 | for (symbol = symbol_hash[hash]; symbol; symbol = symbol->next) { | ||
666 | if (!strcmp(symbol->name, name)) { | ||
667 | if ((isconst && symbol->flags & SYMBOL_CONST) || | ||
668 | (!isconst && !(symbol->flags & SYMBOL_CONST))) | ||
669 | return symbol; | ||
670 | } | ||
671 | } | ||
672 | new_name = strdup(name); | ||
673 | } else { | ||
674 | new_name = NULL; | ||
675 | hash = 256; | ||
676 | } | ||
677 | |||
678 | symbol = malloc(sizeof(*symbol)); | ||
679 | memset(symbol, 0, sizeof(*symbol)); | ||
680 | symbol->name = new_name; | ||
681 | symbol->type = S_UNKNOWN; | ||
682 | symbol->flags = SYMBOL_NEW; | ||
683 | if (isconst) | ||
684 | symbol->flags |= SYMBOL_CONST; | ||
685 | |||
686 | symbol->next = symbol_hash[hash]; | ||
687 | symbol_hash[hash] = symbol; | ||
688 | |||
689 | return symbol; | ||
690 | } | ||
691 | |||
692 | struct symbol *sym_find(const char *name) | ||
693 | { | ||
694 | struct symbol *symbol = NULL; | ||
695 | const char *ptr; | ||
696 | int hash = 0; | ||
697 | |||
698 | if (!name) | ||
699 | return NULL; | ||
700 | |||
701 | if (name[0] && !name[1]) { | ||
702 | switch (name[0]) { | ||
703 | case 'y': return &symbol_yes; | ||
704 | case 'm': return &symbol_mod; | ||
705 | case 'n': return &symbol_no; | ||
706 | } | ||
707 | } | ||
708 | for (ptr = name; *ptr; ptr++) | ||
709 | hash += *ptr; | ||
710 | hash &= 0xff; | ||
711 | |||
712 | for (symbol = symbol_hash[hash]; symbol; symbol = symbol->next) { | ||
713 | if (!strcmp(symbol->name, name) && | ||
714 | !(symbol->flags & SYMBOL_CONST)) | ||
715 | break; | ||
716 | } | ||
717 | |||
718 | return symbol; | ||
719 | } | ||
720 | |||
721 | struct symbol **sym_re_search(const char *pattern) | ||
722 | { | ||
723 | struct symbol *sym, **sym_arr = NULL; | ||
724 | int i, cnt, size; | ||
725 | regex_t re; | ||
726 | |||
727 | cnt = size = 0; | ||
728 | /* Skip if empty */ | ||
729 | if (strlen(pattern) == 0) | ||
730 | return NULL; | ||
731 | if (regcomp(&re, pattern, REG_EXTENDED|REG_NOSUB|REG_ICASE)) | ||
732 | return NULL; | ||
733 | |||
734 | for_all_symbols(i, sym) { | ||
735 | if (sym->flags & SYMBOL_CONST || !sym->name) | ||
736 | continue; | ||
737 | if (regexec(&re, sym->name, 0, NULL, 0)) | ||
738 | continue; | ||
739 | if (cnt + 1 >= size) { | ||
740 | void *tmp = sym_arr; | ||
741 | size += 16; | ||
742 | sym_arr = realloc(sym_arr, size * sizeof(struct symbol *)); | ||
743 | if (!sym_arr) { | ||
744 | free(tmp); | ||
745 | return NULL; | ||
746 | } | ||
747 | } | ||
748 | sym_arr[cnt++] = sym; | ||
749 | } | ||
750 | if (sym_arr) | ||
751 | sym_arr[cnt] = NULL; | ||
752 | regfree(&re); | ||
753 | |||
754 | return sym_arr; | ||
755 | } | ||
756 | |||
757 | |||
758 | struct symbol *sym_check_deps(struct symbol *sym); | ||
759 | |||
760 | static struct symbol *sym_check_expr_deps(struct expr *e) | ||
761 | { | ||
762 | struct symbol *sym; | ||
763 | |||
764 | if (!e) | ||
765 | return NULL; | ||
766 | switch (e->type) { | ||
767 | case E_OR: | ||
768 | case E_AND: | ||
769 | sym = sym_check_expr_deps(e->left.expr); | ||
770 | if (sym) | ||
771 | return sym; | ||
772 | return sym_check_expr_deps(e->right.expr); | ||
773 | case E_NOT: | ||
774 | return sym_check_expr_deps(e->left.expr); | ||
775 | case E_EQUAL: | ||
776 | case E_UNEQUAL: | ||
777 | sym = sym_check_deps(e->left.sym); | ||
778 | if (sym) | ||
779 | return sym; | ||
780 | return sym_check_deps(e->right.sym); | ||
781 | case E_SYMBOL: | ||
782 | return sym_check_deps(e->left.sym); | ||
783 | default: | ||
784 | break; | ||
785 | } | ||
786 | printf("Oops! How to check %d?\n", e->type); | ||
787 | return NULL; | ||
788 | } | ||
789 | |||
790 | struct symbol *sym_check_deps(struct symbol *sym) | ||
791 | { | ||
792 | struct symbol *sym2; | ||
793 | struct property *prop; | ||
794 | |||
795 | if (sym->flags & SYMBOL_CHECK) { | ||
796 | printf("Warning! Found recursive dependency: %s", sym->name); | ||
797 | return sym; | ||
798 | } | ||
799 | if (sym->flags & SYMBOL_CHECKED) | ||
800 | return NULL; | ||
801 | |||
802 | sym->flags |= (SYMBOL_CHECK | SYMBOL_CHECKED); | ||
803 | sym2 = sym_check_expr_deps(sym->rev_dep.expr); | ||
804 | if (sym2) | ||
805 | goto out; | ||
806 | |||
807 | for (prop = sym->prop; prop; prop = prop->next) { | ||
808 | if (prop->type == P_CHOICE || prop->type == P_SELECT) | ||
809 | continue; | ||
810 | sym2 = sym_check_expr_deps(prop->visible.expr); | ||
811 | if (sym2) | ||
812 | goto out; | ||
813 | if (prop->type != P_DEFAULT || sym_is_choice(sym)) | ||
814 | continue; | ||
815 | sym2 = sym_check_expr_deps(prop->expr); | ||
816 | if (sym2) | ||
817 | goto out; | ||
818 | } | ||
819 | out: | ||
820 | if (sym2) { | ||
821 | printf(" %s", sym->name); | ||
822 | if (sym2 == sym) { | ||
823 | printf("\n"); | ||
824 | sym2 = NULL; | ||
825 | } | ||
826 | } | ||
827 | sym->flags &= ~SYMBOL_CHECK; | ||
828 | return sym2; | ||
829 | } | ||
830 | |||
831 | struct property *prop_alloc(enum prop_type type, struct symbol *sym) | ||
832 | { | ||
833 | struct property *prop; | ||
834 | struct property **propp; | ||
835 | |||
836 | prop = malloc(sizeof(*prop)); | ||
837 | memset(prop, 0, sizeof(*prop)); | ||
838 | prop->type = type; | ||
839 | prop->sym = sym; | ||
840 | prop->file = current_file; | ||
841 | prop->lineno = zconf_lineno(); | ||
842 | |||
843 | /* append property to the prop list of symbol */ | ||
844 | if (sym) { | ||
845 | for (propp = &sym->prop; *propp; propp = &(*propp)->next) | ||
846 | ; | ||
847 | *propp = prop; | ||
848 | } | ||
849 | |||
850 | return prop; | ||
851 | } | ||
852 | |||
853 | struct symbol *prop_get_symbol(struct property *prop) | ||
854 | { | ||
855 | if (prop->expr && (prop->expr->type == E_SYMBOL || | ||
856 | prop->expr->type == E_CHOICE)) | ||
857 | return prop->expr->left.sym; | ||
858 | return NULL; | ||
859 | } | ||
860 | |||
861 | const char *prop_get_type_name(enum prop_type type) | ||
862 | { | ||
863 | switch (type) { | ||
864 | case P_PROMPT: | ||
865 | return "prompt"; | ||
866 | case P_COMMENT: | ||
867 | return "comment"; | ||
868 | case P_MENU: | ||
869 | return "menu"; | ||
870 | case P_DEFAULT: | ||
871 | return "default"; | ||
872 | case P_CHOICE: | ||
873 | return "choice"; | ||
874 | case P_SELECT: | ||
875 | return "select"; | ||
876 | case P_RANGE: | ||
877 | return "range"; | ||
878 | case P_UNKNOWN: | ||
879 | break; | ||
880 | } | ||
881 | return "unknown"; | ||
882 | } | ||
diff --git a/scripts/kconfig/util.c b/scripts/kconfig/util.c new file mode 100644 index 000000000..aea8d56ce --- /dev/null +++ b/scripts/kconfig/util.c | |||
@@ -0,0 +1,109 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2002-2005 Roman Zippel <zippel@linux-m68k.org> | ||
3 | * Copyright (C) 2002-2005 Sam Ravnborg <sam@ravnborg.org> | ||
4 | * | ||
5 | * Released under the terms of the GNU GPL v2.0. | ||
6 | */ | ||
7 | |||
8 | #include <string.h> | ||
9 | #include "lkc.h" | ||
10 | |||
11 | /* file already present in list? If not add it */ | ||
12 | struct file *file_lookup(const char *name) | ||
13 | { | ||
14 | struct file *file; | ||
15 | |||
16 | for (file = file_list; file; file = file->next) { | ||
17 | if (!strcmp(name, file->name)) | ||
18 | return file; | ||
19 | } | ||
20 | |||
21 | file = malloc(sizeof(*file)); | ||
22 | memset(file, 0, sizeof(*file)); | ||
23 | file->name = strdup(name); | ||
24 | file->next = file_list; | ||
25 | file_list = file; | ||
26 | return file; | ||
27 | } | ||
28 | |||
29 | /* write a dependency file as used by kbuild to track dependencies */ | ||
30 | int file_write_dep(const char *name) | ||
31 | { | ||
32 | struct file *file; | ||
33 | FILE *out; | ||
34 | |||
35 | if (!name) | ||
36 | name = ".kconfig.d"; | ||
37 | out = fopen("..config.tmp", "w"); | ||
38 | if (!out) | ||
39 | return 1; | ||
40 | fprintf(out, "deps_config := \\\n"); | ||
41 | for (file = file_list; file; file = file->next) { | ||
42 | if (file->next) | ||
43 | fprintf(out, "\t%s \\\n", file->name); | ||
44 | else | ||
45 | fprintf(out, "\t%s\n", file->name); | ||
46 | } | ||
47 | fprintf(out, "\n.config include/autoconf.h: $(deps_config)\n\n$(deps_config):\n"); | ||
48 | fclose(out); | ||
49 | rename("..config.tmp", name); | ||
50 | return 0; | ||
51 | } | ||
52 | |||
53 | |||
54 | /* Allocate initial growable sting */ | ||
55 | struct gstr str_new(void) | ||
56 | { | ||
57 | struct gstr gs; | ||
58 | gs.s = malloc(sizeof(char) * 64); | ||
59 | gs.len = 16; | ||
60 | strcpy(gs.s, "\0"); | ||
61 | return gs; | ||
62 | } | ||
63 | |||
64 | /* Allocate and assign growable string */ | ||
65 | struct gstr str_assign(const char *s) | ||
66 | { | ||
67 | struct gstr gs; | ||
68 | gs.s = strdup(s); | ||
69 | gs.len = strlen(s) + 1; | ||
70 | return gs; | ||
71 | } | ||
72 | |||
73 | /* Free storage for growable string */ | ||
74 | void str_free(struct gstr *gs) | ||
75 | { | ||
76 | if (gs->s) | ||
77 | free(gs->s); | ||
78 | gs->s = NULL; | ||
79 | gs->len = 0; | ||
80 | } | ||
81 | |||
82 | /* Append to growable string */ | ||
83 | void str_append(struct gstr *gs, const char *s) | ||
84 | { | ||
85 | size_t l = strlen(gs->s) + strlen(s) + 1; | ||
86 | if (l > gs->len) { | ||
87 | gs->s = realloc(gs->s, l); | ||
88 | gs->len = l; | ||
89 | } | ||
90 | strcat(gs->s, s); | ||
91 | } | ||
92 | |||
93 | /* Append printf formatted string to growable string */ | ||
94 | void str_printf(struct gstr *gs, const char *fmt, ...) | ||
95 | { | ||
96 | va_list ap; | ||
97 | char s[10000]; /* big enough... */ | ||
98 | va_start(ap, fmt); | ||
99 | vsnprintf(s, sizeof(s), fmt, ap); | ||
100 | str_append(gs, s); | ||
101 | va_end(ap); | ||
102 | } | ||
103 | |||
104 | /* Retrieve value of growable string */ | ||
105 | const char *str_get(struct gstr *gs) | ||
106 | { | ||
107 | return gs->s; | ||
108 | } | ||
109 | |||
diff --git a/scripts/kconfig/zconf.gperf b/scripts/kconfig/zconf.gperf new file mode 100644 index 000000000..b03220600 --- /dev/null +++ b/scripts/kconfig/zconf.gperf | |||
@@ -0,0 +1,43 @@ | |||
1 | %language=ANSI-C | ||
2 | %define hash-function-name kconf_id_hash | ||
3 | %define lookup-function-name kconf_id_lookup | ||
4 | %define string-pool-name kconf_id_strings | ||
5 | %compare-strncmp | ||
6 | %enum | ||
7 | %pic | ||
8 | %struct-type | ||
9 | |||
10 | struct kconf_id; | ||
11 | |||
12 | %% | ||
13 | mainmenu, T_MAINMENU, TF_COMMAND | ||
14 | menu, T_MENU, TF_COMMAND | ||
15 | endmenu, T_ENDMENU, TF_COMMAND | ||
16 | source, T_SOURCE, TF_COMMAND | ||
17 | choice, T_CHOICE, TF_COMMAND | ||
18 | endchoice, T_ENDCHOICE, TF_COMMAND | ||
19 | comment, T_COMMENT, TF_COMMAND | ||
20 | config, T_CONFIG, TF_COMMAND | ||
21 | menuconfig, T_MENUCONFIG, TF_COMMAND | ||
22 | help, T_HELP, TF_COMMAND | ||
23 | if, T_IF, TF_COMMAND|TF_PARAM | ||
24 | endif, T_ENDIF, TF_COMMAND | ||
25 | depends, T_DEPENDS, TF_COMMAND | ||
26 | requires, T_REQUIRES, TF_COMMAND | ||
27 | optional, T_OPTIONAL, TF_COMMAND | ||
28 | default, T_DEFAULT, TF_COMMAND, S_UNKNOWN | ||
29 | prompt, T_PROMPT, TF_COMMAND | ||
30 | tristate, T_TYPE, TF_COMMAND, S_TRISTATE | ||
31 | def_tristate, T_DEFAULT, TF_COMMAND, S_TRISTATE | ||
32 | bool, T_TYPE, TF_COMMAND, S_BOOLEAN | ||
33 | boolean, T_TYPE, TF_COMMAND, S_BOOLEAN | ||
34 | def_bool, T_DEFAULT, TF_COMMAND, S_BOOLEAN | ||
35 | def_boolean, T_DEFAULT, TF_COMMAND, S_BOOLEAN | ||
36 | int, T_TYPE, TF_COMMAND, S_INT | ||
37 | hex, T_TYPE, TF_COMMAND, S_HEX | ||
38 | string, T_TYPE, TF_COMMAND, S_STRING | ||
39 | select, T_SELECT, TF_COMMAND | ||
40 | enable, T_SELECT, TF_COMMAND | ||
41 | range, T_RANGE, TF_COMMAND | ||
42 | on, T_ON, TF_PARAM | ||
43 | %% | ||
diff --git a/scripts/kconfig/zconf.hash.c_shipped b/scripts/kconfig/zconf.hash.c_shipped new file mode 100644 index 000000000..345f0fc07 --- /dev/null +++ b/scripts/kconfig/zconf.hash.c_shipped | |||
@@ -0,0 +1,231 @@ | |||
1 | /* ANSI-C code produced by gperf version 3.0.1 */ | ||
2 | /* Command-line: gperf */ | ||
3 | /* Computed positions: -k'1,3' */ | ||
4 | |||
5 | #if !((' ' == 32) && ('!' == 33) && ('"' == 34) && ('#' == 35) \ | ||
6 | && ('%' == 37) && ('&' == 38) && ('\'' == 39) && ('(' == 40) \ | ||
7 | && (')' == 41) && ('*' == 42) && ('+' == 43) && (',' == 44) \ | ||
8 | && ('-' == 45) && ('.' == 46) && ('/' == 47) && ('0' == 48) \ | ||
9 | && ('1' == 49) && ('2' == 50) && ('3' == 51) && ('4' == 52) \ | ||
10 | && ('5' == 53) && ('6' == 54) && ('7' == 55) && ('8' == 56) \ | ||
11 | && ('9' == 57) && (':' == 58) && (';' == 59) && ('<' == 60) \ | ||
12 | && ('=' == 61) && ('>' == 62) && ('?' == 63) && ('A' == 65) \ | ||
13 | && ('B' == 66) && ('C' == 67) && ('D' == 68) && ('E' == 69) \ | ||
14 | && ('F' == 70) && ('G' == 71) && ('H' == 72) && ('I' == 73) \ | ||
15 | && ('J' == 74) && ('K' == 75) && ('L' == 76) && ('M' == 77) \ | ||
16 | && ('N' == 78) && ('O' == 79) && ('P' == 80) && ('Q' == 81) \ | ||
17 | && ('R' == 82) && ('S' == 83) && ('T' == 84) && ('U' == 85) \ | ||
18 | && ('V' == 86) && ('W' == 87) && ('X' == 88) && ('Y' == 89) \ | ||
19 | && ('Z' == 90) && ('[' == 91) && ('\\' == 92) && (']' == 93) \ | ||
20 | && ('^' == 94) && ('_' == 95) && ('a' == 97) && ('b' == 98) \ | ||
21 | && ('c' == 99) && ('d' == 100) && ('e' == 101) && ('f' == 102) \ | ||
22 | && ('g' == 103) && ('h' == 104) && ('i' == 105) && ('j' == 106) \ | ||
23 | && ('k' == 107) && ('l' == 108) && ('m' == 109) && ('n' == 110) \ | ||
24 | && ('o' == 111) && ('p' == 112) && ('q' == 113) && ('r' == 114) \ | ||
25 | && ('s' == 115) && ('t' == 116) && ('u' == 117) && ('v' == 118) \ | ||
26 | && ('w' == 119) && ('x' == 120) && ('y' == 121) && ('z' == 122) \ | ||
27 | && ('{' == 123) && ('|' == 124) && ('}' == 125) && ('~' == 126)) | ||
28 | /* The character set is not based on ISO-646. */ | ||
29 | #error "gperf generated tables don't work with this execution character set. Please report a bug to <bug-gnu-gperf@gnu.org>." | ||
30 | #endif | ||
31 | |||
32 | struct kconf_id; | ||
33 | /* maximum key range = 45, duplicates = 0 */ | ||
34 | |||
35 | #ifdef __GNUC__ | ||
36 | __inline | ||
37 | #else | ||
38 | #ifdef __cplusplus | ||
39 | inline | ||
40 | #endif | ||
41 | #endif | ||
42 | static unsigned int | ||
43 | kconf_id_hash (register const char *str, register unsigned int len) | ||
44 | { | ||
45 | static unsigned char asso_values[] = | ||
46 | { | ||
47 | 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, | ||
48 | 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, | ||
49 | 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, | ||
50 | 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, | ||
51 | 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, | ||
52 | 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, | ||
53 | 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, | ||
54 | 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, | ||
55 | 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, | ||
56 | 47, 47, 47, 47, 47, 47, 47, 25, 10, 15, | ||
57 | 0, 0, 5, 47, 0, 0, 47, 47, 0, 10, | ||
58 | 0, 20, 20, 20, 5, 0, 0, 20, 47, 47, | ||
59 | 20, 47, 47, 47, 47, 47, 47, 47, 47, 47, | ||
60 | 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, | ||
61 | 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, | ||
62 | 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, | ||
63 | 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, | ||
64 | 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, | ||
65 | 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, | ||
66 | 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, | ||
67 | 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, | ||
68 | 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, | ||
69 | 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, | ||
70 | 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, | ||
71 | 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, | ||
72 | 47, 47, 47, 47, 47, 47 | ||
73 | }; | ||
74 | register int hval = len; | ||
75 | |||
76 | switch (hval) | ||
77 | { | ||
78 | default: | ||
79 | hval += asso_values[(unsigned char)str[2]]; | ||
80 | /*FALLTHROUGH*/ | ||
81 | case 2: | ||
82 | case 1: | ||
83 | hval += asso_values[(unsigned char)str[0]]; | ||
84 | break; | ||
85 | } | ||
86 | return hval; | ||
87 | } | ||
88 | |||
89 | struct kconf_id_strings_t | ||
90 | { | ||
91 | char kconf_id_strings_str2[sizeof("if")]; | ||
92 | char kconf_id_strings_str3[sizeof("int")]; | ||
93 | char kconf_id_strings_str4[sizeof("help")]; | ||
94 | char kconf_id_strings_str5[sizeof("endif")]; | ||
95 | char kconf_id_strings_str6[sizeof("select")]; | ||
96 | char kconf_id_strings_str7[sizeof("endmenu")]; | ||
97 | char kconf_id_strings_str8[sizeof("tristate")]; | ||
98 | char kconf_id_strings_str9[sizeof("endchoice")]; | ||
99 | char kconf_id_strings_str10[sizeof("range")]; | ||
100 | char kconf_id_strings_str11[sizeof("string")]; | ||
101 | char kconf_id_strings_str12[sizeof("default")]; | ||
102 | char kconf_id_strings_str13[sizeof("def_bool")]; | ||
103 | char kconf_id_strings_str14[sizeof("menu")]; | ||
104 | char kconf_id_strings_str16[sizeof("def_boolean")]; | ||
105 | char kconf_id_strings_str17[sizeof("def_tristate")]; | ||
106 | char kconf_id_strings_str18[sizeof("mainmenu")]; | ||
107 | char kconf_id_strings_str20[sizeof("menuconfig")]; | ||
108 | char kconf_id_strings_str21[sizeof("config")]; | ||
109 | char kconf_id_strings_str22[sizeof("on")]; | ||
110 | char kconf_id_strings_str23[sizeof("hex")]; | ||
111 | char kconf_id_strings_str26[sizeof("source")]; | ||
112 | char kconf_id_strings_str27[sizeof("depends")]; | ||
113 | char kconf_id_strings_str28[sizeof("optional")]; | ||
114 | char kconf_id_strings_str31[sizeof("enable")]; | ||
115 | char kconf_id_strings_str32[sizeof("comment")]; | ||
116 | char kconf_id_strings_str33[sizeof("requires")]; | ||
117 | char kconf_id_strings_str34[sizeof("bool")]; | ||
118 | char kconf_id_strings_str37[sizeof("boolean")]; | ||
119 | char kconf_id_strings_str41[sizeof("choice")]; | ||
120 | char kconf_id_strings_str46[sizeof("prompt")]; | ||
121 | }; | ||
122 | static struct kconf_id_strings_t kconf_id_strings_contents = | ||
123 | { | ||
124 | "if", | ||
125 | "int", | ||
126 | "help", | ||
127 | "endif", | ||
128 | "select", | ||
129 | "endmenu", | ||
130 | "tristate", | ||
131 | "endchoice", | ||
132 | "range", | ||
133 | "string", | ||
134 | "default", | ||
135 | "def_bool", | ||
136 | "menu", | ||
137 | "def_boolean", | ||
138 | "def_tristate", | ||
139 | "mainmenu", | ||
140 | "menuconfig", | ||
141 | "config", | ||
142 | "on", | ||
143 | "hex", | ||
144 | "source", | ||
145 | "depends", | ||
146 | "optional", | ||
147 | "enable", | ||
148 | "comment", | ||
149 | "requires", | ||
150 | "bool", | ||
151 | "boolean", | ||
152 | "choice", | ||
153 | "prompt" | ||
154 | }; | ||
155 | #define kconf_id_strings ((const char *) &kconf_id_strings_contents) | ||
156 | #ifdef __GNUC__ | ||
157 | __inline | ||
158 | #endif | ||
159 | struct kconf_id * | ||
160 | kconf_id_lookup (register const char *str, register unsigned int len) | ||
161 | { | ||
162 | enum | ||
163 | { | ||
164 | TOTAL_KEYWORDS = 30, | ||
165 | MIN_WORD_LENGTH = 2, | ||
166 | MAX_WORD_LENGTH = 12, | ||
167 | MIN_HASH_VALUE = 2, | ||
168 | MAX_HASH_VALUE = 46 | ||
169 | }; | ||
170 | |||
171 | static struct kconf_id wordlist[] = | ||
172 | { | ||
173 | {-1}, {-1}, | ||
174 | {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str2, T_IF, TF_COMMAND|TF_PARAM}, | ||
175 | {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str3, T_TYPE, TF_COMMAND, S_INT}, | ||
176 | {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str4, T_HELP, TF_COMMAND}, | ||
177 | {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str5, T_ENDIF, TF_COMMAND}, | ||
178 | {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str6, T_SELECT, TF_COMMAND}, | ||
179 | {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str7, T_ENDMENU, TF_COMMAND}, | ||
180 | {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str8, T_TYPE, TF_COMMAND, S_TRISTATE}, | ||
181 | {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str9, T_ENDCHOICE, TF_COMMAND}, | ||
182 | {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str10, T_RANGE, TF_COMMAND}, | ||
183 | {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str11, T_TYPE, TF_COMMAND, S_STRING}, | ||
184 | {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str12, T_DEFAULT, TF_COMMAND, S_UNKNOWN}, | ||
185 | {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str13, T_DEFAULT, TF_COMMAND, S_BOOLEAN}, | ||
186 | {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str14, T_MENU, TF_COMMAND}, | ||
187 | {-1}, | ||
188 | {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str16, T_DEFAULT, TF_COMMAND, S_BOOLEAN}, | ||
189 | {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str17, T_DEFAULT, TF_COMMAND, S_TRISTATE}, | ||
190 | {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str18, T_MAINMENU, TF_COMMAND}, | ||
191 | {-1}, | ||
192 | {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str20, T_MENUCONFIG, TF_COMMAND}, | ||
193 | {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str21, T_CONFIG, TF_COMMAND}, | ||
194 | {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str22, T_ON, TF_PARAM}, | ||
195 | {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str23, T_TYPE, TF_COMMAND, S_HEX}, | ||
196 | {-1}, {-1}, | ||
197 | {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str26, T_SOURCE, TF_COMMAND}, | ||
198 | {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str27, T_DEPENDS, TF_COMMAND}, | ||
199 | {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str28, T_OPTIONAL, TF_COMMAND}, | ||
200 | {-1}, {-1}, | ||
201 | {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str31, T_SELECT, TF_COMMAND}, | ||
202 | {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str32, T_COMMENT, TF_COMMAND}, | ||
203 | {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str33, T_REQUIRES, TF_COMMAND}, | ||
204 | {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str34, T_TYPE, TF_COMMAND, S_BOOLEAN}, | ||
205 | {-1}, {-1}, | ||
206 | {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str37, T_TYPE, TF_COMMAND, S_BOOLEAN}, | ||
207 | {-1}, {-1}, {-1}, | ||
208 | {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str41, T_CHOICE, TF_COMMAND}, | ||
209 | {-1}, {-1}, {-1}, {-1}, | ||
210 | {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str46, T_PROMPT, TF_COMMAND} | ||
211 | }; | ||
212 | |||
213 | if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH) | ||
214 | { | ||
215 | register int key = kconf_id_hash (str, len); | ||
216 | |||
217 | if (key <= MAX_HASH_VALUE && key >= 0) | ||
218 | { | ||
219 | register int o = wordlist[key].name; | ||
220 | if (o >= 0) | ||
221 | { | ||
222 | register const char *s = o + kconf_id_strings; | ||
223 | |||
224 | if (*str == *s && !strncmp (str + 1, s + 1, len - 1) && s[len] == '\0') | ||
225 | return &wordlist[key]; | ||
226 | } | ||
227 | } | ||
228 | } | ||
229 | return 0; | ||
230 | } | ||
231 | |||
diff --git a/scripts/kconfig/zconf.l b/scripts/kconfig/zconf.l new file mode 100644 index 000000000..cfa46077c --- /dev/null +++ b/scripts/kconfig/zconf.l | |||
@@ -0,0 +1,350 @@ | |||
1 | %option backup nostdinit noyywrap never-interactive full ecs | ||
2 | %option 8bit backup nodefault perf-report perf-report | ||
3 | %x COMMAND HELP STRING PARAM | ||
4 | %{ | ||
5 | /* | ||
6 | * Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org> | ||
7 | * Released under the terms of the GNU GPL v2.0. | ||
8 | */ | ||
9 | |||
10 | #include <limits.h> | ||
11 | #include <stdio.h> | ||
12 | #include <stdlib.h> | ||
13 | #include <string.h> | ||
14 | #include <unistd.h> | ||
15 | |||
16 | #define LKC_DIRECT_LINK | ||
17 | #include "lkc.h" | ||
18 | |||
19 | #define START_STRSIZE 16 | ||
20 | |||
21 | static struct { | ||
22 | struct file *file; | ||
23 | int lineno; | ||
24 | } current_pos; | ||
25 | |||
26 | static char *text; | ||
27 | static int text_size, text_asize; | ||
28 | |||
29 | struct buffer { | ||
30 | struct buffer *parent; | ||
31 | YY_BUFFER_STATE state; | ||
32 | }; | ||
33 | |||
34 | struct buffer *current_buf; | ||
35 | |||
36 | static int last_ts, first_ts; | ||
37 | |||
38 | static void zconf_endhelp(void); | ||
39 | static void zconf_endfile(void); | ||
40 | |||
41 | void new_string(void) | ||
42 | { | ||
43 | text = malloc(START_STRSIZE); | ||
44 | text_asize = START_STRSIZE; | ||
45 | text_size = 0; | ||
46 | *text = 0; | ||
47 | } | ||
48 | |||
49 | void append_string(const char *str, int size) | ||
50 | { | ||
51 | int new_size = text_size + size + 1; | ||
52 | if (new_size > text_asize) { | ||
53 | new_size += START_STRSIZE - 1; | ||
54 | new_size &= -START_STRSIZE; | ||
55 | text = realloc(text, new_size); | ||
56 | text_asize = new_size; | ||
57 | } | ||
58 | memcpy(text + text_size, str, size); | ||
59 | text_size += size; | ||
60 | text[text_size] = 0; | ||
61 | } | ||
62 | |||
63 | void alloc_string(const char *str, int size) | ||
64 | { | ||
65 | text = malloc(size + 1); | ||
66 | memcpy(text, str, size); | ||
67 | text[size] = 0; | ||
68 | } | ||
69 | %} | ||
70 | |||
71 | ws [ \n\t] | ||
72 | n [A-Za-z0-9_] | ||
73 | |||
74 | %% | ||
75 | int str = 0; | ||
76 | int ts, i; | ||
77 | |||
78 | [ \t]*#.*\n | | ||
79 | [ \t]*\n { | ||
80 | current_file->lineno++; | ||
81 | return T_EOL; | ||
82 | } | ||
83 | [ \t]*#.* | ||
84 | |||
85 | |||
86 | [ \t]+ { | ||
87 | BEGIN(COMMAND); | ||
88 | } | ||
89 | |||
90 | . { | ||
91 | unput(yytext[0]); | ||
92 | BEGIN(COMMAND); | ||
93 | } | ||
94 | |||
95 | |||
96 | <COMMAND>{ | ||
97 | {n}+ { | ||
98 | struct kconf_id *id = kconf_id_lookup(yytext, yyleng); | ||
99 | BEGIN(PARAM); | ||
100 | current_pos.file = current_file; | ||
101 | current_pos.lineno = current_file->lineno; | ||
102 | if (id && id->flags & TF_COMMAND) { | ||
103 | zconflval.id = id; | ||
104 | return id->token; | ||
105 | } | ||
106 | alloc_string(yytext, yyleng); | ||
107 | zconflval.string = text; | ||
108 | return T_WORD; | ||
109 | } | ||
110 | . | ||
111 | \n { | ||
112 | BEGIN(INITIAL); | ||
113 | current_file->lineno++; | ||
114 | return T_EOL; | ||
115 | } | ||
116 | } | ||
117 | |||
118 | <PARAM>{ | ||
119 | "&&" return T_AND; | ||
120 | "||" return T_OR; | ||
121 | "(" return T_OPEN_PAREN; | ||
122 | ")" return T_CLOSE_PAREN; | ||
123 | "!" return T_NOT; | ||
124 | "=" return T_EQUAL; | ||
125 | "!=" return T_UNEQUAL; | ||
126 | \"|\' { | ||
127 | str = yytext[0]; | ||
128 | new_string(); | ||
129 | BEGIN(STRING); | ||
130 | } | ||
131 | \n BEGIN(INITIAL); current_file->lineno++; return T_EOL; | ||
132 | --- /* ignore */ | ||
133 | ({n}|[-/.])+ { | ||
134 | struct kconf_id *id = kconf_id_lookup(yytext, yyleng); | ||
135 | if (id && id->flags & TF_PARAM) { | ||
136 | zconflval.id = id; | ||
137 | return id->token; | ||
138 | } | ||
139 | alloc_string(yytext, yyleng); | ||
140 | zconflval.string = text; | ||
141 | return T_WORD; | ||
142 | } | ||
143 | #.* /* comment */ | ||
144 | \\\n current_file->lineno++; | ||
145 | . | ||
146 | <<EOF>> { | ||
147 | BEGIN(INITIAL); | ||
148 | } | ||
149 | } | ||
150 | |||
151 | <STRING>{ | ||
152 | [^'"\\\n]+/\n { | ||
153 | append_string(yytext, yyleng); | ||
154 | zconflval.string = text; | ||
155 | return T_WORD_QUOTE; | ||
156 | } | ||
157 | [^'"\\\n]+ { | ||
158 | append_string(yytext, yyleng); | ||
159 | } | ||
160 | \\.?/\n { | ||
161 | append_string(yytext + 1, yyleng - 1); | ||
162 | zconflval.string = text; | ||
163 | return T_WORD_QUOTE; | ||
164 | } | ||
165 | \\.? { | ||
166 | append_string(yytext + 1, yyleng - 1); | ||
167 | } | ||
168 | \'|\" { | ||
169 | if (str == yytext[0]) { | ||
170 | BEGIN(PARAM); | ||
171 | zconflval.string = text; | ||
172 | return T_WORD_QUOTE; | ||
173 | } else | ||
174 | append_string(yytext, 1); | ||
175 | } | ||
176 | \n { | ||
177 | printf("%s:%d:warning: multi-line strings not supported\n", zconf_curname(), zconf_lineno()); | ||
178 | current_file->lineno++; | ||
179 | BEGIN(INITIAL); | ||
180 | return T_EOL; | ||
181 | } | ||
182 | <<EOF>> { | ||
183 | BEGIN(INITIAL); | ||
184 | } | ||
185 | } | ||
186 | |||
187 | <HELP>{ | ||
188 | [ \t]+ { | ||
189 | ts = 0; | ||
190 | for (i = 0; i < yyleng; i++) { | ||
191 | if (yytext[i] == '\t') | ||
192 | ts = (ts & ~7) + 8; | ||
193 | else | ||
194 | ts++; | ||
195 | } | ||
196 | last_ts = ts; | ||
197 | if (first_ts) { | ||
198 | if (ts < first_ts) { | ||
199 | zconf_endhelp(); | ||
200 | return T_HELPTEXT; | ||
201 | } | ||
202 | ts -= first_ts; | ||
203 | while (ts > 8) { | ||
204 | append_string(" ", 8); | ||
205 | ts -= 8; | ||
206 | } | ||
207 | append_string(" ", ts); | ||
208 | } | ||
209 | } | ||
210 | [ \t]*\n/[^ \t\n] { | ||
211 | current_file->lineno++; | ||
212 | zconf_endhelp(); | ||
213 | return T_HELPTEXT; | ||
214 | } | ||
215 | [ \t]*\n { | ||
216 | current_file->lineno++; | ||
217 | append_string("\n", 1); | ||
218 | } | ||
219 | [^ \t\n].* { | ||
220 | append_string(yytext, yyleng); | ||
221 | if (!first_ts) | ||
222 | first_ts = last_ts; | ||
223 | } | ||
224 | <<EOF>> { | ||
225 | zconf_endhelp(); | ||
226 | return T_HELPTEXT; | ||
227 | } | ||
228 | } | ||
229 | |||
230 | <<EOF>> { | ||
231 | if (current_file) { | ||
232 | zconf_endfile(); | ||
233 | return T_EOL; | ||
234 | } | ||
235 | fclose(yyin); | ||
236 | yyterminate(); | ||
237 | } | ||
238 | |||
239 | %% | ||
240 | void zconf_starthelp(void) | ||
241 | { | ||
242 | new_string(); | ||
243 | last_ts = first_ts = 0; | ||
244 | BEGIN(HELP); | ||
245 | } | ||
246 | |||
247 | static void zconf_endhelp(void) | ||
248 | { | ||
249 | zconflval.string = text; | ||
250 | BEGIN(INITIAL); | ||
251 | } | ||
252 | |||
253 | |||
254 | /* | ||
255 | * Try to open specified file with following names: | ||
256 | * ./name | ||
257 | * $(srctree)/name | ||
258 | * The latter is used when srctree is separate from objtree | ||
259 | * when compiling the kernel. | ||
260 | * Return NULL if file is not found. | ||
261 | */ | ||
262 | FILE *zconf_fopen(const char *name) | ||
263 | { | ||
264 | char *env, fullname[PATH_MAX+1]; | ||
265 | FILE *f; | ||
266 | |||
267 | f = fopen(name, "r"); | ||
268 | if (!f && name[0] != '/') { | ||
269 | env = getenv(SRCTREE); | ||
270 | if (env) { | ||
271 | sprintf(fullname, "%s/%s", env, name); | ||
272 | f = fopen(fullname, "r"); | ||
273 | } | ||
274 | } | ||
275 | return f; | ||
276 | } | ||
277 | |||
278 | void zconf_initscan(const char *name) | ||
279 | { | ||
280 | yyin = zconf_fopen(name); | ||
281 | if (!yyin) { | ||
282 | printf("can't find file %s\n", name); | ||
283 | exit(1); | ||
284 | } | ||
285 | |||
286 | current_buf = malloc(sizeof(*current_buf)); | ||
287 | memset(current_buf, 0, sizeof(*current_buf)); | ||
288 | |||
289 | current_file = file_lookup(name); | ||
290 | current_file->lineno = 1; | ||
291 | current_file->flags = FILE_BUSY; | ||
292 | } | ||
293 | |||
294 | void zconf_nextfile(const char *name) | ||
295 | { | ||
296 | struct file *file = file_lookup(name); | ||
297 | struct buffer *buf = malloc(sizeof(*buf)); | ||
298 | memset(buf, 0, sizeof(*buf)); | ||
299 | |||
300 | current_buf->state = YY_CURRENT_BUFFER; | ||
301 | yyin = zconf_fopen(name); | ||
302 | if (!yyin) { | ||
303 | printf("%s:%d: can't open file \"%s\"\n", zconf_curname(), zconf_lineno(), name); | ||
304 | exit(1); | ||
305 | } | ||
306 | yy_switch_to_buffer(yy_create_buffer(yyin, YY_BUF_SIZE)); | ||
307 | buf->parent = current_buf; | ||
308 | current_buf = buf; | ||
309 | |||
310 | if (file->flags & FILE_BUSY) { | ||
311 | printf("recursive scan (%s)?\n", name); | ||
312 | exit(1); | ||
313 | } | ||
314 | if (file->flags & FILE_SCANNED) { | ||
315 | printf("file %s already scanned?\n", name); | ||
316 | exit(1); | ||
317 | } | ||
318 | file->flags |= FILE_BUSY; | ||
319 | file->lineno = 1; | ||
320 | file->parent = current_file; | ||
321 | current_file = file; | ||
322 | } | ||
323 | |||
324 | static void zconf_endfile(void) | ||
325 | { | ||
326 | struct buffer *parent; | ||
327 | |||
328 | current_file->flags |= FILE_SCANNED; | ||
329 | current_file->flags &= ~FILE_BUSY; | ||
330 | current_file = current_file->parent; | ||
331 | |||
332 | parent = current_buf->parent; | ||
333 | if (parent) { | ||
334 | fclose(yyin); | ||
335 | yy_delete_buffer(YY_CURRENT_BUFFER); | ||
336 | yy_switch_to_buffer(parent->state); | ||
337 | } | ||
338 | free(current_buf); | ||
339 | current_buf = parent; | ||
340 | } | ||
341 | |||
342 | int zconf_lineno(void) | ||
343 | { | ||
344 | return current_pos.lineno; | ||
345 | } | ||
346 | |||
347 | char *zconf_curname(void) | ||
348 | { | ||
349 | return current_pos.file ? current_pos.file->name : "<none>"; | ||
350 | } | ||
diff --git a/scripts/kconfig/zconf.tab.c_shipped b/scripts/kconfig/zconf.tab.c_shipped new file mode 100644 index 000000000..ea7755da8 --- /dev/null +++ b/scripts/kconfig/zconf.tab.c_shipped | |||
@@ -0,0 +1,2173 @@ | |||
1 | /* A Bison parser, made by GNU Bison 2.0. */ | ||
2 | |||
3 | /* Skeleton parser for Yacc-like parsing with Bison, | ||
4 | Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc. | ||
5 | |||
6 | This program is free software; you can redistribute it and/or modify | ||
7 | it under the terms of the GNU General Public License as published by | ||
8 | the Free Software Foundation; either version 2, or (at your option) | ||
9 | any later version. | ||
10 | |||
11 | This program is distributed in the hope that it will be useful, | ||
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
14 | GNU General Public License for more details. | ||
15 | |||
16 | You should have received a copy of the GNU General Public License | ||
17 | along with this program; if not, write to the Free Software | ||
18 | Foundation, Inc., 59 Temple Place - Suite 330, | ||
19 | Boston, MA 02111-1307, USA. */ | ||
20 | |||
21 | /* As a special exception, when this file is copied by Bison into a | ||
22 | Bison output file, you may use that output file without restriction. | ||
23 | This special exception was added by the Free Software Foundation | ||
24 | in version 1.24 of Bison. */ | ||
25 | |||
26 | /* Written by Richard Stallman by simplifying the original so called | ||
27 | ``semantic'' parser. */ | ||
28 | |||
29 | /* All symbols defined below should begin with yy or YY, to avoid | ||
30 | infringing on user name space. This should be done even for local | ||
31 | variables, as they might otherwise be expanded by user macros. | ||
32 | There are some unavoidable exceptions within include files to | ||
33 | define necessary library symbols; they are noted "INFRINGES ON | ||
34 | USER NAME SPACE" below. */ | ||
35 | |||
36 | /* Identify Bison output. */ | ||
37 | #define YYBISON 1 | ||
38 | |||
39 | /* Skeleton name. */ | ||
40 | #define YYSKELETON_NAME "yacc.c" | ||
41 | |||
42 | /* Pure parsers. */ | ||
43 | #define YYPURE 0 | ||
44 | |||
45 | /* Using locations. */ | ||
46 | #define YYLSP_NEEDED 0 | ||
47 | |||
48 | /* Substitute the variable and function names. */ | ||
49 | #define yyparse zconfparse | ||
50 | #define yylex zconflex | ||
51 | #define yyerror zconferror | ||
52 | #define yylval zconflval | ||
53 | #define yychar zconfchar | ||
54 | #define yydebug zconfdebug | ||
55 | #define yynerrs zconfnerrs | ||
56 | |||
57 | |||
58 | /* Tokens. */ | ||
59 | #ifndef YYTOKENTYPE | ||
60 | # define YYTOKENTYPE | ||
61 | /* Put the tokens into the symbol table, so that GDB and other debuggers | ||
62 | know about them. */ | ||
63 | enum yytokentype { | ||
64 | T_MAINMENU = 258, | ||
65 | T_MENU = 259, | ||
66 | T_ENDMENU = 260, | ||
67 | T_SOURCE = 261, | ||
68 | T_CHOICE = 262, | ||
69 | T_ENDCHOICE = 263, | ||
70 | T_COMMENT = 264, | ||
71 | T_CONFIG = 265, | ||
72 | T_MENUCONFIG = 266, | ||
73 | T_HELP = 267, | ||
74 | T_HELPTEXT = 268, | ||
75 | T_IF = 269, | ||
76 | T_ENDIF = 270, | ||
77 | T_DEPENDS = 271, | ||
78 | T_REQUIRES = 272, | ||
79 | T_OPTIONAL = 273, | ||
80 | T_PROMPT = 274, | ||
81 | T_TYPE = 275, | ||
82 | T_DEFAULT = 276, | ||
83 | T_SELECT = 277, | ||
84 | T_RANGE = 278, | ||
85 | T_ON = 279, | ||
86 | T_WORD = 280, | ||
87 | T_WORD_QUOTE = 281, | ||
88 | T_UNEQUAL = 282, | ||
89 | T_CLOSE_PAREN = 283, | ||
90 | T_OPEN_PAREN = 284, | ||
91 | T_EOL = 285, | ||
92 | T_OR = 286, | ||
93 | T_AND = 287, | ||
94 | T_EQUAL = 288, | ||
95 | T_NOT = 289 | ||
96 | }; | ||
97 | #endif | ||
98 | #define T_MAINMENU 258 | ||
99 | #define T_MENU 259 | ||
100 | #define T_ENDMENU 260 | ||
101 | #define T_SOURCE 261 | ||
102 | #define T_CHOICE 262 | ||
103 | #define T_ENDCHOICE 263 | ||
104 | #define T_COMMENT 264 | ||
105 | #define T_CONFIG 265 | ||
106 | #define T_MENUCONFIG 266 | ||
107 | #define T_HELP 267 | ||
108 | #define T_HELPTEXT 268 | ||
109 | #define T_IF 269 | ||
110 | #define T_ENDIF 270 | ||
111 | #define T_DEPENDS 271 | ||
112 | #define T_REQUIRES 272 | ||
113 | #define T_OPTIONAL 273 | ||
114 | #define T_PROMPT 274 | ||
115 | #define T_TYPE 275 | ||
116 | #define T_DEFAULT 276 | ||
117 | #define T_SELECT 277 | ||
118 | #define T_RANGE 278 | ||
119 | #define T_ON 279 | ||
120 | #define T_WORD 280 | ||
121 | #define T_WORD_QUOTE 281 | ||
122 | #define T_UNEQUAL 282 | ||
123 | #define T_CLOSE_PAREN 283 | ||
124 | #define T_OPEN_PAREN 284 | ||
125 | #define T_EOL 285 | ||
126 | #define T_OR 286 | ||
127 | #define T_AND 287 | ||
128 | #define T_EQUAL 288 | ||
129 | #define T_NOT 289 | ||
130 | |||
131 | |||
132 | |||
133 | |||
134 | /* Copy the first part of user declarations. */ | ||
135 | |||
136 | |||
137 | /* | ||
138 | * Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org> | ||
139 | * Released under the terms of the GNU GPL v2.0. | ||
140 | */ | ||
141 | |||
142 | #include <ctype.h> | ||
143 | #include <stdarg.h> | ||
144 | #include <stdio.h> | ||
145 | #include <stdlib.h> | ||
146 | #include <string.h> | ||
147 | #include <stdbool.h> | ||
148 | |||
149 | #define LKC_DIRECT_LINK | ||
150 | #include "lkc.h" | ||
151 | |||
152 | #include "zconf.hash.c" | ||
153 | |||
154 | #define printd(mask, fmt...) if (cdebug & (mask)) printf(fmt) | ||
155 | |||
156 | #define PRINTD 0x0001 | ||
157 | #define DEBUG_PARSE 0x0002 | ||
158 | |||
159 | int cdebug = PRINTD; | ||
160 | |||
161 | extern int zconflex(void); | ||
162 | static void zconfprint(const char *err, ...); | ||
163 | static void zconf_error(const char *err, ...); | ||
164 | static void zconferror(const char *err); | ||
165 | static bool zconf_endtoken(struct kconf_id *id, int starttoken, int endtoken); | ||
166 | |||
167 | struct symbol *symbol_hash[257]; | ||
168 | |||
169 | static struct menu *current_menu, *current_entry; | ||
170 | |||
171 | #define YYDEBUG 0 | ||
172 | #if YYDEBUG | ||
173 | #define YYERROR_VERBOSE | ||
174 | #endif | ||
175 | |||
176 | |||
177 | /* Enabling traces. */ | ||
178 | #ifndef YYDEBUG | ||
179 | # define YYDEBUG 0 | ||
180 | #endif | ||
181 | |||
182 | /* Enabling verbose error messages. */ | ||
183 | #ifdef YYERROR_VERBOSE | ||
184 | # undef YYERROR_VERBOSE | ||
185 | # define YYERROR_VERBOSE 1 | ||
186 | #else | ||
187 | # define YYERROR_VERBOSE 0 | ||
188 | #endif | ||
189 | |||
190 | #if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED) | ||
191 | |||
192 | typedef union YYSTYPE { | ||
193 | char *string; | ||
194 | struct file *file; | ||
195 | struct symbol *symbol; | ||
196 | struct expr *expr; | ||
197 | struct menu *menu; | ||
198 | struct kconf_id *id; | ||
199 | } YYSTYPE; | ||
200 | /* Line 190 of yacc.c. */ | ||
201 | |||
202 | # define yystype YYSTYPE /* obsolescent; will be withdrawn */ | ||
203 | # define YYSTYPE_IS_DECLARED 1 | ||
204 | # define YYSTYPE_IS_TRIVIAL 1 | ||
205 | #endif | ||
206 | |||
207 | |||
208 | |||
209 | /* Copy the second part of user declarations. */ | ||
210 | |||
211 | |||
212 | /* Line 213 of yacc.c. */ | ||
213 | |||
214 | |||
215 | #if ! defined (yyoverflow) || YYERROR_VERBOSE | ||
216 | |||
217 | # ifndef YYFREE | ||
218 | # define YYFREE free | ||
219 | # endif | ||
220 | # ifndef YYMALLOC | ||
221 | # define YYMALLOC malloc | ||
222 | # endif | ||
223 | |||
224 | /* The parser invokes alloca or malloc; define the necessary symbols. */ | ||
225 | |||
226 | # ifdef YYSTACK_USE_ALLOCA | ||
227 | # if YYSTACK_USE_ALLOCA | ||
228 | # ifdef __GNUC__ | ||
229 | # define YYSTACK_ALLOC __builtin_alloca | ||
230 | # else | ||
231 | # define YYSTACK_ALLOC alloca | ||
232 | # endif | ||
233 | # endif | ||
234 | # endif | ||
235 | |||
236 | # ifdef YYSTACK_ALLOC | ||
237 | /* Pacify GCC's `empty if-body' warning. */ | ||
238 | # define YYSTACK_FREE(Ptr) do { /* empty */; } while (0) | ||
239 | # else | ||
240 | # if defined (__STDC__) || defined (__cplusplus) | ||
241 | # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ | ||
242 | # define YYSIZE_T size_t | ||
243 | # endif | ||
244 | # define YYSTACK_ALLOC YYMALLOC | ||
245 | # define YYSTACK_FREE YYFREE | ||
246 | # endif | ||
247 | #endif /* ! defined (yyoverflow) || YYERROR_VERBOSE */ | ||
248 | |||
249 | |||
250 | #if (! defined (yyoverflow) \ | ||
251 | && (! defined (__cplusplus) \ | ||
252 | || (defined (YYSTYPE_IS_TRIVIAL) && YYSTYPE_IS_TRIVIAL))) | ||
253 | |||
254 | /* A type that is properly aligned for any stack member. */ | ||
255 | union yyalloc | ||
256 | { | ||
257 | short int yyss; | ||
258 | YYSTYPE yyvs; | ||
259 | }; | ||
260 | |||
261 | /* The size of the maximum gap between one aligned stack and the next. */ | ||
262 | # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1) | ||
263 | |||
264 | /* The size of an array large to enough to hold all stacks, each with | ||
265 | N elements. */ | ||
266 | # define YYSTACK_BYTES(N) \ | ||
267 | ((N) * (sizeof (short int) + sizeof (YYSTYPE)) \ | ||
268 | + YYSTACK_GAP_MAXIMUM) | ||
269 | |||
270 | /* Copy COUNT objects from FROM to TO. The source and destination do | ||
271 | not overlap. */ | ||
272 | # ifndef YYCOPY | ||
273 | # if defined (__GNUC__) && 1 < __GNUC__ | ||
274 | # define YYCOPY(To, From, Count) \ | ||
275 | __builtin_memcpy (To, From, (Count) * sizeof (*(From))) | ||
276 | # else | ||
277 | # define YYCOPY(To, From, Count) \ | ||
278 | do \ | ||
279 | { \ | ||
280 | register YYSIZE_T yyi; \ | ||
281 | for (yyi = 0; yyi < (Count); yyi++) \ | ||
282 | (To)[yyi] = (From)[yyi]; \ | ||
283 | } \ | ||
284 | while (0) | ||
285 | # endif | ||
286 | # endif | ||
287 | |||
288 | /* Relocate STACK from its old location to the new one. The | ||
289 | local variables YYSIZE and YYSTACKSIZE give the old and new number of | ||
290 | elements in the stack, and YYPTR gives the new location of the | ||
291 | stack. Advance YYPTR to a properly aligned location for the next | ||
292 | stack. */ | ||
293 | # define YYSTACK_RELOCATE(Stack) \ | ||
294 | do \ | ||
295 | { \ | ||
296 | YYSIZE_T yynewbytes; \ | ||
297 | YYCOPY (&yyptr->Stack, Stack, yysize); \ | ||
298 | Stack = &yyptr->Stack; \ | ||
299 | yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ | ||
300 | yyptr += yynewbytes / sizeof (*yyptr); \ | ||
301 | } \ | ||
302 | while (0) | ||
303 | |||
304 | #endif | ||
305 | |||
306 | #if defined (__STDC__) || defined (__cplusplus) | ||
307 | typedef signed char yysigned_char; | ||
308 | #else | ||
309 | typedef short int yysigned_char; | ||
310 | #endif | ||
311 | |||
312 | /* YYFINAL -- State number of the termination state. */ | ||
313 | #define YYFINAL 3 | ||
314 | /* YYLAST -- Last index in YYTABLE. */ | ||
315 | #define YYLAST 264 | ||
316 | |||
317 | /* YYNTOKENS -- Number of terminals. */ | ||
318 | #define YYNTOKENS 35 | ||
319 | /* YYNNTS -- Number of nonterminals. */ | ||
320 | #define YYNNTS 42 | ||
321 | /* YYNRULES -- Number of rules. */ | ||
322 | #define YYNRULES 104 | ||
323 | /* YYNRULES -- Number of states. */ | ||
324 | #define YYNSTATES 175 | ||
325 | |||
326 | /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ | ||
327 | #define YYUNDEFTOK 2 | ||
328 | #define YYMAXUTOK 289 | ||
329 | |||
330 | #define YYTRANSLATE(YYX) \ | ||
331 | ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) | ||
332 | |||
333 | /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */ | ||
334 | static const unsigned char yytranslate[] = | ||
335 | { | ||
336 | 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, | ||
337 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | ||
338 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | ||
339 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | ||
340 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | ||
341 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | ||
342 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | ||
343 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | ||
344 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | ||
345 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | ||
346 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | ||
347 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | ||
348 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | ||
349 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | ||
350 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | ||
351 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | ||
352 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | ||
353 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | ||
354 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | ||
355 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | ||
356 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | ||
357 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | ||
358 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | ||
359 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | ||
360 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | ||
361 | 2, 2, 2, 2, 2, 2, 1, 2, 3, 4, | ||
362 | 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, | ||
363 | 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, | ||
364 | 25, 26, 27, 28, 29, 30, 31, 32, 33, 34 | ||
365 | }; | ||
366 | |||
367 | #if YYDEBUG | ||
368 | /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in | ||
369 | YYRHS. */ | ||
370 | static const unsigned short int yyprhs[] = | ||
371 | { | ||
372 | 0, 0, 3, 5, 6, 9, 12, 15, 20, 23, | ||
373 | 28, 33, 37, 39, 41, 43, 45, 47, 49, 51, | ||
374 | 53, 55, 57, 59, 61, 63, 67, 70, 74, 77, | ||
375 | 81, 84, 85, 88, 91, 94, 97, 100, 104, 109, | ||
376 | 114, 119, 125, 128, 131, 133, 137, 138, 141, 144, | ||
377 | 147, 150, 153, 158, 162, 165, 170, 171, 174, 178, | ||
378 | 180, 184, 185, 188, 191, 194, 198, 201, 203, 207, | ||
379 | 208, 211, 214, 217, 221, 225, 228, 231, 234, 235, | ||
380 | 238, 241, 244, 249, 253, 257, 258, 261, 263, 265, | ||
381 | 268, 271, 274, 276, 279, 280, 283, 285, 289, 293, | ||
382 | 297, 300, 304, 308, 310 | ||
383 | }; | ||
384 | |||
385 | /* YYRHS -- A `-1'-separated list of the rules' RHS. */ | ||
386 | static const yysigned_char yyrhs[] = | ||
387 | { | ||
388 | 36, 0, -1, 37, -1, -1, 37, 39, -1, 37, | ||
389 | 50, -1, 37, 61, -1, 37, 3, 71, 73, -1, | ||
390 | 37, 72, -1, 37, 25, 1, 30, -1, 37, 38, | ||
391 | 1, 30, -1, 37, 1, 30, -1, 16, -1, 19, | ||
392 | -1, 20, -1, 22, -1, 18, -1, 23, -1, 21, | ||
393 | -1, 30, -1, 56, -1, 65, -1, 42, -1, 44, | ||
394 | -1, 63, -1, 25, 1, 30, -1, 1, 30, -1, | ||
395 | 10, 25, 30, -1, 41, 45, -1, 11, 25, 30, | ||
396 | -1, 43, 45, -1, -1, 45, 46, -1, 45, 69, | ||
397 | -1, 45, 67, -1, 45, 40, -1, 45, 30, -1, | ||
398 | 20, 70, 30, -1, 19, 71, 74, 30, -1, 21, | ||
399 | 75, 74, 30, -1, 22, 25, 74, 30, -1, 23, | ||
400 | 76, 76, 74, 30, -1, 7, 30, -1, 47, 51, | ||
401 | -1, 72, -1, 48, 53, 49, -1, -1, 51, 52, | ||
402 | -1, 51, 69, -1, 51, 67, -1, 51, 30, -1, | ||
403 | 51, 40, -1, 19, 71, 74, 30, -1, 20, 70, | ||
404 | 30, -1, 18, 30, -1, 21, 25, 74, 30, -1, | ||
405 | -1, 53, 39, -1, 14, 75, 73, -1, 72, -1, | ||
406 | 54, 57, 55, -1, -1, 57, 39, -1, 57, 61, | ||
407 | -1, 57, 50, -1, 4, 71, 30, -1, 58, 68, | ||
408 | -1, 72, -1, 59, 62, 60, -1, -1, 62, 39, | ||
409 | -1, 62, 61, -1, 62, 50, -1, 6, 71, 30, | ||
410 | -1, 9, 71, 30, -1, 64, 68, -1, 12, 30, | ||
411 | -1, 66, 13, -1, -1, 68, 69, -1, 68, 30, | ||
412 | -1, 68, 40, -1, 16, 24, 75, 30, -1, 16, | ||
413 | 75, 30, -1, 17, 75, 30, -1, -1, 71, 74, | ||
414 | -1, 25, -1, 26, -1, 5, 30, -1, 8, 30, | ||
415 | -1, 15, 30, -1, 30, -1, 73, 30, -1, -1, | ||
416 | 14, 75, -1, 76, -1, 76, 33, 76, -1, 76, | ||
417 | 27, 76, -1, 29, 75, 28, -1, 34, 75, -1, | ||
418 | 75, 31, 75, -1, 75, 32, 75, -1, 25, -1, | ||
419 | 26, -1 | ||
420 | }; | ||
421 | |||
422 | /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ | ||
423 | static const unsigned short int yyrline[] = | ||
424 | { | ||
425 | 0, 103, 103, 105, 107, 108, 109, 110, 111, 112, | ||
426 | 113, 117, 121, 121, 121, 121, 121, 121, 121, 125, | ||
427 | 126, 127, 128, 129, 130, 134, 135, 141, 149, 155, | ||
428 | 163, 173, 175, 176, 177, 178, 179, 182, 190, 196, | ||
429 | 206, 212, 220, 229, 234, 242, 245, 247, 248, 249, | ||
430 | 250, 251, 254, 260, 271, 277, 287, 289, 294, 302, | ||
431 | 310, 313, 315, 316, 317, 322, 329, 334, 342, 345, | ||
432 | 347, 348, 349, 352, 360, 367, 374, 380, 387, 389, | ||
433 | 390, 391, 394, 399, 404, 412, 414, 419, 420, 423, | ||
434 | 424, 425, 429, 430, 433, 434, 437, 438, 439, 440, | ||
435 | 441, 442, 443, 446, 447 | ||
436 | }; | ||
437 | #endif | ||
438 | |||
439 | #if YYDEBUG || YYERROR_VERBOSE | ||
440 | /* YYTNME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. | ||
441 | First, the terminals, then, starting at YYNTOKENS, nonterminals. */ | ||
442 | static const char *const yytname[] = | ||
443 | { | ||
444 | "$end", "error", "$undefined", "T_MAINMENU", "T_MENU", "T_ENDMENU", | ||
445 | "T_SOURCE", "T_CHOICE", "T_ENDCHOICE", "T_COMMENT", "T_CONFIG", | ||
446 | "T_MENUCONFIG", "T_HELP", "T_HELPTEXT", "T_IF", "T_ENDIF", "T_DEPENDS", | ||
447 | "T_REQUIRES", "T_OPTIONAL", "T_PROMPT", "T_TYPE", "T_DEFAULT", | ||
448 | "T_SELECT", "T_RANGE", "T_ON", "T_WORD", "T_WORD_QUOTE", "T_UNEQUAL", | ||
449 | "T_CLOSE_PAREN", "T_OPEN_PAREN", "T_EOL", "T_OR", "T_AND", "T_EQUAL", | ||
450 | "T_NOT", "$accept", "input", "stmt_list", "option_name", "common_stmt", | ||
451 | "option_error", "config_entry_start", "config_stmt", | ||
452 | "menuconfig_entry_start", "menuconfig_stmt", "config_option_list", | ||
453 | "config_option", "choice", "choice_entry", "choice_end", "choice_stmt", | ||
454 | "choice_option_list", "choice_option", "choice_block", "if_entry", | ||
455 | "if_end", "if_stmt", "if_block", "menu", "menu_entry", "menu_end", | ||
456 | "menu_stmt", "menu_block", "source_stmt", "comment", "comment_stmt", | ||
457 | "help_start", "help", "depends_list", "depends", "prompt_stmt_opt", | ||
458 | "prompt", "end", "nl", "if_expr", "expr", "symbol", 0 | ||
459 | }; | ||
460 | #endif | ||
461 | |||
462 | # ifdef YYPRINT | ||
463 | /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to | ||
464 | token YYLEX-NUM. */ | ||
465 | static const unsigned short int yytoknum[] = | ||
466 | { | ||
467 | 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, | ||
468 | 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, | ||
469 | 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, | ||
470 | 285, 286, 287, 288, 289 | ||
471 | }; | ||
472 | # endif | ||
473 | |||
474 | /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ | ||
475 | static const unsigned char yyr1[] = | ||
476 | { | ||
477 | 0, 35, 36, 37, 37, 37, 37, 37, 37, 37, | ||
478 | 37, 37, 38, 38, 38, 38, 38, 38, 38, 39, | ||
479 | 39, 39, 39, 39, 39, 40, 40, 41, 42, 43, | ||
480 | 44, 45, 45, 45, 45, 45, 45, 46, 46, 46, | ||
481 | 46, 46, 47, 48, 49, 50, 51, 51, 51, 51, | ||
482 | 51, 51, 52, 52, 52, 52, 53, 53, 54, 55, | ||
483 | 56, 57, 57, 57, 57, 58, 59, 60, 61, 62, | ||
484 | 62, 62, 62, 63, 64, 65, 66, 67, 68, 68, | ||
485 | 68, 68, 69, 69, 69, 70, 70, 71, 71, 72, | ||
486 | 72, 72, 73, 73, 74, 74, 75, 75, 75, 75, | ||
487 | 75, 75, 75, 76, 76 | ||
488 | }; | ||
489 | |||
490 | /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ | ||
491 | static const unsigned char yyr2[] = | ||
492 | { | ||
493 | 0, 2, 1, 0, 2, 2, 2, 4, 2, 4, | ||
494 | 4, 3, 1, 1, 1, 1, 1, 1, 1, 1, | ||
495 | 1, 1, 1, 1, 1, 3, 2, 3, 2, 3, | ||
496 | 2, 0, 2, 2, 2, 2, 2, 3, 4, 4, | ||
497 | 4, 5, 2, 2, 1, 3, 0, 2, 2, 2, | ||
498 | 2, 2, 4, 3, 2, 4, 0, 2, 3, 1, | ||
499 | 3, 0, 2, 2, 2, 3, 2, 1, 3, 0, | ||
500 | 2, 2, 2, 3, 3, 2, 2, 2, 0, 2, | ||
501 | 2, 2, 4, 3, 3, 0, 2, 1, 1, 2, | ||
502 | 2, 2, 1, 2, 0, 2, 1, 3, 3, 3, | ||
503 | 2, 3, 3, 1, 1 | ||
504 | }; | ||
505 | |||
506 | /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state | ||
507 | STATE-NUM when YYTABLE doesn't specify something else to do. Zero | ||
508 | means the default is an error. */ | ||
509 | static const unsigned char yydefact[] = | ||
510 | { | ||
511 | 3, 0, 0, 1, 0, 0, 0, 0, 0, 0, | ||
512 | 0, 0, 0, 0, 0, 0, 12, 16, 13, 14, | ||
513 | 18, 15, 17, 0, 19, 0, 4, 31, 22, 31, | ||
514 | 23, 46, 56, 5, 61, 20, 78, 69, 6, 24, | ||
515 | 78, 21, 8, 11, 87, 88, 0, 0, 89, 0, | ||
516 | 42, 90, 0, 0, 0, 103, 104, 0, 0, 0, | ||
517 | 96, 91, 0, 0, 0, 0, 0, 0, 0, 0, | ||
518 | 0, 0, 92, 7, 65, 73, 74, 27, 29, 0, | ||
519 | 100, 0, 0, 58, 0, 0, 9, 10, 0, 0, | ||
520 | 0, 0, 0, 85, 0, 0, 0, 0, 36, 35, | ||
521 | 32, 0, 34, 33, 0, 0, 85, 0, 50, 51, | ||
522 | 47, 49, 48, 57, 45, 44, 62, 64, 60, 63, | ||
523 | 59, 80, 81, 79, 70, 72, 68, 71, 67, 93, | ||
524 | 99, 101, 102, 98, 97, 26, 76, 0, 0, 0, | ||
525 | 94, 0, 94, 94, 94, 0, 0, 77, 54, 94, | ||
526 | 0, 94, 0, 83, 84, 0, 0, 37, 86, 0, | ||
527 | 0, 94, 25, 0, 53, 0, 82, 95, 38, 39, | ||
528 | 40, 0, 52, 55, 41 | ||
529 | }; | ||
530 | |||
531 | /* YYDEFGOTO[NTERM-NUM]. */ | ||
532 | static const short int yydefgoto[] = | ||
533 | { | ||
534 | -1, 1, 2, 25, 26, 99, 27, 28, 29, 30, | ||
535 | 64, 100, 31, 32, 114, 33, 66, 110, 67, 34, | ||
536 | 118, 35, 68, 36, 37, 126, 38, 70, 39, 40, | ||
537 | 41, 101, 102, 69, 103, 141, 142, 42, 73, 156, | ||
538 | 59, 60 | ||
539 | }; | ||
540 | |||
541 | /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing | ||
542 | STATE-NUM. */ | ||
543 | #define YYPACT_NINF -78 | ||
544 | static const short int yypact[] = | ||
545 | { | ||
546 | -78, 2, 159, -78, -21, 0, 0, -12, 0, 1, | ||
547 | 4, 0, 27, 38, 60, 58, -78, -78, -78, -78, | ||
548 | -78, -78, -78, 100, -78, 104, -78, -78, -78, -78, | ||
549 | -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, | ||
550 | -78, -78, -78, -78, -78, -78, 86, 113, -78, 114, | ||
551 | -78, -78, 125, 127, 128, -78, -78, 60, 60, 210, | ||
552 | 65, -78, 141, 142, 39, 103, 182, 200, 6, 66, | ||
553 | 6, 131, -78, 146, -78, -78, -78, -78, -78, 196, | ||
554 | -78, 60, 60, 146, 40, 40, -78, -78, 155, 156, | ||
555 | -2, 60, 0, 0, 60, 105, 40, 194, -78, -78, | ||
556 | -78, 206, -78, -78, 183, 0, 0, 195, -78, -78, | ||
557 | -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, | ||
558 | -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, | ||
559 | -78, 197, -78, -78, -78, -78, -78, 60, 213, 216, | ||
560 | 212, 203, 212, 190, 212, 40, 208, -78, -78, 212, | ||
561 | 222, 212, 219, -78, -78, 60, 223, -78, -78, 224, | ||
562 | 225, 212, -78, 226, -78, 227, -78, 47, -78, -78, | ||
563 | -78, 228, -78, -78, -78 | ||
564 | }; | ||
565 | |||
566 | /* YYPGOTO[NTERM-NUM]. */ | ||
567 | static const short int yypgoto[] = | ||
568 | { | ||
569 | -78, -78, -78, -78, 164, -36, -78, -78, -78, -78, | ||
570 | 230, -78, -78, -78, -78, 29, -78, -78, -78, -78, | ||
571 | -78, -78, -78, -78, -78, -78, 59, -78, -78, -78, | ||
572 | -78, -78, 198, 220, 24, 157, -5, 169, 202, 74, | ||
573 | -53, -77 | ||
574 | }; | ||
575 | |||
576 | /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If | ||
577 | positive, shift that token. If negative, reduce the rule which | ||
578 | number is the opposite. If zero, do what YYDEFACT says. | ||
579 | If YYTABLE_NINF, syntax error. */ | ||
580 | #define YYTABLE_NINF -76 | ||
581 | static const short int yytable[] = | ||
582 | { | ||
583 | 46, 47, 3, 49, 79, 80, 52, 133, 134, 43, | ||
584 | 6, 7, 8, 9, 10, 11, 12, 13, 48, 145, | ||
585 | 14, 15, 137, 55, 56, 44, 45, 57, 131, 132, | ||
586 | 109, 50, 58, 122, 51, 122, 24, 138, 139, -28, | ||
587 | 88, 143, -28, -28, -28, -28, -28, -28, -28, -28, | ||
588 | -28, 89, 53, -28, -28, 90, 91, -28, 92, 93, | ||
589 | 94, 95, 96, 54, 97, 55, 56, 88, 161, 98, | ||
590 | -66, -66, -66, -66, -66, -66, -66, -66, 81, 82, | ||
591 | -66, -66, 90, 91, 152, 55, 56, 140, 61, 57, | ||
592 | 112, 97, 84, 123, 58, 123, 121, 117, 85, 125, | ||
593 | 149, 62, 167, -30, 88, 63, -30, -30, -30, -30, | ||
594 | -30, -30, -30, -30, -30, 89, 72, -30, -30, 90, | ||
595 | 91, -30, 92, 93, 94, 95, 96, 119, 97, 127, | ||
596 | 144, -75, 88, 98, -75, -75, -75, -75, -75, -75, | ||
597 | -75, -75, -75, 74, 75, -75, -75, 90, 91, -75, | ||
598 | -75, -75, -75, -75, -75, 76, 97, 77, 78, -2, | ||
599 | 4, 121, 5, 6, 7, 8, 9, 10, 11, 12, | ||
600 | 13, 86, 87, 14, 15, 16, 129, 17, 18, 19, | ||
601 | 20, 21, 22, 88, 23, 135, 136, -43, -43, 24, | ||
602 | -43, -43, -43, -43, 89, 146, -43, -43, 90, 91, | ||
603 | 104, 105, 106, 107, 155, 7, 8, 97, 10, 11, | ||
604 | 12, 13, 108, 148, 14, 15, 158, 159, 160, 147, | ||
605 | 151, 81, 82, 163, 130, 165, 155, 81, 82, 82, | ||
606 | 24, 113, 116, 157, 124, 171, 115, 120, 162, 128, | ||
607 | 72, 81, 82, 153, 81, 82, 154, 81, 82, 166, | ||
608 | 81, 82, 164, 168, 169, 170, 172, 173, 174, 65, | ||
609 | 71, 83, 0, 150, 111 | ||
610 | }; | ||
611 | |||
612 | static const short int yycheck[] = | ||
613 | { | ||
614 | 5, 6, 0, 8, 57, 58, 11, 84, 85, 30, | ||
615 | 4, 5, 6, 7, 8, 9, 10, 11, 30, 96, | ||
616 | 14, 15, 24, 25, 26, 25, 26, 29, 81, 82, | ||
617 | 66, 30, 34, 69, 30, 71, 30, 90, 91, 0, | ||
618 | 1, 94, 3, 4, 5, 6, 7, 8, 9, 10, | ||
619 | 11, 12, 25, 14, 15, 16, 17, 18, 19, 20, | ||
620 | 21, 22, 23, 25, 25, 25, 26, 1, 145, 30, | ||
621 | 4, 5, 6, 7, 8, 9, 10, 11, 31, 32, | ||
622 | 14, 15, 16, 17, 137, 25, 26, 92, 30, 29, | ||
623 | 66, 25, 27, 69, 34, 71, 30, 68, 33, 70, | ||
624 | 105, 1, 155, 0, 1, 1, 3, 4, 5, 6, | ||
625 | 7, 8, 9, 10, 11, 12, 30, 14, 15, 16, | ||
626 | 17, 18, 19, 20, 21, 22, 23, 68, 25, 70, | ||
627 | 25, 0, 1, 30, 3, 4, 5, 6, 7, 8, | ||
628 | 9, 10, 11, 30, 30, 14, 15, 16, 17, 18, | ||
629 | 19, 20, 21, 22, 23, 30, 25, 30, 30, 0, | ||
630 | 1, 30, 3, 4, 5, 6, 7, 8, 9, 10, | ||
631 | 11, 30, 30, 14, 15, 16, 30, 18, 19, 20, | ||
632 | 21, 22, 23, 1, 25, 30, 30, 5, 6, 30, | ||
633 | 8, 9, 10, 11, 12, 1, 14, 15, 16, 17, | ||
634 | 18, 19, 20, 21, 14, 5, 6, 25, 8, 9, | ||
635 | 10, 11, 30, 30, 14, 15, 142, 143, 144, 13, | ||
636 | 25, 31, 32, 149, 28, 151, 14, 31, 32, 32, | ||
637 | 30, 67, 68, 30, 70, 161, 67, 68, 30, 70, | ||
638 | 30, 31, 32, 30, 31, 32, 30, 31, 32, 30, | ||
639 | 31, 32, 30, 30, 30, 30, 30, 30, 30, 29, | ||
640 | 40, 59, -1, 106, 66 | ||
641 | }; | ||
642 | |||
643 | /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing | ||
644 | symbol of state STATE-NUM. */ | ||
645 | static const unsigned char yystos[] = | ||
646 | { | ||
647 | 0, 36, 37, 0, 1, 3, 4, 5, 6, 7, | ||
648 | 8, 9, 10, 11, 14, 15, 16, 18, 19, 20, | ||
649 | 21, 22, 23, 25, 30, 38, 39, 41, 42, 43, | ||
650 | 44, 47, 48, 50, 54, 56, 58, 59, 61, 63, | ||
651 | 64, 65, 72, 30, 25, 26, 71, 71, 30, 71, | ||
652 | 30, 30, 71, 25, 25, 25, 26, 29, 34, 75, | ||
653 | 76, 30, 1, 1, 45, 45, 51, 53, 57, 68, | ||
654 | 62, 68, 30, 73, 30, 30, 30, 30, 30, 75, | ||
655 | 75, 31, 32, 73, 27, 33, 30, 30, 1, 12, | ||
656 | 16, 17, 19, 20, 21, 22, 23, 25, 30, 40, | ||
657 | 46, 66, 67, 69, 18, 19, 20, 21, 30, 40, | ||
658 | 52, 67, 69, 39, 49, 72, 39, 50, 55, 61, | ||
659 | 72, 30, 40, 69, 39, 50, 60, 61, 72, 30, | ||
660 | 28, 75, 75, 76, 76, 30, 30, 24, 75, 75, | ||
661 | 71, 70, 71, 75, 25, 76, 1, 13, 30, 71, | ||
662 | 70, 25, 75, 30, 30, 14, 74, 30, 74, 74, | ||
663 | 74, 76, 30, 74, 30, 74, 30, 75, 30, 30, | ||
664 | 30, 74, 30, 30, 30 | ||
665 | }; | ||
666 | |||
667 | #if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__) | ||
668 | # define YYSIZE_T __SIZE_TYPE__ | ||
669 | #endif | ||
670 | #if ! defined (YYSIZE_T) && defined (size_t) | ||
671 | # define YYSIZE_T size_t | ||
672 | #endif | ||
673 | #if ! defined (YYSIZE_T) | ||
674 | # if defined (__STDC__) || defined (__cplusplus) | ||
675 | # include <stddef.h> /* INFRINGES ON USER NAME SPACE */ | ||
676 | # define YYSIZE_T size_t | ||
677 | # endif | ||
678 | #endif | ||
679 | #if ! defined (YYSIZE_T) | ||
680 | # define YYSIZE_T unsigned int | ||
681 | #endif | ||
682 | |||
683 | #define yyerrok (yyerrstatus = 0) | ||
684 | #define yyclearin (yychar = YYEMPTY) | ||
685 | #define YYEMPTY (-2) | ||
686 | #define YYEOF 0 | ||
687 | |||
688 | #define YYACCEPT goto yyacceptlab | ||
689 | #define YYABORT goto yyabortlab | ||
690 | #define YYERROR goto yyerrorlab | ||
691 | |||
692 | |||
693 | /* Like YYERROR except do call yyerror. This remains here temporarily | ||
694 | to ease the transition to the new meaning of YYERROR, for GCC. | ||
695 | Once GCC version 2 has supplanted version 1, this can go. */ | ||
696 | |||
697 | #define YYFAIL goto yyerrlab | ||
698 | |||
699 | #define YYRECOVERING() (!!yyerrstatus) | ||
700 | |||
701 | #define YYBACKUP(Token, Value) \ | ||
702 | do \ | ||
703 | if (yychar == YYEMPTY && yylen == 1) \ | ||
704 | { \ | ||
705 | yychar = (Token); \ | ||
706 | yylval = (Value); \ | ||
707 | yytoken = YYTRANSLATE (yychar); \ | ||
708 | YYPOPSTACK; \ | ||
709 | goto yybackup; \ | ||
710 | } \ | ||
711 | else \ | ||
712 | { \ | ||
713 | yyerror ("syntax error: cannot back up");\ | ||
714 | YYERROR; \ | ||
715 | } \ | ||
716 | while (0) | ||
717 | |||
718 | |||
719 | #define YYTERROR 1 | ||
720 | #define YYERRCODE 256 | ||
721 | |||
722 | |||
723 | /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N]. | ||
724 | If N is 0, then set CURRENT to the empty location which ends | ||
725 | the previous symbol: RHS[0] (always defined). */ | ||
726 | |||
727 | #define YYRHSLOC(Rhs, K) ((Rhs)[K]) | ||
728 | #ifndef YYLLOC_DEFAULT | ||
729 | # define YYLLOC_DEFAULT(Current, Rhs, N) \ | ||
730 | do \ | ||
731 | if (N) \ | ||
732 | { \ | ||
733 | (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \ | ||
734 | (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \ | ||
735 | (Current).last_line = YYRHSLOC (Rhs, N).last_line; \ | ||
736 | (Current).last_column = YYRHSLOC (Rhs, N).last_column; \ | ||
737 | } \ | ||
738 | else \ | ||
739 | { \ | ||
740 | (Current).first_line = (Current).last_line = \ | ||
741 | YYRHSLOC (Rhs, 0).last_line; \ | ||
742 | (Current).first_column = (Current).last_column = \ | ||
743 | YYRHSLOC (Rhs, 0).last_column; \ | ||
744 | } \ | ||
745 | while (0) | ||
746 | #endif | ||
747 | |||
748 | |||
749 | /* YY_LOCATION_PRINT -- Print the location on the stream. | ||
750 | This macro was not mandated originally: define only if we know | ||
751 | we won't break user code: when these are the locations we know. */ | ||
752 | |||
753 | #ifndef YY_LOCATION_PRINT | ||
754 | # if YYLTYPE_IS_TRIVIAL | ||
755 | # define YY_LOCATION_PRINT(File, Loc) \ | ||
756 | fprintf (File, "%d.%d-%d.%d", \ | ||
757 | (Loc).first_line, (Loc).first_column, \ | ||
758 | (Loc).last_line, (Loc).last_column) | ||
759 | # else | ||
760 | # define YY_LOCATION_PRINT(File, Loc) ((void) 0) | ||
761 | # endif | ||
762 | #endif | ||
763 | |||
764 | |||
765 | /* YYLEX -- calling `yylex' with the right arguments. */ | ||
766 | |||
767 | #ifdef YYLEX_PARAM | ||
768 | # define YYLEX yylex (YYLEX_PARAM) | ||
769 | #else | ||
770 | # define YYLEX yylex () | ||
771 | #endif | ||
772 | |||
773 | /* Enable debugging if requested. */ | ||
774 | #if YYDEBUG | ||
775 | |||
776 | # ifndef YYFPRINTF | ||
777 | # include <stdio.h> /* INFRINGES ON USER NAME SPACE */ | ||
778 | # define YYFPRINTF fprintf | ||
779 | # endif | ||
780 | |||
781 | # define YYDPRINTF(Args) \ | ||
782 | do { \ | ||
783 | if (yydebug) \ | ||
784 | YYFPRINTF Args; \ | ||
785 | } while (0) | ||
786 | |||
787 | # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ | ||
788 | do { \ | ||
789 | if (yydebug) \ | ||
790 | { \ | ||
791 | YYFPRINTF (stderr, "%s ", Title); \ | ||
792 | yysymprint (stderr, \ | ||
793 | Type, Value); \ | ||
794 | YYFPRINTF (stderr, "\n"); \ | ||
795 | } \ | ||
796 | } while (0) | ||
797 | |||
798 | /*------------------------------------------------------------------. | ||
799 | | yy_stack_print -- Print the state stack from its BOTTOM up to its | | ||
800 | | TOP (included). | | ||
801 | `------------------------------------------------------------------*/ | ||
802 | |||
803 | #if defined (__STDC__) || defined (__cplusplus) | ||
804 | static void | ||
805 | yy_stack_print (short int *bottom, short int *top) | ||
806 | #else | ||
807 | static void | ||
808 | yy_stack_print (bottom, top) | ||
809 | short int *bottom; | ||
810 | short int *top; | ||
811 | #endif | ||
812 | { | ||
813 | YYFPRINTF (stderr, "Stack now"); | ||
814 | for (/* Nothing. */; bottom <= top; ++bottom) | ||
815 | YYFPRINTF (stderr, " %d", *bottom); | ||
816 | YYFPRINTF (stderr, "\n"); | ||
817 | } | ||
818 | |||
819 | # define YY_STACK_PRINT(Bottom, Top) \ | ||
820 | do { \ | ||
821 | if (yydebug) \ | ||
822 | yy_stack_print ((Bottom), (Top)); \ | ||
823 | } while (0) | ||
824 | |||
825 | |||
826 | /*------------------------------------------------. | ||
827 | | Report that the YYRULE is going to be reduced. | | ||
828 | `------------------------------------------------*/ | ||
829 | |||
830 | #if defined (__STDC__) || defined (__cplusplus) | ||
831 | static void | ||
832 | yy_reduce_print (int yyrule) | ||
833 | #else | ||
834 | static void | ||
835 | yy_reduce_print (yyrule) | ||
836 | int yyrule; | ||
837 | #endif | ||
838 | { | ||
839 | int yyi; | ||
840 | unsigned int yylno = yyrline[yyrule]; | ||
841 | YYFPRINTF (stderr, "Reducing stack by rule %d (line %u), ", | ||
842 | yyrule - 1, yylno); | ||
843 | /* Print the symbols being reduced, and their result. */ | ||
844 | for (yyi = yyprhs[yyrule]; 0 <= yyrhs[yyi]; yyi++) | ||
845 | YYFPRINTF (stderr, "%s ", yytname [yyrhs[yyi]]); | ||
846 | YYFPRINTF (stderr, "-> %s\n", yytname [yyr1[yyrule]]); | ||
847 | } | ||
848 | |||
849 | # define YY_REDUCE_PRINT(Rule) \ | ||
850 | do { \ | ||
851 | if (yydebug) \ | ||
852 | yy_reduce_print (Rule); \ | ||
853 | } while (0) | ||
854 | |||
855 | /* Nonzero means print parse trace. It is left uninitialized so that | ||
856 | multiple parsers can coexist. */ | ||
857 | int yydebug; | ||
858 | #else /* !YYDEBUG */ | ||
859 | # define YYDPRINTF(Args) | ||
860 | # define YY_SYMBOL_PRINT(Title, Type, Value, Location) | ||
861 | # define YY_STACK_PRINT(Bottom, Top) | ||
862 | # define YY_REDUCE_PRINT(Rule) | ||
863 | #endif /* !YYDEBUG */ | ||
864 | |||
865 | |||
866 | /* YYINITDEPTH -- initial size of the parser's stacks. */ | ||
867 | #ifndef YYINITDEPTH | ||
868 | # define YYINITDEPTH 200 | ||
869 | #endif | ||
870 | |||
871 | /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only | ||
872 | if the built-in stack extension method is used). | ||
873 | |||
874 | Do not make this value too large; the results are undefined if | ||
875 | SIZE_MAX < YYSTACK_BYTES (YYMAXDEPTH) | ||
876 | evaluated with infinite-precision integer arithmetic. */ | ||
877 | |||
878 | #ifndef YYMAXDEPTH | ||
879 | # define YYMAXDEPTH 10000 | ||
880 | #endif | ||
881 | |||
882 | |||
883 | |||
884 | #if YYERROR_VERBOSE | ||
885 | |||
886 | # ifndef yystrlen | ||
887 | # if defined (__GLIBC__) && defined (_STRING_H) | ||
888 | # define yystrlen strlen | ||
889 | # else | ||
890 | /* Return the length of YYSTR. */ | ||
891 | static YYSIZE_T | ||
892 | # if defined (__STDC__) || defined (__cplusplus) | ||
893 | yystrlen (const char *yystr) | ||
894 | # else | ||
895 | yystrlen (yystr) | ||
896 | const char *yystr; | ||
897 | # endif | ||
898 | { | ||
899 | register const char *yys = yystr; | ||
900 | |||
901 | while (*yys++ != '\0') | ||
902 | continue; | ||
903 | |||
904 | return yys - yystr - 1; | ||
905 | } | ||
906 | # endif | ||
907 | # endif | ||
908 | |||
909 | # ifndef yystpcpy | ||
910 | # if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE) | ||
911 | # define yystpcpy stpcpy | ||
912 | # else | ||
913 | /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in | ||
914 | YYDEST. */ | ||
915 | static char * | ||
916 | # if defined (__STDC__) || defined (__cplusplus) | ||
917 | yystpcpy (char *yydest, const char *yysrc) | ||
918 | # else | ||
919 | yystpcpy (yydest, yysrc) | ||
920 | char *yydest; | ||
921 | const char *yysrc; | ||
922 | # endif | ||
923 | { | ||
924 | register char *yyd = yydest; | ||
925 | register const char *yys = yysrc; | ||
926 | |||
927 | while ((*yyd++ = *yys++) != '\0') | ||
928 | continue; | ||
929 | |||
930 | return yyd - 1; | ||
931 | } | ||
932 | # endif | ||
933 | # endif | ||
934 | |||
935 | #endif /* !YYERROR_VERBOSE */ | ||
936 | |||
937 | |||
938 | |||
939 | #if YYDEBUG | ||
940 | /*--------------------------------. | ||
941 | | Print this symbol on YYOUTPUT. | | ||
942 | `--------------------------------*/ | ||
943 | |||
944 | #if defined (__STDC__) || defined (__cplusplus) | ||
945 | static void | ||
946 | yysymprint (FILE *yyoutput, int yytype, YYSTYPE *yyvaluep) | ||
947 | #else | ||
948 | static void | ||
949 | yysymprint (yyoutput, yytype, yyvaluep) | ||
950 | FILE *yyoutput; | ||
951 | int yytype; | ||
952 | YYSTYPE *yyvaluep; | ||
953 | #endif | ||
954 | { | ||
955 | /* Pacify ``unused variable'' warnings. */ | ||
956 | (void) yyvaluep; | ||
957 | |||
958 | if (yytype < YYNTOKENS) | ||
959 | YYFPRINTF (yyoutput, "token %s (", yytname[yytype]); | ||
960 | else | ||
961 | YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]); | ||
962 | |||
963 | |||
964 | # ifdef YYPRINT | ||
965 | if (yytype < YYNTOKENS) | ||
966 | YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep); | ||
967 | # endif | ||
968 | switch (yytype) | ||
969 | { | ||
970 | default: | ||
971 | break; | ||
972 | } | ||
973 | YYFPRINTF (yyoutput, ")"); | ||
974 | } | ||
975 | |||
976 | #endif /* ! YYDEBUG */ | ||
977 | /*-----------------------------------------------. | ||
978 | | Release the memory associated to this symbol. | | ||
979 | `-----------------------------------------------*/ | ||
980 | |||
981 | #if defined (__STDC__) || defined (__cplusplus) | ||
982 | static void | ||
983 | yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep) | ||
984 | #else | ||
985 | static void | ||
986 | yydestruct (yymsg, yytype, yyvaluep) | ||
987 | const char *yymsg; | ||
988 | int yytype; | ||
989 | YYSTYPE *yyvaluep; | ||
990 | #endif | ||
991 | { | ||
992 | /* Pacify ``unused variable'' warnings. */ | ||
993 | (void) yyvaluep; | ||
994 | |||
995 | if (!yymsg) | ||
996 | yymsg = "Deleting"; | ||
997 | YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp); | ||
998 | |||
999 | switch (yytype) | ||
1000 | { | ||
1001 | case 48: /* choice_entry */ | ||
1002 | |||
1003 | { | ||
1004 | fprintf(stderr, "%s:%d: missing end statement for this entry\n", | ||
1005 | (yyvaluep->menu)->file->name, (yyvaluep->menu)->lineno); | ||
1006 | if (current_menu == (yyvaluep->menu)) | ||
1007 | menu_end_menu(); | ||
1008 | }; | ||
1009 | |||
1010 | break; | ||
1011 | case 54: /* if_entry */ | ||
1012 | |||
1013 | { | ||
1014 | fprintf(stderr, "%s:%d: missing end statement for this entry\n", | ||
1015 | (yyvaluep->menu)->file->name, (yyvaluep->menu)->lineno); | ||
1016 | if (current_menu == (yyvaluep->menu)) | ||
1017 | menu_end_menu(); | ||
1018 | }; | ||
1019 | |||
1020 | break; | ||
1021 | case 59: /* menu_entry */ | ||
1022 | |||
1023 | { | ||
1024 | fprintf(stderr, "%s:%d: missing end statement for this entry\n", | ||
1025 | (yyvaluep->menu)->file->name, (yyvaluep->menu)->lineno); | ||
1026 | if (current_menu == (yyvaluep->menu)) | ||
1027 | menu_end_menu(); | ||
1028 | }; | ||
1029 | |||
1030 | break; | ||
1031 | |||
1032 | default: | ||
1033 | break; | ||
1034 | } | ||
1035 | } | ||
1036 | |||
1037 | |||
1038 | /* Prevent warnings from -Wmissing-prototypes. */ | ||
1039 | |||
1040 | #ifdef YYPARSE_PARAM | ||
1041 | # if defined (__STDC__) || defined (__cplusplus) | ||
1042 | int yyparse (void *YYPARSE_PARAM); | ||
1043 | # else | ||
1044 | int yyparse (); | ||
1045 | # endif | ||
1046 | #else /* ! YYPARSE_PARAM */ | ||
1047 | #if defined (__STDC__) || defined (__cplusplus) | ||
1048 | int yyparse (void); | ||
1049 | #else | ||
1050 | int yyparse (); | ||
1051 | #endif | ||
1052 | #endif /* ! YYPARSE_PARAM */ | ||
1053 | |||
1054 | |||
1055 | |||
1056 | /* The look-ahead symbol. */ | ||
1057 | int yychar; | ||
1058 | |||
1059 | /* The semantic value of the look-ahead symbol. */ | ||
1060 | YYSTYPE yylval; | ||
1061 | |||
1062 | /* Number of syntax errors so far. */ | ||
1063 | int yynerrs; | ||
1064 | |||
1065 | |||
1066 | |||
1067 | /*----------. | ||
1068 | | yyparse. | | ||
1069 | `----------*/ | ||
1070 | |||
1071 | #ifdef YYPARSE_PARAM | ||
1072 | # if defined (__STDC__) || defined (__cplusplus) | ||
1073 | int yyparse (void *YYPARSE_PARAM) | ||
1074 | # else | ||
1075 | int yyparse (YYPARSE_PARAM) | ||
1076 | void *YYPARSE_PARAM; | ||
1077 | # endif | ||
1078 | #else /* ! YYPARSE_PARAM */ | ||
1079 | #if defined (__STDC__) || defined (__cplusplus) | ||
1080 | int | ||
1081 | yyparse (void) | ||
1082 | #else | ||
1083 | int | ||
1084 | yyparse () | ||
1085 | |||
1086 | #endif | ||
1087 | #endif | ||
1088 | { | ||
1089 | |||
1090 | register int yystate; | ||
1091 | register int yyn; | ||
1092 | int yyresult; | ||
1093 | /* Number of tokens to shift before error messages enabled. */ | ||
1094 | int yyerrstatus; | ||
1095 | /* Look-ahead token as an internal (translated) token number. */ | ||
1096 | int yytoken = 0; | ||
1097 | |||
1098 | /* Three stacks and their tools: | ||
1099 | `yyss': related to states, | ||
1100 | `yyvs': related to semantic values, | ||
1101 | `yyls': related to locations. | ||
1102 | |||
1103 | Refer to the stacks thru separate pointers, to allow yyoverflow | ||
1104 | to reallocate them elsewhere. */ | ||
1105 | |||
1106 | /* The state stack. */ | ||
1107 | short int yyssa[YYINITDEPTH]; | ||
1108 | short int *yyss = yyssa; | ||
1109 | register short int *yyssp; | ||
1110 | |||
1111 | /* The semantic value stack. */ | ||
1112 | YYSTYPE yyvsa[YYINITDEPTH]; | ||
1113 | YYSTYPE *yyvs = yyvsa; | ||
1114 | register YYSTYPE *yyvsp; | ||
1115 | |||
1116 | |||
1117 | |||
1118 | #define YYPOPSTACK (yyvsp--, yyssp--) | ||
1119 | |||
1120 | YYSIZE_T yystacksize = YYINITDEPTH; | ||
1121 | |||
1122 | /* The variables used to return semantic value and location from the | ||
1123 | action routines. */ | ||
1124 | YYSTYPE yyval; | ||
1125 | |||
1126 | |||
1127 | /* When reducing, the number of symbols on the RHS of the reduced | ||
1128 | rule. */ | ||
1129 | int yylen; | ||
1130 | |||
1131 | YYDPRINTF ((stderr, "Starting parse\n")); | ||
1132 | |||
1133 | yystate = 0; | ||
1134 | yyerrstatus = 0; | ||
1135 | yynerrs = 0; | ||
1136 | yychar = YYEMPTY; /* Cause a token to be read. */ | ||
1137 | |||
1138 | /* Initialize stack pointers. | ||
1139 | Waste one element of value and location stack | ||
1140 | so that they stay on the same level as the state stack. | ||
1141 | The wasted elements are never initialized. */ | ||
1142 | |||
1143 | yyssp = yyss; | ||
1144 | yyvsp = yyvs; | ||
1145 | |||
1146 | |||
1147 | yyvsp[0] = yylval; | ||
1148 | |||
1149 | goto yysetstate; | ||
1150 | |||
1151 | /*------------------------------------------------------------. | ||
1152 | | yynewstate -- Push a new state, which is found in yystate. | | ||
1153 | `------------------------------------------------------------*/ | ||
1154 | yynewstate: | ||
1155 | /* In all cases, when you get here, the value and location stacks | ||
1156 | have just been pushed. so pushing a state here evens the stacks. | ||
1157 | */ | ||
1158 | yyssp++; | ||
1159 | |||
1160 | yysetstate: | ||
1161 | *yyssp = yystate; | ||
1162 | |||
1163 | if (yyss + yystacksize - 1 <= yyssp) | ||
1164 | { | ||
1165 | /* Get the current used size of the three stacks, in elements. */ | ||
1166 | YYSIZE_T yysize = yyssp - yyss + 1; | ||
1167 | |||
1168 | #ifdef yyoverflow | ||
1169 | { | ||
1170 | /* Give user a chance to reallocate the stack. Use copies of | ||
1171 | these so that the &'s don't force the real ones into | ||
1172 | memory. */ | ||
1173 | YYSTYPE *yyvs1 = yyvs; | ||
1174 | short int *yyss1 = yyss; | ||
1175 | |||
1176 | |||
1177 | /* Each stack pointer address is followed by the size of the | ||
1178 | data in use in that stack, in bytes. This used to be a | ||
1179 | conditional around just the two extra args, but that might | ||
1180 | be undefined if yyoverflow is a macro. */ | ||
1181 | yyoverflow ("parser stack overflow", | ||
1182 | &yyss1, yysize * sizeof (*yyssp), | ||
1183 | &yyvs1, yysize * sizeof (*yyvsp), | ||
1184 | |||
1185 | &yystacksize); | ||
1186 | |||
1187 | yyss = yyss1; | ||
1188 | yyvs = yyvs1; | ||
1189 | } | ||
1190 | #else /* no yyoverflow */ | ||
1191 | # ifndef YYSTACK_RELOCATE | ||
1192 | goto yyoverflowlab; | ||
1193 | # else | ||
1194 | /* Extend the stack our own way. */ | ||
1195 | if (YYMAXDEPTH <= yystacksize) | ||
1196 | goto yyoverflowlab; | ||
1197 | yystacksize *= 2; | ||
1198 | if (YYMAXDEPTH < yystacksize) | ||
1199 | yystacksize = YYMAXDEPTH; | ||
1200 | |||
1201 | { | ||
1202 | short int *yyss1 = yyss; | ||
1203 | union yyalloc *yyptr = | ||
1204 | (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); | ||
1205 | if (! yyptr) | ||
1206 | goto yyoverflowlab; | ||
1207 | YYSTACK_RELOCATE (yyss); | ||
1208 | YYSTACK_RELOCATE (yyvs); | ||
1209 | |||
1210 | # undef YYSTACK_RELOCATE | ||
1211 | if (yyss1 != yyssa) | ||
1212 | YYSTACK_FREE (yyss1); | ||
1213 | } | ||
1214 | # endif | ||
1215 | #endif /* no yyoverflow */ | ||
1216 | |||
1217 | yyssp = yyss + yysize - 1; | ||
1218 | yyvsp = yyvs + yysize - 1; | ||
1219 | |||
1220 | |||
1221 | YYDPRINTF ((stderr, "Stack size increased to %lu\n", | ||
1222 | (unsigned long int) yystacksize)); | ||
1223 | |||
1224 | if (yyss + yystacksize - 1 <= yyssp) | ||
1225 | YYABORT; | ||
1226 | } | ||
1227 | |||
1228 | YYDPRINTF ((stderr, "Entering state %d\n", yystate)); | ||
1229 | |||
1230 | goto yybackup; | ||
1231 | |||
1232 | /*-----------. | ||
1233 | | yybackup. | | ||
1234 | `-----------*/ | ||
1235 | yybackup: | ||
1236 | |||
1237 | /* Do appropriate processing given the current state. */ | ||
1238 | /* Read a look-ahead token if we need one and don't already have one. */ | ||
1239 | /* yyresume: */ | ||
1240 | |||
1241 | /* First try to decide what to do without reference to look-ahead token. */ | ||
1242 | |||
1243 | yyn = yypact[yystate]; | ||
1244 | if (yyn == YYPACT_NINF) | ||
1245 | goto yydefault; | ||
1246 | |||
1247 | /* Not known => get a look-ahead token if don't already have one. */ | ||
1248 | |||
1249 | /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */ | ||
1250 | if (yychar == YYEMPTY) | ||
1251 | { | ||
1252 | YYDPRINTF ((stderr, "Reading a token: ")); | ||
1253 | yychar = YYLEX; | ||
1254 | } | ||
1255 | |||
1256 | if (yychar <= YYEOF) | ||
1257 | { | ||
1258 | yychar = yytoken = YYEOF; | ||
1259 | YYDPRINTF ((stderr, "Now at end of input.\n")); | ||
1260 | } | ||
1261 | else | ||
1262 | { | ||
1263 | yytoken = YYTRANSLATE (yychar); | ||
1264 | YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc); | ||
1265 | } | ||
1266 | |||
1267 | /* If the proper action on seeing token YYTOKEN is to reduce or to | ||
1268 | detect an error, take that action. */ | ||
1269 | yyn += yytoken; | ||
1270 | if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken) | ||
1271 | goto yydefault; | ||
1272 | yyn = yytable[yyn]; | ||
1273 | if (yyn <= 0) | ||
1274 | { | ||
1275 | if (yyn == 0 || yyn == YYTABLE_NINF) | ||
1276 | goto yyerrlab; | ||
1277 | yyn = -yyn; | ||
1278 | goto yyreduce; | ||
1279 | } | ||
1280 | |||
1281 | if (yyn == YYFINAL) | ||
1282 | YYACCEPT; | ||
1283 | |||
1284 | /* Shift the look-ahead token. */ | ||
1285 | YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); | ||
1286 | |||
1287 | /* Discard the token being shifted unless it is eof. */ | ||
1288 | if (yychar != YYEOF) | ||
1289 | yychar = YYEMPTY; | ||
1290 | |||
1291 | *++yyvsp = yylval; | ||
1292 | |||
1293 | |||
1294 | /* Count tokens shifted since error; after three, turn off error | ||
1295 | status. */ | ||
1296 | if (yyerrstatus) | ||
1297 | yyerrstatus--; | ||
1298 | |||
1299 | yystate = yyn; | ||
1300 | goto yynewstate; | ||
1301 | |||
1302 | |||
1303 | /*-----------------------------------------------------------. | ||
1304 | | yydefault -- do the default action for the current state. | | ||
1305 | `-----------------------------------------------------------*/ | ||
1306 | yydefault: | ||
1307 | yyn = yydefact[yystate]; | ||
1308 | if (yyn == 0) | ||
1309 | goto yyerrlab; | ||
1310 | goto yyreduce; | ||
1311 | |||
1312 | |||
1313 | /*-----------------------------. | ||
1314 | | yyreduce -- Do a reduction. | | ||
1315 | `-----------------------------*/ | ||
1316 | yyreduce: | ||
1317 | /* yyn is the number of a rule to reduce with. */ | ||
1318 | yylen = yyr2[yyn]; | ||
1319 | |||
1320 | /* If YYLEN is nonzero, implement the default value of the action: | ||
1321 | `$$ = $1'. | ||
1322 | |||
1323 | Otherwise, the following line sets YYVAL to garbage. | ||
1324 | This behavior is undocumented and Bison | ||
1325 | users should not rely upon it. Assigning to YYVAL | ||
1326 | unconditionally makes the parser a bit smaller, and it avoids a | ||
1327 | GCC warning that YYVAL may be used uninitialized. */ | ||
1328 | yyval = yyvsp[1-yylen]; | ||
1329 | |||
1330 | |||
1331 | YY_REDUCE_PRINT (yyn); | ||
1332 | switch (yyn) | ||
1333 | { | ||
1334 | case 8: | ||
1335 | |||
1336 | { zconf_error("unexpected end statement"); ;} | ||
1337 | break; | ||
1338 | |||
1339 | case 9: | ||
1340 | |||
1341 | { zconf_error("unknown statement \"%s\"", (yyvsp[-2].string)); ;} | ||
1342 | break; | ||
1343 | |||
1344 | case 10: | ||
1345 | |||
1346 | { | ||
1347 | zconf_error("unexpected option \"%s\"", kconf_id_strings + (yyvsp[-2].id)->name); | ||
1348 | ;} | ||
1349 | break; | ||
1350 | |||
1351 | case 11: | ||
1352 | |||
1353 | { zconf_error("invalid statement"); ;} | ||
1354 | break; | ||
1355 | |||
1356 | case 25: | ||
1357 | |||
1358 | { zconf_error("unknown option \"%s\"", (yyvsp[-2].string)); ;} | ||
1359 | break; | ||
1360 | |||
1361 | case 26: | ||
1362 | |||
1363 | { zconf_error("invalid option"); ;} | ||
1364 | break; | ||
1365 | |||
1366 | case 27: | ||
1367 | |||
1368 | { | ||
1369 | struct symbol *sym = sym_lookup((yyvsp[-1].string), 0); | ||
1370 | sym->flags |= SYMBOL_OPTIONAL; | ||
1371 | menu_add_entry(sym); | ||
1372 | printd(DEBUG_PARSE, "%s:%d:config %s\n", zconf_curname(), zconf_lineno(), (yyvsp[-1].string)); | ||
1373 | ;} | ||
1374 | break; | ||
1375 | |||
1376 | case 28: | ||
1377 | |||
1378 | { | ||
1379 | menu_end_entry(); | ||
1380 | printd(DEBUG_PARSE, "%s:%d:endconfig\n", zconf_curname(), zconf_lineno()); | ||
1381 | ;} | ||
1382 | break; | ||
1383 | |||
1384 | case 29: | ||
1385 | |||
1386 | { | ||
1387 | struct symbol *sym = sym_lookup((yyvsp[-1].string), 0); | ||
1388 | sym->flags |= SYMBOL_OPTIONAL; | ||
1389 | menu_add_entry(sym); | ||
1390 | printd(DEBUG_PARSE, "%s:%d:menuconfig %s\n", zconf_curname(), zconf_lineno(), (yyvsp[-1].string)); | ||
1391 | ;} | ||
1392 | break; | ||
1393 | |||
1394 | case 30: | ||
1395 | |||
1396 | { | ||
1397 | if (current_entry->prompt) | ||
1398 | current_entry->prompt->type = P_MENU; | ||
1399 | else | ||
1400 | zconfprint("warning: menuconfig statement without prompt"); | ||
1401 | menu_end_entry(); | ||
1402 | printd(DEBUG_PARSE, "%s:%d:endconfig\n", zconf_curname(), zconf_lineno()); | ||
1403 | ;} | ||
1404 | break; | ||
1405 | |||
1406 | case 37: | ||
1407 | |||
1408 | { | ||
1409 | menu_set_type((yyvsp[-2].id)->stype); | ||
1410 | printd(DEBUG_PARSE, "%s:%d:type(%u)\n", | ||
1411 | zconf_curname(), zconf_lineno(), | ||
1412 | (yyvsp[-2].id)->stype); | ||
1413 | ;} | ||
1414 | break; | ||
1415 | |||
1416 | case 38: | ||
1417 | |||
1418 | { | ||
1419 | menu_add_prompt(P_PROMPT, (yyvsp[-2].string), (yyvsp[-1].expr)); | ||
1420 | printd(DEBUG_PARSE, "%s:%d:prompt\n", zconf_curname(), zconf_lineno()); | ||
1421 | ;} | ||
1422 | break; | ||
1423 | |||
1424 | case 39: | ||
1425 | |||
1426 | { | ||
1427 | menu_add_expr(P_DEFAULT, (yyvsp[-2].expr), (yyvsp[-1].expr)); | ||
1428 | if ((yyvsp[-3].id)->stype != S_UNKNOWN) | ||
1429 | menu_set_type((yyvsp[-3].id)->stype); | ||
1430 | printd(DEBUG_PARSE, "%s:%d:default(%u)\n", | ||
1431 | zconf_curname(), zconf_lineno(), | ||
1432 | (yyvsp[-3].id)->stype); | ||
1433 | ;} | ||
1434 | break; | ||
1435 | |||
1436 | case 40: | ||
1437 | |||
1438 | { | ||
1439 | menu_add_symbol(P_SELECT, sym_lookup((yyvsp[-2].string), 0), (yyvsp[-1].expr)); | ||
1440 | printd(DEBUG_PARSE, "%s:%d:select\n", zconf_curname(), zconf_lineno()); | ||
1441 | ;} | ||
1442 | break; | ||
1443 | |||
1444 | case 41: | ||
1445 | |||
1446 | { | ||
1447 | menu_add_expr(P_RANGE, expr_alloc_comp(E_RANGE,(yyvsp[-3].symbol), (yyvsp[-2].symbol)), (yyvsp[-1].expr)); | ||
1448 | printd(DEBUG_PARSE, "%s:%d:range\n", zconf_curname(), zconf_lineno()); | ||
1449 | ;} | ||
1450 | break; | ||
1451 | |||
1452 | case 42: | ||
1453 | |||
1454 | { | ||
1455 | struct symbol *sym = sym_lookup(NULL, 0); | ||
1456 | sym->flags |= SYMBOL_CHOICE; | ||
1457 | menu_add_entry(sym); | ||
1458 | menu_add_expr(P_CHOICE, NULL, NULL); | ||
1459 | printd(DEBUG_PARSE, "%s:%d:choice\n", zconf_curname(), zconf_lineno()); | ||
1460 | ;} | ||
1461 | break; | ||
1462 | |||
1463 | case 43: | ||
1464 | |||
1465 | { | ||
1466 | (yyval.menu) = menu_add_menu(); | ||
1467 | ;} | ||
1468 | break; | ||
1469 | |||
1470 | case 44: | ||
1471 | |||
1472 | { | ||
1473 | if (zconf_endtoken((yyvsp[0].id), T_CHOICE, T_ENDCHOICE)) { | ||
1474 | menu_end_menu(); | ||
1475 | printd(DEBUG_PARSE, "%s:%d:endchoice\n", zconf_curname(), zconf_lineno()); | ||
1476 | } | ||
1477 | ;} | ||
1478 | break; | ||
1479 | |||
1480 | case 52: | ||
1481 | |||
1482 | { | ||
1483 | menu_add_prompt(P_PROMPT, (yyvsp[-2].string), (yyvsp[-1].expr)); | ||
1484 | printd(DEBUG_PARSE, "%s:%d:prompt\n", zconf_curname(), zconf_lineno()); | ||
1485 | ;} | ||
1486 | break; | ||
1487 | |||
1488 | case 53: | ||
1489 | |||
1490 | { | ||
1491 | if ((yyvsp[-2].id)->stype == S_BOOLEAN || (yyvsp[-2].id)->stype == S_TRISTATE) { | ||
1492 | menu_set_type((yyvsp[-2].id)->stype); | ||
1493 | printd(DEBUG_PARSE, "%s:%d:type(%u)\n", | ||
1494 | zconf_curname(), zconf_lineno(), | ||
1495 | (yyvsp[-2].id)->stype); | ||
1496 | } else | ||
1497 | YYERROR; | ||
1498 | ;} | ||
1499 | break; | ||
1500 | |||
1501 | case 54: | ||
1502 | |||
1503 | { | ||
1504 | current_entry->sym->flags |= SYMBOL_OPTIONAL; | ||
1505 | printd(DEBUG_PARSE, "%s:%d:optional\n", zconf_curname(), zconf_lineno()); | ||
1506 | ;} | ||
1507 | break; | ||
1508 | |||
1509 | case 55: | ||
1510 | |||
1511 | { | ||
1512 | if ((yyvsp[-3].id)->stype == S_UNKNOWN) { | ||
1513 | menu_add_symbol(P_DEFAULT, sym_lookup((yyvsp[-2].string), 0), (yyvsp[-1].expr)); | ||
1514 | printd(DEBUG_PARSE, "%s:%d:default\n", | ||
1515 | zconf_curname(), zconf_lineno()); | ||
1516 | } else | ||
1517 | YYERROR; | ||
1518 | ;} | ||
1519 | break; | ||
1520 | |||
1521 | case 58: | ||
1522 | |||
1523 | { | ||
1524 | printd(DEBUG_PARSE, "%s:%d:if\n", zconf_curname(), zconf_lineno()); | ||
1525 | menu_add_entry(NULL); | ||
1526 | menu_add_dep((yyvsp[-1].expr)); | ||
1527 | (yyval.menu) = menu_add_menu(); | ||
1528 | ;} | ||
1529 | break; | ||
1530 | |||
1531 | case 59: | ||
1532 | |||
1533 | { | ||
1534 | if (zconf_endtoken((yyvsp[0].id), T_IF, T_ENDIF)) { | ||
1535 | menu_end_menu(); | ||
1536 | printd(DEBUG_PARSE, "%s:%d:endif\n", zconf_curname(), zconf_lineno()); | ||
1537 | } | ||
1538 | ;} | ||
1539 | break; | ||
1540 | |||
1541 | case 65: | ||
1542 | |||
1543 | { | ||
1544 | menu_add_entry(NULL); | ||
1545 | menu_add_prompt(P_MENU, (yyvsp[-1].string), NULL); | ||
1546 | printd(DEBUG_PARSE, "%s:%d:menu\n", zconf_curname(), zconf_lineno()); | ||
1547 | ;} | ||
1548 | break; | ||
1549 | |||
1550 | case 66: | ||
1551 | |||
1552 | { | ||
1553 | (yyval.menu) = menu_add_menu(); | ||
1554 | ;} | ||
1555 | break; | ||
1556 | |||
1557 | case 67: | ||
1558 | |||
1559 | { | ||
1560 | if (zconf_endtoken((yyvsp[0].id), T_MENU, T_ENDMENU)) { | ||
1561 | menu_end_menu(); | ||
1562 | printd(DEBUG_PARSE, "%s:%d:endmenu\n", zconf_curname(), zconf_lineno()); | ||
1563 | } | ||
1564 | ;} | ||
1565 | break; | ||
1566 | |||
1567 | case 73: | ||
1568 | |||
1569 | { | ||
1570 | printd(DEBUG_PARSE, "%s:%d:source %s\n", zconf_curname(), zconf_lineno(), (yyvsp[-1].string)); | ||
1571 | zconf_nextfile((yyvsp[-1].string)); | ||
1572 | ;} | ||
1573 | break; | ||
1574 | |||
1575 | case 74: | ||
1576 | |||
1577 | { | ||
1578 | menu_add_entry(NULL); | ||
1579 | menu_add_prompt(P_COMMENT, (yyvsp[-1].string), NULL); | ||
1580 | printd(DEBUG_PARSE, "%s:%d:comment\n", zconf_curname(), zconf_lineno()); | ||
1581 | ;} | ||
1582 | break; | ||
1583 | |||
1584 | case 75: | ||
1585 | |||
1586 | { | ||
1587 | menu_end_entry(); | ||
1588 | ;} | ||
1589 | break; | ||
1590 | |||
1591 | case 76: | ||
1592 | |||
1593 | { | ||
1594 | printd(DEBUG_PARSE, "%s:%d:help\n", zconf_curname(), zconf_lineno()); | ||
1595 | zconf_starthelp(); | ||
1596 | ;} | ||
1597 | break; | ||
1598 | |||
1599 | case 77: | ||
1600 | |||
1601 | { | ||
1602 | current_entry->sym->help = (yyvsp[0].string); | ||
1603 | ;} | ||
1604 | break; | ||
1605 | |||
1606 | case 82: | ||
1607 | |||
1608 | { | ||
1609 | menu_add_dep((yyvsp[-1].expr)); | ||
1610 | printd(DEBUG_PARSE, "%s:%d:depends on\n", zconf_curname(), zconf_lineno()); | ||
1611 | ;} | ||
1612 | break; | ||
1613 | |||
1614 | case 83: | ||
1615 | |||
1616 | { | ||
1617 | menu_add_dep((yyvsp[-1].expr)); | ||
1618 | printd(DEBUG_PARSE, "%s:%d:depends\n", zconf_curname(), zconf_lineno()); | ||
1619 | ;} | ||
1620 | break; | ||
1621 | |||
1622 | case 84: | ||
1623 | |||
1624 | { | ||
1625 | menu_add_dep((yyvsp[-1].expr)); | ||
1626 | printd(DEBUG_PARSE, "%s:%d:requires\n", zconf_curname(), zconf_lineno()); | ||
1627 | ;} | ||
1628 | break; | ||
1629 | |||
1630 | case 86: | ||
1631 | |||
1632 | { | ||
1633 | menu_add_prompt(P_PROMPT, (yyvsp[-1].string), (yyvsp[0].expr)); | ||
1634 | ;} | ||
1635 | break; | ||
1636 | |||
1637 | case 89: | ||
1638 | |||
1639 | { (yyval.id) = (yyvsp[-1].id); ;} | ||
1640 | break; | ||
1641 | |||
1642 | case 90: | ||
1643 | |||
1644 | { (yyval.id) = (yyvsp[-1].id); ;} | ||
1645 | break; | ||
1646 | |||
1647 | case 91: | ||
1648 | |||
1649 | { (yyval.id) = (yyvsp[-1].id); ;} | ||
1650 | break; | ||
1651 | |||
1652 | case 94: | ||
1653 | |||
1654 | { (yyval.expr) = NULL; ;} | ||
1655 | break; | ||
1656 | |||
1657 | case 95: | ||
1658 | |||
1659 | { (yyval.expr) = (yyvsp[0].expr); ;} | ||
1660 | break; | ||
1661 | |||
1662 | case 96: | ||
1663 | |||
1664 | { (yyval.expr) = expr_alloc_symbol((yyvsp[0].symbol)); ;} | ||
1665 | break; | ||
1666 | |||
1667 | case 97: | ||
1668 | |||
1669 | { (yyval.expr) = expr_alloc_comp(E_EQUAL, (yyvsp[-2].symbol), (yyvsp[0].symbol)); ;} | ||
1670 | break; | ||
1671 | |||
1672 | case 98: | ||
1673 | |||
1674 | { (yyval.expr) = expr_alloc_comp(E_UNEQUAL, (yyvsp[-2].symbol), (yyvsp[0].symbol)); ;} | ||
1675 | break; | ||
1676 | |||
1677 | case 99: | ||
1678 | |||
1679 | { (yyval.expr) = (yyvsp[-1].expr); ;} | ||
1680 | break; | ||
1681 | |||
1682 | case 100: | ||
1683 | |||
1684 | { (yyval.expr) = expr_alloc_one(E_NOT, (yyvsp[0].expr)); ;} | ||
1685 | break; | ||
1686 | |||
1687 | case 101: | ||
1688 | |||
1689 | { (yyval.expr) = expr_alloc_two(E_OR, (yyvsp[-2].expr), (yyvsp[0].expr)); ;} | ||
1690 | break; | ||
1691 | |||
1692 | case 102: | ||
1693 | |||
1694 | { (yyval.expr) = expr_alloc_two(E_AND, (yyvsp[-2].expr), (yyvsp[0].expr)); ;} | ||
1695 | break; | ||
1696 | |||
1697 | case 103: | ||
1698 | |||
1699 | { (yyval.symbol) = sym_lookup((yyvsp[0].string), 0); free((yyvsp[0].string)); ;} | ||
1700 | break; | ||
1701 | |||
1702 | case 104: | ||
1703 | |||
1704 | { (yyval.symbol) = sym_lookup((yyvsp[0].string), 1); free((yyvsp[0].string)); ;} | ||
1705 | break; | ||
1706 | |||
1707 | |||
1708 | } | ||
1709 | |||
1710 | /* Line 1037 of yacc.c. */ | ||
1711 | |||
1712 | |||
1713 | yyvsp -= yylen; | ||
1714 | yyssp -= yylen; | ||
1715 | |||
1716 | |||
1717 | YY_STACK_PRINT (yyss, yyssp); | ||
1718 | |||
1719 | *++yyvsp = yyval; | ||
1720 | |||
1721 | |||
1722 | /* Now `shift' the result of the reduction. Determine what state | ||
1723 | that goes to, based on the state we popped back to and the rule | ||
1724 | number reduced by. */ | ||
1725 | |||
1726 | yyn = yyr1[yyn]; | ||
1727 | |||
1728 | yystate = yypgoto[yyn - YYNTOKENS] + *yyssp; | ||
1729 | if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp) | ||
1730 | yystate = yytable[yystate]; | ||
1731 | else | ||
1732 | yystate = yydefgoto[yyn - YYNTOKENS]; | ||
1733 | |||
1734 | goto yynewstate; | ||
1735 | |||
1736 | |||
1737 | /*------------------------------------. | ||
1738 | | yyerrlab -- here on detecting error | | ||
1739 | `------------------------------------*/ | ||
1740 | yyerrlab: | ||
1741 | /* If not already recovering from an error, report this error. */ | ||
1742 | if (!yyerrstatus) | ||
1743 | { | ||
1744 | ++yynerrs; | ||
1745 | #if YYERROR_VERBOSE | ||
1746 | yyn = yypact[yystate]; | ||
1747 | |||
1748 | if (YYPACT_NINF < yyn && yyn < YYLAST) | ||
1749 | { | ||
1750 | YYSIZE_T yysize = 0; | ||
1751 | int yytype = YYTRANSLATE (yychar); | ||
1752 | const char* yyprefix; | ||
1753 | char *yymsg; | ||
1754 | int yyx; | ||
1755 | |||
1756 | /* Start YYX at -YYN if negative to avoid negative indexes in | ||
1757 | YYCHECK. */ | ||
1758 | int yyxbegin = yyn < 0 ? -yyn : 0; | ||
1759 | |||
1760 | /* Stay within bounds of both yycheck and yytname. */ | ||
1761 | int yychecklim = YYLAST - yyn; | ||
1762 | int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; | ||
1763 | int yycount = 0; | ||
1764 | |||
1765 | yyprefix = ", expecting "; | ||
1766 | for (yyx = yyxbegin; yyx < yyxend; ++yyx) | ||
1767 | if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR) | ||
1768 | { | ||
1769 | yysize += yystrlen (yyprefix) + yystrlen (yytname [yyx]); | ||
1770 | yycount += 1; | ||
1771 | if (yycount == 5) | ||
1772 | { | ||
1773 | yysize = 0; | ||
1774 | break; | ||
1775 | } | ||
1776 | } | ||
1777 | yysize += (sizeof ("syntax error, unexpected ") | ||
1778 | + yystrlen (yytname[yytype])); | ||
1779 | yymsg = (char *) YYSTACK_ALLOC (yysize); | ||
1780 | if (yymsg != 0) | ||
1781 | { | ||
1782 | char *yyp = yystpcpy (yymsg, "syntax error, unexpected "); | ||
1783 | yyp = yystpcpy (yyp, yytname[yytype]); | ||
1784 | |||
1785 | if (yycount < 5) | ||
1786 | { | ||
1787 | yyprefix = ", expecting "; | ||
1788 | for (yyx = yyxbegin; yyx < yyxend; ++yyx) | ||
1789 | if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR) | ||
1790 | { | ||
1791 | yyp = yystpcpy (yyp, yyprefix); | ||
1792 | yyp = yystpcpy (yyp, yytname[yyx]); | ||
1793 | yyprefix = " or "; | ||
1794 | } | ||
1795 | } | ||
1796 | yyerror (yymsg); | ||
1797 | YYSTACK_FREE (yymsg); | ||
1798 | } | ||
1799 | else | ||
1800 | yyerror ("syntax error; also virtual memory exhausted"); | ||
1801 | } | ||
1802 | else | ||
1803 | #endif /* YYERROR_VERBOSE */ | ||
1804 | yyerror ("syntax error"); | ||
1805 | } | ||
1806 | |||
1807 | |||
1808 | |||
1809 | if (yyerrstatus == 3) | ||
1810 | { | ||
1811 | /* If just tried and failed to reuse look-ahead token after an | ||
1812 | error, discard it. */ | ||
1813 | |||
1814 | if (yychar <= YYEOF) | ||
1815 | { | ||
1816 | /* If at end of input, pop the error token, | ||
1817 | then the rest of the stack, then return failure. */ | ||
1818 | if (yychar == YYEOF) | ||
1819 | for (;;) | ||
1820 | { | ||
1821 | |||
1822 | YYPOPSTACK; | ||
1823 | if (yyssp == yyss) | ||
1824 | YYABORT; | ||
1825 | yydestruct ("Error: popping", | ||
1826 | yystos[*yyssp], yyvsp); | ||
1827 | } | ||
1828 | } | ||
1829 | else | ||
1830 | { | ||
1831 | yydestruct ("Error: discarding", yytoken, &yylval); | ||
1832 | yychar = YYEMPTY; | ||
1833 | } | ||
1834 | } | ||
1835 | |||
1836 | /* Else will try to reuse look-ahead token after shifting the error | ||
1837 | token. */ | ||
1838 | goto yyerrlab1; | ||
1839 | |||
1840 | |||
1841 | /*---------------------------------------------------. | ||
1842 | | yyerrorlab -- error raised explicitly by YYERROR. | | ||
1843 | `---------------------------------------------------*/ | ||
1844 | yyerrorlab: | ||
1845 | |||
1846 | #ifdef __GNUC__ | ||
1847 | /* Pacify GCC when the user code never invokes YYERROR and the label | ||
1848 | yyerrorlab therefore never appears in user code. */ | ||
1849 | if (0) | ||
1850 | goto yyerrorlab; | ||
1851 | #endif | ||
1852 | |||
1853 | yyvsp -= yylen; | ||
1854 | yyssp -= yylen; | ||
1855 | yystate = *yyssp; | ||
1856 | goto yyerrlab1; | ||
1857 | |||
1858 | |||
1859 | /*-------------------------------------------------------------. | ||
1860 | | yyerrlab1 -- common code for both syntax error and YYERROR. | | ||
1861 | `-------------------------------------------------------------*/ | ||
1862 | yyerrlab1: | ||
1863 | yyerrstatus = 3; /* Each real token shifted decrements this. */ | ||
1864 | |||
1865 | for (;;) | ||
1866 | { | ||
1867 | yyn = yypact[yystate]; | ||
1868 | if (yyn != YYPACT_NINF) | ||
1869 | { | ||
1870 | yyn += YYTERROR; | ||
1871 | if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) | ||
1872 | { | ||
1873 | yyn = yytable[yyn]; | ||
1874 | if (0 < yyn) | ||
1875 | break; | ||
1876 | } | ||
1877 | } | ||
1878 | |||
1879 | /* Pop the current state because it cannot handle the error token. */ | ||
1880 | if (yyssp == yyss) | ||
1881 | YYABORT; | ||
1882 | |||
1883 | |||
1884 | yydestruct ("Error: popping", yystos[yystate], yyvsp); | ||
1885 | YYPOPSTACK; | ||
1886 | yystate = *yyssp; | ||
1887 | YY_STACK_PRINT (yyss, yyssp); | ||
1888 | } | ||
1889 | |||
1890 | if (yyn == YYFINAL) | ||
1891 | YYACCEPT; | ||
1892 | |||
1893 | *++yyvsp = yylval; | ||
1894 | |||
1895 | |||
1896 | /* Shift the error token. */ | ||
1897 | YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp); | ||
1898 | |||
1899 | yystate = yyn; | ||
1900 | goto yynewstate; | ||
1901 | |||
1902 | |||
1903 | /*-------------------------------------. | ||
1904 | | yyacceptlab -- YYACCEPT comes here. | | ||
1905 | `-------------------------------------*/ | ||
1906 | yyacceptlab: | ||
1907 | yyresult = 0; | ||
1908 | goto yyreturn; | ||
1909 | |||
1910 | /*-----------------------------------. | ||
1911 | | yyabortlab -- YYABORT comes here. | | ||
1912 | `-----------------------------------*/ | ||
1913 | yyabortlab: | ||
1914 | yydestruct ("Error: discarding lookahead", | ||
1915 | yytoken, &yylval); | ||
1916 | yychar = YYEMPTY; | ||
1917 | yyresult = 1; | ||
1918 | goto yyreturn; | ||
1919 | |||
1920 | #ifndef yyoverflow | ||
1921 | /*----------------------------------------------. | ||
1922 | | yyoverflowlab -- parser overflow comes here. | | ||
1923 | `----------------------------------------------*/ | ||
1924 | yyoverflowlab: | ||
1925 | yyerror ("parser stack overflow"); | ||
1926 | yyresult = 2; | ||
1927 | /* Fall through. */ | ||
1928 | #endif | ||
1929 | |||
1930 | yyreturn: | ||
1931 | #ifndef yyoverflow | ||
1932 | if (yyss != yyssa) | ||
1933 | YYSTACK_FREE (yyss); | ||
1934 | #endif | ||
1935 | return yyresult; | ||
1936 | } | ||
1937 | |||
1938 | |||
1939 | |||
1940 | |||
1941 | |||
1942 | void conf_parse(const char *name) | ||
1943 | { | ||
1944 | struct symbol *sym; | ||
1945 | int i; | ||
1946 | |||
1947 | zconf_initscan(name); | ||
1948 | |||
1949 | sym_init(); | ||
1950 | menu_init(); | ||
1951 | modules_sym = sym_lookup("MODULES", 0); | ||
1952 | rootmenu.prompt = menu_add_prompt(P_MENU, "Linux Kernel Configuration", NULL); | ||
1953 | |||
1954 | #if YYDEBUG | ||
1955 | if (getenv("ZCONF_DEBUG")) | ||
1956 | zconfdebug = 1; | ||
1957 | #endif | ||
1958 | zconfparse(); | ||
1959 | if (zconfnerrs) | ||
1960 | exit(1); | ||
1961 | menu_finalize(&rootmenu); | ||
1962 | for_all_symbols(i, sym) { | ||
1963 | sym_check_deps(sym); | ||
1964 | } | ||
1965 | |||
1966 | sym_change_count = 1; | ||
1967 | } | ||
1968 | |||
1969 | const char *zconf_tokenname(int token) | ||
1970 | { | ||
1971 | switch (token) { | ||
1972 | case T_MENU: return "menu"; | ||
1973 | case T_ENDMENU: return "endmenu"; | ||
1974 | case T_CHOICE: return "choice"; | ||
1975 | case T_ENDCHOICE: return "endchoice"; | ||
1976 | case T_IF: return "if"; | ||
1977 | case T_ENDIF: return "endif"; | ||
1978 | case T_DEPENDS: return "depends"; | ||
1979 | } | ||
1980 | return "<token>"; | ||
1981 | } | ||
1982 | |||
1983 | static bool zconf_endtoken(struct kconf_id *id, int starttoken, int endtoken) | ||
1984 | { | ||
1985 | if (id->token != endtoken) { | ||
1986 | zconf_error("unexpected '%s' within %s block", | ||
1987 | kconf_id_strings + id->name, zconf_tokenname(starttoken)); | ||
1988 | zconfnerrs++; | ||
1989 | return false; | ||
1990 | } | ||
1991 | if (current_menu->file != current_file) { | ||
1992 | zconf_error("'%s' in different file than '%s'", | ||
1993 | kconf_id_strings + id->name, zconf_tokenname(starttoken)); | ||
1994 | fprintf(stderr, "%s:%d: location of the '%s'\n", | ||
1995 | current_menu->file->name, current_menu->lineno, | ||
1996 | zconf_tokenname(starttoken)); | ||
1997 | zconfnerrs++; | ||
1998 | return false; | ||
1999 | } | ||
2000 | return true; | ||
2001 | } | ||
2002 | |||
2003 | static void zconfprint(const char *err, ...) | ||
2004 | { | ||
2005 | va_list ap; | ||
2006 | |||
2007 | fprintf(stderr, "%s:%d: ", zconf_curname(), zconf_lineno()); | ||
2008 | va_start(ap, err); | ||
2009 | vfprintf(stderr, err, ap); | ||
2010 | va_end(ap); | ||
2011 | fprintf(stderr, "\n"); | ||
2012 | } | ||
2013 | |||
2014 | static void zconf_error(const char *err, ...) | ||
2015 | { | ||
2016 | va_list ap; | ||
2017 | |||
2018 | zconfnerrs++; | ||
2019 | fprintf(stderr, "%s:%d: ", zconf_curname(), zconf_lineno()); | ||
2020 | va_start(ap, err); | ||
2021 | vfprintf(stderr, err, ap); | ||
2022 | va_end(ap); | ||
2023 | fprintf(stderr, "\n"); | ||
2024 | } | ||
2025 | |||
2026 | static void zconferror(const char *err) | ||
2027 | { | ||
2028 | #if YYDEBUG | ||
2029 | fprintf(stderr, "%s:%d: %s\n", zconf_curname(), zconf_lineno() + 1, err); | ||
2030 | #endif | ||
2031 | } | ||
2032 | |||
2033 | void print_quoted_string(FILE *out, const char *str) | ||
2034 | { | ||
2035 | const char *p; | ||
2036 | int len; | ||
2037 | |||
2038 | putc('"', out); | ||
2039 | while ((p = strchr(str, '"'))) { | ||
2040 | len = p - str; | ||
2041 | if (len) | ||
2042 | fprintf(out, "%.*s", len, str); | ||
2043 | fputs("\\\"", out); | ||
2044 | str = p + 1; | ||
2045 | } | ||
2046 | fputs(str, out); | ||
2047 | putc('"', out); | ||
2048 | } | ||
2049 | |||
2050 | void print_symbol(FILE *out, struct menu *menu) | ||
2051 | { | ||
2052 | struct symbol *sym = menu->sym; | ||
2053 | struct property *prop; | ||
2054 | |||
2055 | if (sym_is_choice(sym)) | ||
2056 | fprintf(out, "choice\n"); | ||
2057 | else | ||
2058 | fprintf(out, "config %s\n", sym->name); | ||
2059 | switch (sym->type) { | ||
2060 | case S_BOOLEAN: | ||
2061 | fputs(" boolean\n", out); | ||
2062 | break; | ||
2063 | case S_TRISTATE: | ||
2064 | fputs(" tristate\n", out); | ||
2065 | break; | ||
2066 | case S_STRING: | ||
2067 | fputs(" string\n", out); | ||
2068 | break; | ||
2069 | case S_INT: | ||
2070 | fputs(" integer\n", out); | ||
2071 | break; | ||
2072 | case S_HEX: | ||
2073 | fputs(" hex\n", out); | ||
2074 | break; | ||
2075 | default: | ||
2076 | fputs(" ???\n", out); | ||
2077 | break; | ||
2078 | } | ||
2079 | for (prop = sym->prop; prop; prop = prop->next) { | ||
2080 | if (prop->menu != menu) | ||
2081 | continue; | ||
2082 | switch (prop->type) { | ||
2083 | case P_PROMPT: | ||
2084 | fputs(" prompt ", out); | ||
2085 | print_quoted_string(out, prop->text); | ||
2086 | if (!expr_is_yes(prop->visible.expr)) { | ||
2087 | fputs(" if ", out); | ||
2088 | expr_fprint(prop->visible.expr, out); | ||
2089 | } | ||
2090 | fputc('\n', out); | ||
2091 | break; | ||
2092 | case P_DEFAULT: | ||
2093 | fputs( " default ", out); | ||
2094 | expr_fprint(prop->expr, out); | ||
2095 | if (!expr_is_yes(prop->visible.expr)) { | ||
2096 | fputs(" if ", out); | ||
2097 | expr_fprint(prop->visible.expr, out); | ||
2098 | } | ||
2099 | fputc('\n', out); | ||
2100 | break; | ||
2101 | case P_CHOICE: | ||
2102 | fputs(" #choice value\n", out); | ||
2103 | break; | ||
2104 | default: | ||
2105 | fprintf(out, " unknown prop %d!\n", prop->type); | ||
2106 | break; | ||
2107 | } | ||
2108 | } | ||
2109 | if (sym->help) { | ||
2110 | int len = strlen(sym->help); | ||
2111 | while (sym->help[--len] == '\n') | ||
2112 | sym->help[len] = 0; | ||
2113 | fprintf(out, " help\n%s\n", sym->help); | ||
2114 | } | ||
2115 | fputc('\n', out); | ||
2116 | } | ||
2117 | |||
2118 | void zconfdump(FILE *out) | ||
2119 | { | ||
2120 | struct property *prop; | ||
2121 | struct symbol *sym; | ||
2122 | struct menu *menu; | ||
2123 | |||
2124 | menu = rootmenu.list; | ||
2125 | while (menu) { | ||
2126 | if ((sym = menu->sym)) | ||
2127 | print_symbol(out, menu); | ||
2128 | else if ((prop = menu->prompt)) { | ||
2129 | switch (prop->type) { | ||
2130 | case P_COMMENT: | ||
2131 | fputs("\ncomment ", out); | ||
2132 | print_quoted_string(out, prop->text); | ||
2133 | fputs("\n", out); | ||
2134 | break; | ||
2135 | case P_MENU: | ||
2136 | fputs("\nmenu ", out); | ||
2137 | print_quoted_string(out, prop->text); | ||
2138 | fputs("\n", out); | ||
2139 | break; | ||
2140 | default: | ||
2141 | ; | ||
2142 | } | ||
2143 | if (!expr_is_yes(prop->visible.expr)) { | ||
2144 | fputs(" depends ", out); | ||
2145 | expr_fprint(prop->visible.expr, out); | ||
2146 | fputc('\n', out); | ||
2147 | } | ||
2148 | fputs("\n", out); | ||
2149 | } | ||
2150 | |||
2151 | if (menu->list) | ||
2152 | menu = menu->list; | ||
2153 | else if (menu->next) | ||
2154 | menu = menu->next; | ||
2155 | else while ((menu = menu->parent)) { | ||
2156 | if (menu->prompt && menu->prompt->type == P_MENU) | ||
2157 | fputs("\nendmenu\n", out); | ||
2158 | if (menu->next) { | ||
2159 | menu = menu->next; | ||
2160 | break; | ||
2161 | } | ||
2162 | } | ||
2163 | } | ||
2164 | } | ||
2165 | |||
2166 | #include "lex.zconf.c" | ||
2167 | #include "util.c" | ||
2168 | #include "confdata.c" | ||
2169 | #include "expr.c" | ||
2170 | #include "symbol.c" | ||
2171 | #include "menu.c" | ||
2172 | |||
2173 | |||
diff --git a/scripts/kconfig/zconf.y b/scripts/kconfig/zconf.y new file mode 100644 index 000000000..1f61fba6a --- /dev/null +++ b/scripts/kconfig/zconf.y | |||
@@ -0,0 +1,681 @@ | |||
1 | %{ | ||
2 | /* | ||
3 | * Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org> | ||
4 | * Released under the terms of the GNU GPL v2.0. | ||
5 | */ | ||
6 | |||
7 | #include <ctype.h> | ||
8 | #include <stdarg.h> | ||
9 | #include <stdio.h> | ||
10 | #include <stdlib.h> | ||
11 | #include <string.h> | ||
12 | #include <stdbool.h> | ||
13 | |||
14 | #define LKC_DIRECT_LINK | ||
15 | #include "lkc.h" | ||
16 | |||
17 | #include "zconf.hash.c" | ||
18 | |||
19 | #define printd(mask, fmt...) if (cdebug & (mask)) printf(fmt) | ||
20 | |||
21 | #define PRINTD 0x0001 | ||
22 | #define DEBUG_PARSE 0x0002 | ||
23 | |||
24 | int cdebug = PRINTD; | ||
25 | |||
26 | extern int zconflex(void); | ||
27 | static void zconfprint(const char *err, ...); | ||
28 | static void zconf_error(const char *err, ...); | ||
29 | static void zconferror(const char *err); | ||
30 | static bool zconf_endtoken(struct kconf_id *id, int starttoken, int endtoken); | ||
31 | |||
32 | struct symbol *symbol_hash[257]; | ||
33 | |||
34 | static struct menu *current_menu, *current_entry; | ||
35 | |||
36 | #define YYDEBUG 0 | ||
37 | #if YYDEBUG | ||
38 | #define YYERROR_VERBOSE | ||
39 | #endif | ||
40 | %} | ||
41 | %expect 26 | ||
42 | |||
43 | %union | ||
44 | { | ||
45 | char *string; | ||
46 | struct file *file; | ||
47 | struct symbol *symbol; | ||
48 | struct expr *expr; | ||
49 | struct menu *menu; | ||
50 | struct kconf_id *id; | ||
51 | } | ||
52 | |||
53 | %token <id>T_MAINMENU | ||
54 | %token <id>T_MENU | ||
55 | %token <id>T_ENDMENU | ||
56 | %token <id>T_SOURCE | ||
57 | %token <id>T_CHOICE | ||
58 | %token <id>T_ENDCHOICE | ||
59 | %token <id>T_COMMENT | ||
60 | %token <id>T_CONFIG | ||
61 | %token <id>T_MENUCONFIG | ||
62 | %token <id>T_HELP | ||
63 | %token <string> T_HELPTEXT | ||
64 | %token <id>T_IF | ||
65 | %token <id>T_ENDIF | ||
66 | %token <id>T_DEPENDS | ||
67 | %token <id>T_REQUIRES | ||
68 | %token <id>T_OPTIONAL | ||
69 | %token <id>T_PROMPT | ||
70 | %token <id>T_TYPE | ||
71 | %token <id>T_DEFAULT | ||
72 | %token <id>T_SELECT | ||
73 | %token <id>T_RANGE | ||
74 | %token <id>T_ON | ||
75 | %token <string> T_WORD | ||
76 | %token <string> T_WORD_QUOTE | ||
77 | %token T_UNEQUAL | ||
78 | %token T_CLOSE_PAREN | ||
79 | %token T_OPEN_PAREN | ||
80 | %token T_EOL | ||
81 | |||
82 | %left T_OR | ||
83 | %left T_AND | ||
84 | %left T_EQUAL T_UNEQUAL | ||
85 | %nonassoc T_NOT | ||
86 | |||
87 | %type <string> prompt | ||
88 | %type <symbol> symbol | ||
89 | %type <expr> expr | ||
90 | %type <expr> if_expr | ||
91 | %type <id> end | ||
92 | %type <id> option_name | ||
93 | %type <menu> if_entry menu_entry choice_entry | ||
94 | |||
95 | %destructor { | ||
96 | fprintf(stderr, "%s:%d: missing end statement for this entry\n", | ||
97 | $$->file->name, $$->lineno); | ||
98 | if (current_menu == $$) | ||
99 | menu_end_menu(); | ||
100 | } if_entry menu_entry choice_entry | ||
101 | |||
102 | %% | ||
103 | input: stmt_list; | ||
104 | |||
105 | stmt_list: | ||
106 | /* empty */ | ||
107 | | stmt_list common_stmt | ||
108 | | stmt_list choice_stmt | ||
109 | | stmt_list menu_stmt | ||
110 | | stmt_list T_MAINMENU prompt nl | ||
111 | | stmt_list end { zconf_error("unexpected end statement"); } | ||
112 | | stmt_list T_WORD error T_EOL { zconf_error("unknown statement \"%s\"", $2); } | ||
113 | | stmt_list option_name error T_EOL | ||
114 | { | ||
115 | zconf_error("unexpected option \"%s\"", kconf_id_strings + $2->name); | ||
116 | } | ||
117 | | stmt_list error T_EOL { zconf_error("invalid statement"); } | ||
118 | ; | ||
119 | |||
120 | option_name: | ||
121 | T_DEPENDS | T_PROMPT | T_TYPE | T_SELECT | T_OPTIONAL | T_RANGE | T_DEFAULT | ||
122 | ; | ||
123 | |||
124 | common_stmt: | ||
125 | T_EOL | ||
126 | | if_stmt | ||
127 | | comment_stmt | ||
128 | | config_stmt | ||
129 | | menuconfig_stmt | ||
130 | | source_stmt | ||
131 | ; | ||
132 | |||
133 | option_error: | ||
134 | T_WORD error T_EOL { zconf_error("unknown option \"%s\"", $1); } | ||
135 | | error T_EOL { zconf_error("invalid option"); } | ||
136 | ; | ||
137 | |||
138 | |||
139 | /* config/menuconfig entry */ | ||
140 | |||
141 | config_entry_start: T_CONFIG T_WORD T_EOL | ||
142 | { | ||
143 | struct symbol *sym = sym_lookup($2, 0); | ||
144 | sym->flags |= SYMBOL_OPTIONAL; | ||
145 | menu_add_entry(sym); | ||
146 | printd(DEBUG_PARSE, "%s:%d:config %s\n", zconf_curname(), zconf_lineno(), $2); | ||
147 | }; | ||
148 | |||
149 | config_stmt: config_entry_start config_option_list | ||
150 | { | ||
151 | menu_end_entry(); | ||
152 | printd(DEBUG_PARSE, "%s:%d:endconfig\n", zconf_curname(), zconf_lineno()); | ||
153 | }; | ||
154 | |||
155 | menuconfig_entry_start: T_MENUCONFIG T_WORD T_EOL | ||
156 | { | ||
157 | struct symbol *sym = sym_lookup($2, 0); | ||
158 | sym->flags |= SYMBOL_OPTIONAL; | ||
159 | menu_add_entry(sym); | ||
160 | printd(DEBUG_PARSE, "%s:%d:menuconfig %s\n", zconf_curname(), zconf_lineno(), $2); | ||
161 | }; | ||
162 | |||
163 | menuconfig_stmt: menuconfig_entry_start config_option_list | ||
164 | { | ||
165 | if (current_entry->prompt) | ||
166 | current_entry->prompt->type = P_MENU; | ||
167 | else | ||
168 | zconfprint("warning: menuconfig statement without prompt"); | ||
169 | menu_end_entry(); | ||
170 | printd(DEBUG_PARSE, "%s:%d:endconfig\n", zconf_curname(), zconf_lineno()); | ||
171 | }; | ||
172 | |||
173 | config_option_list: | ||
174 | /* empty */ | ||
175 | | config_option_list config_option | ||
176 | | config_option_list depends | ||
177 | | config_option_list help | ||
178 | | config_option_list option_error | ||
179 | | config_option_list T_EOL | ||
180 | ; | ||
181 | |||
182 | config_option: T_TYPE prompt_stmt_opt T_EOL | ||
183 | { | ||
184 | menu_set_type($1->stype); | ||
185 | printd(DEBUG_PARSE, "%s:%d:type(%u)\n", | ||
186 | zconf_curname(), zconf_lineno(), | ||
187 | $1->stype); | ||
188 | }; | ||
189 | |||
190 | config_option: T_PROMPT prompt if_expr T_EOL | ||
191 | { | ||
192 | menu_add_prompt(P_PROMPT, $2, $3); | ||
193 | printd(DEBUG_PARSE, "%s:%d:prompt\n", zconf_curname(), zconf_lineno()); | ||
194 | }; | ||
195 | |||
196 | config_option: T_DEFAULT expr if_expr T_EOL | ||
197 | { | ||
198 | menu_add_expr(P_DEFAULT, $2, $3); | ||
199 | if ($1->stype != S_UNKNOWN) | ||
200 | menu_set_type($1->stype); | ||
201 | printd(DEBUG_PARSE, "%s:%d:default(%u)\n", | ||
202 | zconf_curname(), zconf_lineno(), | ||
203 | $1->stype); | ||
204 | }; | ||
205 | |||
206 | config_option: T_SELECT T_WORD if_expr T_EOL | ||
207 | { | ||
208 | menu_add_symbol(P_SELECT, sym_lookup($2, 0), $3); | ||
209 | printd(DEBUG_PARSE, "%s:%d:select\n", zconf_curname(), zconf_lineno()); | ||
210 | }; | ||
211 | |||
212 | config_option: T_RANGE symbol symbol if_expr T_EOL | ||
213 | { | ||
214 | menu_add_expr(P_RANGE, expr_alloc_comp(E_RANGE,$2, $3), $4); | ||
215 | printd(DEBUG_PARSE, "%s:%d:range\n", zconf_curname(), zconf_lineno()); | ||
216 | }; | ||
217 | |||
218 | /* choice entry */ | ||
219 | |||
220 | choice: T_CHOICE T_EOL | ||
221 | { | ||
222 | struct symbol *sym = sym_lookup(NULL, 0); | ||
223 | sym->flags |= SYMBOL_CHOICE; | ||
224 | menu_add_entry(sym); | ||
225 | menu_add_expr(P_CHOICE, NULL, NULL); | ||
226 | printd(DEBUG_PARSE, "%s:%d:choice\n", zconf_curname(), zconf_lineno()); | ||
227 | }; | ||
228 | |||
229 | choice_entry: choice choice_option_list | ||
230 | { | ||
231 | $$ = menu_add_menu(); | ||
232 | }; | ||
233 | |||
234 | choice_end: end | ||
235 | { | ||
236 | if (zconf_endtoken($1, T_CHOICE, T_ENDCHOICE)) { | ||
237 | menu_end_menu(); | ||
238 | printd(DEBUG_PARSE, "%s:%d:endchoice\n", zconf_curname(), zconf_lineno()); | ||
239 | } | ||
240 | }; | ||
241 | |||
242 | choice_stmt: choice_entry choice_block choice_end | ||
243 | ; | ||
244 | |||
245 | choice_option_list: | ||
246 | /* empty */ | ||
247 | | choice_option_list choice_option | ||
248 | | choice_option_list depends | ||
249 | | choice_option_list help | ||
250 | | choice_option_list T_EOL | ||
251 | | choice_option_list option_error | ||
252 | ; | ||
253 | |||
254 | choice_option: T_PROMPT prompt if_expr T_EOL | ||
255 | { | ||
256 | menu_add_prompt(P_PROMPT, $2, $3); | ||
257 | printd(DEBUG_PARSE, "%s:%d:prompt\n", zconf_curname(), zconf_lineno()); | ||
258 | }; | ||
259 | |||
260 | choice_option: T_TYPE prompt_stmt_opt T_EOL | ||
261 | { | ||
262 | if ($1->stype == S_BOOLEAN || $1->stype == S_TRISTATE) { | ||
263 | menu_set_type($1->stype); | ||
264 | printd(DEBUG_PARSE, "%s:%d:type(%u)\n", | ||
265 | zconf_curname(), zconf_lineno(), | ||
266 | $1->stype); | ||
267 | } else | ||
268 | YYERROR; | ||
269 | }; | ||
270 | |||
271 | choice_option: T_OPTIONAL T_EOL | ||
272 | { | ||
273 | current_entry->sym->flags |= SYMBOL_OPTIONAL; | ||
274 | printd(DEBUG_PARSE, "%s:%d:optional\n", zconf_curname(), zconf_lineno()); | ||
275 | }; | ||
276 | |||
277 | choice_option: T_DEFAULT T_WORD if_expr T_EOL | ||
278 | { | ||
279 | if ($1->stype == S_UNKNOWN) { | ||
280 | menu_add_symbol(P_DEFAULT, sym_lookup($2, 0), $3); | ||
281 | printd(DEBUG_PARSE, "%s:%d:default\n", | ||
282 | zconf_curname(), zconf_lineno()); | ||
283 | } else | ||
284 | YYERROR; | ||
285 | }; | ||
286 | |||
287 | choice_block: | ||
288 | /* empty */ | ||
289 | | choice_block common_stmt | ||
290 | ; | ||
291 | |||
292 | /* if entry */ | ||
293 | |||
294 | if_entry: T_IF expr nl | ||
295 | { | ||
296 | printd(DEBUG_PARSE, "%s:%d:if\n", zconf_curname(), zconf_lineno()); | ||
297 | menu_add_entry(NULL); | ||
298 | menu_add_dep($2); | ||
299 | $$ = menu_add_menu(); | ||
300 | }; | ||
301 | |||
302 | if_end: end | ||
303 | { | ||
304 | if (zconf_endtoken($1, T_IF, T_ENDIF)) { | ||
305 | menu_end_menu(); | ||
306 | printd(DEBUG_PARSE, "%s:%d:endif\n", zconf_curname(), zconf_lineno()); | ||
307 | } | ||
308 | }; | ||
309 | |||
310 | if_stmt: if_entry if_block if_end | ||
311 | ; | ||
312 | |||
313 | if_block: | ||
314 | /* empty */ | ||
315 | | if_block common_stmt | ||
316 | | if_block menu_stmt | ||
317 | | if_block choice_stmt | ||
318 | ; | ||
319 | |||
320 | /* menu entry */ | ||
321 | |||
322 | menu: T_MENU prompt T_EOL | ||
323 | { | ||
324 | menu_add_entry(NULL); | ||
325 | menu_add_prompt(P_MENU, $2, NULL); | ||
326 | printd(DEBUG_PARSE, "%s:%d:menu\n", zconf_curname(), zconf_lineno()); | ||
327 | }; | ||
328 | |||
329 | menu_entry: menu depends_list | ||
330 | { | ||
331 | $$ = menu_add_menu(); | ||
332 | }; | ||
333 | |||
334 | menu_end: end | ||
335 | { | ||
336 | if (zconf_endtoken($1, T_MENU, T_ENDMENU)) { | ||
337 | menu_end_menu(); | ||
338 | printd(DEBUG_PARSE, "%s:%d:endmenu\n", zconf_curname(), zconf_lineno()); | ||
339 | } | ||
340 | }; | ||
341 | |||
342 | menu_stmt: menu_entry menu_block menu_end | ||
343 | ; | ||
344 | |||
345 | menu_block: | ||
346 | /* empty */ | ||
347 | | menu_block common_stmt | ||
348 | | menu_block menu_stmt | ||
349 | | menu_block choice_stmt | ||
350 | ; | ||
351 | |||
352 | source_stmt: T_SOURCE prompt T_EOL | ||
353 | { | ||
354 | printd(DEBUG_PARSE, "%s:%d:source %s\n", zconf_curname(), zconf_lineno(), $2); | ||
355 | zconf_nextfile($2); | ||
356 | }; | ||
357 | |||
358 | /* comment entry */ | ||
359 | |||
360 | comment: T_COMMENT prompt T_EOL | ||
361 | { | ||
362 | menu_add_entry(NULL); | ||
363 | menu_add_prompt(P_COMMENT, $2, NULL); | ||
364 | printd(DEBUG_PARSE, "%s:%d:comment\n", zconf_curname(), zconf_lineno()); | ||
365 | }; | ||
366 | |||
367 | comment_stmt: comment depends_list | ||
368 | { | ||
369 | menu_end_entry(); | ||
370 | }; | ||
371 | |||
372 | /* help option */ | ||
373 | |||
374 | help_start: T_HELP T_EOL | ||
375 | { | ||
376 | printd(DEBUG_PARSE, "%s:%d:help\n", zconf_curname(), zconf_lineno()); | ||
377 | zconf_starthelp(); | ||
378 | }; | ||
379 | |||
380 | help: help_start T_HELPTEXT | ||
381 | { | ||
382 | current_entry->sym->help = $2; | ||
383 | }; | ||
384 | |||
385 | /* depends option */ | ||
386 | |||
387 | depends_list: | ||
388 | /* empty */ | ||
389 | | depends_list depends | ||
390 | | depends_list T_EOL | ||
391 | | depends_list option_error | ||
392 | ; | ||
393 | |||
394 | depends: T_DEPENDS T_ON expr T_EOL | ||
395 | { | ||
396 | menu_add_dep($3); | ||
397 | printd(DEBUG_PARSE, "%s:%d:depends on\n", zconf_curname(), zconf_lineno()); | ||
398 | } | ||
399 | | T_DEPENDS expr T_EOL | ||
400 | { | ||
401 | menu_add_dep($2); | ||
402 | printd(DEBUG_PARSE, "%s:%d:depends\n", zconf_curname(), zconf_lineno()); | ||
403 | } | ||
404 | | T_REQUIRES expr T_EOL | ||
405 | { | ||
406 | menu_add_dep($2); | ||
407 | printd(DEBUG_PARSE, "%s:%d:requires\n", zconf_curname(), zconf_lineno()); | ||
408 | }; | ||
409 | |||
410 | /* prompt statement */ | ||
411 | |||
412 | prompt_stmt_opt: | ||
413 | /* empty */ | ||
414 | | prompt if_expr | ||
415 | { | ||
416 | menu_add_prompt(P_PROMPT, $1, $2); | ||
417 | }; | ||
418 | |||
419 | prompt: T_WORD | ||
420 | | T_WORD_QUOTE | ||
421 | ; | ||
422 | |||
423 | end: T_ENDMENU T_EOL { $$ = $1; } | ||
424 | | T_ENDCHOICE T_EOL { $$ = $1; } | ||
425 | | T_ENDIF T_EOL { $$ = $1; } | ||
426 | ; | ||
427 | |||
428 | nl: | ||
429 | T_EOL | ||
430 | | nl T_EOL | ||
431 | ; | ||
432 | |||
433 | if_expr: /* empty */ { $$ = NULL; } | ||
434 | | T_IF expr { $$ = $2; } | ||
435 | ; | ||
436 | |||
437 | expr: symbol { $$ = expr_alloc_symbol($1); } | ||
438 | | symbol T_EQUAL symbol { $$ = expr_alloc_comp(E_EQUAL, $1, $3); } | ||
439 | | symbol T_UNEQUAL symbol { $$ = expr_alloc_comp(E_UNEQUAL, $1, $3); } | ||
440 | | T_OPEN_PAREN expr T_CLOSE_PAREN { $$ = $2; } | ||
441 | | T_NOT expr { $$ = expr_alloc_one(E_NOT, $2); } | ||
442 | | expr T_OR expr { $$ = expr_alloc_two(E_OR, $1, $3); } | ||
443 | | expr T_AND expr { $$ = expr_alloc_two(E_AND, $1, $3); } | ||
444 | ; | ||
445 | |||
446 | symbol: T_WORD { $$ = sym_lookup($1, 0); free($1); } | ||
447 | | T_WORD_QUOTE { $$ = sym_lookup($1, 1); free($1); } | ||
448 | ; | ||
449 | |||
450 | %% | ||
451 | |||
452 | void conf_parse(const char *name) | ||
453 | { | ||
454 | struct symbol *sym; | ||
455 | int i; | ||
456 | |||
457 | zconf_initscan(name); | ||
458 | |||
459 | sym_init(); | ||
460 | menu_init(); | ||
461 | modules_sym = sym_lookup("MODULES", 0); | ||
462 | rootmenu.prompt = menu_add_prompt(P_MENU, "Linux Kernel Configuration", NULL); | ||
463 | |||
464 | #if YYDEBUG | ||
465 | if (getenv("ZCONF_DEBUG")) | ||
466 | zconfdebug = 1; | ||
467 | #endif | ||
468 | zconfparse(); | ||
469 | if (zconfnerrs) | ||
470 | exit(1); | ||
471 | menu_finalize(&rootmenu); | ||
472 | for_all_symbols(i, sym) { | ||
473 | sym_check_deps(sym); | ||
474 | } | ||
475 | |||
476 | sym_change_count = 1; | ||
477 | } | ||
478 | |||
479 | const char *zconf_tokenname(int token) | ||
480 | { | ||
481 | switch (token) { | ||
482 | case T_MENU: return "menu"; | ||
483 | case T_ENDMENU: return "endmenu"; | ||
484 | case T_CHOICE: return "choice"; | ||
485 | case T_ENDCHOICE: return "endchoice"; | ||
486 | case T_IF: return "if"; | ||
487 | case T_ENDIF: return "endif"; | ||
488 | case T_DEPENDS: return "depends"; | ||
489 | } | ||
490 | return "<token>"; | ||
491 | } | ||
492 | |||
493 | static bool zconf_endtoken(struct kconf_id *id, int starttoken, int endtoken) | ||
494 | { | ||
495 | if (id->token != endtoken) { | ||
496 | zconf_error("unexpected '%s' within %s block", | ||
497 | kconf_id_strings + id->name, zconf_tokenname(starttoken)); | ||
498 | zconfnerrs++; | ||
499 | return false; | ||
500 | } | ||
501 | if (current_menu->file != current_file) { | ||
502 | zconf_error("'%s' in different file than '%s'", | ||
503 | kconf_id_strings + id->name, zconf_tokenname(starttoken)); | ||
504 | fprintf(stderr, "%s:%d: location of the '%s'\n", | ||
505 | current_menu->file->name, current_menu->lineno, | ||
506 | zconf_tokenname(starttoken)); | ||
507 | zconfnerrs++; | ||
508 | return false; | ||
509 | } | ||
510 | return true; | ||
511 | } | ||
512 | |||
513 | static void zconfprint(const char *err, ...) | ||
514 | { | ||
515 | va_list ap; | ||
516 | |||
517 | fprintf(stderr, "%s:%d: ", zconf_curname(), zconf_lineno()); | ||
518 | va_start(ap, err); | ||
519 | vfprintf(stderr, err, ap); | ||
520 | va_end(ap); | ||
521 | fprintf(stderr, "\n"); | ||
522 | } | ||
523 | |||
524 | static void zconf_error(const char *err, ...) | ||
525 | { | ||
526 | va_list ap; | ||
527 | |||
528 | zconfnerrs++; | ||
529 | fprintf(stderr, "%s:%d: ", zconf_curname(), zconf_lineno()); | ||
530 | va_start(ap, err); | ||
531 | vfprintf(stderr, err, ap); | ||
532 | va_end(ap); | ||
533 | fprintf(stderr, "\n"); | ||
534 | } | ||
535 | |||
536 | static void zconferror(const char *err) | ||
537 | { | ||
538 | #if YYDEBUG | ||
539 | fprintf(stderr, "%s:%d: %s\n", zconf_curname(), zconf_lineno() + 1, err); | ||
540 | #endif | ||
541 | } | ||
542 | |||
543 | void print_quoted_string(FILE *out, const char *str) | ||
544 | { | ||
545 | const char *p; | ||
546 | int len; | ||
547 | |||
548 | putc('"', out); | ||
549 | while ((p = strchr(str, '"'))) { | ||
550 | len = p - str; | ||
551 | if (len) | ||
552 | fprintf(out, "%.*s", len, str); | ||
553 | fputs("\\\"", out); | ||
554 | str = p + 1; | ||
555 | } | ||
556 | fputs(str, out); | ||
557 | putc('"', out); | ||
558 | } | ||
559 | |||
560 | void print_symbol(FILE *out, struct menu *menu) | ||
561 | { | ||
562 | struct symbol *sym = menu->sym; | ||
563 | struct property *prop; | ||
564 | |||
565 | if (sym_is_choice(sym)) | ||
566 | fprintf(out, "choice\n"); | ||
567 | else | ||
568 | fprintf(out, "config %s\n", sym->name); | ||
569 | switch (sym->type) { | ||
570 | case S_BOOLEAN: | ||
571 | fputs(" boolean\n", out); | ||
572 | break; | ||
573 | case S_TRISTATE: | ||
574 | fputs(" tristate\n", out); | ||
575 | break; | ||
576 | case S_STRING: | ||
577 | fputs(" string\n", out); | ||
578 | break; | ||
579 | case S_INT: | ||
580 | fputs(" integer\n", out); | ||
581 | break; | ||
582 | case S_HEX: | ||
583 | fputs(" hex\n", out); | ||
584 | break; | ||
585 | default: | ||
586 | fputs(" ???\n", out); | ||
587 | break; | ||
588 | } | ||
589 | for (prop = sym->prop; prop; prop = prop->next) { | ||
590 | if (prop->menu != menu) | ||
591 | continue; | ||
592 | switch (prop->type) { | ||
593 | case P_PROMPT: | ||
594 | fputs(" prompt ", out); | ||
595 | print_quoted_string(out, prop->text); | ||
596 | if (!expr_is_yes(prop->visible.expr)) { | ||
597 | fputs(" if ", out); | ||
598 | expr_fprint(prop->visible.expr, out); | ||
599 | } | ||
600 | fputc('\n', out); | ||
601 | break; | ||
602 | case P_DEFAULT: | ||
603 | fputs( " default ", out); | ||
604 | expr_fprint(prop->expr, out); | ||
605 | if (!expr_is_yes(prop->visible.expr)) { | ||
606 | fputs(" if ", out); | ||
607 | expr_fprint(prop->visible.expr, out); | ||
608 | } | ||
609 | fputc('\n', out); | ||
610 | break; | ||
611 | case P_CHOICE: | ||
612 | fputs(" #choice value\n", out); | ||
613 | break; | ||
614 | default: | ||
615 | fprintf(out, " unknown prop %d!\n", prop->type); | ||
616 | break; | ||
617 | } | ||
618 | } | ||
619 | if (sym->help) { | ||
620 | int len = strlen(sym->help); | ||
621 | while (sym->help[--len] == '\n') | ||
622 | sym->help[len] = 0; | ||
623 | fprintf(out, " help\n%s\n", sym->help); | ||
624 | } | ||
625 | fputc('\n', out); | ||
626 | } | ||
627 | |||
628 | void zconfdump(FILE *out) | ||
629 | { | ||
630 | struct property *prop; | ||
631 | struct symbol *sym; | ||
632 | struct menu *menu; | ||
633 | |||
634 | menu = rootmenu.list; | ||
635 | while (menu) { | ||
636 | if ((sym = menu->sym)) | ||
637 | print_symbol(out, menu); | ||
638 | else if ((prop = menu->prompt)) { | ||
639 | switch (prop->type) { | ||
640 | case P_COMMENT: | ||
641 | fputs("\ncomment ", out); | ||
642 | print_quoted_string(out, prop->text); | ||
643 | fputs("\n", out); | ||
644 | break; | ||
645 | case P_MENU: | ||
646 | fputs("\nmenu ", out); | ||
647 | print_quoted_string(out, prop->text); | ||
648 | fputs("\n", out); | ||
649 | break; | ||
650 | default: | ||
651 | ; | ||
652 | } | ||
653 | if (!expr_is_yes(prop->visible.expr)) { | ||
654 | fputs(" depends ", out); | ||
655 | expr_fprint(prop->visible.expr, out); | ||
656 | fputc('\n', out); | ||
657 | } | ||
658 | fputs("\n", out); | ||
659 | } | ||
660 | |||
661 | if (menu->list) | ||
662 | menu = menu->list; | ||
663 | else if (menu->next) | ||
664 | menu = menu->next; | ||
665 | else while ((menu = menu->parent)) { | ||
666 | if (menu->prompt && menu->prompt->type == P_MENU) | ||
667 | fputs("\nendmenu\n", out); | ||
668 | if (menu->next) { | ||
669 | menu = menu->next; | ||
670 | break; | ||
671 | } | ||
672 | } | ||
673 | } | ||
674 | } | ||
675 | |||
676 | #include "lex.zconf.c" | ||
677 | #include "util.c" | ||
678 | #include "confdata.c" | ||
679 | #include "expr.c" | ||
680 | #include "symbol.c" | ||
681 | #include "menu.c" | ||
diff --git a/scripts/mkconfigs b/scripts/mkconfigs new file mode 100755 index 000000000..fda9de72f --- /dev/null +++ b/scripts/mkconfigs | |||
@@ -0,0 +1,51 @@ | |||
1 | #!/bin/sh | ||
2 | # | ||
3 | # Copyright (C) 2002 Khalid Aziz <khalid_aziz at hp.com> | ||
4 | # Copyright (C) 2002 Randy Dunlap <rddunlap at osdl.org> | ||
5 | # Copyright (C) 2002 Al Stone <ahs3 at fc.hp.com> | ||
6 | # Copyright (C) 2002 Hewlett-Packard Company | ||
7 | # | ||
8 | # This program is free software; you can redistribute it and/or modify | ||
9 | # it under the terms of the GNU General Public License as published by | ||
10 | # the Free Software Foundation; either version 2 of the License, or | ||
11 | # (at your option) any later version. | ||
12 | # | ||
13 | # This program is distributed in the hope that it will be useful, | ||
14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
16 | # GNU General Public License for more details. | ||
17 | # | ||
18 | # You should have received a copy of the GNU General Public License | ||
19 | # along with this program; if not, write to the Free Software | ||
20 | # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
21 | # | ||
22 | # Busybox version by Matteo Croce <3297627799 at wind.it> | ||
23 | # | ||
24 | # Rules to generate bbconfig.h from .config: | ||
25 | # - Retain lines that begin with "CONFIG_" | ||
26 | # - Retain lines that begin with "# CONFIG_" | ||
27 | # - lines that use double-quotes must \\-escape-quote them | ||
28 | |||
29 | if [ $# -lt 1 ] | ||
30 | then | ||
31 | config=.config | ||
32 | else config=$1 | ||
33 | fi | ||
34 | |||
35 | echo "#ifndef _BBCONFIGOPTS_H" | ||
36 | echo "#define _BBCONFIGOPTS_H" | ||
37 | echo \ | ||
38 | "/* | ||
39 | * busybox configuration settings. | ||
40 | * | ||
41 | * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. | ||
42 | * | ||
43 | * This file is generated automatically by scripts/config/mkconfigs. | ||
44 | * Do not edit. | ||
45 | * | ||
46 | */" | ||
47 | |||
48 | echo "static const char * const bbconfig_config =" | ||
49 | echo "`sed 's/\"/\\\\\"/g' $config | grep "^#\? \?CONFIG_" | awk '{print "\\"" $0 "\\\\n\\"";}'`" | ||
50 | echo ";" | ||
51 | echo "#endif /* _BBCONFIGOPTS_H */" | ||
diff --git a/scripts/trylink b/scripts/trylink new file mode 100755 index 000000000..dfe282db5 --- /dev/null +++ b/scripts/trylink | |||
@@ -0,0 +1,18 @@ | |||
1 | #!/bin/sh | ||
2 | |||
3 | debug=false | ||
4 | |||
5 | function try { | ||
6 | added="$1" | ||
7 | shift | ||
8 | $debug && echo "Trying: $* $added" | ||
9 | "$@" $added >/dev/null 2>&1 \ | ||
10 | && exit 0 | ||
11 | } | ||
12 | |||
13 | try "" "$@" | ||
14 | try "-lm" "$@" | ||
15 | try "-lcrypt" "$@" | ||
16 | try "-Wl,--start-group -lcrypt -lm -Wl,--end-group" "$@" | ||
17 | # It failed. Rerun & let people see the error messages | ||
18 | "$@" $added | ||
diff --git a/scripts/usage.c b/scripts/usage.c index 373642cd6..adb290e4d 100644 --- a/scripts/usage.c +++ b/scripts/usage.c | |||
@@ -1,11 +1,13 @@ | |||
1 | /* vi: set sw=4 ts=4: */ | 1 | /* vi: set sw=4 ts=4: */ |
2 | #include <unistd.h> | 2 | #include <unistd.h> |
3 | #include "busybox.h" | 3 | |
4 | #include "../include/autoconf.h" | ||
5 | #include "../include/busybox.h" | ||
4 | 6 | ||
5 | static const char usage_messages[] = | 7 | static const char usage_messages[] = |
6 | #define MAKE_USAGE | 8 | #define MAKE_USAGE |
7 | #include "usage.h" | 9 | #include "../include/usage.h" |
8 | #include "applets.h" | 10 | #include "../include/applets.h" |
9 | ; | 11 | ; |
10 | 12 | ||
11 | int main(void) | 13 | int main(void) |
diff --git a/scripts/usage_compressed b/scripts/usage_compressed index 8e2228af2..ab164aa12 100644..100755 --- a/scripts/usage_compressed +++ b/scripts/usage_compressed | |||
@@ -1,13 +1,19 @@ | |||
1 | #!/bin/sh | 1 | #!/bin/sh |
2 | 2 | ||
3 | loc="$1" | 3 | target="$1" |
4 | loc="$2" | ||
4 | 5 | ||
6 | test "$target" || exit 1 | ||
5 | test "$loc" || loc=. | 7 | test "$loc" || loc=. |
6 | test -x "$loc/usage" || exit 1 | 8 | test -x "$loc/usage" || exit 1 |
9 | test "$SED" || SED=sed | ||
10 | |||
11 | sz=`"$loc/usage" | wc -c` || exit 1 | ||
12 | |||
13 | exec >"$target" | ||
7 | 14 | ||
8 | echo 'static const char packed_usage[] = ' | 15 | echo 'static const char packed_usage[] = ' |
9 | "$loc"/usage | bzip2 -1 | od -v -t x1 \ | 16 | "$loc/usage" | bzip2 -1 | od -v -t x1 \ |
10 | | $SED -e 's/^[^ ]*//' -e 's/ \(..\)/\\x\1/g' -e 's/^\(.*\)$/"\1"/' || exit 1 | 17 | | $SED -e 's/^[^ ]*//' -e 's/ \(..\)/\\x\1/g' -e 's/^\(.*\)$/"\1"/' |
11 | echo ';' | 18 | echo ';' |
12 | sz=`"$loc"/usage | wc -c` || exit 1 | ||
13 | echo '#define SIZEOF_usage_messages' `expr 0 + $sz` | 19 | echo '#define SIZEOF_usage_messages' `expr 0 + $sz` |
diff --git a/shell/Config.in b/shell/Config.in index cfe081f2c..0e25bedcb 100644 --- a/shell/Config.in +++ b/shell/Config.in | |||
@@ -7,36 +7,36 @@ menu "Shells" | |||
7 | 7 | ||
8 | choice | 8 | choice |
9 | prompt "Choose your default shell" | 9 | prompt "Choose your default shell" |
10 | default CONFIG_FEATURE_SH_IS_NONE | 10 | default FEATURE_SH_IS_NONE |
11 | help | 11 | help |
12 | Choose a shell. The ash shell is the most bash compatible | 12 | Choose a shell. The ash shell is the most bash compatible |
13 | and full featured one. | 13 | and full featured one. |
14 | 14 | ||
15 | config CONFIG_FEATURE_SH_IS_ASH | 15 | config FEATURE_SH_IS_ASH |
16 | select CONFIG_ASH | 16 | select ASH |
17 | bool "ash" | 17 | bool "ash" |
18 | 18 | ||
19 | config CONFIG_FEATURE_SH_IS_HUSH | 19 | config FEATURE_SH_IS_HUSH |
20 | select CONFIG_HUSH | 20 | select HUSH |
21 | bool "hush" | 21 | bool "hush" |
22 | 22 | ||
23 | config CONFIG_FEATURE_SH_IS_LASH | 23 | config FEATURE_SH_IS_LASH |
24 | select CONFIG_LASH | 24 | select LASH |
25 | bool "lash" | 25 | bool "lash" |
26 | 26 | ||
27 | config CONFIG_FEATURE_SH_IS_MSH | 27 | config FEATURE_SH_IS_MSH |
28 | select CONFIG_MSH | 28 | select MSH |
29 | bool "msh" | 29 | bool "msh" |
30 | 30 | ||
31 | config CONFIG_FEATURE_SH_IS_NONE | 31 | config FEATURE_SH_IS_NONE |
32 | bool "none" | 32 | bool "none" |
33 | 33 | ||
34 | endchoice | 34 | endchoice |
35 | 35 | ||
36 | config CONFIG_ASH | 36 | config ASH |
37 | bool "ash" | 37 | bool "ash" |
38 | default n | 38 | default n |
39 | select CONFIG_TEST | 39 | select TEST |
40 | help | 40 | help |
41 | Tha 'ash' shell adds about 60k in the default configuration and is | 41 | Tha 'ash' shell adds about 60k in the default configuration and is |
42 | the most complete and most pedantically correct shell included with | 42 | the most complete and most pedantically correct shell included with |
@@ -45,105 +45,105 @@ config CONFIG_ASH | |||
45 | (written by Kenneth Almquist) from NetBSD. | 45 | (written by Kenneth Almquist) from NetBSD. |
46 | 46 | ||
47 | comment "Ash Shell Options" | 47 | comment "Ash Shell Options" |
48 | depends on CONFIG_ASH | 48 | depends on ASH |
49 | 49 | ||
50 | config CONFIG_ASH_JOB_CONTROL | 50 | config ASH_JOB_CONTROL |
51 | bool "Job control" | 51 | bool "Job control" |
52 | default y | 52 | default y |
53 | depends on CONFIG_ASH | 53 | depends on ASH |
54 | help | 54 | help |
55 | Enable job control in the ash shell. | 55 | Enable job control in the ash shell. |
56 | 56 | ||
57 | config CONFIG_ASH_READ_NCHARS | 57 | config ASH_READ_NCHARS |
58 | bool "'read -n N' and 'read -s' support" | 58 | bool "'read -n N' and 'read -s' support" |
59 | default n | 59 | default n |
60 | depends on CONFIG_ASH | 60 | depends on ASH |
61 | help | 61 | help |
62 | 'read -n N' will return a value after N characters have been read. | 62 | 'read -n N' will return a value after N characters have been read. |
63 | 'read -s' will read without echoing the user's input. | 63 | 'read -s' will read without echoing the user's input. |
64 | 64 | ||
65 | config CONFIG_ASH_READ_TIMEOUT | 65 | config ASH_READ_TIMEOUT |
66 | bool "'read -t S' support." | 66 | bool "'read -t S' support." |
67 | default n | 67 | default n |
68 | depends on CONFIG_ASH | 68 | depends on ASH |
69 | help | 69 | help |
70 | 'read -t S' will return a value after S seconds have passed. | 70 | 'read -t S' will return a value after S seconds have passed. |
71 | This implementation will allow fractional seconds, expressed | 71 | This implementation will allow fractional seconds, expressed |
72 | as a decimal fraction, e.g. 'read -t 2.5 foo'. | 72 | as a decimal fraction, e.g. 'read -t 2.5 foo'. |
73 | 73 | ||
74 | config CONFIG_ASH_ALIAS | 74 | config ASH_ALIAS |
75 | bool "alias support" | 75 | bool "alias support" |
76 | default y | 76 | default y |
77 | depends on CONFIG_ASH | 77 | depends on ASH |
78 | help | 78 | help |
79 | Enable alias support in the ash shell. | 79 | Enable alias support in the ash shell. |
80 | 80 | ||
81 | config CONFIG_ASH_MATH_SUPPORT | 81 | config ASH_MATH_SUPPORT |
82 | bool "Posix math support" | 82 | bool "Posix math support" |
83 | default y | 83 | default y |
84 | depends on CONFIG_ASH | 84 | depends on ASH |
85 | help | 85 | help |
86 | Enable math support in the ash shell. | 86 | Enable math support in the ash shell. |
87 | 87 | ||
88 | config CONFIG_ASH_MATH_SUPPORT_64 | 88 | config ASH_MATH_SUPPORT_64 |
89 | bool "Extend Posix math support to 64 bit" | 89 | bool "Extend Posix math support to 64 bit" |
90 | default n | 90 | default n |
91 | depends on CONFIG_ASH_MATH_SUPPORT | 91 | depends on ASH_MATH_SUPPORT |
92 | help | 92 | help |
93 | Enable 64-bit math support in the ash shell. This will make | 93 | Enable 64-bit math support in the ash shell. This will make |
94 | the shell slightly larger, but will allow computation with very | 94 | the shell slightly larger, but will allow computation with very |
95 | large numbers. | 95 | large numbers. |
96 | 96 | ||
97 | config CONFIG_ASH_GETOPTS | 97 | config ASH_GETOPTS |
98 | bool "Builtin getopt to parse positional parameters" | 98 | bool "Builtin getopt to parse positional parameters" |
99 | default n | 99 | default n |
100 | depends on CONFIG_ASH | 100 | depends on ASH |
101 | help | 101 | help |
102 | Enable getopts builtin in the ash shell. | 102 | Enable getopts builtin in the ash shell. |
103 | 103 | ||
104 | config CONFIG_ASH_BUILTIN_ECHO | 104 | config ASH_BUILTIN_ECHO |
105 | bool "Builtin version of 'echo'" | 105 | bool "Builtin version of 'echo'" |
106 | default y | 106 | default y |
107 | select CONFIG_ECHO | 107 | select ECHO |
108 | depends on CONFIG_ASH | 108 | depends on ASH |
109 | help | 109 | help |
110 | Enable support for echo, built in to ash. | 110 | Enable support for echo, built in to ash. |
111 | 111 | ||
112 | config CONFIG_ASH_BUILTIN_TEST | 112 | config ASH_BUILTIN_TEST |
113 | bool "Builtin version of 'test'" | 113 | bool "Builtin version of 'test'" |
114 | default y | 114 | default y |
115 | select CONFIG_TEST | 115 | select TEST |
116 | depends on CONFIG_ASH | 116 | depends on ASH |
117 | help | 117 | help |
118 | Enable support for test, built in to ash. | 118 | Enable support for test, built in to ash. |
119 | 119 | ||
120 | config CONFIG_ASH_CMDCMD | 120 | config ASH_CMDCMD |
121 | bool "'command' command to override shell builtins" | 121 | bool "'command' command to override shell builtins" |
122 | default n | 122 | default n |
123 | depends on CONFIG_ASH | 123 | depends on ASH |
124 | help | 124 | help |
125 | Enable support for the ash 'command' builtin, which allows | 125 | Enable support for the ash 'command' builtin, which allows |
126 | you to run the specified command with the specified arguments, | 126 | you to run the specified command with the specified arguments, |
127 | even when there is an ash builtin command with the same name. | 127 | even when there is an ash builtin command with the same name. |
128 | 128 | ||
129 | config CONFIG_ASH_MAIL | 129 | config ASH_MAIL |
130 | bool "Check for new mail on interactive shells" | 130 | bool "Check for new mail on interactive shells" |
131 | default y | 131 | default y |
132 | depends on CONFIG_ASH | 132 | depends on ASH |
133 | help | 133 | help |
134 | Enable "check for new mail" in the ash shell. | 134 | Enable "check for new mail" in the ash shell. |
135 | 135 | ||
136 | config CONFIG_ASH_OPTIMIZE_FOR_SIZE | 136 | config ASH_OPTIMIZE_FOR_SIZE |
137 | bool "Optimize for size instead of speed" | 137 | bool "Optimize for size instead of speed" |
138 | default y | 138 | default y |
139 | depends on CONFIG_ASH | 139 | depends on ASH |
140 | help | 140 | help |
141 | Compile ash for reduced size at the price of speed. | 141 | Compile ash for reduced size at the price of speed. |
142 | 142 | ||
143 | config CONFIG_ASH_RANDOM_SUPPORT | 143 | config ASH_RANDOM_SUPPORT |
144 | bool "Pseudorandom generator and variable $RANDOM" | 144 | bool "Pseudorandom generator and variable $RANDOM" |
145 | default n | 145 | default n |
146 | depends on CONFIG_ASH | 146 | depends on ASH |
147 | help | 147 | help |
148 | Enable pseudorandom generator and dynamic variable "$RANDOM". | 148 | Enable pseudorandom generator and dynamic variable "$RANDOM". |
149 | Each read of "$RANDOM" will generate a new pseudorandom value. | 149 | Each read of "$RANDOM" will generate a new pseudorandom value. |
@@ -151,21 +151,21 @@ config CONFIG_ASH_RANDOM_SUPPORT | |||
151 | After "unset RANDOM" then generator will switch off and this | 151 | After "unset RANDOM" then generator will switch off and this |
152 | variable will no longer have special treatment. | 152 | variable will no longer have special treatment. |
153 | 153 | ||
154 | config CONFIG_ASH_EXPAND_PRMT | 154 | config ASH_EXPAND_PRMT |
155 | bool "Expand prompt string" | 155 | bool "Expand prompt string" |
156 | default n | 156 | default n |
157 | depends on CONFIG_ASH | 157 | depends on ASH |
158 | help | 158 | help |
159 | "PS#" may be contain volatile content, such as backquote commands. | 159 | "PS#" may be contain volatile content, such as backquote commands. |
160 | This option recreates the prompt string from the environment | 160 | This option recreates the prompt string from the environment |
161 | variable each time it is displayed. | 161 | variable each time it is displayed. |
162 | 162 | ||
163 | config CONFIG_HUSH | 163 | config HUSH |
164 | bool "hush" | 164 | bool "hush" |
165 | default n | 165 | default n |
166 | select CONFIG_TRUE | 166 | select TRUE |
167 | select CONFIG_FALSE | 167 | select FALSE |
168 | select CONFIG_TEST | 168 | select TEST |
169 | help | 169 | help |
170 | hush is a very small shell (just 18k) and it has fairly complete | 170 | hush is a very small shell (just 18k) and it has fairly complete |
171 | Bourne shell grammar. It even handles all the normal flow control | 171 | Bourne shell grammar. It even handles all the normal flow control |
@@ -177,12 +177,12 @@ config CONFIG_HUSH | |||
177 | expansion, &> and >& redirection of stdout+stderr, etc. | 177 | expansion, &> and >& redirection of stdout+stderr, etc. |
178 | 178 | ||
179 | 179 | ||
180 | config CONFIG_LASH | 180 | config LASH |
181 | bool "lash" | 181 | bool "lash" |
182 | default n | 182 | default n |
183 | select CONFIG_TRUE | 183 | select TRUE |
184 | select CONFIG_FALSE | 184 | select FALSE |
185 | select CONFIG_TEST | 185 | select TEST |
186 | help | 186 | help |
187 | lash is the very smallest shell (adds just 10k) and it is quite | 187 | lash is the very smallest shell (adds just 10k) and it is quite |
188 | usable as a command prompt, but it is not suitable for any but the | 188 | usable as a command prompt, but it is not suitable for any but the |
@@ -192,12 +192,12 @@ config CONFIG_LASH | |||
192 | command editing makes it a very nice lightweight command prompt. | 192 | command editing makes it a very nice lightweight command prompt. |
193 | 193 | ||
194 | 194 | ||
195 | config CONFIG_MSH | 195 | config MSH |
196 | bool "msh" | 196 | bool "msh" |
197 | default n | 197 | default n |
198 | select CONFIG_TRUE | 198 | select TRUE |
199 | select CONFIG_FALSE | 199 | select FALSE |
200 | select CONFIG_TEST | 200 | select TEST |
201 | help | 201 | help |
202 | The minix shell (adds just 30k) is quite complete and handles things | 202 | The minix shell (adds just 30k) is quite complete and handles things |
203 | like for/do/done, case/esac and all the things you expect a Bourne | 203 | like for/do/done, case/esac and all the things you expect a Bourne |
@@ -207,19 +207,19 @@ config CONFIG_MSH | |||
207 | It also uses only vfork, so it can be used on uClinux systems. | 207 | It also uses only vfork, so it can be used on uClinux systems. |
208 | 208 | ||
209 | comment "Bourne Shell Options" | 209 | comment "Bourne Shell Options" |
210 | depends on CONFIG_MSH || CONFIG_LASH || CONFIG_HUSH || CONFIG_ASH | 210 | depends on MSH || LASH || HUSH || ASH |
211 | 211 | ||
212 | config CONFIG_FEATURE_SH_EXTRA_QUIET | 212 | config FEATURE_SH_EXTRA_QUIET |
213 | bool "Hide message on interactive shell startup" | 213 | bool "Hide message on interactive shell startup" |
214 | default n | 214 | default n |
215 | depends on CONFIG_MSH || CONFIG_LASH || CONFIG_HUSH || CONFIG_ASH | 215 | depends on MSH || LASH || HUSH || ASH |
216 | help | 216 | help |
217 | Remove the busybox introduction when starting a shell. | 217 | Remove the busybox introduction when starting a shell. |
218 | 218 | ||
219 | config CONFIG_FEATURE_SH_STANDALONE_SHELL | 219 | config FEATURE_SH_STANDALONE_SHELL |
220 | bool "Standalone shell" | 220 | bool "Standalone shell" |
221 | default n | 221 | default n |
222 | depends on CONFIG_MSH || CONFIG_LASH || CONFIG_HUSH || CONFIG_ASH | 222 | depends on MSH || LASH || HUSH || ASH |
223 | help | 223 | help |
224 | This option causes the selected busybox shell to use busybox applets | 224 | This option causes the selected busybox shell to use busybox applets |
225 | in preference to executables in the PATH whenever possible. For | 225 | in preference to executables in the PATH whenever possible. For |
@@ -240,53 +240,53 @@ config CONFIG_FEATURE_SH_STANDALONE_SHELL | |||
240 | that exact location with that exact name, this option will not work at | 240 | that exact location with that exact name, this option will not work at |
241 | all. | 241 | all. |
242 | 242 | ||
243 | config CONFIG_FEATURE_COMMAND_EDITING | 243 | config FEATURE_COMMAND_EDITING |
244 | bool "Command line editing" | 244 | bool "Command line editing" |
245 | default n | 245 | default n |
246 | depends on CONFIG_MSH || CONFIG_LASH || CONFIG_HUSH || CONFIG_ASH | 246 | depends on MSH || LASH || HUSH || ASH |
247 | help | 247 | help |
248 | Enable command editing in shell. | 248 | Enable command editing in shell. |
249 | 249 | ||
250 | config CONFIG_FEATURE_COMMAND_EDITING_VI | 250 | config FEATURE_COMMAND_EDITING_VI |
251 | bool "vi-style line editing commands" | 251 | bool "vi-style line editing commands" |
252 | default n | 252 | default n |
253 | depends on CONFIG_FEATURE_COMMAND_EDITING | 253 | depends on FEATURE_COMMAND_EDITING |
254 | help | 254 | help |
255 | Enable vi-style line editing in the shell. This mode can be | 255 | Enable vi-style line editing in the shell. This mode can be |
256 | turned on and off with "set -o vi" and "set +o vi". | 256 | turned on and off with "set -o vi" and "set +o vi". |
257 | 257 | ||
258 | config CONFIG_FEATURE_COMMAND_HISTORY | 258 | config FEATURE_COMMAND_HISTORY |
259 | int "History size" | 259 | int "History size" |
260 | default 15 | 260 | default 15 |
261 | depends on CONFIG_FEATURE_COMMAND_EDITING | 261 | depends on FEATURE_COMMAND_EDITING |
262 | help | 262 | help |
263 | Specify command history size in shell. | 263 | Specify command history size in shell. |
264 | 264 | ||
265 | config CONFIG_FEATURE_COMMAND_SAVEHISTORY | 265 | config FEATURE_COMMAND_SAVEHISTORY |
266 | bool "History saving" | 266 | bool "History saving" |
267 | default n | 267 | default n |
268 | depends on CONFIG_ASH && CONFIG_FEATURE_COMMAND_EDITING | 268 | depends on ASH && FEATURE_COMMAND_EDITING |
269 | help | 269 | help |
270 | Enable history saving in ash shell. | 270 | Enable history saving in ash shell. |
271 | 271 | ||
272 | config CONFIG_FEATURE_COMMAND_TAB_COMPLETION | 272 | config FEATURE_COMMAND_TAB_COMPLETION |
273 | bool "Tab completion" | 273 | bool "Tab completion" |
274 | default n | 274 | default n |
275 | depends on CONFIG_FEATURE_COMMAND_EDITING | 275 | depends on FEATURE_COMMAND_EDITING |
276 | help | 276 | help |
277 | Enable tab completion in shell. | 277 | Enable tab completion in shell. |
278 | 278 | ||
279 | config CONFIG_FEATURE_COMMAND_USERNAME_COMPLETION | 279 | config FEATURE_COMMAND_USERNAME_COMPLETION |
280 | bool "Username completion" | 280 | bool "Username completion" |
281 | default n | 281 | default n |
282 | depends on CONFIG_FEATURE_COMMAND_TAB_COMPLETION | 282 | depends on FEATURE_COMMAND_TAB_COMPLETION |
283 | help | 283 | help |
284 | Enable username completion in shell. | 284 | Enable username completion in shell. |
285 | 285 | ||
286 | config CONFIG_FEATURE_SH_FANCY_PROMPT | 286 | config FEATURE_SH_FANCY_PROMPT |
287 | bool "Fancy shell prompts" | 287 | bool "Fancy shell prompts" |
288 | default n | 288 | default n |
289 | depends on CONFIG_FEATURE_COMMAND_EDITING | 289 | depends on FEATURE_COMMAND_EDITING |
290 | help | 290 | help |
291 | Setting this option allows for prompts to use things like \w and | 291 | Setting this option allows for prompts to use things like \w and |
292 | \$ and also using escape codes. | 292 | \$ and also using escape codes. |
diff --git a/shell/Kbuild b/shell/Kbuild new file mode 100644 index 000000000..eb0199ee2 --- /dev/null +++ b/shell/Kbuild | |||
@@ -0,0 +1,12 @@ | |||
1 | # Makefile for busybox | ||
2 | # | ||
3 | # Copyright (C) 1999-2005 by Erik Andersen <andersen@codepoet.org> | ||
4 | # | ||
5 | # Licensed under the GPL v2, see the file LICENSE in this tarball. | ||
6 | |||
7 | lib-y:= | ||
8 | lib-$(CONFIG_ASH) += ash.o | ||
9 | lib-$(CONFIG_HUSH) += hush.o | ||
10 | lib-$(CONFIG_LASH) += lash.o | ||
11 | lib-$(CONFIG_MSH) += msh.o | ||
12 | lib-$(CONFIG_FEATURE_COMMAND_EDITING) += cmdedit.o | ||
diff --git a/shell/Makefile b/shell/Makefile deleted file mode 100644 index 9590f524e..000000000 --- a/shell/Makefile +++ /dev/null | |||
@@ -1,23 +0,0 @@ | |||
1 | # Makefile for busybox | ||
2 | # | ||
3 | # Copyright (C) 1999-2005 by Erik Andersen <andersen@codepoet.org> | ||
4 | # | ||
5 | # Licensed under the GPL v2, see the file LICENSE in this tarball. | ||
6 | |||
7 | ifndef top_srcdir | ||
8 | top_srcdir=.. | ||
9 | endif | ||
10 | ifndef top_builddir | ||
11 | top_builddir=.. | ||
12 | endif | ||
13 | srcdir=$(top_srcdir)/shell | ||
14 | SHELL_DIR:=./ | ||
15 | include $(top_srcdir)/Rules.mak | ||
16 | include $(top_builddir)/.config | ||
17 | include Makefile.in | ||
18 | all: $(libraries-y) | ||
19 | -include $(top_builddir)/.depend | ||
20 | |||
21 | clean: | ||
22 | rm -f *.o *.a $(AR_TARGET) | ||
23 | |||
diff --git a/shell/Makefile.in b/shell/Makefile.in deleted file mode 100644 index fcd93f345..000000000 --- a/shell/Makefile.in +++ /dev/null | |||
@@ -1,33 +0,0 @@ | |||
1 | # Makefile for busybox | ||
2 | # | ||
3 | # Copyright (C) 1999-2005 by Erik Andersen <andersen@codepoet.org> | ||
4 | # | ||
5 | # Licensed under the GPL v2, see the file LICENSE in this tarball. | ||
6 | |||
7 | SHELL_AR:=shell.a | ||
8 | ifndef $(SHELL_DIR) | ||
9 | SHELL_DIR:=$(top_builddir)/shell/ | ||
10 | endif | ||
11 | srcdir=$(top_srcdir)/shell | ||
12 | |||
13 | SHELLT-y:= | ||
14 | SHELLT-$(CONFIG_ASH) += ash.o | ||
15 | SHELLT-$(CONFIG_HUSH) += hush.o | ||
16 | SHELLT-$(CONFIG_LASH) += lash.o | ||
17 | SHELLT-$(CONFIG_MSH) += msh.o | ||
18 | SHELLT-$(CONFIG_FEATURE_COMMAND_EDITING) += cmdedit.o | ||
19 | |||
20 | ifneq ($(strip $(SHELLT-y)),) | ||
21 | libraries-y+=$(SHELL_DIR)$(SHELL_AR) | ||
22 | endif | ||
23 | |||
24 | SHELLT_SRC-y:=$(patsubst %.o,$(srcdir)/%.c,$(SHELLT-y)) | ||
25 | SHELLT_SRC-a:=$(wildcard $(srcdir)/*.c) | ||
26 | APPLET_SRC-y+=$(SHELLT_SRC-y) | ||
27 | APPLET_SRC-a+=$(SHELLT_SRC-a) | ||
28 | |||
29 | $(SHELL_DIR)$(SHELL_AR): $(patsubst %,$(SHELL_DIR)%, $(SHELLT-y)) | ||
30 | $(do_ar) | ||
31 | |||
32 | $(SHELL_DIR)%.o: $(srcdir)/%.c | ||
33 | $(compile.c) | ||
diff --git a/shell/ash.c b/shell/ash.c index 0d9fa7fe2..3564044b2 100644 --- a/shell/ash.c +++ b/shell/ash.c | |||
@@ -81,8 +81,6 @@ | |||
81 | #include <time.h> | 81 | #include <time.h> |
82 | #include <fnmatch.h> | 82 | #include <fnmatch.h> |
83 | 83 | ||
84 | #include "pwd_.h" | ||
85 | |||
86 | #ifdef CONFIG_ASH_JOB_CONTROL | 84 | #ifdef CONFIG_ASH_JOB_CONTROL |
87 | #define JOBS 1 | 85 | #define JOBS 1 |
88 | #else | 86 | #else |
diff --git a/shell/cmdedit.c b/shell/cmdedit.c index a9fc84798..7b4d46511 100644 --- a/shell/cmdedit.c +++ b/shell/cmdedit.c | |||
@@ -79,11 +79,6 @@ | |||
79 | #define CONFIG_FEATURE_GETUSERNAME_AND_HOMEDIR | 79 | #define CONFIG_FEATURE_GETUSERNAME_AND_HOMEDIR |
80 | #endif | 80 | #endif |
81 | 81 | ||
82 | #ifdef CONFIG_FEATURE_GETUSERNAME_AND_HOMEDIR | ||
83 | #include "pwd_.h" | ||
84 | #endif /* advanced FEATURES */ | ||
85 | |||
86 | |||
87 | /* Maximum length of the linked list for the command line history */ | 82 | /* Maximum length of the linked list for the command line history */ |
88 | #ifndef CONFIG_FEATURE_COMMAND_HISTORY | 83 | #ifndef CONFIG_FEATURE_COMMAND_HISTORY |
89 | #define MAX_HISTORY 15 | 84 | #define MAX_HISTORY 15 |
diff --git a/sysklogd/Config.in b/sysklogd/Config.in index 399315208..9875b3c12 100644 --- a/sysklogd/Config.in +++ b/sysklogd/Config.in | |||
@@ -5,7 +5,7 @@ | |||
5 | 5 | ||
6 | menu "System Logging Utilities" | 6 | menu "System Logging Utilities" |
7 | 7 | ||
8 | config CONFIG_SYSLOGD | 8 | config SYSLOGD |
9 | bool "syslogd" | 9 | bool "syslogd" |
10 | default n | 10 | default n |
11 | help | 11 | help |
@@ -20,18 +20,18 @@ config CONFIG_SYSLOGD | |||
20 | wrong. And something almost always will go wrong if | 20 | wrong. And something almost always will go wrong if |
21 | you wait long enough.... | 21 | you wait long enough.... |
22 | 22 | ||
23 | config CONFIG_FEATURE_ROTATE_LOGFILE | 23 | config FEATURE_ROTATE_LOGFILE |
24 | bool "Rotate message files" | 24 | bool "Rotate message files" |
25 | default n | 25 | default n |
26 | depends on CONFIG_SYSLOGD | 26 | depends on SYSLOGD |
27 | help | 27 | help |
28 | This enables syslogd to rotate the message files | 28 | This enables syslogd to rotate the message files |
29 | on his own. No need to use an external rotatescript. | 29 | on his own. No need to use an external rotatescript. |
30 | 30 | ||
31 | config CONFIG_FEATURE_REMOTE_LOG | 31 | config FEATURE_REMOTE_LOG |
32 | bool "Remote Log support" | 32 | bool "Remote Log support" |
33 | default n | 33 | default n |
34 | depends on CONFIG_SYSLOGD | 34 | depends on SYSLOGD |
35 | help | 35 | help |
36 | When you enable this feature, the syslogd utility can | 36 | When you enable this feature, the syslogd utility can |
37 | be used to send system log messages to another system | 37 | be used to send system log messages to another system |
@@ -42,10 +42,10 @@ config CONFIG_FEATURE_REMOTE_LOG | |||
42 | measure to prevent system logs from being tampered with | 42 | measure to prevent system logs from being tampered with |
43 | by an intruder. | 43 | by an intruder. |
44 | 44 | ||
45 | config CONFIG_FEATURE_IPC_SYSLOG | 45 | config FEATURE_IPC_SYSLOG |
46 | bool "Circular Buffer support" | 46 | bool "Circular Buffer support" |
47 | default n | 47 | default n |
48 | depends on CONFIG_SYSLOGD | 48 | depends on SYSLOGD |
49 | help | 49 | help |
50 | When you enable this feature, the syslogd utility will | 50 | When you enable this feature, the syslogd utility will |
51 | use a circular buffer to record system log messages. | 51 | use a circular buffer to record system log messages. |
@@ -56,28 +56,28 @@ config CONFIG_FEATURE_IPC_SYSLOG | |||
56 | entire filesystem, which may cause your system to | 56 | entire filesystem, which may cause your system to |
57 | break badly. | 57 | break badly. |
58 | 58 | ||
59 | config CONFIG_FEATURE_IPC_SYSLOG_BUFFER_SIZE | 59 | config FEATURE_IPC_SYSLOG_BUFFER_SIZE |
60 | int " Circular buffer size in Kbytes (minimum 4KB)" | 60 | int " Circular buffer size in Kbytes (minimum 4KB)" |
61 | default 16 | 61 | default 16 |
62 | depends on CONFIG_FEATURE_IPC_SYSLOG | 62 | depends on FEATURE_IPC_SYSLOG |
63 | help | 63 | help |
64 | This option sets the size of the circular buffer | 64 | This option sets the size of the circular buffer |
65 | used to record system log messages. | 65 | used to record system log messages. |
66 | 66 | ||
67 | config CONFIG_LOGREAD | 67 | config LOGREAD |
68 | bool "logread" | 68 | bool "logread" |
69 | default y | 69 | default y |
70 | depends on CONFIG_FEATURE_IPC_SYSLOG | 70 | depends on FEATURE_IPC_SYSLOG |
71 | help | 71 | help |
72 | If you enabled Circular Buffer support, you almost | 72 | If you enabled Circular Buffer support, you almost |
73 | certainly want to enable this feature as well. This | 73 | certainly want to enable this feature as well. This |
74 | utility will allow you to read the messages that are | 74 | utility will allow you to read the messages that are |
75 | stored in the syslogd circular buffer. | 75 | stored in the syslogd circular buffer. |
76 | 76 | ||
77 | config CONFIG_FEATURE_LOGREAD_REDUCED_LOCKING | 77 | config FEATURE_LOGREAD_REDUCED_LOCKING |
78 | bool "logread double buffering" | 78 | bool "logread double buffering" |
79 | default n | 79 | default n |
80 | depends on CONFIG_LOGREAD | 80 | depends on LOGREAD |
81 | help | 81 | help |
82 | 'logread' ouput to slow serial terminals can have | 82 | 'logread' ouput to slow serial terminals can have |
83 | side effects on syslog because of the semaphore. | 83 | side effects on syslog because of the semaphore. |
@@ -85,11 +85,11 @@ config CONFIG_FEATURE_LOGREAD_REDUCED_LOCKING | |||
85 | from circular buffer, minimizing semaphore | 85 | from circular buffer, minimizing semaphore |
86 | contention at some minor memory expense. | 86 | contention at some minor memory expense. |
87 | 87 | ||
88 | config CONFIG_KLOGD | 88 | config KLOGD |
89 | bool "klogd" | 89 | bool "klogd" |
90 | default n | 90 | default n |
91 | depends on CONFIG_SYSLOGD | 91 | depends on SYSLOGD |
92 | select CONFIG_FEATURE_SYSLOG | 92 | select FEATURE_SYSLOG |
93 | help | 93 | help |
94 | klogd is a utility which intercepts and logs all | 94 | klogd is a utility which intercepts and logs all |
95 | messages from the Linux kernel and sends the messages | 95 | messages from the Linux kernel and sends the messages |
@@ -97,10 +97,10 @@ config CONFIG_KLOGD | |||
97 | you wish to record the messages produced by the kernel, | 97 | you wish to record the messages produced by the kernel, |
98 | you should enable this option. | 98 | you should enable this option. |
99 | 99 | ||
100 | config CONFIG_LOGGER | 100 | config LOGGER |
101 | bool "logger" | 101 | bool "logger" |
102 | default n | 102 | default n |
103 | select CONFIG_FEATURE_SYSLOG | 103 | select FEATURE_SYSLOG |
104 | help | 104 | help |
105 | The logger utility allows you to send arbitrary text | 105 | The logger utility allows you to send arbitrary text |
106 | messages to the system log (i.e. the 'syslogd' utility) so | 106 | messages to the system log (i.e. the 'syslogd' utility) so |
diff --git a/sysklogd/Kbuild b/sysklogd/Kbuild new file mode 100644 index 000000000..0d5b2b929 --- /dev/null +++ b/sysklogd/Kbuild | |||
@@ -0,0 +1,11 @@ | |||
1 | # Makefile for busybox | ||
2 | # | ||
3 | # Copyright (C) 1999-2005 by Erik Andersen <andersen@codepoet.org> | ||
4 | # | ||
5 | # Licensed under the GPL v2, see the file LICENSE in this tarball. | ||
6 | |||
7 | lib-y:= | ||
8 | lib-$(CONFIG_KLOGD) += klogd.o | ||
9 | lib-$(CONFIG_LOGGER) += logger.o | ||
10 | lib-$(CONFIG_LOGREAD) += logread.o | ||
11 | lib-$(CONFIG_SYSLOGD) += syslogd.o | ||
diff --git a/sysklogd/Makefile b/sysklogd/Makefile deleted file mode 100644 index 0ae4f1d35..000000000 --- a/sysklogd/Makefile +++ /dev/null | |||
@@ -1,22 +0,0 @@ | |||
1 | # Makefile for busybox | ||
2 | # | ||
3 | # Copyright (C) 1999-2005 by Erik Andersen <andersen@codepoet.org> | ||
4 | # | ||
5 | # Licensed under the GPL v2, see the file LICENSE in this tarball. | ||
6 | |||
7 | ifndef top_srcdir | ||
8 | top_srcdir=.. | ||
9 | endif | ||
10 | ifndef top_builddir | ||
11 | top_builddir=.. | ||
12 | endif | ||
13 | srcdir=$(top_srcdir)/sysklogd | ||
14 | SYSKLOGD_DIR:=./ | ||
15 | include $(top_srcdir)/Rules.mak | ||
16 | include $(top_builddir)/.config | ||
17 | include Makefile.in | ||
18 | all: $(libraries-y) | ||
19 | -include $(top_builddir)/.depend | ||
20 | |||
21 | clean: | ||
22 | rm -f *.o *.a $(AR_TARGET) | ||
diff --git a/sysklogd/Makefile.in b/sysklogd/Makefile.in deleted file mode 100644 index 83f77be90..000000000 --- a/sysklogd/Makefile.in +++ /dev/null | |||
@@ -1,32 +0,0 @@ | |||
1 | # Makefile for busybox | ||
2 | # | ||
3 | # Copyright (C) 1999-2005 by Erik Andersen <andersen@codepoet.org> | ||
4 | # | ||
5 | # Licensed under the GPL v2, see the file LICENSE in this tarball. | ||
6 | |||
7 | SYSKLOGD_AR:=sysklogd.a | ||
8 | ifndef $(SYSKLOGD_DIR) | ||
9 | SYSKLOGD_DIR:=$(top_builddir)/sysklogd/ | ||
10 | endif | ||
11 | srcdir=$(top_srcdir)/sysklogd | ||
12 | |||
13 | SYSKLOGD-y:= | ||
14 | SYSKLOGD-$(CONFIG_KLOGD) += klogd.o | ||
15 | SYSKLOGD-$(CONFIG_LOGGER) += logger.o | ||
16 | SYSKLOGD-$(CONFIG_LOGREAD) += logread.o | ||
17 | SYSKLOGD-$(CONFIG_SYSLOGD) += syslogd.o | ||
18 | |||
19 | ifneq ($(strip $(SYSKLOGD-y)),) | ||
20 | libraries-y+=$(SYSKLOGD_DIR)$(SYSKLOGD_AR) | ||
21 | endif | ||
22 | |||
23 | SYSKLOGD_SRC-y:=$(patsubst %.o,$(srcdir)/%.c,$(SYSKLOGD-y)) | ||
24 | SYSKLOGD_SRC-a:=$(wildcard $(srcdir)/*.c) | ||
25 | APPLET_SRC-y+=$(SYSKLOGD_SRC-y) | ||
26 | APPLET_SRC-a+=$(SYSKLOGD_SRC-a) | ||
27 | |||
28 | $(SYSKLOGD_DIR)$(SYSKLOGD_AR): $(patsubst %,$(SYSKLOGD_DIR)%, $(SYSKLOGD-y)) | ||
29 | $(do_ar) | ||
30 | |||
31 | $(SYSKLOGD_DIR)%.o: $(srcdir)/%.c | ||
32 | $(compile.c) | ||
diff --git a/util-linux/Config.in b/util-linux/Config.in index a215e250f..a6640e19d 100644 --- a/util-linux/Config.in +++ b/util-linux/Config.in | |||
@@ -5,7 +5,7 @@ | |||
5 | 5 | ||
6 | menu "Linux System Utilities" | 6 | menu "Linux System Utilities" |
7 | 7 | ||
8 | config CONFIG_DMESG | 8 | config DMESG |
9 | bool "dmesg" | 9 | bool "dmesg" |
10 | default n | 10 | default n |
11 | help | 11 | help |
@@ -17,10 +17,10 @@ config CONFIG_DMESG | |||
17 | are also logged to the system console. Enable this option if you | 17 | are also logged to the system console. Enable this option if you |
18 | wish to enable the 'dmesg' utility. | 18 | wish to enable the 'dmesg' utility. |
19 | 19 | ||
20 | config CONFIG_FEATURE_DMESG_PRETTY | 20 | config FEATURE_DMESG_PRETTY |
21 | bool "pretty dmesg output" | 21 | bool "pretty dmesg output" |
22 | default y | 22 | default y |
23 | depends on CONFIG_DMESG | 23 | depends on DMESG |
24 | help | 24 | help |
25 | If you wish to scrub the syslog level from the output, say 'Y' here. | 25 | If you wish to scrub the syslog level from the output, say 'Y' here. |
26 | The syslog level is a string prefixed to every line with the form "<#>". | 26 | The syslog level is a string prefixed to every line with the form "<#>". |
@@ -37,7 +37,7 @@ config CONFIG_FEATURE_DMESG_PRETTY | |||
37 | <6>BIOS-provided physical RAM map: | 37 | <6>BIOS-provided physical RAM map: |
38 | <6> BIOS-e820: 0000000000000000 - 000000000009f000 (usable) | 38 | <6> BIOS-e820: 0000000000000000 - 000000000009f000 (usable) |
39 | 39 | ||
40 | config CONFIG_FBSET | 40 | config FBSET |
41 | bool "fbset" | 41 | bool "fbset" |
42 | default n | 42 | default n |
43 | help | 43 | help |
@@ -46,26 +46,26 @@ config CONFIG_FBSET | |||
46 | interface to access a graphics display. Enable this option | 46 | interface to access a graphics display. Enable this option |
47 | if you wish to enable the 'fbset' utility. | 47 | if you wish to enable the 'fbset' utility. |
48 | 48 | ||
49 | config CONFIG_FEATURE_FBSET_FANCY | 49 | config FEATURE_FBSET_FANCY |
50 | bool "Turn on extra fbset options" | 50 | bool "Turn on extra fbset options" |
51 | default n | 51 | default n |
52 | depends on CONFIG_FBSET | 52 | depends on FBSET |
53 | help | 53 | help |
54 | This option enables extended fbset options, allowing one to set the | 54 | This option enables extended fbset options, allowing one to set the |
55 | framebuffer size, color depth, etc. interface to access a graphics | 55 | framebuffer size, color depth, etc. interface to access a graphics |
56 | display. Enable this option if you wish to enable extended fbset | 56 | display. Enable this option if you wish to enable extended fbset |
57 | options. | 57 | options. |
58 | 58 | ||
59 | config CONFIG_FEATURE_FBSET_READMODE | 59 | config FEATURE_FBSET_READMODE |
60 | bool "Turn on fbset readmode support" | 60 | bool "Turn on fbset readmode support" |
61 | default n | 61 | default n |
62 | depends on CONFIG_FBSET | 62 | depends on FBSET |
63 | help | 63 | help |
64 | This option allows fbset to read the video mode database stored by | 64 | This option allows fbset to read the video mode database stored by |
65 | default as /etc/fb.modes, which can be used to set frame buffer | 65 | default as /etc/fb.modes, which can be used to set frame buffer |
66 | device to pre-defined video modes. | 66 | device to pre-defined video modes. |
67 | 67 | ||
68 | config CONFIG_FDFLUSH | 68 | config FDFLUSH |
69 | bool "fdflush" | 69 | bool "fdflush" |
70 | default n | 70 | default n |
71 | help | 71 | help |
@@ -77,13 +77,13 @@ config CONFIG_FDFLUSH | |||
77 | you change a disk. Most people have working hardware and can safely | 77 | you change a disk. Most people have working hardware and can safely |
78 | leave this disabled. | 78 | leave this disabled. |
79 | 79 | ||
80 | config CONFIG_FDFORMAT | 80 | config FDFORMAT |
81 | bool "fdformat" | 81 | bool "fdformat" |
82 | default n | 82 | default n |
83 | help | 83 | help |
84 | fdformat is used to low-level format a floppy disk. | 84 | fdformat is used to low-level format a floppy disk. |
85 | 85 | ||
86 | config CONFIG_FDISK | 86 | config FDISK |
87 | bool "fdisk" | 87 | bool "fdisk" |
88 | default n | 88 | default n |
89 | help | 89 | help |
@@ -95,62 +95,62 @@ config CONFIG_FDISK | |||
95 | config FDISK_SUPPORT_LARGE_DISKS | 95 | config FDISK_SUPPORT_LARGE_DISKS |
96 | bool "support over 4GB disks" | 96 | bool "support over 4GB disks" |
97 | default y | 97 | default y |
98 | depends on CONFIG_FDISK | 98 | depends on FDISK |
99 | help | 99 | help |
100 | Enable this option to support large disks > 4GB. | 100 | Enable this option to support large disks > 4GB. |
101 | 101 | ||
102 | config CONFIG_FEATURE_FDISK_WRITABLE | 102 | config FEATURE_FDISK_WRITABLE |
103 | bool "Write support" | 103 | bool "Write support" |
104 | default y | 104 | default y |
105 | depends on CONFIG_FDISK | 105 | depends on FDISK |
106 | help | 106 | help |
107 | Enabling this option allows you to create or change a partition table | 107 | Enabling this option allows you to create or change a partition table |
108 | and write those changes out to disk. If you leave this option | 108 | and write those changes out to disk. If you leave this option |
109 | disabled, you will only be able to view the partition table. | 109 | disabled, you will only be able to view the partition table. |
110 | 110 | ||
111 | config CONFIG_FEATURE_AIX_LABEL | 111 | config FEATURE_AIX_LABEL |
112 | bool "Support AIX disklabels" | 112 | bool "Support AIX disklabels" |
113 | default n | 113 | default n |
114 | depends on CONFIG_FDISK && CONFIG_FEATURE_FDISK_WRITABLE | 114 | depends on FDISK && FEATURE_FDISK_WRITABLE |
115 | help | 115 | help |
116 | Enabling this option allows you to create or change AIX disklabels. | 116 | Enabling this option allows you to create or change AIX disklabels. |
117 | Most people can safely leave this option disabled. | 117 | Most people can safely leave this option disabled. |
118 | 118 | ||
119 | config CONFIG_FEATURE_SGI_LABEL | 119 | config FEATURE_SGI_LABEL |
120 | bool "Support SGI disklabels" | 120 | bool "Support SGI disklabels" |
121 | default n | 121 | default n |
122 | depends on CONFIG_FDISK && CONFIG_FEATURE_FDISK_WRITABLE | 122 | depends on FDISK && FEATURE_FDISK_WRITABLE |
123 | help | 123 | help |
124 | Enabling this option allows you to create or change SGI disklabels. | 124 | Enabling this option allows you to create or change SGI disklabels. |
125 | Most people can safely leave this option disabled. | 125 | Most people can safely leave this option disabled. |
126 | 126 | ||
127 | config CONFIG_FEATURE_SUN_LABEL | 127 | config FEATURE_SUN_LABEL |
128 | bool "Support SUN disklabels" | 128 | bool "Support SUN disklabels" |
129 | default n | 129 | default n |
130 | depends on CONFIG_FDISK && CONFIG_FEATURE_FDISK_WRITABLE | 130 | depends on FDISK && FEATURE_FDISK_WRITABLE |
131 | help | 131 | help |
132 | Enabling this option allows you to create or change SUN disklabels. | 132 | Enabling this option allows you to create or change SUN disklabels. |
133 | Most people can safely leave this option disabled. | 133 | Most people can safely leave this option disabled. |
134 | 134 | ||
135 | config CONFIG_FEATURE_OSF_LABEL | 135 | config FEATURE_OSF_LABEL |
136 | bool "Support BSD disklabels" | 136 | bool "Support BSD disklabels" |
137 | default n | 137 | default n |
138 | depends on CONFIG_FDISK && CONFIG_FEATURE_FDISK_WRITABLE | 138 | depends on FDISK && FEATURE_FDISK_WRITABLE |
139 | help | 139 | help |
140 | Enabling this option allows you to create or change BSD disklabels | 140 | Enabling this option allows you to create or change BSD disklabels |
141 | and define and edit BSD disk slices. | 141 | and define and edit BSD disk slices. |
142 | 142 | ||
143 | config CONFIG_FEATURE_FDISK_ADVANCED | 143 | config FEATURE_FDISK_ADVANCED |
144 | bool "Support expert mode" | 144 | bool "Support expert mode" |
145 | default n | 145 | default n |
146 | depends on CONFIG_FDISK && CONFIG_FEATURE_FDISK_WRITABLE | 146 | depends on FDISK && FEATURE_FDISK_WRITABLE |
147 | help | 147 | help |
148 | Enabling this option allows you to do terribly unsafe things like | 148 | Enabling this option allows you to do terribly unsafe things like |
149 | define arbitrary drive geometry, move the beginning of data in a | 149 | define arbitrary drive geometry, move the beginning of data in a |
150 | partition, and similarly evil things. Unless you have a very good | 150 | partition, and similarly evil things. Unless you have a very good |
151 | reason you would be wise to leave this disabled. | 151 | reason you would be wise to leave this disabled. |
152 | 152 | ||
153 | config CONFIG_FREERAMDISK | 153 | config FREERAMDISK |
154 | bool "freeramdisk" | 154 | bool "freeramdisk" |
155 | default n | 155 | default n |
156 | help | 156 | help |
@@ -161,7 +161,7 @@ config CONFIG_FREERAMDISK | |||
161 | ramdisk. If you have no use for freeing memory from a ramdisk, leave | 161 | ramdisk. If you have no use for freeing memory from a ramdisk, leave |
162 | this disabled. | 162 | this disabled. |
163 | 163 | ||
164 | config CONFIG_FSCK_MINIX | 164 | config FSCK_MINIX |
165 | bool "fsck_minix" | 165 | bool "fsck_minix" |
166 | default n | 166 | default n |
167 | help | 167 | help |
@@ -172,7 +172,7 @@ config CONFIG_FSCK_MINIX | |||
172 | check for and attempt to repair any corruption that occurs to a minix | 172 | check for and attempt to repair any corruption that occurs to a minix |
173 | filesystem. | 173 | filesystem. |
174 | 174 | ||
175 | config CONFIG_MKFS_MINIX | 175 | config MKFS_MINIX |
176 | bool "mkfs_minix" | 176 | bool "mkfs_minix" |
177 | default n | 177 | default n |
178 | help | 178 | help |
@@ -181,18 +181,18 @@ config CONFIG_MKFS_MINIX | |||
181 | this utility will do the job for you. | 181 | this utility will do the job for you. |
182 | 182 | ||
183 | comment "Minix filesystem support" | 183 | comment "Minix filesystem support" |
184 | depends on CONFIG_FSCK_MINIX || CONFIG_MKFS_MINIX | 184 | depends on FSCK_MINIX || MKFS_MINIX |
185 | 185 | ||
186 | config CONFIG_FEATURE_MINIX2 | 186 | config FEATURE_MINIX2 |
187 | bool "Support Minix fs v2 (fsck_minix/mkfs_minix)" | 187 | bool "Support Minix fs v2 (fsck_minix/mkfs_minix)" |
188 | default y | 188 | default y |
189 | depends on CONFIG_FSCK_MINIX || CONFIG_MKFS_MINIX | 189 | depends on FSCK_MINIX || MKFS_MINIX |
190 | help | 190 | help |
191 | If you wish to be able to create version 2 minix filesystems, enable this. | 191 | If you wish to be able to create version 2 minix filesystems, enable this. |
192 | If you enabled 'mkfs_minix' then you almost certainly want to be using the | 192 | If you enabled 'mkfs_minix' then you almost certainly want to be using the |
193 | version 2 filesystem support. | 193 | version 2 filesystem support. |
194 | 194 | ||
195 | config CONFIG_GETOPT | 195 | config GETOPT |
196 | bool "getopt" | 196 | bool "getopt" |
197 | default n | 197 | default n |
198 | help | 198 | help |
@@ -203,14 +203,14 @@ config CONFIG_GETOPT | |||
203 | written by others, this utility may be for you. Most people will | 203 | written by others, this utility may be for you. Most people will |
204 | wisely leave this disabled. | 204 | wisely leave this disabled. |
205 | 205 | ||
206 | config CONFIG_HEXDUMP | 206 | config HEXDUMP |
207 | bool "hexdump" | 207 | bool "hexdump" |
208 | default n | 208 | default n |
209 | help | 209 | help |
210 | The hexdump utility is used to display binary data in a readable | 210 | The hexdump utility is used to display binary data in a readable |
211 | way that is comparable to the output from most hex editors. | 211 | way that is comparable to the output from most hex editors. |
212 | 212 | ||
213 | config CONFIG_HWCLOCK | 213 | config HWCLOCK |
214 | bool "hwclock" | 214 | bool "hwclock" |
215 | default n | 215 | default n |
216 | help | 216 | help |
@@ -219,19 +219,19 @@ config CONFIG_HWCLOCK | |||
219 | shutdown in the hardware clock, so the hardware will keep the | 219 | shutdown in the hardware clock, so the hardware will keep the |
220 | correct time when Linux is _not_ running. | 220 | correct time when Linux is _not_ running. |
221 | 221 | ||
222 | config CONFIG_FEATURE_HWCLOCK_LONG_OPTIONS | 222 | config FEATURE_HWCLOCK_LONG_OPTIONS |
223 | bool "Support long options (--hctosys,...)" | 223 | bool "Support long options (--hctosys,...)" |
224 | default n | 224 | default n |
225 | depends on CONFIG_HWCLOCK && CONFIG_GETOPT_LONG | 225 | depends on HWCLOCK && GETOPT_LONG |
226 | help | 226 | help |
227 | By default, the hwclock utility only uses short options. If you | 227 | By default, the hwclock utility only uses short options. If you |
228 | are overly fond of its long options, such as --hctosys, --utc, etc) | 228 | are overly fond of its long options, such as --hctosys, --utc, etc) |
229 | then enable this option. | 229 | then enable this option. |
230 | 230 | ||
231 | config CONFIG_FEATURE_HWCLOCK_ADJTIME_FHS | 231 | config FEATURE_HWCLOCK_ADJTIME_FHS |
232 | bool "Use FHS /var/lib/hwclock/adjtime" | 232 | bool "Use FHS /var/lib/hwclock/adjtime" |
233 | default y | 233 | default y |
234 | depends on CONFIG_HWCLOCK | 234 | depends on HWCLOCK |
235 | help | 235 | help |
236 | Starting with FHS 2.3, the adjtime state file is supposed to exist | 236 | Starting with FHS 2.3, the adjtime state file is supposed to exist |
237 | at /var/lib/hwclock/adjtime instead of /etc/adjtime. If you wish | 237 | at /var/lib/hwclock/adjtime instead of /etc/adjtime. If you wish |
@@ -240,24 +240,24 @@ config CONFIG_FEATURE_HWCLOCK_ADJTIME_FHS | |||
240 | 240 | ||
241 | http://www.pathname.com/fhs/pub/fhs-2.3.html#VARLIBHWCLOCKSTATEDIRECTORYFORHWCLO | 241 | http://www.pathname.com/fhs/pub/fhs-2.3.html#VARLIBHWCLOCKSTATEDIRECTORYFORHWCLO |
242 | 242 | ||
243 | config CONFIG_IPCRM | 243 | config IPCRM |
244 | bool "ipcrm" | 244 | bool "ipcrm" |
245 | default n | 245 | default n |
246 | select CONFIG_FEATURE_SUID | 246 | select FEATURE_SUID |
247 | help | 247 | help |
248 | The ipcrm utility allows the removal of System V interprocess | 248 | The ipcrm utility allows the removal of System V interprocess |
249 | communication (IPC) objects and the associated data structures | 249 | communication (IPC) objects and the associated data structures |
250 | from the system. | 250 | from the system. |
251 | 251 | ||
252 | config CONFIG_IPCS | 252 | config IPCS |
253 | bool "ipcs" | 253 | bool "ipcs" |
254 | default n | 254 | default n |
255 | select CONFIG_FEATURE_SUID | 255 | select FEATURE_SUID |
256 | help | 256 | help |
257 | The ipcs utility is used to provide information on the currently | 257 | The ipcs utility is used to provide information on the currently |
258 | allocated System V interprocess (IPC) objects in the system. | 258 | allocated System V interprocess (IPC) objects in the system. |
259 | 259 | ||
260 | config CONFIG_LOSETUP | 260 | config LOSETUP |
261 | bool "losetup" | 261 | bool "losetup" |
262 | default n | 262 | default n |
263 | help | 263 | help |
@@ -265,7 +265,7 @@ config CONFIG_LOSETUP | |||
265 | file or block device, and to query the status of a loop device. This | 265 | file or block device, and to query the status of a loop device. This |
266 | version does not currently support enabling data encryption. | 266 | version does not currently support enabling data encryption. |
267 | 267 | ||
268 | config CONFIG_MDEV | 268 | config MDEV |
269 | bool "mdev" | 269 | bool "mdev" |
270 | default n | 270 | default n |
271 | help | 271 | help |
@@ -274,10 +274,10 @@ config CONFIG_MDEV | |||
274 | have it handle hotplug events afterwards. Device names are taken | 274 | have it handle hotplug events afterwards. Device names are taken |
275 | from sysfs. | 275 | from sysfs. |
276 | 276 | ||
277 | config CONFIG_FEATURE_MDEV_CONF | 277 | config FEATURE_MDEV_CONF |
278 | bool "Support /etc/mdev.conf" | 278 | bool "Support /etc/mdev.conf" |
279 | default n | 279 | default n |
280 | depends on CONFIG_MDEV | 280 | depends on MDEV |
281 | help | 281 | help |
282 | The mdev config file contains lines that look like: | 282 | The mdev config file contains lines that look like: |
283 | 283 | ||
@@ -289,10 +289,10 @@ config CONFIG_FEATURE_MDEV_CONF | |||
289 | entry is matched, devices are created with default 0:0 660. (Make | 289 | entry is matched, devices are created with default 0:0 660. (Make |
290 | the last line match .* to override this.) | 290 | the last line match .* to override this.) |
291 | 291 | ||
292 | config CONFIG_FEATURE_MDEV_EXEC | 292 | config FEATURE_MDEV_EXEC |
293 | bool "Support command execution at device addition/removal" | 293 | bool "Support command execution at device addition/removal" |
294 | default n | 294 | default n |
295 | depends on CONFIG_FEATURE_MDEV_CONF | 295 | depends on FEATURE_MDEV_CONF |
296 | help | 296 | help |
297 | This adds support for an optional field to /etc/mdev.conf, consisting | 297 | This adds support for an optional field to /etc/mdev.conf, consisting |
298 | of a special character and a command line to run after creating the | 298 | of a special character and a command line to run after creating the |
@@ -310,7 +310,7 @@ config CONFIG_FEATURE_MDEV_EXEC | |||
310 | Commands are executed via system() so you need /bin/sh, meaning you | 310 | Commands are executed via system() so you need /bin/sh, meaning you |
311 | probably want to select a default shell in the Shells menu. | 311 | probably want to select a default shell in the Shells menu. |
312 | 312 | ||
313 | config CONFIG_MKSWAP | 313 | config MKSWAP |
314 | bool "mkswap" | 314 | bool "mkswap" |
315 | default n | 315 | default n |
316 | help | 316 | help |
@@ -323,17 +323,17 @@ config CONFIG_MKSWAP | |||
323 | Once you have created swap space using 'mkswap' you need to enable | 323 | Once you have created swap space using 'mkswap' you need to enable |
324 | the swap space using the 'swapon' utility. | 324 | the swap space using the 'swapon' utility. |
325 | 325 | ||
326 | config CONFIG_FEATURE_MKSWAP_V0 | 326 | config FEATURE_MKSWAP_V0 |
327 | bool "version 0 support" | 327 | bool "version 0 support" |
328 | default n | 328 | default n |
329 | depends on CONFIG_MKSWAP | 329 | depends on MKSWAP |
330 | # depends on CONFIG_MKSWAP && CONFIG_DEPRECATED | 330 | # depends on MKSWAP && DEPRECATED |
331 | help | 331 | help |
332 | Enable support for the old v0 style. | 332 | Enable support for the old v0 style. |
333 | If your kernel is older than 2.1.117, then v0 support is the | 333 | If your kernel is older than 2.1.117, then v0 support is the |
334 | only option. | 334 | only option. |
335 | 335 | ||
336 | config CONFIG_MORE | 336 | config MORE |
337 | bool "more" | 337 | bool "more" |
338 | default n | 338 | default n |
339 | help | 339 | help |
@@ -343,10 +343,10 @@ config CONFIG_MORE | |||
343 | you will probably find this utility very helpful. If you don't have | 343 | you will probably find this utility very helpful. If you don't have |
344 | any need to reading text files, you can leave this disabled. | 344 | any need to reading text files, you can leave this disabled. |
345 | 345 | ||
346 | config CONFIG_FEATURE_USE_TERMIOS | 346 | config FEATURE_USE_TERMIOS |
347 | bool "Use termios to manipulate the screen" | 347 | bool "Use termios to manipulate the screen" |
348 | default y | 348 | default y |
349 | depends on CONFIG_MORE | 349 | depends on MORE |
350 | help | 350 | help |
351 | This option allows utilities such as 'more' and 'top' to determine | 351 | This option allows utilities such as 'more' and 'top' to determine |
352 | the size of the screen. If you leave this disabled, your utilities | 352 | the size of the screen. If you leave this disabled, your utilities |
@@ -354,7 +354,7 @@ config CONFIG_FEATURE_USE_TERMIOS | |||
354 | will be unable to determine the current screen size, and will be | 354 | will be unable to determine the current screen size, and will be |
355 | unable to move the cursor. | 355 | unable to move the cursor. |
356 | 356 | ||
357 | config CONFIG_MOUNT | 357 | config MOUNT |
358 | bool "mount" | 358 | bool "mount" |
359 | default n | 359 | default n |
360 | help | 360 | help |
@@ -365,23 +365,23 @@ config CONFIG_MOUNT | |||
365 | NFS filesystems. Most people using BusyBox will also want to enable | 365 | NFS filesystems. Most people using BusyBox will also want to enable |
366 | the 'mount' utility. | 366 | the 'mount' utility. |
367 | 367 | ||
368 | config CONFIG_FEATURE_MOUNT_NFS | 368 | config FEATURE_MOUNT_NFS |
369 | bool "Support mounting NFS file systems" | 369 | bool "Support mounting NFS file systems" |
370 | default n | 370 | default n |
371 | depends on CONFIG_MOUNT | 371 | depends on MOUNT |
372 | select CONFIG_FEATURE_SYSLOG | 372 | select FEATURE_SYSLOG |
373 | help | 373 | help |
374 | Enable mounting of NFS file systems. | 374 | Enable mounting of NFS file systems. |
375 | 375 | ||
376 | config CONFIG_FEATURE_MOUNT_CIFS | 376 | config FEATURE_MOUNT_CIFS |
377 | bool "Support mounting CIFS/SMB file systems" | 377 | bool "Support mounting CIFS/SMB file systems" |
378 | default n | 378 | default n |
379 | depends on CONFIG_MOUNT | 379 | depends on MOUNT |
380 | help | 380 | help |
381 | Enable support for samba mounts. | 381 | Enable support for samba mounts. |
382 | 382 | ||
383 | config CONFIG_FEATURE_MOUNT_FLAGS | 383 | config FEATURE_MOUNT_FLAGS |
384 | depends on CONFIG_MOUNT | 384 | depends on MOUNT |
385 | bool "Support lots of -o flags in mount" | 385 | bool "Support lots of -o flags in mount" |
386 | default y | 386 | default y |
387 | help | 387 | help |
@@ -390,14 +390,14 @@ config CONFIG_FEATURE_MOUNT_FLAGS | |||
390 | noatime, diratime, nodiratime, loud, bind, move, shared, slave, | 390 | noatime, diratime, nodiratime, loud, bind, move, shared, slave, |
391 | private, unbindable, rshared, rslave, rprivate, and runbindable. | 391 | private, unbindable, rshared, rslave, rprivate, and runbindable. |
392 | 392 | ||
393 | config CONFIG_FEATURE_MOUNT_FSTAB | 393 | config FEATURE_MOUNT_FSTAB |
394 | depends on CONFIG_MOUNT | 394 | depends on MOUNT |
395 | bool "Support /etc/fstab and -a" | 395 | bool "Support /etc/fstab and -a" |
396 | default y | 396 | default y |
397 | help | 397 | help |
398 | Support mount all and looking for files in /etc/fstab. | 398 | Support mount all and looking for files in /etc/fstab. |
399 | 399 | ||
400 | config CONFIG_PIVOT_ROOT | 400 | config PIVOT_ROOT |
401 | bool "pivot_root" | 401 | bool "pivot_root" |
402 | default n | 402 | default n |
403 | help | 403 | help |
@@ -409,7 +409,7 @@ config CONFIG_PIVOT_ROOT | |||
409 | Note: This is for initrd in linux 2.4. Under initramfs (introduced | 409 | Note: This is for initrd in linux 2.4. Under initramfs (introduced |
410 | in linux 2.6) use switch_root instead. | 410 | in linux 2.6) use switch_root instead. |
411 | 411 | ||
412 | config CONFIG_RDATE | 412 | config RDATE |
413 | bool "rdate" | 413 | bool "rdate" |
414 | default n | 414 | default n |
415 | help | 415 | help |
@@ -418,13 +418,13 @@ config CONFIG_RDATE | |||
418 | the RFC868 protocol, which is built into the inetd daemon on most | 418 | the RFC868 protocol, which is built into the inetd daemon on most |
419 | systems. | 419 | systems. |
420 | 420 | ||
421 | config CONFIG_READPROFILE | 421 | config READPROFILE |
422 | bool "readprofile" | 422 | bool "readprofile" |
423 | default n | 423 | default n |
424 | help | 424 | help |
425 | This allows you to parse /proc/profile for basic profiling. | 425 | This allows you to parse /proc/profile for basic profiling. |
426 | 426 | ||
427 | config CONFIG_SETARCH | 427 | config SETARCH |
428 | bool "setarch" | 428 | bool "setarch" |
429 | default n | 429 | default n |
430 | help | 430 | help |
@@ -433,7 +433,7 @@ config CONFIG_SETARCH | |||
433 | this util on a system that supports both 64bit and 32bit userland | 433 | this util on a system that supports both 64bit and 32bit userland |
434 | (like amd64/x86, ppc64/ppc, sparc64/sparc, etc...). | 434 | (like amd64/x86, ppc64/ppc, sparc64/sparc, etc...). |
435 | 435 | ||
436 | config CONFIG_SWAPONOFF | 436 | config SWAPONOFF |
437 | bool "swaponoff" | 437 | bool "swaponoff" |
438 | default n | 438 | default n |
439 | help | 439 | help |
@@ -444,7 +444,7 @@ config CONFIG_SWAPONOFF | |||
444 | space. If you are not using any swap space, you can leave this | 444 | space. If you are not using any swap space, you can leave this |
445 | option disabled. | 445 | option disabled. |
446 | 446 | ||
447 | config CONFIG_SWITCH_ROOT | 447 | config SWITCH_ROOT |
448 | bool "switch_root" | 448 | bool "switch_root" |
449 | default n | 449 | default n |
450 | help | 450 | help |
@@ -463,7 +463,7 @@ config CONFIG_SWITCH_ROOT | |||
463 | and ending point for searching through the kernel's doubly linked | 463 | and ending point for searching through the kernel's doubly linked |
464 | list of active mount points. That's why. | 464 | list of active mount points. That's why. |
465 | 465 | ||
466 | config CONFIG_UMOUNT | 466 | config UMOUNT |
467 | bool "umount" | 467 | bool "umount" |
468 | default n | 468 | default n |
469 | help | 469 | help |
@@ -472,20 +472,20 @@ config CONFIG_UMOUNT | |||
472 | the tool to use. If you enabled the 'mount' utility, you almost certainly | 472 | the tool to use. If you enabled the 'mount' utility, you almost certainly |
473 | also want to enable 'umount'. | 473 | also want to enable 'umount'. |
474 | 474 | ||
475 | config CONFIG_FEATURE_UMOUNT_ALL | 475 | config FEATURE_UMOUNT_ALL |
476 | bool "umount -a option" | 476 | bool "umount -a option" |
477 | default n | 477 | default n |
478 | depends on CONFIG_UMOUNT | 478 | depends on UMOUNT |
479 | help | 479 | help |
480 | Support -a option to unmount all currently mounted filesystems. | 480 | Support -a option to unmount all currently mounted filesystems. |
481 | 481 | ||
482 | comment "Common options for mount/umount" | 482 | comment "Common options for mount/umount" |
483 | depends on CONFIG_MOUNT || CONFIG_UMOUNT | 483 | depends on MOUNT || UMOUNT |
484 | 484 | ||
485 | config CONFIG_FEATURE_MOUNT_LOOP | 485 | config FEATURE_MOUNT_LOOP |
486 | bool "Support loopback mounts" | 486 | bool "Support loopback mounts" |
487 | default n | 487 | default n |
488 | depends on CONFIG_MOUNT || CONFIG_UMOUNT | 488 | depends on MOUNT || UMOUNT |
489 | help | 489 | help |
490 | Enabling this feature allows automatic mounting of files (containing | 490 | Enabling this feature allows automatic mounting of files (containing |
491 | filesystem images) via the linux kernel's loopback devices. The mount | 491 | filesystem images) via the linux kernel's loopback devices. The mount |
@@ -498,10 +498,10 @@ config CONFIG_FEATURE_MOUNT_LOOP | |||
498 | specify an offset or cryptographic options to the loopback device. | 498 | specify an offset or cryptographic options to the loopback device. |
499 | (If you don't want umount to free the loop device, use "umount -D".) | 499 | (If you don't want umount to free the loop device, use "umount -D".) |
500 | 500 | ||
501 | config CONFIG_FEATURE_MTAB_SUPPORT | 501 | config FEATURE_MTAB_SUPPORT |
502 | bool "Support for the old /etc/mtab file" | 502 | bool "Support for the old /etc/mtab file" |
503 | default n | 503 | default n |
504 | depends on CONFIG_MOUNT || CONFIG_UMOUNT | 504 | depends on MOUNT || UMOUNT |
505 | help | 505 | help |
506 | Historically, Unix systems kept track of the currently mounted | 506 | Historically, Unix systems kept track of the currently mounted |
507 | partitions in the file "/etc/mtab". These days, the kernel exports | 507 | partitions in the file "/etc/mtab". These days, the kernel exports |
diff --git a/util-linux/Kbuild b/util-linux/Kbuild new file mode 100644 index 000000000..cc1d0e05d --- /dev/null +++ b/util-linux/Kbuild | |||
@@ -0,0 +1,32 @@ | |||
1 | # Makefile for busybox | ||
2 | # | ||
3 | # Copyright (C) 1999-2005 by Erik Andersen <andersen@codepoet.org> | ||
4 | # | ||
5 | # Licensed under the GPL v2, see the file LICENSE in this tarball. | ||
6 | |||
7 | lib-y:= | ||
8 | lib-$(CONFIG_DMESG) +=dmesg.o | ||
9 | lib-$(CONFIG_FBSET) +=fbset.o | ||
10 | lib-$(CONFIG_FDFLUSH) +=freeramdisk.o | ||
11 | lib-$(CONFIG_FDFORMAT) +=fdformat.o | ||
12 | lib-$(CONFIG_FDISK) +=fdisk.o | ||
13 | lib-$(CONFIG_FREERAMDISK) +=freeramdisk.o | ||
14 | lib-$(CONFIG_FSCK_MINIX) +=fsck_minix.o | ||
15 | lib-$(CONFIG_GETOPT) +=getopt.o | ||
16 | lib-$(CONFIG_HEXDUMP) +=hexdump.o | ||
17 | lib-$(CONFIG_HWCLOCK) +=hwclock.o | ||
18 | lib-$(CONFIG_IPCRM) +=ipcrm.o | ||
19 | lib-$(CONFIG_IPCS) +=ipcs.o | ||
20 | lib-$(CONFIG_LOSETUP) +=losetup.o | ||
21 | lib-$(CONFIG_MDEV) +=mdev.o | ||
22 | lib-$(CONFIG_MKFS_MINIX) +=mkfs_minix.o | ||
23 | lib-$(CONFIG_MKSWAP) +=mkswap.o | ||
24 | lib-$(CONFIG_MORE) +=more.o | ||
25 | lib-$(CONFIG_MOUNT) +=mount.o | ||
26 | lib-$(CONFIG_PIVOT_ROOT) +=pivot_root.o | ||
27 | lib-$(CONFIG_RDATE) +=rdate.o | ||
28 | lib-$(CONFIG_READPROFILE) +=readprofile.o | ||
29 | lib-$(CONFIG_SETARCH) +=setarch.o | ||
30 | lib-$(CONFIG_SWAPONOFF) +=swaponoff.o | ||
31 | lib-$(CONFIG_SWITCH_ROOT) +=switch_root.o | ||
32 | lib-$(CONFIG_UMOUNT) +=umount.o | ||
diff --git a/util-linux/Makefile b/util-linux/Makefile deleted file mode 100644 index 9a53470a4..000000000 --- a/util-linux/Makefile +++ /dev/null | |||
@@ -1,22 +0,0 @@ | |||
1 | # Makefile for busybox | ||
2 | # | ||
3 | # Copyright (C) 1999-2005 by Erik Andersen <andersen@codepoet.org> | ||
4 | # | ||
5 | # Licensed under the GPL v2, see the file LICENSE in this tarball. | ||
6 | |||
7 | ifndef top_srcdir | ||
8 | top_srcdir=.. | ||
9 | endif | ||
10 | ifndef top_builddir | ||
11 | top_builddir=.. | ||
12 | endif | ||
13 | srcdir=$(top_srcdir)/util-linux | ||
14 | UTILLINUX_DIR:=./ | ||
15 | include $(top_srcdir)/Rules.mak | ||
16 | include $(top_builddir)/.config | ||
17 | include Makefile.in | ||
18 | all: $(libraries-y) | ||
19 | -include $(top_builddir)/.depend | ||
20 | |||
21 | clean: | ||
22 | rm -f *.o *.a $(AR_TARGET) | ||
diff --git a/util-linux/Makefile.in b/util-linux/Makefile.in deleted file mode 100644 index 3d6c96a35..000000000 --- a/util-linux/Makefile.in +++ /dev/null | |||
@@ -1,62 +0,0 @@ | |||
1 | # Makefile for busybox | ||
2 | # | ||
3 | # Copyright (C) 1999-2005 by Erik Andersen <andersen@codepoet.org> | ||
4 | # | ||
5 | # Licensed under the GPL v2, see the file LICENSE in this tarball. | ||
6 | |||
7 | UTILLINUX_AR:=util-linux.a | ||
8 | ifndef $(UTILLINUX_DIR) | ||
9 | UTILLINUX_DIR:=$(top_builddir)/util-linux/ | ||
10 | endif | ||
11 | srcdir=$(top_srcdir)/util-linux | ||
12 | |||
13 | UTILLINUX-y:= | ||
14 | UTILLINUX-$(CONFIG_DMESG) +=dmesg.o | ||
15 | UTILLINUX-$(CONFIG_FBSET) +=fbset.o | ||
16 | UTILLINUX-$(CONFIG_FDFLUSH) +=freeramdisk.o | ||
17 | UTILLINUX-$(CONFIG_FDFORMAT) +=fdformat.o | ||
18 | UTILLINUX-$(CONFIG_FDISK) +=fdisk.o | ||
19 | UTILLINUX-$(CONFIG_FREERAMDISK) +=freeramdisk.o | ||
20 | UTILLINUX-$(CONFIG_FSCK_MINIX) +=fsck_minix.o | ||
21 | UTILLINUX-$(CONFIG_GETOPT) +=getopt.o | ||
22 | UTILLINUX-$(CONFIG_HEXDUMP) +=hexdump.o | ||
23 | UTILLINUX-$(CONFIG_HWCLOCK) +=hwclock.o | ||
24 | UTILLINUX-$(CONFIG_IPCRM) +=ipcrm.o | ||
25 | UTILLINUX-$(CONFIG_IPCS) +=ipcs.o | ||
26 | UTILLINUX-$(CONFIG_LOSETUP) +=losetup.o | ||
27 | UTILLINUX-$(CONFIG_MDEV) +=mdev.o | ||
28 | UTILLINUX-$(CONFIG_MKFS_MINIX) +=mkfs_minix.o | ||
29 | UTILLINUX-$(CONFIG_MKSWAP) +=mkswap.o | ||
30 | UTILLINUX-$(CONFIG_MORE) +=more.o | ||
31 | UTILLINUX-$(CONFIG_MOUNT) +=mount.o | ||
32 | UTILLINUX-$(CONFIG_PIVOT_ROOT) +=pivot_root.o | ||
33 | UTILLINUX-$(CONFIG_RDATE) +=rdate.o | ||
34 | UTILLINUX-$(CONFIG_READPROFILE) +=readprofile.o | ||
35 | UTILLINUX-$(CONFIG_SETARCH) +=setarch.o | ||
36 | UTILLINUX-$(CONFIG_SWAPONOFF) +=swaponoff.o | ||
37 | UTILLINUX-$(CONFIG_SWITCH_ROOT) +=switch_root.o | ||
38 | UTILLINUX-$(CONFIG_UMOUNT) +=umount.o | ||
39 | |||
40 | UTILLINUX-y:=$(sort $(UTILLINUX-y)) | ||
41 | |||
42 | ifneq ($(strip $(UTILLINUX-y)),) | ||
43 | libraries-y+=$(UTILLINUX_DIR)$(UTILLINUX_AR) | ||
44 | endif | ||
45 | |||
46 | UTILLINUX_SRC-y:=$(patsubst %.o,$(srcdir)/%.c,$(UTILLINUX-y)) | ||
47 | UTILLINUX_SRC-a:=$(wildcard $(srcdir)/*.c) | ||
48 | APPLET_SRC-y+=$(UTILLINUX_SRC-y) | ||
49 | APPLET_SRC-a+=$(UTILLINUX_SRC-a) | ||
50 | |||
51 | $(UTILLINUX_DIR)$(UTILLINUX_AR): $(patsubst %,$(UTILLINUX_DIR)%, $(UTILLINUX-y)) | ||
52 | $(do_ar) | ||
53 | |||
54 | $(UTILLINUX_DIR)%.o: $(srcdir)/%.c | ||
55 | $(compile.c) | ||
56 | |||
57 | ifneq ($(strip $(CONFIG_LFS)),y) | ||
58 | ifeq ($(strip $(FDISK_SUPPORT_LARGE_DISKS)),y) | ||
59 | $(UTILLINUX_DIR)fdisk.o: $(srcdir)/fdisk.c | ||
60 | $(compile.c) -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 | ||
61 | endif | ||
62 | endif | ||