aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorvapier <vapier@69ca8d6d-28ef-0310-b511-8ec308f3f277>2007-03-09 08:25:24 +0000
committervapier <vapier@69ca8d6d-28ef-0310-b511-8ec308f3f277>2007-03-09 08:25:24 +0000
commitce17ffbafc2e79b4d94d3bf5683ae9d25bf908f0 (patch)
tree1b5c7929aca17c8abf014e30d9e5d3abd983f30c
parentc2a4207b5625c9cfc0aa91a180aafbb4be851cb8 (diff)
downloadbusybox-w32-ce17ffbafc2e79b4d94d3bf5683ae9d25bf908f0.tar.gz
busybox-w32-ce17ffbafc2e79b4d94d3bf5683ae9d25bf908f0.tar.bz2
busybox-w32-ce17ffbafc2e79b4d94d3bf5683ae9d25bf908f0.zip
add STANDALONE support
git-svn-id: svn://busybox.net/trunk/busybox@18044 69ca8d6d-28ef-0310-b511-8ec308f3f277
-rw-r--r--shell/msh.c78
1 files changed, 73 insertions, 5 deletions
diff --git a/shell/msh.c b/shell/msh.c
index 58c498b61..89c375380 100644
--- a/shell/msh.c
+++ b/shell/msh.c
@@ -13,12 +13,80 @@
13 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 13 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
14 */ 14 */
15 15
16#include <setjmp.h> 16#ifdef STANDALONE
17#include <sys/times.h> 17# ifndef _GNU_SOURCE
18#include "busybox.h" 18# define _GNU_SOURCE
19 19# endif
20# include <setjmp.h>
21# include <sys/times.h>
22# include <sys/types.h>
23# include <sys/stat.h>
24# include <sys/wait.h>
25# include <signal.h>
26# include <stdio.h>
27# include <stdlib.h>
28# include <unistd.h>
29# include <string.h>
30# include <errno.h>
31# include <dirent.h>
32# include <fcntl.h>
33# include <ctype.h>
34# include <assert.h>
35# define bb_dev_null "/dev/null"
36# define DEFAULT_SHELL "/proc/self/exe"
37# define CONFIG_BUSYBOX_EXEC_PATH "/proc/self/exe"
38# define BB_BANNER "busybox standalone"
39# define ENABLE_FEATURE_SH_STANDALONE_SHELL 0
40# define bb_msg_memory_exhausted "memory exhausted"
41# define xmalloc(size) malloc(size)
42# define msh_main(argc,argv) main(argc,argv)
43# define safe_read(fd,buf,count) read(fd,buf,count)
44# define NOT_LONE_DASH(s) ((s)[0] != '-' || (s)[1])
45# define LONE_CHAR(s,c) ((s)[0] == (c) && !(s)[1])
46# define ATTRIBUTE_NORETURN __attribute__ ((__noreturn__))
47static char *find_applet_by_name(const char *applet)
48{
49 return NULL;
50}
51static void utoa_to_buf(unsigned n, char *buf, unsigned buflen)
52{
53 unsigned i, out, res;
54 assert(sizeof(unsigned) == 4);
55 if (buflen) {
56 out = 0;
57 for (i = 1000000000; i; i /= 10) {
58 res = n / i;
59 if (res || out || i == 1) {
60 if (!--buflen) break;
61 out++;
62 n -= res*i;
63 *buf++ = '0' + res;
64 }
65 }
66 *buf = '\0';
67 }
68}
69static void itoa_to_buf(int n, char *buf, unsigned buflen)
70{
71 if (buflen && n<0) {
72 n = -n;
73 *buf++ = '-';
74 buflen--;
75 }
76 utoa_to_buf((unsigned)n, buf, buflen);
77}
78static char local_buf[12];
79static char *itoa(int n)
80{
81 itoa_to_buf(n, local_buf, sizeof(local_buf));
82 return local_buf;
83}
84#else
85# include <setjmp.h>
86# include <sys/times.h>
87# include "busybox.h"
20extern char **environ; 88extern char **environ;
21 89#endif
22 90
23/*#define MSHDEBUG 1*/ 91/*#define MSHDEBUG 1*/
24 92