Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
emacs
emacs
Commits
ffb4c76d
Commit
ffb4c76d
authored
Oct 30, 2018
by
Jules Tamagnan
Committed by
Eli Zaretskii
Nov 10, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
src/editfns.c (group-name): New function.
parent
4f0e5422
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
31 additions
and
0 deletions
+31
-0
doc/lispref/os.texi
doc/lispref/os.texi
+5
-0
etc/NEWS
etc/NEWS
+3
-0
src/editfns.c
src/editfns.c
+16
-0
test/src/editfns-tests.el
test/src/editfns-tests.el
+7
-0
No files found.
doc/lispref/os.texi
View file @
ffb4c76d
...
@@ -1230,6 +1230,11 @@ groups on the system. If Emacs cannot retrieve this information, the
...
@@ -1230,6 +1230,11 @@ groups on the system. If Emacs cannot retrieve this information, the
return value is @code{nil}.
return value is @code{nil}.
@end defun
@end defun
@defun user-login-name gid
This runction returns the group name that corresponds to @var{gid},
or @code{nil} if there is no such group.
@end defun
@node Time of Day
@node Time of Day
@section Time of Day
@section Time of Day
...
...
etc/NEWS
View file @
ffb4c76d
...
@@ -1263,6 +1263,9 @@ where there's no better alternative. We believe that the incorrect
...
@@ -1263,6 +1263,9 @@ where there's no better alternative. We believe that the incorrect
uses of this function all but disappeared by now, so we are
uses of this function all but disappeared by now, so we are
un-obsoleting it.
un-obsoleting it.
+++
** New function 'group-name' returns a group name based on a group-GID
* Changes in Emacs 27.1 on Non-Free Operating Systems
* Changes in Emacs 27.1 on Non-Free Operating Systems
...
...
src/editfns.c
View file @
ffb4c76d
...
@@ -1143,6 +1143,21 @@ of the user with that uid, or nil if there is no such user. */)
...
@@ -1143,6 +1143,21 @@ of the user with that uid, or nil if there is no such user. */)
return
(
pw
?
build_string
(
pw
->
pw_name
)
:
Qnil
);
return
(
pw
?
build_string
(
pw
->
pw_name
)
:
Qnil
);
}
}
DEFUN
(
"group-name"
,
Fgroup_name
,
Sgroup_name
,
1
,
1
,
0
,
doc
:
/* If argument GID is an integer or a float, return the login name
of the group with that gid, or nil if there is no such GID. */
)
(
Lisp_Object
gid
)
{
struct
group
*
gr
;
gid_t
id
;
CONS_TO_INTEGER
(
gid
,
gid_t
,
id
);
block_input
();
gr
=
getgrgid
(
id
);
unblock_input
();
return
(
gr
?
build_string
(
gr
->
gr_name
)
:
Qnil
);
}
DEFUN
(
"user-real-login-name"
,
Fuser_real_login_name
,
Suser_real_login_name
,
DEFUN
(
"user-real-login-name"
,
Fuser_real_login_name
,
Suser_real_login_name
,
0
,
0
,
0
,
0
,
0
,
0
,
doc
:
/* Return the name of the user's real uid, as a string.
doc
:
/* Return the name of the user's real uid, as a string.
...
@@ -4487,6 +4502,7 @@ it to be non-nil. */);
...
@@ -4487,6 +4502,7 @@ it to be non-nil. */);
defsubr
(
&
Sinsert_byte
);
defsubr
(
&
Sinsert_byte
);
defsubr
(
&
Suser_login_name
);
defsubr
(
&
Suser_login_name
);
defsubr
(
&
Sgroup_name
);
defsubr
(
&
Suser_real_login_name
);
defsubr
(
&
Suser_real_login_name
);
defsubr
(
&
Suser_uid
);
defsubr
(
&
Suser_uid
);
defsubr
(
&
Suser_real_uid
);
defsubr
(
&
Suser_real_uid
);
...
...
test/src/editfns-tests.el
View file @
ffb4c76d
...
@@ -351,4 +351,11 @@
...
@@ -351,4 +351,11 @@
(
should
(
equal
(
format
"%-#50.40x"
v3
)
(
should
(
equal
(
format
"%-#50.40x"
v3
)
"-0x000000003ffffffffffffffe000000000000000 "
))))
"-0x000000003ffffffffffffffe000000000000000 "
))))
(
ert-deftest
group-name
()
(
let
((
list
`
((
0
.
"root"
)
(
1000
.
,
(
user-login-name
1000
))
(
1212345
.
nil
))))
(
dolist
(
test
list
)
(
should
(
equal
(
group-name
(
car
test
))
(
cdr
test
))))))
;;; editfns-tests.el ends here
;;; editfns-tests.el ends here
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment