Mercurial > emacs
comparison src/editfns.c @ 9572:b36d5e88cccc
*** empty log message ***
author | Morten Welinder <terra@diku.dk> |
---|---|
date | Mon, 17 Oct 1994 08:42:36 +0000 |
parents | 5187a4159d16 |
children | 0fc126c193e7 |
comparison
equal
deleted
inserted
replaced
9571:b37425ecb3f0 | 9572:b36d5e88cccc |
---|---|
62 if (!initialized) | 62 if (!initialized) |
63 return; | 63 return; |
64 #endif /* not CANNOT_DUMP */ | 64 #endif /* not CANNOT_DUMP */ |
65 | 65 |
66 pw = (struct passwd *) getpwuid (getuid ()); | 66 pw = (struct passwd *) getpwuid (getuid ()); |
67 #ifdef MSDOS | |
68 /* We let the real user name default to "root" because that's quite | |
69 accurate on MSDOG and because it lets Emacs find the init file. | |
70 (The DVX libraries override the Djgpp libraries here.) */ | |
71 Vuser_real_name = build_string (pw ? pw->pw_name : "root"); | |
72 #else | |
67 Vuser_real_name = build_string (pw ? pw->pw_name : "unknown"); | 73 Vuser_real_name = build_string (pw ? pw->pw_name : "unknown"); |
74 #endif | |
68 | 75 |
69 /* Get the effective user name, by consulting environment variables, | 76 /* Get the effective user name, by consulting environment variables, |
70 or the effective uid if those are unset. */ | 77 or the effective uid if those are unset. */ |
71 user_name = (char *) getenv ("LOGNAME"); | 78 user_name = (char *) getenv ("LOGNAME"); |
72 if (!user_name) | 79 if (!user_name) |
481 | 488 |
482 XSETFASTINT (val, FETCH_CHAR (n)); | 489 XSETFASTINT (val, FETCH_CHAR (n)); |
483 return val; | 490 return val; |
484 } | 491 } |
485 | 492 |
486 DEFUN ("user-login-name", Fuser_login_name, Suser_login_name, 0, 0, 0, | 493 DEFUN ("user-login-name", Fuser_login_name, Suser_login_name, 0, 1, 0, |
487 "Return the name under which the user logged in, as a string.\n\ | 494 "Return the name under which the user logged in, as a string.\n\ |
488 This is based on the effective uid, not the real uid.\n\ | 495 This is based on the effective uid, not the real uid.\n\ |
489 Also, if the environment variable LOGNAME or USER is set,\n\ | 496 Also, if the environment variable LOGNAME or USER is set,\n\ |
490 that determines the value of this function.") | 497 that determines the value of this function.\n\n\ |
491 () | 498 If optional argument UID is an integer, return the login name of the user\n\ |
492 { | 499 with that uid, or nil if there is no such user.") |
500 (uid) | |
501 Lisp_Object uid; | |
502 { | |
503 struct passwd *pw; | |
504 | |
493 /* Set up the user name info if we didn't do it before. | 505 /* Set up the user name info if we didn't do it before. |
494 (That can happen if Emacs is dumpable | 506 (That can happen if Emacs is dumpable |
495 but you decide to run `temacs -l loadup' and not dump. */ | 507 but you decide to run `temacs -l loadup' and not dump. */ |
496 if (INTEGERP (Vuser_name)) | 508 if (INTEGERP (Vuser_name)) |
497 init_editfns (); | 509 init_editfns (); |
498 return Vuser_name; | 510 |
511 if (NILP (uid)) | |
512 return Vuser_name; | |
513 | |
514 CHECK_NUMBER (uid, 0); | |
515 pw = (struct passwd *) getpwuid (XINT (uid)); | |
516 return (pw ? build_string (pw->pw_name) : Qnil); | |
499 } | 517 } |
500 | 518 |
501 DEFUN ("user-real-login-name", Fuser_real_login_name, Suser_real_login_name, | 519 DEFUN ("user-real-login-name", Fuser_real_login_name, Suser_real_login_name, |
502 0, 0, 0, | 520 0, 0, 0, |
503 "Return the name of the user's real uid, as a string.\n\ | 521 "Return the name of the user's real uid, as a string.\n\ |