#define HAVE_STRUCT_STAT_ST_GEN 1
#define HAVE_STRUCT_STAT_ST_BIRTHTIME 1
#define HAVE_STRUCT_STAT_ST_MTIMENSEC 1
+#define HAVE_STRUCT_STAT_ST_ATIM 0
#define HAVE_DEVNAME 1
#endif /* HAVE_CONFIG_H */
#include <time.h>
#include <unistd.h>
-#ifdef __APPLE__
-#define stat stat64
-#define fstat fstat64
-#define lstat lstat64
-#endif /* __APPLE__ */
-
#if HAVE_STRUCT_STAT_ST_FLAGS
#define DEF_F "%#Xf "
#define RAW_F "%f "
struct passwd *pw;
struct group *gr;
const struct timespec *tsp;
- struct timespec ts;
+ struct timespec ts = {0,0};
struct tm *tm;
int l, small, formats;
tsp = NULL;
- formats = 0;
- small = 0;
+// formats = 0;
+// small = 0;
/*
* First, pick out the data and tweak it based on hilo or
ts = *tsp; /* copy so we can muck with it */
small = (sizeof(ts.tv_sec) == 4);
data = ts.tv_sec;
- small = 1;
tm = localtime(&ts.tv_sec);
+ if (tm == NULL) {
+ ts.tv_sec = 0;
+ tm = localtime(&ts.tv_sec);
+ }
(void)strftime(path, sizeof(path), timefmt, tm);
sdata = path;
formats = FMTF_DECIMAL | FMTF_OCTAL | FMTF_UNSIGNED | FMTF_HEX |
small = (sizeof(st->st_flags) == 4);
data = st->st_flags;
sdata = NULL;
- formats = FMTF_DECIMAL | FMTF_OCTAL | FMTF_UNSIGNED | FMTF_HEX;
+ formats = FMTF_DECIMAL | FMTF_OCTAL | FMTF_UNSIGNED | FMTF_HEX |
+ FMTF_STRING;
+ if (ofmt == FMTF_STRING) {
+ small = 0;
+ data = 0;
+ snprintf(path, sizeof(path), "%s", fflagstostr(st->st_flags));
+ sdata = path;
+ }
if (ofmt == 0)
ofmt = FMTF_UNSIGNED;
break;