aboutsummaryrefslogtreecommitdiffstats
path: root/src/dired.c
diff options
context:
space:
mode:
authorPaul Eggert2012-04-21 17:53:32 -0700
committerPaul Eggert2012-04-21 17:53:32 -0700
commitbbd347f5f7e99da1a559dad818b5fa8f59c0901e (patch)
tree77c1fc54c2240b08d2859109d18cac8812a8ffb1 /src/dired.c
parente4ecdc9c71af4199129d5dd2db1a32ff6b725fe4 (diff)
parent9ee7d8b93cb143b473e6dffb708e777bc6fe5bd0 (diff)
downloademacs-bbd347f5f7e99da1a559dad818b5fa8f59c0901e.tar.gz
emacs-bbd347f5f7e99da1a559dad818b5fa8f59c0901e.zip
Merge from trunk.
Diffstat (limited to 'src/dired.c')
-rw-r--r--src/dired.c41
1 files changed, 41 insertions, 0 deletions
diff --git a/src/dired.c b/src/dired.c
index 6eedc824231..38dfa23c1bf 100644
--- a/src/dired.c
+++ b/src/dired.c
@@ -1018,6 +1018,45 @@ Comparison is in lexicographic order and case is significant. */)
1018 return Fstring_lessp (Fcar (f1), Fcar (f2)); 1018 return Fstring_lessp (Fcar (f1), Fcar (f2));
1019} 1019}
1020 1020
1021
1022DEFUN ("system-users", Fsystem_users, Ssystem_users, 0, 0, 0,
1023 doc: /* Return a list of user names currently registered in the system.
1024If we don't know how to determine that on this platform, just
1025return a list with one element, taken from `user-real-login-name'. */)
1026 (void)
1027{
1028 Lisp_Object users = Qnil;
1029#if defined HAVE_GETPWENT && defined HAVE_ENDPWENT
1030 struct passwd *pw;
1031
1032 while ((pw = getpwent ()))
1033 users = Fcons (DECODE_SYSTEM (build_string (pw->pw_name)), users);
1034
1035 endpwent ();
1036#endif
1037 if (EQ (users, Qnil))
1038 /* At least current user is always known. */
1039 users = Fcons (Vuser_real_login_name, Qnil);
1040 return users;
1041}
1042
1043DEFUN ("system-groups", Fsystem_groups, Ssystem_groups, 0, 0, 0,
1044 doc: /* Return a list of user group names currently registered in the system.
1045The value may be nil if not supported on this platform. */)
1046 (void)
1047{
1048 Lisp_Object groups = Qnil;
1049#if defined HAVE_GETGRENT && defined HAVE_ENDGRENT
1050 struct group *gr;
1051
1052 while ((gr = getgrent ()))
1053 groups = Fcons (DECODE_SYSTEM (build_string (gr->gr_name)), groups);
1054
1055 endgrent ();
1056#endif
1057 return groups;
1058}
1059
1021void 1060void
1022syms_of_dired (void) 1061syms_of_dired (void)
1023{ 1062{
@@ -1035,6 +1074,8 @@ syms_of_dired (void)
1035 defsubr (&Sfile_name_all_completions); 1074 defsubr (&Sfile_name_all_completions);
1036 defsubr (&Sfile_attributes); 1075 defsubr (&Sfile_attributes);
1037 defsubr (&Sfile_attributes_lessp); 1076 defsubr (&Sfile_attributes_lessp);
1077 defsubr (&Ssystem_users);
1078 defsubr (&Ssystem_groups);
1038 1079
1039 DEFVAR_LISP ("completion-ignored-extensions", Vcompletion_ignored_extensions, 1080 DEFVAR_LISP ("completion-ignored-extensions", Vcompletion_ignored_extensions,
1040 doc: /* Completion ignores file names ending in any string in this list. 1081 doc: /* Completion ignores file names ending in any string in this list.