Userspace: Use printf length modifiers when printing
This commit is contained in:
parent
1cd12b5f16
commit
85b1252b9e
|
@ -26,11 +26,11 @@ int parse_int(const char* val)
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
void print_time(uint64_t start_ns, uint64_t end_ns, int transfered)
|
void print_time(uint64_t start_ns, uint64_t end_ns, size_t transfered)
|
||||||
{
|
{
|
||||||
static bool first = true;
|
static bool first = true;
|
||||||
uint64_t duration_ns = end_ns - start_ns;
|
uint64_t duration_ns = end_ns - start_ns;
|
||||||
printf("%s%d bytes copied, %d.%09d s\e[K\n", (first ? "" : "\e[F"), transfered, (int)(duration_ns / 1'000'000'000), (int)(duration_ns % 1'000'000'000));
|
printf("%s%zu bytes copied, %d.%09d s\e[K\n", (first ? "" : "\e[F"), transfered, (int)(duration_ns / 1'000'000'000), (int)(duration_ns % 1'000'000'000));
|
||||||
first = false;
|
first = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -65,9 +65,9 @@ int main(int argc, char** argv)
|
||||||
access[10] = '\0';
|
access[10] = '\0';
|
||||||
|
|
||||||
printf(" File: %s\n", argv[i]);
|
printf(" File: %s\n", argv[i]);
|
||||||
printf(" Size: %-15d Blocks: %-10d IO Block: %-6d %s\n", (int)st.st_size, (int)st.st_blocks, (int)st.st_blksize, type);
|
printf(" Size: %-15ld Blocks: %-10ld IO Block: %-6ld %s\n", st.st_size, st.st_blocks, st.st_blksize, type);
|
||||||
printf("Device: %d,%-5d Inode: %-11d Links: %-5d Device type: %d,%d\n", (int)major(st.st_dev), (int)minor(st.st_dev), (int)st.st_ino, (int)st.st_nlink, (int)major(st.st_rdev), (int)minor(st.st_rdev));
|
printf("Device: %lu,%-5lu Inode: %-11lu Links: %-5lu Device type: %lu,%lu\n", major(st.st_dev), minor(st.st_dev), st.st_ino, st.st_nlink, major(st.st_rdev), minor(st.st_rdev));
|
||||||
printf("Access: (%04o/%s) Uid: %5d Gid: %5d\n", (int)(st.st_mode & S_IRWXMASK), access, (int)st.st_uid, (int)st.st_gid);
|
printf("Access: (%04o/%s) Uid: %5d Gid: %5d\n", st.st_mode & S_IRWXMASK, access, st.st_uid, st.st_gid);
|
||||||
printf("Access: "); print_timestamp(st.st_atim); printf("\n");
|
printf("Access: "); print_timestamp(st.st_atim); printf("\n");
|
||||||
printf("Modify: "); print_timestamp(st.st_mtim); printf("\n");
|
printf("Modify: "); print_timestamp(st.st_mtim); printf("\n");
|
||||||
printf("Change: "); print_timestamp(st.st_ctim); printf("\n");
|
printf("Change: "); print_timestamp(st.st_ctim); printf("\n");
|
||||||
|
|
Loading…
Reference in New Issue