diff options
| author | Karl Heuer | 1995-05-30 21:56:32 +0000 |
|---|---|---|
| committer | Karl Heuer | 1995-05-30 21:56:32 +0000 |
| commit | 35b34f729f356ae2b4df985f9f58346c70346612 (patch) | |
| tree | 7307b3743f4979d1fb39d9c1471f6774dcecd3ab /src | |
| parent | 7cca72e3e204c668593785b7ffcde7392ac3975f (diff) | |
| download | emacs-35b34f729f356ae2b4df985f9f58346c70346612.tar.gz emacs-35b34f729f356ae2b4df985f9f58346c70346612.zip | |
(syms_of_editfns): user-login-name renamed from user-name.
user-real-login-name renamed from user-real-name.
C names changed to Vuser_real_login_name, Vuser_login_name as well.
Diffstat (limited to 'src')
| -rw-r--r-- | src/editfns.c | 33 |
1 files changed, 17 insertions, 16 deletions
diff --git a/src/editfns.c b/src/editfns.c index 50cf607707d..2f1807828ca 100644 --- a/src/editfns.c +++ b/src/editfns.c | |||
| @@ -44,9 +44,9 @@ static long difftm (); | |||
| 44 | /* Some static data, and a function to initialize it for each run */ | 44 | /* Some static data, and a function to initialize it for each run */ |
| 45 | 45 | ||
| 46 | Lisp_Object Vsystem_name; | 46 | Lisp_Object Vsystem_name; |
| 47 | Lisp_Object Vuser_real_name; /* login name of current user ID */ | 47 | Lisp_Object Vuser_real_login_name; /* login name of current user ID */ |
| 48 | Lisp_Object Vuser_full_name; /* full name of current user */ | 48 | Lisp_Object Vuser_full_name; /* full name of current user */ |
| 49 | Lisp_Object Vuser_name; /* user name from LOGNAME or USER */ | 49 | Lisp_Object Vuser_login_name; /* user name from LOGNAME or USER */ |
| 50 | 50 | ||
| 51 | void | 51 | void |
| 52 | init_editfns () | 52 | init_editfns () |
| @@ -71,9 +71,9 @@ init_editfns () | |||
| 71 | /* We let the real user name default to "root" because that's quite | 71 | /* We let the real user name default to "root" because that's quite |
| 72 | accurate on MSDOG and because it lets Emacs find the init file. | 72 | accurate on MSDOG and because it lets Emacs find the init file. |
| 73 | (The DVX libraries override the Djgpp libraries here.) */ | 73 | (The DVX libraries override the Djgpp libraries here.) */ |
| 74 | Vuser_real_name = build_string (pw ? pw->pw_name : "root"); | 74 | Vuser_real_login_name = build_string (pw ? pw->pw_name : "root"); |
| 75 | #else | 75 | #else |
| 76 | Vuser_real_name = build_string (pw ? pw->pw_name : "unknown"); | 76 | Vuser_real_login_name = build_string (pw ? pw->pw_name : "unknown"); |
| 77 | #endif | 77 | #endif |
| 78 | 78 | ||
| 79 | /* Get the effective user name, by consulting environment variables, | 79 | /* Get the effective user name, by consulting environment variables, |
| @@ -90,13 +90,13 @@ init_editfns () | |||
| 90 | pw = (struct passwd *) getpwuid (geteuid ()); | 90 | pw = (struct passwd *) getpwuid (geteuid ()); |
| 91 | user_name = (char *) (pw ? pw->pw_name : "unknown"); | 91 | user_name = (char *) (pw ? pw->pw_name : "unknown"); |
| 92 | } | 92 | } |
| 93 | Vuser_name = build_string (user_name); | 93 | Vuser_login_name = build_string (user_name); |
| 94 | 94 | ||
| 95 | /* If the user name claimed in the environment vars differs from | 95 | /* If the user name claimed in the environment vars differs from |
| 96 | the real uid, use the claimed name to find the full name. */ | 96 | the real uid, use the claimed name to find the full name. */ |
| 97 | tem = Fstring_equal (Vuser_name, Vuser_real_name); | 97 | tem = Fstring_equal (Vuser_login_name, Vuser_real_login_name); |
| 98 | if (NILP (tem)) | 98 | if (NILP (tem)) |
| 99 | pw = (struct passwd *) getpwnam (XSTRING (Vuser_name)->data); | 99 | pw = (struct passwd *) getpwnam (XSTRING (Vuser_login_name)->data); |
| 100 | 100 | ||
| 101 | p = (unsigned char *) (pw ? USER_FULL_NAME : "unknown"); | 101 | p = (unsigned char *) (pw ? USER_FULL_NAME : "unknown"); |
| 102 | q = (unsigned char *) index (p, ','); | 102 | q = (unsigned char *) index (p, ','); |
| @@ -108,10 +108,11 @@ init_editfns () | |||
| 108 | /* Substitute the login name for the &, upcasing the first character. */ | 108 | /* Substitute the login name for the &, upcasing the first character. */ |
| 109 | if (q) | 109 | if (q) |
| 110 | { | 110 | { |
| 111 | r = (unsigned char *) alloca (strlen (p) + XSTRING (Vuser_name)->size + 1); | 111 | r = (unsigned char *) alloca (strlen (p) |
| 112 | + XSTRING (Vuser_login_name)->size + 1); | ||
| 112 | bcopy (p, r, q - p); | 113 | bcopy (p, r, q - p); |
| 113 | r[q - p] = 0; | 114 | r[q - p] = 0; |
| 114 | strcat (r, XSTRING (Vuser_name)->data); | 115 | strcat (r, XSTRING (Vuser_login_name)->data); |
| 115 | r[q - p] = UPCASE (r[q - p]); | 116 | r[q - p] = UPCASE (r[q - p]); |
| 116 | strcat (r, q + 1); | 117 | strcat (r, q + 1); |
| 117 | Vuser_full_name = build_string (r); | 118 | Vuser_full_name = build_string (r); |
| @@ -516,11 +517,11 @@ with that uid, or nil if there is no such user.") | |||
| 516 | /* Set up the user name info if we didn't do it before. | 517 | /* Set up the user name info if we didn't do it before. |
| 517 | (That can happen if Emacs is dumpable | 518 | (That can happen if Emacs is dumpable |
| 518 | but you decide to run `temacs -l loadup' and not dump. */ | 519 | but you decide to run `temacs -l loadup' and not dump. */ |
| 519 | if (INTEGERP (Vuser_name)) | 520 | if (INTEGERP (Vuser_login_name)) |
| 520 | init_editfns (); | 521 | init_editfns (); |
| 521 | 522 | ||
| 522 | if (NILP (uid)) | 523 | if (NILP (uid)) |
| 523 | return Vuser_name; | 524 | return Vuser_login_name; |
| 524 | 525 | ||
| 525 | CHECK_NUMBER (uid, 0); | 526 | CHECK_NUMBER (uid, 0); |
| 526 | pw = (struct passwd *) getpwuid (XINT (uid)); | 527 | pw = (struct passwd *) getpwuid (XINT (uid)); |
| @@ -537,9 +538,9 @@ This ignores the environment variables LOGNAME and USER, so it differs from\n\ | |||
| 537 | /* Set up the user name info if we didn't do it before. | 538 | /* Set up the user name info if we didn't do it before. |
| 538 | (That can happen if Emacs is dumpable | 539 | (That can happen if Emacs is dumpable |
| 539 | but you decide to run `temacs -l loadup' and not dump. */ | 540 | but you decide to run `temacs -l loadup' and not dump. */ |
| 540 | if (INTEGERP (Vuser_name)) | 541 | if (INTEGERP (Vuser_login_name)) |
| 541 | init_editfns (); | 542 | init_editfns (); |
| 542 | return Vuser_real_name; | 543 | return Vuser_real_login_name; |
| 543 | } | 544 | } |
| 544 | 545 | ||
| 545 | DEFUN ("user-uid", Fuser_uid, Suser_uid, 0, 0, 0, | 546 | DEFUN ("user-uid", Fuser_uid, Suser_uid, 0, 0, 0, |
| @@ -2283,10 +2284,10 @@ syms_of_editfns () | |||
| 2283 | DEFVAR_LISP ("user-full-name", &Vuser_full_name, | 2284 | DEFVAR_LISP ("user-full-name", &Vuser_full_name, |
| 2284 | "The full name of the user logged in."); | 2285 | "The full name of the user logged in."); |
| 2285 | 2286 | ||
| 2286 | DEFVAR_LISP ("user-name", &Vuser_name, | 2287 | DEFVAR_LISP ("user-login-name", &Vuser_login_name, |
| 2287 | "The user's name, taken from environment variables if possible."); | 2288 | "The user's name, taken from environment variables if possible."); |
| 2288 | 2289 | ||
| 2289 | DEFVAR_LISP ("user-real-name", &Vuser_real_name, | 2290 | DEFVAR_LISP ("user-real-login-name", &Vuser_real_login_name, |
| 2290 | "The user's name, based upon the real uid only."); | 2291 | "The user's name, based upon the real uid only."); |
| 2291 | 2292 | ||
| 2292 | defsubr (&Schar_equal); | 2293 | defsubr (&Schar_equal); |