changeset 10172:9a91efe65b85

(main): Fix conversion of --display to -d. (main): Implement --version.
author Richard M. Stallman <rms@gnu.org>
date Thu, 15 Dec 1994 13:56:57 +0000
parents 3c022e99daab
children 6a4f5fc9d3f9
files src/emacs.c
diffstat 1 files changed, 19 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/emacs.c	Thu Dec 15 13:53:44 1994 +0000
+++ b/src/emacs.c	Thu Dec 15 13:56:57 1994 +0000
@@ -420,6 +420,22 @@
 
   sort_args (argc, argv);
 
+  if (argmatch (argv, argc, "-version", "--version", 3, NULL, &skip_args))
+    {
+      Lisp_Object tem;
+      tem = Fsymbol_value (intern ("emacs-version"));
+      if (!STRINGP (tem))
+	{
+	  fprintf (stderr, "Invalid value of `emacs-version'\n");
+	  exit (1);
+	}
+      else
+	{
+	  printf ("%s\n", XSTRING (tem)->data);
+	  exit (0);
+	}
+    }
+
 /* Map in shared memory, if we are using that.  */
 #ifdef HAVE_SHM
   if (argmatch (argv, argc, "-nl", "--no-shared-memory", 6, NULL, &skip_args))
@@ -604,7 +620,9 @@
 	argv = new;
 	argc++;
       }
-    else if (displayname != 0 && argv[count_before + 1][1] == '-')
+    /* Change --display to -d, when its arg is separate.  */
+    else if (displayname != 0 && skip_args > count_before
+	     && argv[count_before + 1][1] == '-')
       argv[count_before] = "-d";
 
     /* Don't actually discard this arg.  */