diff options
| author | Eli Zaretskii | 2009-03-18 20:37:06 +0000 |
|---|---|---|
| committer | Eli Zaretskii | 2009-03-18 20:37:06 +0000 |
| commit | 7b1c38a4f233ce6eb249f0355d85d37f0c585946 (patch) | |
| tree | 92952f2a3e5e410f5209822866984ffdba2bf5d6 /src | |
| parent | 0be8a34397e64d018371f4f7ed727ca174b7c749 (diff) | |
| download | emacs-7b1c38a4f233ce6eb249f0355d85d37f0c585946.tar.gz emacs-7b1c38a4f233ce6eb249f0355d85d37f0c585946.zip | |
(Fuser_login_name): Support float arguments. Doc fix.
Diffstat (limited to 'src')
| -rw-r--r-- | src/editfns.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/editfns.c b/src/editfns.c index 2d45dba8fce..cfce1f2add6 100644 --- a/src/editfns.c +++ b/src/editfns.c | |||
| @@ -1278,12 +1278,13 @@ This is based on the effective uid, not the real uid. | |||
| 1278 | Also, if the environment variables LOGNAME or USER are set, | 1278 | Also, if the environment variables LOGNAME or USER are set, |
| 1279 | that determines the value of this function. | 1279 | that determines the value of this function. |
| 1280 | 1280 | ||
| 1281 | If optional argument UID is an integer, return the login name of the user | 1281 | If optional argument UID is an integer or a float, return the login name |
| 1282 | with that uid, or nil if there is no such user. */) | 1282 | of the user with that uid, or nil if there is no such user. */) |
| 1283 | (uid) | 1283 | (uid) |
| 1284 | Lisp_Object uid; | 1284 | Lisp_Object uid; |
| 1285 | { | 1285 | { |
| 1286 | struct passwd *pw; | 1286 | struct passwd *pw; |
| 1287 | uid_t id; | ||
| 1287 | 1288 | ||
| 1288 | /* Set up the user name info if we didn't do it before. | 1289 | /* Set up the user name info if we didn't do it before. |
| 1289 | (That can happen if Emacs is dumpable | 1290 | (That can happen if Emacs is dumpable |
| @@ -1294,9 +1295,9 @@ with that uid, or nil if there is no such user. */) | |||
| 1294 | if (NILP (uid)) | 1295 | if (NILP (uid)) |
| 1295 | return Vuser_login_name; | 1296 | return Vuser_login_name; |
| 1296 | 1297 | ||
| 1297 | CHECK_NUMBER (uid); | 1298 | id = (uid_t)XFLOATINT (uid); |
| 1298 | BLOCK_INPUT; | 1299 | BLOCK_INPUT; |
| 1299 | pw = (struct passwd *) getpwuid (XINT (uid)); | 1300 | pw = (struct passwd *) getpwuid (id); |
| 1300 | UNBLOCK_INPUT; | 1301 | UNBLOCK_INPUT; |
| 1301 | return (pw ? build_string (pw->pw_name) : Qnil); | 1302 | return (pw ? build_string (pw->pw_name) : Qnil); |
| 1302 | } | 1303 | } |