+ /* Handle --unibyte and the EMACS_UNIBYTE envvar,
+ but not while dumping. */
+ if (
+#ifndef CANNOT_DUMP
+ ! noninteractive || initialized
+#else
+ 1
+#endif
+ )
+ {
+ int inhibit_unibyte = 0;
+
+ /* --multibyte overrides EMACS_UNIBYTE. */
+ if (argmatch (argv, argc, "-no-unibyte", "--no-unibyte", 4, NULL, &skip_args)
+ || argmatch (argv, argc, "-multibyte", "--multibyte", 4, NULL, &skip_args))
+ inhibit_unibyte = 1;
+
+ /* --unibyte requests that we set up to do everything with single-byte
+ buffers and strings. We need to handle this before calling
+ init_lread, init_editfns and other places that generate Lisp strings
+ from text in the environment. */
+ /* Actually this shouldn't be needed as of 20.4 in a generally
+ unibyte environment. As handa says, environment values
+ aren't now decoded; also existing buffers are now made
+ unibyte during startup if .emacs sets unibyte. Tested with
+ 8-bit data in environment variables and /etc/passwd, setting
+ unibyte and Latin-1 in .emacs. -- Dave Love */
+ if (argmatch (argv, argc, "-unibyte", "--unibyte", 4, NULL, &skip_args)
+ || argmatch (argv, argc, "-no-multibyte", "--no-multibyte", 4, NULL, &skip_args)
+ || (getenv ("EMACS_UNIBYTE") && !inhibit_unibyte))
+ {
+ Lisp_Object old_log_max;
+ Lisp_Object symbol, tail;
+
+ symbol = intern ("default-enable-multibyte-characters");
+ Fset (symbol, Qnil);
+
+ if (initialized)
+ {
+ /* Erase pre-dump messages in *Messages* now so no abort. */
+ old_log_max = Vmessage_log_max;
+ XSETFASTINT (Vmessage_log_max, 0);
+ message_dolog ("", 0, 1, 0);
+ Vmessage_log_max = old_log_max;
+ }
+
+ for (tail = Vbuffer_alist; CONSP (tail);
+ tail = XCDR (tail))
+ {
+ Lisp_Object buffer;
+
+ buffer = Fcdr (XCAR (tail));
+ /* Verify that all buffers are empty now, as they
+ ought to be. */
+ if (BUF_Z (XBUFFER (buffer)) > BUF_BEG (XBUFFER (buffer)))
+ abort ();
+ /* It is safe to do this crudely in an empty buffer. */
+ XBUFFER (buffer)->enable_multibyte_characters = Qnil;
+ }
+ }
+ }
+
+ no_loadup
+ = !argmatch (argv, argc, "-nl", "--no-loadup", 6, NULL, &skip_args);
+
+
+#ifdef HAVE_X_WINDOWS
+ /* Stupid kludge to catch command-line display spec. We can't
+ handle this argument entirely in window system dependent code
+ because we don't even know which window system dependent code
+ to run until we've recognized this argument. */
+ {
+ char *displayname = 0;
+ int count_before = skip_args;
+
+ /* Skip any number of -d options, but only use the last one. */
+ while (1)
+ {
+ int count_before_this = skip_args;
+
+ if (argmatch (argv, argc, "-d", "--display", 3, &displayname, &skip_args))
+ display_arg = 1;
+ else if (argmatch (argv, argc, "-display", 0, 3, &displayname, &skip_args))
+ display_arg = 1;
+ else
+ break;
+
+ count_before = count_before_this;
+ }
+
+ /* If we have the form --display=NAME,
+ convert it into -d name.
+ This requires inserting a new element into argv. */
+ if (displayname != 0 && skip_args - count_before == 1)
+ {
+ char **new = (char **) xmalloc (sizeof (char *) * (argc + 2));
+ int j;
+
+ for (j = 0; j < count_before + 1; j++)
+ new[j] = argv[j];
+ new[count_before + 1] = "-d";
+ new[count_before + 2] = displayname;
+ for (j = count_before + 2; j <argc; j++)
+ new[j + 1] = argv[j];
+ argv = new;
+ argc++;
+ }
+ /* 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 + 1] = "-d";
+
+ /* Don't actually discard this arg. */
+ skip_args = count_before;
+ }
+#endif
+
+ /* argmatch must not be used after here,
+ except when bulding temacs
+ because the -d argument has not been skipped in skip_args. */
+