about summary refs log tree commit diff
path: root/Src
diff options
context:
space:
mode:
authorBart Schaefer <barts@users.sourceforge.net>2009-03-16 05:20:36 +0000
committerBart Schaefer <barts@users.sourceforge.net>2009-03-16 05:20:36 +0000
commit14e7096982b27fddd3c098dc09444b44bbed9cef (patch)
treec38365531c4cab3760aff0741aec7e3889a00a89 /Src
parent7733ade831f01a00b93e88312c433dbc3d2cdaa2 (diff)
downloadzsh-14e7096982b27fddd3c098dc09444b44bbed9cef.tar.gz
zsh-14e7096982b27fddd3c098dc09444b44bbed9cef.tar.xz
zsh-14e7096982b27fddd3c098dc09444b44bbed9cef.zip
users/13937, users/13939: configure.ac, Src/jobs.c: check for
and if available use setproctitle() for "jobs -Z".
Diffstat (limited to 'Src')
-rw-r--r--Src/jobs.c8
1 files changed, 8 insertions, 0 deletions
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;
     }