|
From: <kin...@us...> - 2025-09-22 10:01:33
|
Revision: 7465
http://sourceforge.net/p/teem/code/7465
Author: kindlmann
Date: 2025-09-22 10:01:30 +0000 (Mon, 22 Sep 2025)
Log Message:
-----------
should now correctly emulate POSIC argument tokenization rules, with correct quoting
Modified Paths:
--------------
teem/trunk/src/hest/parsest.c
Modified: teem/trunk/src/hest/parsest.c
===================================================================
--- teem/trunk/src/hest/parsest.c 2025-09-22 09:22:17 UTC (rev 7464)
+++ teem/trunk/src/hest/parsest.c 2025-09-22 10:01:30 UTC (rev 7465)
@@ -224,16 +224,29 @@
}
break;
case argstEscapeIn:
- case argstEscapeDQ:
if ('\n' == cc) {
// line continuation; ignore \ and \n
} else {
- // add escaped characters (including #) to arg
+ // add escaped character (including #) to arg
hestArgAddChar(tharg, cc);
}
- // either way, back to whatever we were in pre-escape
- *stateP = (argstEscapeIn == *stateP) ? argstInside : argstDoubleQ;
+ // back to unescaped input
+ *stateP = argstInside;
break;
+ case argstEscapeDQ:
+ if ('\n' == cc) {
+ // like above: line continuation; ignore \ and \n
+ } else if ('$' == cc || '\'' == cc || '\"' == cc || '\\' == cc) {
+ // add escaped character to arg
+ hestArgAddChar(tharg, cc);
+ } else {
+ // other character (needlessly) escaped, put in both \ and char
+ hestArgAddChar(tharg, '\\');
+ hestArgAddChar(tharg, cc);
+ }
+ // back to unescaped input
+ *stateP = argstDoubleQ;
+ break;
case argstComment:
if ('\n' == cc) {
// the newline has ended the comment, prepare for next arg
@@ -290,7 +303,8 @@
} else {
// we have gotten to the end of the given argv array, pop it as input source */
if (histPop(hist, hparm)) {
- biffAddf(HEST, "%s: trouble popping", __func__);
+ biffAddf(HEST, "%s: trouble popping %s", __func__,
+ airEnumStr(hestSource, hestSourceCommandLine));
return 1;
}
*nastP = nastTryAgain;
@@ -325,7 +339,13 @@
} else {
// we're at end; pop input; *nastP already set to nastTryAgain by argstGo()
if (histPop(hist, hparm)) {
- biffAddf(HEST, "%s: trouble popping", __func__);
+ if (hestSourceResponseFile == hin->source) {
+ biffAddf(HEST, "%s: trouble popping %s \"%s\"", __func__,
+ airEnumStr(hestSource, hin->source), hin->rfname);
+ } else {
+ biffAddf(HEST, "%s: trouble popping %s |%s|", __func__,
+ airEnumStr(hestSource, hin->source), hin->dfltStr);
+ }
return 1;
}
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|