File: g_outfile.c

package info (click to toggle)
plotutils 2.4.1-15
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 11,072 kB
  • ctags: 6,952
  • sloc: ansic: 76,305; cpp: 12,402; sh: 8,475; yacc: 2,604; makefile: 894; lex: 144
file content (43 lines) | stat: -rw-r--r-- 1,169 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
/* This file contains the outfile method, which is a GNU extension to
   libplot.  It selects an output stream for all subsequent plot commands.
   The outfile method may only be invoked outside an openpl()...closepl()
   pair. */

/* THIS METHOD IS NOW DEPRECATED.  IT WILL SOON GO AWAY. */

#include "sys-defines.h"
#include "extern.h"

/* outfile takes a single argument, a stream that has been opened for
   writing.  It may be called only outside an openpl()....closepl() pair.
   It switches all future output to the new, specified stream.  The old
   output stream, which is not closed, is returned. */

FILE *
#ifdef _HAVE_PROTOS
_API_outfile(R___(Plotter *_plotter) FILE *outfile)
#else
_API_outfile(R___(_plotter) outfile)
     S___(Plotter *_plotter;) 
     FILE *outfile;
#endif
{
  FILE *oldoutfile;
  
  if (_plotter->data->open)
    {
      _plotter->error (R___(_plotter) 
		       "outfile: invalid operation");
      return (FILE *)NULL;
    }

  oldoutfile = _plotter->data->outfp;
  _plotter->data->outfp = outfile;
#ifdef LIBPLOTTER
  _plotter->data->outstream = NULL;
#endif

  _plotter->data->page_number = 0;	/* reset */

  return oldoutfile;
}