Whamcloud - gitweb
*** empty log message ***
authorbraam <braam>
Thu, 21 Feb 2002 23:02:57 +0000 (23:02 +0000)
committerbraam <braam>
Thu, 21 Feb 2002 23:02:57 +0000 (23:02 +0000)
lustre/tests/truncate.c [new file with mode: 0644]

diff --git a/lustre/tests/truncate.c b/lustre/tests/truncate.c
new file mode 100644 (file)
index 0000000..66634dd
--- /dev/null
@@ -0,0 +1,23 @@
+#include <unistd.h>
+#include <stdio.h>
+#include <errno.h>
+#include <string.h>
+#include <stdlib.h>
+
+int main(int argc, char **argv)
+{
+       unsigned long off;
+       int err;
+
+       if (argc != 3) { 
+               printf("usage %s file offset\n", argv[0]); 
+               return 1;
+       }
+
+       off = strtoul(argv[2], NULL, 0);
+       err = truncate(argv[1], off); 
+       if ( err ) { 
+               printf("Error truncating %s: %s\n", argv[1], strerror(errno));
+       }
+       return err;
+}