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/cp.c | 55 --------------------------------------------- 1 file changed, 55 deletions(-) delete mode 100644 pintos-progos/examples/cp.c (limited to 'pintos-progos/examples/cp.c') diff --git a/pintos-progos/examples/cp.c b/pintos-progos/examples/cp.c deleted file mode 100644 index 86a5cd7..0000000 --- a/pintos-progos/examples/cp.c +++ /dev/null @@ -1,55 +0,0 @@ -/* cat.c - -Copies one file to another. */ - -#include -#include - -int -main (int argc, char *argv[]) -{ - int in_fd, out_fd; - - if (argc != 3) - { - printf ("usage: cp OLD NEW\n"); - return EXIT_FAILURE; - } - - /* Open input file. */ - in_fd = open (argv[1]); - if (in_fd < 0) - { - printf ("%s: open failed\n", argv[1]); - return EXIT_FAILURE; - } - - /* Create and open output file. */ - if (!create (argv[2], filesize (in_fd))) - { - printf ("%s: create failed\n", argv[2]); - return EXIT_FAILURE; - } - out_fd = open (argv[2]); - if (out_fd < 0) - { - printf ("%s: open failed\n", argv[2]); - return EXIT_FAILURE; - } - - /* Copy data. */ - for (;;) - { - char buffer[1024]; - int bytes_read = read (in_fd, buffer, sizeof buffer); - if (bytes_read == 0) - break; - if (write (out_fd, buffer, bytes_read) != bytes_read) - { - printf ("%s: write failed\n", argv[2]); - return EXIT_FAILURE; - } - } - - return EXIT_SUCCESS; -} -- cgit v1.2.3