diff options
author | Denis Vlasenko <vda.linux@googlemail.com> | 2007-08-12 20:58:27 +0000 |
---|---|---|
committer | Denis Vlasenko <vda.linux@googlemail.com> | 2007-08-12 20:58:27 +0000 |
commit | 6ca409e0e4c198fe3081346eebbae3f068fe605a (patch) | |
tree | 060cb05d99220a1eda399194d1209c269f0e8cd8 /shell | |
parent | 4185548984357df91311f30c8e43d95f33922576 (diff) | |
download | busybox-w32-6ca409e0e4c198fe3081346eebbae3f068fe605a.tar.gz busybox-w32-6ca409e0e4c198fe3081346eebbae3f068fe605a.tar.bz2 busybox-w32-6ca409e0e4c198fe3081346eebbae3f068fe605a.zip |
trylink: produce even more info about final link stage
trylink: explain how to modify link and drastically decrease amount
of padding (unfortunately, needs hand editing ATM).
*: add ALIGN1 / ALIGN2 to global strings and arrays of bytes and shorts
size saving: 0.5k
Diffstat (limited to 'shell')
-rw-r--r-- | shell/ash.c | 58 | ||||
-rw-r--r-- | shell/hush.c | 5 | ||||
-rw-r--r-- | shell/lash.c | 2 | ||||
-rw-r--r-- | shell/msh.c | 9 |
4 files changed, 39 insertions, 35 deletions
diff --git a/shell/ash.c b/shell/ash.c index d34f5207f..9aec8ee0a 100644 --- a/shell/ash.c +++ b/shell/ash.c | |||
@@ -91,10 +91,10 @@ static const char *const optletters_optnames[] = { | |||
91 | "a" "allexport", | 91 | "a" "allexport", |
92 | "b" "notify", | 92 | "b" "notify", |
93 | "u" "nounset", | 93 | "u" "nounset", |
94 | "\0" "vi", | 94 | "\0" "vi" |
95 | #if DEBUG | 95 | #if DEBUG |
96 | "\0" "nolog", | 96 | ,"\0" "nolog" |
97 | "\0" "debug", | 97 | ,"\0" "debug" |
98 | #endif | 98 | #endif |
99 | }; | 99 | }; |
100 | 100 | ||
@@ -103,7 +103,7 @@ static const char *const optletters_optnames[] = { | |||
103 | 103 | ||
104 | enum { NOPTS = ARRAY_SIZE(optletters_optnames) }; | 104 | enum { NOPTS = ARRAY_SIZE(optletters_optnames) }; |
105 | 105 | ||
106 | static char optlist[NOPTS]; | 106 | static char optlist[NOPTS] ALIGN1; |
107 | 107 | ||
108 | #define eflag optlist[0] | 108 | #define eflag optlist[0] |
109 | #define fflag optlist[1] | 109 | #define fflag optlist[1] |
@@ -127,12 +127,12 @@ static char optlist[NOPTS]; | |||
127 | 127 | ||
128 | /* ============ Misc data */ | 128 | /* ============ Misc data */ |
129 | 129 | ||
130 | static char nullstr[1]; /* zero length string */ | 130 | static char nullstr[1] ALIGN1; /* zero length string */ |
131 | static const char homestr[] = "HOME"; | 131 | static const char homestr[] ALIGN1 = "HOME"; |
132 | static const char snlfmt[] = "%s\n"; | 132 | static const char snlfmt[] ALIGN1 = "%s\n"; |
133 | static const char illnum[] = "Illegal number: %s"; | 133 | static const char illnum[] ALIGN1 = "Illegal number: %s"; |
134 | 134 | ||
135 | static char *minusc; /* argument to -c option */ | 135 | static char *minusc; /* argument to -c option */ |
136 | 136 | ||
137 | /* pid of main shell */ | 137 | /* pid of main shell */ |
138 | static int rootpid; | 138 | static int rootpid; |
@@ -447,7 +447,9 @@ out2str(const char *p) | |||
447 | #define VSTRIMLEFTMAX 0x9 /* ${var##pattern} */ | 447 | #define VSTRIMLEFTMAX 0x9 /* ${var##pattern} */ |
448 | #define VSLENGTH 0xa /* ${#var} */ | 448 | #define VSLENGTH 0xa /* ${#var} */ |
449 | 449 | ||
450 | static const char dolatstr[] = { CTLVAR, VSNORMAL|VSQUOTE, '@', '=', '\0' }; | 450 | static const char dolatstr[] ALIGN1 = { |
451 | CTLVAR, VSNORMAL|VSQUOTE, '@', '=', '\0' | ||
452 | }; | ||
451 | 453 | ||
452 | #define NCMD 0 | 454 | #define NCMD 0 |
453 | #define NPIPE 1 | 455 | #define NPIPE 1 |
@@ -1583,10 +1585,10 @@ static unsigned long rseed; | |||
1583 | #endif | 1585 | #endif |
1584 | 1586 | ||
1585 | #ifdef IFS_BROKEN | 1587 | #ifdef IFS_BROKEN |
1586 | static const char defifsvar[] = "IFS= \t\n"; | 1588 | static const char defifsvar[] ALIGN1 = "IFS= \t\n"; |
1587 | #define defifs (defifsvar + 4) | 1589 | #define defifs (defifsvar + 4) |
1588 | #else | 1590 | #else |
1589 | static const char defifs[] = " \t\n"; | 1591 | static const char defifs[] ALIGN1 = " \t\n"; |
1590 | #endif | 1592 | #endif |
1591 | 1593 | ||
1592 | struct shparam { | 1594 | struct shparam { |
@@ -2548,16 +2550,16 @@ static const char S_I_T[][3] = { | |||
2548 | static int | 2550 | static int |
2549 | SIT(int c, int syntax) | 2551 | SIT(int c, int syntax) |
2550 | { | 2552 | { |
2551 | static const char spec_symbls[] = "\t\n !\"$&'()*-/:;<=>?[\\]`|}~"; | 2553 | static const char spec_symbls[] ALIGN1 = "\t\n !\"$&'()*-/:;<=>?[\\]`|}~"; |
2552 | #if ENABLE_ASH_ALIAS | 2554 | #if ENABLE_ASH_ALIAS |
2553 | static const char syntax_index_table[] = { | 2555 | static const char syntax_index_table[] ALIGN1 = { |
2554 | 1, 2, 1, 3, 4, 5, 1, 6, /* "\t\n !\"$&'" */ | 2556 | 1, 2, 1, 3, 4, 5, 1, 6, /* "\t\n !\"$&'" */ |
2555 | 7, 8, 3, 3, 3, 3, 1, 1, /* "()*-/:;<" */ | 2557 | 7, 8, 3, 3, 3, 3, 1, 1, /* "()*-/:;<" */ |
2556 | 3, 1, 3, 3, 9, 3, 10, 1, /* "=>?[\\]`|" */ | 2558 | 3, 1, 3, 3, 9, 3, 10, 1, /* "=>?[\\]`|" */ |
2557 | 11, 3 /* "}~" */ | 2559 | 11, 3 /* "}~" */ |
2558 | }; | 2560 | }; |
2559 | #else | 2561 | #else |
2560 | static const char syntax_index_table[] = { | 2562 | static const char syntax_index_table[] ALIGN1 = { |
2561 | 0, 1, 0, 2, 3, 4, 0, 5, /* "\t\n !\"$&'" */ | 2563 | 0, 1, 0, 2, 3, 4, 0, 5, /* "\t\n !\"$&'" */ |
2562 | 6, 7, 2, 2, 2, 2, 0, 0, /* "()*-/:;<" */ | 2564 | 6, 7, 2, 2, 2, 2, 0, 0, /* "()*-/:;<" */ |
2563 | 2, 0, 2, 2, 8, 2, 9, 0, /* "=>?[\\]`|" */ | 2565 | 2, 0, 2, 2, 8, 2, 9, 0, /* "=>?[\\]`|" */ |
@@ -5003,7 +5005,7 @@ esclen(const char *start, const char *p) | |||
5003 | static char * | 5005 | static char * |
5004 | _rmescapes(char *str, int flag) | 5006 | _rmescapes(char *str, int flag) |
5005 | { | 5007 | { |
5006 | static const char qchars[] = { CTLESC, CTLQUOTEMARK, '\0' }; | 5008 | static const char qchars[] ALIGN1 = { CTLESC, CTLQUOTEMARK, '\0' }; |
5007 | 5009 | ||
5008 | char *p, *q, *r; | 5010 | char *p, *q, *r; |
5009 | unsigned inquotes; | 5011 | unsigned inquotes; |
@@ -5420,7 +5422,7 @@ static char *evalvar(char *p, int flag); | |||
5420 | static void | 5422 | static void |
5421 | argstr(char *p, int flag) | 5423 | argstr(char *p, int flag) |
5422 | { | 5424 | { |
5423 | static const char spclchars[] = { | 5425 | static const char spclchars[] ALIGN1 = { |
5424 | '=', | 5426 | '=', |
5425 | ':', | 5427 | ':', |
5426 | CTLQUOTEMARK, | 5428 | CTLQUOTEMARK, |
@@ -6266,7 +6268,7 @@ expsort(struct strlist *str) | |||
6266 | static void | 6268 | static void |
6267 | expandmeta(struct strlist *str, int flag) | 6269 | expandmeta(struct strlist *str, int flag) |
6268 | { | 6270 | { |
6269 | static const char metachars[] = { | 6271 | static const char metachars[] ALIGN1 = { |
6270 | '*', '?', '[', 0 | 6272 | '*', '?', '[', 0 |
6271 | }; | 6273 | }; |
6272 | /* TODO - EXP_REDIR */ | 6274 | /* TODO - EXP_REDIR */ |
@@ -10200,7 +10202,7 @@ parsesub: { | |||
10200 | int typeloc; | 10202 | int typeloc; |
10201 | int flags; | 10203 | int flags; |
10202 | char *p; | 10204 | char *p; |
10203 | static const char types[] = "}-+?="; | 10205 | static const char types[] ALIGN1 = "}-+?="; |
10204 | 10206 | ||
10205 | c = pgetc(); | 10207 | c = pgetc(); |
10206 | if ( | 10208 | if ( |
@@ -10496,13 +10498,15 @@ parsearith: { | |||
10496 | #define NEW_xxreadtoken | 10498 | #define NEW_xxreadtoken |
10497 | #ifdef NEW_xxreadtoken | 10499 | #ifdef NEW_xxreadtoken |
10498 | /* singles must be first! */ | 10500 | /* singles must be first! */ |
10499 | static const char xxreadtoken_chars[7] = { '\n', '(', ')', '&', '|', ';', 0 }; | 10501 | static const char xxreadtoken_chars[7] ALIGN1 = { |
10502 | '\n', '(', ')', '&', '|', ';', 0 | ||
10503 | }; | ||
10500 | 10504 | ||
10501 | static const char xxreadtoken_tokens[] = { | 10505 | static const char xxreadtoken_tokens[] ALIGN1 = { |
10502 | TNL, TLP, TRP, /* only single occurrence allowed */ | 10506 | TNL, TLP, TRP, /* only single occurrence allowed */ |
10503 | TBACKGND, TPIPE, TSEMI, /* if single occurrence */ | 10507 | TBACKGND, TPIPE, TSEMI, /* if single occurrence */ |
10504 | TEOF, /* corresponds to trailing nul */ | 10508 | TEOF, /* corresponds to trailing nul */ |
10505 | TAND, TOR, TENDCASE, /* if double occurrence */ | 10509 | TAND, TOR, TENDCASE /* if double occurrence */ |
10506 | }; | 10510 | }; |
10507 | 10511 | ||
10508 | #define xxreadtoken_doubles \ | 10512 | #define xxreadtoken_doubles \ |
@@ -11379,7 +11383,7 @@ unsetcmd(int argc, char **argv) | |||
11379 | 11383 | ||
11380 | #include <sys/times.h> | 11384 | #include <sys/times.h> |
11381 | 11385 | ||
11382 | static const unsigned char timescmd_str[] = { | 11386 | static const unsigned char timescmd_str[] ALIGN1 = { |
11383 | ' ', offsetof(struct tms, tms_utime), | 11387 | ' ', offsetof(struct tms, tms_utime), |
11384 | '\n', offsetof(struct tms, tms_stime), | 11388 | '\n', offsetof(struct tms, tms_stime), |
11385 | ' ', offsetof(struct tms, tms_cutime), | 11389 | ' ', offsetof(struct tms, tms_cutime), |
@@ -11659,9 +11663,9 @@ readcmd(int argc, char **argv) | |||
11659 | static int | 11663 | static int |
11660 | umaskcmd(int argc, char **argv) | 11664 | umaskcmd(int argc, char **argv) |
11661 | { | 11665 | { |
11662 | static const char permuser[3] = "ugo"; | 11666 | static const char permuser[3] ALIGN1 = "ugo"; |
11663 | static const char permmode[3] = "rwx"; | 11667 | static const char permmode[3] ALIGN1 = "rwx"; |
11664 | static const short int permmask[] = { | 11668 | static const short permmask[] ALIGN2 = { |
11665 | S_IRUSR, S_IWUSR, S_IXUSR, | 11669 | S_IRUSR, S_IWUSR, S_IXUSR, |
11666 | S_IRGRP, S_IWGRP, S_IXGRP, | 11670 | S_IRGRP, S_IWGRP, S_IXGRP, |
11667 | S_IROTH, S_IWOTH, S_IXOTH | 11671 | S_IROTH, S_IWOTH, S_IXOTH |
@@ -12318,7 +12322,7 @@ arith_apply(operator op, v_n_t *numstack, v_n_t **numstackptr) | |||
12318 | } | 12322 | } |
12319 | 12323 | ||
12320 | /* longest must be first */ | 12324 | /* longest must be first */ |
12321 | static const char op_tokens[] = { | 12325 | static const char op_tokens[] ALIGN1 = { |
12322 | '<','<','=',0, TOK_LSHIFT_ASSIGN, | 12326 | '<','<','=',0, TOK_LSHIFT_ASSIGN, |
12323 | '>','>','=',0, TOK_RSHIFT_ASSIGN, | 12327 | '>','>','=',0, TOK_RSHIFT_ASSIGN, |
12324 | '<','<', 0, TOK_LSHIFT, | 12328 | '<','<', 0, TOK_LSHIFT, |
diff --git a/shell/hush.c b/shell/hush.c index 275b69ef3..5796f1127 100644 --- a/shell/hush.c +++ b/shell/hush.c | |||
@@ -126,7 +126,8 @@ extern char **environ; /* This is in <unistd.h>, but protected with __USE_GNU */ | |||
126 | /* broken, of course, but OK for testing */ | 126 | /* broken, of course, but OK for testing */ |
127 | static const char *indenter(int i) | 127 | static const char *indenter(int i) |
128 | { | 128 | { |
129 | static const char blanks[] = " "; | 129 | static const char blanks[] ALIGN1 = |
130 | " "; | ||
130 | return &blanks[sizeof(blanks) - i - 1]; | 131 | return &blanks[sizeof(blanks) - i - 1]; |
131 | } | 132 | } |
132 | #define debug_printf_clean(...) fprintf(stderr, __VA_ARGS__) | 133 | #define debug_printf_clean(...) fprintf(stderr, __VA_ARGS__) |
@@ -3656,7 +3657,7 @@ static void setup_job_control(void) | |||
3656 | int hush_main(int argc, char **argv); | 3657 | int hush_main(int argc, char **argv); |
3657 | int hush_main(int argc, char **argv) | 3658 | int hush_main(int argc, char **argv) |
3658 | { | 3659 | { |
3659 | static const char version_str[] = "HUSH_VERSION="HUSH_VER_STR; | 3660 | static const char version_str[] ALIGN1 = "HUSH_VERSION="HUSH_VER_STR; |
3660 | static const struct variable const_shell_ver = { | 3661 | static const struct variable const_shell_ver = { |
3661 | .next = NULL, | 3662 | .next = NULL, |
3662 | .varstr = (char*)version_str, | 3663 | .varstr = (char*)version_str, |
diff --git a/shell/lash.c b/shell/lash.c index e5c7ef670..c28a1034a 100644 --- a/shell/lash.c +++ b/shell/lash.c | |||
@@ -711,7 +711,7 @@ static char * strsep_space(char *string, int * ix) | |||
711 | 711 | ||
712 | static int expand_arguments(char *command) | 712 | static int expand_arguments(char *command) |
713 | { | 713 | { |
714 | static const char out_of_space[] = "out of space during expansion"; | 714 | static const char out_of_space[] ALIGN1 = "out of space during expansion"; |
715 | 715 | ||
716 | int total_length = 0, length, i, retval, ix = 0; | 716 | int total_length = 0, length, i, retval, ix = 0; |
717 | expand_t expand_result; | 717 | expand_t expand_result; |
diff --git a/shell/msh.c b/shell/msh.c index effdc0107..f1b3f0525 100644 --- a/shell/msh.c +++ b/shell/msh.c | |||
@@ -280,7 +280,7 @@ struct brkcon { | |||
280 | * -x: trace | 280 | * -x: trace |
281 | * -u: unset variables net diagnostic | 281 | * -u: unset variables net diagnostic |
282 | */ | 282 | */ |
283 | static char flags['z' - 'a' + 1]; | 283 | static char flags['z' - 'a' + 1] ALIGN1; |
284 | /* this looks weird, but is OK ... we index FLAG with 'a'...'z' */ | 284 | /* this looks weird, but is OK ... we index FLAG with 'a'...'z' */ |
285 | #define FLAG (flags - 'a') | 285 | #define FLAG (flags - 'a') |
286 | 286 | ||
@@ -577,7 +577,7 @@ struct here { | |||
577 | struct here *h_next; | 577 | struct here *h_next; |
578 | }; | 578 | }; |
579 | 579 | ||
580 | static const char * const signame[] = { | 580 | static const char *const signame[] = { |
581 | "Signal 0", | 581 | "Signal 0", |
582 | "Hangup", | 582 | "Hangup", |
583 | NULL, /* interrupt */ | 583 | NULL, /* interrupt */ |
@@ -593,11 +593,10 @@ static const char * const signame[] = { | |||
593 | "SIGUSR2", | 593 | "SIGUSR2", |
594 | NULL, /* broken pipe */ | 594 | NULL, /* broken pipe */ |
595 | "Alarm clock", | 595 | "Alarm clock", |
596 | "Terminated", | 596 | "Terminated" |
597 | }; | 597 | }; |
598 | 598 | ||
599 | 599 | ||
600 | |||
601 | struct res { | 600 | struct res { |
602 | const char *r_name; | 601 | const char *r_name; |
603 | int r_val; | 602 | int r_val; |
@@ -4209,7 +4208,7 @@ static char *unquote(char *as) | |||
4209 | #define NDENT ((BLKSIZ+sizeof(struct dirent)-1)/sizeof(struct dirent)) | 4208 | #define NDENT ((BLKSIZ+sizeof(struct dirent)-1)/sizeof(struct dirent)) |
4210 | 4209 | ||
4211 | static struct wdblock *cl, *nl; | 4210 | static struct wdblock *cl, *nl; |
4212 | static char spcl[] = "[?*"; | 4211 | static const char spcl[] ALIGN1= "[?*"; |
4213 | 4212 | ||
4214 | static struct wdblock *glob(char *cp, struct wdblock *wb) | 4213 | static struct wdblock *glob(char *cp, struct wdblock *wb) |
4215 | { | 4214 | { |