Skip to content

Commit

Permalink
A few accumulated tweaks to recent commits
Browse files Browse the repository at this point in the history
src/cmd/ksh93/sh/lex.c: sh_syntax():
- Code simpilification, eliminating a block with two variables. No
  change in behaviour. (re: abeb5ea)

src/lib/libast/features/omitted:
- Remove a hardcoded use of /tmp, which Android doesn't have. Use
  the current (i.e., build) directory instead. (re: c3fec93)

src/cmd/ksh93/tests/quoting.sh:
- Delete a leftover increase of 'i' from an earlier iteration of
  the test code (never committed). Since i gets reassigned on the
  next iteration, there is no change in behaviour. (re: 6d69092)
  • Loading branch information
McDutchie committed Aug 24, 2024
1 parent 3686cec commit 958db76
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 16 deletions.
2 changes: 1 addition & 1 deletion src/cmd/ksh93/data/lexstates.c
Original file line number Diff line number Diff line change
Expand Up @@ -738,6 +738,7 @@ const char e_unmatched[] = "`%s' unmatched";
const char e_emptysubscr[] = "[]: empty subscript";
const char e_badreflist[] = "invalid reference list";
const char e_heredoccomsub[] = "`<<%s' here-document not contained within command substitution";
const char e_lexzerobyte[] = "zero byte";
const char e_endoffile[] = "end of file";
const char e_newline[] = "newline";

Expand All @@ -758,7 +759,6 @@ const char e_lexnested[] = "line %d: spaces required for nested subshell";
const char e_lexbadchar[] = "%c: invalid character in expression - %s";
const char e_lexfuture[] = "line %d: \\ in front of %c reserved for future use";
const char e_lexlongquote[] = "line %d: %c quote may be missing";
const char e_lexzerobyte[] = "zero byte";
const char e_lexemptyfor[] = "line %d: empty for list";
const char e_lextypeset[] = "line %d: %s invalid typeset option order";
const char e_lexcharclass[] = "line %d: '^' as first character in character class not portable";
2 changes: 1 addition & 1 deletion src/cmd/ksh93/include/lexstates.h
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ extern const char e_unmatched[];
extern const char e_emptysubscr[];
extern const char e_badreflist[];
extern const char e_heredoccomsub[];
extern const char e_lexzerobyte[];
extern const char e_endoffile[];
extern const char e_newline[];

Expand All @@ -156,7 +157,6 @@ extern const char e_lexnested[];
extern const char e_lexbadchar[];
extern const char e_lexlongquote[];
extern const char e_lexfuture[];
extern const char e_lexzerobyte[];
extern const char e_lexemptyfor[];
extern const char e_lextypeset[];
extern const char e_lexcharclass[];
Expand Down
12 changes: 3 additions & 9 deletions src/cmd/ksh93/sh/lex.c
Original file line number Diff line number Diff line change
Expand Up @@ -2134,16 +2134,10 @@ noreturn void sh_syntax(Lex_t *lp, int special)
sfprintf(sh.strbuf, sh_translate(e_badreflist));
else if (special==3)
sfprintf(sh.strbuf, sh_translate(e_heredoccomsub), lp->heredoc->ioname);
else if (eof)
sfprintf(sh.strbuf, sh_translate(e_unmatched), fmttoken(lp, lp->lasttok));
else
{
const char *msg;
int tok;
if (eof)
tok = lp->lasttok, msg = sh_translate(e_unmatched);
else
tok = lp->token, msg = sh_translate(e_unexpected);
sfprintf(sh.strbuf, msg, fmttoken(lp, tok));
}
sfprintf(sh.strbuf, sh_translate(e_unexpected), fmttoken(lp, lp->token));
errormsg(SH_DICT, ERROR_exit(SYNBAD), "%s", sfstruse(sh.strbuf));
UNREACHABLE();
}
Expand Down
1 change: 0 additions & 1 deletion src/cmd/ksh93/tests/quoting.sh
Original file line number Diff line number Diff line change
Expand Up @@ -394,7 +394,6 @@ do [[ $e == [0-9]* ]] && i=$e && continue
done
done
done
((i+=2))
done

# ======
Expand Down
4 changes: 2 additions & 2 deletions src/lib/libast/features/omitted
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ tst note{ check for Win32 .exe botches }end output{
struct stat st;
char buf[256];

snprintf(buf, sizeof(buf), "rm -rf /tmp/iff-%d", getpid());
snprintf(buf, sizeof(buf), "rm -rf .iff-%d", getpid());
if (_mkdir(buf+7, 0755))
return 1;
if (_chdir(buf+7))
Expand Down Expand Up @@ -76,7 +76,7 @@ tst note{ check for Win32 .exe botches }end output{
printf("#define _win32_botch_execve 1\n");
printf("#define _win32_botch 1\n");
}
_chdir("/tmp");
_chdir("..");
system(buf);
return 0;
}
Expand Down
2 changes: 1 addition & 1 deletion src/lib/libast/misc/procclose.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* *
* This software is part of the ast package *
* Copyright (c) 1985-2011 AT&T Intellectual Property *
* Copyright (c) 2020-2023 Contributors to ksh 93u+m *
* Copyright (c) 2020-2024 Contributors to ksh 93u+m *
* and is licensed under the *
* Eclipse Public License, Version 2.0 *
* *
Expand Down
2 changes: 1 addition & 1 deletion src/lib/libast/misc/proclib.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* *
* This software is part of the ast package *
* Copyright (c) 1985-2012 AT&T Intellectual Property *
* Copyright (c) 2020-2022 Contributors to ksh 93u+m *
* Copyright (c) 2020-2024 Contributors to ksh 93u+m *
* and is licensed under the *
* Eclipse Public License, Version 2.0 *
* *
Expand Down

0 comments on commit 958db76

Please sign in to comment.