X-Git-Url: https://git.librecmc.org/?a=blobdiff_plain;f=docs%2Fnew-applet-HOWTO.txt;h=a00dfcc30c0070374c617ff451f9a0a47aa85ba6;hb=c5f9a9dd0cf2154de6a581ffc9018715a02c118b;hp=638526a0cad023a21b8aa81c066481644b09b48d;hpb=8a6b619c96e1aa5cc2994614547951d8248d276f;p=oweals%2Fbusybox.git diff --git a/docs/new-applet-HOWTO.txt b/docs/new-applet-HOWTO.txt index 638526a0c..a00dfcc30 100644 --- a/docs/new-applet-HOWTO.txt +++ b/docs/new-applet-HOWTO.txt @@ -70,40 +70,35 @@ you _write_ your applet) please read through the style guide in the docs directory and make your program compliant. -Some Words on utility.c ------------------------ +Some Words on libbb +------------------- As you are writing your applet, please be aware of the body of pre-existing -useful functions in utility.c. Use these instead of reinventing the wheel. - -If you use functions from utility.c, you may need to add to the preprocessor -conditionals in that file, to make sure the routines you need are included. -So, since your mu implementation used safe_read(), append "|| define BB_MU" to -the #if instruction that precedes the safe_read() function in utility.c . +useful functions in libbb. Use these instead of reinventing the wheel. Additionally, if you have any useful, general-purpose functions in your program that could be useful in another program, consider putting them in -utility.c. +libbb. Usage String(s) --------------- -Next, add usage information for you applet to usage.c. This should look like +Next, add usage information for you applet to usage.h. This should look like the following: - #if defined BB_MU - const char mu_usage[] = - "mu\n" - #ifndef BB_FEATURE_TRIVIAL_HELP - "\nReturns an indeterminate value.\n" - #endif - ; + #define mu_trivial_usage \ + "-[abcde] FILES" + #define mu_full_usage \ + "Returns an indeterminate value.\n\n" \ + "Options:\n" \ + "\t-a\t\tfirst function\n" \ + "\t-b\t\tsecond function\n" \ If your program supports flags, the flags should be mentioned on the first -line (mu -[bcRovma]) and a detailed description of each flag should go in the -BB_FEATURE_TRIVIAL_HELP section, one flag per line. (Numerous examples of this -currently exist in utility.c.) +line (-[abcde]) and a detailed description of each flag should go in the +mu_full_usage section, one flag per line. (Numerous examples of this +currently exist in usage.h.) Header Files @@ -114,7 +109,7 @@ order, or else it will break the binary-search lookup algorithm in busybox.c and the Gods of BusyBox smite you. Yea, verily: /* all programs above here are alphabetically "less than" 'mu' */ - #ifdef BB_MU + #ifdef CONFIG_MU APPLET("mu", mu_main, _BB_DIR_USR_BIN, mu_usage) #endif /* all programs below here are alphabetically "greater than" 'mu' */ @@ -122,7 +117,7 @@ and the Gods of BusyBox smite you. Yea, verily: Finally, add a define for your applet to Config.h: - #define BB_MU + #define CONFIG_MU Documentation