File: makeprocs.c

package info (click to toggle)
grass 6.0.2-6
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 40,044 kB
  • ctags: 31,303
  • sloc: ansic: 321,125; tcl: 25,676; sh: 11,176; cpp: 10,098; makefile: 5,025; fortran: 1,846; yacc: 493; lex: 462; perl: 133; sed: 1
file content (45 lines) | stat: -rw-r--r-- 843 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
44
45
/* Function: make_procs
**
** This function creates some commonly used PostScript procedures.
**
** Author: Paul W. Carlson	March 1992
*/

#include "ps_info.h"

int 
make_procs (void)
{
    char filename[1024];
    FILE *fp;
    int level;

    /* begin procs */
    fprintf(PS.fp, "\n%%%%BeginProlog\n");

    /* level 2 is default PostScript level */
    level = (PS.level != 1) ? 2 : 1;
    fprintf(PS.fp, "/level %d def\n", level);

    sprintf(filename, "%s/etc/paint/prolog.ps", G_gisbase());

    fp = fopen(filename, "r");
    if (!fp)
	G_fatal_error("unable to open prolog '%s'", filename);

    for (;;)
    {
	char buff[80];
	if (!fgets(buff, sizeof(buff), fp))
	    break;
	fputs(buff, PS.fp);
    }

    fclose(fp);

    /* all procs should be defined above this line */
    fprintf(PS.fp, "%%%%EndProlog\n\n");

    return 0;
}