comparison src/xsmfns.c @ 65412:3a9693f993b2

(smc_save_yourself_CB): Use get_current_dir_name.
author Eli Zaretskii <eliz@gnu.org>
date Sat, 10 Sep 2005 11:30:55 +0000
parents a0d1312ede66
children 8763a59d5982
comparison
equal deleted inserted replaced
65411:29cca0143d6f 65412:3a9693f993b2
50 #include "lisp.h" 50 #include "lisp.h"
51 #include "termhooks.h" 51 #include "termhooks.h"
52 #include "termopts.h" 52 #include "termopts.h"
53 #include "xterm.h" 53 #include "xterm.h"
54 54
55 #ifndef MAXPATHLEN 55 extern char * get_current_dir_name ();
56 #define MAXPATHLEN 1024
57 #endif /* not MAXPATHLEN */
58
59 56
60 /* The user login name. */ 57 /* The user login name. */
61 58
62 extern Lisp_Object Vuser_login_name; 59 extern Lisp_Object Vuser_login_name;
63 60
203 200
204 SmPropValue values[20]; 201 SmPropValue values[20];
205 int val_idx = 0; 202 int val_idx = 0;
206 int props_idx = 0; 203 int props_idx = 0;
207 204
208 char cwd[MAXPATHLEN+1]; 205 char *cwd = NULL;
209 char *smid_opt; 206 char *smid_opt;
210 207
211 /* How to start a new instance of Emacs. */ 208 /* How to start a new instance of Emacs. */
212 props[props_idx] = &prop_ptr[props_idx]; 209 props[props_idx] = &prop_ptr[props_idx];
213 props[props_idx]->name = SmCloneCommand; 210 props[props_idx]->name = SmCloneCommand;
257 props[props_idx]->vals = &values[val_idx++]; 254 props[props_idx]->vals = &values[val_idx++];
258 props[props_idx]->vals[0].length = strlen (SDATA (Vuser_login_name)); 255 props[props_idx]->vals[0].length = strlen (SDATA (Vuser_login_name));
259 props[props_idx]->vals[0].value = SDATA (Vuser_login_name); 256 props[props_idx]->vals[0].value = SDATA (Vuser_login_name);
260 ++props_idx; 257 ++props_idx;
261 258
262 /* The current directory property, not mandatory. */ 259 cwd = get_current_dir_name ();
263 #ifdef HAVE_GETCWD 260
264 if (getcwd (cwd, MAXPATHLEN+1) != 0) 261 if (cwd)
265 #else
266 if (getwd (cwd) != 0)
267 #endif
268 { 262 {
269 props[props_idx] = &prop_ptr[props_idx]; 263 props[props_idx] = &prop_ptr[props_idx];
270 props[props_idx]->name = SmCurrentDirectory; 264 props[props_idx]->name = SmCurrentDirectory;
271 props[props_idx]->type = SmARRAY8; 265 props[props_idx]->type = SmARRAY8;
272 props[props_idx]->num_vals = 1; 266 props[props_idx]->num_vals = 1;
278 272
279 273
280 SmcSetProperties (smcConn, props_idx, props); 274 SmcSetProperties (smcConn, props_idx, props);
281 275
282 xfree (smid_opt); 276 xfree (smid_opt);
277
278 if (cwd)
279 free (cwd);
283 280
284 /* See if we maybe shall interact with the user. */ 281 /* See if we maybe shall interact with the user. */
285 if (interactStyle != SmInteractStyleAny 282 if (interactStyle != SmInteractStyleAny
286 || ! shutdown 283 || ! shutdown
287 || saveType == SmSaveLocal 284 || saveType == SmSaveLocal