aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog5
-rw-r--r--src/dired.c41
2 files changed, 46 insertions, 0 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index e321a70d4c3..bcb2edee96f 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,8 @@
12012-04-17 Dmitry Antipov <dmantipov@yandex.ru>
2
3 * dired.c (Fsystem_users, Fsystem_groups): New functions. (Bug#7900)
4 (syms_of_dired): Add them.
5
12012-04-16 Paul Eggert <eggert@cs.ucla.edu> 62012-04-16 Paul Eggert <eggert@cs.ucla.edu>
2 7
3 Fix minor alloc.c problems found by static checking. 8 Fix minor alloc.c problems found by static checking.
diff --git a/src/dired.c b/src/dired.c
index 9b0f94a0760..2c634b9ca6f 100644
--- a/src/dired.c
+++ b/src/dired.c
@@ -1015,6 +1015,45 @@ Comparison is in lexicographic order and case is significant. */)
1015 return Fstring_lessp (Fcar (f1), Fcar (f2)); 1015 return Fstring_lessp (Fcar (f1), Fcar (f2));
1016} 1016}
1017 1017
1018
1019DEFUN ("system-users", Fsystem_users, Ssystem_users, 0, 0, 0,
1020 doc: /* Return a list of user names currently registered in the system.
1021The value may be nil if not supported on this platform. */)
1022 (void)
1023{
1024 Lisp_Object users = Qnil;
1025#if defined(HAVE_GETPWENT) && defined(HAVE_ENDPWENT)
1026 struct passwd *pw;
1027
1028 while ((pw = getpwent ()))
1029 users = Fcons (DECODE_SYSTEM (build_string (pw->pw_name)), users);
1030
1031 endpwent ();
1032#endif
1033 if (EQ (users, Qnil))
1034 /* At least current user is always known. */
1035 users = Fcons (Vuser_real_login_name, Qnil);
1036 return users;
1037}
1038
1039DEFUN ("system-groups", Fsystem_groups, Ssystem_groups, 0, 0, 0,
1040 doc: /* Return a list of user group names currently registered in the system.
1041The value may be nil if not supported on this platform. */)
1042 (void)
1043{
1044 Lisp_Object groups = Qnil;
1045#if defined(HAVE_GETGRENT) && defined(HAVE_ENDGRENT)
1046 struct group *gr;
1047 int length;
1048
1049 while ((gr = getgrent ()))
1050 groups = Fcons (DECODE_SYSTEM (build_string (gr->gr_name)), groups);
1051
1052 endgrent ();
1053#endif
1054 return groups;
1055}
1056
1018void 1057void
1019syms_of_dired (void) 1058syms_of_dired (void)
1020{ 1059{
@@ -1032,6 +1071,8 @@ syms_of_dired (void)
1032 defsubr (&Sfile_name_all_completions); 1071 defsubr (&Sfile_name_all_completions);
1033 defsubr (&Sfile_attributes); 1072 defsubr (&Sfile_attributes);
1034 defsubr (&Sfile_attributes_lessp); 1073 defsubr (&Sfile_attributes_lessp);
1074 defsubr (&Ssystem_users);
1075 defsubr (&Ssystem_groups);
1035 1076
1036 DEFVAR_LISP ("completion-ignored-extensions", Vcompletion_ignored_extensions, 1077 DEFVAR_LISP ("completion-ignored-extensions", Vcompletion_ignored_extensions,
1037 doc: /* Completion ignores file names ending in any string in this list. 1078 doc: /* Completion ignores file names ending in any string in this list.