From aeb5ffba573df022598b5a9cbdbe08f0ed7f9b8a Mon Sep 17 00:00:00 2001 From: Joel Sherrill Date: Thu, 10 Aug 2006 14:05:57 +0000 Subject: 2006-08-10 Joel Sherrill * nios2gen.c: Added some very basic support for --help and --version options along with output that is roughly in GNU format. This is required by help2man. help2man expects this all to be written to stdout instead of stderr so this was changed as well. * ChangeLog: New file. --- tools/cpu/nios2/nios2gen.c | 32 +++++++++++++++++++++++++++++--- 1 file changed, 29 insertions(+), 3 deletions(-) (limited to 'tools/cpu/nios2/nios2gen.c') diff --git a/tools/cpu/nios2/nios2gen.c b/tools/cpu/nios2/nios2gen.c index ad9631f5a8..fb271735ca 100644 --- a/tools/cpu/nios2/nios2gen.c +++ b/tools/cpu/nios2/nios2gen.c @@ -66,9 +66,25 @@ void read_include_file(struct ptf_item *pi, void *arg) void usage() { - fprintf(stderr, -"Please specify the name of a nios2gen PTF file that describes where to\n" -"find the system description PTF from SOPC Builder on the command line.\n"); +printf( + "Usage: nios2gen [PTFFILE]\n" + "Generate BSP data based upon PTF file from SOPC Builder.\n" + "\n" + "Please specify the name of a nios2gen PTF file that describes where to\n" + "find the system description PTF from SOPC Builder on the command line.\n" +); +} + +void version() +{ +printf( + "RTEMS/NIOS nios2gen\n" + " Copyright (c) 2006 Kolja Waschk rtemsdev/ixo.de\n" + "\n" + " The license and distribution terms for this file may be\n" + " found in the file LICENSE in this distribution or at\n" + " http://www.rtems.com/license/LICENSE.\n" +); } /********************************************************/ @@ -87,6 +103,16 @@ int main(int argc, char *argv[]) return -1; }; + if ( !strcmp(argv[1], "--help") || !strcmp(argv[1],"-?") ) { + usage(); + return 0; + }; + + if ( !strcmp(argv[1], "--version") ) { + version(); + return 0; + }; + cfg = ptf_parse_file(argv[1]); if(cfg == NULL) { -- cgit v1.2.3