This commit is contained in:
Your Name 2024-04-17 22:49:08 +03:00
parent 4d278767ef
commit 365752eb0e
2 changed files with 4 additions and 4 deletions

View File

@ -75,7 +75,7 @@ struct d_node **list(const char *path, size_t *nfiles, int *ret) {
return NULL;
}
struct d_node *dn, *cur;
struct d_node *dn = NULL, *cur;
struct dirent *ep;
while ((ep = readdir(dp)) != NULL) {
@ -227,10 +227,10 @@ int print(const struct d_node *node) {
char *gr_name = (gr != 0) ? gr->gr_name : "nobody";
char *pw_name = (pw != 0) ? pw->pw_name : "nobody";
if (h_flag)
ret += printf(" %4u %4s %6s %6s %s ", node->stats.st_nlink, pw_name, gr_name, mu_humansize(node->stats.st_size, 1024), get_date(node->stats.st_mtime));
ret += printf(" %4u %4s %6s %6s %s ", (unsigned int)node->stats.st_nlink, pw_name, gr_name, mu_humansize(node->stats.st_size, 1024), get_date(node->stats.st_mtime));
else
ret += printf(" %4u %4s %6s %10ld %s ", node->stats.st_nlink, pw_name, gr_name, node->stats.st_size, get_date(node->stats.st_mtime));
ret += printf(" %4u %4s %6s %10ld %s ", (unsigned int)node->stats.st_nlink, pw_name, gr_name, node->stats.st_size, get_date(node->stats.st_mtime));
}
if (c_flag && p_flag)

View File

@ -24,7 +24,7 @@ int nl(const char *path) {
size_t size = 0;
while (getline(&buf, &size, fp) != EOF) {
if (strlen(buf) > 1)
fprintf(stdout, "%*d\t%s", w_flag, lines++, buf);
fprintf(stdout, "%*d\t%s\n", w_flag, lines++, buf);
else
fprintf(stdout, "%*s\t%s", w_flag, " ", buf);