From 4f670845ff9ab6c48bcb5f7bf4d4ef6dc3c3064b Mon Sep 17 00:00:00 2001 From: manuel Date: Tue, 27 Mar 2012 11:51:08 +0200 Subject: reorganize file structure to match the upstream requirements --- pintos-progos/examples/lineup.c | 46 ----------------------------------------- 1 file changed, 46 deletions(-) delete mode 100644 pintos-progos/examples/lineup.c (limited to 'pintos-progos/examples/lineup.c') diff --git a/pintos-progos/examples/lineup.c b/pintos-progos/examples/lineup.c deleted file mode 100644 index 60402d0..0000000 --- a/pintos-progos/examples/lineup.c +++ /dev/null @@ -1,46 +0,0 @@ -/* lineup.c - - Converts a file to uppercase in-place. - - Incidentally, another way to do this while avoiding the seeks - would be to open the input file, then remove() it and reopen - it under another handle. Because of Unix deletion semantics - this works fine. */ - -#include -#include -#include - -int -main (int argc, char *argv[]) -{ - char buf[1024]; - int handle; - - if (argc != 2) - exit (1); - - handle = open (argv[1]); - if (handle < 0) - exit (2); - - for (;;) - { - int n, i; - - n = read (handle, buf, sizeof buf); - if (n <= 0) - break; - - for (i = 0; i < n; i++) - buf[i] = toupper ((unsigned char) buf[i]); - - seek (handle, tell (handle) - n); - if (write (handle, buf, n) != n) - printf ("write failed\n"); - } - - close (handle); - - return EXIT_SUCCESS; -} -- cgit v1.2.3