1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
|
const char **argv, /* Argument strings in UTF. */
Tcl_DString *linePtr) /* Initialized Tcl_DString that receives the
* command line (WCHAR). */
{
const char *arg, *start, *special, *bspos;
int quote = 0, i;
Tcl_DString ds;
static const char specMetaChars[] = "&|^<>!()%";
/* Characters to enclose in quotes if unpaired
* quote flag set. */
static const char specMetaChars2[] = "%";
/* Character to enclose in quotes in any case
* (regardless of unpaired-flag). */
/*
* Quote flags:
* CL_ESCAPE - escape argument;
* CL_QUOTE - enclose in quotes;
* CL_UNPAIRED - previous arguments chain contains unpaired quote-char;
*/
enum {CL_ESCAPE = 1, CL_QUOTE = 2, CL_UNPAIRED = 4};
|
>
>
>
>
>
>
>
>
|
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
|
const char **argv, /* Argument strings in UTF. */
Tcl_DString *linePtr) /* Initialized Tcl_DString that receives the
* command line (WCHAR). */
{
const char *arg, *start, *special, *bspos;
int quote = 0, i;
Tcl_DString ds;
#ifdef TCL_WIN_PIPE_FULLESC
/* full escape inclusive %-subst avoidance */
static const char specMetaChars[] = "&|^<>!()%";
/* Characters to enclose in quotes if unpaired
* quote flag set. */
static const char specMetaChars2[] = "%";
/* Character to enclose in quotes in any case
* (regardless of unpaired-flag). */
#else
/* escape considering quotation only (no %-subst avoidance) */
static const char specMetaChars[] = "&|^<>!()";
/* Characters to enclose in quotes if unpaired
* quote flag set. */
#endif
/*
* Quote flags:
* CL_ESCAPE - escape argument;
* CL_QUOTE - enclose in quotes;
* CL_UNPAIRED - previous arguments chain contains unpaired quote-char;
*/
enum {CL_ESCAPE = 1, CL_QUOTE = 2, CL_UNPAIRED = 4};
|
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
|
/*
* Start to current or first backslash
*/
start = !bspos ? special : bspos;
continue;
}
/*
* Special case for % - should be enclosed always (paired
* also)
*/
if (strchr(specMetaChars2, *special)) {
special = QuoteCmdLinePart(&ds, start, special,
specMetaChars2, &bspos);
/*
* Start to current or first backslash.
*/
start = !bspos ? special : bspos;
continue;
}
/*
* Other not special (and not meta) character
*/
bspos = NULL; /* reset last backslash position (not
* interesting) */
|
|
>
|
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
|
/*
* Start to current or first backslash
*/
start = !bspos ? special : bspos;
continue;
}
#ifdef TCL_WIN_PIPE_FULLESC
/*
* Special case for % - should be enclosed always (paired
* also)
*/
if (strchr(specMetaChars2, *special)) {
special = QuoteCmdLinePart(&ds, start, special,
specMetaChars2, &bspos);
/*
* Start to current or first backslash.
*/
start = !bspos ? special : bspos;
continue;
}
#endif
/*
* Other not special (and not meta) character
*/
bspos = NULL; /* reset last backslash position (not
* interesting) */
|