aboutsummaryrefslogtreecommitdiff
path: root/docs/new-applet-HOWTO.txt
diff options
context:
space:
mode:
Diffstat (limited to 'docs/new-applet-HOWTO.txt')
-rw-r--r--docs/new-applet-HOWTO.txt21
1 files changed, 10 insertions, 11 deletions
diff --git a/docs/new-applet-HOWTO.txt b/docs/new-applet-HOWTO.txt
index 2f237564d..bb29999cf 100644
--- a/docs/new-applet-HOWTO.txt
+++ b/docs/new-applet-HOWTO.txt
@@ -19,8 +19,7 @@ such as who you stole the code from and so forth. Also include the mini-GPL
19boilerplate. Be sure to name the main function <applet>_main instead of main. 19boilerplate. Be sure to name the main function <applet>_main instead of main.
20And be sure to put it in <applet>.c. Usage does not have to be taken care of by 20And be sure to put it in <applet>.c. Usage does not have to be taken care of by
21your applet. 21your applet.
22Make sure to #include "libbb.h" as the first include file in your applet so 22Make sure to #include "libbb.h" as the first include file in your applet.
23the bb_config.h and appropriate platform specific files are included properly.
24 23
25For a new applet mu, here is the code that would go in mu.c: 24For a new applet mu, here is the code that would go in mu.c:
26 25
@@ -99,14 +98,14 @@ int function(char *a)
99----end example code------ 98----end example code------
100 99
101Add <function_name>.o in the right alphabetically sorted place 100Add <function_name>.o in the right alphabetically sorted place
102in libbb/Kbuild. You should look at the conditional part of 101in libbb/Kbuild.src. You should look at the conditional part of
103libbb/Kbuild aswell. 102libbb/Kbuild.src as well.
104 103
105You should also try to find a suitable place in include/libbb.h for 104You should also try to find a suitable place in include/libbb.h for
106the function declaration. If not, add it somewhere anyway, with or without 105the function declaration. If not, add it somewhere anyway, with or without
107ifdefs to include or not. 106ifdefs to include or not.
108 107
109You can look at libbb/Config.in and try to find out if the function is 108You can look at libbb/Config.src and try to find out if the function is
110tunable and add it there if it is. 109tunable and add it there if it is.
111 110
112 111
@@ -118,11 +117,11 @@ Find the appropriate directory for your new applet.
118Make sure you find the appropriate places in the files, the applets are 117Make sure you find the appropriate places in the files, the applets are
119sorted alphabetically. 118sorted alphabetically.
120 119
121Add the applet to Kbuild in the chosen directory: 120Add the applet to Kbuild.src in the chosen directory:
122 121
123lib-$(CONFIG_MU) += mu.o 122lib-$(CONFIG_MU) += mu.o
124 123
125Add the applet to Config.in in the chosen directory: 124Add the applet to Config.src in the chosen directory:
126 125
127config MU 126config MU
128 bool "MU" 127 bool "MU"
@@ -134,7 +133,7 @@ config MU
134Usage String(s) 133Usage String(s)
135--------------- 134---------------
136 135
137Next, add usage information for you applet to include/usage.h. 136Next, add usage information for you applet to include/usage.src.h.
138This should look like the following: 137This should look like the following:
139 138
140 #define mu_trivial_usage \ 139 #define mu_trivial_usage \
@@ -149,17 +148,17 @@ This should look like the following:
149If your program supports flags, the flags should be mentioned on the first 148If your program supports flags, the flags should be mentioned on the first
150line (-[abcde]) and a detailed description of each flag should go in the 149line (-[abcde]) and a detailed description of each flag should go in the
151mu_full_usage section, one flag per line. (Numerous examples of this 150mu_full_usage section, one flag per line. (Numerous examples of this
152currently exist in usage.h.) 151currently exist in usage.src.h.)
153 152
154 153
155Header Files 154Header Files
156------------ 155------------
157 156
158Next, add an entry to include/applets.h. Be *sure* to keep the list 157Next, add an entry to include/applets.src.h. Be *sure* to keep the list
159in alphabetical order, or else it will break the binary-search lookup 158in alphabetical order, or else it will break the binary-search lookup
160algorithm in busybox.c and the Gods of BusyBox smite you. Yea, verily: 159algorithm in busybox.c and the Gods of BusyBox smite you. Yea, verily:
161 160
162Be sure to read the top of applets.h before adding your applet. 161Be sure to read the top of applets.src.h before adding your applet.
163 162
164 /* all programs above here are alphabetically "less than" 'mu' */ 163 /* all programs above here are alphabetically "less than" 'mu' */
165 IF_MU(APPLET(mu, _BB_DIR_USR_BIN, _BB_SUID_DROP)) 164 IF_MU(APPLET(mu, _BB_DIR_USR_BIN, _BB_SUID_DROP))