aboutsummaryrefslogtreecommitdiff
path: root/shell/ash.c
diff options
context:
space:
mode:
authorDenis Vlasenko <vda.linux@googlemail.com>2007-08-12 20:58:27 +0000
committerDenis Vlasenko <vda.linux@googlemail.com>2007-08-12 20:58:27 +0000
commit6ca409e0e4c198fe3081346eebbae3f068fe605a (patch)
tree060cb05d99220a1eda399194d1209c269f0e8cd8 /shell/ash.c
parent4185548984357df91311f30c8e43d95f33922576 (diff)
downloadbusybox-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/ash.c')
-rw-r--r--shell/ash.c58
1 files changed, 31 insertions, 27 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
104enum { NOPTS = ARRAY_SIZE(optletters_optnames) }; 104enum { NOPTS = ARRAY_SIZE(optletters_optnames) };
105 105
106static char optlist[NOPTS]; 106static 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
130static char nullstr[1]; /* zero length string */ 130static char nullstr[1] ALIGN1; /* zero length string */
131static const char homestr[] = "HOME"; 131static const char homestr[] ALIGN1 = "HOME";
132static const char snlfmt[] = "%s\n"; 132static const char snlfmt[] ALIGN1 = "%s\n";
133static const char illnum[] = "Illegal number: %s"; 133static const char illnum[] ALIGN1 = "Illegal number: %s";
134 134
135static char *minusc; /* argument to -c option */ 135static char *minusc; /* argument to -c option */
136 136
137/* pid of main shell */ 137/* pid of main shell */
138static int rootpid; 138static 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
450static const char dolatstr[] = { CTLVAR, VSNORMAL|VSQUOTE, '@', '=', '\0' }; 450static 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
1586static const char defifsvar[] = "IFS= \t\n"; 1588static const char defifsvar[] ALIGN1 = "IFS= \t\n";
1587#define defifs (defifsvar + 4) 1589#define defifs (defifsvar + 4)
1588#else 1590#else
1589static const char defifs[] = " \t\n"; 1591static const char defifs[] ALIGN1 = " \t\n";
1590#endif 1592#endif
1591 1593
1592struct shparam { 1594struct shparam {
@@ -2548,16 +2550,16 @@ static const char S_I_T[][3] = {
2548static int 2550static int
2549SIT(int c, int syntax) 2551SIT(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)
5003static char * 5005static 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);
5420static void 5422static void
5421argstr(char *p, int flag) 5423argstr(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)
6266static void 6268static void
6267expandmeta(struct strlist *str, int flag) 6269expandmeta(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! */
10499static const char xxreadtoken_chars[7] = { '\n', '(', ')', '&', '|', ';', 0 }; 10501static const char xxreadtoken_chars[7] ALIGN1 = {
10502 '\n', '(', ')', '&', '|', ';', 0
10503};
10500 10504
10501static const char xxreadtoken_tokens[] = { 10505static 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
11382static const unsigned char timescmd_str[] = { 11386static 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)
11659static int 11663static int
11660umaskcmd(int argc, char **argv) 11664umaskcmd(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 */
12321static const char op_tokens[] = { 12325static 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,