00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011 #include <ctype.h>
00012 #include <stdio.h>
00013 #include <syscall.h>
00014
00015 int
00016 main (int argc, char *argv[])
00017 {
00018 char buf[1024];
00019 int handle;
00020
00021 if (argc != 2)
00022 exit (1);
00023
00024 handle = open (argv[1]);
00025 if (handle < 0)
00026 exit (2);
00027
00028 for (;;)
00029 {
00030 int n, i;
00031
00032 n = read (handle, buf, sizeof buf);
00033 if (n <= 0)
00034 break;
00035
00036 for (i = 0; i < n; i++)
00037 buf[i] = toupper ((unsigned char) buf[i]);
00038
00039 seek (handle, tell (handle) - n);
00040 if (write (handle, buf, n) != n)
00041 printf ("write failed\n");
00042 }
00043
00044 close (handle);
00045
00046 return EXIT_SUCCESS;
00047 }