HP 9000 Series 300 Tutorials Manual page 185

Device i/o and user interfacing hp-ux concepts and tutorials
Hide thumbs Also See for HP 9000 Series 300:
Table of Contents

Advertisement

142
/* GET USER SUPPLIED OPTIONS AND PRINTER FILE NAME */
143
while «i
=
getopt(argc, argv, Ib:t:p:D"))
!=
EOF) {
144
switch (i) {
145
/* set the buffer size to output to printer */
146
case 'b': if «bufsz
=
atoi(optarg))
<=
0) errflg++;
147
break;
148
149
/* get the new timeout value in seconds */
150
case 't': if «timeout
=
atoi(optarg)) < 0) errflg++;
151
break;
152
153
/* Set the parallel poll pmask (mostly for debugging) */
154
case 'p': if «pmask[O]
=
atoi(optarg)) < 0) errflg++;
155
break;
156
157
case 'D': Debug++; break;
158
159
case '1': errflg++;break;
160
}
161
}
162
/* get printer dev if supplied */
163
if (optind
<
argc)
164
strcpy(ptr_dev, argv[optind]);
165
166
if (errflg) {
167 fprintf(stderr, "usage: %s [-bbufsz -ttmout] [printer_dev]\n", procnam);
168 fprintf(stderr, "-b bufsz > Output buf size to printer (%d)\n", bufsz);
169 fprintf(stderr, lI_t tmout > Max seconds to output buffer (%d)\n",
timeout) ;
170 fprintf(stderr, "printer_dev> Printer device file
(%s)\n", ptr_dev);
171
fprintf(stderr, "_ p ppoll_mask > Parallel poll mask
(Ox%02x)\n",pmask[0]);
172
exit(2);
173
}
174
/* get memory for the output buffer */
175
outbuf
=
(unsigned char *)malloc (bufsz + 4);
176
/*
177
NOTE: Printer device file (/dev/lp) is used only to get printer select
178
code and HP-IB bus address.
This is because attention-true (ATN)
179
requests can only be sent to an "HP-IB raw bus device file".
Therefore
180
after getting the SC and BA we will use a "HP-IB raw bus device file" to
181
do all the work, but it must exist with a name similar to the printer
182
device; i.e. "/dev/lp" is changed to l/dev/lp_07", where the "07" is the
183
select code.
184
*/
OIL Programming Example
0-5

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

Hp 9000 series 800

Table of Contents