changeset: 90:3f408c4419e7
tag: tip
user: Connor Lane Smith <cls_AT_lubutu.com>
date: Tue Jun 21 05:05:37 2011 +0100
files: chown.c config.mk fold.c kill.c nl.c sort.c util/agetcwd.c util/enmasse.c
description:
cc -Wextra
diff -r af0e98cea3c6 -r 3f408c4419e7 chown.c
--- a/chown.c Tue Jun 21 04:56:16 2011 +0100
+++ b/chown.c Tue Jun 21 05:05:37 2011 +0100
@@ -58,7 +58,8 @@
void
chownpwgr(const char *path)
{
- if(chown(path, pw ? pw->pw_uid : -1, gr ? gr->gr_gid : -1) == -1)
+ if(chown(path, pw ? pw->pw_uid : (uid_t)-1,
+ gr ? gr->gr_gid : (gid_t)-1) == -1)
eprintf("chown %s:", path);
if(rflag)
recurse(path, chownpwgr);
diff -r af0e98cea3c6 -r 3f408c4419e7 config.mk
--- a/config.mk Tue Jun 21 04:56:16 2011 +0100
+++ b/config.mk Tue Jun 21 05:05:37 2011 +0100
@@ -9,7 +9,7 @@
#CC = musl-gcc
LD = $(CC)
CPPFLAGS = -D_POSIX_C_SOURCE=200112L
-CFLAGS = -Os -ansi -Wall -pedantic $(CPPFLAGS)
+CFLAGS = -Os -ansi -Wall -Wextra -pedantic $(CPPFLAGS)
LDFLAGS = -static #-s
#CC = tcc
diff -r af0e98cea3c6 -r 3f408c4419e7 fold.c
--- a/fold.c Tue Jun 21 04:56:16 2011 +0100
+++ b/fold.c Tue Jun 21 05:05:37 2011 +0100
@@ -7,7 +7,7 @@
#include "text.h"
#include "util.h"
-static void fold(FILE *, const char *, long);
+static void fold(FILE *, long);
static void foldline(const char *, long);
static bool bflag = false;
@@ -35,18 +35,18 @@
exit(EXIT_FAILURE);
}
if(optind == argc)
- fold(stdin, "<stdin>", width);
+ fold(stdin, width);
else for(; optind < argc; optind++) {
if(!(fp = fopen(argv[optind], "r")))
eprintf("fopen %s:", argv[optind]);
- fold(fp, argv[optind], width);
+ fold(fp, width);
fclose(fp);
}
return EXIT_SUCCESS;
}
void
-fold(FILE *fp, const char *str, long width)
+fold(FILE *fp, long width)
{
char *buf = NULL;
size_t size = 0;
@@ -60,7 +60,8 @@
foldline(const char *str, long width)
{
bool space;
- long col, j, i = 0, n = 0;
+ long col, j;
+ size_t i = 0, n = 0;
do {
space = false;
diff -r af0e98cea3c6 -r 3f408c4419e7 kill.c
--- a/kill.c Tue Jun 21 04:56:16 2011 +0100
+++ b/kill.c Tue Jun 21 05:05:37 2011 +0100
@@ -26,8 +26,9 @@
{
bool lflag = false;
char c, *end;
- int i, sig = SIGTERM;
+ int sig = SIGTERM;
pid_t pid;
+ size_t i;
while((c = getopt(argc, argv, "ls:")) != -1)
switch(c) {
diff -r af0e98cea3c6 -r 3f408c4419e7 nl.c
--- a/nl.c Tue Jun 21 04:56:16 2011 +0100
+++ b/nl.c Tue Jun 21 05:05:37 2011 +0100
@@ -7,7 +7,7 @@
#include "text.h"
#include "util.h"
-static void nl(FILE *, const char *);
+static void nl(FILE *);
static char mode = 't';
static const char *sep = "\t";
@@ -39,18 +39,18 @@
exit(EXIT_FAILURE);
}
if(optind == argc)
- nl(stdin, "<stdin>");
+ nl(stdin);
else for(; optind < argc; optind++) {
if(!(fp = fopen(argv[optind], "r")))
eprintf("fopen %s:", argv[optind]);
- nl(fp, argv[optind]);
+ nl(fp);
fclose(fp);
}
return EXIT_SUCCESS;
}
void
-nl(FILE *fp, const char *str)
+nl(FILE *fp)
{
char *buf = NULL;
long n = 0;
diff -r af0e98cea3c6 -r 3f408c4419e7 sort.c
--- a/sort.c Tue Jun 21 04:56:16 2011 +0100
+++ b/sort.c Tue Jun 21 05:05:37 2011 +0100
@@ -8,7 +8,7 @@
#include "util.h"
static int linecmp(const char **, const char **);
-static void getlines(FILE *, const char *);
+static void getlines(FILE *);
static bool rflag = false;
static bool uflag = false;
@@ -34,11 +34,11 @@
exit(EXIT_FAILURE);
}
if(optind == argc)
- getlines(stdin, "<stdin>");
+ getlines(stdin);
else for(; optind < argc; optind++) {
if(!(fp = fopen(argv[optind], "r")))
eprintf("fopen %s:", argv[optind]);
- getlines(fp, argv[optind]);
+ getlines(fp);
fclose(fp);
}
qsort(lines, nlines, sizeof *lines, (int (*)(const void *, const void *))linecmp);
@@ -50,7 +50,7 @@
}
void
-getlines(FILE *fp, const char *str)
+getlines(FILE *fp)
{
char *line = NULL;
size_t size = 0;
diff -r af0e98cea3c6 -r 3f408c4419e7 util/agetcwd.c
--- a/util/agetcwd.c Tue Jun 21 04:56:16 2011 +0100
+++ b/util/agetcwd.c Tue Jun 21 05:05:37 2011 +0100
@@ -8,9 +8,9 @@
agetcwd(void)
{
char *buf;
- size_t size;
+ long size;
- if((size = pathconf(".", _PC_PATH_MAX)) < 0)
+ if((size = pathconf(".", _PC_PATH_MAX)) == -1)
size = BUFSIZ;
if(!(buf = malloc(size)))
eprintf("malloc:");
diff -r af0e98cea3c6 -r 3f408c4419e7 util/enmasse.c
--- a/util/enmasse.c Tue Jun 21 04:56:16 2011 +0100
+++ b/util/enmasse.c Tue Jun 21 05:05:37 2011 +0100
@@ -25,7 +25,7 @@
else
dir = argv[--argc];
- if((size = pathconf(dir, _PC_PATH_MAX)) < 0)
+ if((size = pathconf(dir, _PC_PATH_MAX)) == -1)
size = BUFSIZ;
if(!(buf = malloc(size)))
eprintf("malloc:");
Received on Tue Jun 21 2011 - 06:05:53 CEST
This archive was generated by hypermail 2.2.0 : Tue Jun 21 2011 - 06:12:06 CEST