OSDN Git Service

Fix no pic
[uclinux-h8/uClinux-dist.git] / user / httpd / copy.c
1 /* copy.c:
2  *
3  * Copyright (C) 1998  Kenneth Albanowski <kjahds@kjahds.com>,
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 2 of the License, or
8  * (at your option) any later version.
9  */
10
11 #include <stdio.h>
12
13 static char copybuf[16384];
14
15 extern int TIMEOUT;
16
17 int
18 copy(FILE *read_f, FILE *write_f)
19 {
20   int n;
21   int i;
22   int j;
23   int oi;
24   int wrote;
25
26   alarm(TIMEOUT);
27   while (n = fread(copybuf,1,sizeof(copybuf),read_f)) {
28     alarm(TIMEOUT);
29     wrote = fwrite(copybuf,n,1,write_f);
30     alarm(TIMEOUT);
31     if (wrote < 1)
32         return -1;
33   }
34   alarm(0);
35   return 0;
36 }