|
|
1.1 ! root 1: #include "../../src/parms.h" ! 2: #include "../../src/structs.h" ! 3: ! 4: main (argc, argv) ! 5: int argc; ! 6: char **argv; ! 7: { ! 8: int i, ! 9: j, ! 10: k; ! 11: char *p, ! 12: *q, ! 13: *r; ! 14: FILE * fp; ! 15: struct seq_f buf; ! 16: char line[128]; ! 17: ! 18: i = open (argv[1], 1); ! 19: if (i < 0) ! 20: { ! 21: i = creat (argv[1], 0666); ! 22: if (i < 0) ! 23: { ! 24: printf ("Couldn't open/create %d\n", argv[1]); ! 25: exit (1); ! 26: } ! 27: } ! 28: ! 29: while (fgets (line, sizeof line, stdin) != NULL) ! 30: { ! 31: /* ! 32: * printf("Hey I read line: %d", line); ! 33: */ ! 34: ! 35: buf.lastin.w_gmttime = 0; /* no unixtime */ ! 36: j=sscanf (line, "%s : %hd:%hd %hd/%hd/%hd", ! 37: &buf.nfname, ! 38: &buf.lastin.w_hours, &buf.lastin.w_mins, ! 39: &buf.lastin.w_day, &buf.lastin.w_month, &buf.lastin.w_year); ! 40: /* ! 41: * printf("sscanf returned %d\n", j); ! 42: * printf ("%-20s: %d:%d %d/%d/%d\n", buf.nfname, ! 43: * buf.lastin.w_hours, buf.lastin.w_mins, ! 44: * buf.lastin.w_day, buf.lastin.w_month, buf.lastin.w_year); ! 45: */ ! 46: ! 47: write (i, &buf, sizeof buf); ! 48: } ! 49: ! 50: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.