commit f0c4c552c86fd98e68a3e69d6ded849d16f4be41
parent 536b50828d486f224bdc21942c1fcc24ac3fa700
Author: ukai <ukai>
Date:   Wed, 19 Dec 2001 18:16:18 +0000
[w3m-dev 02655] print version and compile options
Hironori Sakamoto <hsaka@mth.biglobe.ne.jp>
Diffstat:
| M | ChangeLog | | | 9 | +++++++++ | 
| M | configure | | | 25 | +++++++++++++++---------- | 
| M | main.c | | | 71 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++---- | 
3 files changed, 91 insertions(+), 14 deletions(-)
diff --git a/ChangeLog b/ChangeLog
@@ -1,3 +1,12 @@
+2001-12-20  Hironori Sakamoto <hsaka@mth.biglobe.ne.jp>
+
+	* [w3m-dev 02655] print version and compile options
+	* configure: change order of questions
+	* main.c (fversion): added
+	* main.c (fusage): use fversion()
+	* main.c (fusage): add -help, -version
+	* main.c (MAIN): add -help, -version
+
 2001-12-20  Tsutomu Okada <okada@furuno.co.jp>
 
 	* [w3m-dev 02672]
diff --git a/configure b/configure
@@ -555,22 +555,19 @@ else
   def_param system_code x
 fi
 
-# editing?
-ask_param "Use Lynx-like key binding as default" use_lynx_key n
-if [ "$use_lynx_key" = y ]; then
-  keymap_file="keybind_lynx"
-else
-  keymap_file="keybind"
-fi
-
-# terminal capabilities
 if [ "$lang" = "JA" ]; then
   ask_param "Use 2-byte character for table border, item, etc." kanji_symbols y
 else
   kanji_symbols=n
   def_param kanji_symbols n
 fi
-ask_param "ANSI color escape sequences support" use_ansi_color n
+
+ask_param "Use Lynx-like key binding as default" use_lynx_key n
+if [ "$use_lynx_key" = y ]; then
+  keymap_file="keybind_lynx"
+else
+  keymap_file="keybind"
+fi
 
 if [ "$lang" = "JA" ]; then
   if [ "$use_lynx_key" = y ]; then
@@ -694,9 +691,17 @@ fi
 if [ "$use_ssl" = y ]; then
   ask_param "SSL verification support (SSL library >= version 0.8)" use_ssl_verify n
 else
+  use_ssl_verify=n
   def_param "use_ssl_verify" n
 fi
 
+if [ "$use_color" = y ]; then
+  ask_param "ANSI color escape sequences support" use_ansi_color n
+else
+  use_ansi_color=n
+  def_param "use_ansi_color" n
+fi
+
 # protocols?
 ask_param "NNTP support" use_nntp $include_opt
 ask_param "Gopher support" use_gopher $include_opt
diff --git a/main.c b/main.c
@@ -85,9 +85,66 @@ static int searchKeyNum(void);
 #define usage() fusage(stderr, 1)
 
 static void
+fversion(FILE * f)
+{
+    fprintf(f, "w3m version %s, options %s\n", w3m_version,
+#if LANG == JA
+	    "lang=ja"
+#ifdef KANJI_SYMBOLS
+	    ",kanji-symbols"
+#endif
+#else
+	    "lang=en"
+#endif
+#ifdef USE_COLOR
+	    ",color"
+#ifdef USE_ANSI_COLOR
+	    ",ansi-color"
+#endif
+#endif
+#ifdef USE_MOUSE
+	    ",mouse"
+#ifdef USE_GPM
+	    ",gpm"
+#endif
+#ifdef USE_SYSMOUSE
+	    ",sysmouse"
+#endif
+#endif
+#ifdef USE_MENU
+	    ",menu"
+#endif
+#ifdef USE_COOKIE
+	    ",cookie"
+#endif
+#ifdef USE_SSL
+	    ",ssl"
+#ifdef USE_SSL_VERIFY
+	    ",ssl-verify"
+#endif
+#endif
+#ifdef USE_NNTP
+	    ",nntp"
+#endif
+#ifdef USE_GOPHER
+	    ",gopher"
+#endif
+#ifdef USE_INET6
+	    ",ipv6"
+#endif
+#ifdef USE_ALARM
+	    ",alarm"
+#endif
+#ifdef USE_MARK
+	    ",mark"
+#endif
+	);
+}
+
+static void
 fusage(FILE * f, int err)
 {
-    fprintf(f, "version %s\n", w3m_version);
+    fversion(f);
     fprintf(f, "usage: w3m [options] [URL or filename]\noptions:\n");
     fprintf(f, "    -t tab           set tab width\n");
     fprintf(f, "    -r               ignore backspace effect\n");
@@ -146,6 +203,8 @@ fusage(FILE * f, int err)
     fprintf(f, "    -X               don't use termcap init/deinit\n");
     fprintf(f, "    -o opt=value     assign value to config option\n");
     fprintf(f, "    -config file     specify config file\n");
+    fprintf(f, "    -help            print this usage message\n");
+    fprintf(f, "    -version         print w3m version\n");
     fprintf(f, "    -debug           DO NOT USE\n");
     if (show_params_p)
 	show_params(f);
@@ -172,11 +231,11 @@ wrap_GC_warn_proc(char *msg, GC_word arg)
 	static int n = 0;
 	static int lock = 0;
 	int j;
-	
+
 	j = (i + n) % (sizeof(msg_ring) / sizeof(msg_ring[0]));
 	msg_ring[j].msg = msg;
 	msg_ring[j].arg = arg;
-	
+
 	if (n < sizeof(msg_ring) / sizeof(msg_ring[0]))
 	    ++n;
 	else
@@ -304,8 +363,12 @@ MAIN(int argc, char **argv, char **envp)
 		config_filename = argv[i];
 		argv[i] = "-dummy";
 	    }
-	    else if (!strcmp("-h", argv[i]))
+	    else if (!strcmp("-h", argv[i]) || !strcmp("-help", argv[i]))
 		help();
+	    else if (!strcmp("-V", argv[i]) || !strcmp("-version", argv[i])) {
+		fversion(stdout);
+		exit(0);
+	    }
 	}
     }