- usage.h
authorJohn Beppu <beppu@lbox.org>
Tue, 17 Apr 2001 17:09:34 +0000 (17:09 -0000)
committerJohn Beppu <beppu@lbox.org>
Tue, 17 Apr 2001 17:09:34 +0000 (17:09 -0000)
  o echo_example_usage
    needed to escape some backslashes in an inner quote
  o find_full_usage
    missing a \n at the end of the -name line
  ? getopt_full_usage
    the -o line has tab issues, but I didn't fix them.
  o length_example_usage
    removed some double-quotes that were within an inner quotes
  o printf_example_usage
    needed to escape a backslash in an inner quote
  o sort_example_usage
    needed to escape some backslashes and double quotes in an inner quote
  o tftp_full_usage
    s/nameing/naming/;
  o umount_full_usage
    remove colons after options for consistency w/ other full_usage messages
  o uniq_example_usage
    needed to escape some backslashes and double quotes in an inner quote

- TODO                          xargs -l ?
- docs/autodocifier.pl          POD && comment updates
- docs/busybox_footer.pod       added Larry Doolittle and Sterling Huxley

TODO
applets/usage.h
docs/autodocifier.pl
docs/busybox.pod
docs/busybox_footer.pod
include/usage.h
usage.h

diff --git a/TODO b/TODO
index b5e383b..6112748 100644 (file)
--- a/TODO
+++ b/TODO
@@ -12,7 +12,7 @@ around to it some time. If you have any good ideas, please let me know.
 
 * The busybox shell, lash, is really too weak for serious use, although it is
     possible to run many simple systems with it.  BusyBox 0.49 was supposed to
-    have a new shell, updated to understand full Bourne grammer.  Well, that
+    have a new shell, updated to understand full Bourne grammar.  Well, that
     simply didn't happen in time for the release.  A rewrite is in progress
     that will result in a new shell that understands the full Bourne grammar.
     This new shell is being championed by Larry Doolittle
@@ -55,4 +55,8 @@ and then start with the biggest things and make them smaller...
 
  du.c probably ought to have an -x switch like GNU du does...
 
+-----------------------
+
+xargs could use a -l option
+
 ------------------------------------------------------------------
index 40171fc..7bc817f 100644 (file)
 #define echo_example_usage \
        "$ echo "Erik is cool"\n" \
        "Erik is cool\n" \
-       "$  echo -e "Erik\nis\ncool"\n" \
+       "$  echo -e "Erik\\nis\\ncool"\n" \
        "Erik\n" \
        "is\n" \
        "cool\n" \
        "the current directory; default EXPRESSION is '-print'\n" \
        "\nEXPRESSION may consist of:\n" \
        "\t-follow\t\tDereference symbolic links.\n" \
-       "\t-name PATTERN\tFile name (leading directories removed) matches PATTERN." \
+       "\t-name PATTERN\tFile name (leading directories removed) matches PATTERN.\n" \
        "\t-print\t\tPrint (default and assumed).\n" \
        USAGE_FIND_TYPE( \
        "\n\t-type X\t\tFiletype matches X (where X is one of: f,d,l,b,c,...)" \
 #define length_full_usage \
        "Prints out the length of the specified STRING."
 #define length_example_usage \
-       "$ length "Hello"\n" \
+       "$ length Hello\n" \
        "5\n"
 
 #define ln_trivial_usage \
        "Formats and prints ARGUMENT(s) according to FORMAT,\n" \
        "Where FORMAT controls the output exactly as in C printf."
 #define printf_example_usage \
-       "$ printf "Val=%d\n" 5\n" \
+       "$ printf "Val=%d\\n" 5\n" \
        "Val=5\n" 
 
 #define ps_trivial_usage \
 #define sort_full_usage \
        "Sorts lines of text in the specified files"
 #define sort_example_usage \
-       "$ echo -e "e\nf\nb\nd\nc\na" | sort\n" \
+       "$ echo -e \"e\\nf\\nb\\nd\\nc\\na\" | sort\n" \
        "a\n" \
        "b\n" \
        "c\n" \
         USAGE_TFTP_PUT(        \
        "\tput\tPut local file SOURCE to server DEST.\n" \
        ) \
-       "\nWhen nameing a server, use the syntax \"server:file\"."
+       "\nWhen naming a server, use the syntax \"server:file\"."
 
 #define touch_trivial_usage \
        "[-c] file [file ...]"
        "[flags] filesystem|directory"
 #define umount_full_usage \
        "Unmount file systems\n" \
-       "\nFlags:\n" "\t-a:\tUnmount all file systems" \
-       USAGE_MTAB(" in /etc/mtab\n\t-n:\tDon't erase /etc/mtab entries") \
-       "\n\t-r:\tTry to remount devices as read-only if mount is busy" \
-       USAGE_MOUNT_FORCE("\n\t-f:\tForce filesystem umount (i.e. unreachable NFS server)") \
-       USAGE_MOUNT_LOOP("\n\t-l:\tDo not free loop device (if a loop device has been used)")
+       "\nFlags:\n" "\t-a\tUnmount all file systems" \
+       USAGE_MTAB(" in /etc/mtab\n\t-n\tDon't erase /etc/mtab entries") \
+       "\n\t-r\tTry to remount devices as read-only if mount is busy" \
+       USAGE_MOUNT_FORCE("\n\t-f\tForce filesystem umount (i.e. unreachable NFS server)") \
+       USAGE_MOUNT_LOOP("\n\t-l\tDo not free loop device (if a loop device has been used)")
 #define umount_example_usage \
        "$ umount /dev/hdc1 \n"
 
        "\t-d\tonly print duplicate lines\n" \
        "\t-u\tonly print unique lines"
 #define uniq_example_usage \
-       "$ echo -e "a\na\nb\nc\nc\na" | sort | uniq\n" \
+       "$ echo -e \"a\\na\\nb\\nc\\nc\\na\" | sort | uniq\n" \
        "a\n" \
        "b\n" \
        "c\n"
index 2bf7cd8..d753300 100755 (executable)
@@ -62,12 +62,12 @@ sub pod_for_usage {
        }
        my $full = join("\n", @f1);
 
-       # prepare notes if they exists
+       # prepare notes if they exist
        my $notes = (defined $usage->{notes})
                ? "$usage->{notes}\n\n"
                : "";
 
-       # prepare example if one exists
+       # prepare examples if they exist
        my $example = (defined $usage->{example})
                ?  
                        "Example:\n\n" .
@@ -107,6 +107,7 @@ sub sgml_for_usage {
 # {
 #     trivial => "...",
 #     full    => "...",
+#     notes   => "...",
 #     example => "...",
 # }
 my %docs;
@@ -176,7 +177,13 @@ autodocifier.pl - generate docs for busybox based on usage.h
 
 =head1 SYNOPSIS
 
-autodocifier.pl usage.h > something
+autodocifier.pl [OPTION]... [FILE]...
+
+Example:
+
+    ( cat docs/busybox_header.pod; \
+      docs/autodocifier.pl usage.h; \
+      cat docs/busybox_footer.pod ) > docs/busybox.pod
 
 =head1 DESCRIPTION
 
@@ -186,7 +193,8 @@ Currently, the same content has to be duplicated in 3 places in
 slightly different formats -- F<usage.h>, F<docs/busybox.pod>, and
 F<docs/busybox.sgml>.  This is tedious, so Perl has come to the rescue.
 
-This script was based on a script by Erik Andersen (andersen@lineo.com).
+This script was based on a script by Erik Andersen <andersen@lineo.com>
+which was in turn based on a script by Mark Whitley <markw@lineo.com>
 
 =head1 OPTIONS
 
@@ -219,7 +227,7 @@ The following is an example of some data this script might parse.
     #define length_full_usage \
             "Prints out the length of the specified STRING."
     #define length_example_usage \
-            "$ length "Hello"\n" \
+            "$ length Hello\n" \
             "5\n"
 
 Each entry is a cpp macro that defines a string.  The macros are
@@ -249,13 +257,14 @@ is disabled.  I<REQUIRED>
 =item B<notes>
 
 This is documentation that is intended to go in the POD or SGML, but
-not be output when a B<-h> is given to a command.  To see an example
+not be printed when a B<-h> is given to a command.  To see an example
 of notes being used, see init_notes_usage.  I<OPTIONAL>
 
 =item B<example>
 
 This should be an example of how the command is acutally used.
-I<OPTIONAL>
+This will not be printed when a B<-h> is given to a command -- it
+is inteded only for the POD or SGML documentation.  I<OPTIONAL>
 
 =back
 
@@ -275,4 +284,4 @@ John BEPPU <beppu@lineo.com>
 
 =cut
 
-# $Id: autodocifier.pl,v 1.20 2001/04/10 00:00:05 kraai Exp $
+# $Id: autodocifier.pl,v 1.21 2001/04/17 17:09:34 beppu Exp $
index 8e8a549..e54ff82 100644 (file)
@@ -441,15 +441,17 @@ WORK IN PROGRESS, only usefull for debian-installer
 
 =item B<dpkg_deb>
 
-dpkg_deb [B<-cexX>] file directory
+dpkg_deb [B<-cefItxX>] file [argument]
 
 Perform actions on debian packages (.debs)
 
 Options:
 
-       -c      List contents of filesystem tree (verbose)
-       -l      List contents of filesystem tree (.list format)
-       -e      Extract control files to directory
+       -c      List contents of filesystem tree
+       -e      Extract control files to [argument] directory
+       -f      Display control field name starting with [argument]
+       -I      Display the control filenamed [argument]
+       -t      Extract filesystem tree to stdout in tar format
        -x      Exctract packages filesystem tree to directory
        -X      Verbose extract
 
@@ -538,9 +540,7 @@ Example:
 
        $ echo "Erik is cool"
        Erik is cool
-       $  echo -e "Erik
-       is
-       cool"
+       $  echo -e "Erik\nis\ncool"
        Erik
        is
        cool
@@ -658,7 +658,8 @@ the current directory; default EXPRESSION is 'B<-print>'
 EXPRESSION may consist of:
 
        -follow         Dereference symbolic links.
-       -name PATTERN   File name (leading directories removed) matches PATTERN.        -print          Print (default and assumed).
+       -name PATTERN   File name (leading directories removed) matches PATTERN.
+       -print          Print (default and assumed).
 
        -type X         Filetype matches X (where X is one of: f,d,l,b,c,...)
        -perm PERMS     Permissions match any of (+NNN); all of (-NNN);
@@ -1610,8 +1611,7 @@ Where FORMAT controls the output exactly as in C printf.
 
 Example:
 
-       $ printf "Val=%d
-       " 5
+       $ printf "Val=%d\n" 5
        Val=5
 
 -------------------------------
@@ -1840,12 +1840,7 @@ Sorts lines of text in the specified files
 
 Example:
 
-       $ echo -e "e
-       f
-       b
-       d
-       c
-       a" | sort
+       $ echo -e "e\nf\nb\nd\nc\na" | sort
        a
        b
        c
@@ -2046,7 +2041,7 @@ Commands:
        get     Get file from server SOURCE and store to local DEST.
        put     Put local file SOURCE to server DEST.
 
-When nameing a server, use the syntax "server:file".
+When naming a server, use the syntax "server:file".
 
 -------------------------------
 
@@ -2129,11 +2124,11 @@ Unmount file systems
 
 Flags:
 
-       -a:     Unmount all file systems in /etc/mtab
-       -n:     Don't erase /etc/mtab entries
-       -r:     Try to remount devices as read-only if mount is busy
-       -f:     Force filesystem umount (i.e. unreachable NFS server)
-       -l:     Do not free loop device (if a loop device has been used)
+       -a      Unmount all file systems in /etc/mtab
+       -n      Don't erase /etc/mtab entries
+       -r      Try to remount devices as read-only if mount is busy
+       -f      Force filesystem umount (i.e. unreachable NFS server)
+       -l      Do not free loop device (if a loop device has been used)
 
 Example:
 
@@ -2179,12 +2174,7 @@ Options:
 
 Example:
 
-       $ echo -e "a
-       a
-       b
-       c
-       c
-       a" | sort | uniq
+       $ echo -e "a\na\nb\nc\nc\na" | sort | uniq
        a
        b
        c
@@ -2537,4 +2527,4 @@ Enrique Zanardi <ezanardi@ull.es>
 
 =cut
 
-# $Id: busybox.pod,v 1.100 2001/04/10 18:17:05 andersen Exp $
+# $Id: busybox.pod,v 1.101 2001/04/17 17:09:34 beppu Exp $
index d724dc8..2ab4e16 100644 (file)
@@ -37,16 +37,17 @@ Erik Andersen <andersen@lineo.com>, <andersee@debian.org>
 
 =for html <br>
 
-Edward Betts <edward@debian.org>
+John Beppu <beppu@lineo.com>
 
-    expr, hostid, logname, tty, wc, whoami, yes
-=for html <br>
+    du, head, nslookup, sort, tee, uniq (so Kraai could rewrite them ;-),
+    documentation
 
-John Beppu <beppu@lineo.com>
+=for html <br>
 
-    du, head, nslookup, sort, tee, uniq
+Edward Betts <edward@debian.org>
 
+    expr, hostid, logname, tty, wc, whoami, yes
 =for html <br>
 
 Brian Candler <B.Candler@pobox.com>
@@ -68,12 +69,24 @@ Dave Cinege <dcinege@psychosis.com>
 
 =for html <br>
 
+Larry Doolittle <ldoolitt@recycle.lbl.gov>
+
+    various fixes, shell rewrite
+
+=for html <br>
+
 Karl M. Hegbloom <karlheg@debian.org>
 
     cp_mv.c, the test suite, various fixes to utility.c, &c.
 
 =for html <br>
 
+Sterling Huxley <sterling@europa.com>
+
+    vi (!!!)
+
+=for html <br>
+
 Daniel Jacobowitz <dan@debian.org>
 
     mktemp.c
@@ -153,4 +166,4 @@ Enrique Zanardi <ezanardi@ull.es>
 
 =cut
 
-# $Id: busybox_footer.pod,v 1.3 2001/04/09 23:27:51 kraai Exp $
+# $Id: busybox_footer.pod,v 1.4 2001/04/17 17:09:34 beppu Exp $
index 40171fc..7bc817f 100644 (file)
 #define echo_example_usage \
        "$ echo "Erik is cool"\n" \
        "Erik is cool\n" \
-       "$  echo -e "Erik\nis\ncool"\n" \
+       "$  echo -e "Erik\\nis\\ncool"\n" \
        "Erik\n" \
        "is\n" \
        "cool\n" \
        "the current directory; default EXPRESSION is '-print'\n" \
        "\nEXPRESSION may consist of:\n" \
        "\t-follow\t\tDereference symbolic links.\n" \
-       "\t-name PATTERN\tFile name (leading directories removed) matches PATTERN." \
+       "\t-name PATTERN\tFile name (leading directories removed) matches PATTERN.\n" \
        "\t-print\t\tPrint (default and assumed).\n" \
        USAGE_FIND_TYPE( \
        "\n\t-type X\t\tFiletype matches X (where X is one of: f,d,l,b,c,...)" \
 #define length_full_usage \
        "Prints out the length of the specified STRING."
 #define length_example_usage \
-       "$ length "Hello"\n" \
+       "$ length Hello\n" \
        "5\n"
 
 #define ln_trivial_usage \
        "Formats and prints ARGUMENT(s) according to FORMAT,\n" \
        "Where FORMAT controls the output exactly as in C printf."
 #define printf_example_usage \
-       "$ printf "Val=%d\n" 5\n" \
+       "$ printf "Val=%d\\n" 5\n" \
        "Val=5\n" 
 
 #define ps_trivial_usage \
 #define sort_full_usage \
        "Sorts lines of text in the specified files"
 #define sort_example_usage \
-       "$ echo -e "e\nf\nb\nd\nc\na" | sort\n" \
+       "$ echo -e \"e\\nf\\nb\\nd\\nc\\na\" | sort\n" \
        "a\n" \
        "b\n" \
        "c\n" \
         USAGE_TFTP_PUT(        \
        "\tput\tPut local file SOURCE to server DEST.\n" \
        ) \
-       "\nWhen nameing a server, use the syntax \"server:file\"."
+       "\nWhen naming a server, use the syntax \"server:file\"."
 
 #define touch_trivial_usage \
        "[-c] file [file ...]"
        "[flags] filesystem|directory"
 #define umount_full_usage \
        "Unmount file systems\n" \
-       "\nFlags:\n" "\t-a:\tUnmount all file systems" \
-       USAGE_MTAB(" in /etc/mtab\n\t-n:\tDon't erase /etc/mtab entries") \
-       "\n\t-r:\tTry to remount devices as read-only if mount is busy" \
-       USAGE_MOUNT_FORCE("\n\t-f:\tForce filesystem umount (i.e. unreachable NFS server)") \
-       USAGE_MOUNT_LOOP("\n\t-l:\tDo not free loop device (if a loop device has been used)")
+       "\nFlags:\n" "\t-a\tUnmount all file systems" \
+       USAGE_MTAB(" in /etc/mtab\n\t-n\tDon't erase /etc/mtab entries") \
+       "\n\t-r\tTry to remount devices as read-only if mount is busy" \
+       USAGE_MOUNT_FORCE("\n\t-f\tForce filesystem umount (i.e. unreachable NFS server)") \
+       USAGE_MOUNT_LOOP("\n\t-l\tDo not free loop device (if a loop device has been used)")
 #define umount_example_usage \
        "$ umount /dev/hdc1 \n"
 
        "\t-d\tonly print duplicate lines\n" \
        "\t-u\tonly print unique lines"
 #define uniq_example_usage \
-       "$ echo -e "a\na\nb\nc\nc\na" | sort | uniq\n" \
+       "$ echo -e \"a\\na\\nb\\nc\\nc\\na\" | sort | uniq\n" \
        "a\n" \
        "b\n" \
        "c\n"
diff --git a/usage.h b/usage.h
index 40171fc..7bc817f 100644 (file)
--- a/usage.h
+++ b/usage.h
 #define echo_example_usage \
        "$ echo "Erik is cool"\n" \
        "Erik is cool\n" \
-       "$  echo -e "Erik\nis\ncool"\n" \
+       "$  echo -e "Erik\\nis\\ncool"\n" \
        "Erik\n" \
        "is\n" \
        "cool\n" \
        "the current directory; default EXPRESSION is '-print'\n" \
        "\nEXPRESSION may consist of:\n" \
        "\t-follow\t\tDereference symbolic links.\n" \
-       "\t-name PATTERN\tFile name (leading directories removed) matches PATTERN." \
+       "\t-name PATTERN\tFile name (leading directories removed) matches PATTERN.\n" \
        "\t-print\t\tPrint (default and assumed).\n" \
        USAGE_FIND_TYPE( \
        "\n\t-type X\t\tFiletype matches X (where X is one of: f,d,l,b,c,...)" \
 #define length_full_usage \
        "Prints out the length of the specified STRING."
 #define length_example_usage \
-       "$ length "Hello"\n" \
+       "$ length Hello\n" \
        "5\n"
 
 #define ln_trivial_usage \
        "Formats and prints ARGUMENT(s) according to FORMAT,\n" \
        "Where FORMAT controls the output exactly as in C printf."
 #define printf_example_usage \
-       "$ printf "Val=%d\n" 5\n" \
+       "$ printf "Val=%d\\n" 5\n" \
        "Val=5\n" 
 
 #define ps_trivial_usage \
 #define sort_full_usage \
        "Sorts lines of text in the specified files"
 #define sort_example_usage \
-       "$ echo -e "e\nf\nb\nd\nc\na" | sort\n" \
+       "$ echo -e \"e\\nf\\nb\\nd\\nc\\na\" | sort\n" \
        "a\n" \
        "b\n" \
        "c\n" \
         USAGE_TFTP_PUT(        \
        "\tput\tPut local file SOURCE to server DEST.\n" \
        ) \
-       "\nWhen nameing a server, use the syntax \"server:file\"."
+       "\nWhen naming a server, use the syntax \"server:file\"."
 
 #define touch_trivial_usage \
        "[-c] file [file ...]"
        "[flags] filesystem|directory"
 #define umount_full_usage \
        "Unmount file systems\n" \
-       "\nFlags:\n" "\t-a:\tUnmount all file systems" \
-       USAGE_MTAB(" in /etc/mtab\n\t-n:\tDon't erase /etc/mtab entries") \
-       "\n\t-r:\tTry to remount devices as read-only if mount is busy" \
-       USAGE_MOUNT_FORCE("\n\t-f:\tForce filesystem umount (i.e. unreachable NFS server)") \
-       USAGE_MOUNT_LOOP("\n\t-l:\tDo not free loop device (if a loop device has been used)")
+       "\nFlags:\n" "\t-a\tUnmount all file systems" \
+       USAGE_MTAB(" in /etc/mtab\n\t-n\tDon't erase /etc/mtab entries") \
+       "\n\t-r\tTry to remount devices as read-only if mount is busy" \
+       USAGE_MOUNT_FORCE("\n\t-f\tForce filesystem umount (i.e. unreachable NFS server)") \
+       USAGE_MOUNT_LOOP("\n\t-l\tDo not free loop device (if a loop device has been used)")
 #define umount_example_usage \
        "$ umount /dev/hdc1 \n"
 
        "\t-d\tonly print duplicate lines\n" \
        "\t-u\tonly print unique lines"
 #define uniq_example_usage \
-       "$ echo -e "a\na\nb\nc\nc\na" | sort | uniq\n" \
+       "$ echo -e \"a\\na\\nb\\nc\\nc\\na\" | sort | uniq\n" \
        "a\n" \
        "b\n" \
        "c\n"