From owner-freebsd-bugs Tue Jun 12 15:50:11 2001 Delivered-To: freebsd-bugs@hub.freebsd.org Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by hub.freebsd.org (Postfix) with ESMTP id 2286137B40A for ; Tue, 12 Jun 2001 15:50:01 -0700 (PDT) (envelope-from gnats@FreeBSD.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.11.3/8.11.3) id f5CMo1k72332; Tue, 12 Jun 2001 15:50:01 -0700 (PDT) (envelope-from gnats) Received: from whistle.com (s204m90.isp.whistle.com [207.76.204.90]) by hub.freebsd.org (Postfix) with ESMTP id 3FCED37B401 for ; Tue, 12 Jun 2001 15:41:34 -0700 (PDT) (envelope-from mark@whistle.com) Received: (from mark@localhost) by whistle.com (8.11.3/8.11.3) id f5CMfYD10147; Tue, 12 Jun 2001 15:41:34 -0700 (PDT) (envelope-from mark) Message-Id: <200106122241.f5CMfYD10147@whistle.com> Date: Tue, 12 Jun 2001 15:41:34 -0700 (PDT) From: mark@whistle.com Reply-To: mark@whistle.com To: FreeBSD-gnats-submit@freebsd.org X-Send-Pr-Version: 3.113 Subject: bin/28109: [PATCH] Add "kill -s" to tcsh builtin for doc and POSIX compatibility Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org >Number: 28109 >Category: bin >Synopsis: [PATCH] Add "kill -s" to tcsh builtin for doc and POSIX compatibility >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Tue Jun 12 15:50:00 PDT 2001 >Closed-Date: >Last-Modified: >Originator: Mark Peek >Release: FreeBSD 4.3-RELEASE i386 >Organization: Whistle Communications, Inc. >Environment: System: FreeBSD shark.whistle.com 4.3-RELEASE FreeBSD 4.3-RELEASE #5: Mon May 7 11:42:59 PDT 2001 root@shark.whistle.com:/usr/obj/usr/src/sys/INTELLISTATION_SMP i386 >Description: Several man pages (such as mountd and exports) contain instructions to use "kill -s HUP" to invoke behaviors within the commands. However, the "-s" option is not implemented in the default tcsh shell builtin kill. This can lead to users scratching their heads when they get an error message: "s: Unknown signal; kill -l lists signals." >How-To-Repeat: /bin/tcsh -c "kill -s HUP 1" >Fix: This can be fixed a variety of ways: 1. Change the documentation to use the obsolete "kill -HUP" or the non-builtin "/bin/kill -HUP". 2. Apply the patch below to add "kill -s" to the tcsh command 3. Wait for the next version of tcsh to become available that (hopefully) will have the patch below contributed (I sent it to the tcsh mailing list). I don't believe #1 should be done since that moves us backwards instead of forwards. I'd like to see #2 but this might require moving this file off the vendor branch. I'm just not sure about #3, since it would require the patch to be applied to the tcsh source base and I'm unclear when the next tcsh release will be available. -------- Index: contrib/tcsh/sh.proc.c =================================================================== RCS file: /home/ncvs/src/contrib/tcsh/sh.proc.c,v retrieving revision 1.1.1.1.2.2 diff -u -r1.1.1.1.2.2 sh.proc.c --- contrib/tcsh/sh.proc.c 2001/03/05 05:50:09 1.1.1.1.2.2 +++ contrib/tcsh/sh.proc.c 2001/06/12 22:20:36 @@ -1524,6 +1524,7 @@ { register int signum, len = 0; register char *name; + Char *sigptr; extern int T_Cols; extern int nsig; @@ -1544,17 +1545,26 @@ xputchar('\n'); return; } - if (Isdigit(v[0][1])) { - signum = atoi(short2str(v[0] + 1)); + sigptr = &v[0][1]; + if (v[0][1] == 's') { + if (v[1]) { + v++; + sigptr = &v[0][0]; + } else { + stderror(ERR_NAME | ERR_TOOFEW); + } + } + if (Isdigit(*sigptr)) { + signum = atoi(short2str(sigptr)); if (signum < 0 || signum > (MAXSIG-1)) stderror(ERR_NAME | ERR_BADSIG); } else { for (signum = 0; signum <= nsig; signum++) if (mesg[signum].iname && - eq(&v[0][1], str2short(mesg[signum].iname))) + eq(sigptr, str2short(mesg[signum].iname))) goto gotsig; - setname(short2str(&v[0][1])); + setname(short2str(sigptr)); stderror(ERR_NAME | ERR_UNKSIG); } gotsig: Index: contrib/tcsh/tcsh.man =================================================================== RCS file: /home/ncvs/src/contrib/tcsh/tcsh.man,v retrieving revision 1.1.1.3.2.2 diff -u -r1.1.1.3.2.2 tcsh.man --- contrib/tcsh/tcsh.man 2001/03/05 05:50:10 1.1.1.3.2.2 +++ contrib/tcsh/tcsh.man 2001/06/12 22:20:37 @@ -2851,8 +2851,11 @@ .B kill \fR[\fB\-\fIsignal\fR] \fB%\fIjob\fR|\fIpid\fR ... .PD 0 .TP 8 +.B kill \fR[\fB\-s \fIsignal\fR] \fB%\fIjob\fR|\fIpid\fR ... +.TP 8 .B kill \-l -The first form sends the specified \fIsignal\fR (or, if none is given, +The first and second forms sends the specified \fIsignal\fR (or, if none +is given, the TERM (terminate) signal) to the specified jobs or processes. \fIjob\fR may be a number, a string, `', `%', `+' or `\-' as described under \fBJobs\fR. @@ -2862,7 +2865,7 @@ to the current job. If the signal being sent is TERM (terminate) or HUP (hangup), then the job or process is sent a CONT (continue) signal as well. -The second form lists the signal names. +The third form lists the signal names. .PD .ig \" Obsolete tcsh command .TP 8 >Release-Note: >Audit-Trail: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message