summaryrefslogtreecommitdiff
path: root/docs/new-applet-HOWTO.txt
diff options
context:
space:
mode:
authorDenis Vlasenko <vda.linux@googlemail.com>2007-05-08 17:52:17 +0000
committerDenis Vlasenko <vda.linux@googlemail.com>2007-05-08 17:52:17 +0000
commit7e84e539de530b2060f0e570fc8f063ed0aaad2f (patch)
treec03518f2059504a513119cf4d499ccf5c7233f83 /docs/new-applet-HOWTO.txt
parent92c0b8222eb50dd35c06e2f1265706b388762234 (diff)
downloadbusybox-w32-7e84e539de530b2060f0e570fc8f063ed0aaad2f.tar.gz
busybox-w32-7e84e539de530b2060f0e570fc8f063ed0aaad2f.tar.bz2
busybox-w32-7e84e539de530b2060f0e570fc8f063ed0aaad2f.zip
cryptpw: new applet (a bit less than 3k added)
(by Thomas Lundquist <lists@zelow.no>)
Diffstat (limited to 'docs/new-applet-HOWTO.txt')
-rw-r--r--docs/new-applet-HOWTO.txt74
1 files changed, 52 insertions, 22 deletions
diff --git a/docs/new-applet-HOWTO.txt b/docs/new-applet-HOWTO.txt
index b1e103572..5d8fbe78a 100644
--- a/docs/new-applet-HOWTO.txt
+++ b/docs/new-applet-HOWTO.txt
@@ -6,7 +6,10 @@ This document details the steps you must take to add a new applet to BusyBox.
6Credits: 6Credits:
7Matt Kraai - initial writeup 7Matt Kraai - initial writeup
8Mark Whitley - the remix 8Mark Whitley - the remix
9Thomas Lundquist - Added stuff for the new directory layout. 9Thomas Lundquist - Trying to keep it updated.
10
11When doing this you should consider using the latest svn trunk.
12This is a good thing if you plan to getting it commited into mainline.
10 13
11Initial Write 14Initial Write
12------------- 15-------------
@@ -21,6 +24,10 @@ the bb_config.h and appropriate platform specific files are included properly.
21 24
22For a new applet mu, here is the code that would go in mu.c: 25For a new applet mu, here is the code that would go in mu.c:
23 26
27(busybox.h already includes most usual header files. You do not need
28#include <stdio.h> etc...)
29
30
24----begin example code------ 31----begin example code------
25 32
26/* vi: set sw=4 ts=4: */ 33/* vi: set sw=4 ts=4: */
@@ -33,7 +40,7 @@ For a new applet mu, here is the code that would go in mu.c:
33 */ 40 */
34 41
35#include "busybox.h" 42#include "busybox.h"
36#include <other.h> 43#include "other.h"
37 44
38int mu_main(int argc, char **argv); 45int mu_main(int argc, char **argv);
39int mu_main(int argc, char **argv) 46int mu_main(int argc, char **argv)
@@ -69,6 +76,38 @@ useful functions in libbb. Use these instead of reinventing the wheel.
69Additionally, if you have any useful, general-purpose functions in your 76Additionally, if you have any useful, general-purpose functions in your
70applet that could be useful in other applets, consider putting them in libbb. 77applet that could be useful in other applets, consider putting them in libbb.
71 78
79And it may be possible that some of the other applets uses functions you
80could use. If so, you have to rip the function out of the applet and make
81a libbb function out of it.
82
83Adding a libbb function:
84------------------------
85
86Make a new file named <function_name>.c
87
88----start example code------
89
90#include "libbb.h"
91#include "other.h"
92
93int function(char *a)
94{
95 return *a;
96}
97
98----end example code------
99
100Add <function_name>.o in the right alphabetically sorted place
101in libbb/Kbuild. You should look at the conditional part of
102libbb/Kbuild aswell.
103
104You should also try to find a suitable place in include/libbb.h for
105the function declaration. If not, add it somewhere anyway, with or without
106ifdefs to include or not.
107
108You can look at libbb/Config.in and try to find out if the function is
109tuneable and add it there if it is.
110
72 111
73Placement / Directory 112Placement / Directory
74--------------------- 113---------------------
@@ -78,9 +117,9 @@ Find the appropriate directory for your new applet.
78Make 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
79sorted alphabetically. 118sorted alphabetically.
80 119
81Add the applet to Makefile.in in the chosen directory: 120Add the applet to Kbuild in the chosen directory:
82 121
83obj-$(CONFIG_MU) += mu.o 122lib-$(CONFIG_MU) += mu.o
84 123
85Add the applet to Config.in in the chosen directory: 124Add the applet to Config.in in the chosen directory:
86 125
@@ -119,31 +158,22 @@ Next, add an entry to include/applets.h. Be *sure* to keep the list
119in alphabetical order, or else it will break the binary-search lookup 158in alphabetical order, or else it will break the binary-search lookup
120algorithm 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:
121 160
161Be sure to read the top of applets.h before adding your applet.
162
122 /* all programs above here are alphabetically "less than" 'mu' */ 163 /* all programs above here are alphabetically "less than" 'mu' */
123 #ifdef CONFIG_MU 164 USE_MU(APPLET(mu, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
124 APPLET("mu", mu_main, _BB_DIR_USR_BIN, mu_usage)
125 #endif
126 /* all programs below here are alphabetically "greater than" 'mu' */ 165 /* all programs below here are alphabetically "greater than" 'mu' */
127 166
128 167
129Documentation
130-------------
131
132If you're feeling especially nice, you should also document your applet in the
133docs directory (but nobody ever does that).
134
135Adding some text to docs/Configure.help is a nice start.
136
137
138The Grand Announcement 168The Grand Announcement
139---------------------- 169----------------------
140 170
141Then create a diff -urN of the files you added and/or modified. Typically: 171Then create a diff by adding the new files with svn (remember your libbb files)
142 <appletdir>/<applet>.c 172 svn add <where you put it>/mu.c
143 include/usage.c 173eventually also:
144 include/applets.h 174 svn add libbb/function.c
145 <appletdir>/Makefile.in 175then
146 <appletdir>/config.in 176 svn diff
147and send it to the mailing list: 177and send it to the mailing list:
148 busybox@busybox.net 178 busybox@busybox.net
149 http://busybox.net/mailman/listinfo/busybox 179 http://busybox.net/mailman/listinfo/busybox