summaryrefslogtreecommitdiff
path: root/data.c
diff options
context:
space:
mode:
authordefault <nobody@localhost>2022-11-25 13:33:13 +0100
committerdefault <nobody@localhost>2022-11-25 13:33:13 +0100
commit2d7c327cbf08a7ebc12df2818289af5d923c48de (patch)
tree600f9ea61567e392fa8fde749a98c58b94af963e /data.c
parentafeec970a38ad91fc00ab50efaf42723c38cefbf (diff)
New function mtime_nl().
Diffstat (limited to 'data.c')
-rw-r--r--data.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/data.c b/data.c
index 1febf7a..bb31096 100644
--- a/data.c
+++ b/data.c
@@ -185,14 +185,20 @@ d_char *user_list(void)
}
-double mtime(const char *fn)
-/* returns the mtime of a file or directory, or 0.0 */
+double mtime_nl(const char *fn, int *n_link)
+/* returns the mtime and number of links of a file or directory, or 0.0 */
{
struct stat st;
double r = 0.0;
+ int n = 0;
+
+ if (fn && stat(fn, &st) != -1) {
+ r = (double) st.st_mtim.tv_sec;
+ n = st.st_nlink;
+ }
- if (fn && stat(fn, &st) != -1)
- r = (double)st.st_mtim.tv_sec;
+ if (*n_link)
+ *n_link = n;
return r;
}