Thomas Lundquist - Trying to keep it updated.
When doing this you should consider using the latest svn trunk.
-This is a good thing if you plan to getting it commited into mainline.
+This is a good thing if you plan to getting it committed into mainline.
Initial Write
-------------
boilerplate. Be sure to name the main function <applet>_main instead of main.
And be sure to put it in <applet>.c. Usage does not have to be taken care of by
your applet.
-Make sure to #include "busybox.h" as the first include file in your applet so
+Make sure to #include "libbb.h" as the first include file in your applet so
the bb_config.h and appropriate platform specific files are included properly.
For a new applet mu, here is the code that would go in mu.c:
* Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
*/
-#include "busybox.h"
+#include "libbb.h"
#include "other.h"
-int mu_main(int argc, char **argv);
+int mu_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
int mu_main(int argc, char **argv)
{
int fd;
+ ssize_t n;
char mu;
fd = xopen("/dev/random", O_RDONLY);
----end example code------
-Add <function_name>.o in the right alphabetically sorted place
-in libbb/Kbuild. You should look at the conditional part of
+Add <function_name>.o in the right alphabetically sorted place
+in libbb/Kbuild. You should look at the conditional part of
libbb/Kbuild aswell.
-You should also try to find a suitable place in include/libbb.h for
+You should also try to find a suitable place in include/libbb.h for
the function declaration. If not, add it somewhere anyway, with or without
ifdefs to include or not.
-You can look at libbb/Config.in and try to find out if the function is
-tuneable and add it there if it is.
+You can look at libbb/Config.in and try to find out if the function is
+tunable and add it there if it is.
Placement / Directory
Add the applet to Config.in in the chosen directory:
-config CONFIG_MU
+config MU
bool "MU"
default n
help
Be sure to read the top of applets.h before adding your applet.
/* all programs above here are alphabetically "less than" 'mu' */
- USE_MU(APPLET(mu, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
+ IF_MU(APPLET(mu, _BB_DIR_USR_BIN, _BB_SUID_DROP))
/* all programs below here are alphabetically "greater than" 'mu' */
Then create a diff by adding the new files with svn (remember your libbb files)
svn add <where you put it>/mu.c
-eventually also:
+eventually also:
svn add libbb/function.c
then
- svn diff
+ svn diff
and send it to the mailing list:
busybox@busybox.net
http://busybox.net/mailman/listinfo/busybox