2006-08-10 Joel Sherrill <joel@oarcorp.com>

* 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.
This commit is contained in:
Joel Sherrill
2006-08-10 14:05:57 +00:00
parent f77424ea92
commit aeb5ffba57
2 changed files with 37 additions and 3 deletions

View File

@@ -0,0 +1,8 @@
2006-08-10 Joel Sherrill <joel@oarcorp.com>
* 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.

View File

@@ -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)
{