From af4168a84836c8b42bf0a06126e0021a07520ba3 Mon Sep 17 00:00:00 2001 From: girst Date: Thu, 19 Apr 2018 16:59:36 +0200 Subject: [PATCH] help text into header --- mines.c | 32 ++++++-------------------------- mines.h | 28 ++++++++++++++++++++++++++++ 2 files changed, 34 insertions(+), 26 deletions(-) diff --git a/mines.c b/mines.c index bc5109f..e11b2cf 100644 --- a/mines.c +++ b/mines.c @@ -68,32 +68,9 @@ int main (int argc, char** argv) { case 'c': op.scheme = &symbols_col1; break; case 'd': op.scheme = &symbols_doublewidth; break; case 'h': - default: - fprintf (stderr, "%s [OPTIONS] [FIELDSPEC]\n" - "OPTIONS:\n" - " -n(o flagging)\n" - " -f(lagging)\n" - " -q(uestion marks)\n" - " -c(olored symbols)\n" - " -d(ec charset symbols)\n" - "FIELDSPEC:\n" - " WxH[xM] (width 'x' height 'x' mines)\n" - " defaults to 30x16x99; mines default to ~20%%\n" - "\n" - "Keybindings:\n" - " hjkl: move left/down/up/right\n" - " bduw: move to next boundary\n" - " ^Gg$: move to the left/bottom/top/right\n" - " z: center cursor on minefield\n" - " o: open/choord\n" - " i: flag/unflag\n" - " space:modeful cursor (either open or flag)\n" - " a: toggle mode for space (open/flag)\n" - " mX: set a mark for letter X\n" - " `X: move to mark X (aliased to ')\n" - " r: start a new game\n" - " q: quit\n", argv[0]); - _exit(optget=='h'?0:1); + default: + fprintf (stderr, SHORTHELP LONGHELP, argv[0]); + return !(optget=='h'); } } /* end parse options*/ @@ -289,6 +266,9 @@ int everything_opened (void) { return 1; } +void print_help(char* progname) { +} + int wait_mouse_up (int l, int c) { unsigned char mouse2[3]; int level = 1; diff --git a/mines.h b/mines.h index 94e7d1b..25807ec 100644 --- a/mines.h +++ b/mines.h @@ -1,5 +1,32 @@ #ifndef __MINES_H__ #define __MINES_H + +#define SHORTHELP "%s [OPTIONS] [FIELDSPEC]\n" +#define LONGHELP \ + "OPTIONS:\n" \ + " -n(o flagging)\n" \ + " -f(lagging)\n" \ + " -q(uestion marks)\n" \ + " -c(olored symbols)\n" \ + " -d(ec charset symbols)\n" \ + "FIELDSPEC:\n" \ + " WxH[xM] (width 'x' height 'x' mines)\n" \ + " defaults to 30x16x99; mines default to ~20%%\n" \ + "\n" \ + "Keybindings:\n" \ + " hjkl: move left/down/up/right\n" \ + " bduw: move to next boundary\n" \ + " ^Gg$: move to the left/bottom/top/right\n" \ + " z: center cursor on minefield\n" \ + " o: open/choord\n" \ + " i: flag/unflag\n" \ + " space:modeful cursor (either open or flag)\n" \ + " a: toggle mode for space (open/flag)\n" \ + " mX: set a mark for letter X\n" \ + " `X: move to mark X (aliased to ')\n" \ + " r: start a new game\n" \ + " q: quit\n" + struct minefield { struct minecell { unsigned m:2; /* mine?1:killmine?2:0 */ @@ -54,6 +81,7 @@ int screen2field_c (int); int field2screen_c (int); int clicked_emoticon (unsigned char*); void quit(void); +void print_help(char*); int parse_fieldspec(char*); void signal_handler (int signum); void signal_setup (void); -- 2.39.3