mirror of
git://git.code.sf.net/p/cdesktopenv/code
synced 2025-03-09 15:50:02 +00:00
Fix more compiler warnings, typos and other minor issues (#260)
Many of these changes are minor typo fixes. The other changes (which are mostly compiler warning fixes) are: NEWS: - The --globcasedetect shell option works on older Linux kernels when used with FAT32/VFAT file systems, so remove the note about it only working with 5.2+ kernels. src/cmd/ksh93/COMPATIBILITY: - Update the documentation on function scoping with an addition from ksh93v- (this does apply to ksh93u+). src/cmd/ksh93/edit/emacs.c: - Check for '_AST_ksh_release', not 'AST_ksh_release'. src/cmd/INIT/mamake.c, src/cmd/INIT/ratz.c, src/cmd/INIT/release.c, src/cmd/builtin/pty.c: - Add more uses of UNREACHABLE() and noreturn, this time for the build system and pty. src/cmd/builtin/pty.c, src/cmd/builtin/array.c, src/cmd/ksh93/sh/name.c, src/cmd/ksh93/sh/nvtype.c, src/cmd/ksh93/sh/suid_exec.c: - Fix six -Wunused-variable warnings (the name.c nv_arrayptr() fixes are also in ksh93v-). - Remove the unused 'tableval' function to fix a -Wunused-function warning. src/cmd/ksh93/sh/lex.c: - Remove unused 'SHOPT_DOS' code, which isn't enabled anywhere. https://github.com/att/ast/issues/272#issuecomment-354363112 src/cmd/ksh93/bltins/misc.c, src/cmd/ksh93/bltins/trap.c, src/cmd/ksh93/bltins/typeset.c: - Add dictionary generator function declarations for former aliases that are now builtins (re:1fbbeaa1,ef1621c1,3ba4900e). - For consistency with the rest of the codebase, use '(void)' instead of '()' for print_cpu_times. src/cmd/ksh93/sh/init.c, src/lib/libast/path/pathshell.c: - Move the otherwise unused EXE macro to pathshell() and only search for 'sh.exe' on Windows. src/cmd/ksh93/sh/xec.c, src/lib/libast/include/ast.h: - Add an empty definition for inline when compiling with C89. This allows the timeval_to_double() function to be inlined. src/cmd/ksh93/include/shlex.h: - Remove the unused 'PIPESYM2' macro. src/cmd/ksh93/tests/pty.sh: - Add '# err_exit #' to count the regression test added in commit113a9392. src/lib/libast/disc/sfdcdio.c: - Move diordwr, dioread, diowrite and dioexcept behind '#ifdef F_DIOINFO' to fix one -Wunused-variable warning and multiple -Wunused-function warnings (sfdcdio() only uses these functions when F_DIOINFO is defined). src/lib/libast/string/fmtdev.c: - Fix two -Wimplicit-function-declaration warnings on Linux by including sys/sysmacros.h in fmtdev().
This commit is contained in:
parent
ecf260c282
commit
a065558291
96 changed files with 299 additions and 282 deletions
|
|
@ -125,9 +125,10 @@ static const char usage[] =
|
|||
#define CMIN 1
|
||||
#endif
|
||||
|
||||
static void outofmemory(void)
|
||||
static noreturn void outofmemory(void)
|
||||
{
|
||||
error(ERROR_SYSTEM|ERROR_PANIC, "out of memory");
|
||||
UNREACHABLE();
|
||||
}
|
||||
|
||||
#if !_lib_openpty && !_lib__getpty && !defined(_pty_clone)
|
||||
|
|
@ -221,7 +222,6 @@ static int
|
|||
mkpty(int* master, int* minion)
|
||||
{
|
||||
struct termios tty;
|
||||
struct termios tst;
|
||||
struct termios* ttyp;
|
||||
#ifdef TIOCGWINSZ
|
||||
struct winsize win;
|
||||
|
|
@ -316,6 +316,7 @@ mkpty(int* master, int* minion)
|
|||
return -1;
|
||||
#endif
|
||||
#ifdef I_PUSH
|
||||
struct termios tst;
|
||||
if (tcgetattr(*minion, &tst) < 0 && (ioctl(*minion, I_PUSH, "ptem") < 0 || ioctl(*minion, I_PUSH, "ldterm") < 0))
|
||||
{
|
||||
close(*minion);
|
||||
|
|
@ -1057,17 +1058,26 @@ b_pty(int argc, char** argv, Shbltin_t* context)
|
|||
break;
|
||||
case '?':
|
||||
error(ERROR_usage(2), "%s", opt_info.arg);
|
||||
break;
|
||||
UNREACHABLE();
|
||||
}
|
||||
break;
|
||||
}
|
||||
argv += opt_info.index;
|
||||
if (!argv[0])
|
||||
{
|
||||
error(ERROR_exit(1), "command must be specified");
|
||||
UNREACHABLE();
|
||||
}
|
||||
if (mkpty(&master, &minion) < 0)
|
||||
{
|
||||
error(ERROR_system(1), "unable to create pty");
|
||||
UNREACHABLE();
|
||||
}
|
||||
if (!(mp = sfnew(NiL, 0, SF_UNBOUND, master, SF_READ|SF_WRITE)))
|
||||
{
|
||||
error(ERROR_system(1), "cannot open master stream");
|
||||
UNREACHABLE();
|
||||
}
|
||||
if (stty)
|
||||
{
|
||||
n = 2;
|
||||
|
|
@ -1095,9 +1105,15 @@ b_pty(int argc, char** argv, Shbltin_t* context)
|
|||
if (!log)
|
||||
lp = 0;
|
||||
else if (!(lp = sfopen(NiL, log, "w")))
|
||||
{
|
||||
error(ERROR_system(1), "%s: cannot write", log);
|
||||
UNREACHABLE();
|
||||
}
|
||||
if (!(proc = runcmd(argv, minion, session)))
|
||||
{
|
||||
error(ERROR_system(1), "unable run %s", argv[0]);
|
||||
UNREACHABLE();
|
||||
}
|
||||
close(minion);
|
||||
if (messages)
|
||||
{
|
||||
|
|
@ -1109,7 +1125,10 @@ b_pty(int argc, char** argv, Shbltin_t* context)
|
|||
else if ((fd = open(messages, O_CREAT|O_WRONLY, MODE_666)) >= 0)
|
||||
drop = 0;
|
||||
else
|
||||
{
|
||||
error(ERROR_system(1), "%s: cannot redirect messages", messages);
|
||||
UNREACHABLE();
|
||||
}
|
||||
close(2);
|
||||
dup(fd);
|
||||
if (drop)
|
||||
|
|
@ -1118,6 +1137,9 @@ b_pty(int argc, char** argv, Shbltin_t* context)
|
|||
minion = (*fun)(mp, lp, delay, timeout);
|
||||
master = procclose(proc);
|
||||
if (lp && sfclose(lp))
|
||||
{
|
||||
error(ERROR_system(1), "%s: write error", log);
|
||||
UNREACHABLE();
|
||||
}
|
||||
return minion ? minion : master;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue