add bigtouch (for creating maaany files)
authorJann Horn <jann@thejh.net>
Sun, 9 Feb 2014 21:24:43 +0000 (22:24 +0100)
committerJann Horn <jann@thejh.net>
Sun, 9 Feb 2014 21:24:43 +0000 (22:24 +0100)
tools/bigtouch.c [new file with mode: 0644]

diff --git a/tools/bigtouch.c b/tools/bigtouch.c
new file mode 100644 (file)
index 0000000..ad9058b
--- /dev/null
@@ -0,0 +1,20 @@
+// create maaaany files
+
+#include <stdio.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <stdlib.h>
+#include <jh.h>
+#include <unistd.h>
+
+int main(int argc, char **argv) {
+  if (argc != 2) printf("bad invocation, want <maxnum>\n"), exit(1);
+  int max = atoi(argv[1]);
+  for (int i=0; i<max; i++) {
+    char name[50];
+    sprintf(name, "%d", i);
+    close(fail_on_neg(creat(name, 0600), "creat() failed", 1));
+  }
+  return 0;
+}