needs typees.h
[unix-history] / usr / src / usr.bin / pascal / libpc / PMFLUSH.c
CommitLineData
0d78ca85 1/*-
f5bf6c54
KB
2 * Copyright (c) 1979, 1993
3 * The Regents of the University of California. All rights reserved.
0d78ca85
KB
4 *
5 * %sccs.include.redist.c%
6 */
b25797df 7
0d78ca85 8#ifndef lint
f5bf6c54 9static char sccsid[] = "@(#)PMFLUSH.c 8.1 (Berkeley) %G%";
0d78ca85 10#endif /* not lint */
b25797df
KM
11
12#include "h00vars.h"
13
f87e8667 14PMFLUSH(cntrs, rtns, bufaddr)
b25797df 15
f87e8667
KM
16 long cntrs; /* total number of counters (stmt + routine) */
17 long rtns; /* number of func and proc counters */
18 long *bufaddr; /* address of count buffers */
b25797df
KM
19{
20 register FILE *filep;
21
f87e8667 22 bufaddr[0] = 0426;
492cc5d3 23 time(&bufaddr[1]);
f87e8667
KM
24 bufaddr[2] = cntrs;
25 bufaddr[3] = rtns;
b25797df
KM
26 filep = fopen(PXPFILE, "w");
27 if (filep == NULL)
28 goto ioerr;
492cc5d3 29 fwrite(bufaddr, (int)(cntrs + 1), sizeof(long), filep);
b25797df
KM
30 if (ferror(filep))
31 goto ioerr;
32 fclose(filep);
33 if (!ferror(filep))
34 return;
35ioerr:
36 perror(PXPFILE);
37}