Add ctime,atime,mtime printing.
This commit is contained in:
parent
45875d3d9e
commit
34cdc3ca09
27
kofu.c
27
kofu.c
@ -11,6 +11,7 @@
|
||||
#include <sys/stat.h>
|
||||
#include <fcntl.h>
|
||||
#include <assert.h>
|
||||
#include <time.h>
|
||||
#include "kolibri.h"
|
||||
#include "trace.h"
|
||||
|
||||
@ -266,8 +267,32 @@ void kofu_stat(int argc, const char **argv) {
|
||||
f70.path = argv[1];
|
||||
kos_lfn(&f70, &r);
|
||||
print_f70_status(&r, 0);
|
||||
if (r.status != F70_ERROR_SUCCESS)
|
||||
return;
|
||||
printf("attr: 0x%2.2x\n", file.attr);
|
||||
printf("size: %llu\n", file.size);
|
||||
if (!file.attr) { // don't show size for dirs
|
||||
printf("size: %llu\n", file.size);
|
||||
}
|
||||
|
||||
#if PRINT_DATE_TIME == 1
|
||||
time_t time;
|
||||
struct tm *t;
|
||||
time = kos_time_to_epoch(&file.ctime);
|
||||
t = localtime(&time);
|
||||
printf("ctime: %4.4i.%2.2i.%2.2i %2.2i:%2.2i:%2.2i\n",
|
||||
t->tm_year + 1900, t->tm_mon + 1, t->tm_mday,
|
||||
t->tm_hour, t->tm_min, t->tm_sec);
|
||||
time = kos_time_to_epoch(&file.atime);
|
||||
t = localtime(&time);
|
||||
printf("atime: %4.4i.%2.2i.%2.2i %2.2i:%2.2i:%2.2i\n",
|
||||
t->tm_year + 1900, t->tm_mon + 1, t->tm_mday,
|
||||
t->tm_hour, t->tm_min, t->tm_sec);
|
||||
time = kos_time_to_epoch(&file.mtime);
|
||||
t = localtime(&time);
|
||||
printf("mtime: %4.4i.%2.2i.%2.2i %2.2i:%2.2i:%2.2i\n",
|
||||
t->tm_year + 1900, t->tm_mon + 1, t->tm_mday,
|
||||
t->tm_hour, t->tm_min, t->tm_sec);
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -68,7 +68,7 @@ typedef struct {
|
||||
uint32_t version;
|
||||
uint32_t cnt;
|
||||
uint32_t total_cnt;
|
||||
uint32_t reserved[5];
|
||||
uint32_t zeroed[5];
|
||||
bdfe_t bdfes[0];
|
||||
} f70s1info_t;
|
||||
|
||||
|
5
makefile
5
makefile
@ -6,7 +6,7 @@ CFLAGS_32=-m32
|
||||
LDFLAGS=
|
||||
LDFLAGS_32=-m32
|
||||
|
||||
all: kofu kofuse kolibri.sym kolibri.prp kolibri.lst tools/mkdirrange tools/mkfilepattern
|
||||
all: kofu kofuse kolibri.sym kolibri.prp kolibri.lst tags tools/mkdirrange tools/mkfilepattern
|
||||
|
||||
kofu: kofu.o kolibri.o trace.o trace_lbr.o trace_lwp.o cio.o
|
||||
$(CC) $(LDFLAGS) $(LDFLAGS_32) $^ -o $@
|
||||
@ -26,6 +26,9 @@ kolibri.sym: kolibri.fas
|
||||
kolibri.lst: kolibri.fas
|
||||
listing kolibri.fas kolibri.lst
|
||||
|
||||
tags: kolibri.sym
|
||||
fasmtags.py $<
|
||||
|
||||
trace.o: trace.c trace.h trace_lbr.h
|
||||
$(CC) $(CFLAGS) $(CFLAGS_32) -c $<
|
||||
|
||||
|
@ -1,6 +1,24 @@
|
||||
/> disk_add ../img/s512_xfs_v4_files.img hd0
|
||||
/> disk_add ../img/s512_xfs_v4_ftype0_b4k_n2b.img hd0
|
||||
/hd0/1: xfs
|
||||
/> stat /hd0/1/no_hole
|
||||
#stat /hd0/1/sf/.
|
||||
/> stat /hd0/1/sf/..
|
||||
status = 0 success
|
||||
attr: 0x00
|
||||
size: 65536
|
||||
attr: 0x10
|
||||
/> stat /hd0/1/sf/d0000000000_
|
||||
status = 0 success
|
||||
attr: 0x10
|
||||
/> stat /hd0/1/sf/d0000000001_x
|
||||
status = 0 success
|
||||
attr: 0x10
|
||||
/> stat /hd0/1/sf/d0000000002_xx
|
||||
status = 0 success
|
||||
attr: 0x10
|
||||
/> stat /hd0/1/sf/d0000000003_xxx
|
||||
status = 5 file_not_found
|
||||
|
||||
/> cd /hd0/1/sf
|
||||
sf> stat d0000000001_x
|
||||
status = 0 success
|
||||
attr: 0x10
|
||||
sf> stat d0000000003_xxx
|
||||
status = 5 file_not_found
|
||||
|
@ -1,2 +1,11 @@
|
||||
disk_add ../img/s512_xfs_v4_files.img hd0
|
||||
stat /hd0/1/no_hole
|
||||
disk_add ../img/s512_xfs_v4_ftype0_b4k_n2b.img hd0
|
||||
#stat /hd0/1/sf/.
|
||||
stat /hd0/1/sf/..
|
||||
stat /hd0/1/sf/d0000000000_
|
||||
stat /hd0/1/sf/d0000000001_x
|
||||
stat /hd0/1/sf/d0000000002_xx
|
||||
stat /hd0/1/sf/d0000000003_xxx
|
||||
|
||||
cd /hd0/1/sf
|
||||
stat d0000000001_x
|
||||
stat d0000000003_xxx
|
||||
|
Loading…
Reference in New Issue
Block a user