diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2010-10-23 21:06:06 +0200 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2010-10-23 21:06:06 +0200 |
commit | 53600591311a129717abd2e3bcaa302622a6ce67 (patch) | |
tree | 4b0d08ed429d4b73a9739339e74d84a8a72fe25e /loginutils | |
parent | 6a0d7490ea6ad97aeafb9da04acab13bd3c38e4d (diff) | |
download | busybox-w32-53600591311a129717abd2e3bcaa302622a6ce67.tar.gz busybox-w32-53600591311a129717abd2e3bcaa302622a6ce67.tar.bz2 busybox-w32-53600591311a129717abd2e3bcaa302622a6ce67.zip |
libbb: introduce and use strcpy_and_process_escape_sequences
function old new delta
strcpy_and_process_escape_sequences - 50 +50
bb_process_escape_sequence 148 138 -10
printf_main 789 776 -13
getty_main 1897 1831 -66
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 0/3 up/down: 50/-89) Total: -39 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'loginutils')
-rw-r--r-- | loginutils/getty.c | 18 |
1 files changed, 3 insertions, 15 deletions
diff --git a/loginutils/getty.c b/loginutils/getty.c index b1cd235fb..ab55ea4b0 100644 --- a/loginutils/getty.c +++ b/loginutils/getty.c | |||
@@ -188,21 +188,9 @@ static void parse_args(char **argv, struct options *op, char **fakehost_p) | |||
188 | &(op->login), &op->timeout); | 188 | &(op->login), &op->timeout); |
189 | argv += optind; | 189 | argv += optind; |
190 | if (op->flags & F_INITSTRING) { | 190 | if (op->flags & F_INITSTRING) { |
191 | const char *p = op->initstring; | 191 | op->initstring = xstrdup(op->initstring); |
192 | char *q; | 192 | /* decode \ddd octal codes into chars */ |
193 | 193 | strcpy_and_process_escape_sequences((char*)op->initstring, op->initstring); | |
194 | op->initstring = q = xstrdup(p); | ||
195 | /* copy optarg into op->initstring decoding \ddd | ||
196 | octal codes into chars */ | ||
197 | while (*p) { | ||
198 | if (*p == '\\') { | ||
199 | p++; | ||
200 | *q++ = bb_process_escape_sequence(&p); | ||
201 | } else { | ||
202 | *q++ = *p++; | ||
203 | } | ||
204 | } | ||
205 | *q = '\0'; | ||
206 | } | 194 | } |
207 | op->flags ^= F_ISSUE; /* invert flag "show /etc/issue" */ | 195 | op->flags ^= F_ISSUE; /* invert flag "show /etc/issue" */ |
208 | debug("after getopt\n"); | 196 | debug("after getopt\n"); |