mirror of
https://github.com/ascii-boxes/boxes.git
synced 2025-01-08 06:58:49 +01:00
Add undocumented option -q, use it for -l
This commit is contained in:
parent
b39076ea19
commit
25b9e7ac58
23
src/boxes.c
23
src/boxes.c
@ -124,6 +124,7 @@ static void usage (FILE *st)
|
|||||||
fprintf (st, " -l list available box designs w/ samples\n");
|
fprintf (st, " -l list available box designs w/ samples\n");
|
||||||
fprintf (st, " -m mend box, i.e. remove it and redraw it afterwards\n");
|
fprintf (st, " -m mend box, i.e. remove it and redraw it afterwards\n");
|
||||||
fprintf (st, " -p fmt padding [default: none]\n");
|
fprintf (st, " -p fmt padding [default: none]\n");
|
||||||
|
//fprintf (st, " -q modify command for needs of the web UI (undocumented)\n");
|
||||||
fprintf (st, " -r remove box\n");
|
fprintf (st, " -r remove box\n");
|
||||||
fprintf (st, " -s wxh box size (width w and/or height h)\n");
|
fprintf (st, " -s wxh box size (width w and/or height h)\n");
|
||||||
fprintf (st, " -t str tab stop distance and expansion [default: %de]\n", DEF_TABSTOP);
|
fprintf (st, " -t str tab stop distance and expansion [default: %de]\n", DEF_TABSTOP);
|
||||||
@ -404,7 +405,7 @@ static int process_commandline (int argc, char *argv[])
|
|||||||
* Parse Command Line
|
* Parse Command Line
|
||||||
*/
|
*/
|
||||||
do {
|
do {
|
||||||
oc = getopt (argc, argv, "a:c:d:f:hi:k:lmp:rs:t:v");
|
oc = getopt (argc, argv, "a:c:d:f:hi:k:lmp:qrs:t:v");
|
||||||
|
|
||||||
switch (oc) {
|
switch (oc) {
|
||||||
|
|
||||||
@ -658,6 +659,13 @@ static int process_commandline (int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 'q':
|
||||||
|
/*
|
||||||
|
* Activate special behavior for web UI (undocumented)
|
||||||
|
*/
|
||||||
|
opt.q = 1;
|
||||||
|
break;
|
||||||
|
|
||||||
case 'r':
|
case 'r':
|
||||||
/*
|
/*
|
||||||
* Remove box from input
|
* Remove box from input
|
||||||
@ -833,6 +841,7 @@ static int process_commandline (int argc, char *argv[])
|
|||||||
opt.justify? opt.justify: '?');
|
opt.justify? opt.justify: '?');
|
||||||
fprintf (stderr, "- Kill blank lines: %d\n", opt.killblank);
|
fprintf (stderr, "- Kill blank lines: %d\n", opt.killblank);
|
||||||
fprintf (stderr, "- Remove box: %d\n", opt.r);
|
fprintf (stderr, "- Remove box: %d\n", opt.r);
|
||||||
|
fprintf (stderr, "- Special handling for Web UI: %d\n", opt.q);
|
||||||
fprintf (stderr, "- Mend box: %d\n", opt.mend);
|
fprintf (stderr, "- Mend box: %d\n", opt.mend);
|
||||||
fprintf (stderr, "- Design Definition W shape: %s\n",
|
fprintf (stderr, "- Design Definition W shape: %s\n",
|
||||||
opt.cld? opt.cld: "n/a");
|
opt.cld? opt.cld: "n/a");
|
||||||
@ -1069,6 +1078,10 @@ static int list_styles()
|
|||||||
/*
|
/*
|
||||||
* Display all shapes
|
* Display all shapes
|
||||||
*/
|
*/
|
||||||
|
if (opt.q) {
|
||||||
|
fprintf (opt.outfile, "Sample:\n%s\n", d->sample);
|
||||||
|
}
|
||||||
|
else {
|
||||||
fprintf (opt.outfile, "Defined Shapes: ");
|
fprintf (opt.outfile, "Defined Shapes: ");
|
||||||
until = -1;
|
until = -1;
|
||||||
sstart = 0;
|
sstart = 0;
|
||||||
@ -1122,6 +1135,7 @@ static int list_styles()
|
|||||||
fprintf (opt.outfile, "\n");
|
fprintf (opt.outfile, "\n");
|
||||||
} while (until < ANZ_SHAPES-1);
|
} while (until < ANZ_SHAPES-1);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
else {
|
else {
|
||||||
@ -1140,6 +1154,7 @@ static int list_styles()
|
|||||||
|
|
||||||
sprintf (buf, "%d", anz_designs);
|
sprintf (buf, "%d", anz_designs);
|
||||||
|
|
||||||
|
if (!opt.q) {
|
||||||
fprintf (opt.outfile, "%d Available Style%s in \"%s\":\n",
|
fprintf (opt.outfile, "%d Available Style%s in \"%s\":\n",
|
||||||
anz_designs, anz_designs==1?"":"s", yyfilename);
|
anz_designs, anz_designs==1?"":"s", yyfilename);
|
||||||
fprintf (opt.outfile, "-----------------------%s",
|
fprintf (opt.outfile, "-----------------------%s",
|
||||||
@ -1147,7 +1162,12 @@ static int list_styles()
|
|||||||
for (i=strlen(yyfilename)+strlen(buf); i>0; --i)
|
for (i=strlen(yyfilename)+strlen(buf); i>0; --i)
|
||||||
fprintf (opt.outfile, "-");
|
fprintf (opt.outfile, "-");
|
||||||
fprintf (opt.outfile, "\n\n");
|
fprintf (opt.outfile, "\n\n");
|
||||||
|
}
|
||||||
for (i=0; i<anz_designs; ++i) {
|
for (i=0; i<anz_designs; ++i) {
|
||||||
|
if (opt.q) {
|
||||||
|
fprintf(opt.outfile, "%s\n", list[i]->name);
|
||||||
|
}
|
||||||
|
else {
|
||||||
if (list[i]->author && list[i]->designer && strcmp(list[i]->author, list[i]->designer) != 0) {
|
if (list[i]->author && list[i]->designer && strcmp(list[i]->author, list[i]->designer) != 0) {
|
||||||
fprintf(opt.outfile, "%s\n%s, coded by %s:\n\n%s\n\n", list[i]->name,
|
fprintf(opt.outfile, "%s\n%s, coded by %s:\n\n%s\n\n", list[i]->name,
|
||||||
list[i]->designer, list[i]->author, list[i]->sample);
|
list[i]->designer, list[i]->author, list[i]->sample);
|
||||||
@ -1164,6 +1184,7 @@ static int list_styles()
|
|||||||
fprintf(opt.outfile, "%s:\n\n%s\n\n", list[i]->name, list[i]->sample);
|
fprintf(opt.outfile, "%s:\n\n%s\n\n", list[i]->name, list[i]->sample);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
BFREE (list);
|
BFREE (list);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -121,6 +121,7 @@ extern char *yyfilename; /* name of config file */
|
|||||||
typedef struct { /* Command line options: */
|
typedef struct { /* Command line options: */
|
||||||
int l; /* list available designs */
|
int l; /* list available designs */
|
||||||
int mend; /* 1 if -m is given, 2 in 2nd loop */
|
int mend; /* 1 if -m is given, 2 in 2nd loop */
|
||||||
|
int q; /* special handling of web UI needs */
|
||||||
int r; /* remove box from input */
|
int r; /* remove box from input */
|
||||||
int tabstop; /* tab stop distance */
|
int tabstop; /* tab stop distance */
|
||||||
char tabexp; /* tab expansion mode (for leading tabs) */
|
char tabexp; /* tab expansion mode (for leading tabs) */
|
||||||
|
Loading…
Reference in New Issue
Block a user