Permalink
Browse files

update ct

  • Loading branch information...
1 parent d67d2b3 commit da3754d0db2002570df65ec0c1ede7b5360f8be9 @kr committed Sep 12, 2012
Showing with 7 additions and 6 deletions.
  1. +4 −3 ct/ct.c
  2. +1 −1 ct/ct.h
  3. +2 −2 ct/gen
View
7 ct/ct.c
@@ -10,6 +10,7 @@
#include <sys/wait.h>
#include <errno.h>
#include "internal.h"
+#include "ct.h"
void
@@ -105,11 +106,11 @@ run(T t[])
static void
copyfd(FILE *out, int in)
{
- int n;
+ ssize_t n;
char buf[1024]; // arbitrary size
while ((n = read(in, buf, sizeof(buf))) != 0) {
- if (fwrite(buf, 1, n, out) != n) {
+ if (fwrite(buf, 1, n, out) != (size_t)n) {
die(3, errno, "fwrite");
}
}
@@ -157,7 +158,7 @@ report(T t[])
int
-main(int argc, char *argv[])
+main()
{
run(ctmain);
return report(ctmain);
View
2 ct/ct.h
@@ -1,5 +1,5 @@
void ctfail(void);
-void ctlogpn(char*, int, char*, ...);
+void ctlogpn(char*, int, char*, ...) __attribute__((format(printf, 3, 4)));
#define ctlog(...) ctlogpn(__FILE__, __LINE__, __VA_ARGS__)
#define assert(x) do if (!(x)) {\
ctlog("%s", "test: " #x);\
View
4 ct/gen
@@ -26,9 +26,9 @@ gen() {
printf 'T ctmain[] = {\n'
for t in "$@"
- do printf ' {%s, "%s"},\n' $t $t
+ do printf ' {%s, "%s", 0, 0},\n' $t $t
done
- printf ' {},\n'
+ printf ' {0, 0, 0, 0},\n'
printf '};\n'
}

0 comments on commit da3754d

Please sign in to comment.