X-Git-Url: https://git.danieliu.xyz/?p=smdp.git;a=blobdiff_plain;f=src%2Fmain.c;h=9920f38006bb7737c0ef77a02d0b934ee33a34a7;hp=3d63052c26f7064084dc79eac7f6b6a4f91de6a7;hb=c8f46dfa8f411b643907bc4c372bf788140f26f3;hpb=b0575cea32ff05e6af09e5106e82f8b14a7bb139 diff --git a/src/main.c b/src/main.c index 3d63052..9920f38 100644 --- a/src/main.c +++ b/src/main.c @@ -29,12 +29,14 @@ void usage() { fprintf(stderr, "%s", "Usage: mdp [OPTION]... [FILE]\n"); fprintf(stderr, "%s", "A command-line based markdown presentation tool.\n\n"); - fprintf(stderr, "%s", " -d, --debug enable debug messages on STDERR\n"); - fprintf(stderr, "%s", " add it multiple times to increases debug level\n"); - fprintf(stderr, "%s", " -f, --nofade disable color fading in 256 color mode\n"); - fprintf(stderr, "%s", " -h, --help display this help and exit\n"); - fprintf(stderr, "%s", " -i, --invert swap black and white color\n"); - fprintf(stderr, "%s", " -t, --notrans disable transparency in transparent terminal\n"); + fprintf(stderr, "%s", " -d, --debug enable debug messages on STDERR\n"); + fprintf(stderr, "%s", " add it multiple times to increases debug level\n"); + fprintf(stderr, "%s", " -f, --nofade disable color fading in 256 color mode\n"); + fprintf(stderr, "%s", " -h, --help display this help and exit\n"); + fprintf(stderr, "%s", " -i, --invert swap black and white color\n"); + fprintf(stderr, "%s", " -t, --notrans disable transparency in transparent terminal\n"); + fprintf(stderr, "%s", " -s, --noslidenum do not show slide number at the bottom\n"); + fprintf(stderr, "%s", " -x, --noslidemax show slide number, but not total number of slides\n"); fprintf(stderr, "%s", "\nWith no FILE, or when FILE is -, read standard input.\n\n"); exit(EXIT_FAILURE); } @@ -55,6 +57,7 @@ int main(int argc, char *argv[]) { int invert = 0; // invert color (black on white) int reload = 0; // reload page N (0 means no reload) int noreload = 1; // reload disabled until we know input is a file + int slidenum = 2; // 0:don't show; 1:show #; 2:show #/# // define command-line options struct option longopts[] = { @@ -64,12 +67,14 @@ int main(int argc, char *argv[]) { { "invert", no_argument, 0, 'i' }, { "notrans", no_argument, 0, 't' }, { "version", no_argument, 0, 'v' }, + { "noslidenum", no_argument, 0, 's' }, + { "noslidemax", no_argument, 0, 'x' }, { 0, 0, 0, 0 } }; // parse command-line options int opt, debug = 0; - while ((opt = getopt_long(argc, argv, ":dfhitv", longopts, NULL)) != -1) { + while ((opt = getopt_long(argc, argv, ":dfhitvsx", longopts, NULL)) != -1) { switch(opt) { case 'd': debug += 1; break; case 'f': nofade = 1; break; @@ -77,6 +82,8 @@ int main(int argc, char *argv[]) { case 'i': invert = 1; break; case 't': notrans = 1; break; case 'v': version(); break; + case 's': slidenum = 0; break; + case 'x': slidenum = 1; break; case ':': fprintf(stderr, "%s: '%c' requires an argument\n", argv[0], optopt); usage(); break; case '?': default : fprintf(stderr, "%s: option '%c' is invalid\n", argv[0], optopt); usage(); break; @@ -147,7 +154,7 @@ int main(int argc, char *argv[]) { markdown_debug(deck, debug); } - reload = ncurses_display(deck, notrans, nofade, invert, reload, noreload); + reload = ncurses_display(deck, notrans, nofade, invert, reload, noreload, slidenum); free_deck(deck);