From 14e7096982b27fddd3c098dc09444b44bbed9cef Mon Sep 17 00:00:00 2001 From: Bart Schaefer Date: Mon, 16 Mar 2009 05:20:36 +0000 Subject: users/13937, users/13939: configure.ac, Src/jobs.c: check for and if available use setproctitle() for "jobs -Z". --- Src/jobs.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'Src') diff --git a/Src/jobs.c b/Src/jobs.c index 666d90966..df1787b79 100644 --- a/Src/jobs.c +++ b/Src/jobs.c @@ -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; } -- cgit 1.4.1