Return-Path: Mailing-List: contact tomcat-dev-help@jakarta.apache.org; run by ezmlm Delivered-To: mailing list tomcat-dev@jakarta.apache.org Received: (qmail 23850 invoked from network); 24 Nov 2000 17:49:05 -0000 Received: from mailrelay1.alcatel.de (194.113.59.75) by locus.apache.org with SMTP; 24 Nov 2000 17:49:05 -0000 Received: from slbh00.bln.sel.alcatel.de by mailrelay1.alcatel.de with SMTP (XT-PP); Fri, 24 Nov 2000 18:48:28 +0100 Received: from alcatel.de (slbpqb [149.204.63.9]) by slbh00.bln.sel.alcatel.de (8.9.3/8.9.3) with ESMTP id SAA18963 for ; Fri, 24 Nov 2000 18:48:28 +0100 (MET) Message-ID: <3A1EAA9A.4DE61219@alcatel.de> Date: Fri, 24 Nov 2000 18:51:22 +0100 From: Ralf Suckow Organization: Alcatel X-Mailer: Mozilla 4.7 [en] (WinNT; I) X-Accept-Language: en MIME-Version: 1.0 To: tomcat-dev@jakarta.apache.org Subject: tomcat usage output missing/written twice Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Spam-Rating: locus.apache.org 1.6.2 0/1000/N Hello, I've just submitted the following problem/solution to BugRat as Report number 429. This is my first jakarta bug report, so I'm taking advice from the web page to also send it to the mailing list. Hope that helps and does not annoy too much, the submitted bug is a minor problem ;-) Yours, Ralf Bug Report 429: tomcat usage output missing/written twice The startup class does not write a usage beyond "usage:" This makes it difficult to learn about the (very useful) options. Also, if the -help option is used, the usage is printed twice, second time with "Wrong arguments", which is wrong :-) Finally, tomcat is not checking for invalid arguments. To fix this, I did the following: In .../src/share/apache/tomcat/startup/LocalStrings.properties replaced the line tomcat.usage=usage: by tomcat.usage=usage: java org.apache.tomcat.startup.Tomcat options\n\ options are:\n\ \t-help shows this help\n\ \thelp same as -help\n\ \t-stop shutdown tomcat\n\ \t-f file use given file instead of /conf/server.xml\n\ \t-config file same as -f file\n\ \t-h dir use given directory instead of \n\ \t-home dir same as -h dir\n This has been tested with tomcat 3.1 by repackaging the jar and seems to work. In .../src/share/apache/tomcat/startup/Tomcat.java changed two methods (NOT TESTED - I did never build tomcat): public void execute(String args[] ) throws Exception { if( ! processArgs( args ) ) { // 2 Lines Commented out because already done in processArgs: // System.out.println(sm.getString("tomcat.wrongargs")); // printUsage(); return; } public boolean processArgs(String[] args) { for (int i = 0; i < args.length; i++) { String arg = args[i]; if (arg.equals("-help") || arg.equals("help")) { printUsage(); return false; } else if (arg.equals("-stop")) { doStop=true; } else if (arg.equals("-f") || arg.equals("-config")) { i++; if( i < args.length ) configFile = args[i]; } else if (arg.equals("-h") || arg.equals("-home")) { i++; if (i < args.length) System.getProperties().put("tomcat.home", args[i]); // added the following three lines } else { // do not allow for bad options printUsage(); return false; } } return true; } Yours, Ralf