now WDS_KEEPQ and WDS_MAGIC are both no longer needed
This commit is contained in:
parent
305599031d
commit
aa4ad0c2e4
16
tree.c
16
tree.c
@ -23,7 +23,7 @@
|
|||||||
|
|
||||||
#include "sh.h"
|
#include "sh.h"
|
||||||
|
|
||||||
__RCSID("$MirOS: src/bin/mksh/tree.c,v 1.78 2015/10/09 19:29:50 tg Exp $");
|
__RCSID("$MirOS: src/bin/mksh/tree.c,v 1.79 2015/12/12 19:08:58 tg Exp $");
|
||||||
|
|
||||||
#define INDENT 8
|
#define INDENT 8
|
||||||
|
|
||||||
@ -308,7 +308,7 @@ wdvarput(struct shf *shf, const char *wp, int quotelevel, int opmode)
|
|||||||
* `...` -> $(...)
|
* `...` -> $(...)
|
||||||
* 'foo' -> "foo"
|
* 'foo' -> "foo"
|
||||||
* x${foo:-"hi"} -> x${foo:-hi} unless WDS_TPUTS
|
* x${foo:-"hi"} -> x${foo:-hi} unless WDS_TPUTS
|
||||||
* x${foo:-'hi'} -> x${foo:-hi} unless WDS_KEEPQ
|
* x${foo:-'hi'} -> x${foo:-hi}
|
||||||
* could change encoding to:
|
* could change encoding to:
|
||||||
* OQUOTE ["'] ... CQUOTE ["']
|
* OQUOTE ["'] ... CQUOTE ["']
|
||||||
* COMSUB [(`] ...\0 (handle $ ` \ and maybe " in `...` case)
|
* COMSUB [(`] ...\0 (handle $ ` \ and maybe " in `...` case)
|
||||||
@ -320,10 +320,6 @@ wdvarput(struct shf *shf, const char *wp, int quotelevel, int opmode)
|
|||||||
case ADELIM:
|
case ADELIM:
|
||||||
case CHAR:
|
case CHAR:
|
||||||
c = *wp++;
|
c = *wp++;
|
||||||
if ((opmode & WDS_MAGIC) &&
|
|
||||||
(ISMAGIC(c) || c == '[' || c == '!' ||
|
|
||||||
c == '-' || c == ']' || c == '*' || c == '?'))
|
|
||||||
shf_putc(MAGIC, shf);
|
|
||||||
shf_putc(c, shf);
|
shf_putc(c, shf);
|
||||||
break;
|
break;
|
||||||
case QCHAR: {
|
case QCHAR: {
|
||||||
@ -335,7 +331,6 @@ wdvarput(struct shf *shf, const char *wp, int quotelevel, int opmode)
|
|||||||
if (quotelevel == 0)
|
if (quotelevel == 0)
|
||||||
doq = true;
|
doq = true;
|
||||||
} else {
|
} else {
|
||||||
if (!(opmode & WDS_KEEPQ))
|
|
||||||
doq = false;
|
doq = false;
|
||||||
}
|
}
|
||||||
if (doq)
|
if (doq)
|
||||||
@ -392,21 +387,14 @@ wdvarput(struct shf *shf, const char *wp, int quotelevel, int opmode)
|
|||||||
shf_putc('}', shf);
|
shf_putc('}', shf);
|
||||||
return (wp);
|
return (wp);
|
||||||
case OPAT:
|
case OPAT:
|
||||||
if (opmode & WDS_MAGIC) {
|
|
||||||
shf_putc(MAGIC, shf);
|
|
||||||
shf_putchar(*wp++ | 0x80, shf);
|
|
||||||
} else {
|
|
||||||
shf_putchar(*wp++, shf);
|
shf_putchar(*wp++, shf);
|
||||||
shf_putc('(', shf);
|
shf_putc('(', shf);
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case SPAT:
|
case SPAT:
|
||||||
c = '|';
|
c = '|';
|
||||||
if (0)
|
if (0)
|
||||||
case CPAT:
|
case CPAT:
|
||||||
c = /*(*/ ')';
|
c = /*(*/ ')';
|
||||||
if (opmode & WDS_MAGIC)
|
|
||||||
shf_putc(MAGIC, shf);
|
|
||||||
shf_putc(c, shf);
|
shf_putc(c, shf);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user