diff options
Diffstat (limited to 'data.c')
| -rw-r--r-- | data.c | 14 |
1 files changed, 10 insertions, 4 deletions
| @@ -185,14 +185,20 @@ d_char *user_list(void) | |||
| 185 | } | 185 | } |
| 186 | 186 | ||
| 187 | 187 | ||
| 188 | double mtime(const char *fn) | 188 | double mtime_nl(const char *fn, int *n_link) |
| 189 | /* returns the mtime of a file or directory, or 0.0 */ | 189 | /* returns the mtime and number of links of a file or directory, or 0.0 */ |
| 190 | { | 190 | { |
| 191 | struct stat st; | 191 | struct stat st; |
| 192 | double r = 0.0; | 192 | double r = 0.0; |
| 193 | int n = 0; | ||
| 194 | |||
| 195 | if (fn && stat(fn, &st) != -1) { | ||
| 196 | r = (double) st.st_mtim.tv_sec; | ||
| 197 | n = st.st_nlink; | ||
| 198 | } | ||
| 193 | 199 | ||
| 194 | if (fn && stat(fn, &st) != -1) | 200 | if (*n_link) |
| 195 | r = (double)st.st_mtim.tv_sec; | 201 | *n_link = n; |
| 196 | 202 | ||
| 197 | return r; | 203 | return r; |
| 198 | } | 204 | } |