aboutsummaryrefslogtreecommitdiff
path: root/shell
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2010-06-02 12:57:26 +0200
committerDenys Vlasenko <vda.linux@googlemail.com>2010-06-02 12:57:26 +0200
commitea8b252cb30c4b4463df43a5342af95931920f09 (patch)
treeb32f4cfd202c9b98cbb2a59bb5a629275e1b4119 /shell
parent8837c5dec402fd6782589c0a676bc7f90dea4061 (diff)
downloadbusybox-ea8b252cb30c4b4463df43a5342af95931920f09.tar.gz
*: better string sharing
text data bss dec hex filename 849427 441 7556 857424 d1550 busybox_old 849355 441 7556 857352 d1508 busybox_unstripped Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'shell')
-rw-r--r--shell/ash.c14
1 files changed, 6 insertions, 8 deletions
diff --git a/shell/ash.c b/shell/ash.c
index d77d9d3c2..08ad0f451 100644
--- a/shell/ash.c
+++ b/shell/ash.c
@@ -119,9 +119,7 @@ enum { NOPTS = ARRAY_SIZE(optletters_optnames) };
/* ============ Misc data */
-static const char homestr[] ALIGN1 = "HOME";
-static const char snlfmt[] ALIGN1 = "%s\n";
-static const char msg_illnum[] ALIGN1 = "Illegal number: %s";
+#define msg_illnum "Illegal number: %s"
/*
* We enclose jmp_buf in a structure so that we can declare pointers to
@@ -2520,7 +2518,7 @@ cdcmd(int argc UNUSED_PARAM, char **argv UNUSED_PARAM)
flags = cdopt();
dest = *argptr;
if (!dest)
- dest = bltinlookup(homestr);
+ dest = bltinlookup("HOME");
else if (LONE_DASH(dest)) {
dest = bltinlookup("OLDPWD");
flags |= CD_PRINT;
@@ -2567,7 +2565,7 @@ cdcmd(int argc UNUSED_PARAM, char **argv UNUSED_PARAM)
/* NOTREACHED */
out:
if (flags & CD_PRINT)
- out1fmt(snlfmt, curdir);
+ out1fmt("%s\n", curdir);
return 0;
}
@@ -2583,7 +2581,7 @@ pwdcmd(int argc UNUSED_PARAM, char **argv UNUSED_PARAM)
setpwd(dir, 0);
dir = physdir;
}
- out1fmt(snlfmt, dir);
+ out1fmt("%s\n", dir);
return 0;
}
@@ -5625,7 +5623,7 @@ exptilde(char *startp, char *p, int flags)
done:
*p = '\0';
if (*name == '\0') {
- home = lookupvar(homestr);
+ home = lookupvar("HOME");
} else {
pw = getpwnam(name);
if (pw == NULL)
@@ -9857,7 +9855,7 @@ chkmail(void)
}
if (!mail_var_path_changed && statb.st_mtime != *mtp) {
fprintf(
- stderr, snlfmt,
+ stderr, "%s\n",
pathopt ? pathopt : "you have mail"
);
}