Some cleanup of the remote tape interface, but a lot more is needed.
Ideally, we'd have a "rmt" library which provides a remote tape API
including open, read, write, close, and ioctl. This is useful not
only for mt, but also for programs like tar, cpio, pax, backup and
restore.
This is used to implement the POSIX behavior when OPTIND=1
- Call setvarsafe instead of setvar. If one ran
"getopts optstr badvariable"
where badvariable contained an illegal variable name, there was no way
to recover, since setvar() would longjmp on the error.
1. OPTIND value was not computed correctly when the argument was part of the
option string (i.e. for "l:" "-l 1" was working "-l1" was not). (PR/2505).
2. OPTARG was not being unset in case of errors [in the non POSIX error case].
3. optvar could be set to random values.
4. Option string starting with a : was not treated specially as POSIX
specifies (if the option string starts with a :, then there is no
error printed when there are missing option arguments or illegal options,
and OPTARG and optvar are being set specially).
5. Implemented getopts "opts" optvar [arg]. The optional argument case
was not implemented.
To do:
- what does Posix say about resetting the getopts state? Bash does it
by setting OPTIND=0; is that correct? Should we be doing the same thing?
- should we be using getopt(3) for everything internal to the shell? Is that
feasible because we might need to handle multiple invocations at once.
consistency with other programs, and because currently it can never
actually succeeed if LANG is set to something other than "C". Sent
in by me in PR 2486, approved by jtc).
(1) it needs to be ALIGNed for both halves of the 'if,' and
(2) if you're going to claim that you now have ALIGN(newlen)
bytes left, you should have actually allocated
ALIGN(newlen), rather than just 'newlen' bytes.
and many user complaints why the shell hangs in echo "`"
- eval.c: Fix exitstatus invalid resetting in `if' statements were:
if (exit 3); then
echo foo $?
else
echo bar $?
fi
printed 'bar 0' instead of bar 3
symlinks. From Chris Demetriou <cgd@NetBSD.ORG>. Fixes PR #1776.
Changed so that INTOFF/INTON are paired in getpwd(). From Matthias
Pfaller <leo@marco.de>. Fixes PR #2130.
(1) It won't compile, and (2) there's code in dd.c which actually
does modify (some, all, used?) conversion tables, so they can't _all_ be
const (if any can).