mirror of
git://git.code.sf.net/p/zsh/code
synced 2025-09-02 22:11:54 +02:00
53588: zsystem flock: handle optargs in the same word
with small tweak to test, just in case
This commit is contained in:
parent
b0fa403a3d
commit
a2f390701a
3 changed files with 18 additions and 3 deletions
|
@ -1,3 +1,8 @@
|
||||||
|
2025-05-13 dana@dana.is <dana@dana.is>
|
||||||
|
|
||||||
|
* 53588 (tweaked): Src/Modules/system.c, Test/V14system.ztst:
|
||||||
|
make `zsystem flock` handle optargs in the same word
|
||||||
|
|
||||||
2025-05-12 Bart Schaefer <schaefer@zsh.org>
|
2025-05-12 Bart Schaefer <schaefer@zsh.org>
|
||||||
|
|
||||||
* 53602: Doc/Zsh/func.yo, Src/params.c, Test/K01nameref.ztst:
|
* 53602: Doc/Zsh/func.yo, Src/params.c, Test/K01nameref.ztst:
|
||||||
|
|
|
@ -572,7 +572,7 @@ bin_zsystem_flock(char *nam, char **args, UNUSED(Options ops), UNUSED(int func))
|
||||||
/* variable for fd */
|
/* variable for fd */
|
||||||
if (optptr[1]) {
|
if (optptr[1]) {
|
||||||
fdvar = optptr + 1;
|
fdvar = optptr + 1;
|
||||||
optptr += strlen(fdvar) - 1;
|
optptr += strlen(fdvar);
|
||||||
} else if (*args) {
|
} else if (*args) {
|
||||||
fdvar = *args++;
|
fdvar = *args++;
|
||||||
}
|
}
|
||||||
|
@ -592,7 +592,7 @@ bin_zsystem_flock(char *nam, char **args, UNUSED(Options ops), UNUSED(int func))
|
||||||
/* timeout in seconds */
|
/* timeout in seconds */
|
||||||
if (optptr[1]) {
|
if (optptr[1]) {
|
||||||
optarg = optptr + 1;
|
optarg = optptr + 1;
|
||||||
optptr += strlen(optarg) - 1;
|
optptr += strlen(optarg);
|
||||||
} else if (!*args) {
|
} else if (!*args) {
|
||||||
zwarnnam(nam, "flock: option %c requires a numeric timeout",
|
zwarnnam(nam, "flock: option %c requires a numeric timeout",
|
||||||
opt);
|
opt);
|
||||||
|
@ -622,7 +622,7 @@ bin_zsystem_flock(char *nam, char **args, UNUSED(Options ops), UNUSED(int func))
|
||||||
/* retry interval in seconds */
|
/* retry interval in seconds */
|
||||||
if (optptr[1]) {
|
if (optptr[1]) {
|
||||||
optarg = optptr + 1;
|
optarg = optptr + 1;
|
||||||
optptr += strlen(optarg) - 1;
|
optptr += strlen(optarg);
|
||||||
} else if (!*args) {
|
} else if (!*args) {
|
||||||
zwarnnam(nam,
|
zwarnnam(nam,
|
||||||
"flock: option %c requires "
|
"flock: option %c requires "
|
||||||
|
|
|
@ -148,6 +148,16 @@ F:This timing test might fail due to process scheduling issues unrelated to zsh.
|
||||||
?elapsed time seems OK
|
?elapsed time seems OK
|
||||||
F:This timing test might fail due to process scheduling issues unrelated to zsh.
|
F:This timing test might fail due to process scheduling issues unrelated to zsh.
|
||||||
|
|
||||||
|
(
|
||||||
|
zsystem flock -t 0.1 -i 0.1 -f XYZ $tst_dir/file
|
||||||
|
echo $XYZ
|
||||||
|
zsystem flock -t0.1 -i0.1 -fZYX $tst_dir/file
|
||||||
|
echo $ZYX
|
||||||
|
)
|
||||||
|
0:regression: zsystem flock optarg parsing
|
||||||
|
*><->
|
||||||
|
*><->
|
||||||
|
|
||||||
unset chars REPLY
|
unset chars REPLY
|
||||||
print -n a few words | sysread -i 0 -c chars
|
print -n a few words | sysread -i 0 -c chars
|
||||||
ret=$?
|
ret=$?
|
||||||
|
|
Loading…
Reference in a new issue