1 /* $Id: $ */
2
3 /* Copyright (C) 1997 Sverre Hvammen Johansen,
4 * Department of Informatics, University of Oslo.
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; version 2.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18 */
19
20 #include "cim.h"
21 #include "simfile.h"
22
23 /******************************************************************************
24 BOOLEAN PROCEDURE CLOSE */
25
26 char
__robclose(p)27 __robclose (p)
28 __bs9FILE *p;
29 {
30 if (((__bs1FILE *) p)->open)
31 {
32 if (((__bs1FILE *) p)->re_wind == __REWIND
33 && fseek (((__bs1FILE *) p)->file, 0L, 0) == __EOF)
34 __rerror ("Close: Not possible to rewind");
35 if (fclose (((__bs1FILE *) p)->file) == __EOF)
36 return (__FALSE);
37 #if HAVE_UNLINK
38 if (((__bs1FILE *) p)->purge == __PURGE)
39 (void) unlink (((__bs1FILE *) p)->filename.obj->string);
40 #endif
41 ((__bs1FILE *) p)->open = __FALSE;
42 return (__TRUE);
43 }
44 else
45 return (__FALSE);
46 }
47