Permalink
Browse files

Generated options list for --help output

  • Loading branch information...
1 parent a299f19 commit f5e73852c578d3babfc9b9dd839169b2a5e021a1 ec429 committed Apr 6, 2011
Showing with 37 additions and 2 deletions.
  1. +1 −1 Makefile
  2. +2 −0 config.c
  3. +2 −0 config_help.c
  4. +31 −0 genconfig.c
  5. +1 −1 text.h
View
@@ -60,7 +60,7 @@ buffer.h: config.h version.h
config.o: config.c config.h names.h bits.h colour.h text.h version.h
-config.c: config_check.c config_def.c config_need.c config_rcread.c config_pargs.c
+config.c: config_check.c config_def.c config_need.c config_rcread.c config_pargs.c config_help.c
touch config.c
config.h: config_globals.h version.h
View
@@ -304,6 +304,8 @@ signed int pargs(int argc, char *argv[])
if((strcmp(argv[arg], "--help")==0)||(strcmp(argv[arg], "-h")==0))
{
fprintf(stderr, USAGE_MSG);
+ fprintf(stderr, "options:\n");
+#include "config_help.c"
return(0);
}
else if((strcmp(argv[arg], "--version")==0)||(strcmp(argv[arg], "-V")==0)||(strcmp(argv[arg], "-v")==0)) // allow -v as we did in old versions; depr
View
@@ -0,0 +1,2 @@
+/* Generated by genconfig */
+ fprintf(stderr, "\t--width=<numeric> : display width\n"); fprintf(stderr, "\t--height=<numeric> : display height\n"); fprintf(stderr, "\t--mcc=<0 to 2> : mirc colour compatibility\n"); fprintf(stderr, "\t--fred=<0 to 3> : force-redraw\n"); fprintf(stderr, "\t--buf-lines=<numeric> : buffer lines\n"); fprintf(stderr, "\t--maxnicklen=<numeric> : max nick length\n"); fprintf(stderr, "\t--[no-]fwc : full width colour\n"); fprintf(stderr, "\t--[no-]hts : highlight tabstrip\n"); fprintf(stderr, "\t--[no-]tsb : top status bar\n"); fprintf(stderr, "\t--tping=<numeric> : outbound ping time\n"); fprintf(stderr, "\t--timestamps=<0 to 4> : timestamping\n"); fprintf(stderr, "\t--[no-]utc : UTC timestamps\n");
View
@@ -54,6 +54,8 @@ int main(int argc, char **argv)
otype=5;
else if(strcmp(argv[1], "config_need.c")==0)
otype=6;
+ else if(strcmp(argv[1], "config_help.c")==0)
+ otype=7;
else
{
fprintf(stderr, "genconfig: unrecognised outtype '%s'\n", argv[1]);
@@ -450,6 +452,35 @@ int main(int argc, char **argv)
if((ents[i].set_type==BOOLEAN)||(ents[i].set_type==LEVEL))
printf("\t\t\tif(strcmp(cmd, \"no-%s\")==0) need=false;\n", ents[i].rc_name);
break;
+ case 7:
+ if(ents[i].cmdline_name)
+ {
+ int j;
+ switch(ents[i].type)
+ {
+ case BOOL:
+ printf("\t\t\tfprintf(stderr, \"\\t--[no-]%s", ents[i].cmdline_name);
+ for(j=strlen(ents[i].cmdline_name);j<25;j++)
+ putchar(' ');
+ break;
+ case INT:
+ if((ents[i].min!=-1)&&(ents[i].max!=-1))
+ {
+ printf("\t\t\tfprintf(stderr, \"\\t--%s=<%d to %d>", ents[i].cmdline_name, ents[i].min, ents[i].max);
+ for(j=strlen(ents[i].cmdline_name);j<21;j++)
+ putchar(' ');
+ }
+ else
+ {
+ printf("\t\t\tfprintf(stderr, \"\\t--%s=<numeric>", ents[i].cmdline_name);
+ for(j=strlen(ents[i].cmdline_name);j<20;j++)
+ putchar(' ');
+ }
+ break;
+ }
+ printf(": %s\\n\");", ents[i].set_msg);
+ }
+ break;
default:
fprintf(stderr, "genconfig: otype %d not implemented!\n", otype);
return(EXIT_FAILURE);
View
2 text.h
@@ -17,4 +17,4 @@
There is NO WARRANTY, to the extent permitted by law.\n\
Compiler was %s\n", "quirc", VERSION_MAJ, VERSION_MIN, VERSION_REV, VERSION_TXT[0]?"-":"", VERSION_TXT, CC_VERSION
-#define USAGE_MSG "quirc [--width=<cols>] [--height=<rows>] [--maxnicklen=<mnln>] [--mcc=<mcc>]\n\t[--force-redraw=<fred>] [--no-server] [--no-chan] [--check]\n\t[--server=<server>] [--uname=<uname>] [--fname=<fname>] [--nick=<nick>]\n\t[--chan=<chan>] [--port=<port>] [--[no-]fwc] [--[no-]hts] [--[no-]tsb]\nquirc {-h|--help|-V|--version}\n"
+#define USAGE_MSG "quirc [--no-server] [--no-chan] [--check] [--server=<server>] [--uname=<uname>]\n [--fname=<fname>] [--nick=<nick>] [--chan=<chan>] [--port=<port>] [options]\nquirc {-h|--help|-V|--version}\n"

0 comments on commit f5e7385

Please sign in to comment.