diff options
| author | Denys Vlasenko <vda.linux@googlemail.com> | 2014-03-17 15:06:29 +0100 |
|---|---|---|
| committer | Denys Vlasenko <vda.linux@googlemail.com> | 2014-03-17 15:06:29 +0100 |
| commit | f332617fbd9248f34cff183a2a4caa961730625d (patch) | |
| tree | 654da089139b5b6a9249f6cc3bb13452332bf74d /docs | |
| parent | c50493854a78b28b3642a402d1a0bbd57c1b3c1b (diff) | |
| download | busybox-w32-f332617fbd9248f34cff183a2a4caa961730625d.tar.gz busybox-w32-f332617fbd9248f34cff183a2a4caa961730625d.tar.bz2 busybox-w32-f332617fbd9248f34cff183a2a4caa961730625d.zip | |
docs/new-applet-HOWTO.txt: tweak a bit
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/new-applet-HOWTO.txt | 33 |
1 files changed, 15 insertions, 18 deletions
diff --git a/docs/new-applet-HOWTO.txt b/docs/new-applet-HOWTO.txt index 28970a50a..078e77bce 100644 --- a/docs/new-applet-HOWTO.txt +++ b/docs/new-applet-HOWTO.txt | |||
| @@ -6,7 +6,7 @@ This document details the steps you must take to add a new applet to BusyBox. | |||
| 6 | Credits: | 6 | Credits: |
| 7 | Matt Kraai - initial writeup | 7 | Matt Kraai - initial writeup |
| 8 | Mark Whitley - the remix | 8 | Mark Whitley - the remix |
| 9 | Thomas Lundquist - Trying to keep it updated. | 9 | Thomas Lundquist - trying to keep it updated |
| 10 | 10 | ||
| 11 | When doing this you should consider using the latest git HEAD. | 11 | When doing this you should consider using the latest git HEAD. |
| 12 | This is a good thing if you plan to getting it committed into mainline. | 12 | This is a good thing if you plan to getting it committed into mainline. |
| @@ -23,7 +23,7 @@ as the first include file in your applet. | |||
| 23 | 23 | ||
| 24 | For a new applet mu, here is the code that would go in mu.c: | 24 | For a new applet mu, here is the code that would go in mu.c: |
| 25 | 25 | ||
| 26 | (busybox.h already includes most usual header files. You do not need | 26 | (libbb.h already includes most usual header files. You do not need |
| 27 | #include <stdio.h> etc...) | 27 | #include <stdio.h> etc...) |
| 28 | 28 | ||
| 29 | 29 | ||
| @@ -43,7 +43,7 @@ For a new applet mu, here is the code that would go in mu.c: | |||
| 43 | 43 | ||
| 44 | //config:config MU | 44 | //config:config MU |
| 45 | //config: bool "MU" | 45 | //config: bool "MU" |
| 46 | //config: default n | 46 | //config: default y |
| 47 | //config: help | 47 | //config: help |
| 48 | //config: Returns an indeterminate value. | 48 | //config: Returns an indeterminate value. |
| 49 | 49 | ||
| @@ -51,12 +51,11 @@ For a new applet mu, here is the code that would go in mu.c: | |||
| 51 | //applet:IF_MU(APPLET(mu, BB_DIR_USR_BIN, BB_SUID_DROP)) | 51 | //applet:IF_MU(APPLET(mu, BB_DIR_USR_BIN, BB_SUID_DROP)) |
| 52 | 52 | ||
| 53 | //usage:#define mu_trivial_usage | 53 | //usage:#define mu_trivial_usage |
| 54 | //usage: "-[abcde] FILES" | 54 | //usage: "[-abcde] FILE..." |
| 55 | //usage:#define mu_full_usage | 55 | //usage:#define mu_full_usage |
| 56 | //usage: "Returns an indeterminate value.\n\n" | 56 | //usage: "Returns an indeterminate value\n" |
| 57 | //usage: "Options:\n" | 57 | //usage: "\n -a First function" |
| 58 | //usage: "\t-a\t\tfirst function\n" | 58 | //usage: "\n -b Second function" |
| 59 | //usage: "\t-b\t\tsecond function\n" | ||
| 60 | 59 | ||
| 61 | int mu_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; | 60 | int mu_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; |
| 62 | int mu_main(int argc, char **argv) | 61 | int mu_main(int argc, char **argv) |
| @@ -150,13 +149,13 @@ Find the appropriate directory for your new applet. | |||
| 150 | 149 | ||
| 151 | Add the kbuild snippet to the .c file: | 150 | Add the kbuild snippet to the .c file: |
| 152 | 151 | ||
| 153 | //kbuild:lib-$(CONFIG_MU) += mu.o | 152 | //kbuild:lib-$(CONFIG_MU) += mu.o |
| 154 | 153 | ||
| 155 | Add the config snippet to the .c file: | 154 | Add the config snippet to the .c file: |
| 156 | 155 | ||
| 157 | //config:config MU | 156 | //config:config MU |
| 158 | //config: bool "MU" | 157 | //config: bool "MU" |
| 159 | //config: default n | 158 | //config: default y |
| 160 | //config: help | 159 | //config: help |
| 161 | //config: Returns an indeterminate value. | 160 | //config: Returns an indeterminate value. |
| 162 | 161 | ||
| @@ -168,18 +167,16 @@ Next, add usage information for your applet to the .c file. | |||
| 168 | This should look like the following: | 167 | This should look like the following: |
| 169 | 168 | ||
| 170 | //usage:#define mu_trivial_usage | 169 | //usage:#define mu_trivial_usage |
| 171 | //usage: "-[abcde] FILES" | 170 | //usage: "[-abcde] FILE..." |
| 172 | //usage:#define mu_full_usage | 171 | //usage:#define mu_full_usage |
| 173 | //usage: "Returns an indeterminate value.\n\n" | 172 | //usage: "Returns an indeterminate value\n" |
| 174 | //usage: "Options:\n" | 173 | //usage: "\n -a First function" |
| 175 | //usage: "\t-a\t\tfirst function\n" | 174 | //usage: "\n -b Second function" |
| 176 | //usage: "\t-b\t\tsecond function\n" | ||
| 177 | //usage: ... | 175 | //usage: ... |
| 178 | 176 | ||
| 179 | If your program supports flags, the flags should be mentioned on the first | 177 | If your program supports flags, the flags should be mentioned on the first |
| 180 | line (-[abcde]) and a detailed description of each flag should go in the | 178 | line ([-abcde]) and a detailed description of each flag should go in the |
| 181 | mu_full_usage section, one flag per line. (Numerous examples of this | 179 | mu_full_usage section, one flag per line. |
| 182 | currently exist in usage.src.h.) | ||
| 183 | 180 | ||
| 184 | 181 | ||
| 185 | Header Files | 182 | Header Files |
