28 lines
585 B
C
28 lines
585 B
C
#ifndef _GET_STAT_H
|
|
#define _GET_STAT_H
|
|
|
|
#include <stdio.h>
|
|
#include <errno.h>
|
|
#include <string.h>
|
|
#include <sys/stat.h>
|
|
|
|
int mu_get_stat(const char *prog_name, const char *path, struct stat *stat_path) {
|
|
if (stat(path, stat_path)) {
|
|
fprintf(stderr, "%s: unable to stat %s: %s\n", prog_name, path, strerror(errno));
|
|
return 1;
|
|
}
|
|
|
|
return 0;
|
|
}
|
|
|
|
int mu_get_lstat(const char *prog_name, const char *path, struct stat *stat_path) {
|
|
if (lstat(path, stat_path)) {
|
|
fprintf(stderr, "%s: unable to stat %s: %s\n", prog_name, path, strerror(errno));
|
|
return 1;
|
|
}
|
|
|
|
return 0;
|
|
}
|
|
|
|
#endif
|