aboutsummaryrefslogtreecommitdiff
path: root/shell
diff options
context:
space:
mode:
authorGravatar Rob Landley <rob@landley.net>2006-08-03 15:41:12 +0000
committerGravatar Rob Landley <rob@landley.net>2006-08-03 15:41:12 +0000
commitd921b2ecc0d294ad4bf8c7458fc52a60c28727d2 (patch)
treee4a2769349867c441cf2983d83097bb66701a733 /shell
parent6dce0b6fa79f2d4bb7e9d90e1fbc0f6beb25f855 (diff)
downloadbusybox-d921b2ecc0d294ad4bf8c7458fc52a60c28727d2.tar.gz
busybox-d921b2ecc0d294ad4bf8c7458fc52a60c28727d2.tar.bz2
Remove bb_ prefixes from xfuncs.c (and a few other places), consolidate
things like xasprintf() into xfuncs.c, remove xprint_file_by_name() (it only had one user), clean up lots of #includes... General cleanup pass. What I've been doing for the last couple days. And it conflicts! I've removed httpd.c from this checkin due to somebody else touching that file. It builds for me. I have to catch a bus. (Now you know why I'm looking forward to Mercurial.)
Diffstat (limited to 'shell')
-rw-r--r--shell/ash.c4
-rw-r--r--shell/cmdedit.c16
-rw-r--r--shell/hush.c4
-rw-r--r--shell/lash.c12
4 files changed, 18 insertions, 18 deletions
diff --git a/shell/ash.c b/shell/ash.c
index 5031ae153..c1b2b0ed6 100644
--- a/shell/ash.c
+++ b/shell/ash.c
@@ -6011,7 +6011,7 @@ static inline void putprompt(const char *s)
{
#ifdef CONFIG_ASH_EXPAND_PRMT
free(cmdedit_prompt);
- cmdedit_prompt = bb_xstrdup(s);
+ cmdedit_prompt = xstrdup(s);
#else
cmdedit_prompt = s;
#endif
@@ -8105,7 +8105,7 @@ static int dotcmd(int argc, char **argv)
int status = 0;
for (sp = cmdenviron; sp; sp = sp->next)
- setvareq(bb_xstrdup(sp->text), VSTRFIXED | VTEXTFIXED);
+ setvareq(xstrdup(sp->text), VSTRFIXED | VTEXTFIXED);
if (argc >= 2) { /* That's what SVR2 does */
char *fullname;
diff --git a/shell/cmdedit.c b/shell/cmdedit.c
index 59226aff5..0af1a2ad0 100644
--- a/shell/cmdedit.c
+++ b/shell/cmdedit.c
@@ -216,7 +216,7 @@ static void cmdedit_set_out_char(int next_char)
printf("\033[7m%c\033[0m", c);
} else
#endif
- putchar(c);
+ if (initial_settings.c_lflag & ECHO) putchar(c);
if (++cmdedit_x >= cmdedit_termw) {
/* terminal is scrolled down */
cmdedit_y++;
@@ -546,8 +546,8 @@ static void cmdedit_init(void)
my_euid = geteuid();
entry = getpwuid(my_euid);
if (entry) {
- user_buf = bb_xstrdup(entry->pw_name);
- home_pwd_buf = bb_xstrdup(entry->pw_dir);
+ user_buf = xstrdup(entry->pw_name);
+ home_pwd_buf = xstrdup(entry->pw_dir);
}
#endif
@@ -634,7 +634,7 @@ static void username_tab_completion(char *ud, char *with_shash_flg)
while ((entry = getpwent()) != NULL) {
/* Null usernames should result in all users as possible completions. */
if ( /*!userlen || */ !strncmp(ud, entry->pw_name, userlen)) {
- add_match(bb_xasprintf("~%s", entry->pw_name), '/');
+ add_match(xasprintf("~%s", entry->pw_name), '/');
}
}
@@ -684,7 +684,7 @@ static int path_parse(char ***p, int flags)
*p = xmalloc(npth * sizeof(char *));
tmp = pth;
- (*p)[0] = bb_xstrdup(tmp);
+ (*p)[0] = xstrdup(tmp);
npth = 1; /* count words is + 1 count ':' */
for (;;) {
@@ -1114,7 +1114,7 @@ static void input_tab(int *lastWasTab)
if (!matches)
return; /* not found */
/* find minimal match */
- tmp1 = bb_xstrdup(matches[0]);
+ tmp1 = xstrdup(matches[0]);
for (tmp = tmp1; *tmp; tmp++)
for (len_found = 1; len_found < num_matches; len_found++)
if (matches[len_found][(tmp - tmp1)] != *tmp) {
@@ -1175,7 +1175,7 @@ static void get_previous_history(void)
{
if(command_ps[0] != 0 || history[cur_history] == 0) {
free(history[cur_history]);
- history[cur_history] = bb_xstrdup(command_ps);
+ history[cur_history] = xstrdup(command_ps);
}
cur_history--;
}
@@ -1856,7 +1856,7 @@ rewrite_line:
for(i = 0; i < (MAX_HISTORY-1); i++)
history[i] = history[i+1];
}
- history[i++] = bb_xstrdup(command);
+ history[i++] = xstrdup(command);
cur_history = i;
n_history = i;
#if defined(CONFIG_FEATURE_SH_FANCY_PROMPT)
diff --git a/shell/hush.c b/shell/hush.c
index 8c432942e..8df91a1e8 100644
--- a/shell/hush.c
+++ b/shell/hush.c
@@ -1320,7 +1320,7 @@ static int run_pipe_real(struct pipe *pi)
* variable. */
int export_me=0;
char *name, *value;
- name = bb_xstrdup(child->argv[i]);
+ name = xstrdup(child->argv[i]);
debug_printf("Local environment set: %s\n", name);
value = strchr(name, '=');
if (value)
@@ -2753,7 +2753,7 @@ int hush_main(int argc, char **argv)
debug_printf("\nrunning script '%s'\n", argv[optind]);
global_argv = argv+optind;
global_argc = argc-optind;
- input = bb_xfopen(argv[optind], "r");
+ input = xfopen(argv[optind], "r");
opt = parse_file_outer(input);
#ifdef CONFIG_FEATURE_CLEAN_UP
diff --git a/shell/lash.c b/shell/lash.c
index 92c24d1c2..eae949e18 100644
--- a/shell/lash.c
+++ b/shell/lash.c
@@ -710,7 +710,7 @@ static char * strsep_space( char *string, int * ix)
return NULL;
}
- token = bb_xstrndup(string, *ix);
+ token = xstrndup(string, *ix);
return token;
}
@@ -751,7 +751,7 @@ static int expand_arguments(char *command)
/* We need a clean copy, so strsep can mess up the copy while
* we write stuff into the original (in a minute) */
- cmd = cmd_copy = bb_xstrdup(command);
+ cmd = cmd_copy = xstrdup(command);
*command = '\0';
for (ix = 0, tmpcmd = cmd;
(tmpcmd = strsep_space(cmd, &ix)) != NULL; cmd += ix, ix=0) {
@@ -1123,10 +1123,10 @@ static int parse_command(char **command_ptr, struct job *job, int *inbg)
prog->argv[argc_l] = NULL;
if (!return_command) {
- job->text = bb_xstrdup(*command_ptr);
+ job->text = xstrdup(*command_ptr);
} else {
/* This leaves any trailing spaces, which is a bit sloppy */
- job->text = bb_xstrndup(*command_ptr, return_command - *command_ptr);
+ job->text = xstrndup(*command_ptr, return_command - *command_ptr);
}
*command_ptr = return_command;
@@ -1543,7 +1543,7 @@ int lash_main(int argc_l, char **argv_l)
input = NULL;
if (local_pending_command != 0)
bb_error_msg_and_die("multiple -c arguments");
- local_pending_command = bb_xstrdup(argv[optind]);
+ local_pending_command = xstrdup(argv[optind]);
optind++;
argv = argv+optind;
break;
@@ -1575,7 +1575,7 @@ int lash_main(int argc_l, char **argv_l)
}
} else if (!local_pending_command && argv[optind]) {
//printf( "optind=%d argv[optind]='%s'\n", optind, argv[optind]);
- input = bb_xfopen(argv[optind], "r");
+ input = xfopen(argv[optind], "r");
/* be lazy, never mark this closed */
llist_add_to(&close_me_list, (void *)(long)fileno(input));
}