From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Tom Tromey Newsgroups: gmane.emacs.bugs Subject: emacsclient --help output Date: 11 Mar 2003 14:33:49 -0700 Sender: bug-gnu-emacs-bounces+gnu-bug-gnu-emacs=m.gmane.org@gnu.org Message-ID: <87el5degg2.fsf@fleche.redhat.com> Reply-To: tromey@redhat.com NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: main.gmane.org 1047419167 26214 80.91.224.249 (11 Mar 2003 21:46:07 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Tue, 11 Mar 2003 21:46:07 +0000 (UTC) Original-X-From: bug-gnu-emacs-bounces+gnu-bug-gnu-emacs=m.gmane.org@gnu.org Tue Mar 11 22:46:03 2003 Return-path: Original-Received: from monty-python.gnu.org ([199.232.76.173]) by main.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 18srZA-0006nS-00 for ; Tue, 11 Mar 2003 22:45:45 +0100 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.10.13) id 18srZ9-0002CK-07 for gnu-bug-gnu-emacs@m.gmane.org; Tue, 11 Mar 2003 16:45:43 -0500 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.10.13) id 18srYH-0001XT-00 for bug-gnu-emacs@gnu.org; Tue, 11 Mar 2003 16:44:49 -0500 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.10.13) id 18srXo-0001Fz-00 for bug-gnu-emacs@gnu.org; Tue, 11 Mar 2003 16:44:21 -0500 Original-Received: from mail.peakpeak.com ([207.174.178.17] helo=gash2.peakpeak.com) by monty-python.gnu.org with esmtp (Exim 4.10.13) id 18srTx-0000Eh-00 for bug-gnu-emacs@gnu.org; Tue, 11 Mar 2003 16:40:21 -0500 Original-Received: from fleche.redhat.com (tf0021.peakpeak.com [204.144.239.21]) by gash2.peakpeak.com (8.9.3/8.9.3) with ESMTP id OAA09338; Tue, 11 Mar 2003 14:40:16 -0700 Original-Received: by fleche.redhat.com (Postfix, from userid 1000) id 96E514F8610; Tue, 11 Mar 2003 14:33:49 -0700 (MST) Original-To: bug-gnu-emacs@gnu.org X-Attribution: Tom X-Zippy: Three attractive BANK ROBBERS are discussing RELIGIOUS DIFFERENCES and MAKE-UP TECHNIQUE with them!! Original-Lines: 146 X-BeenThere: bug-gnu-emacs@gnu.org X-Mailman-Version: 2.1b5 Precedence: list List-Id: Bug reports for GNU Emacs, the Swiss army knife of text editors List-Help: List-Post: List-Subscribe: , List-Archive: List-Unsubscribe: , Errors-To: bug-gnu-emacs-bounces+gnu-bug-gnu-emacs=m.gmane.org@gnu.org Xref: main.gmane.org gmane.emacs.bugs:4595 X-Report-Spam: http://spam.gmane.org/gmane.emacs.bugs:4595 This bug report will be sent to the Free Software Foundation, not to your local site managers! Please write in English, because the Emacs maintainers do not have translators to read other languages for them. Your bug report will be posted to the bug-gnu-emacs@gnu.org mailing list, and to the gnu.emacs.bug news group. In GNU Emacs 21.2.1 (i386-redhat-linux-gnu, X toolkit, Xaw3d scroll bars) of 2002-04-08 on porky.devel.redhat.com configured using `configure i386-redhat-linux --prefix=/usr --exec-prefix=/usr --bindir=/usr/bin --sbindir=/usr/sbin --sysconfdir=/etc --datadir=/usr/share --includedir=/usr/include --libdir=/usr/lib --libexecdir=/usr/libexec --localstatedir=/var --sharedstatedir=/usr/com --mandir=/usr/share/man --infodir=/usr/share/info --with-gcc --with-pop --with-sound' Important settings: value of $LC_ALL: nil value of $LC_COLLATE: nil value of $LC_CTYPE: nil value of $LC_MESSAGES: nil value of $LC_MONETARY: nil value of $LC_NUMERIC: nil value of $LC_TIME: nil value of $LANG: en_US.iso885915 locale-coding-system: iso-latin-9 default-enable-multibyte-characters: nil Please describe exactly what actions triggered the bug and the precise symptoms of the bug: The appended patch cleans up emacsclient --help (and other) output in a few ways. * According to GNU coding standards, --help should print to stdout and exit successfully. Likewise --version. * It is a bit more typical not to print full --help output in response to an error. * It is a little easier to read (and more typical among GNU programs in my experience) the --help output if there are a couple blank lines. Recent input: C-n C-p C-p C-p C-e C-b C-n C-a C-o \ n \ C-x C-s C-u C-n C-u C-n C-n C-a C-o \ n \ C-x C-s C-c a C-a C-k C-k C-u C-p C-n C-e SPC SPC A d d e d SPC s o m e SPC v e r t i c a b l a n k SPC l i n e s SPC f o r SPC r e a d a b i l i t y . C-x C-s C-x s M-x r e p o r t - e m Recent messages: Saving file /home/tromey/private_html/todo.html... Wrote /home/tromey/private_html/todo.html Mark saved where search started Wrote /home/tromey/gnu/Emacs/emacs/lib-src/emacsclient.c [2 times] Mark saved where search started [2 times] Wrote /home/tromey/gnu/Emacs/emacs/lib-src/emacsclient.c [2 times] Saving file /home/tromey/gnu/Emacs/emacs/lib-src/ChangeLog... Wrote /home/tromey/gnu/Emacs/emacs/lib-src/ChangeLog (No files need saving) Loading emacsbug...done Tom 2003-03-11 Tom Tromey * emacsclient.c (print_help_and_exit): Print to stdout. Exit successfully. Added some blank lines for readability. (decode_options): Don't call print_help_and_exit in default case. Print version information to stdout. (main): Don't call print_help_and_exit. Index: emacsclient.c =================================================================== RCS file: /cvsroot/emacs/emacs/lib-src/emacsclient.c,v retrieving revision 1.56 diff -u -r1.56 emacsclient.c --- emacsclient.c 2 Dec 2002 20:57:42 -0000 1.56 +++ emacsclient.c 11 Mar 2003 21:37:42 -0000 @@ -1,5 +1,5 @@ /* Client process that communicates with GNU Emacs acting as server. - Copyright (C) 1986, 1987, 1994, 1999, 2000, 2001 + Copyright (C) 1986, 1987, 1994, 1999, 2000, 2001, 2003 Free Software Foundation, Inc. This file is part of GNU Emacs. @@ -122,13 +122,18 @@ break; case 'V': - fprintf (stderr, "emacsclient %s\n", VERSION); - exit (1); + printf ("emacsclient %s\n", VERSION); + exit (0); break; case 'H': - default: print_help_and_exit (); + break; + + default: + fprintf (stderr, "Try `%s --help' for more information\n", progname); + exit (1); + break; } } } @@ -136,10 +141,11 @@ void print_help_and_exit () { - fprintf (stderr, - "Usage: %s [OPTIONS] FILE...\n\ + printf ( + "Usage: %s [OPTIONS] FILE...\n\ Tell the Emacs server to visit the specified files.\n\ Every FILE can be either just a FILENAME or [+LINE[:COLUMN]] FILENAME.\n\ +\n\ The following OPTIONS are accepted:\n\ -V, --version Just print a version info and return\n\ -H, --help Print this usage information message\n\ @@ -148,8 +154,9 @@ -d, --display=DISPLAY Visit the file in the given display\n\ -a, --alternate-editor=EDITOR\n\ Editor to fallback to if the server is not running\n\ +\n\ Report bugs to bug-gnu-emacs@gnu.org.\n", progname); - exit (1); + exit (0); } /* Return a copy of NAME, inserting a & @@ -294,7 +301,11 @@ decode_options (argc, argv); if (argc - optind < 1) - print_help_and_exit (); + { + fprintf (stderr, "%s: file name or argument required\n", progname); + fprintf (stderr, "Try `%s --help' for more information\n", progname); + exit (1); + } /* * Open up an AF_UNIX socket in this person's home directory