mirror of
git://git.code.sf.net/p/cdesktopenv/code
synced 2025-02-13 19:52:20 +00:00
Another round of accumulated minor fixes and cleanups
Only notable changes listed below. **/Mamfile: - Do not bother redirecting standard error for 'cmp -s' to /dev/null. Normally, 'cmp -s' on Linux, macOS, *BSD, or Solaris do not not print any message. If it does, something unusual is going on and I would want to see the message. - Since we now require a POSIX shell, we can use '!'. src/cmd/ksh93/include/defs.h, src/cmd/ksh93/sh/init.c: - Remove SH_TYPE_PROFILE symbol, unused after the removal of the SHOPT_PFSH code. (re: eabd6453) src/cmd/ksh93/sh/io.c: - piperead(), slowread(): Replace redundant sffileno() calls by the variables already containing their results. (re: 50d342e4) src/cmd/ksh93/bltins/mkservice.c, rc/lib/libcmd/vmstate.c: - If these aren't compiled, define a stub function to silence the ranlib(1) warning that the .o file does not contain symbols.
This commit is contained in:
parent
8fc8c2f51c
commit
b398f33c49
42 changed files with 352 additions and 523 deletions
|
@ -1501,23 +1501,20 @@ make install
|
|||
make ${PACKAGE_ast_INCLUDE}/nval.h
|
||||
prev ${PACKAGE_ast_INCLUDE}
|
||||
prev include/nval.h
|
||||
exec - if cmp 2>/dev/null -s include/nval.h ${PACKAGE_ast_INCLUDE}/nval.h
|
||||
exec - then :
|
||||
exec - else ${STDCP} include/nval.h ${PACKAGE_ast_INCLUDE}/nval.h
|
||||
exec - if ! cmp -s include/nval.h ${PACKAGE_ast_INCLUDE}/nval.h
|
||||
exec - then ${STDCP} include/nval.h ${PACKAGE_ast_INCLUDE}/nval.h
|
||||
exec - fi
|
||||
done ${PACKAGE_ast_INCLUDE}/nval.h generated
|
||||
make ${PACKAGE_ast_INCLUDE}/shell.h
|
||||
prev include/shell.h
|
||||
exec - if cmp 2>/dev/null -s include/shell.h ${PACKAGE_ast_INCLUDE}/shell.h
|
||||
exec - then :
|
||||
exec - else ${STDCP} include/shell.h ${PACKAGE_ast_INCLUDE}/shell.h
|
||||
exec - if ! cmp -s include/shell.h ${PACKAGE_ast_INCLUDE}/shell.h
|
||||
exec - then ${STDCP} include/shell.h ${PACKAGE_ast_INCLUDE}/shell.h
|
||||
exec - fi
|
||||
done ${PACKAGE_ast_INCLUDE}/shell.h generated
|
||||
make ${PACKAGE_ast_INCLUDE}/history.h
|
||||
prev include/history.h
|
||||
exec - if cmp 2>/dev/null -s include/history.h ${PACKAGE_ast_INCLUDE}/history.h
|
||||
exec - then :
|
||||
exec - else ${STDCP} include/history.h ${PACKAGE_ast_INCLUDE}/history.h
|
||||
exec - if ! cmp -s include/history.h ${PACKAGE_ast_INCLUDE}/history.h
|
||||
exec - then ${STDCP} include/history.h ${PACKAGE_ast_INCLUDE}/history.h
|
||||
exec - fi
|
||||
done ${PACKAGE_ast_INCLUDE}/history.h generated
|
||||
make ${INSTALLROOT}/bin/suid_exec
|
||||
|
|
|
@ -297,7 +297,6 @@ int b_hist(int argc,char *argv[], Shbltin_t *context)
|
|||
* given a file containing a command and a string of the form old=new,
|
||||
* execute the command with the string old replaced by new
|
||||
*/
|
||||
|
||||
static void hist_subst(const char *command,int fd,char *replace)
|
||||
{
|
||||
register char *newp=replace;
|
||||
|
|
|
@ -25,7 +25,9 @@
|
|||
* AT&T Labs
|
||||
*/
|
||||
|
||||
#if SHOPT_MKSERVICE
|
||||
#if !SHOPT_MKSERVICE
|
||||
void _STUB_b_mkservice(){}
|
||||
#else
|
||||
|
||||
static const char mkservice_usage[] =
|
||||
"[-?\n@(#)$Id: mkservice (AT&T Research) 2001-06-13 $\n]"
|
||||
|
|
|
@ -163,7 +163,6 @@ static int infof(Opt_t* op, Sfio_t* sp, const char* s, Optdisc_t* dp)
|
|||
* argc==0 when called from echo
|
||||
* argc==-1 when called from printf
|
||||
*/
|
||||
|
||||
int b_print(int argc, char *argv[], Shbltin_t *context)
|
||||
{
|
||||
register Sfio_t *outfile;
|
||||
|
@ -397,7 +396,6 @@ printf_v:
|
|||
* if <raw> is non-zero then \ is not a special character.
|
||||
* returns 0 for \c otherwise 1.
|
||||
*/
|
||||
|
||||
static int echolist(Sfio_t *outfile, int raw, char *argv[])
|
||||
{
|
||||
register char *cp;
|
||||
|
@ -1054,7 +1052,6 @@ static int extend(Sfio_t* sp, void* v, Sffmt_t* fe)
|
|||
* Otherwise, puts null-terminated result on stack, but doesn't freeze it
|
||||
* returns length of output.
|
||||
*/
|
||||
|
||||
static int fmtvecho(const char *string, struct printf *pp)
|
||||
{
|
||||
register const char *cp = string, *cpmax;
|
||||
|
|
|
@ -212,7 +212,6 @@ static void timedout(void *handle)
|
|||
* <flags> is union of -A, -r, -s, and contains delimiter if not '\n'
|
||||
* <timeout> is the number of milliseconds until timeout
|
||||
*/
|
||||
|
||||
int sh_readline(char **names, volatile int fd, int flags, ssize_t size, long timeout)
|
||||
{
|
||||
register ssize_t c;
|
||||
|
|
|
@ -132,7 +132,6 @@ void sh_regress_init(void)
|
|||
/*
|
||||
* regress info trace output
|
||||
*/
|
||||
|
||||
void sh_regress(unsigned int index, const char* intercept, const char* info, unsigned int line, const char* file)
|
||||
{
|
||||
char* name;
|
||||
|
@ -148,7 +147,6 @@ void sh_regress(unsigned int index, const char* intercept, const char* info, uns
|
|||
/*
|
||||
* EGID intercepts
|
||||
*/
|
||||
|
||||
static gid_t intercept_sgid = 0;
|
||||
static gid_t intercept_egid = -1;
|
||||
static gid_t intercept_rgid = -1;
|
||||
|
@ -191,7 +189,6 @@ int setgid(gid_t gid)
|
|||
/*
|
||||
* EUID intercepts
|
||||
*/
|
||||
|
||||
static uid_t intercept_suid = 0;
|
||||
static uid_t intercept_euid = -1;
|
||||
static uid_t intercept_ruid = -1;
|
||||
|
@ -234,7 +231,6 @@ int setuid(uid_t uid)
|
|||
/*
|
||||
* p_suid intercept
|
||||
*/
|
||||
|
||||
static uid_t intercept_p_suid = 0x7fffffff;
|
||||
|
||||
uid_t sh_regress_p_suid(unsigned int line, const char* file)
|
||||
|
@ -246,7 +242,6 @@ uid_t sh_regress_p_suid(unsigned int line, const char* file)
|
|||
/*
|
||||
* p_suid intercept
|
||||
*/
|
||||
|
||||
static char* intercept_etc = 0;
|
||||
|
||||
char* sh_regress_etc(const char* path, unsigned int line, const char* file)
|
||||
|
@ -258,7 +253,6 @@ char* sh_regress_etc(const char* path, unsigned int line, const char* file)
|
|||
/*
|
||||
* __regress__ builtin
|
||||
*/
|
||||
|
||||
int b___regress__(int argc, char** argv, Shbltin_t *context)
|
||||
{
|
||||
int n;
|
||||
|
|
|
@ -27,7 +27,6 @@
|
|||
*
|
||||
*/
|
||||
|
||||
|
||||
#include "defs.h"
|
||||
#include <error.h>
|
||||
#include <ls.h>
|
||||
|
@ -560,7 +559,6 @@ int test_binop(register int op,const char *left,const char *right)
|
|||
/*
|
||||
* returns the modification time of f1 - modification time of f2
|
||||
*/
|
||||
|
||||
static time_t test_time(const char *file1,const char *file2)
|
||||
{
|
||||
Time_t t1, t2;
|
||||
|
@ -582,7 +580,6 @@ static time_t test_time(const char *file1,const char *file2)
|
|||
/*
|
||||
* return true if inode of two files are the same
|
||||
*/
|
||||
|
||||
int test_inode(const char *file1,const char *file2)
|
||||
{
|
||||
struct stat stat1,stat2;
|
||||
|
@ -597,7 +594,6 @@ int test_inode(const char *file1,const char *file2)
|
|||
* This version of access checks against the effective UID/GID
|
||||
* The static buffer statb is shared with test_mode.
|
||||
*/
|
||||
|
||||
int sh_access(register const char *name, register int mode)
|
||||
{
|
||||
struct stat statb;
|
||||
|
@ -685,7 +681,6 @@ skip:
|
|||
* If <file> is null, then the previous stat buffer is used.
|
||||
* The mode bits are zero if the file doesn't exist.
|
||||
*/
|
||||
|
||||
static int test_mode(register const char *file)
|
||||
{
|
||||
struct stat statb;
|
||||
|
|
|
@ -316,7 +316,6 @@ int b_suspend(int argc,char *argv[],Shbltin_t *context)
|
|||
/*
|
||||
* Given the name or number of a signal return the signal number
|
||||
*/
|
||||
|
||||
static int sig_number(const char *string)
|
||||
{
|
||||
const Shtable_t *tp;
|
||||
|
|
|
@ -1024,7 +1024,6 @@ static int maxlib;
|
|||
* always move to head of search list
|
||||
* return: 0: already loaded 1: first load
|
||||
*/
|
||||
|
||||
int sh_addlib(void* dll, char* name, Pathcomp_t* pp)
|
||||
{
|
||||
register int n;
|
||||
|
@ -1391,7 +1390,6 @@ static int unall(int argc, char **argv, register Dt_t *troot)
|
|||
sh_subfork(); /* avoid affecting the parent shell's alias table */
|
||||
nv_delete(np,troot,nofree_attr);
|
||||
}
|
||||
|
||||
}
|
||||
else if(troot==sh.alias_tree)
|
||||
r = 1;
|
||||
|
@ -1404,7 +1402,6 @@ static int unall(int argc, char **argv, register Dt_t *troot)
|
|||
/*
|
||||
* print out the name and value of a name-value pair <np>
|
||||
*/
|
||||
|
||||
static int print_namval(Sfio_t *file,register Namval_t *np,register int flag, struct tdata *tp)
|
||||
{
|
||||
register char *cp;
|
||||
|
@ -1549,7 +1546,6 @@ static void print_attribute(register Namval_t *np,void *data)
|
|||
* print the nodes in tree <root> which have attributes <flag> set
|
||||
* if <option> is non-zero, no subscript or value is printed
|
||||
*/
|
||||
|
||||
static void print_scan(Sfio_t *file, int flag, Dt_t *root, int option,struct tdata *tp)
|
||||
{
|
||||
register char **argv;
|
||||
|
@ -1616,7 +1612,6 @@ static void print_scan(Sfio_t *file, int flag, Dt_t *root, int option,struct tda
|
|||
/*
|
||||
* add the name of the node to the argument list argnam
|
||||
*/
|
||||
|
||||
static void pushname(Namval_t *np,void *data)
|
||||
{
|
||||
struct tdata *tp = (struct tdata*)data;
|
||||
|
|
|
@ -1448,7 +1448,7 @@ const char sh_optread[] =
|
|||
"\n[var?prompt] [var ...]\n"
|
||||
"\n"
|
||||
"[+EXIT STATUS?]{"
|
||||
"[+0? Successful completion.]"
|
||||
"[+0?Successful completion.]"
|
||||
"[+>0?End of file was detected or an error occurred.]"
|
||||
"}"
|
||||
"[+SEE ALSO?\bprint\b(1), \bprintf\b(1), \bcat\b(1)]"
|
||||
|
|
|
@ -357,7 +357,6 @@ retry:
|
|||
/*
|
||||
* close the history file and free the space
|
||||
*/
|
||||
|
||||
void hist_close(register History_t *hp)
|
||||
{
|
||||
sfclose(hp->histfp);
|
||||
|
@ -405,7 +404,6 @@ static int hist_clean(int fd)
|
|||
/*
|
||||
* Copy the last <n> commands to a new file and make this the history file
|
||||
*/
|
||||
|
||||
static History_t* hist_trim(History_t *hp, int n)
|
||||
{
|
||||
register char *cp;
|
||||
|
@ -571,7 +569,6 @@ begin:
|
|||
* unless it is followed by 0. If followed by 0 then it cancels
|
||||
* the previous command.
|
||||
*/
|
||||
|
||||
void hist_eof(register History_t *hp)
|
||||
{
|
||||
register char *cp,*first,*endbuff;
|
||||
|
@ -685,7 +682,6 @@ again:
|
|||
/*
|
||||
* This routine will cause the previous command to be cancelled
|
||||
*/
|
||||
|
||||
void hist_cancel(register History_t *hp)
|
||||
{
|
||||
register int c;
|
||||
|
@ -702,7 +698,6 @@ void hist_cancel(register History_t *hp)
|
|||
/*
|
||||
* flush the current history command
|
||||
*/
|
||||
|
||||
void hist_flush(register History_t *hp)
|
||||
{
|
||||
register char *buff;
|
||||
|
@ -730,7 +725,6 @@ void hist_flush(register History_t *hp)
|
|||
* When called from hist_flush(), trailing newlines are deleted and
|
||||
* a zero byte. Line sequencing is added as required
|
||||
*/
|
||||
|
||||
static ssize_t hist_write(Sfio_t *iop,const void *buff,register size_t insize,Sfdisc_t* handle)
|
||||
{
|
||||
register History_t *hp = (History_t*)handle;
|
||||
|
@ -821,7 +815,6 @@ static ssize_t hist_write(Sfio_t *iop,const void *buff,register size_t insize,Sf
|
|||
* Put history sequence number <n> into buffer <buff>
|
||||
* The buffer must be large enough to hold HIST_MARKSZ chars
|
||||
*/
|
||||
|
||||
static void hist_marker(register char *buff,register long cmdno)
|
||||
{
|
||||
*buff++ = HIST_CMDNO;
|
||||
|
@ -855,7 +848,6 @@ off_t hist_seek(register History_t *hp, int n)
|
|||
* if character <last> appears before newline it is deleted
|
||||
* each new-line character is replaced with string <nl>.
|
||||
*/
|
||||
|
||||
void hist_list(register History_t *hp,Sfio_t *outfile, off_t offset,int last, char *nl)
|
||||
{
|
||||
register int oldc=0;
|
||||
|
@ -880,13 +872,12 @@ void hist_list(register History_t *hp,Sfio_t *outfile, off_t offset,int last, ch
|
|||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* find index for last line with given string
|
||||
* If flag==0 then line must begin with string
|
||||
* direction < 1 for backwards search
|
||||
*/
|
||||
|
||||
Histloc_t hist_find(register History_t*hp,char *string,register int index1,int flag,int direction)
|
||||
{
|
||||
register int index2;
|
||||
|
@ -944,7 +935,6 @@ Histloc_t hist_find(register History_t*hp,char *string,register int index1,int f
|
|||
* If coffset==0 then line must begin with string
|
||||
* returns the line number of the match if successful, otherwise -1
|
||||
*/
|
||||
|
||||
int hist_match(register History_t *hp,off_t offset,char *string,int *coffset)
|
||||
{
|
||||
register unsigned char *first, *cp;
|
||||
|
@ -985,7 +975,6 @@ int hist_match(register History_t *hp,off_t offset,char *string,int *coffset)
|
|||
* line < 0 for full command copy
|
||||
* -1 returned if there is no history file
|
||||
*/
|
||||
|
||||
int hist_copy(char *s1,int size,int command,int line)
|
||||
{
|
||||
register int c;
|
||||
|
@ -1026,7 +1015,6 @@ int hist_copy(char *s1,int size,int command,int line)
|
|||
/*
|
||||
* return word number <word> from command number <command>
|
||||
*/
|
||||
|
||||
char *hist_word(char *string,int size,int word)
|
||||
{
|
||||
register int c;
|
||||
|
@ -1081,7 +1069,6 @@ char *hist_word(char *string,int size,int word)
|
|||
* and number of lines back or forward,
|
||||
* compute the new command and line number.
|
||||
*/
|
||||
|
||||
Histloc_t hist_locate(History_t *hp,register int command,register int line,int lines)
|
||||
{
|
||||
Histloc_t next;
|
||||
|
|
|
@ -98,7 +98,6 @@ extern char* sh_setenviron(const char*);
|
|||
#define SH_TYPE_KSH 002
|
||||
#define SH_TYPE_POSIX 004
|
||||
#define SH_TYPE_LOGIN 010
|
||||
#define SH_TYPE_PROFILE 020
|
||||
#define SH_TYPE_RESTRICTED 040
|
||||
|
||||
#ifndef PIPE_BUF
|
||||
|
|
|
@ -1734,7 +1734,7 @@ element stores the
|
|||
.IR i\^ -th
|
||||
submatch.
|
||||
For
|
||||
.B //
|
||||
.BR // ,
|
||||
the array is two-dimensional, with the first subscript indicating the
|
||||
most recent match and subpattern match, and the second subscript indicating
|
||||
which match with
|
||||
|
|
|
@ -511,7 +511,6 @@ static Sfdouble_t arith(const char **ptr, struct lval *lvalue, int type, Sfdoubl
|
|||
}
|
||||
return(r);
|
||||
}
|
||||
|
||||
case MESSAGE:
|
||||
sfsync(NIL(Sfio_t*));
|
||||
if(lvalue->emode&ARITH_COMP)
|
||||
|
@ -527,7 +526,6 @@ static Sfdouble_t arith(const char **ptr, struct lval *lvalue, int type, Sfdoubl
|
|||
* ptr is set to the last character processed
|
||||
* if mode>0, an error will be fatal with value <mode>
|
||||
*/
|
||||
|
||||
Sfdouble_t sh_strnum(register const char *str, char** ptr, int mode)
|
||||
{
|
||||
register Sfdouble_t d;
|
||||
|
|
|
@ -144,7 +144,6 @@ static int scantree(Dt_t *tree, const char *pattern, struct argnod **arghead)
|
|||
* generate the list of files found by adding an suffix to end of name
|
||||
* The number of matches is returned
|
||||
*/
|
||||
|
||||
int path_complete(const char *name,register const char *suffix, struct argnod **arghead)
|
||||
{
|
||||
sufstr = suffix;
|
||||
|
|
|
@ -380,7 +380,6 @@ void sh_sigclear(register int sig)
|
|||
/*
|
||||
* check for traps
|
||||
*/
|
||||
|
||||
void sh_chktrap(void)
|
||||
{
|
||||
register int sig=sh.st.trapmax;
|
||||
|
@ -606,7 +605,6 @@ static void array_notify(Namval_t *np, void *data)
|
|||
/*
|
||||
* This is the exit routine for the shell
|
||||
*/
|
||||
|
||||
noreturn void sh_done(register int sig)
|
||||
{
|
||||
register char *t;
|
||||
|
|
|
@ -1192,7 +1192,7 @@ int sh_type(register const char *path)
|
|||
continue;
|
||||
}
|
||||
}
|
||||
if (!(t & (SH_TYPE_PROFILE|SH_TYPE_RESTRICTED)))
|
||||
if (!(t & SH_TYPE_RESTRICTED))
|
||||
{
|
||||
if (*s == 'r')
|
||||
{
|
||||
|
@ -1222,7 +1222,7 @@ int sh_type(register const char *path)
|
|||
if (!isalnum(*s))
|
||||
return t;
|
||||
}
|
||||
return t & ~(SH_TYPE_KSH|SH_TYPE_PROFILE|SH_TYPE_RESTRICTED);
|
||||
return t & ~(SH_TYPE_KSH|SH_TYPE_RESTRICTED);
|
||||
}
|
||||
|
||||
|
||||
|
@ -1948,7 +1948,6 @@ static Init_t *nv_init(void)
|
|||
/*
|
||||
* initialize name-value pairs
|
||||
*/
|
||||
|
||||
Dt_t *sh_inittree(const struct shtable2 *name_vals)
|
||||
{
|
||||
register Namval_t *np;
|
||||
|
@ -2006,7 +2005,6 @@ Dt_t *sh_inittree(const struct shtable2 *name_vals)
|
|||
*
|
||||
* Returns pointer to A__z env var from which to import attributes, or 0.
|
||||
*/
|
||||
|
||||
static char *env_init(void)
|
||||
{
|
||||
register char *cp;
|
||||
|
|
|
@ -211,7 +211,6 @@ static int onintr(struct addrinfo*);
|
|||
* return <protocol>/<host>/<service> fd
|
||||
* If called with flags==O_NONBLOCK return 1 if protocol is supported
|
||||
*/
|
||||
|
||||
static int
|
||||
inetopen(const char* path, int flags)
|
||||
{
|
||||
|
@ -1927,7 +1926,7 @@ static ssize_t piperead(Sfio_t *iop,void *buff,register size_t size,Sfdisc_t *ha
|
|||
errno = EINTR;
|
||||
return(-1);
|
||||
}
|
||||
if(sh_isstate(SH_INTERACTIVE) && sffileno(iop)==0 && io_prompt(iop,sh.nextprompt)<0 && errno==EIO)
|
||||
if(sh_isstate(SH_INTERACTIVE) && fd==0 && io_prompt(iop,sh.nextprompt)<0 && errno==EIO)
|
||||
return(0);
|
||||
sh_onstate(SH_TTYWAIT);
|
||||
if(!(sh.fdstatus[fd]&IOCLEX) && (sfset(iop,0,0)&SF_SHARE))
|
||||
|
@ -1983,7 +1982,7 @@ static ssize_t slowread(Sfio_t *iop,void *buff,register size_t size,Sfdisc_t *ha
|
|||
return(0);
|
||||
if(sh.timeout)
|
||||
timeout = (void*)sh_timeradd(sh_isstate(SH_GRACE)?1000L*TGRACE:1000L*sh.timeout,0,time_grace,&sh);
|
||||
rsize = (*readf)(sh.ed_context, sffileno(iop), (char*)buff, size, reedit);
|
||||
rsize = (*readf)(sh.ed_context, fno, (char*)buff, size, reedit);
|
||||
if(timeout)
|
||||
timerdel(timeout);
|
||||
timeout=0;
|
||||
|
@ -2040,7 +2039,6 @@ static ssize_t slowread(Sfio_t *iop,void *buff,register size_t size,Sfdisc_t *ha
|
|||
/*
|
||||
* check and return the attributes for a file descriptor
|
||||
*/
|
||||
|
||||
int sh_iocheckfd(register int fd)
|
||||
{
|
||||
register int flags, n;
|
||||
|
@ -2117,7 +2115,6 @@ int sh_iocheckfd(register int fd)
|
|||
/*
|
||||
* Display prompt PS<flag> on standard error
|
||||
*/
|
||||
|
||||
static int io_prompt(Sfio_t *iop,register int flag)
|
||||
{
|
||||
register char *cp;
|
||||
|
@ -2319,7 +2316,6 @@ struct eval
|
|||
/*
|
||||
* Create a stream consisting of a space separated argv[] list
|
||||
*/
|
||||
|
||||
Sfio_t *sh_sfeval(register char *argv[])
|
||||
{
|
||||
register Sfio_t *iop;
|
||||
|
@ -2345,7 +2341,6 @@ Sfio_t *sh_sfeval(register char *argv[])
|
|||
/*
|
||||
* This code gets called whenever an end of string is found with eval
|
||||
*/
|
||||
|
||||
static int eval_exceptf(Sfio_t *iop,int type, void *data, Sfdisc_t *handle)
|
||||
{
|
||||
register struct eval *ep = (struct eval*)handle;
|
||||
|
@ -2385,7 +2380,6 @@ static int eval_exceptf(Sfio_t *iop,int type, void *data, Sfdisc_t *handle)
|
|||
* the stream <sp> starting at offset <offset>
|
||||
* The stream can be read with the normal stream operations
|
||||
*/
|
||||
|
||||
static Sfio_t *subopen(Sfio_t* sp, off_t offset, long size)
|
||||
{
|
||||
register struct subfile *disp;
|
||||
|
@ -2604,7 +2598,6 @@ mode_t sh_umask(mode_t m)
|
|||
* <fd> must be a non-negative number ofr SH_IOCOPROCESS or SH_IOHISTFILE.
|
||||
* returns NULL on failure and may set errno.
|
||||
*/
|
||||
|
||||
Sfio_t *sh_iogetiop(int fd, int mode)
|
||||
{
|
||||
int n;
|
||||
|
|
|
@ -794,7 +794,6 @@ static void job_reset(register struct process *pw)
|
|||
/*
|
||||
* wait built-in command
|
||||
*/
|
||||
|
||||
void job_bwait(char **jobs)
|
||||
{
|
||||
register char *jp;
|
||||
|
@ -826,7 +825,6 @@ void job_bwait(char **jobs)
|
|||
/*
|
||||
* execute function <fun> for each job
|
||||
*/
|
||||
|
||||
int job_walk(Sfio_t *file,int (*fun)(struct process*,int),int arg,char *joblist[])
|
||||
{
|
||||
register struct process *pw;
|
||||
|
@ -894,7 +892,6 @@ int job_walk(Sfio_t *file,int (*fun)(struct process*,int),int arg,char *joblist[
|
|||
* flag JOB_NFLAG for list only jobs marked for notification
|
||||
* flag JOB_PFLAG for process ID(s) only
|
||||
*/
|
||||
|
||||
int job_list(struct process *pw,register int flag)
|
||||
{
|
||||
register struct process *px = pw;
|
||||
|
@ -1002,7 +999,6 @@ static struct process *job_bystring(register char *ajob)
|
|||
/*
|
||||
* Kill a job or process
|
||||
*/
|
||||
|
||||
int job_kill(register struct process *pw,register int sig)
|
||||
{
|
||||
register pid_t pid;
|
||||
|
@ -1127,7 +1123,6 @@ int job_hup(struct process *pw, int sig)
|
|||
/*
|
||||
* Get process structure from first letters of jobname
|
||||
*/
|
||||
|
||||
static struct process *job_byname(char *name)
|
||||
{
|
||||
register struct process *pw = job.pwlist;
|
||||
|
@ -1163,7 +1158,6 @@ static struct process *job_byname(char *name)
|
|||
/*
|
||||
* Initialize the process posting array
|
||||
*/
|
||||
|
||||
void job_clear(void)
|
||||
{
|
||||
register struct process *pw, *px;
|
||||
|
@ -1207,7 +1201,6 @@ void job_clear(void)
|
|||
* put the process <pid> on the process list and return the job number
|
||||
* if non-zero, <join> is the process ID of the job to join
|
||||
*/
|
||||
|
||||
int job_post(pid_t pid, pid_t join)
|
||||
{
|
||||
register struct process *pw;
|
||||
|
@ -1332,7 +1325,6 @@ int job_post(pid_t pid, pid_t join)
|
|||
/*
|
||||
* Returns a process structure give a process ID
|
||||
*/
|
||||
|
||||
static struct process *job_bypid(pid_t pid)
|
||||
{
|
||||
register struct process *pw, *px;
|
||||
|
@ -1348,7 +1340,6 @@ static struct process *job_bypid(pid_t pid)
|
|||
/*
|
||||
* return a pointer to a job given the job ID
|
||||
*/
|
||||
|
||||
static struct process *job_byjid(int jobid)
|
||||
{
|
||||
register struct process *pw;
|
||||
|
@ -1388,7 +1379,6 @@ static void job_prmsg(register struct process *pw)
|
|||
* pid=1 to wait for at least one process to complete
|
||||
* pid=-1 to wait for all running processes
|
||||
*/
|
||||
|
||||
int job_wait(register pid_t pid)
|
||||
{
|
||||
register struct process *pw=0,*px;
|
||||
|
@ -1588,7 +1578,6 @@ done:
|
|||
* move job to background if bgflag == 'b'
|
||||
* disown job if bgflag == 'd'
|
||||
*/
|
||||
|
||||
int job_switch(register struct process *pw,int bgflag)
|
||||
{
|
||||
register const char *msg;
|
||||
|
@ -1652,7 +1641,6 @@ int job_switch(register struct process *pw,int bgflag)
|
|||
/*
|
||||
* Set the foreground group associated with a job
|
||||
*/
|
||||
|
||||
static void job_fgrp(register struct process *pw, int newgrp)
|
||||
{
|
||||
for(; pw; pw=pw->p_nxtproc)
|
||||
|
@ -1662,7 +1650,6 @@ static void job_fgrp(register struct process *pw, int newgrp)
|
|||
/*
|
||||
* turn off STOP state of a process group and send CONT signals
|
||||
*/
|
||||
|
||||
static void job_unstop(register struct process *px)
|
||||
{
|
||||
register struct process *pw;
|
||||
|
@ -1691,7 +1678,6 @@ static void job_unstop(register struct process *px)
|
|||
* pwlist is reset if the first job is removed
|
||||
* if <notify> is non-zero, then jobs with pending notifications are unposted
|
||||
*/
|
||||
|
||||
static struct process *job_unpost(register struct process *pwtop,int notify)
|
||||
{
|
||||
register struct process *pw;
|
||||
|
@ -1769,7 +1755,6 @@ static void job_unlink(register struct process *pw)
|
|||
* get an unused job number
|
||||
* freejobs is a bit vector, 0 is unused
|
||||
*/
|
||||
|
||||
static int job_alloc(void)
|
||||
{
|
||||
register int j=0;
|
||||
|
@ -1800,7 +1785,6 @@ static int job_alloc(void)
|
|||
/*
|
||||
* return a job number
|
||||
*/
|
||||
|
||||
static void job_free(register int n)
|
||||
{
|
||||
register int j = (--n)/CHAR_BIT;
|
||||
|
|
|
@ -1750,7 +1750,6 @@ void sh_lexskip(Lex_t *lp,int close, register int copy, int state)
|
|||
* noted with the IOQUOTE flag
|
||||
* returns 1 for complete here-doc, 0 for EOF
|
||||
*/
|
||||
|
||||
static int here_copy(Lex_t *lp,register struct ionod *iop)
|
||||
{
|
||||
register const char *state;
|
||||
|
@ -2071,7 +2070,6 @@ static char *fmttoken(Lex_t *lp, register int sym)
|
|||
/*
|
||||
* print a bad syntax message
|
||||
*/
|
||||
|
||||
noreturn void sh_syntax(Lex_t *lp)
|
||||
{
|
||||
register const char *cp = sh_translate(e_unexpected);
|
||||
|
|
|
@ -85,7 +85,6 @@ static char beenhere = 0;
|
|||
* search for file and exfile() it if it exists
|
||||
* 1 returned if file found, 0 otherwise
|
||||
*/
|
||||
|
||||
static int sh_source(Sfio_t *iop, const char *file)
|
||||
{
|
||||
char* oid;
|
||||
|
@ -373,7 +372,6 @@ int sh_main(int ac, char *av[], Shinit_f userinit)
|
|||
* iop is not null when the input is a string
|
||||
* fdin is the input file descriptor
|
||||
*/
|
||||
|
||||
static void exfile(register Sfio_t *iop,register int fno)
|
||||
{
|
||||
time_t curtime;
|
||||
|
|
|
@ -2338,7 +2338,6 @@ void sh_scope(struct argnod *envlist, int fun)
|
|||
* of nnod. This includes any strings representing the value(s) of the
|
||||
* node, as well as its dope vector, if it is an array.
|
||||
*/
|
||||
|
||||
void sh_envnolocal (register Namval_t *np, void *data)
|
||||
{
|
||||
char *cp = 0, was_export = nv_isattr(np,NV_EXPORT)!=0;
|
||||
|
@ -2695,7 +2694,6 @@ void sh_optclear(void *old)
|
|||
*
|
||||
* If <np> has no value, 0 is returned.
|
||||
*/
|
||||
|
||||
char *nv_getval(register Namval_t *np)
|
||||
{
|
||||
register union Value *up= &np->nvalue;
|
||||
|
|
|
@ -376,7 +376,6 @@ static Shnode_t *makelist(Lex_t *lexp, int type, Shnode_t *l, Shnode_t *r)
|
|||
* entry to shell parser
|
||||
* Flag can be the union of SH_EOF|SH_NL
|
||||
*/
|
||||
|
||||
void *sh_parse(Sfio_t *iop, int flag)
|
||||
{
|
||||
register Shnode_t *t;
|
||||
|
@ -507,7 +506,6 @@ Shnode_t *sh_dolparen(Lex_t* lp)
|
|||
/*
|
||||
* remove temporary files and stacks
|
||||
*/
|
||||
|
||||
void sh_freeup(void)
|
||||
{
|
||||
if(sh.st.staklist)
|
||||
|
@ -520,7 +518,6 @@ void sh_freeup(void)
|
|||
* decrease reference count for each stack in function list when flag<=0
|
||||
* stack is freed when reference count is zero
|
||||
*/
|
||||
|
||||
void sh_funstaks(register struct slnod *slp,int flag)
|
||||
{
|
||||
register struct slnod *slpold;
|
||||
|
@ -542,7 +539,6 @@ void sh_funstaks(register struct slnod *slp,int flag)
|
|||
* list & [ cmd ]
|
||||
* list [ ; cmd ]
|
||||
*/
|
||||
|
||||
static Shnode_t *sh_cmd(Lex_t *lexp, register int sym, int flag)
|
||||
{
|
||||
register Shnode_t *left, *right;
|
||||
|
@ -1199,7 +1195,6 @@ static struct argnod *assign(Lex_t *lexp, register struct argnod *ap, int type)
|
|||
* case ... in ... esac
|
||||
* begin ... end
|
||||
*/
|
||||
|
||||
static Shnode_t *item(Lex_t *lexp,int flag)
|
||||
{
|
||||
register Shnode_t *t;
|
||||
|
@ -1896,7 +1891,6 @@ static struct ionod *inout(Lex_t *lexp,struct ionod *lastio,int flag)
|
|||
/*
|
||||
* convert argument chain to argument list when no special arguments
|
||||
*/
|
||||
|
||||
static struct argnod *qscan(struct comnod *ac,int argn)
|
||||
{
|
||||
register char **cp;
|
||||
|
|
|
@ -482,7 +482,6 @@ int path_open(const char *name, register Pathcomp_t *pp)
|
|||
/*
|
||||
* given a pathname return the base name
|
||||
*/
|
||||
|
||||
char *path_basename(register const char *name)
|
||||
{
|
||||
register const char *start = name;
|
||||
|
@ -612,7 +611,6 @@ static void funload(int fno, const char *name)
|
|||
* if the matching $PATH entry is '.' or empty, the simple name is written without prefixing the PWD
|
||||
* - nothing executable was found
|
||||
*/
|
||||
|
||||
int path_search(register const char *name,Pathcomp_t **oldpp, int flag)
|
||||
{
|
||||
register Namval_t *np;
|
||||
|
@ -927,7 +925,6 @@ err:
|
|||
/*
|
||||
* Return path relative to present working directory
|
||||
*/
|
||||
|
||||
char *path_relative(register const char* file)
|
||||
{
|
||||
register const char *pwd;
|
||||
|
@ -1269,7 +1266,6 @@ pid_t path_spawn(const char *opath,register char **argv, char **envp, Pathcomp_t
|
|||
* File is executable but not machine code.
|
||||
* Assume file is a shell script and execute it.
|
||||
*/
|
||||
|
||||
static noreturn void exscript(register char *path,register char *argv[],char **envp)
|
||||
{
|
||||
register Sfio_t *sp;
|
||||
|
@ -1387,8 +1383,8 @@ static noreturn void exscript(register char *path,register char *argv[],char **e
|
|||
SHACCT = getenv("SHACCT");
|
||||
}
|
||||
/*
|
||||
* suspend accounting until turned on by sh_accbegin()
|
||||
*/
|
||||
* suspend accounting until turned on by sh_accbegin()
|
||||
*/
|
||||
void sh_accsusp(void)
|
||||
{
|
||||
shaccton=0;
|
||||
|
@ -1459,8 +1455,6 @@ static noreturn void exscript(register char *path,register char *argv[],char **e
|
|||
}
|
||||
#endif /* SHOPT_ACCT */
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* add a path component to the path search list and eliminate duplicates
|
||||
* and non-existing absolute paths.
|
||||
|
|
|
@ -564,7 +564,6 @@ static int gettok(register struct vars *vp)
|
|||
/*
|
||||
* evaluate a subexpression with precedence
|
||||
*/
|
||||
|
||||
static int expr(register struct vars *vp,register int precedence)
|
||||
{
|
||||
register int c, op;
|
||||
|
@ -943,7 +942,6 @@ Arith_t *arith_compile(const char *string,char **last,Sfdouble_t(*fun)(const cha
|
|||
*
|
||||
* NOTE: (*convert)() may call arith_strval()
|
||||
*/
|
||||
|
||||
Sfdouble_t arith_strval(const char *s, char **end, Sfdouble_t(*convert)(const char**,struct lval*,int,Sfdouble_t), int emode)
|
||||
{
|
||||
Arith_t *ep;
|
||||
|
|
|
@ -45,7 +45,6 @@
|
|||
* <table> is searched for string <sp> and corresponding value is returned
|
||||
* This is only used for small tables and is used to save non-shareable memory
|
||||
*/
|
||||
|
||||
const Shtable_t *sh_locate(register const char *sp,const Shtable_t *table,int size)
|
||||
{
|
||||
register int first;
|
||||
|
@ -230,7 +229,6 @@ found:
|
|||
* TRIM(sp)
|
||||
* Remove escape characters from characters in <sp> and eliminate quoted nulls.
|
||||
*/
|
||||
|
||||
void sh_trim(register char *sp)
|
||||
/*@
|
||||
assume sp!=NULL;
|
||||
|
@ -267,7 +265,6 @@ void sh_trim(register char *sp)
|
|||
* <str2> must be big enough to hold <str1>
|
||||
* <str1> and <str2> may point to the same place.
|
||||
*/
|
||||
|
||||
void sh_utol(register char const *str1,register char *str2)
|
||||
/*@
|
||||
assume str1!=0 && str2!=0
|
||||
|
|
|
@ -471,7 +471,6 @@ void sh_subjobcheck(pid_t pid)
|
|||
* If comsub is not null, the return value will be a stream consisting of
|
||||
* output of command <t>. Otherwise, NULL will be returned.
|
||||
*/
|
||||
|
||||
Sfio_t *sh_subshell(Shnode_t *t, volatile int flags, int comsub)
|
||||
{
|
||||
struct subshell sub_data;
|
||||
|
|
|
@ -258,7 +258,6 @@ exec:
|
|||
/*
|
||||
* return true if shell ends in sh or ksh
|
||||
*/
|
||||
|
||||
static int endsh(register const char *shell)
|
||||
{
|
||||
while(*shell)
|
||||
|
@ -276,7 +275,6 @@ static int endsh(register const char *shell)
|
|||
/*
|
||||
* return true if shell is in <dir> directory
|
||||
*/
|
||||
|
||||
static int in_dir(register const char *dir,register const char *shell)
|
||||
{
|
||||
while(*dir)
|
||||
|
@ -298,7 +296,6 @@ static void error_exit(const char *message)
|
|||
/*
|
||||
* This version of access checks against effective UID and effective GID
|
||||
*/
|
||||
|
||||
int eaccess(register const char *name, register int mode)
|
||||
{
|
||||
struct stat statb;
|
||||
|
@ -374,7 +371,6 @@ static void setids(int mode,int owner,int group)
|
|||
* Finally, the clone is exec'd. This file is unlinked by a grandchild
|
||||
* of this program, who waits around until the text is free.
|
||||
*/
|
||||
|
||||
static void setids(int mode,uid_t owner,gid_t group)
|
||||
{
|
||||
register int n,m;
|
||||
|
@ -485,7 +481,6 @@ static void setids(int mode,uid_t owner,gid_t group)
|
|||
/*
|
||||
* create a unique name into the <template>
|
||||
*/
|
||||
|
||||
static void maketemp(char *template)
|
||||
{
|
||||
register char *cp = template;
|
||||
|
@ -503,7 +498,6 @@ static void maketemp(char *template)
|
|||
/*
|
||||
* copy THISPROG into the open file number <fdo> and close <fdo>
|
||||
*/
|
||||
|
||||
static int mycopy(int fdi, int fdo)
|
||||
{
|
||||
char buffer[BLKSIZE];
|
||||
|
|
|
@ -26,8 +26,6 @@
|
|||
* waiting for job completion.
|
||||
* The previous waitevent hook function is returned
|
||||
*/
|
||||
|
||||
|
||||
void *sh_waitnotify(int(*newevent)(int,long,int))
|
||||
{
|
||||
int (*old)(int,long,int);
|
||||
|
|
|
@ -2802,7 +2802,6 @@ int sh_run(int argn, char *argv[])
|
|||
/*
|
||||
* print out the command line if set -x is on
|
||||
*/
|
||||
|
||||
int sh_trace(register char *argv[], register int nl)
|
||||
{
|
||||
if(sh_isoption(SH_XTRACE))
|
||||
|
@ -2867,7 +2866,6 @@ int sh_trace(register char *argv[], register int nl)
|
|||
* Traps are reset by the child
|
||||
* The process-id of the child is returned to the parent, 0 to the child.
|
||||
*/
|
||||
|
||||
static void timed_out(void *handle)
|
||||
{
|
||||
NOT_USED(handle);
|
||||
|
|
|
@ -499,6 +499,10 @@ export foo
|
|||
|
||||
# ======
|
||||
# unset exported readonly variables, combined with all other possible attributes
|
||||
(
|
||||
### begin subshell
|
||||
ulimit -t unlimited 2>/dev/null # run in forked subshell to be crash-proof
|
||||
Errors=0
|
||||
typeset -A expect=(
|
||||
[a]='typeset -x -r -a foo'
|
||||
[b]='typeset -x -r -b foo'
|
||||
|
@ -552,7 +556,13 @@ do unset foo
|
|||
"expected $(printf %q "${expect[$flag]}"), got $(printf %q "$actual")"
|
||||
fi
|
||||
done
|
||||
unset expect
|
||||
exit "$Errors"
|
||||
### end subshell
|
||||
)
|
||||
if let "(e=$?) > 128"
|
||||
then err_exit "typeset -x -r test crashed with SIG$(kill -l "$e")"
|
||||
else let "Errors += e"
|
||||
fi
|
||||
|
||||
unset base
|
||||
for base in 0 1 65
|
||||
|
@ -592,6 +602,10 @@ got=$(< $tmpfile)
|
|||
# Combining -u with -F or -E caused an incorrect variable type
|
||||
# https://github.com/ksh93/ksh/pull/163
|
||||
# Allow the last numeric type to win out
|
||||
(
|
||||
### begin subshell
|
||||
ulimit -t unlimited 2>/dev/null # run in forked subshell to be crash-proof
|
||||
Errors=0
|
||||
typeset -A expect=(
|
||||
[uF]='typeset -F a=2.0000000000'
|
||||
[Fu]='typeset -F a=2.0000000000'
|
||||
|
@ -632,6 +646,14 @@ unset expect
|
|||
|
||||
[[ $(typeset -iX12 -s a=2; typeset -p a) == 'typeset -X 12 a=0x1.000000000000p+1' ]] || err_exit "typeset -iX12 -s failed to become typeset -X 12 a=0x1.000000000000p+1."
|
||||
|
||||
exit "$Errors"
|
||||
### end subshell
|
||||
)
|
||||
if let "(e=$?) > 128"
|
||||
then err_exit "typeset int+float test crashed with SIG$(kill -l "$e")"
|
||||
else let "Errors += e"
|
||||
fi
|
||||
|
||||
# ======
|
||||
# Bug introduced in 0e4c4d61: could not alter the size of an existing justified string attribute
|
||||
# https://github.com/ksh93/ksh/issues/142#issuecomment-780931533
|
||||
|
|
|
@ -867,6 +867,7 @@ PATH=$save_PATH
|
|||
|
||||
# ======
|
||||
# These are the regression tests for the whence builtin's '-t' flag
|
||||
((.sh.version >= 20211227)) &&
|
||||
for w in 'whence -t' 'type -t' 'whence -t -v'; do
|
||||
exp=file
|
||||
got=$($w $SHELL)
|
||||
|
@ -1428,6 +1429,7 @@ got="$($SHELL -i "$hist_error_leak" 2>&1)"
|
|||
|
||||
# ======
|
||||
# printf -v works as of 2021-11-18
|
||||
((.sh.version >= 20211118)) && {
|
||||
integer ver=.sh.version
|
||||
exp=ok$'\f'0000$ver$'\n'
|
||||
printf -v got 'ok\f%012d\n' $ver 2>/dev/null
|
||||
|
@ -1438,6 +1440,7 @@ printf -v 'got[1][two][3]' 'ok\f%012d\n' $ver 2>/dev/null
|
|||
[[ ${got[1]["two"][3]} == "$exp" ]] || err_exit "printf -v not working with array subscripts" \
|
||||
"(expected $(printf %q "$exp"), got $(printf %q "$got"))"
|
||||
unset got ver
|
||||
}
|
||||
|
||||
# ======
|
||||
# The rm builtin's -d option should remove files and empty directories without
|
||||
|
@ -1491,45 +1494,63 @@ fi
|
|||
# ======
|
||||
# These are regression tests for the cd command's -e and -P flags
|
||||
mkdir -p "$tmp/failpwd"
|
||||
ln -s "$tmp/failpwd" "$tmp/failpwd1"
|
||||
cd "$tmp/failpwd1"
|
||||
rm ../failpwd1
|
||||
cd "$tmp/failpwd"
|
||||
"$SHELL" -c 'cd /; exec rmdir "$1"' x "$tmp/failpwd"
|
||||
cd -P .
|
||||
got=$?; exp=0
|
||||
(( got == exp )) || err_exit "cd -P without -e exits with error status if \$PWD doesn't exist (expected $exp, got $got)"
|
||||
cd -eP .
|
||||
got=$?; exp=1
|
||||
(( got == exp )) || err_exit "cd -eP doesn't fail if \$PWD doesn't exist (expected $exp, got $got)"
|
||||
if ((.sh.version >= 20211205))
|
||||
then
|
||||
cd -eP .
|
||||
got=$?; exp=1
|
||||
(( got == exp )) || err_exit "cd -eP doesn't fail if \$PWD doesn't exist (expected $exp, got $got)"
|
||||
fi
|
||||
|
||||
cd "$tmp"
|
||||
cd -P "$tmp/notadir" >/dev/null 2>&1
|
||||
got=$?; exp=1
|
||||
(( got == exp )) || err_exit "cd -P without -e fails with wrong exit status on nonexistent dir (expected $exp, got $got)"
|
||||
cd -eP "$tmp/notadir" >/dev/null 2>&1
|
||||
got=$?; exp=2
|
||||
(( got == exp )) || err_exit "cd -eP fails with wrong exit status on nonexistent dir (expected $exp, got $got)"
|
||||
if ((.sh.version >= 20211205))
|
||||
then
|
||||
cd -eP "$tmp/notadir" >/dev/null 2>&1
|
||||
got=$?; exp=2
|
||||
(( got == exp )) || err_exit "cd -eP fails with wrong exit status on nonexistent dir (expected $exp, got $got)"
|
||||
fi
|
||||
|
||||
OLDPWD="$tmp/baddir"
|
||||
cd -P - >/dev/null 2>&1
|
||||
got=$?; exp=1
|
||||
(( got == exp )) || err_exit "cd -P without -e fails with wrong exit status on \$OLDPWD (expected $exp, got $got)"
|
||||
cd -eP - >/dev/null 2>&1
|
||||
got=$?; exp=2
|
||||
(( got == exp )) || err_exit "cd -eP fails with wrong exit status on \$OLDPWD (expected $exp, got $got)"
|
||||
if ((.sh.version >= 20211205))
|
||||
then
|
||||
cd -eP - >/dev/null 2>&1
|
||||
got=$?; exp=2
|
||||
(( got == exp )) || err_exit "cd -eP fails with wrong exit status on \$OLDPWD (expected $exp, got $got)"
|
||||
fi
|
||||
cd "$tmp" || err_exit "couldn't change directory from nonexistent dir"
|
||||
|
||||
(set -o restricted; cd -P /) >/dev/null 2>&1
|
||||
got=$?; exp=1
|
||||
(( got == exp )) || err_exit "cd -P in restricted shell has wrong exit status (expected $exp, got $got)"
|
||||
(set -o restricted; cd -eP /) >/dev/null 2>&1
|
||||
got=$?; exp=2
|
||||
(( got == exp )) || err_exit "cd -eP in restricted shell has wrong exit status (expected $exp, got $got)"
|
||||
(set -o restricted; cd -?) >/dev/null 2>&1
|
||||
if ((.sh.version >= 20211205))
|
||||
then
|
||||
(set -o restricted; cd -eP /) >/dev/null 2>&1
|
||||
got=$?; exp=2
|
||||
(( got == exp )) || err_exit "cd -eP in restricted shell has wrong exit status (expected $exp, got $got)"
|
||||
fi
|
||||
(set -o restricted; cd -\?) >/dev/null 2>&1
|
||||
got=$?; exp=1
|
||||
(( got == exp )) || err_exit "cd -? shows usage info in restricted shell and has wrong exit status (expected $exp, got $got)"
|
||||
(( got == exp )) || err_exit "cd -\\? shows usage info in restricted shell and has wrong exit status (expected $exp, got $got)"
|
||||
|
||||
(cd -P '') >/dev/null 2>&1
|
||||
got=$?; exp=1
|
||||
(( got == exp )) || err_exit "cd -P to empty string has wrong exit status (expected $exp, got $got)"
|
||||
(cd -eP '') >/dev/null 2>&1
|
||||
got=$?; exp=2
|
||||
(( got == exp )) || err_exit "cd -eP to empty string has wrong exit status (expected $exp, got $got)"
|
||||
if ((.sh.version >= 20211205))
|
||||
then
|
||||
(cd -eP '') >/dev/null 2>&1
|
||||
got=$?; exp=2
|
||||
(( got == exp )) || err_exit "cd -eP to empty string has wrong exit status (expected $exp, got $got)"
|
||||
fi
|
||||
|
||||
# ======
|
||||
# The head and tail builtins should work on files without newlines
|
||||
|
|
|
@ -22,8 +22,7 @@
|
|||
. "${SHTESTS_COMMON:-${0%/*}/_common}"
|
||||
|
||||
# regression tests for compound variables
|
||||
Command=${0##*/}
|
||||
integer Errors=0
|
||||
|
||||
Point=(
|
||||
float x=1. y=0.
|
||||
)
|
||||
|
|
|
@ -22,10 +22,7 @@
|
|||
|
||||
. "${SHTESTS_COMMON:-${0%/*}/_common}"
|
||||
|
||||
# "nounset" disabled for now
|
||||
#set -o nounset
|
||||
Command=${0##*/}
|
||||
integer Errors=0 HAVE_signbit=0
|
||||
typeset -is HAVE_signbit=0
|
||||
|
||||
if typeset -f .sh.math.signbit >/dev/null && (( signbit(-NaN) ))
|
||||
then HAVE_signbit=1
|
||||
|
|
|
@ -954,6 +954,7 @@ got=$(
|
|||
[[ $got == 'test' ]] || err_exit "issue 161 hypothetical bug 2" \
|
||||
"(expected 'test', got $(printf %q "$got"))"
|
||||
got=$(
|
||||
set +x
|
||||
exec 4>&1
|
||||
foo=${ { redirect 4>&1; } 6<&2 4<&-; }
|
||||
echo "test" >&4 # => 4: cannot open [Bad file descriptor]
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -94,7 +94,7 @@ static ssize_t filterread(Sfio_t* f, /* stream reading from */
|
|||
}
|
||||
|
||||
static ssize_t filterwrite(Sfio_t* f, /* stream writing to */
|
||||
void* buf, /* buffer to write into */
|
||||
const void* buf, /* buffer to write into */
|
||||
size_t n, /* number of bytes requested */
|
||||
Sfdisc_t* disc) /* discipline */
|
||||
{
|
||||
|
|
|
@ -39,7 +39,7 @@ typedef struct _skable_s
|
|||
} Seek_t;
|
||||
|
||||
static ssize_t skwrite(Sfio_t* f, /* stream involved */
|
||||
void* buf, /* buffer to read into */
|
||||
const void* buf, /* buffer to read into */
|
||||
size_t n, /* number of bytes to read */
|
||||
Sfdisc_t* disc) /* discipline */
|
||||
{
|
||||
|
|
|
@ -429,7 +429,7 @@ make install
|
|||
exec - ${PACKAGEROOT}/src/lib/libcmd/cmdinit.c ${PACKAGEROOT}/src/lib/libcmd/basename.c ${PACKAGEROOT}/src/lib/libcmd/cat.c ${PACKAGEROOT}/src/lib/libcmd/chgrp.c ${PACKAGEROOT}/src/lib/libcmd/chmod.c ${PACKAGEROOT}/src/lib/libcmd/chown.c ${PACKAGEROOT}/src/lib/libcmd/cksum.c ${PACKAGEROOT}/src/lib/libcmd/cmp.c ${PACKAGEROOT}/src/lib/libcmd/comm.c ${PACKAGEROOT}/src/lib/libcmd/cp.c ${PACKAGEROOT}/src/lib/libcmd/cut.c ${PACKAGEROOT}/src/lib/libcmd/dirname.c ${PACKAGEROOT}/src/lib/libcmd/date.c ${PACKAGEROOT}/src/lib/libcmd/expr.c ${PACKAGEROOT}/src/lib/libcmd/fds.c ${PACKAGEROOT}/src/lib/libcmd/fmt.c ${PACKAGEROOT}/src/lib/libcmd/fold.c ${PACKAGEROOT}/src/lib/libcmd/getconf.c ${PACKAGEROOT}/src/lib/libcmd/head.c ${PACKAGEROOT}/src/lib/libcmd/id.c ${PACKAGEROOT}/src/lib/libcmd/join.c ${PACKAGEROOT}/src/lib/libcmd/ln.c ${PACKAGEROOT}/src/lib/libcmd/logname.c ${PACKAGEROOT}/src/lib/libcmd/md5sum.c ${PACKAGEROOT}/src/lib/libcmd/mkdir.c ${PACKAGEROOT}/src/lib/libcmd/mkfifo.c ${PACKAGEROOT}/src/lib/libcmd/mktemp.c ${PACKAGEROOT}/src/lib/libcmd/mv.c ${PACKAGEROOT}/src/lib/libcmd/paste.c ${PACKAGEROOT}/src/lib/libcmd/pathchk.c ${PACKAGEROOT}/src/lib/libcmd/pids.c ${PACKAGEROOT}/src/lib/libcmd/rev.c ${PACKAGEROOT}/src/lib/libcmd/rm.c ${PACKAGEROOT}/src/lib/libcmd/rmdir.c ${PACKAGEROOT}/src/lib/libcmd/stty.c ${PACKAGEROOT}/src/lib/libcmd/sum.c ${PACKAGEROOT}/src/lib/libcmd/sync.c ${PACKAGEROOT}/src/lib/libcmd/tail.c ${PACKAGEROOT}/src/lib/libcmd/tee.c ${PACKAGEROOT}/src/lib/libcmd/tty.c ${PACKAGEROOT}/src/lib/libcmd/uname.c ${PACKAGEROOT}/src/lib/libcmd/uniq.c ${PACKAGEROOT}/src/lib/libcmd/vmstate.c ${PACKAGEROOT}/src/lib/libcmd/wc.c ${PACKAGEROOT}/src/lib/libcmd/revlib.c ${PACKAGEROOT}/src/lib/libcmd/wclib.c ${PACKAGEROOT}/src/lib/libcmd/lib.c |
|
||||
exec - sort -u
|
||||
exec - } > 1.${COTEMP}.h
|
||||
exec - if cmp 2>/dev/null -s 1.${COTEMP}.h cmdext.h
|
||||
exec - if cmp -s 1.${COTEMP}.h cmdext.h
|
||||
exec - then rm -f 1.${COTEMP}.h
|
||||
exec - else mv 1.${COTEMP}.h cmdext.h
|
||||
exec - fi
|
||||
|
@ -762,16 +762,14 @@ make install
|
|||
make ${PACKAGE_ast_INCLUDE}/cmd.h
|
||||
prev ${PACKAGE_ast_INCLUDE}
|
||||
prev cmd.h
|
||||
exec - if cmp 2>/dev/null -s cmd.h ${PACKAGE_ast_INCLUDE}/cmd.h
|
||||
exec - then :
|
||||
exec - else ${STDCP} cmd.h ${PACKAGE_ast_INCLUDE}/cmd.h
|
||||
exec - if ! cmp -s cmd.h ${PACKAGE_ast_INCLUDE}/cmd.h
|
||||
exec - then ${STDCP} cmd.h ${PACKAGE_ast_INCLUDE}/cmd.h
|
||||
exec - fi
|
||||
done ${PACKAGE_ast_INCLUDE}/cmd.h generated
|
||||
make ${PACKAGE_ast_INCLUDE}/cmdext.h
|
||||
prev cmdext.h
|
||||
exec - if cmp 2>/dev/null -s cmdext.h ${PACKAGE_ast_INCLUDE}/cmdext.h
|
||||
exec - then :
|
||||
exec - else ${STDCP} cmdext.h ${PACKAGE_ast_INCLUDE}/cmdext.h
|
||||
exec - if ! cmp -s cmdext.h ${PACKAGE_ast_INCLUDE}/cmdext.h
|
||||
exec - then ${STDCP} cmdext.h ${PACKAGE_ast_INCLUDE}/cmdext.h
|
||||
exec - fi
|
||||
done ${PACKAGE_ast_INCLUDE}/cmdext.h generated
|
||||
make ${PACKAGE_ast_INCLUDE}/cmdlist.h
|
||||
|
@ -838,14 +836,13 @@ make install
|
|||
exec - |
|
||||
exec - sort -u
|
||||
exec - } > 1.${COTEMP}.h
|
||||
exec - if cmp 2>/dev/null -s 1.${COTEMP}.h cmdlist.h
|
||||
exec - if cmp -s 1.${COTEMP}.h cmdlist.h
|
||||
exec - then rm -f 1.${COTEMP}.h
|
||||
exec - else mv 1.${COTEMP}.h cmdlist.h
|
||||
exec - fi
|
||||
done cmdlist.h generated
|
||||
exec - if cmp 2>/dev/null -s cmdlist.h ${PACKAGE_ast_INCLUDE}/cmdlist.h
|
||||
exec - then :
|
||||
exec - else ${STDCP} cmdlist.h ${PACKAGE_ast_INCLUDE}/cmdlist.h
|
||||
exec - if ! cmp -s cmdlist.h ${PACKAGE_ast_INCLUDE}/cmdlist.h
|
||||
exec - then ${STDCP} cmdlist.h ${PACKAGE_ast_INCLUDE}/cmdlist.h
|
||||
exec - fi
|
||||
done ${PACKAGE_ast_INCLUDE}/cmdlist.h generated
|
||||
done install virtual
|
||||
|
|
|
@ -24,7 +24,9 @@
|
|||
#include <vmalloc.h>
|
||||
#include <sfdisc.h>
|
||||
|
||||
#if !_std_malloc /* do not pointlessly compile this if vmalloc is disabled */
|
||||
#if _std_malloc /* do not pointlessly compile this if vmalloc is disabled */
|
||||
void _STUB_vmstate(){}
|
||||
#else
|
||||
|
||||
#define FORMAT "region=%(region)p method=%(method)s flags=%(flags)s size=%(size)d segments=%(segments)d busy=(%(busy_size)d,%(busy_blocks)d,%(busy_max)d) free=(%(free_size)d,%(free_blocks)d,%(free_max)d)"
|
||||
|
||||
|
|
|
@ -146,7 +146,7 @@ make install
|
|||
bind -last
|
||||
exec - iffe ${IFFEFLAGS} -v -c "${CC} ${mam_cc_FLAGS} ${KSH_RELFLAGS} ${CCFLAGS} ${LDFLAGS}" ref ${mam_cc_L+-L.} ${mam_cc_L+-L${INSTALLROOT}/lib} -I${PACKAGE_ast_INCLUDE} -I${INSTALLROOT}/include ${mam_libdl} ${mam_libast} : run features/dll
|
||||
done FEATURE/dll generated
|
||||
exec - cmp 2>/dev/null -s FEATURE/dll dlldefs.h || { rm -f dlldefs.h; silent test -d . || mkdir .; cp FEATURE/dll dlldefs.h; }
|
||||
exec - cmp -s FEATURE/dll dlldefs.h || { rm -f dlldefs.h; silent test -d . || mkdir .; cp FEATURE/dll dlldefs.h; }
|
||||
done dlldefs.h generated
|
||||
prev ${PACKAGE_ast_INCLUDE}/ast.h implicit
|
||||
done dlfcn.c
|
||||
|
@ -285,9 +285,8 @@ make install
|
|||
make ${PACKAGE_ast_INCLUDE}/dlldefs.h
|
||||
prev ${PACKAGE_ast_INCLUDE}
|
||||
prev dlldefs.h
|
||||
exec - if cmp 2>/dev/null -s dlldefs.h ${PACKAGE_ast_INCLUDE}/dlldefs.h
|
||||
exec - then :
|
||||
exec - else ${STDCP} dlldefs.h ${PACKAGE_ast_INCLUDE}/dlldefs.h
|
||||
exec - if ! cmp -s dlldefs.h ${PACKAGE_ast_INCLUDE}/dlldefs.h
|
||||
exec - then ${STDCP} dlldefs.h ${PACKAGE_ast_INCLUDE}/dlldefs.h
|
||||
exec - fi
|
||||
done ${PACKAGE_ast_INCLUDE}/dlldefs.h generated
|
||||
done install virtual
|
||||
|
|
|
@ -212,9 +212,8 @@ make install
|
|||
make ${PACKAGE_ast_INCLUDE}/sum.h
|
||||
prev ${PACKAGE_ast_INCLUDE}
|
||||
prev sum.h
|
||||
exec - if cmp 2>/dev/null -s sum.h ${PACKAGE_ast_INCLUDE}/sum.h
|
||||
exec - then :
|
||||
exec - else ${STDCP} sum.h ${PACKAGE_ast_INCLUDE}/sum.h
|
||||
exec - if ! cmp -s sum.h ${PACKAGE_ast_INCLUDE}/sum.h
|
||||
exec - then ${STDCP} sum.h ${PACKAGE_ast_INCLUDE}/sum.h
|
||||
exec - fi
|
||||
done ${PACKAGE_ast_INCLUDE}/sum.h generated
|
||||
done install virtual
|
||||
|
|
Loading…
Reference in a new issue