aboutsummaryrefslogtreecommitdiff
path: root/coreutils
diff options
context:
space:
mode:
Diffstat (limited to 'coreutils')
-rw-r--r--coreutils/Config.src (renamed from coreutils/Config.in)281
-rw-r--r--coreutils/Kbuild.src (renamed from coreutils/Kbuild)12
-rw-r--r--coreutils/basename.c10
-rw-r--r--coreutils/cat.c12
-rw-r--r--coreutils/date.c104
-rw-r--r--coreutils/libcoreutils/Kbuild.src (renamed from coreutils/libcoreutils/Kbuild)0
-rw-r--r--coreutils/test.c20
-rw-r--r--coreutils/tr.c29
-rw-r--r--coreutils/yes.c5
9 files changed, 273 insertions, 200 deletions
diff --git a/coreutils/Config.in b/coreutils/Config.src
index ead632a31..d4c9e0541 100644
--- a/coreutils/Config.in
+++ b/coreutils/Config.src
@@ -5,89 +5,76 @@
5 5
6menu "Coreutils" 6menu "Coreutils"
7 7
8config BASENAME 8INSERT
9 bool "basename"
10 default n
11 help
12 basename is used to strip the directory and suffix from filenames,
13 leaving just the filename itself. Enable this option if you wish
14 to enable the 'basename' utility.
15 9
16config CAL 10config CAL
17 bool "cal" 11 bool "cal"
18 default n 12 default y
19 help 13 help
20 cal is used to display a monthly calender. 14 cal is used to display a monthly calender.
21 15
22config CAT
23 bool "cat"
24 default n
25 help
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.
28
29config CATV 16config CATV
30 bool "catv" 17 bool "catv"
31 default n 18 default y
32 help 19 help
33 Display nonprinting characters as escape sequences (like some 20 Display nonprinting characters as escape sequences (like some
34 implementations' cat -v option). 21 implementations' cat -v option).
35 22
36config CHGRP 23config CHGRP
37 bool "chgrp" 24 bool "chgrp"
38 default n 25 default y
39 help 26 help
40 chgrp is used to change the group ownership of files. 27 chgrp is used to change the group ownership of files.
41 28
42config CHMOD 29config CHMOD
43 bool "chmod" 30 bool "chmod"
44 default n 31 default y
45 help 32 help
46 chmod is used to change the access permission of files. 33 chmod is used to change the access permission of files.
47 34
48config CHOWN 35config CHOWN
49 bool "chown" 36 bool "chown"
50 default n 37 default y
51 help 38 help
52 chown is used to change the user and/or group ownership 39 chown is used to change the user and/or group ownership
53 of files. 40 of files.
54 41
55config FEATURE_CHOWN_LONG_OPTIONS 42config FEATURE_CHOWN_LONG_OPTIONS
56 bool "Enable long options" 43 bool "Enable long options"
57 default n 44 default y
58 depends on CHOWN && LONG_OPTS 45 depends on CHOWN && LONG_OPTS
59 help 46 help
60 Enable use of long options 47 Enable use of long options
61 48
62config CHROOT 49config CHROOT
63 bool "chroot" 50 bool "chroot"
64 default n 51 default y
65 help 52 help
66 chroot is used to change the root directory and run a command. 53 chroot is used to change the root directory and run a command.
67 The default command is `/bin/sh'. 54 The default command is `/bin/sh'.
68 55
69config CKSUM 56config CKSUM
70 bool "cksum" 57 bool "cksum"
71 default n 58 default y
72 help 59 help
73 cksum is used to calculate the CRC32 checksum of a file. 60 cksum is used to calculate the CRC32 checksum of a file.
74 61
75config COMM 62config COMM
76 bool "comm" 63 bool "comm"
77 default n 64 default y
78 help 65 help
79 comm is used to compare two files line by line and return 66 comm is used to compare two files line by line and return
80 a three-column output. 67 a three-column output.
81 68
82config CP 69config CP
83 bool "cp" 70 bool "cp"
84 default n 71 default y
85 help 72 help
86 cp is used to copy files and directories. 73 cp is used to copy files and directories.
87 74
88config FEATURE_CP_LONG_OPTIONS 75config FEATURE_CP_LONG_OPTIONS
89 bool "Enable long options for cp" 76 bool "Enable long options for cp"
90 default n 77 default y
91 depends on CP && LONG_OPTS 78 depends on CP && LONG_OPTS
92 help 79 help
93 Enable long options for cp. 80 Enable long options for cp.
@@ -95,45 +82,14 @@ config FEATURE_CP_LONG_OPTIONS
95 82
96config CUT 83config CUT
97 bool "cut" 84 bool "cut"
98 default n 85 default y
99 help 86 help
100 cut is used to print selected parts of lines from 87 cut is used to print selected parts of lines from
101 each file to stdout. 88 each file to stdout.
102 89
103config DATE
104 bool "date"
105 default n
106 help
107 date is used to set the system date or display the
108 current time in the given format.
109
110config FEATURE_DATE_ISOFMT
111 bool "Enable ISO date format output (-I)"
112 default y
113 depends on DATE
114 help
115 Enable option (-I) to output an ISO-8601 compliant
116 date/time string.
117
118config FEATURE_DATE_COMPAT
119 bool "Support weird 'date MMDDhhmm[[YY]YY][.ss]' format"
120 default y
121 depends on DATE
122 help
123 System time can be set by 'date -s DATE' and simply 'date DATE',
124 but formats of DATE string are different. 'date DATE' accepts
125 a rather weird MMDDhhmm[[YY]YY][.ss] format with completely
126 unnatural placement of year between minutes and seconds.
127 date -s (and other commands like touch -d) use more sensible
128 formats (for one, ISO format YYYY-MM-DD hh:mm:ss.ssssss).
129
130 With this option off, 'date DATE' is 'date -s DATE' support
131 the same format. With it on, 'date DATE' additionally supports
132 MMDDhhmm[[YY]YY][.ss] format.
133
134config DD 90config DD
135 bool "dd" 91 bool "dd"
136 default n 92 default y
137 help 93 help
138 dd copies a file (from standard input to standard output, 94 dd copies a file (from standard input to standard output,
139 by default) using specific input and output blocksizes, 95 by default) using specific input and output blocksizes,
@@ -155,7 +111,7 @@ config FEATURE_DD_SIGNAL_HANDLING
155 111
156config FEATURE_DD_THIRD_STATUS_LINE 112config FEATURE_DD_THIRD_STATUS_LINE
157 bool "Enable the third status line upon signal" 113 bool "Enable the third status line upon signal"
158 default n 114 default y
159 depends on DD && FEATURE_DD_SIGNAL_HANDLING 115 depends on DD && FEATURE_DD_SIGNAL_HANDLING
160 help 116 help
161 Displays a coreutils-like third status line with transferred bytes, 117 Displays a coreutils-like third status line with transferred bytes,
@@ -163,7 +119,7 @@ config FEATURE_DD_THIRD_STATUS_LINE
163 119
164config FEATURE_DD_IBS_OBS 120config FEATURE_DD_IBS_OBS
165 bool "Enable ibs, obs and conv options" 121 bool "Enable ibs, obs and conv options"
166 default n 122 default y
167 depends on DD 123 depends on DD
168 help 124 help
169 Enables support for writing a certain number of bytes in and out, 125 Enables support for writing a certain number of bytes in and out,
@@ -171,14 +127,14 @@ config FEATURE_DD_IBS_OBS
171 127
172config DF 128config DF
173 bool "df" 129 bool "df"
174 default n 130 default y
175 help 131 help
176 df reports the amount of disk space used and available 132 df reports the amount of disk space used and available
177 on filesystems. 133 on filesystems.
178 134
179config FEATURE_DF_FANCY 135config FEATURE_DF_FANCY
180 bool "Enable -a, -i, -B" 136 bool "Enable -a, -i, -B"
181 default n 137 default y
182 depends on DF 138 depends on DF
183 help 139 help
184 This option enables -a, -i and -B. 140 This option enables -a, -i and -B.
@@ -189,14 +145,14 @@ config FEATURE_DF_FANCY
189 145
190config DIRNAME 146config DIRNAME
191 bool "dirname" 147 bool "dirname"
192 default n 148 default y
193 help 149 help
194 dirname is used to strip a non-directory suffix from 150 dirname is used to strip a non-directory suffix from
195 a file name. 151 a file name.
196 152
197config DOS2UNIX 153config DOS2UNIX
198 bool "dos2unix/unix2dos" 154 bool "dos2unix/unix2dos"
199 default n 155 default y
200 help 156 help
201 dos2unix is used to convert a text file from DOS format to 157 dos2unix is used to convert a text file from DOS format to
202 UNIX format, and vice versa. 158 UNIX format, and vice versa.
@@ -211,7 +167,7 @@ config UNIX2DOS
211 167
212config DU 168config DU
213 bool "du (default blocksize of 512 bytes)" 169 bool "du (default blocksize of 512 bytes)"
214 default n 170 default y
215 help 171 help
216 du is used to report the amount of disk space used 172 du is used to report the amount of disk space used
217 for specified files. 173 for specified files.
@@ -225,7 +181,7 @@ config FEATURE_DU_DEFAULT_BLOCKSIZE_1K
225 181
226config ECHO 182config ECHO
227 bool "echo (basic SuSv3 version taking no options)" 183 bool "echo (basic SuSv3 version taking no options)"
228 default n 184 default y
229 help 185 help
230 echo is used to print a specified string to stdout. 186 echo is used to print a specified string to stdout.
231 187
@@ -239,7 +195,7 @@ config FEATURE_FANCY_ECHO
239 195
240config ENV 196config ENV
241 bool "env" 197 bool "env"
242 default n 198 default y
243 help 199 help
244 env is used to set an environment variable and run 200 env is used to set an environment variable and run
245 a command; without options it displays the current 201 a command; without options it displays the current
@@ -247,34 +203,34 @@ config ENV
247 203
248config FEATURE_ENV_LONG_OPTIONS 204config FEATURE_ENV_LONG_OPTIONS
249 bool "Enable long options" 205 bool "Enable long options"
250 default n 206 default y
251 depends on ENV && LONG_OPTS 207 depends on ENV && LONG_OPTS
252 help 208 help
253 Support long options for the env applet. 209 Support long options for the env applet.
254 210
255config EXPAND 211config EXPAND
256 bool "expand" 212 bool "expand"
257 default n 213 default y
258 help 214 help
259 By default, convert all tabs to spaces. 215 By default, convert all tabs to spaces.
260 216
261config FEATURE_EXPAND_LONG_OPTIONS 217config FEATURE_EXPAND_LONG_OPTIONS
262 bool "Enable long options" 218 bool "Enable long options"
263 default n 219 default y
264 depends on EXPAND && LONG_OPTS 220 depends on EXPAND && LONG_OPTS
265 help 221 help
266 Support long options for the expand applet. 222 Support long options for the expand applet.
267 223
268config EXPR 224config EXPR
269 bool "expr" 225 bool "expr"
270 default n 226 default y
271 help 227 help
272 expr is used to calculate numbers and print the result 228 expr is used to calculate numbers and print the result
273 to standard output. 229 to standard output.
274 230
275config EXPR_MATH_SUPPORT_64 231config EXPR_MATH_SUPPORT_64
276 bool "Extend Posix numbers support to 64 bit" 232 bool "Extend Posix numbers support to 64 bit"
277 default n 233 default y
278 depends on EXPR 234 depends on EXPR
279 help 235 help
280 Enable 64-bit math support in the expr applet. This will make 236 Enable 64-bit math support in the expr applet. This will make
@@ -283,83 +239,83 @@ config EXPR_MATH_SUPPORT_64
283 239
284config FALSE 240config FALSE
285 bool "false" 241 bool "false"
286 default n 242 default y
287 help 243 help
288 false returns an exit code of FALSE (1). 244 false returns an exit code of FALSE (1).
289 245
290config FOLD 246config FOLD
291 bool "fold" 247 bool "fold"
292 default n 248 default y
293 help 249 help
294 Wrap text to fit a specific width. 250 Wrap text to fit a specific width.
295 251
296config FSYNC 252config FSYNC
297 bool "fsync" 253 bool "fsync"
298 default n 254 default y
299 help 255 help
300 fsync is used to flush file-related cached blocks to disk. 256 fsync is used to flush file-related cached blocks to disk.
301 257
302config HEAD 258config HEAD
303 bool "head" 259 bool "head"
304 default n 260 default y
305 help 261 help
306 head is used to print the first specified number of lines 262 head is used to print the first specified number of lines
307 from files. 263 from files.
308 264
309config FEATURE_FANCY_HEAD 265config FEATURE_FANCY_HEAD
310 bool "Enable head options (-c, -q, and -v)" 266 bool "Enable head options (-c, -q, and -v)"
311 default n 267 default y
312 depends on HEAD 268 depends on HEAD
313 help 269 help
314 This enables the head options (-c, -q, and -v). 270 This enables the head options (-c, -q, and -v).
315 271
316config HOSTID 272config HOSTID
317 bool "hostid" 273 bool "hostid"
318 default n 274 default y
319 help 275 help
320 hostid prints the numeric identifier (in hexadecimal) for 276 hostid prints the numeric identifier (in hexadecimal) for
321 the current host. 277 the current host.
322 278
323config ID 279config ID
324 bool "id" 280 bool "id"
325 default n 281 default y
326 help 282 help
327 id displays the current user and group ID names. 283 id displays the current user and group ID names.
328 284
329config INSTALL 285config INSTALL
330 bool "install" 286 bool "install"
331 default n 287 default y
332 help 288 help
333 Copy files and set attributes. 289 Copy files and set attributes.
334 290
335config FEATURE_INSTALL_LONG_OPTIONS 291config FEATURE_INSTALL_LONG_OPTIONS
336 bool "Enable long options" 292 bool "Enable long options"
337 default n 293 default y
338 depends on INSTALL && LONG_OPTS 294 depends on INSTALL && LONG_OPTS
339 help 295 help
340 Support long options for the install applet. 296 Support long options for the install applet.
341 297
342config LENGTH 298config LENGTH
343 bool "length" 299 bool "length"
344 default n 300 default y
345 help 301 help
346 length is used to print out the length of a specified string. 302 length is used to print out the length of a specified string.
347 303
348config LN 304config LN
349 bool "ln" 305 bool "ln"
350 default n 306 default y
351 help 307 help
352 ln is used to create hard or soft links between files. 308 ln is used to create hard or soft links between files.
353 309
354config LOGNAME 310config LOGNAME
355 bool "logname" 311 bool "logname"
356 default n 312 default y
357 help 313 help
358 logname is used to print the current user's login name. 314 logname is used to print the current user's login name.
359 315
360config LS 316config LS
361 bool "ls" 317 bool "ls"
362 default n 318 default y
363 help 319 help
364 ls is used to list the contents of directories. 320 ls is used to list the contents of directories.
365 321
@@ -414,7 +370,7 @@ config FEATURE_LS_COLOR
414 370
415config FEATURE_LS_COLOR_IS_DEFAULT 371config FEATURE_LS_COLOR_IS_DEFAULT
416 bool "Produce colored ls output by default" 372 bool "Produce colored ls output by default"
417 default n 373 default y
418 depends on FEATURE_LS_COLOR 374 depends on FEATURE_LS_COLOR
419 help 375 help
420 Saying yes here will turn coloring on by default, 376 Saying yes here will turn coloring on by default,
@@ -425,123 +381,123 @@ config FEATURE_LS_COLOR_IS_DEFAULT
425 381
426config MD5SUM 382config MD5SUM
427 bool "md5sum" 383 bool "md5sum"
428 default n 384 default y
429 help 385 help
430 md5sum is used to print or check MD5 checksums. 386 md5sum is used to print or check MD5 checksums.
431 387
432config MKDIR 388config MKDIR
433 bool "mkdir" 389 bool "mkdir"
434 default n 390 default y
435 help 391 help
436 mkdir is used to create directories with the specified names. 392 mkdir is used to create directories with the specified names.
437 393
438config FEATURE_MKDIR_LONG_OPTIONS 394config FEATURE_MKDIR_LONG_OPTIONS
439 bool "Enable long options" 395 bool "Enable long options"
440 default n 396 default y
441 depends on MKDIR && LONG_OPTS 397 depends on MKDIR && LONG_OPTS
442 help 398 help
443 Support long options for the mkdir applet. 399 Support long options for the mkdir applet.
444 400
445config MKFIFO 401config MKFIFO
446 bool "mkfifo" 402 bool "mkfifo"
447 default n 403 default y
448 help 404 help
449 mkfifo is used to create FIFOs (named pipes). 405 mkfifo is used to create FIFOs (named pipes).
450 The `mknod' program can also create FIFOs. 406 The `mknod' program can also create FIFOs.
451 407
452config MKNOD 408config MKNOD
453 bool "mknod" 409 bool "mknod"
454 default n 410 default y
455 help 411 help
456 mknod is used to create FIFOs or block/character special 412 mknod is used to create FIFOs or block/character special
457 files with the specified names. 413 files with the specified names.
458 414
459config MV 415config MV
460 bool "mv" 416 bool "mv"
461 default n 417 default y
462 help 418 help
463 mv is used to move or rename files or directories. 419 mv is used to move or rename files or directories.
464 420
465config FEATURE_MV_LONG_OPTIONS 421config FEATURE_MV_LONG_OPTIONS
466 bool "Enable long options" 422 bool "Enable long options"
467 default n 423 default y
468 depends on MV && LONG_OPTS 424 depends on MV && LONG_OPTS
469 help 425 help
470 Support long options for the mv applet. 426 Support long options for the mv applet.
471 427
472config NICE 428config NICE
473 bool "nice" 429 bool "nice"
474 default n 430 default y
475 help 431 help
476 nice runs a program with modified scheduling priority. 432 nice runs a program with modified scheduling priority.
477 433
478config NOHUP 434config NOHUP
479 bool "nohup" 435 bool "nohup"
480 default n 436 default y
481 help 437 help
482 run a command immune to hangups, with output to a non-tty. 438 run a command immune to hangups, with output to a non-tty.
483 439
484config OD 440config OD
485 bool "od" 441 bool "od"
486 default n 442 default y
487 help 443 help
488 od is used to dump binary files in octal and other formats. 444 od is used to dump binary files in octal and other formats.
489 445
490config PRINTENV 446config PRINTENV
491 bool "printenv" 447 bool "printenv"
492 default n 448 default y
493 help 449 help
494 printenv is used to print all or part of environment. 450 printenv is used to print all or part of environment.
495 451
496config PRINTF 452config PRINTF
497 bool "printf" 453 bool "printf"
498 default n 454 default y
499 help 455 help
500 printf is used to format and print specified strings. 456 printf is used to format and print specified strings.
501 It's similar to `echo' except it has more options. 457 It's similar to `echo' except it has more options.
502 458
503config PWD 459config PWD
504 bool "pwd" 460 bool "pwd"
505 default n 461 default y
506 help 462 help
507 pwd is used to print the current directory. 463 pwd is used to print the current directory.
508 464
509config READLINK 465config READLINK
510 bool "readlink" 466 bool "readlink"
511 default n 467 default y
512 help 468 help
513 This program reads a symbolic link and returns the name 469 This program reads a symbolic link and returns the name
514 of the file it points to 470 of the file it points to
515 471
516config FEATURE_READLINK_FOLLOW 472config FEATURE_READLINK_FOLLOW
517 bool "Enable canonicalization by following all symlinks (-f)" 473 bool "Enable canonicalization by following all symlinks (-f)"
518 default n 474 default y
519 depends on READLINK 475 depends on READLINK
520 help 476 help
521 Enable the readlink option (-f). 477 Enable the readlink option (-f).
522 478
523config REALPATH 479config REALPATH
524 bool "realpath" 480 bool "realpath"
525 default n 481 default y
526 help 482 help
527 Return the canonicalized absolute pathname. 483 Return the canonicalized absolute pathname.
528 This isn't provided by GNU shellutils, but where else does it belong. 484 This isn't provided by GNU shellutils, but where else does it belong.
529 485
530config RM 486config RM
531 bool "rm" 487 bool "rm"
532 default n 488 default y
533 help 489 help
534 rm is used to remove files or directories. 490 rm is used to remove files or directories.
535 491
536config RMDIR 492config RMDIR
537 bool "rmdir" 493 bool "rmdir"
538 default n 494 default y
539 help 495 help
540 rmdir is used to remove empty directories. 496 rmdir is used to remove empty directories.
541 497
542config FEATURE_RMDIR_LONG_OPTIONS 498config FEATURE_RMDIR_LONG_OPTIONS
543 bool "Enable long options" 499 bool "Enable long options"
544 default n 500 default y
545 depends on RMDIR && LONG_OPTS 501 depends on RMDIR && LONG_OPTS
546 help 502 help
547 Support long options for the rmdir applet, including 503 Support long options for the rmdir applet, including
@@ -549,31 +505,31 @@ config FEATURE_RMDIR_LONG_OPTIONS
549 505
550config SEQ 506config SEQ
551 bool "seq" 507 bool "seq"
552 default n 508 default y
553 help 509 help
554 print a sequence of numbers 510 print a sequence of numbers
555 511
556config SHA1SUM 512config SHA1SUM
557 bool "sha1sum" 513 bool "sha1sum"
558 default n 514 default y
559 help 515 help
560 Compute and check SHA1 message digest 516 Compute and check SHA1 message digest
561 517
562config SHA256SUM 518config SHA256SUM
563 bool "sha256sum" 519 bool "sha256sum"
564 default n 520 default y
565 help 521 help
566 Compute and check SHA256 message digest 522 Compute and check SHA256 message digest
567 523
568config SHA512SUM 524config SHA512SUM
569 bool "sha512sum" 525 bool "sha512sum"
570 default n 526 default y
571 help 527 help
572 Compute and check SHA512 message digest 528 Compute and check SHA512 message digest
573 529
574config SLEEP 530config SLEEP
575 bool "sleep" 531 bool "sleep"
576 default n 532 default y
577 help 533 help
578 sleep is used to pause for a specified number of seconds. 534 sleep is used to pause for a specified number of seconds.
579 It comes in 3 versions: 535 It comes in 3 versions:
@@ -587,21 +543,21 @@ config SLEEP
587 543
588config FEATURE_FANCY_SLEEP 544config FEATURE_FANCY_SLEEP
589 bool "Enable multiple arguments and s/m/h/d suffixes" 545 bool "Enable multiple arguments and s/m/h/d suffixes"
590 default n 546 default y
591 depends on SLEEP 547 depends on SLEEP
592 help 548 help
593 Allow sleep to pause for specified minutes, hours, and days. 549 Allow sleep to pause for specified minutes, hours, and days.
594 550
595config FEATURE_FLOAT_SLEEP 551config FEATURE_FLOAT_SLEEP
596 bool "Enable fractional arguments" 552 bool "Enable fractional arguments"
597 default n 553 default y
598 depends on FEATURE_FANCY_SLEEP 554 depends on FEATURE_FANCY_SLEEP
599 help 555 help
600 Allow for fractional numeric parameters. 556 Allow for fractional numeric parameters.
601 557
602config SORT 558config SORT
603 bool "sort" 559 bool "sort"
604 default n 560 default y
605 help 561 help
606 sort is used to sort lines of text in specified files. 562 sort is used to sort lines of text in specified files.
607 563
@@ -619,13 +575,13 @@ config FEATURE_SORT_BIG
619 575
620config SPLIT 576config SPLIT
621 bool "split" 577 bool "split"
622 default n 578 default y
623 help 579 help
624 split a file into pieces. 580 split a file into pieces.
625 581
626config FEATURE_SPLIT_FANCY 582config FEATURE_SPLIT_FANCY
627 bool "Fancy extensions" 583 bool "Fancy extensions"
628 default n 584 default y
629 depends on SPLIT 585 depends on SPLIT
630 help 586 help
631 Add support for features not required by SUSv3. 587 Add support for features not required by SUSv3.
@@ -634,13 +590,13 @@ config FEATURE_SPLIT_FANCY
634 590
635config STAT 591config STAT
636 bool "stat" 592 bool "stat"
637 default n 593 default y
638 help 594 help
639 display file or filesystem status. 595 display file or filesystem status.
640 596
641config FEATURE_STAT_FORMAT 597config FEATURE_STAT_FORMAT
642 bool "Enable custom formats (-c)" 598 bool "Enable custom formats (-c)"
643 default n 599 default y
644 depends on STAT 600 depends on STAT
645 help 601 help
646 Without this, stat will not support the '-c format' option where 602 Without this, stat will not support the '-c format' option where
@@ -649,31 +605,31 @@ config FEATURE_STAT_FORMAT
649 605
650config STTY 606config STTY
651 bool "stty" 607 bool "stty"
652 default n 608 default y
653 help 609 help
654 stty is used to change and print terminal line settings. 610 stty is used to change and print terminal line settings.
655 611
656config SUM 612config SUM
657 bool "sum" 613 bool "sum"
658 default n 614 default y
659 help 615 help
660 checksum and count the blocks in a file 616 checksum and count the blocks in a file
661 617
662config SYNC 618config SYNC
663 bool "sync" 619 bool "sync"
664 default n 620 default y
665 help 621 help
666 sync is used to flush filesystem buffers. 622 sync is used to flush filesystem buffers.
667 623
668config TAC 624config TAC
669 bool "tac" 625 bool "tac"
670 default n 626 default y
671 help 627 help
672 tac is used to concatenate and print files in reverse. 628 tac is used to concatenate and print files in reverse.
673 629
674config TAIL 630config TAIL
675 bool "tail" 631 bool "tail"
676 default n 632 default y
677 help 633 help
678 tail is used to print the last specified number of lines 634 tail is used to print the last specified number of lines
679 from files. 635 from files.
@@ -692,153 +648,112 @@ config FEATURE_FANCY_TAIL
692 648
693config TEE 649config TEE
694 bool "tee" 650 bool "tee"
695 default n 651 default y
696 help 652 help
697 tee is used to read from standard input and write 653 tee is used to read from standard input and write
698 to standard output and files. 654 to standard output and files.
699 655
700config FEATURE_TEE_USE_BLOCK_IO 656config FEATURE_TEE_USE_BLOCK_IO
701 bool "Enable block I/O (larger/faster) instead of byte I/O" 657 bool "Enable block I/O (larger/faster) instead of byte I/O"
702 default n 658 default y
703 depends on TEE 659 depends on TEE
704 help 660 help
705 Enable this option for a faster tee, at expense of size. 661 Enable this option for a faster tee, at expense of size.
706 662
707config TEST
708 bool "test"
709 default n
710 help
711 test is used to check file types and compare values,
712 returning an appropriate exit code. The bash shell
713 has test built in, ash can build it in optionally.
714
715config FEATURE_TEST_64
716 bool "Extend test to 64 bit"
717 default n
718 depends on TEST || ASH_BUILTIN_TEST || HUSH
719 help
720 Enable 64-bit support in test.
721
722config TOUCH 663config TOUCH
723 bool "touch" 664 bool "touch"
724 default n 665 default y
725 help 666 help
726 touch is used to create or change the access and/or 667 touch is used to create or change the access and/or
727 modification timestamp of specified files. 668 modification timestamp of specified files.
728 669
729config TR
730 bool "tr"
731 default n
732 help
733 tr is used to squeeze, and/or delete characters from standard
734 input, writing to standard output.
735
736config FEATURE_TR_CLASSES
737 bool "Enable character classes (such as [:upper:])"
738 default n
739 depends on TR
740 help
741 Enable character classes, enabling commands such as:
742 tr [:upper:] [:lower:] to convert input into lowercase.
743
744config FEATURE_TR_EQUIV
745 bool "Enable equivalence classes"
746 default n
747 depends on TR
748 help
749 Enable equivalence classes, which essentially add the enclosed
750 character to the current set. For instance, tr [=a=] xyz would
751 replace all instances of 'a' with 'xyz'. This option is mainly
752 useful for cases when no other way of expressing a character
753 is possible.
754
755config TRUE 670config TRUE
756 bool "true" 671 bool "true"
757 default n 672 default y
758 help 673 help
759 true returns an exit code of TRUE (0). 674 true returns an exit code of TRUE (0).
760 675
761config TTY 676config TTY
762 bool "tty" 677 bool "tty"
763 default n 678 default y
764 help 679 help
765 tty is used to print the name of the current terminal to 680 tty is used to print the name of the current terminal to
766 standard output. 681 standard output.
767 682
768config UNAME 683config UNAME
769 bool "uname" 684 bool "uname"
770 default n 685 default y
771 help 686 help
772 uname is used to print system information. 687 uname is used to print system information.
773 688
774config UNEXPAND 689config UNEXPAND
775 bool "unexpand" 690 bool "unexpand"
776 default n 691 default y
777 help 692 help
778 By default, convert only leading sequences of blanks to tabs. 693 By default, convert only leading sequences of blanks to tabs.
779 694
780config FEATURE_UNEXPAND_LONG_OPTIONS 695config FEATURE_UNEXPAND_LONG_OPTIONS
781 bool "Enable long options" 696 bool "Enable long options"
782 default n 697 default y
783 depends on UNEXPAND && LONG_OPTS 698 depends on UNEXPAND && LONG_OPTS
784 help 699 help
785 Support long options for the unexpand applet. 700 Support long options for the unexpand applet.
786 701
787config UNIQ 702config UNIQ
788 bool "uniq" 703 bool "uniq"
789 default n 704 default y
790 help 705 help
791 uniq is used to remove duplicate lines from a sorted file. 706 uniq is used to remove duplicate lines from a sorted file.
792 707
793config USLEEP 708config USLEEP
794 bool "usleep" 709 bool "usleep"
795 default n 710 default y
796 help 711 help
797 usleep is used to pause for a specified number of microseconds. 712 usleep is used to pause for a specified number of microseconds.
798 713
799config UUDECODE 714config UUDECODE
800 bool "uudecode" 715 bool "uudecode"
801 default n 716 default y
802 help 717 help
803 uudecode is used to decode a uuencoded file. 718 uudecode is used to decode a uuencoded file.
804 719
805config UUENCODE 720config UUENCODE
806 bool "uuencode" 721 bool "uuencode"
807 default n 722 default y
808 help 723 help
809 uuencode is used to uuencode a file. 724 uuencode is used to uuencode a file.
810 725
811config WC 726config WC
812 bool "wc" 727 bool "wc"
813 default n 728 default y
814 help 729 help
815 wc is used to print the number of bytes, words, and lines, 730 wc is used to print the number of bytes, words, and lines,
816 in specified files. 731 in specified files.
817 732
818config FEATURE_WC_LARGE 733config FEATURE_WC_LARGE
819 bool "Support very large files in wc" 734 bool "Support very large files in wc"
820 default n 735 default y
821 depends on WC 736 depends on WC
822 help 737 help
823 Use "unsigned long long" in wc for counter variables. 738 Use "unsigned long long" in wc for counter variables.
824 739
825config WHO 740config WHO
826 bool "who" 741 bool "who"
827 default n 742 default y
828 depends on FEATURE_UTMP 743 depends on FEATURE_UTMP
829 help 744 help
830 who is used to show who is logged on. 745 who is used to show who is logged on.
831 746
832config WHOAMI 747config WHOAMI
833 bool "whoami" 748 bool "whoami"
834 default n 749 default y
835 help 750 help
836 whoami is used to print the username of the current 751 whoami is used to print the username of the current
837 user id (same as id -un). 752 user id (same as id -un).
838 753
839config YES 754config YES
840 bool "yes" 755 bool "yes"
841 default n 756 default y
842 help 757 help
843 yes is used to repeatedly output a specific string, or 758 yes is used to repeatedly output a specific string, or
844 the default string `y'. 759 the default string `y'.
@@ -848,7 +763,7 @@ comment "Common options for cp and mv"
848 763
849config FEATURE_PRESERVE_HARDLINKS 764config FEATURE_PRESERVE_HARDLINKS
850 bool "Preserve hard links" 765 bool "Preserve hard links"
851 default n 766 default y
852 depends on CP || MV 767 depends on CP || MV
853 help 768 help
854 Allow cp and mv to preserve hard links. 769 Allow cp and mv to preserve hard links.
@@ -872,7 +787,7 @@ comment "Common options for df, du, ls"
872 787
873config FEATURE_HUMAN_READABLE 788config FEATURE_HUMAN_READABLE
874 bool "Support for human readable output (example 13k, 23M, 235G)" 789 bool "Support for human readable output (example 13k, 23M, 235G)"
875 default n 790 default y
876 depends on DF || DU || LS 791 depends on DF || DU || LS
877 help 792 help
878 Allow df, du, and ls to have human readable output. 793 Allow df, du, and ls to have human readable output.
@@ -882,7 +797,7 @@ comment "Common options for md5sum, sha1sum, sha256sum, sha512sum"
882 797
883config FEATURE_MD5_SHA1_SUM_CHECK 798config FEATURE_MD5_SHA1_SUM_CHECK
884 bool "Enable -c, -s and -w options" 799 bool "Enable -c, -s and -w options"
885 default n 800 default y
886 depends on MD5SUM || SHA1SUM || SHA256SUM || SHA512SUM 801 depends on MD5SUM || SHA1SUM || SHA256SUM || SHA512SUM
887 help 802 help
888 Enabling the -c options allows files to be checked 803 Enabling the -c options allows files to be checked
diff --git a/coreutils/Kbuild b/coreutils/Kbuild.src
index ee22a3f7b..57ea7d6c4 100644
--- a/coreutils/Kbuild
+++ b/coreutils/Kbuild.src
@@ -7,12 +7,8 @@
7libs-y += libcoreutils/ 7libs-y += libcoreutils/
8 8
9lib-y:= 9lib-y:=
10lib-$(CONFIG_BASENAME) += basename.o 10INSERT
11lib-$(CONFIG_CAL) += cal.o 11lib-$(CONFIG_CAL) += cal.o
12lib-$(CONFIG_CAT) += cat.o
13lib-$(CONFIG_MORE) += cat.o # more uses it if stdout isn't a tty
14lib-$(CONFIG_LESS) += cat.o # less too
15lib-$(CONFIG_CRONTAB) += cat.o # crontab -l
16lib-$(CONFIG_CATV) += catv.o 12lib-$(CONFIG_CATV) += catv.o
17lib-$(CONFIG_CHGRP) += chgrp.o chown.o 13lib-$(CONFIG_CHGRP) += chgrp.o chown.o
18lib-$(CONFIG_CHMOD) += chmod.o 14lib-$(CONFIG_CHMOD) += chmod.o
@@ -24,7 +20,6 @@ lib-$(CONFIG_CKSUM) += cksum.o
24lib-$(CONFIG_COMM) += comm.o 20lib-$(CONFIG_COMM) += comm.o
25lib-$(CONFIG_CP) += cp.o 21lib-$(CONFIG_CP) += cp.o
26lib-$(CONFIG_CUT) += cut.o 22lib-$(CONFIG_CUT) += cut.o
27lib-$(CONFIG_DATE) += date.o
28lib-$(CONFIG_DD) += dd.o 23lib-$(CONFIG_DD) += dd.o
29lib-$(CONFIG_DF) += df.o 24lib-$(CONFIG_DF) += df.o
30lib-$(CONFIG_DIRNAME) += dirname.o 25lib-$(CONFIG_DIRNAME) += dirname.o
@@ -78,12 +73,7 @@ lib-$(CONFIG_SYNC) += sync.o
78lib-$(CONFIG_TAC) += tac.o 73lib-$(CONFIG_TAC) += tac.o
79lib-$(CONFIG_TAIL) += tail.o 74lib-$(CONFIG_TAIL) += tail.o
80lib-$(CONFIG_TEE) += tee.o 75lib-$(CONFIG_TEE) += tee.o
81lib-$(CONFIG_TEST) += test.o test_ptr_hack.o
82lib-$(CONFIG_ASH) += test.o test_ptr_hack.o # used by ash
83lib-$(CONFIG_HUSH) += test.o test_ptr_hack.o # used by hush
84lib-$(CONFIG_MSH) += test.o test_ptr_hack.o # used by msh
85lib-$(CONFIG_TOUCH) += touch.o 76lib-$(CONFIG_TOUCH) += touch.o
86lib-$(CONFIG_TR) += tr.o
87lib-$(CONFIG_TRUE) += true.o 77lib-$(CONFIG_TRUE) += true.o
88lib-$(CONFIG_TTY) += tty.o 78lib-$(CONFIG_TTY) += tty.o
89lib-$(CONFIG_UNAME) += uname.o 79lib-$(CONFIG_UNAME) += uname.o
diff --git a/coreutils/basename.c b/coreutils/basename.c
index 8a5597e65..d1ad91ba1 100644
--- a/coreutils/basename.c
+++ b/coreutils/basename.c
@@ -20,6 +20,16 @@
20 * 3) Save some space by using strcmp(). Calling strncmp() here was silly. 20 * 3) Save some space by using strcmp(). Calling strncmp() here was silly.
21 */ 21 */
22 22
23//kbuild:lib-$(CONFIG_BASENAME) += basename.o
24
25//config:config BASENAME
26//config: bool "basename"
27//config: default y
28//config: help
29//config: basename is used to strip the directory and suffix from filenames,
30//config: leaving just the filename itself. Enable this option if you wish
31//config: to enable the 'basename' utility.
32
23#include "libbb.h" 33#include "libbb.h"
24 34
25/* This is a NOFORK applet. Be very careful! */ 35/* This is a NOFORK applet. Be very careful! */
diff --git a/coreutils/cat.c b/coreutils/cat.c
index 0024eb8d5..ab682588f 100644
--- a/coreutils/cat.c
+++ b/coreutils/cat.c
@@ -10,6 +10,18 @@
10/* BB_AUDIT SUSv3 compliant */ 10/* BB_AUDIT SUSv3 compliant */
11/* http://www.opengroup.org/onlinepubs/007904975/utilities/cat.html */ 11/* http://www.opengroup.org/onlinepubs/007904975/utilities/cat.html */
12 12
13//kbuild:lib-$(CONFIG_CAT) += cat.o
14//kbuild:lib-$(CONFIG_MORE) += cat.o # more uses it if stdout isn't a tty
15//kbuild:lib-$(CONFIG_LESS) += cat.o # less too
16//kbuild:lib-$(CONFIG_CRONTAB) += cat.o # crontab -l
17
18//config:config CAT
19//config: bool "cat"
20//config: default y
21//config: help
22//config: cat is used to concatenate files and print them to the standard
23//config: output. Enable this option if you wish to enable the 'cat' utility.
24
13#include "libbb.h" 25#include "libbb.h"
14 26
15/* This is a NOFORK applet. Be very careful! */ 27/* This is a NOFORK applet. Be very careful! */
diff --git a/coreutils/date.c b/coreutils/date.c
index 4e5b3b0b8..3d78a5336 100644
--- a/coreutils/date.c
+++ b/coreutils/date.c
@@ -51,6 +51,47 @@
51 * and does not support -Ins 51 * and does not support -Ins
52 * -D FMT is a bbox extension for _input_ conversion of -d DATE 52 * -D FMT is a bbox extension for _input_ conversion of -d DATE
53 */ 53 */
54
55//kbuild:lib-$(CONFIG_DATE) += date.o
56
57//config:config DATE
58//config: bool "date"
59//config: default y
60//config: help
61//config: date is used to set the system date or display the
62//config: current time in the given format.
63//config:
64//config:config FEATURE_DATE_ISOFMT
65//config: bool "Enable ISO date format output (-I)"
66//config: default y
67//config: depends on DATE
68//config: help
69//config: Enable option (-I) to output an ISO-8601 compliant
70//config: date/time string.
71//config:
72//config:config FEATURE_DATE_NANO
73//config: bool "Support %[num]N nanosecond format specifier"
74//config: default n
75//config: depends on DATE
76//config: help
77//config: Support %[num]N format specifier. Adds ~250 bytes of code.
78//config:
79//config:config FEATURE_DATE_COMPAT
80//config: bool "Support weird 'date MMDDhhmm[[YY]YY][.ss]' format"
81//config: default y
82//config: depends on DATE
83//config: help
84//config: System time can be set by 'date -s DATE' and simply 'date DATE',
85//config: but formats of DATE string are different. 'date DATE' accepts
86//config: a rather weird MMDDhhmm[[YY]YY][.ss] format with completely
87//config: unnatural placement of year between minutes and seconds.
88//config: date -s (and other commands like touch -d) use more sensible
89//config: formats (for one, ISO format YYYY-MM-DD hh:mm:ss.ssssss).
90//config:
91//config: With this option off, 'date DATE' is 'date -s DATE' support
92//config: the same format. With it on, 'date DATE' additionally supports
93//config: MMDDhhmm[[YY]YY][.ss] format.
94
54#include "libbb.h" 95#include "libbb.h"
55 96
56enum { 97enum {
@@ -84,9 +125,9 @@ static const char date_longopts[] ALIGN1 =
84int date_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; 125int date_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
85int date_main(int argc UNUSED_PARAM, char **argv) 126int date_main(int argc UNUSED_PARAM, char **argv)
86{ 127{
128 struct timespec ts;
87 struct tm tm_time; 129 struct tm tm_time;
88 char buf_fmt_dt2str[64]; 130 char buf_fmt_dt2str[64];
89 time_t tm;
90 unsigned opt; 131 unsigned opt;
91 int ifmt = -1; 132 int ifmt = -1;
92 char *date_str; 133 char *date_str;
@@ -161,11 +202,22 @@ int date_main(int argc UNUSED_PARAM, char **argv)
161 if (opt & OPT_REFERENCE) { 202 if (opt & OPT_REFERENCE) {
162 struct stat statbuf; 203 struct stat statbuf;
163 xstat(filename, &statbuf); 204 xstat(filename, &statbuf);
164 tm = statbuf.st_mtime; 205 ts.tv_sec = statbuf.st_mtime;
206#if ENABLE_FEATURE_DATE_NANO
207# if defined __GLIBC__ && !defined __UCLIBC__
208 ts.tv_nsec = statbuf.st_mtim.tv_nsec;
209# else
210 ts.tv_nsec = statbuf.st_mtimensec;
211# endif
212#endif
165 } else { 213 } else {
166 time(&tm); 214#if ENABLE_FEATURE_DATE_NANO
215 clock_gettime(CLOCK_REALTIME, &ts);
216#else
217 time(&ts.tv_nsec);
218#endif
167 } 219 }
168 localtime_r(&tm, &tm_time); 220 localtime_r(&ts.tv_sec, &tm_time);
169 221
170 /* If date string is given, update tm_time, and maybe set date */ 222 /* If date string is given, update tm_time, and maybe set date */
171 if (date_str != NULL) { 223 if (date_str != NULL) {
@@ -184,12 +236,12 @@ int date_main(int argc UNUSED_PARAM, char **argv)
184 236
185 /* Correct any day of week and day of year etc. fields */ 237 /* Correct any day of week and day of year etc. fields */
186 tm_time.tm_isdst = -1; /* Be sure to recheck dst */ 238 tm_time.tm_isdst = -1; /* Be sure to recheck dst */
187 tm = validate_tm_time(date_str, &tm_time); 239 ts.tv_sec = validate_tm_time(date_str, &tm_time);
188 240
189 maybe_set_utc(opt); 241 maybe_set_utc(opt);
190 242
191 /* if setting time, set it */ 243 /* if setting time, set it */
192 if ((opt & OPT_SET) && stime(&tm) < 0) { 244 if ((opt & OPT_SET) && stime(&ts.tv_sec) < 0) {
193 bb_perror_msg("can't set date"); 245 bb_perror_msg("can't set date");
194 } 246 }
195 } 247 }
@@ -222,6 +274,46 @@ int date_main(int argc UNUSED_PARAM, char **argv)
222 fmt_dt2str = (char*)"%a %b %e %H:%M:%S %Z %Y"; 274 fmt_dt2str = (char*)"%a %b %e %H:%M:%S %Z %Y";
223 } 275 }
224 } 276 }
277#if ENABLE_FEATURE_DATE_NANO
278 else {
279 /* User-specified fmt_dt2str */
280 /* Search for and process "%N" */
281 char *p = fmt_dt2str;
282 while ((p = strchr(p, '%')) != NULL) {
283 int n, m;
284 unsigned pres, scale;
285
286 p++;
287 if (*p == '%') {
288 p++;
289 continue;
290 }
291 n = strspn(p, "0123456789");
292 if (p[n] != 'N') {
293 p += n;
294 continue;
295 }
296 /* We have "%[nnn]N" */
297 p[-1] = '\0';
298 p[n] = '\0';
299 scale = 1;
300 pres = 9;
301 if (n) {
302 pres = xatoi_u(p);
303 if (pres == 0)
304 pres = 9;
305 m = 9 - pres;
306 while (--m >= 0)
307 scale *= 10;
308 }
309
310 m = p - fmt_dt2str;
311 p += n + 1;
312 fmt_dt2str = xasprintf("%s%0*u%s", fmt_dt2str, pres, (unsigned)ts.tv_nsec / scale, p);
313 p = fmt_dt2str + m;
314 }
315 }
316#endif
225 317
226#define date_buf bb_common_bufsiz1 318#define date_buf bb_common_bufsiz1
227 if (*fmt_dt2str == '\0') { 319 if (*fmt_dt2str == '\0') {
diff --git a/coreutils/libcoreutils/Kbuild b/coreutils/libcoreutils/Kbuild.src
index 755d01f86..755d01f86 100644
--- a/coreutils/libcoreutils/Kbuild
+++ b/coreutils/libcoreutils/Kbuild.src
diff --git a/coreutils/test.c b/coreutils/test.c
index 0b9322316..fb5778760 100644
--- a/coreutils/test.c
+++ b/coreutils/test.c
@@ -19,6 +19,26 @@
19 * Original copyright notice states: 19 * Original copyright notice states:
20 * "This program is in the Public Domain." 20 * "This program is in the Public Domain."
21 */ 21 */
22
23//kbuild:lib-$(CONFIG_TEST) += test.o test_ptr_hack.o
24//kbuild:lib-$(CONFIG_ASH) += test.o test_ptr_hack.o
25//kbuild:lib-$(CONFIG_HUSH) += test.o test_ptr_hack.o
26
27//config:config TEST
28//config: bool "test"
29//config: default y
30//config: help
31//config: test is used to check file types and compare values,
32//config: returning an appropriate exit code. The bash shell
33//config: has test built in, ash can build it in optionally.
34//config:
35//config:config FEATURE_TEST_64
36//config: bool "Extend test to 64 bit"
37//config: default y
38//config: depends on TEST || ASH_BUILTIN_TEST || HUSH
39//config: help
40//config: Enable 64-bit support in test.
41
22#include "libbb.h" 42#include "libbb.h"
23#include <setjmp.h> 43#include <setjmp.h>
24 44
diff --git a/coreutils/tr.c b/coreutils/tr.c
index 6d4cb4a14..f3db3793f 100644
--- a/coreutils/tr.c
+++ b/coreutils/tr.c
@@ -18,6 +18,35 @@
18/* http://www.opengroup.org/onlinepubs/009695399/utilities/tr.html 18/* http://www.opengroup.org/onlinepubs/009695399/utilities/tr.html
19 * TODO: graph, print 19 * TODO: graph, print
20 */ 20 */
21
22//kbuild:lib-$(CONFIG_TR) += tr.o
23
24//config:config TR
25//config: bool "tr"
26//config: default y
27//config: help
28//config: tr is used to squeeze, and/or delete characters from standard
29//config: input, writing to standard output.
30//config:
31//config:config FEATURE_TR_CLASSES
32//config: bool "Enable character classes (such as [:upper:])"
33//config: default y
34//config: depends on TR
35//config: help
36//config: Enable character classes, enabling commands such as:
37//config: tr [:upper:] [:lower:] to convert input into lowercase.
38//config:
39//config:config FEATURE_TR_EQUIV
40//config: bool "Enable equivalence classes"
41//config: default y
42//config: depends on TR
43//config: help
44//config: Enable equivalence classes, which essentially add the enclosed
45//config: character to the current set. For instance, tr [=a=] xyz would
46//config: replace all instances of 'a' with 'xyz'. This option is mainly
47//config: useful for cases when no other way of expressing a character
48//config: is possible.
49
21#include "libbb.h" 50#include "libbb.h"
22 51
23enum { 52enum {
diff --git a/coreutils/yes.c b/coreutils/yes.c
index d757a4504..ead674b27 100644
--- a/coreutils/yes.c
+++ b/coreutils/yes.c
@@ -18,6 +18,11 @@
18 18
19/* This is a NOFORK applet. Be very careful! */ 19/* This is a NOFORK applet. Be very careful! */
20 20
21//usage:#define yes_trivial_usage
22//usage: "[STRING]"
23//usage:#define yes_full_usage "\n\n"
24//usage: "Repeatedly output a line with STRING, or 'y'"
25
21int yes_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; 26int yes_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
22int yes_main(int argc UNUSED_PARAM, char **argv) 27int yes_main(int argc UNUSED_PARAM, char **argv)
23{ 28{