Mercurial > hg > xemacs-beta
comparison src/editfns.c @ 163:0132846995bd r20-3b8
Import from CVS: tag r20-3b8
author | cvs |
---|---|
date | Mon, 13 Aug 2007 09:43:35 +0200 |
parents | 28f395d8dc7a |
children | 15872534500d |
comparison
equal
deleted
inserted
replaced
162:4de2936b4e77 | 163:0132846995bd |
---|---|
773 If the optional argument USER is given, then the full name for that | 773 If the optional argument USER is given, then the full name for that |
774 user is returned, or nil. USER may be either a login name or a uid. | 774 user is returned, or nil. USER may be either a login name or a uid. |
775 */ | 775 */ |
776 (user)) | 776 (user)) |
777 { | 777 { |
778 Lisp_Object uname = (STRINGP (user) ? user : Fuser_login_name (user)); | 778 Lisp_Object user_name = (STRINGP (user) ? user : Fuser_login_name (user)); |
779 struct passwd *pw = NULL; | 779 struct passwd *pw = NULL; |
780 Lisp_Object tem; | 780 Lisp_Object tem; |
781 char *p, *q; | 781 char *p, *q; |
782 | 782 |
783 if (!NILP (uname)) /* nil when nonexistent UID passed as arg */ | 783 if (!NILP (user_name)) /* nil when nonexistent UID passed as arg */ |
784 { | 784 { |
785 CONST char *uname_ext; | 785 CONST char *user_name_ext; |
786 | 786 |
787 /* Fuck me. getpwnam() can call select() and (under IRIX at least) | 787 /* Fuck me. getpwnam() can call select() and (under IRIX at least) |
788 things get wedged if a SIGIO arrives during this time. */ | 788 things get wedged if a SIGIO arrives during this time. */ |
789 GET_C_STRING_OS_DATA_ALLOCA (uname, uname_ext); | 789 GET_C_STRING_OS_DATA_ALLOCA (user_name, user_name_ext); |
790 slow_down_interrupts (); | 790 slow_down_interrupts (); |
791 pw = (struct passwd *) getpwnam (uname_ext); | 791 pw = (struct passwd *) getpwnam (user_name_ext); |
792 speed_up_interrupts (); | 792 speed_up_interrupts (); |
793 } | 793 } |
794 | 794 |
795 /* #### - Stig sez: this should return nil instead of "unknown" when pw==0 */ | 795 /* #### - Stig sez: this should return nil instead of "unknown" when pw==0 */ |
796 /* Ben sez: bad idea because it's likely to break something */ | 796 /* Ben sez: bad idea because it's likely to break something */ |
812 p = (char *) XSTRING_DATA (tem); | 812 p = (char *) XSTRING_DATA (tem); |
813 q = strchr (p, '&'); | 813 q = strchr (p, '&'); |
814 /* Substitute the login name for the &, upcasing the first character. */ | 814 /* Substitute the login name for the &, upcasing the first character. */ |
815 if (q) | 815 if (q) |
816 { | 816 { |
817 char *r = (char *) alloca (strlen (p) + XSTRING_LENGTH (uname) + 1); | 817 char *r = (char *) alloca (strlen (p) + XSTRING_LENGTH (user_name) + 1); |
818 memcpy (r, p, q - p); | 818 memcpy (r, p, q - p); |
819 r[q - p] = 0; | 819 r[q - p] = 0; |
820 strcat (r, (char *) XSTRING_DATA (uname)); | 820 strcat (r, (char *) XSTRING_DATA (user_name)); |
821 /* #### current_buffer dependency! */ | 821 /* #### current_buffer dependency! */ |
822 r[q - p] = UPCASE (current_buffer, r[q - p]); | 822 r[q - p] = UPCASE (current_buffer, r[q - p]); |
823 strcat (r, q + 1); | 823 strcat (r, q + 1); |
824 tem = build_string (r); | 824 tem = build_string (r); |
825 } | 825 } |