[librep] added file-uid-p and file-gid-p
- From: Christopher Bratusek <chrisb src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [librep] added file-uid-p and file-gid-p
- Date: Mon, 4 Jan 2010 18:53:38 +0000 (UTC)
commit 45f6396f7cf6fa6c20d84ab5ab4a17b0880c3729
Author: Christopher Roy Bratusek <chris nanolx org>
Date: Mon Jan 4 19:52:50 2010 +0100
added file-uid-p and file-gid-p
ChangeLog | 8 ++++++++
debian/librep9.symbols | 4 ++++
man/news.texi | 6 ++++++
src/files.c | 42 ++++++++++++++++++++++++++++++++++++++++++
src/librep.sym | 4 ++++
src/repint.h | 2 ++
src/repint_subrs.h | 2 ++
src/unix_files.c | 20 ++++++++++++++++++++
8 files changed, 88 insertions(+), 0 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 53ed36c..b3ae15e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2010-01-04 Christopher Bratusek <zanghar freenet de>
+ * debian/librep9.symbols
+ * src/repint.h
+ * src/repint_subrs.h
+ * src/files.c
+ * src/unix_files.c
+ * src/librep.sym: added file-uid-p and file-gid-p
+
2010-01-03 Christopher Bratusek <zanghar freenet de>
* debian/rules: don't remove config.{guess,sub} on rules/clean
diff --git a/debian/librep9.symbols b/debian/librep9.symbols
index bee48a3..d5e45d7 100644
--- a/debian/librep9.symbols
+++ b/debian/librep9.symbols
@@ -108,6 +108,8 @@ librep.so.9 librep9 #MINVER#
Ffile_name_nondirectory Base 0.17+svn20070119
Ffile_nlinks Base 0.17+svn20070119
Ffile_owner_p Base 0.17+svn20070119
+ Ffile_gid_p Base 0.90.5~100104-1nano
+ Ffile_uid_p Base 0.90.5~100104-1nano
Ffile_readable_p Base 0.17+svn20070119
Ffile_regular_p Base 0.17+svn20070119
Ffile_size Base 0.17+svn20070119
@@ -438,6 +440,8 @@ librep.so.9 librep9 #MINVER#
Qfile_name_nondirectory Base 0.17+svn20070119
Qfile_nlinks Base 0.17+svn20070119
Qfile_owner_p Base 0.17+svn20070119
+ Qfile_gid_p Base 0.90.5~100104-1nano
+ Qfile_uid_p Base 0.90.5~100104-1nano
Qfile_readable_p Base 0.17+svn20070119
Qfile_regular_p Base 0.17+svn20070119
Qfile_size Base 0.17+svn20070119
diff --git a/man/news.texi b/man/news.texi
index b3c3e02..d3fd051 100644
--- a/man/news.texi
+++ b/man/news.texi
@@ -19,6 +19,12 @@ sawfish on several architectures. From this version on, we don't ship it.
@item Autotools improvements (Makefile, autogen.sh & Co.)
[Christopher Bratusek]
+
+ item Added @code{file-gid-p} function for getting the gid of a file
+[Christopher Bratusek]
+
+ item Added @code{file-uid-p} function for getting the uid of a file
+[Christopher Bratusek]
@end itemize
@heading 0.90.4
diff --git a/src/files.c b/src/files.c
index abfbdcf..d06cdbb 100644
--- a/src/files.c
+++ b/src/files.c
@@ -132,6 +132,8 @@ DEFSYM(file_regular_p, "file-regular-p");
DEFSYM(file_directory_p, "file-directory-p");
DEFSYM(file_symlink_p, "file-symlink-p");
DEFSYM(file_owner_p, "file-owner-p");
+DEFSYM(file_gid_p, "file-gid-p");
+DEFSYM(file_uid_p, "file-uid-p");
DEFSYM(file_nlinks, "file-nlinks");
DEFSYM(file_size, "file-size");
DEFSYM(file_modes, "file-modes");
@@ -1320,6 +1322,42 @@ same as that of any files written by the editor.
Qfile_owner_p, 1, file);
}
+DEFUN("file-gid-p", Ffile_gid_p, Sfile_gid_p,
+ (repv file), rep_Subr1) /*
+::doc::rep.io.files#file-gid-p::
+file-gid-p FILE-NAME
+
+Returns the gid of the file called FILE-NAME
+::end:: */
+{
+ repv handler = rep_expand_and_get_handler(&file, op_file_gid_p);
+ if (!handler)
+ return handler;
+ if(rep_NILP(handler))
+ return rep_file_gid_p(file);
+ else
+ return rep_call_file_handler(handler, op_file_gid_p,
+ Qfile_gid_p, 1, file);
+}
+
+DEFUN("file-uid-p", Ffile_uid_p, Sfile_uid_p,
+ (repv file), rep_Subr1) /*
+::doc::rep.io.files#file-uid-p::
+file-uid-p FILE-NAME
+
+Returns the uid of the file called FILE-NAME
+::end:: */
+{
+ repv handler = rep_expand_and_get_handler(&file, op_file_uid_p);
+ if (!handler)
+ return handler;
+ if (rep_NILP(handler))
+ return rep_file_uid_p(file);
+ else
+ return rep_call_file_handler(handler, op_file_uid_p,
+ Qfile_uid_p, 1, file);
+}
+
DEFUN("file-nlinks", Ffile_nlinks, Sfile_nlinks,
(repv file), rep_Subr1) /*
::doc:rep.io.files#file-nlinks::
@@ -1677,6 +1715,8 @@ rep_files_init(void)
rep_INTERN(file_directory_p);
rep_INTERN(file_symlink_p);
rep_INTERN(file_owner_p);
+ rep_INTERN(file_gid_p);
+ rep_INTERN(file_uid_p);
rep_INTERN(file_nlinks);
rep_INTERN(file_size);
rep_INTERN(file_modes);
@@ -1733,6 +1773,8 @@ rep_files_init(void)
rep_ADD_SUBR(Sfile_directory_p);
rep_ADD_SUBR(Sfile_symlink_p);
rep_ADD_SUBR(Sfile_owner_p);
+ rep_ADD_SUBR(Sfile_gid_p);
+ rep_ADD_SUBR(Sfile_uid_p);
rep_ADD_SUBR(Sfile_nlinks);
rep_ADD_SUBR(Sfile_size);
rep_ADD_SUBR(Sfile_modes);
diff --git a/src/librep.sym b/src/librep.sym
index 4caec47..6611044 100644
--- a/src/librep.sym
+++ b/src/librep.sym
@@ -106,6 +106,8 @@ Ffile_name_directory
Ffile_name_nondirectory
Ffile_nlinks
Ffile_owner_p
+Ffile_gid_p
+Ffile_uid_p
Ffile_readable_p
Ffile_regular_p
Ffile_size
@@ -436,6 +438,8 @@ Qfile_name_directory
Qfile_name_nondirectory
Qfile_nlinks
Qfile_owner_p
+Qfile_gid_p
+Qfile_uid_p
Qfile_readable_p
Qfile_regular_p
Qfile_size
diff --git a/src/repint.h b/src/repint.h
index b6f031b..50ef0e7 100644
--- a/src/repint.h
+++ b/src/repint.h
@@ -85,6 +85,8 @@ enum file_ops {
op_file_directory_p,
op_file_symlink_p,
op_file_owner_p,
+ op_file_gid_p,
+ op_file_uid_p,
op_file_nlinks,
op_file_size,
op_file_modes,
diff --git a/src/repint_subrs.h b/src/repint_subrs.h
index 9d5d9d5..d7b8a8d 100644
--- a/src/repint_subrs.h
+++ b/src/repint_subrs.h
@@ -208,6 +208,8 @@ extern repv rep_file_regular_p(repv file);
extern repv rep_file_directory_p(repv file);
extern repv rep_file_symlink_p(repv file);
extern repv rep_file_owner_p(repv file);
+extern repv rep_file_gid_p(repv file);
+extern repv rep_file_uid_p(repv file);
extern repv rep_file_nlinks(repv file);
extern repv rep_file_size(repv file);
extern repv rep_file_modes(repv file);
diff --git a/src/unix_files.c b/src/unix_files.c
index 840eb8e..aa08442 100644
--- a/src/unix_files.c
+++ b/src/unix_files.c
@@ -432,6 +432,26 @@ rep_file_owner_p(repv file)
}
repv
+rep_file_gid_p(repv file)
+{
+ struct stat *st = stat_file(file);
+ if(st != 0)
+ return rep_MAKE_INT(st->st_gid & 07777);
+ else
+ return Qnil;
+}
+
+repv
+rep_file_uid_p(repv file)
+{
+ struct stat *st = stat_file(file);
+ if(st != 0)
+ return rep_MAKE_INT(st->st_uid & 07777);
+ else
+ return Qnil;
+}
+
+repv
rep_file_nlinks(repv file)
{
struct stat *st = stat_file(file);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]