mirror of
https://codeberg.org/grunfink/snac2.git
synced 2024-11-10 03:50:38 +03:00
New function mtime_nl().
This commit is contained in:
parent
afeec970a3
commit
2d7c327cbf
14
data.c
14
data.c
@ -185,14 +185,20 @@ d_char *user_list(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
double mtime(const char *fn)
|
double mtime_nl(const char *fn, int *n_link)
|
||||||
/* returns the mtime of a file or directory, or 0.0 */
|
/* returns the mtime and number of links of a file or directory, or 0.0 */
|
||||||
{
|
{
|
||||||
struct stat st;
|
struct stat st;
|
||||||
double r = 0.0;
|
double r = 0.0;
|
||||||
|
int n = 0;
|
||||||
|
|
||||||
if (fn && stat(fn, &st) != -1)
|
if (fn && stat(fn, &st) != -1) {
|
||||||
r = (double)st.st_mtim.tv_sec;
|
r = (double) st.st_mtim.tv_sec;
|
||||||
|
n = st.st_nlink;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (*n_link)
|
||||||
|
*n_link = n;
|
||||||
|
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
3
snac.h
3
snac.h
@ -50,7 +50,8 @@ int check_password(char *uid, char *passwd, char *hash);
|
|||||||
void srv_archive(char *direction, char *req, char *payload, int p_size,
|
void srv_archive(char *direction, char *req, char *payload, int p_size,
|
||||||
int status, char *headers, char *body, int b_size);
|
int status, char *headers, char *body, int b_size);
|
||||||
|
|
||||||
double mtime(const char *fn);
|
double mtime_nl(const char *fn, int *n_link);
|
||||||
|
#define mtime(fn) mtime_nl(fn, NULL)
|
||||||
|
|
||||||
int index_add(const char *fn, const char *md5);
|
int index_add(const char *fn, const char *md5);
|
||||||
int index_del(const char *fn, const char *md5);
|
int index_del(const char *fn, const char *md5);
|
||||||
|
Loading…
Reference in New Issue
Block a user