Mercurial > emacs
comparison src/editfns.c @ 16683:6802dbd07a80
(Fuser_full_name): Return nil if the specified user doesn't exist.
(init_editfns): Set Vuser_full_name to "unknown" if the user name
can't be resolved.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Sun, 15 Dec 1996 20:14:13 +0000 |
parents | 912ff9d36bb1 |
children | 0b914fcd97a1 |
comparison
equal
deleted
inserted
replaced
16682:fe4b95eb15ae | 16683:6802dbd07a80 |
---|---|
107 : Vuser_login_name); | 107 : Vuser_login_name); |
108 | 108 |
109 p = (unsigned char *) getenv ("NAME"); | 109 p = (unsigned char *) getenv ("NAME"); |
110 if (p) | 110 if (p) |
111 Vuser_full_name = build_string (p); | 111 Vuser_full_name = build_string (p); |
112 else if (NILP (Vuser_full_name)) | |
113 Vuser_full_name = build_string ("unknown"); | |
112 } | 114 } |
113 | 115 |
114 DEFUN ("char-to-string", Fchar_to_string, Schar_to_string, 1, 1, 0, | 116 DEFUN ("char-to-string", Fchar_to_string, Schar_to_string, 1, 1, 0, |
115 "Convert arg CHARACTER to a one-character string containing that character.") | 117 "Convert arg CHARACTER to a one-character string containing that character.") |
116 (character) | 118 (character) |
583 pw = (struct passwd *) getpwnam (XSTRING (uid)->data); | 585 pw = (struct passwd *) getpwnam (XSTRING (uid)->data); |
584 else | 586 else |
585 error ("Invalid UID specification"); | 587 error ("Invalid UID specification"); |
586 | 588 |
587 if (!pw) | 589 if (!pw) |
588 return build_string ("unknown"); | 590 return Qnil; |
589 | 591 |
590 p = (unsigned char *) USER_FULL_NAME; | 592 p = (unsigned char *) USER_FULL_NAME; |
591 /* Chop off everything after the first comma. */ | 593 /* Chop off everything after the first comma. */ |
592 q = (unsigned char *) index (p, ','); | 594 q = (unsigned char *) index (p, ','); |
593 full = make_string (p, q ? q - p : strlen (p)); | 595 full = make_string (p, q ? q - p : strlen (p)); |