diff --git a/c/typeprint.c b/c/typeprint.c index caa23d9..f5e5583 100644 --- a/c/typeprint.c +++ b/c/typeprint.c @@ -2,22 +2,26 @@ #include #include -static int process(char *name, struct timespec *ts); +static int process(char *name); static int -process(char *name, struct timespec *ts) +process(char *name) { FILE *file = fopen(name, "r"); + struct timespec ts; + + ts.tv_sec = 0; + ts.tv_nsec = 10 * 1000000; if (file == 0){ - fprintf(stderr, "[err] you either gave me an invalid file, or no file at all"); + fprintf(stderr, "[err] you either gave me an invalid file, or no file at all\n"); return -1; } int x; while ((x = fgetc(file)) != EOF) { printf("%c", x); - nanosleep(ts, NULL); + nanosleep(&ts, NULL); } return 0; @@ -26,13 +30,6 @@ process(char *name, struct timespec *ts) int main(int argc, char *argv[]) { - char *argv0; - - struct timespec ts; - ts.tv_sec = 0; - ts.tv_nsec = 10 * 1000000; - - process(argv[1], &ts); - + process(argv[1]); return 0; -} \ No newline at end of file +}