source: trunk/minix/lib/ack/libp/cls.c@ 12

Last change on this file since 12 was 9, checked in by Mattia Monga, 14 years ago

Minix 3.1.2a

File size: 1.2 KB
Line 
1/* $Header: /cvsup/minix/src/lib/ack/libp/cls.c,v 1.1 2005/10/10 15:27:46 beng Exp $ */
2/*
3 * (c) copyright 1983 by the Vrije Universiteit, Amsterdam, The Netherlands.
4 *
5 * This product is part of the Amsterdam Compiler Kit.
6 *
7 * Permission to use, sell, duplicate or disclose this software must be
8 * obtained in writing. Requests for such permissions may be sent to
9 *
10 * Dr. Andrew S. Tanenbaum
11 * Wiskundig Seminarium
12 * Vrije Universiteit
13 * Postbox 7161
14 * 1007 MC Amsterdam
15 * The Netherlands
16 *
17 */
18
19/* Author: J.W. Stevenson */
20
21#include <pc_file.h>
22#include <pc_err.h>
23
24extern struct file *_curfil;
25extern _trp();
26extern _flush();
27extern _outcpt();
28extern int _close();
29
30_xcls(f) struct file *f; {
31
32 if ((f->flags & WRBIT) == 0)
33 return;
34 if ((f->flags & (TXTBIT|ELNBIT)) == TXTBIT) {
35#ifdef CPM
36 *f->ptr = '\r';
37 _outcpt(f);
38#endif
39 *f->ptr = '\n';
40 _outcpt(f);
41 }
42 _flush(f);
43}
44
45_cls(f) struct file *f; {
46#ifdef MAYBE
47 char *p;
48#endif
49
50 _curfil = f;
51 if ((f->flags&0377) != MAGIC)
52 return;
53#ifdef MAYBE
54 p = f->bufadr;
55 if (f->ptr < p)
56 return;
57 if (f->buflen <= 0)
58 return;
59 p += f->buflen;
60 if (f->ptr >= p)
61 return;
62#endif
63 _xcls(f);
64 if (_close(f->ufd) != 0)
65 _trp(ECLOSE);
66 f->flags = 0;
67}
Note: See TracBrowser for help on using the repository browser.