1
0
Fork 0
mirror of git://git.code.sf.net/p/zsh/code synced 2025-01-19 11:31:26 +01:00

users/13937, users/13939: configure.ac, Src/jobs.c: check for

and if available use setproctitle() for "jobs -Z".
This commit is contained in:
Bart Schaefer 2009-03-16 05:20:36 +00:00
parent 7733ade831
commit 14e7096982
3 changed files with 20 additions and 1 deletions

View file

@ -1,3 +1,8 @@
2009-03-15 Barton E. Schaefer <schaefer@zsh.org>
* users/13937, users/13939: configure.ac, Src/jobs.c: check for
and if available use setproctitle() for "jobs -Z".
2009-03-15 Peter Stephenson <p.w.stephenson@ntlworld.com>
* 26736: Doc/Zsh/expn.yo: document 26731.
@ -11416,5 +11421,5 @@
*****************************************************
* This is used by the shell to define $ZSH_PATCHLEVEL
* $Revision: 1.4618 $
* $Revision: 1.4619 $
*****************************************************

View file

@ -1572,12 +1572,14 @@ getjob(const char *s, const char *prog)
return returnval;
}
#ifndef HAVE_SETPROCTITLE
/* For jobs -Z (which modifies the shell's name as seen in ps listings). *
* hackzero is the start of the safely writable space, and hackspace is *
* its length, excluding a final NUL terminator that will always be left. */
static char *hackzero;
static int hackspace;
#endif
/* Initialise job handling. */
@ -1600,6 +1602,7 @@ init_jobs(char **argv, char **envp)
jobtabsize = MAXJOBS_ALLOC;
memset(jobtab, 0, init_bytes);
#ifndef HAVE_SETPROCTITLE
/*
* Initialise the jobs -Z system. The technique is borrowed from
* perl: check through the argument and environment space, to see
@ -1622,6 +1625,7 @@ init_jobs(char **argv, char **envp)
}
done:
hackspace = p - hackzero;
#endif
}
@ -1718,10 +1722,14 @@ bin_fg(char *name, char **argv, Options ops, int func)
}
queue_signals();
unmetafy(*argv, &len);
#ifdef HAVE_SETPROCTITLE
setproctitle("%s", *argv);
#else
if(len > hackspace)
len = hackspace;
memcpy(hackzero, *argv, len);
memset(hackzero + len, 0, hackspace - len);
#endif
unqueue_signals();
return 0;
}

View file

@ -1885,6 +1885,12 @@ if test x$zsh_cv_use_getcwd = xyes; then
AC_DEFINE(USE_GETCWD)
fi
dnl CHECK FOR setproctitle() FOR jobs -Z / ARGV0
AH_TEMPLATE([HAVE_SETPROCTITLE],
[Define to 1 if the system supports `setproctitle' to change process name])
AC_CHECK_FUNC(setproctitle,AC_DEFINE(HAVE_SETPROCTITLE),
AC_SEARCH_LIBS(setproctitle,util,AC_DEFINE(HAVE_SETPROCTITLE)))
dnl -------------
dnl CHECK FOR NIS
dnl -------------