comparison src/buffer.c @ 65438:170f43effa81

(init_buffer): Grow buffer to add directory separator and terminal zero.
author Romain Francoise <romain@orebokech.com>
date Sat, 10 Sep 2005 19:55:28 +0000
parents c832bf03b2b2
children 1ffe6d4d0fc4
comparison
equal deleted inserted replaced
65437:035ea9e34f56 65438:170f43effa81
5133 if (NILP (buffer_defaults.enable_multibyte_characters)) 5133 if (NILP (buffer_defaults.enable_multibyte_characters))
5134 Fset_buffer_multibyte (Qnil); 5134 Fset_buffer_multibyte (Qnil);
5135 5135
5136 pwd = get_current_dir_name (); 5136 pwd = get_current_dir_name ();
5137 5137
5138 if(!pwd) 5138 if (!pwd)
5139 fatal ("`get_current_dir_name' failed: %s\n", strerror (errno)); 5139 fatal ("`get_current_dir_name' failed: %s\n", strerror (errno));
5140 5140
5141 #ifndef VMS 5141 #ifndef VMS
5142 /* Maybe this should really use some standard subroutine 5142 /* Maybe this should really use some standard subroutine
5143 whose definition is filename syntax dependent. */ 5143 whose definition is filename syntax dependent. */
5144 rc = strlen (pwd); 5144 rc = strlen (pwd);
5145 if (!(IS_DIRECTORY_SEP (pwd[rc - 1]))) 5145 if (!(IS_DIRECTORY_SEP (pwd[rc - 1])))
5146 { 5146 {
5147 /* Grow buffer to add directory separator and '\0'. */
5148 pwd = (char *) xrealloc (pwd, rc + 2);
5147 pwd[rc] = DIRECTORY_SEP; 5149 pwd[rc] = DIRECTORY_SEP;
5148 pwd[rc + 1] = '\0'; 5150 pwd[rc + 1] = '\0';
5149 } 5151 }
5150 #endif /* not VMS */ 5152 #endif /* not VMS */
5151 5153
5152 current_buffer->directory = make_unibyte_string (pwd, strlen (pwd)); 5154 current_buffer->directory = make_unibyte_string (pwd, strlen (pwd));
5153 if (! NILP (buffer_defaults.enable_multibyte_characters)) 5155 if (! NILP (buffer_defaults.enable_multibyte_characters))
5154 /* At this momemnt, we still don't know how to decode the 5156 /* At this momemnt, we still don't know how to decode the
5155 direcotry name. So, we keep the bytes in multibyte form so 5157 directory name. So, we keep the bytes in multibyte form so
5156 that ENCODE_FILE correctly gets the original bytes. */ 5158 that ENCODE_FILE correctly gets the original bytes. */
5157 current_buffer->directory 5159 current_buffer->directory
5158 = string_to_multibyte (current_buffer->directory); 5160 = string_to_multibyte (current_buffer->directory);
5159 5161
5160 /* Add /: to the front of the name 5162 /* Add /: to the front of the name