summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJakob Kaivo <jkk@ung.org>2020-10-07 14:58:27 -0400
committerJakob Kaivo <jkk@ung.org>2020-10-07 14:58:27 -0400
commitfa22dbd20f460db01db6870a564847573110cff1 (patch)
tree3f76806e398da9be906a5f01bee16906d965b280
parentb95f33758bbbf89a8d88110945663636ab465d96 (diff)
compile with extreme warnings
-rw-r--r--ls.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/ls.c b/ls.c
index 7ec08ae..3c4f928 100644
--- a/ls.c
+++ b/ls.c
@@ -125,6 +125,8 @@ static struct directory dirlist[ARG_MAX];
int nftw_ls(const char *p, const struct stat *sb, int flag, struct FTW *f)
{
+ (void)sb;
+
if (flag == FTW_D) {
strcat(dirlist[totaldirs].path, p);
// FIXME: this is showing the wrong names
@@ -235,7 +237,7 @@ static int ls_other(struct ls_entry *current, int cpos)
putchar('\n');
} else if (display == COMMA) {
- if (cpos + strlen(current->name) + 2 > columns) {
+ if (cpos + strlen(current->name) + 2 > (unsigned)columns) {
putchar('\n');
cpos = 0;
}
@@ -261,8 +263,8 @@ static int ls_other(struct ls_entry *current, int cpos)
static int ls_columns(struct ls_entry *current, int cpos)
{
- int cols = columns / (longestname + 1);
- int row = 0;
+ //int cols = columns / (longestname + 1);
+ //int row = 0;
// FIXME: this isn't right at all
return ls_other(current, cpos);
@@ -331,7 +333,7 @@ static int ls_add(const char *path, int do_stat)
else
working->time = st.st_mtime;
- if (working->size > biggest)
+ if (working->size > (uintmax_t)biggest)
biggest = working->size;
if (working->links > maxlinks)
maxlinks = working->links;
@@ -341,9 +343,9 @@ static int ls_add(const char *path, int do_stat)
struct group gr = *getgrgid(working->gid);
strcpy(working->owner, pw.pw_name);
strcpy(working->group, gr.gr_name);
- if (strlen(working->owner) > longestowner)
+ if (strlen(working->owner) > (size_t)longestowner)
longestowner = strlen(working->owner);
- if (strlen(working->group) > longestgroup)
+ if (strlen(working->group) > (size_t)longestgroup)
longestgroup = strlen(working->group);
} else {
int l, n = 0;
@@ -403,7 +405,7 @@ static int ls_add(const char *path, int do_stat)
strcpy(working->name, dname);
- if (strlen(dname) > longestname) {
+ if (strlen(dname) > (size_t)longestname) {
longestname = strlen(dname);
}