Make size in stat.h be a uint64
Supporting print long using %l (a bit of cheat) Modify ls to print size using %l We should probably update size in inode too.
This commit is contained in:
parent
6bfb078b14
commit
fab5e7c1de
|
@ -3,9 +3,9 @@
|
||||||
#define T_DEVICE 3 // Device
|
#define T_DEVICE 3 // Device
|
||||||
|
|
||||||
struct stat {
|
struct stat {
|
||||||
short type; // Type of file
|
|
||||||
int dev; // File system's disk device
|
int dev; // File system's disk device
|
||||||
uint ino; // Inode number
|
uint ino; // Inode number
|
||||||
|
short type; // Type of file
|
||||||
short nlink; // Number of links to file
|
short nlink; // Number of links to file
|
||||||
uint size; // Size of file in bytes
|
uint64 size; // Size of file in bytes
|
||||||
};
|
};
|
||||||
|
|
|
@ -43,7 +43,7 @@ ls(char *path)
|
||||||
|
|
||||||
switch(st.type){
|
switch(st.type){
|
||||||
case T_FILE:
|
case T_FILE:
|
||||||
printf(1, "%s %d %d %d\n", fmtname(path), st.type, st.ino, st.size);
|
printf(1, "%s %d %d %l\n", fmtname(path), st.type, st.ino, st.size);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case T_DIR:
|
case T_DIR:
|
||||||
|
|
|
@ -68,6 +68,8 @@ printf(int fd, const char *fmt, ...)
|
||||||
} else if(state == '%'){
|
} else if(state == '%'){
|
||||||
if(c == 'd'){
|
if(c == 'd'){
|
||||||
printint(fd, va_arg(ap, int), 10, 1);
|
printint(fd, va_arg(ap, int), 10, 1);
|
||||||
|
} else if(c == 'l') {
|
||||||
|
printint(fd, va_arg(ap, uint64), 10, 0);
|
||||||
} else if(c == 'x') {
|
} else if(c == 'x') {
|
||||||
printint(fd, va_arg(ap, int), 16, 0);
|
printint(fd, va_arg(ap, int), 16, 0);
|
||||||
} else if(c == 'p') {
|
} else if(c == 'p') {
|
||||||
|
|
Loading…
Reference in a new issue