mirror of
git://git.code.sf.net/p/cdesktopenv/code
synced 2025-03-09 15:50:02 +00:00
Fix various typos, man page issues and improve the documentation (#415)
This commit makes various different improvements to the documentation:
- sh.1: Backported (with changes) mandoc warning fixes from ksh2020
for the ksh93(1) man page: <https://github.com/att/ast/pull/1406>
- Removed unnecessary spaces at the end of lines to fix a few other
mandoc warnings.
- Fixed various typos and capitalization errors in the documentation.
- ANNOUNCE: Document the addition of the ${.sh.pid} variable
(re: 9de65210).
- libast/man/str*: Update the man pages for the libast str* functions
to improve how accurately each function is described.
- ksh93/README: Update regression test/compatibility notes to include
OpenBSD 7.0, FreeBSD 13.0 and WSL running Ubuntu 20.04.
- Change a few places to store the return value from strlen in a
size_t variable rather than signed int.
- comp/setlocale.c: To avoid confusion of two separate variables named
lang, the function local variable has been renamed to langidx.
This commit is contained in:
parent
d347ec0fc9
commit
ca5803419b
95 changed files with 313 additions and 390 deletions
|
|
@ -97,7 +97,7 @@ pid_t pid_fromstring(char *str)
|
|||
pid = (pid_t)strtol(str, &last, 10);
|
||||
if(errno==ERANGE || *last)
|
||||
{
|
||||
errormsg(SH_DICT,ERROR_exit(1),"%s: invalid process id",str);
|
||||
errormsg(SH_DICT,ERROR_exit(1),"%s: invalid process ID",str);
|
||||
UNREACHABLE();
|
||||
}
|
||||
return(pid);
|
||||
|
|
@ -299,7 +299,7 @@ int job_reap(register int sig)
|
|||
abort();
|
||||
}
|
||||
#ifdef DEBUG
|
||||
if(sfprintf(sfstderr,"ksh: job line %4d: reap pid=%d critical=%d signal=%d\n",__LINE__,sh.current_pid,job.in_critical,sig) <=0)
|
||||
if(sfprintf(sfstderr,"ksh: job line %4d: reap PID=%d critical=%d signal=%d\n",__LINE__,sh.current_pid,job.in_critical,sig) <=0)
|
||||
write(2,"waitsafe\n",9);
|
||||
sfsync(sfstderr);
|
||||
#endif /* DEBUG */
|
||||
|
|
@ -347,7 +347,7 @@ int job_reap(register int sig)
|
|||
if(!(pw=job_bypid(pid)))
|
||||
{
|
||||
#ifdef DEBUG
|
||||
sfprintf(sfstderr,"ksh: job line %4d: reap pid=%d critical=%d unknown job pid=%d pw=%x\n",__LINE__,sh.current_pid,job.in_critical,pid,pw);
|
||||
sfprintf(sfstderr,"ksh: job line %4d: reap PID=%d critical=%d unknown job PID=%d pw=%x\n",__LINE__,sh.current_pid,job.in_critical,pid,pw);
|
||||
#endif /* DEBUG */
|
||||
if (WIFCONTINUED(wstat) && wcontinued)
|
||||
continue;
|
||||
|
|
@ -452,7 +452,7 @@ int job_reap(register int sig)
|
|||
jp->exitval |= SH_EXITSIG;
|
||||
}
|
||||
#ifdef DEBUG
|
||||
sfprintf(sfstderr,"ksh: job line %4d: reap pid=%d critical=%d job %d with pid %d flags=%o complete with status=%x exit=%d\n",__LINE__,sh.current_pid,job.in_critical,pw->p_job,pid,pw->p_flag,wstat,pw->p_exit);
|
||||
sfprintf(sfstderr,"ksh: job line %4d: reap PID=%d critical=%d job %d with PID %d flags=%o complete with status=%x exit=%d\n",__LINE__,sh.current_pid,job.in_critical,pw->p_job,pid,pw->p_flag,wstat,pw->p_exit);
|
||||
sfsync(sfstderr);
|
||||
#endif /* DEBUG */
|
||||
/* only top-level process in job should have notify set */
|
||||
|
|
@ -890,7 +890,7 @@ int job_walk(Sfio_t *file,int (*fun)(struct process*,int),int arg,char *joblist[
|
|||
* list the given job
|
||||
* flag JOB_LFLAG for long listing
|
||||
* flag JOB_NFLAG for list only jobs marked for notification
|
||||
* flag JOB_PFLAG for process id(s) only
|
||||
* flag JOB_PFLAG for process ID(s) only
|
||||
*/
|
||||
|
||||
int job_list(struct process *pw,register int flag)
|
||||
|
|
@ -1203,7 +1203,7 @@ 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
|
||||
* if non-zero, <join> is the process ID of the job to join
|
||||
*/
|
||||
|
||||
int job_post(pid_t pid, pid_t join)
|
||||
|
|
@ -1287,7 +1287,7 @@ int job_post(pid_t pid, pid_t join)
|
|||
pw->p_fgrp = 0;
|
||||
pw->p_pgrp = pw->p_fgrp;
|
||||
#ifdef DEBUG
|
||||
sfprintf(sfstderr,"ksh: job line %4d: post pid=%d critical=%d job=%d pid=%d pgid=%d savesig=%d join=%d\n",__LINE__,sh.current_pid,job.in_critical,pw->p_job,
|
||||
sfprintf(sfstderr,"ksh: job line %4d: post PID=%d critical=%d job=%d PID=%d PGID=%d savesig=%d join=%d\n",__LINE__,sh.current_pid,job.in_critical,pw->p_job,
|
||||
pw->p_pid,pw->p_pgrp,job.savesig,join);
|
||||
sfsync(sfstderr);
|
||||
#endif /* DEBUG */
|
||||
|
|
@ -1328,7 +1328,7 @@ int job_post(pid_t pid, pid_t join)
|
|||
}
|
||||
|
||||
/*
|
||||
* Returns a process structure give a process id
|
||||
* Returns a process structure give a process ID
|
||||
*/
|
||||
|
||||
static struct process *job_bypid(pid_t pid)
|
||||
|
|
@ -1344,7 +1344,7 @@ static struct process *job_bypid(pid_t pid)
|
|||
}
|
||||
|
||||
/*
|
||||
* return a pointer to a job given the job id
|
||||
* return a pointer to a job given the job ID
|
||||
*/
|
||||
|
||||
static struct process *job_byjid(int jobid)
|
||||
|
|
@ -1380,7 +1380,7 @@ static void job_prmsg(register struct process *pw)
|
|||
}
|
||||
|
||||
/*
|
||||
* Wait for process pid to complete
|
||||
* Wait for process to complete
|
||||
* If pid < -1, then wait can be interrupted, -pid is waited for (wait builtin)
|
||||
* pid=0 to unpost all done processes
|
||||
* pid=1 to wait for at least one process to complete
|
||||
|
|
@ -1438,9 +1438,9 @@ int job_wait(register pid_t pid)
|
|||
}
|
||||
pwfg = pw;
|
||||
#ifdef DEBUG
|
||||
sfprintf(sfstderr,"ksh: job line %4d: wait pid=%d critical=%d job=%d pid=%d\n",__LINE__,sh.current_pid,job.in_critical,jobid,pid);
|
||||
sfprintf(sfstderr,"ksh: job line %4d: wait PID=%d critical=%d job=%d PID=%d\n",__LINE__,sh.current_pid,job.in_critical,jobid,pid);
|
||||
if(pw)
|
||||
sfprintf(sfstderr,"ksh: job line %4d: wait pid=%d critical=%d flags=%o\n",__LINE__,sh.current_pid,job.in_critical,pw->p_flag);
|
||||
sfprintf(sfstderr,"ksh: job line %4d: wait PID=%d critical=%d flags=%o\n",__LINE__,sh.current_pid,job.in_critical,pw->p_flag);
|
||||
#endif /* DEBUG */
|
||||
errno = 0;
|
||||
if(sh.coutpipe>=0 && lastpid && sh.cpid==lastpid)
|
||||
|
|
@ -1695,7 +1695,7 @@ static struct process *job_unpost(register struct process *pwtop,int notify)
|
|||
register struct process *pw;
|
||||
/* make sure all processes are done */
|
||||
#ifdef DEBUG
|
||||
sfprintf(sfstderr,"ksh: job line %4d: drop pid=%d critical=%d pid=%d env=%u\n",__LINE__,sh.current_pid,job.in_critical,pwtop->p_pid,pwtop->p_env);
|
||||
sfprintf(sfstderr,"ksh: job line %4d: drop PID=%d critical=%d PID=%d env=%u\n",__LINE__,sh.current_pid,job.in_critical,pwtop->p_pid,pwtop->p_env);
|
||||
sfsync(sfstderr);
|
||||
#endif /* DEBUG */
|
||||
pwtop = pw = job_byjid((int)pwtop->p_job);
|
||||
|
|
@ -1736,7 +1736,7 @@ static struct process *job_unpost(register struct process *pwtop,int notify)
|
|||
}
|
||||
pwtop->p_pid = 0;
|
||||
#ifdef DEBUG
|
||||
sfprintf(sfstderr,"ksh: job line %4d: free pid=%d critical=%d job=%d\n",__LINE__,sh.current_pid,job.in_critical,pwtop->p_job);
|
||||
sfprintf(sfstderr,"ksh: job line %4d: free PID=%d critical=%d job=%d\n",__LINE__,sh.current_pid,job.in_critical,pwtop->p_job);
|
||||
sfsync(sfstderr);
|
||||
#endif /* DEBUG */
|
||||
job_free((int)pwtop->p_job);
|
||||
|
|
@ -1939,7 +1939,7 @@ int sh_waitsafe(void)
|
|||
void job_fork(pid_t parent)
|
||||
{
|
||||
#ifdef DEBUG
|
||||
sfprintf(sfstderr,"ksh: job line %4d: fork pid=%d critical=%d parent=%d\n",__LINE__,sh.current_pid,job.in_critical,parent);
|
||||
sfprintf(sfstderr,"ksh: job line %4d: fork PID=%d critical=%d parent=%d\n",__LINE__,sh.current_pid,job.in_critical,parent);
|
||||
#endif /* DEBUG */
|
||||
switch (parent)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -556,7 +556,7 @@ char *path_basename(register const char *name)
|
|||
|
||||
char *path_fullname(const char *name)
|
||||
{
|
||||
int len=strlen(name)+1,dirlen=0;
|
||||
size_t len=strlen(name)+1,dirlen=0;
|
||||
char *path,*pwd;
|
||||
if(*name!='/')
|
||||
{
|
||||
|
|
@ -1356,7 +1356,7 @@ static noreturn void exscript(register char *path,register char *argv[],char **e
|
|||
if((euserid=geteuid()) != sh.userid)
|
||||
{
|
||||
strncpy(name+9,fmtbase((long)sh.current_pid,10,0),sizeof(name)-10);
|
||||
/* create a suid open file with owner equal effective uid */
|
||||
/* create an SUID open file with owner equal to effective UID */
|
||||
if((n=open(name,O_CREAT|O_TRUNC|O_WRONLY,S_ISUID|S_IXUSR)) < 0)
|
||||
goto fail;
|
||||
unlink(name);
|
||||
|
|
|
|||
|
|
@ -76,7 +76,7 @@ static struct subshell
|
|||
Dt_t *strack;/* tracked alias scope for subshell */
|
||||
Pathcomp_t *pathlist; /* for PATH variable */
|
||||
Shopt_t options;/* save shell options */
|
||||
pid_t subpid; /* child process id */
|
||||
pid_t subpid; /* child process ID */
|
||||
Sfio_t* saveout;/* saved standard output */
|
||||
char *pwd; /* present working directory */
|
||||
void *jobs; /* save job info */
|
||||
|
|
|
|||
|
|
@ -19,9 +19,9 @@
|
|||
* *
|
||||
***********************************************************************/
|
||||
/*
|
||||
* This is a program to execute 'execute only' and suid/sgid shell scripts.
|
||||
* This program must be owned by root and must have the set uid bit set.
|
||||
* It must not have the set group id bit set. This program must be installed
|
||||
* This is a program to execute 'execute only' and SUID/SGID shell scripts.
|
||||
* This program must be owned by root and must have the setuid bit set.
|
||||
* It must not have the set group ID bit set. This program must be installed
|
||||
* where the define parameter THISPROG indicates to work correctly on System V.
|
||||
*
|
||||
* Written by David Korn
|
||||
|
|
@ -32,14 +32,14 @@
|
|||
/* The file name of the script to execute is argv[0]
|
||||
* argv[1] is the program name
|
||||
* The basic idea is to open the script as standard input, set the effective
|
||||
* user and group id correctly, and then exec the shell.
|
||||
* The complicated part is getting the effective uid of the caller and
|
||||
* setting the effective uid/gid. The program which execs this program
|
||||
* user and group ID correctly, and then exec the shell.
|
||||
* The complicated part is getting the effective UID of the caller and
|
||||
* setting the effective UID/GID. The program which execs this program
|
||||
* may pass file descriptor FDIN as an open file with mode SPECIAL if
|
||||
* the effective user id is not the real user id. The effective
|
||||
* user id for authentication purposes will be the owner of this
|
||||
* the effective user ID is not the real user ID. The effective
|
||||
* user ID for authentication purposes will be the owner of this
|
||||
* open file. On systems without the setreuid() call, e[ug]id is set
|
||||
* by copying this program to a /tmp/file, making it a suid and/or sgid
|
||||
* by copying this program to a /tmp/file, making it an SUID and/or SGID
|
||||
* program, and then execing this program.
|
||||
* A forked version of this program waits until it can unlink the /tmp
|
||||
* file and then exits. Actually, we fork() twice so the parent can
|
||||
|
|
@ -207,7 +207,7 @@ int main(int argc,char *argv[])
|
|||
error_exit(badexec);
|
||||
close(n);
|
||||
|
||||
/* compute the desired new effective user and group id */
|
||||
/* compute the desired new effective user and group ID */
|
||||
effuid = euserid;
|
||||
effgid = egroupid;
|
||||
mode = 0;
|
||||
|
|
@ -221,7 +221,7 @@ int main(int argc,char *argv[])
|
|||
if(effgid != rgroupid || setgid(rgroupid) < 0)
|
||||
mode = S_ISGID;
|
||||
|
||||
/* now see if the uid needs setting */
|
||||
/* now see if the UID needs setting */
|
||||
if(mode)
|
||||
{
|
||||
if(effuid != ruserid)
|
||||
|
|
@ -296,7 +296,7 @@ static void error_exit(const char *message)
|
|||
|
||||
|
||||
/*
|
||||
* This version of access checks against effective uid and effective gid
|
||||
* This version of access checks against effective UID and effective GID
|
||||
*/
|
||||
|
||||
int eaccess(register const char *name, register int mode)
|
||||
|
|
@ -360,7 +360,7 @@ static void setids(int mode,int owner,int group)
|
|||
if(mode & S_ISGID)
|
||||
setregid(rgroupid,group);
|
||||
|
||||
/* set effective uid even if S_ISUID is not set. This is because
|
||||
/* set effective UID even if S_ISUID is not set. This is because
|
||||
* we are *really* executing EUID root at this point. Even if S_ISUID
|
||||
* is not set, the value for owner that is passed should be correct.
|
||||
*/
|
||||
|
|
@ -370,7 +370,7 @@ static void setids(int mode,int owner,int group)
|
|||
#else
|
||||
/*
|
||||
* This version of setids creates a /tmp file and copies itself into it.
|
||||
* The "clone" file is made executable with appropriate suid/sgid bits.
|
||||
* The "clone" file is made executable with appropriate SUID/SGID bits.
|
||||
* Finally, the clone is exec'd. This file is unlinked by a grandchild
|
||||
* of this program, who waits around until the text is free.
|
||||
*/
|
||||
|
|
@ -383,7 +383,7 @@ static void setids(int mode,uid_t owner,gid_t group)
|
|||
/*
|
||||
* Create a token to pass to the new program for validation.
|
||||
* This token can only be procured by someone running with an
|
||||
* effective userid of root, and hence gives the clone a way to
|
||||
* effective user ID of root, and hence gives the clone a way to
|
||||
* certify that it was really invoked by THISPROG. Someone who
|
||||
* is already root could spoof us, but why would they want to?
|
||||
*
|
||||
|
|
@ -492,7 +492,7 @@ static void maketemp(char *template)
|
|||
register pid_t n = getpid();
|
||||
/* skip to end of string */
|
||||
while(*++cp);
|
||||
/* convert process id to string */
|
||||
/* convert process ID to string */
|
||||
while(n > 0)
|
||||
{
|
||||
*--cp = (n%10) + '0';
|
||||
|
|
|
|||
|
|
@ -2902,7 +2902,7 @@ pid_t _sh_fork(register pid_t parent,int flags,int *jobid)
|
|||
{
|
||||
/*
|
||||
* errno==EPERM means that an earlier processes
|
||||
* completed. Make parent the job group id.
|
||||
* completed. Make parent the job group ID.
|
||||
*/
|
||||
if(postid==0)
|
||||
job.curpgid = parent;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue