File: get_info.c

package info (click to toggle)
cti-ifhp 2.1.8-2
  • links: PTS
  • area: main
  • in suites: hamm
  • size: 932 kB
  • ctags: 845
  • sloc: ansic: 6,036; sh: 1,524; makefile: 318
file content (70 lines) | stat: -rw-r--r-- 1,842 bytes parent folder | download
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
/**************************************************************************
 * LPRng IFHP Filter
 * Copyright 1994-1997 Patrick Powell, San Diego, CA <papowell@sdsu.edu>
 *
 * Based on the CTI printer filters.
 *  See COPYRIGHT for details.
 *
 * $Id: get_info.c,v 2.3 1997/02/05 22:35:38 papowell Exp $
 */

#include "portable.h"
#include "common.h"
#include "hp4.h"

void get_info()
{
	char *s, **t;
	if( version ){
		for( t = copyright; (s = *t); ++t ){
			fprintf( stderr, "%s\n", s );
		}
		fflush(stderr);
	}
	if( name && (s = strrchr(name, '/' )) ){
		name = s+1;
	}
	if( !strcasecmp( name, OFHP ) ){
		log(2,"filter '%s'", name );
		of_filter = 1;
	} else if( format && *format == 'o' ){
		log(2,"format '%s'", format );
		of_filter = 1;
	}

	if( (s = getenv("RETRIES")) ){
		retries = atoi(s);
	}
	if( (s = getenv("SLEEPTIME")) ){
		wait_time = atoi(s);
	}
    if( (s = getenv("MODEL")) || (s = model_name) ){
        if ( ! strcasecmp(s, "IV") )   model = IV ;
        if ( ! strcasecmp(s, "III") )   model = III ;
        if ( ! strcasecmp(s, "IIID") )  model = IIID ;
        if ( ! strcasecmp(s, "IIISi") ) model = IIISi ;
        if ( ! strcasecmp(s, "C5M") ) model = C5M ;
    }
    if( (s = getenv("CARTRIDGE")) ){
		cartridge = ( !strcasecmp(s,"ON") || !strcasecmp(s,"YES") );
	}
	if( (s = getenv("RESOURCESAVE")) ){
		resourcesave = ( !strcasecmp(s,"ON") || !strcasecmp(s,"YES") );
	}
	if( (s = getenv("TRACE")) ){
		trace = ( !strcasecmp(s,"ON") || !strcasecmp(s,"YES") );
	}
	if( (s = getenv("WRAP")) ){
		wrap = ( !strcasecmp(s,"ON") || !strcasecmp(s,"YES") );
	}
	if( (s = getenv("AUTODETECT")) ){
		autodetect = ( !strcasecmp(s,"ON") || !strcasecmp(s,"YES") );
	}
	/* set flags according to model */
	switch( model ){
	default: break;
	case C5M:
		infostatus = 0;	/* do not send PJL INFOSTATUS request */
		break;
	}
}