Patch from Lars Kellogg-Stedman <lars@larsshack.org> to fix bug

#1130 (i.e. When you turn on features it should always ADD features)
This commit is contained in:
Eric Andersen 2001-05-21 20:30:51 +00:00
parent abec344ab7
commit 004015e9c4
14 changed files with 62 additions and 63 deletions

View File

@ -192,8 +192,8 @@
// enable ls -L // enable ls -L
#define BB_FEATURE_LS_FOLLOWLINKS #define BB_FEATURE_LS_FOLLOWLINKS
// //
// Change ping implementation -- simplified, featureless, but really small. // Disable for a smaller (but less functional) ping
//#define BB_FEATURE_SIMPLE_PING #define BB_FEATURE_FANCY_PING
// //
// Make init use a simplified /etc/inittab file (recommended). // Make init use a simplified /etc/inittab file (recommended).
#define BB_FEATURE_USE_INITTAB #define BB_FEATURE_USE_INITTAB
@ -213,9 +213,9 @@
// enable syslogd -C // enable syslogd -C
//#define BB_FEATURE_IPC_SYSLOG //#define BB_FEATURE_IPC_SYSLOG
// //
//Simple tail implementation (2.34k vs 3k for the full one). //Disable for a simple tail implementation (2.34k vs 3k for the full one).
//Both provide 'tail -f', but this cuts out -c, -q, -s, and -v. //Both provide 'tail -f', but this cuts out -c, -q, -s, and -v.
#define BB_FEATURE_SIMPLE_TAIL #define BB_FEATURE_FANCY_TAIL
// //
// Enable support for loop devices in mount // Enable support for loop devices in mount
#define BB_FEATURE_MOUNT_LOOP #define BB_FEATURE_MOUNT_LOOP
@ -273,12 +273,11 @@
// Only relevant if BB_SH is enabled. Off by default. // Only relevant if BB_SH is enabled. Off by default.
//#define BB_FEATURE_SH_APPLETS_ALWAYS_WIN //#define BB_FEATURE_SH_APPLETS_ALWAYS_WIN
// //
// Some deeply embedded systems don't have usernames or even hostnames, // Uncomment this option for a fancy shell prompt that includes the
// and the default prompt can look rather hideous on them. Uncomment // current username and hostname. On systems that don't have usernames
// this option for a simpler, path-only prompt (which was the default until // or hostnames, this can look hideous.
// around BusyBox-0.48). On by default.
// Only relevant if BB_SH is enabled. // Only relevant if BB_SH is enabled.
#define BB_FEATURE_SH_SIMPLE_PROMPT //#define BB_FEATURE_SH_FANCY_PROMPT
// //
//Turn on extra fbset options //Turn on extra fbset options
//#define BB_FEATURE_FBSET_FANCY //#define BB_FEATURE_FBSET_FANCY
@ -389,12 +388,12 @@
#undef BB_FEATURE_COMMAND_EDITING #undef BB_FEATURE_COMMAND_EDITING
#undef BB_FEATURE_COMMAND_TAB_COMPLETION #undef BB_FEATURE_COMMAND_TAB_COMPLETION
#undef BB_FEATURE_COMMAND_USERNAME_COMPLETION #undef BB_FEATURE_COMMAND_USERNAME_COMPLETION
#define BB_FEATURE_SH_SIMPLE_PROMPT #undef BB_FEATURE_SH_FANCY_PROMPT
#endif #endif
#else #else
#undef BB_FEATURE_SH_APPLETS_ALWAYS_WIN #undef BB_FEATURE_SH_APPLETS_ALWAYS_WIN
#undef BB_FEATURE_SH_STANDALONE_SHELL #undef BB_FEATURE_SH_STANDALONE_SHELL
#undef BB_FEATURE_SH_SIMPLE_PROMPT #undef BB_FEATURE_SH_FANCY_PROMPT
#endif #endif
// //
#ifdef BB_KILLALL #ifdef BB_KILLALL

View File

@ -1166,7 +1166,7 @@
"Name: debian\n" \ "Name: debian\n" \
"Address: 127.0.0.1\n" "Address: 127.0.0.1\n"
#ifdef BB_FEATURE_SIMPLE_PING #ifndef BB_FEATURE_FANCY_PING
#define ping_trivial_usage "host" #define ping_trivial_usage "host"
#define ping_full_usage "Send ICMP ECHO_REQUEST packets to network hosts" #define ping_full_usage "Send ICMP ECHO_REQUEST packets to network hosts"
#else #else
@ -1433,7 +1433,7 @@
"$ syslogd -R 192.168.1.1:601\n" "$ syslogd -R 192.168.1.1:601\n"
#ifdef BB_FEATURE_SIMPLE_TAIL #ifndef BB_FEATURE_FANCY_TAIL
#define USAGE_UNSIMPLE_TAIL(a) #define USAGE_UNSIMPLE_TAIL(a)
#else #else
#define USAGE_UNSIMPLE_TAIL(a) a #define USAGE_UNSIMPLE_TAIL(a) a

View File

@ -76,7 +76,7 @@
#undef BB_FEATURE_COMMAND_USERNAME_COMPLETION #undef BB_FEATURE_COMMAND_USERNAME_COMPLETION
#endif #endif
#if defined(BB_FEATURE_COMMAND_USERNAME_COMPLETION) || !defined(BB_FEATURE_SH_SIMPLE_PROMPT) #if defined(BB_FEATURE_COMMAND_USERNAME_COMPLETION) || defined(BB_FEATURE_SH_FANCY_PROMPT)
#define BB_FEATURE_GETUSERNAME_AND_HOMEDIR #define BB_FEATURE_GETUSERNAME_AND_HOMEDIR
#endif #endif
@ -151,7 +151,7 @@ static int cursor; /* required global for signal handler */
static int len; /* --- "" - - "" - -"- --""-- --""--- */ static int len; /* --- "" - - "" - -"- --""-- --""--- */
static char *command_ps; /* --- "" - - "" - -"- --""-- --""--- */ static char *command_ps; /* --- "" - - "" - -"- --""-- --""--- */
static static
#ifdef BB_FEATURE_SH_SIMPLE_PROMPT #ifndef BB_FEATURE_SH_FANCY_PROMPT
const const
#endif #endif
char *cmdedit_prompt; /* --- "" - - "" - -"- --""-- --""--- */ char *cmdedit_prompt; /* --- "" - - "" - -"- --""-- --""--- */
@ -166,7 +166,7 @@ static char *home_pwd_buf = "";
static int my_euid; static int my_euid;
#endif #endif
#ifndef BB_FEATURE_SH_SIMPLE_PROMPT #ifdef BB_FEATURE_SH_FANCY_PROMPT
static char *hostname_buf = ""; static char *hostname_buf = "";
static int num_ok_lines = 1; static int num_ok_lines = 1;
#endif #endif
@ -335,7 +335,7 @@ static void put_prompt(void)
cursor = 0; cursor = 0;
} }
#ifdef BB_FEATURE_SH_SIMPLE_PROMPT #ifndef BB_FEATURE_SH_FANCY_PROMPT
static void parse_prompt(const char *prmt_ptr) static void parse_prompt(const char *prmt_ptr)
{ {
cmdedit_prompt = prmt_ptr; cmdedit_prompt = prmt_ptr;
@ -1469,7 +1469,7 @@ prepare_to_die:
history_counter++; history_counter++;
} }
} }
#if !defined(BB_FEATURE_SH_SIMPLE_PROMPT) #if defined(BB_FEATURE_SH_FANCY_PROMPT)
num_ok_lines++; num_ok_lines++;
#endif #endif
} }
@ -1478,7 +1478,7 @@ prepare_to_die:
#if defined(BB_FEATURE_CLEAN_UP) && defined(BB_FEATURE_COMMAND_TAB_COMPLETION) #if defined(BB_FEATURE_CLEAN_UP) && defined(BB_FEATURE_COMMAND_TAB_COMPLETION)
input_tab(0); /* strong free */ input_tab(0); /* strong free */
#endif #endif
#if !defined(BB_FEATURE_SH_SIMPLE_PROMPT) #if defined(BB_FEATURE_SH_FANCY_PROMPT)
free(cmdedit_prompt); free(cmdedit_prompt);
#endif #endif
return; return;
@ -1519,7 +1519,7 @@ int main(int argc, char **argv)
{ {
char buff[BUFSIZ]; char buff[BUFSIZ];
char *prompt = char *prompt =
#if !defined(BB_FEATURE_SH_SIMPLE_PROMPT) #if defined(BB_FEATURE_SH_FANCY_PROMPT)
"\\[\\033[32;1m\\]\\u@\\[\\x1b[33;1m\\]\\h:\ "\\[\\033[32;1m\\]\\u@\\[\\x1b[33;1m\\]\\h:\
\\[\\033[34;1m\\]\\w\\[\\033[35;1m\\] \ \\[\\033[34;1m\\]\\w\\[\\033[35;1m\\] \
\\!\\[\\e[36;1m\\]\\$ \\[\\E[0m\\]"; \\!\\[\\e[36;1m\\]\\$ \\[\\E[0m\\]";

View File

@ -73,7 +73,7 @@ int tail_main(int argc, char **argv)
case 'f': case 'f':
follow = 1; follow = 1;
break; break;
#ifndef BB_FEATURE_SIMPLE_TAIL #ifdef BB_FEATURE_FANCY_TAIL
case 'c': case 'c':
units = BYTES; units = BYTES;
/* FALLS THROUGH */ /* FALLS THROUGH */
@ -85,7 +85,7 @@ int tail_main(int argc, char **argv)
if (optarg[0] == '+') if (optarg[0] == '+')
from_top = 1; from_top = 1;
break; break;
#ifndef BB_FEATURE_SIMPLE_TAIL #ifdef BB_FEATURE_FANCY_TAIL
case 'q': case 'q':
hide_headers = 1; hide_headers = 1;
break; break;
@ -118,7 +118,7 @@ int tail_main(int argc, char **argv)
} }
} }
#ifndef BB_FEATURE_SIMPLE_TAIL #ifdef BB_FEATURE_FANCY_TAIL
/* tail the files */ /* tail the files */
if (!from_top && units == BYTES) if (!from_top && units == BYTES)
tailbuf = xmalloc(count); tailbuf = xmalloc(count);
@ -132,7 +132,7 @@ int tail_main(int argc, char **argv)
printf("%s==> %s <==\n", i == 0 ? "" : "\n", argv[optind + i]); printf("%s==> %s <==\n", i == 0 ? "" : "\n", argv[optind + i]);
while ((nread = safe_read(fds[i], buf, sizeof(buf))) > 0) { while ((nread = safe_read(fds[i], buf, sizeof(buf))) > 0) {
if (from_top) { if (from_top) {
#ifndef BB_FEATURE_SIMPLE_TAIL #ifdef BB_FEATURE_FANCY_TAIL
if (units == BYTES) { if (units == BYTES) {
if (count - 1 <= seen) if (count - 1 <= seen)
nwrite = nread; nwrite = nread;
@ -165,7 +165,7 @@ int tail_main(int argc, char **argv)
break; break;
} }
} else { } else {
#ifndef BB_FEATURE_SIMPLE_TAIL #ifdef BB_FEATURE_FANCY_TAIL
if (units == BYTES) { if (units == BYTES) {
if (nread < count) { if (nread < count) {
memmove(tailbuf, tailbuf + nread, count - nread); memmove(tailbuf, tailbuf + nread, count - nread);
@ -199,7 +199,7 @@ int tail_main(int argc, char **argv)
status = EXIT_FAILURE; status = EXIT_FAILURE;
} }
#ifndef BB_FEATURE_SIMPLE_TAIL #ifdef BB_FEATURE_FANCY_TAIL
if (!from_top && units == BYTES) { if (!from_top && units == BYTES) {
if (count < seen) if (count < seen)
seen = count; seen = count;

6
hush.c
View File

@ -113,7 +113,7 @@
#define applet_name "hush" #define applet_name "hush"
#include "standalone.h" #include "standalone.h"
#define shell_main main #define shell_main main
#define BB_FEATURE_SH_SIMPLE_PROMPT #undef BB_FEATURE_SH_FANCY_PROMPT
#endif #endif
typedef enum { typedef enum {
@ -843,7 +843,7 @@ static int static_peek(struct in_str *i)
static inline void cmdedit_set_initial_prompt(void) static inline void cmdedit_set_initial_prompt(void)
{ {
#ifdef BB_FEATURE_SH_SIMPLE_PROMPT #ifndef BB_FEATURE_SH_FANCY_PROMPT
PS1 = NULL; PS1 = NULL;
#else #else
PS1 = getenv("PS1"); PS1 = getenv("PS1");
@ -855,7 +855,7 @@ static inline void cmdedit_set_initial_prompt(void)
static inline void setup_prompt_string(int promptmode, char **prompt_str) static inline void setup_prompt_string(int promptmode, char **prompt_str)
{ {
debug_printf("setup_prompt_string %d ",promptmode); debug_printf("setup_prompt_string %d ",promptmode);
#ifdef BB_FEATURE_SH_SIMPLE_PROMPT #ifndef BB_FEATURE_SH_FANCY_PROMPT
/* Set up the prompt */ /* Set up the prompt */
if (promptmode == 1) { if (promptmode == 1) {
if (PS1) if (PS1)

View File

@ -1166,7 +1166,7 @@
"Name: debian\n" \ "Name: debian\n" \
"Address: 127.0.0.1\n" "Address: 127.0.0.1\n"
#ifdef BB_FEATURE_SIMPLE_PING #ifndef BB_FEATURE_FANCY_PING
#define ping_trivial_usage "host" #define ping_trivial_usage "host"
#define ping_full_usage "Send ICMP ECHO_REQUEST packets to network hosts" #define ping_full_usage "Send ICMP ECHO_REQUEST packets to network hosts"
#else #else
@ -1433,7 +1433,7 @@
"$ syslogd -R 192.168.1.1:601\n" "$ syslogd -R 192.168.1.1:601\n"
#ifdef BB_FEATURE_SIMPLE_TAIL #ifndef BB_FEATURE_FANCY_TAIL
#define USAGE_UNSIMPLE_TAIL(a) #define USAGE_UNSIMPLE_TAIL(a)
#else #else
#define USAGE_UNSIMPLE_TAIL(a) a #define USAGE_UNSIMPLE_TAIL(a) a

6
lash.c
View File

@ -436,7 +436,7 @@ static int builtin_export(struct child_prog *child)
res = putenv(v); res = putenv(v);
if (res) if (res)
fprintf(stderr, "export: %m\n"); fprintf(stderr, "export: %m\n");
#ifndef BB_FEATURE_SH_SIMPLE_PROMPT #ifdef BB_FEATURE_SH_FANCY_PROMPT
if (strncmp(v, "PS1=", 4)==0) if (strncmp(v, "PS1=", 4)==0)
PS1 = getenv("PS1"); PS1 = getenv("PS1");
#endif #endif
@ -809,7 +809,7 @@ static void restore_redirects(int squirrel[])
static inline void cmdedit_set_initial_prompt(void) static inline void cmdedit_set_initial_prompt(void)
{ {
#ifdef BB_FEATURE_SH_SIMPLE_PROMPT #ifndef BB_FEATURE_SH_FANCY_PROMPT
PS1 = NULL; PS1 = NULL;
#else #else
PS1 = getenv("PS1"); PS1 = getenv("PS1");
@ -820,7 +820,7 @@ static inline void cmdedit_set_initial_prompt(void)
static inline void setup_prompt_string(char **prompt_str) static inline void setup_prompt_string(char **prompt_str)
{ {
#ifdef BB_FEATURE_SH_SIMPLE_PROMPT #ifndef BB_FEATURE_SH_FANCY_PROMPT
/* Set up the prompt */ /* Set up the prompt */
if (shell_context == 0) { if (shell_context == 0) {
if (PS1) if (PS1)

View File

@ -1,6 +1,6 @@
/* vi: set sw=4 ts=4: */ /* vi: set sw=4 ts=4: */
/* /*
* $Id: ping.c,v 1.42 2001/05/16 15:52:23 kraai Exp $ * $Id: ping.c,v 1.43 2001/05/21 20:30:51 andersen Exp $
* Mini ping implementation for busybox * Mini ping implementation for busybox
* *
* Copyright (C) 1999 by Randolph Chung <tausq@debian.org> * Copyright (C) 1999 by Randolph Chung <tausq@debian.org>
@ -174,7 +174,7 @@ static int in_cksum(unsigned short *buf, int sz)
} }
/* simple version */ /* simple version */
#ifdef BB_FEATURE_SIMPLE_PING #ifndef BB_FEATURE_FANCY_PING
static char *hostname = NULL; static char *hostname = NULL;
static void noresp(int ign) static void noresp(int ign)
@ -251,7 +251,7 @@ extern int ping_main(int argc, char **argv)
return EXIT_SUCCESS; return EXIT_SUCCESS;
} }
#else /* ! BB_FEATURE_SIMPLE_PING */ #else /* ! BB_FEATURE_FANCY_PING */
/* full(er) version */ /* full(er) version */
static char *hostname = NULL; static char *hostname = NULL;
static struct sockaddr_in pingaddr; static struct sockaddr_in pingaddr;
@ -534,7 +534,7 @@ extern int ping_main(int argc, char **argv)
ping(*argv); ping(*argv);
return EXIT_SUCCESS; return EXIT_SUCCESS;
} }
#endif /* ! BB_FEATURE_SIMPLE_PING */ #endif /* ! BB_FEATURE_FANCY_PING */
/* /*
* Copyright (c) 1989 The Regents of the University of California. * Copyright (c) 1989 The Regents of the University of California.

8
ping.c
View File

@ -1,6 +1,6 @@
/* vi: set sw=4 ts=4: */ /* vi: set sw=4 ts=4: */
/* /*
* $Id: ping.c,v 1.42 2001/05/16 15:52:23 kraai Exp $ * $Id: ping.c,v 1.43 2001/05/21 20:30:51 andersen Exp $
* Mini ping implementation for busybox * Mini ping implementation for busybox
* *
* Copyright (C) 1999 by Randolph Chung <tausq@debian.org> * Copyright (C) 1999 by Randolph Chung <tausq@debian.org>
@ -174,7 +174,7 @@ static int in_cksum(unsigned short *buf, int sz)
} }
/* simple version */ /* simple version */
#ifdef BB_FEATURE_SIMPLE_PING #ifndef BB_FEATURE_FANCY_PING
static char *hostname = NULL; static char *hostname = NULL;
static void noresp(int ign) static void noresp(int ign)
@ -251,7 +251,7 @@ extern int ping_main(int argc, char **argv)
return EXIT_SUCCESS; return EXIT_SUCCESS;
} }
#else /* ! BB_FEATURE_SIMPLE_PING */ #else /* ! BB_FEATURE_FANCY_PING */
/* full(er) version */ /* full(er) version */
static char *hostname = NULL; static char *hostname = NULL;
static struct sockaddr_in pingaddr; static struct sockaddr_in pingaddr;
@ -534,7 +534,7 @@ extern int ping_main(int argc, char **argv)
ping(*argv); ping(*argv);
return EXIT_SUCCESS; return EXIT_SUCCESS;
} }
#endif /* ! BB_FEATURE_SIMPLE_PING */ #endif /* ! BB_FEATURE_FANCY_PING */
/* /*
* Copyright (c) 1989 The Regents of the University of California. * Copyright (c) 1989 The Regents of the University of California.

View File

@ -76,7 +76,7 @@
#undef BB_FEATURE_COMMAND_USERNAME_COMPLETION #undef BB_FEATURE_COMMAND_USERNAME_COMPLETION
#endif #endif
#if defined(BB_FEATURE_COMMAND_USERNAME_COMPLETION) || !defined(BB_FEATURE_SH_SIMPLE_PROMPT) #if defined(BB_FEATURE_COMMAND_USERNAME_COMPLETION) || defined(BB_FEATURE_SH_FANCY_PROMPT)
#define BB_FEATURE_GETUSERNAME_AND_HOMEDIR #define BB_FEATURE_GETUSERNAME_AND_HOMEDIR
#endif #endif
@ -151,7 +151,7 @@ static int cursor; /* required global for signal handler */
static int len; /* --- "" - - "" - -"- --""-- --""--- */ static int len; /* --- "" - - "" - -"- --""-- --""--- */
static char *command_ps; /* --- "" - - "" - -"- --""-- --""--- */ static char *command_ps; /* --- "" - - "" - -"- --""-- --""--- */
static static
#ifdef BB_FEATURE_SH_SIMPLE_PROMPT #ifndef BB_FEATURE_SH_FANCY_PROMPT
const const
#endif #endif
char *cmdedit_prompt; /* --- "" - - "" - -"- --""-- --""--- */ char *cmdedit_prompt; /* --- "" - - "" - -"- --""-- --""--- */
@ -166,7 +166,7 @@ static char *home_pwd_buf = "";
static int my_euid; static int my_euid;
#endif #endif
#ifndef BB_FEATURE_SH_SIMPLE_PROMPT #ifdef BB_FEATURE_SH_FANCY_PROMPT
static char *hostname_buf = ""; static char *hostname_buf = "";
static int num_ok_lines = 1; static int num_ok_lines = 1;
#endif #endif
@ -335,7 +335,7 @@ static void put_prompt(void)
cursor = 0; cursor = 0;
} }
#ifdef BB_FEATURE_SH_SIMPLE_PROMPT #ifndef BB_FEATURE_SH_FANCY_PROMPT
static void parse_prompt(const char *prmt_ptr) static void parse_prompt(const char *prmt_ptr)
{ {
cmdedit_prompt = prmt_ptr; cmdedit_prompt = prmt_ptr;
@ -1469,7 +1469,7 @@ prepare_to_die:
history_counter++; history_counter++;
} }
} }
#if !defined(BB_FEATURE_SH_SIMPLE_PROMPT) #if defined(BB_FEATURE_SH_FANCY_PROMPT)
num_ok_lines++; num_ok_lines++;
#endif #endif
} }
@ -1478,7 +1478,7 @@ prepare_to_die:
#if defined(BB_FEATURE_CLEAN_UP) && defined(BB_FEATURE_COMMAND_TAB_COMPLETION) #if defined(BB_FEATURE_CLEAN_UP) && defined(BB_FEATURE_COMMAND_TAB_COMPLETION)
input_tab(0); /* strong free */ input_tab(0); /* strong free */
#endif #endif
#if !defined(BB_FEATURE_SH_SIMPLE_PROMPT) #if defined(BB_FEATURE_SH_FANCY_PROMPT)
free(cmdedit_prompt); free(cmdedit_prompt);
#endif #endif
return; return;
@ -1519,7 +1519,7 @@ int main(int argc, char **argv)
{ {
char buff[BUFSIZ]; char buff[BUFSIZ];
char *prompt = char *prompt =
#if !defined(BB_FEATURE_SH_SIMPLE_PROMPT) #if defined(BB_FEATURE_SH_FANCY_PROMPT)
"\\[\\033[32;1m\\]\\u@\\[\\x1b[33;1m\\]\\h:\ "\\[\\033[32;1m\\]\\u@\\[\\x1b[33;1m\\]\\h:\
\\[\\033[34;1m\\]\\w\\[\\033[35;1m\\] \ \\[\\033[34;1m\\]\\w\\[\\033[35;1m\\] \
\\!\\[\\e[36;1m\\]\\$ \\[\\E[0m\\]"; \\!\\[\\e[36;1m\\]\\$ \\[\\E[0m\\]";

View File

@ -113,7 +113,7 @@
#define applet_name "hush" #define applet_name "hush"
#include "standalone.h" #include "standalone.h"
#define shell_main main #define shell_main main
#define BB_FEATURE_SH_SIMPLE_PROMPT #undef BB_FEATURE_SH_FANCY_PROMPT
#endif #endif
typedef enum { typedef enum {
@ -843,7 +843,7 @@ static int static_peek(struct in_str *i)
static inline void cmdedit_set_initial_prompt(void) static inline void cmdedit_set_initial_prompt(void)
{ {
#ifdef BB_FEATURE_SH_SIMPLE_PROMPT #ifndef BB_FEATURE_SH_FANCY_PROMPT
PS1 = NULL; PS1 = NULL;
#else #else
PS1 = getenv("PS1"); PS1 = getenv("PS1");
@ -855,7 +855,7 @@ static inline void cmdedit_set_initial_prompt(void)
static inline void setup_prompt_string(int promptmode, char **prompt_str) static inline void setup_prompt_string(int promptmode, char **prompt_str)
{ {
debug_printf("setup_prompt_string %d ",promptmode); debug_printf("setup_prompt_string %d ",promptmode);
#ifdef BB_FEATURE_SH_SIMPLE_PROMPT #ifndef BB_FEATURE_SH_FANCY_PROMPT
/* Set up the prompt */ /* Set up the prompt */
if (promptmode == 1) { if (promptmode == 1) {
if (PS1) if (PS1)

View File

@ -436,7 +436,7 @@ static int builtin_export(struct child_prog *child)
res = putenv(v); res = putenv(v);
if (res) if (res)
fprintf(stderr, "export: %m\n"); fprintf(stderr, "export: %m\n");
#ifndef BB_FEATURE_SH_SIMPLE_PROMPT #ifdef BB_FEATURE_SH_FANCY_PROMPT
if (strncmp(v, "PS1=", 4)==0) if (strncmp(v, "PS1=", 4)==0)
PS1 = getenv("PS1"); PS1 = getenv("PS1");
#endif #endif
@ -809,7 +809,7 @@ static void restore_redirects(int squirrel[])
static inline void cmdedit_set_initial_prompt(void) static inline void cmdedit_set_initial_prompt(void)
{ {
#ifdef BB_FEATURE_SH_SIMPLE_PROMPT #ifndef BB_FEATURE_SH_FANCY_PROMPT
PS1 = NULL; PS1 = NULL;
#else #else
PS1 = getenv("PS1"); PS1 = getenv("PS1");
@ -820,7 +820,7 @@ static inline void cmdedit_set_initial_prompt(void)
static inline void setup_prompt_string(char **prompt_str) static inline void setup_prompt_string(char **prompt_str)
{ {
#ifdef BB_FEATURE_SH_SIMPLE_PROMPT #ifndef BB_FEATURE_SH_FANCY_PROMPT
/* Set up the prompt */ /* Set up the prompt */
if (shell_context == 0) { if (shell_context == 0) {
if (PS1) if (PS1)

12
tail.c
View File

@ -73,7 +73,7 @@ int tail_main(int argc, char **argv)
case 'f': case 'f':
follow = 1; follow = 1;
break; break;
#ifndef BB_FEATURE_SIMPLE_TAIL #ifdef BB_FEATURE_FANCY_TAIL
case 'c': case 'c':
units = BYTES; units = BYTES;
/* FALLS THROUGH */ /* FALLS THROUGH */
@ -85,7 +85,7 @@ int tail_main(int argc, char **argv)
if (optarg[0] == '+') if (optarg[0] == '+')
from_top = 1; from_top = 1;
break; break;
#ifndef BB_FEATURE_SIMPLE_TAIL #ifdef BB_FEATURE_FANCY_TAIL
case 'q': case 'q':
hide_headers = 1; hide_headers = 1;
break; break;
@ -118,7 +118,7 @@ int tail_main(int argc, char **argv)
} }
} }
#ifndef BB_FEATURE_SIMPLE_TAIL #ifdef BB_FEATURE_FANCY_TAIL
/* tail the files */ /* tail the files */
if (!from_top && units == BYTES) if (!from_top && units == BYTES)
tailbuf = xmalloc(count); tailbuf = xmalloc(count);
@ -132,7 +132,7 @@ int tail_main(int argc, char **argv)
printf("%s==> %s <==\n", i == 0 ? "" : "\n", argv[optind + i]); printf("%s==> %s <==\n", i == 0 ? "" : "\n", argv[optind + i]);
while ((nread = safe_read(fds[i], buf, sizeof(buf))) > 0) { while ((nread = safe_read(fds[i], buf, sizeof(buf))) > 0) {
if (from_top) { if (from_top) {
#ifndef BB_FEATURE_SIMPLE_TAIL #ifdef BB_FEATURE_FANCY_TAIL
if (units == BYTES) { if (units == BYTES) {
if (count - 1 <= seen) if (count - 1 <= seen)
nwrite = nread; nwrite = nread;
@ -165,7 +165,7 @@ int tail_main(int argc, char **argv)
break; break;
} }
} else { } else {
#ifndef BB_FEATURE_SIMPLE_TAIL #ifdef BB_FEATURE_FANCY_TAIL
if (units == BYTES) { if (units == BYTES) {
if (nread < count) { if (nread < count) {
memmove(tailbuf, tailbuf + nread, count - nread); memmove(tailbuf, tailbuf + nread, count - nread);
@ -199,7 +199,7 @@ int tail_main(int argc, char **argv)
status = EXIT_FAILURE; status = EXIT_FAILURE;
} }
#ifndef BB_FEATURE_SIMPLE_TAIL #ifdef BB_FEATURE_FANCY_TAIL
if (!from_top && units == BYTES) { if (!from_top && units == BYTES) {
if (count < seen) if (count < seen)
seen = count; seen = count;

View File

@ -1166,7 +1166,7 @@
"Name: debian\n" \ "Name: debian\n" \
"Address: 127.0.0.1\n" "Address: 127.0.0.1\n"
#ifdef BB_FEATURE_SIMPLE_PING #ifndef BB_FEATURE_FANCY_PING
#define ping_trivial_usage "host" #define ping_trivial_usage "host"
#define ping_full_usage "Send ICMP ECHO_REQUEST packets to network hosts" #define ping_full_usage "Send ICMP ECHO_REQUEST packets to network hosts"
#else #else
@ -1433,7 +1433,7 @@
"$ syslogd -R 192.168.1.1:601\n" "$ syslogd -R 192.168.1.1:601\n"
#ifdef BB_FEATURE_SIMPLE_TAIL #ifndef BB_FEATURE_FANCY_TAIL
#define USAGE_UNSIMPLE_TAIL(a) #define USAGE_UNSIMPLE_TAIL(a)
#else #else
#define USAGE_UNSIMPLE_TAIL(a) a #define USAGE_UNSIMPLE_TAIL(a) a