diff -Paur --no-dereference -- dash.upstream/src/cd.c dash/src/cd.c --- dash.upstream/src/cd.c +++ dash/src/cd.c @@ -252,7 +252,7 @@ STATIC char * getpwd() { -#ifdef __GLIBC__ +#if defined(__GLIBC__) || defined(__sortix__) char *dir = getcwd(0, 0); if (dir) diff -Paur --no-dereference -- dash.upstream/src/exec.c dash/src/exec.c --- dash.upstream/src/exec.c +++ dash/src/exec.c @@ -151,6 +151,9 @@ STATIC void tryexec(char *cmd, char **argv, char **envp) { +#if defined(__sortix__) + execvpe((const char*) cmd, argv, envp); +#else char *const path_bshell = _PATH_BSHELL; repeat: @@ -166,6 +169,7 @@ *argv = cmd = path_bshell; goto repeat; } +#endif } diff -Paur --no-dereference -- dash.upstream/src/histedit.c dash/src/histedit.c --- dash.upstream/src/histedit.c +++ dash/src/histedit.c @@ -32,7 +32,6 @@ * SUCH DAMAGE. */ -#include #ifdef HAVE_PATHS_H #include #endif diff -Paur --no-dereference -- dash.upstream/src/jobs.c dash/src/jobs.c --- dash.upstream/src/jobs.c +++ dash/src/jobs.c @@ -40,7 +40,6 @@ #include #endif #include -#include #ifdef BSD #include #include @@ -207,7 +206,7 @@ mflag = on = 0; goto close; } - if (pgrp == getpgrp()) + if (pgrp == getpgid(0)) break; killpg(0, SIGTTIN); } while (1); @@ -457,7 +456,7 @@ if (mode & SHOW_PGID) { /* just output process (group) id of pipeline */ - outfmt(out, "%d\n", ps->pid); + outfmt(out, "%jd\n", (intmax_t) ps->pid); return; } @@ -470,7 +469,7 @@ s[col - 2] = '-'; if (mode & SHOW_PID) - col += fmtstr(s + col, 16, "%d ", ps->pid); + col += fmtstr(s + col, 16, "%jd ", (intmax_t) ps->pid); psend = ps + jp->nprocs; @@ -490,7 +489,7 @@ do { /* for each process */ - col = fmtstr(s, 48, " |\n%*c%d ", indent, ' ', ps->pid) - 3; + col = fmtstr(s, 48, " |\n%*c%jd ", indent, ' ', (intmax_t) ps->pid) - 3; start: outfmt( @@ -1136,7 +1135,7 @@ do { gotsigchld = 0; - err = wait3(status, flags, NULL); + err = waitpid(-1, status, flags); if (err || !block) break; diff -Paur --no-dereference -- dash.upstream/src/Makefile.in dash/src/Makefile.in --- dash.upstream/src/Makefile.in +++ dash/src/Makefile.in @@ -170,9 +170,9 @@ AM_CFLAGS = $(COMMON_CFLAGS) AM_CPPFLAGS = $(COMMON_CPPFLAGS) AM_CFLAGS_FOR_BUILD = -g -O2 $(COMMON_CFLAGS) -AM_CPPFLAGS_FOR_BUILD = $(COMMON_CPPFLAGS) +AM_CPPFLAGS_FOR_BUILD = -DBSD=1 -DSHELL -DIFS_BROKEN COMPILE_FOR_BUILD = \ - $(CC_FOR_BUILD) $(DEFAULT_INCLUDES) $(AM_CPPFLAGS_FOR_BUILD) \ + unset HOST_SYSTEM_ROOT && $(CC_FOR_BUILD) $(DEFAULT_INCLUDES) $(AM_CPPFLAGS_FOR_BUILD) \ $(CPPFLAGS_FOR_BUILD) \ $(AM_CFLAGS_FOR_BUILD) $(CFLAGS_FOR_BUILD) @@ -542,7 +542,11 @@ info-am: -install-data-am: install-man +install-data-am: install-man install-proper-shells + +install-proper-shells: + mkdir -p "$(DESTDIR)$(sysconfdir)/proper-shells" + echo dash > "$(DESTDIR)$(sysconfdir)/proper-shells/dash" install-dvi: install-dvi-am diff -Paur --no-dereference -- dash.upstream/src/miscbltin.c dash/src/miscbltin.c --- dash.upstream/src/miscbltin.c +++ dash/src/miscbltin.c @@ -37,7 +37,6 @@ */ #include /* quad_t */ -#include /* BSD4_4 */ #include #include #include diff -Paur --no-dereference -- dash.upstream/src/output.c dash/src/output.c --- dash.upstream/src/output.c +++ dash/src/output.c @@ -44,7 +44,6 @@ */ #include /* quad_t */ -#include /* BSD4_4 */ #include #include /* defines BUFSIZ */ diff -Paur --no-dereference -- dash.upstream/src/parser.c dash/src/parser.c --- dash.upstream/src/parser.c +++ dash/src/parser.c @@ -32,10 +32,6 @@ * SUCH DAMAGE. */ -#if HAVE_ALLOCA_H -#include -#endif - #include #include "shell.h" @@ -1090,10 +1086,12 @@ if (len) { char *str; - str = alloca(len + 1); + str = ckmalloc(len + 1); *(char *)mempcpy(str, p, len) = 0; pushstring(str, NULL); + + ckfree(str); } } } @@ -1300,7 +1298,7 @@ str = NULL; savelen = out - (char *)stackblock(); if (savelen > 0) { - str = alloca(savelen); + str = ckmalloc(savelen); memcpy(str, stackblock(), savelen); } if (oldstyle) { @@ -1400,6 +1398,7 @@ if (str) { memcpy(out, str, savelen); STADJUST(savelen, out); + ckfree(str); } USTPUTC(CTLBACKQ, out); if (oldstyle) diff -Paur --no-dereference -- dash.upstream/src/redir.c dash/src/redir.c --- dash.upstream/src/redir.c +++ dash/src/redir.c @@ -34,7 +34,6 @@ #include #include -#include /* PIPE_BUF */ #include #include #include diff -Paur --no-dereference -- dash.upstream/src/shell.h dash/src/shell.h --- dash.upstream/src/shell.h +++ dash/src/shell.h @@ -49,8 +49,6 @@ * a quit signal will generate a core dump. */ -#include - #ifndef JOBS #define JOBS 1 #endif