emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] trunk r114900: * emacs.c (original_pwd): Remove global var


From: Paul Eggert
Subject: [Emacs-diffs] trunk r114900: * emacs.c (original_pwd): Remove global var by making it local.
Date: Sat, 02 Nov 2013 02:11:40 +0000
User-agent: Bazaar (2.6b2)

------------------------------------------------------------
revno: 114900
revision-id: address@hidden
parent: address@hidden
committer: Paul Eggert <address@hidden>
branch nick: trunk
timestamp: Fri 2013-11-01 19:11:37 -0700
message:
  * emacs.c (original_pwd): Remove global var by making it local.
  
  (init_cmdargs): New arg ORIGINAL_PWD; caller changed.
modified:
  src/ChangeLog                  changelog-20091113204419-o5vbwnq5f7feedwu-1438
  src/emacs.c                    emacs.c-20091113204419-o5vbwnq5f7feedwu-241
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog     2013-11-01 15:47:10 +0000
+++ b/src/ChangeLog     2013-11-02 02:11:37 +0000
@@ -1,3 +1,8 @@
+2013-11-02  Paul Eggert  <address@hidden>
+
+       * emacs.c (original_pwd): Remove global var by making it local.
+       (init_cmdargs): New arg ORIGINAL_PWD; caller changed.
+
 2013-11-01  Jan Djärv  <address@hidden>
 
        * xfaces.c: Declare color_distance.

=== modified file 'src/emacs.c'
--- a/src/emacs.c       2013-10-31 08:32:42 +0000
+++ b/src/emacs.c       2013-11-02 02:11:37 +0000
@@ -202,9 +202,6 @@
    startup.  */
 int daemon_pipe[2];
 
-/* If we use --chdir, this records the original directory.  */
-char *original_pwd;
-
 /* Save argv and argc.  */
 char **initial_argv;
 int initial_argc;
@@ -386,7 +383,7 @@
 /* Code for dealing with Lisp access to the Unix command line.  */
 
 static void
-init_cmdargs (int argc, char **argv, int skip_args)
+init_cmdargs (int argc, char **argv, int skip_args, char *original_pwd)
 {
   register int i;
   Lisp_Object name, dir, handler;
@@ -705,6 +702,9 @@
 #endif
   char *ch_to_dir;
 
+  /* If we use --chdir, this records the original directory.  */
+  char *original_pwd = 0;
+
 #if GC_MARK_STACK
   stack_base = &dummy;
 #endif
@@ -794,7 +794,7 @@
   if (argmatch (argv, argc, "-chdir", "--chdir", 4, &ch_to_dir, &skip_args))
     {
       original_pwd = get_current_dir_name ();
-      if (chdir (ch_to_dir) == -1)
+      if (chdir (ch_to_dir) != 0)
         {
           fprintf (stderr, "%s: Can't chdir to %s: %s\n",
                    argv[0], ch_to_dir, strerror (errno));
@@ -1330,7 +1330,9 @@
   init_buffer ();      /* Init default directory of main buffer.  */
 
   init_callproc_1 ();  /* Must precede init_cmdargs and init_sys_modes.  */
-  init_cmdargs (argc, argv, skip_args);        /* Must precede init_lread.  */
+
+  /* Must precede init_lread.  */
+  init_cmdargs (argc, argv, skip_args, original_pwd);
 
   if (initialized)
     {


reply via email to

[Prev in Thread] Current Thread [Next in Thread]