sh: Write LINENO value to stack string directly.
This commit is contained in:
parent
13caa46866
commit
7696368682
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=298109
@ -1610,7 +1610,6 @@ readtoken1(int firstc, char const *initialsyntax, const char *eofmark,
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
parsesub: {
|
parsesub: {
|
||||||
char buf[10];
|
|
||||||
int subtype;
|
int subtype;
|
||||||
int typeloc;
|
int typeloc;
|
||||||
int flags;
|
int flags;
|
||||||
@ -1654,12 +1653,15 @@ parsesub: {
|
|||||||
strncmp(out - length, "LINENO", length) == 0) {
|
strncmp(out - length, "LINENO", length) == 0) {
|
||||||
/* Replace the variable name with the
|
/* Replace the variable name with the
|
||||||
* current line number. */
|
* current line number. */
|
||||||
|
STADJUST(-6, out);
|
||||||
|
CHECKSTRSPACE(11, out);
|
||||||
linno = plinno;
|
linno = plinno;
|
||||||
if (funclinno != 0)
|
if (funclinno != 0)
|
||||||
linno -= funclinno - 1;
|
linno -= funclinno - 1;
|
||||||
snprintf(buf, sizeof(buf), "%d", linno);
|
length = snprintf(out, 11, "%d", linno);
|
||||||
STADJUST(-6, out);
|
if (length > 10)
|
||||||
STPUTS(buf, out);
|
length = 10;
|
||||||
|
out += length;
|
||||||
flags |= VSLINENO;
|
flags |= VSLINENO;
|
||||||
}
|
}
|
||||||
} else if (is_digit(c)) {
|
} else if (is_digit(c)) {
|
||||||
|
Loading…
Reference in New Issue
Block a user