source: trunk/gui/shared/PrintUtl.VRS@ 14

Last change on this file since 14 was 14, checked in by Alex Taylor, 13 years ago

Try to fix occasional problems creating local printer object - no longer relying on RINSTPRN to install the printer driver.
Add support for systems without a local CUPS installation (requires providing a PPD).

File size: 20.3 KB
Line 
1/*:VRX GetDriverSource
2*/
3/* Figure out where to look for the PrinterPak driver files used as the install
4 * source. Preference is given to the local repository (PDR_DIR); if it's not
5 * there, we look in a couple of other places where it might have ended up.
6 * Note that we don't look for the actual installed driver files under \OS2\DLL;
7 * if the application wants to fall back to those in some way, then it will have
8 * to take care of that logic itself.
9 *
10 * Various global values are assumed to be set already:
11 * - globals.!prdrv: filespec of \OS2\INSTALL\PRDRV.LST
12 * - globals.!repository: value indicated by PM_INSTALL->PDR_DIR in OS2.INI
13 *
14 * Returns the path, or '' if not found. Also, 'pmdx' will be 0-9 if the
15 * driver is in the repository (indicating the repository subdirectory), or
16 * '' if the driver is not in the repository.
17 */
18GetDriverSource: PROCEDURE EXPOSE globals. pmdx
19 ARG driver
20 IF driver == '' THEN RETURN ''
21
22 drv_file = ''
23 IF globals.!repository <> '' THEN DO
24
25 /* See if the driver is defined in the local repository. (This is the
26 * directory where installable printer drivers are kept. OS/2 gets them
27 * from here when you select 'Printer driver included with OS/2'.)
28 */
29 pmdx = GetDriverPMDD( driver, globals.!prdrv )
30 IF pmdx == '' THEN DO
31 /* Hmm, the driver isn't listed in PRDRV.LST. Let's check to see if
32 * it's in the default repository location anyway.
33 */
34 IF WORDPOS( driver, 'ECUPS ECUPS-HP PSPRINT PSPRINT2') > 0 THEN
35 pmdx = '9'
36 ELSE
37 pmdx = '0'
38 drv_file = STREAM( globals.!repository'\PMDD_'pmdx'\'driver'.DRV', 'C', 'QUERY EXISTS')
39 IF drv_file <> '' THEN DO
40 /* We found the driver in the repository, even though it isn't
41 * defined as such. So let's add the proper definition to
42 * PRDRV.LST now.
43 */
44 CALL LINEOUT globals.!prdrv, LEFT( driver'.DRV', 14 ) pmdx ||,
45 ' (added automatically)'
46 CALL LINEOUT globals.!prdrv
47 END
48 ELSE
49 pmdx = ''
50 END
51 ELSE DO
52 /* The driver is listed; now make sure it's actually there.
53 */
54 drv_file = STREAM( globals.!repository'\PMDD_'pmdx'\'driver'.DRV', 'C', 'QUERY EXISTS')
55 END
56 END
57
58 IF drv_file == '' THEN DO
59 CALL LINEOUT globals.!log1, 'Driver' driver 'is not in the local repository.'
60 /* If the driver really isn't in the repository, there are a couple of
61 * other places that various install utilities might have put it...
62 */
63 PARSE VALUE VRGetIni('PM_INSTALL', driver'_DIR', 'USER') WITH drvr_dir '00'x .
64 IF drvr_dir == '' THEN
65 PARSE VALUE VRGetIni('InstPDR', 'PATH_TO_'driver, 'USER') WITH drvr_dir '00'x .
66 IF drvr_dir <> '' THEN DO
67 drv_file = drvr_dir'\'driver'.DRV'
68 CALL LINEOUT globals.!log1, 'Found driver in' drvr_dir'.'
69 END
70 END
71
72RETURN drv_file
73
74
75/*:VRX GetDriverPMDD
76*/
77/* Check to see which repository directory the specified driver resides in.
78 * Returns the number suffix of the PMDD_* subdirectory name, or '' if either
79 * the driver or the index file could not be located.
80 */
81GetDriverPMDD: PROCEDURE
82 PARSE ARG driver, prdrv_lst
83
84 IF prdrv_lst <> '' THEN DO
85 CALL LINEIN prdrv_lst, 1, 0
86 DO WHILE LINES( prdrv_lst ) > 0
87 PARSE VALUE LINEIN( prdrv_lst ) WITH (driver)'.DRV' pmdx .
88 IF pmdx <> '' THEN LEAVE
89 END
90 CALL STREAM prdrv_lst, 'C', 'CLOSE'
91 END
92 ELSE pmdx = ''
93
94RETURN pmdx
95
96
97/*:VRX VerifyDriverEAs
98*/
99/* Make sure the driver has its extended attributes. If not, look for an
100 * accompanying .EA or .EA_ file, and join it to the driver.
101 */
102VerifyDriverEAs: PROCEDURE EXPOSE globals.
103 PARSE ARG driver
104 eas.0 = 0
105 CALL SysQueryEAList driver, 'eas.'
106 IF eas.0 == 0 THEN DO
107 ea_file = SUBSTR( driver, 1, LASTPOS('.', driver )) || 'EA'
108 IF STREAM( ea_file, 'C', 'QUERY EXISTS') == '' THEN
109 ea_file = ea_file || '_'
110 IF STREAM( ea_file, 'C', 'QUERY EXISTS') == '' THEN
111 RETURN 0
112
113 ADDRESS CMD '@UNLOCK' driver '2>NUL 1>NUL'
114 ADDRESS CMD '@EAUTIL' driver ea_file '/j /p 2>NUL 1>NUL'
115 END
116RETURN 1
117
118
119/*:VRX CopyDriverToSource
120*/
121/* Copies a printerpak driver and all its files from one directory to another.
122 * Usually the target is the source (repository) directory used for
123 * installation, hence the function name. However, this routine can be used
124 * in other contexts as well.
125 *
126 * driver - The fully-qualified filename of the printerpak driver
127 * newdrvdir - The directory where the files will be copied; must exist
128 */
129CopyDriverToSource: PROCEDURE EXPOSE globals.
130 PARSE ARG driver, newdrvdir
131
132 drv_dir = VRParseFilePath( driver, 'DP')
133 IF drv_dir == '' THEN RETURN 0
134
135 IF VerifyDriverEAs( driver ) == 0 THEN RETURN 0
136
137 CALL LINEOUT globals.!log1, 'Copying driver files from' drv_dir 'to' newdrvdir'...'
138
139 /* Read the list of required driver files from the EAs, and copy them
140 * all to the target directory.
141 */
142 IF SysGetEA( driver, 'REQUIREDDRIVERFILES', 'reqfiles') == 0 THEN DO
143 PARSE VAR reqfiles 5 filelist
144 filelist = TRANSLATE( filelist, ' ', ',')
145 DO i = 1 TO WORDS( filelist )
146 copyfile = drv_dir'\' || WORD( filelist, i )
147 ok = VRCopyFile( copyfile, newdrvdir'\' || WORD( filelist, i ))
148 CALL LINEOUT globals.!log1, ' -' copyfile '(REQUIRED):' ok
149 END
150 DROP copyfile
151 DROP filelist
152 END
153 ELSE RETURN 0
154
155 /* If there are optional files defined as well, try to copy those also.
156 */
157 IF SysGetEA( driver, 'OPTIONALDRIVERFILES', 'reqfiles') == 0 THEN DO
158 PARSE VAR reqfiles 5 filelist
159 filelist = TRANSLATE( filelist, ' ', ',')
160 DO i = 1 TO WORDS( filelist )
161 copyfile = drv_dir'\' || WORD( filelist, i )
162 IF STREAM( copyfile, 'C', 'QUERY EXISTS') == '' THEN ITERATE
163 ok = VRCopyFile( copyfile, newdrvdir'\' || WORD( filelist, i ))
164 CALL LINEOUT globals.!log1, ' -' copyfile '(OPTIONAL):' ok
165 END
166 DROP copyfile
167 DROP filelist
168 END
169
170RETURN 1
171
172
173/*:VRX PrinterExistsInDRV
174*/
175/* Determine if the specified PrinterPak driver already contains support
176 * for the specified printer model.
177 */
178PrinterExistsInDRV: PROCEDURE EXPOSE globals.
179 PARSE UPPER ARG driver_name, printer_name
180 printer_name = TRANSLATE( printer_name, '_', '.')
181
182 printer_drv = globals.!bootdrv'\OS2\DLL\'driver_name'\'driver_name'.DRV'
183 /* ?? TODO: install driver_name if not found (prompt first) ?? */
184
185 IF SysGetEA( printer_drv, '.EXPAND', 'exist_ea') <> 0 THEN RETURN 0
186 PARSE VAR exist_ea 1 _eatype 3 .
187 IF C2X( _eatype ) <> 'FDFF' THEN RETURN 0
188
189 PARSE VAR exist_ea 3 _ealen 5 exist_models
190 total_len = C2D( REVERSE( _ealen ))
191
192 /* The variable exist_models now contains a null-separated list of printer
193 * models supported by the driver (including those from previously-imported
194 * PPD files). Next we check each one against our requested printer name.
195 */
196 start = 1
197 found = 0
198 DO WHILE ( found == 0 ) & ( start < total_len )
199 _strend = POS('0'x, exist_models, start )
200 IF _strend == 0 THEN LEAVE
201 _model = TRANSLATE( SUBSTR( exist_models, start, _strend - start ))
202 IF _model == printer_name THEN
203 found = 1
204 ELSE
205 start = _strend + 1
206 END
207
208RETURN found
209
210
211/*:VRX CreateDriverList
212*/
213/* Generate a driver listfile from the .EXPAND EA
214 */
215CreateDriverList: PROCEDURE EXPOSE globals.
216 ARG driver, listfile
217
218 IF STREAM( listfile, 'C', 'QUERY EXISTS') <> '' THEN
219 CALL SysFileDelete listfile
220
221 drv_name = FILESPEC('NAME', driver )
222 IF SysGetEA( driver, '.EXPAND', 'eaval') == 0 THEN DO
223 PARSE VAR eaval 3 ealen 5 models
224 offs = 1
225 datalen = C2D( REVERSE( ealen ))
226 DO WHILE offs <= datalen
227 start = SUBSTR( models, offs )
228 inc = POS('00'x, start )
229 IF inc > 1 THEN DO
230 current_name = STRIP( SUBSTR( start, 1, inc-1 ))
231 CALL LINEOUT listfile, current_name':' current_name '('drv_name')'
232 END
233 offs = offs + inc
234 END
235 CALL LINEOUT listfile
236 CALL LINEOUT globals.!log1, 'Created driver list' listfile 'for' driver'.'
237 END
238 ELSE
239 CALL LINEOUT globals.!log1, 'No drivers found in' driver '(missing .EXPAND extended attribute?)'
240
241RETURN 1
242
243
244/*:VRX AddPort_CUPS
245*/
246/* Adds a new CUPS port. Returns 0 on full success, 1 if the port was created
247 * but could not be configured, and an OS/2 or PM error code otherwise.
248 */
249AddPort_CUPS: PROCEDURE EXPOSE globals.
250 PARSE ARG portname, hostname, queuename
251 CALL LINEOUT globals.!log1, 'Creating new port' portname
252 ADDRESS CMD '@cupsport' portname hostname queuename '>>' globals.!log2
253 IF rc == 1 THEN DO
254 CALL VRSetIni 'PM_'portname, 'INITIALIZATION', hostname'#'queuename||'00'x, 'SYSTEM', 'NoClose'
255 CALL VRSetIni 'PM_'portname, 'DESCRIPTION', hostname':'queuename||'00'x, 'SYSTEM'
256 END
257RETURN rc
258
259
260/*:VRX DeletePort
261*/
262/* Deletes a printer port (any type).
263 */
264DeletePort: PROCEDURE EXPOSE globals.
265 PARSE ARG portname
266 CALL SysIni 'SYSTEM', 'PM_'portname, 'DELETE:'
267 CALL SysIni 'SYSTEM', 'PM_SPOOLER_PORT', portname, 'DELETE:'
268RETURN 1
269
270
271/*:VRX GetNextPortName
272*/
273/* Get the next unique (non-existing) port name for the specified port driver.
274 */
275GetNextPortName: PROCEDURE
276 ARG portdrv
277
278 maxports = 64 /* should be smarter about this if possible */
279 exists = 1
280 x = 0
281 DO WHILE ( x < maxports ) & ( exists == 1 )
282 x = x + 1
283 portname = portdrv || x
284 nextport = SysIni('SYSTEM', 'PM_SPOOLER_PORT', portname )
285 IF LEFT( nextport, 6 ) == 'ERROR:' THEN exists = 0
286 END
287 IF exists == 1 THEN
288 portname = ''
289
290RETURN portname
291
292
293/*:VRX GetQueueName
294*/
295/* Generate a unique queue name from the specified printer name.
296 */
297GetQueueName: PROCEDURE
298 ARG queuename
299
300 DO UNTIL badchar = 0
301 badchar = VERIFY( queuename, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ-_0123456789 ')
302 IF badchar > 0 THEN
303 queuename = OVERLAY(' ', queuename, badchar, 1 )
304 END
305 queuename = LEFT( SPACE( queuename, 0 ), 8 )
306
307 tail = 0
308 PARSE VALUE VRGetIni('PM_SPOOLER', 'DIR', 'SYSTEM') WITH spldir ';' .
309 DO WHILE VRFileExists( spldir'\'queuename ) == 1
310 tail = tail + 1
311 queuename = STRIP( LEFT( queuename, 8 - LENGTH( tail ))) || tail
312 END
313
314RETURN queuename
315
316
317/*:VRX InstallPrintDriver
318*/
319/* 'Installs' (that is to say, registers with the spooler) an OS printer
320 * device driver/model. Installs the corresponding printerpak driver if
321 * necessary.
322 *
323 * driver - The name of the printerpak driver (without path or extension)
324 * driverfull - The fully-qualified filename of the printerpak driver
325 * model - The printer make/model name used by the driver
326 */
327InstallPrintDriver: PROCEDURE EXPOSE globals.
328 PARSE ARG driver, driverfull, model
329
330 targetdir = globals.!os2dir'\DLL\'driver
331 IF ( VRFileExists( targetdir'\'driver'.DRV') == 0 ) THEN DO
332 CALL VRMkDir targetdir
333 rc = CopyDriverToSource( driverfull, targetdir )
334 END
335 IF VRGetIni('PM_DEVICE_DRIVERS', driver, 'USER', 'NoClose') <> driverfull THEN
336 CALL VRSetIni 'PM_DEVICE_DRIVERS', driver, driverfull||'00'x, 'USER'
337 CALL VRSetIni 'PM_SPOOLER_DD', driver'.'model, driver'.DRV;;;'||'00'x, 'SYSTEM'
338RETURN rc
339
340
341/*:VRX RSPCreatePort
342*/
343/* Create/update a RINSTPRN response file to create the specified port.
344 */
345RSPCreatePort: PROCEDURE
346 PARSE ARG rsp, portdriver, portname, hostname, printername
347
348 CALL LINEOUT rsp, '* Creates a new printer port.'
349 CALL LINEOUT rsp, '*'
350 CALL LINEOUT rsp, 'ADDPORT'
351 CALL LINEOUT rsp, ' NAME =' portname
352 CALL LINEOUT rsp, ' PORTDRIVER =' portdriver
353 CALL LINEOUT rsp, ' DESCRIPTION =' hostname':'printername
354 CALL LINEOUT rsp, ' INITIALIZATION =' hostname'#'printername
355 CALL LINEOUT rsp, ' TERMINATION = ;'
356 CALL LINEOUT rsp, ' TIMEOUT = 45;'
357 CALL LINEOUT rsp, 'ENDPORT'
358 CALL LINEOUT rsp, ''
359 CALL LINEOUT rsp
360RETURN 1
361
362
363/*:VRX RSPCreatePrinter
364*/
365/* Create a RINSTPRN response file to create the specified printer.
366 */
367RSPCreatePrinter: PROCEDURE
368 PARSE ARG rsp, driver, model, portname, queuename, printername
369
370 IF STREAM( rsp, 'C', 'QUERY EXISTS') <> '' THEN
371 CALL SysFileDelete rsp
372
373 /* This is temporary until we can implement proper options configuration */
374 PARSE UPPER VALUE VALUE('LANG',,'OS2ENVIRONMENT') WITH 1 . 4 _ctry 6 .
375 IF ( WORDPOS( _ctry, 'US CA MX BO CO VE PH CL') > 0 ) THEN
376 page = 'Letter'
377 ELSE
378 page = 'A4'
379 o9n = 'PORTRAIT'
380
381 CALL LINEOUT rsp, '* Creates both a printer queue and a desktop object for this printer.'
382 CALL LINEOUT rsp, '*'
383 CALL LINEOUT rsp, 'ADDQUEUE'
384 CALL LINEOUT rsp, ' NAME =' queuename
385 CALL LINEOUT rsp, ' COMMENT =' printername
386 CALL LINEOUT rsp, ' DRIVERNAME =' driver'.'model
387 CALL LINEOUT rsp, ' PORT =' portname
388 CALL LINEOUT rsp, ' DEFINEQUEUEPROPS'
389 CALL LINEOUT rsp, ' FORMNAME =' page
390 CALL LINEOUT rsp, ' ORIENTATION =' o9n
391 CALL LINEOUT rsp, ' ENDQUEUEPROPS'
392 CALL LINEOUT rsp, 'ENDQUEUE'
393 CALL LINEOUT rsp, ''
394 CALL LINEOUT rsp
395RETURN 1
396
397
398/*:VRX RSPInstallDriver
399*/
400/* Create/update a RINSTPRN response file to install the specified printer
401 * driver. (This doesn't always seem to work so we don't use it except as
402 * a fallback.)
403 */
404RSPInstallDriver: PROCEDURE
405 PARSE ARG rsp, driver, model
406
407 CALL LINEOUT rsp, '* Installs the' driver 'PrinterPak driver.'
408 CALL LINEOUT rsp, '*'
409 CALL LINEOUT rsp, 'ADDPRINTDRIVER'
410 CALL LINEOUT rsp, ' NAME =' driver
411 CALL LINEOUT rsp, 'ENDPRINTDRIVER'
412 CALL LINEOUT rsp, ''
413 CALL LINEOUT rsp, '* Installs support for the' model 'device.'
414 CALL LINEOUT rsp, '*'
415 CALL LINEOUT rsp, 'ADDPRINTDEVICE'
416 CALL LINEOUT rsp, ' NAME =' model
417 CALL LINEOUT rsp, ' DRIVER =' driver
418 CALL LINEOUT rsp, 'ENDPRINTDEVICE'
419 CALL LINEOUT rsp, ''
420 CALL LINEOUT rsp
421RETURN 1
422
423
424/*:VRX GetNameFromPPD
425*/
426GetNameFromPPD: PROCEDURE
427 ARG ppd_file
428
429 IF STREAM( ppd_file, 'C', 'QUERY EXISTS') == '' THEN RETURN ''
430 nickname = ''
431 IF VRParseFilePath( ppd_file, 'E') == 'GZ' THEN DO
432 nq = RXQUEUE('CREATE')
433 oq = RXQUEUE('SET', nq )
434 ADDRESS CMD '@gzip -c -d' ppd_file '| RXQUEUE' nq
435 DO QUEUED()
436 PARSE PULL line
437 line = STRIP( line )
438 IF LEFT( line, 15 ) == '*ShortNickName:' THEN DO
439 PARSE VAR line . ':' _nick '0D'x .
440 nickname = STRIP( _nick )
441 nickname = STRIP( nickname, 'B', '"')
442 LEAVE
443 END
444 END
445 CALL RXQUEUE 'SET', oq
446 CALL RXQUEUE 'DELETE', nq
447 END
448 ELSE DO
449 CALL LINEIN ppd_file, 1, 0
450 DO WHILE LINES( ppd_file ) <> 0
451 line = STRIP( LINEIN( ppd_file ))
452 IF LEFT( line, 15 ) == '*ShortNickName:' THEN DO
453 PARSE VAR line . ':' _nick '0D'x .
454 nickname = STRIP( _nick )
455 nickname = STRIP( nickname, 'B', '"')
456 LEAVE
457 END
458 END
459 CALL STREAM ppd_file, 'C', 'CLOSE'
460 END
461
462RETURN nickname
463
464/*:VRX CleanPPD
465*/
466/* Clean out lines from Gutenprint and Foomatic PPD files that are known to
467 * cause problems when importing with PIN. (Partially based on work by Paul
468 * Smedley and Peter Brown).
469 */
470CleanPPD: PROCEDURE
471 PARSE ARG in_ppd, logfile
472 IF logfile <> '' THEN
473 logfile = STREAM( logfile, 'C', 'QUERY EXISTS')
474
475 out_ppd = VRParseFilePath( in_ppd, 'DPN') || '.TMP'
476 IF STREAM( out_ppd, 'C', 'QUERY EXISTS') \= '' THEN
477 CALL SysFileDelete out_ppd
478
479 IF logfile <> '' THEN
480 CALL CHAROUT logfile, 'Doing cleanup on' in_ppd '...'
481
482 skip_next = 0
483 DO WHILE LINES( in_ppd ) \= 0
484 line = LINEIN( in_ppd )
485 SELECT
486 WHEN skip_next == 1 THEN DO
487 line = STRIP( TRANSLATE( line ))
488 IF line == '*END' THEN skip_next = 0
489 END
490 WHEN LEFT( line, 11 ) == '*StpDefault' THEN NOP
491 WHEN LEFT( line, 7 ) == '*StpStp' THEN NOP
492 WHEN LEFT( line, 18 ) == '*StpResolutionMap:' THEN NOP
493 WHEN LEFT( line, 14 ) == '*OPOptionHints' THEN NOP
494 WHEN LEFT( line, 9 ) == '*Foomatic' THEN DO
495 line = STRIP( line )
496 IF RIGHT( line, 2 ) == '&&' THEN skip_next = 1
497 END
498 OTHERWISE DO
499 CALL LINEOUT out_ppd, line
500 skip_next = 0
501 END
502 END
503 END
504 CALL STREAM in_ppd, 'C', 'CLOSE'
505 CALL STREAM out_ppd, 'C', 'CLOSE'
506
507 ok = VRCopyFile( out_ppd, in_ppd )
508 IF logfile <> '' THEN DO
509 IF ok == 1 THEN
510 CALL LINEOUT logfile, 'OK'
511 ELSE DO
512 CALL LINEOUT logfile, 'Failed!'
513 CALL LINEOUT logfile, ' ->' VRError()
514 END
515 CALL LINEOUT logfile, ''
516 END
517 CALL SysFileDelete out_ppd
518
519RETURN
520
521/*:VRX MatchPrinterModel
522*/
523/* Find a set of printers supported by the OS/2 driver which mostly closely
524 * match the given name.
525 */
526MatchPrinterModel: PROCEDURE EXPOSE globals. models.
527 PARSE UPPER ARG driver_name, printer_name
528 printer_name = TRANSLATE( printer_name, '_', '.')
529 printer_drv = globals.!bootdrv'\OS2\DLL\'driver_name'\'driver_name'.DRV'
530 models.0 = 0
531
532 IF SysGetEA( printer_drv, '.EXPAND', 'exist_ea') <> 0 THEN RETURN 0
533 PARSE VAR exist_ea 1 _eatype 3 .
534 IF C2X( _eatype ) <> 'FDFF' THEN RETURN 0
535
536 PARSE VAR exist_ea 3 _ealen 5 exist_models
537 total_len = C2D( REVERSE( _ealen ))
538
539 /* The variable exist_models now contains a null-separated list of printer
540 * models supported by the driver (including those from previously-imported
541 * PPD files). Next we check each one against our requested printer name.
542 */
543 start = 1
544 count = 0
545 best = 0
546 DO WHILE start < total_len
547 _strend = POS('0'x, exist_models, start )
548 IF _strend == 0 THEN LEAVE
549 _model = TRANSLATE( SUBSTR( exist_models, start, _strend - start ))
550 _model = TRANSLATE( _model, ' ', '-')
551 _comp = COMPARE( _model, printer_name )
552 IF WORD( _model, 1 ) == WORD( printer_name, 1 ) THEN DO
553 count = count + 1
554 IF _comp == 0 THEN DO
555 _comp = 9999
556 best = count
557 END
558 ELSE IF ( best == 0 ) & ( _comp > LENGTH( printer_name )) THEN
559 best = count
560/*
561 models.count = RIGHT( _comp, 4, '0') SUBSTR( exist_models, start, _strend - start )
562*/
563 models.count = SUBSTR( exist_models, start, _strend - start )
564 END
565 start = _strend + 1
566 END
567 models.0 = count
568
569/*
570 CALL SysStemSort 'models.', 'D', 'I',,, 1, 4
571 DO i = 1 TO count
572 models.i = SUBWORD( models.i, 2 )
573 END
574*/
575RETURN best
576
577/*:VRX QueryAvailableDrivers
578*/
579/* Determine which of our supported PrinterPak drivers are currently available.
580 */
581QueryAvailableDrivers: PROCEDURE EXPOSE globals. drv_list.
582 drv_list.0 = 0
583
584 test_drivers = 'ECUPS ECUPS-HP PSPRINT'
585 DO i = 1 TO WORDS( test_drivers )
586 driver = WORD( test_drivers, i )
587 ok = GetDriverSource( driver )
588 IF ok == '' THEN
589 ok = VRGetIni('PM_DEVICE_DRIVERS', driver, 'USER')
590 IF ok <> '' THEN
591 CALL SysStemInsert 'drv_list.', drv_list.0+1, driver
592 END
593
594RETURN drv_list.0
595
Note: See TracBrowser for help on using the repository browser.