ING_DB
This commit is contained in:
parent
5265abcaca
commit
a215ac5274
|
|
@ -0,0 +1,61 @@
|
||||||
|
# include <stdio.h>
|
||||||
|
|
||||||
|
main(c, v)
|
||||||
|
int c;
|
||||||
|
char **v;
|
||||||
|
{
|
||||||
|
register int i;
|
||||||
|
long new;
|
||||||
|
long old;
|
||||||
|
char buf[10240];
|
||||||
|
extern long time();
|
||||||
|
|
||||||
|
i = atoi(v[1]);
|
||||||
|
old = time((char *) 0);
|
||||||
|
while (rd(buf, i) > 0)
|
||||||
|
continue;
|
||||||
|
new = time((char *) 0);
|
||||||
|
printf("%ld sec\n", new - old);
|
||||||
|
}
|
||||||
|
|
||||||
|
char *AAbmove(p, q, n)
|
||||||
|
register char *p;
|
||||||
|
register char *q;
|
||||||
|
register int n;
|
||||||
|
{
|
||||||
|
while (n--)
|
||||||
|
*q++ = *p++;
|
||||||
|
return (q);
|
||||||
|
}
|
||||||
|
|
||||||
|
char B[BUFSIZ];
|
||||||
|
char *BP = B;
|
||||||
|
int BL = 0;
|
||||||
|
|
||||||
|
rd(buf, len)
|
||||||
|
register char *buf;
|
||||||
|
register int len;
|
||||||
|
{
|
||||||
|
register char *bp;
|
||||||
|
register int bl;
|
||||||
|
register int i;
|
||||||
|
|
||||||
|
bp = BP;
|
||||||
|
bl = BL;
|
||||||
|
while (len)
|
||||||
|
{
|
||||||
|
if (bl)
|
||||||
|
{
|
||||||
|
i = (len > bl)? bl: len;
|
||||||
|
len -= i;
|
||||||
|
buf = AAbmove(bp, buf, i);
|
||||||
|
bp += i;
|
||||||
|
bl -= i;
|
||||||
|
}
|
||||||
|
if ((bl = read(0, bp = B, BUFSIZ)) <= 0)
|
||||||
|
return (0);
|
||||||
|
}
|
||||||
|
BL = bl;
|
||||||
|
BP = bp;
|
||||||
|
return (1);
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue