Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
att
GitHub Repository: att/ast
Path: blob/master/src/cmd/tests/sfio/tleak.c
1810 views
1
/***********************************************************************
2
* *
3
* This software is part of the ast package *
4
* Copyright (c) 1999-2011 AT&T Intellectual Property *
5
* and is licensed under the *
6
* Eclipse Public License, Version 1.0 *
7
* by AT&T Intellectual Property *
8
* *
9
* A copy of the License is available at *
10
* http://www.eclipse.org/org/documents/epl-v10.html *
11
* (with md5 checksum b35adb5213ca9657e911e9befb180842) *
12
* *
13
* Information and Software Systems Research *
14
* AT&T Research *
15
* Florham Park NJ *
16
* *
17
* Glenn Fowler <[email protected]> *
18
* *
19
***********************************************************************/
20
#include "sftest.h"
21
22
tmain()
23
{
24
Sfoff_t m;
25
26
if(sfopen(sfstdout, tstfile("sf", 0), "w") != sfstdout)
27
terror("Can't open %s to write", tstfile("sf", 0));
28
if(sfputr(sfstdout,"012345678\n",-1) != 10)
29
terror("Can't write to %s", tstfile("sf", 0));
30
31
if(sfopen(sfstdout, tstfile("sf", 1),"w") != sfstdout)
32
terror("Can't open %s to write", tstfile("sf", 1));
33
34
if(sfopen(sfstdin, tstfile("sf", 0), "r") != sfstdin)
35
terror("Can't open %s to read", tstfile("sf", 0));
36
37
if((m = sfmove(sfstdin,sfstdout, (Sfoff_t)SF_UNBOUND, -1)) != 10)
38
terror("Moving data from %s to %s m=%lld",
39
tstfile("sf", 0), tstfile("sf", 1), (Sflong_t)m);
40
41
texit(0);
42
}
43
44