Mercurial > emacs
comparison src/editfns.c @ 5907:5fdb226fe9a4
(init_editfns): Look at LOGNAME before USER.
author | Karl Heuer <kwzh@gnu.org> |
---|---|
date | Fri, 11 Feb 1994 21:51:23 +0000 |
parents | d02095ea13a5 |
children | 11c1e1696fe3 |
comparison
equal
deleted
inserted
replaced
5906:5b5d6e2f65d1 | 5907:5fdb226fe9a4 |
---|---|
41 /* Some static data, and a function to initialize it for each run */ | 41 /* Some static data, and a function to initialize it for each run */ |
42 | 42 |
43 Lisp_Object Vsystem_name; | 43 Lisp_Object Vsystem_name; |
44 Lisp_Object Vuser_real_name; /* login name of current user ID */ | 44 Lisp_Object Vuser_real_name; /* login name of current user ID */ |
45 Lisp_Object Vuser_full_name; /* full name of current user */ | 45 Lisp_Object Vuser_full_name; /* full name of current user */ |
46 Lisp_Object Vuser_name; /* user name from USER or LOGNAME. */ | 46 Lisp_Object Vuser_name; /* user name from LOGNAME or USER */ |
47 | 47 |
48 void | 48 void |
49 init_editfns () | 49 init_editfns () |
50 { | 50 { |
51 char *user_name; | 51 char *user_name; |
74 pw = (struct passwd *) getpwuid (getuid ()); | 74 pw = (struct passwd *) getpwuid (getuid ()); |
75 Vuser_real_name = build_string (pw ? pw->pw_name : "unknown"); | 75 Vuser_real_name = build_string (pw ? pw->pw_name : "unknown"); |
76 | 76 |
77 /* Get the effective user name, by consulting environment variables, | 77 /* Get the effective user name, by consulting environment variables, |
78 or the effective uid if those are unset. */ | 78 or the effective uid if those are unset. */ |
79 user_name = (char *) getenv ("USER"); | 79 user_name = (char *) getenv ("LOGNAME"); |
80 if (!user_name) | 80 if (!user_name) |
81 user_name = (char *) getenv ("LOGNAME"); | 81 user_name = (char *) getenv ("USER"); |
82 if (!user_name) | 82 if (!user_name) |
83 { | 83 { |
84 pw = (struct passwd *) getpwuid (geteuid ()); | 84 pw = (struct passwd *) getpwuid (geteuid ()); |
85 user_name = (char *) (pw ? pw->pw_name : "unknown"); | 85 user_name = (char *) (pw ? pw->pw_name : "unknown"); |
86 } | 86 } |
481 } | 481 } |
482 | 482 |
483 DEFUN ("user-login-name", Fuser_login_name, Suser_login_name, 0, 0, 0, | 483 DEFUN ("user-login-name", Fuser_login_name, Suser_login_name, 0, 0, 0, |
484 "Return the name under which the user logged in, as a string.\n\ | 484 "Return the name under which the user logged in, as a string.\n\ |
485 This is based on the effective uid, not the real uid.\n\ | 485 This is based on the effective uid, not the real uid.\n\ |
486 Also, if the environment variable USER or LOGNAME is set,\n\ | 486 Also, if the environment variable LOGNAME or USER is set,\n\ |
487 that determines the value of this function.") | 487 that determines the value of this function.") |
488 () | 488 () |
489 { | 489 { |
490 return Vuser_name; | 490 return Vuser_name; |
491 } | 491 } |