home *** CD-ROM | disk | FTP | other *** search
- /*---------------------------------------------------------*
- | Author: Maurizio Loreti, aka MLO or I3NOO. |
- | Address: University of Padova - Department of Physics |
- | Via F. Marzolo, 8 - 35131 PADOVA - Italy |
- | Phone: (39)(49) 844-313 FAX: (39)(49) 844-245 |
- | E-Mail: LORETI at IPDINFN (BITNET); or VAXFPD::LORETI |
- | (DECnet) - VAXFPD is node 38.257 i.e. 39169; or |
- | LORETI@PADOVA.INFN.IT (INTERNET). |
- | Home: Via G. Donizetti 6 - 35010 CADONEGHE (PD) - Italy |
- *---------------------------------------------------------*/
-
- /*--------------------------------*
- | PF.c - Short for PRINTFILES.c |
- | See the Read.Me file for help. |
- *--------------------------------*/
-
- #include <stdio.h> /* Standard library */
- #include <string.h>
- #include <exec/types.h> /* Amiga specific */
- #include <intuition/intuition.h>
- #include <graphics/gfxbase.h>
- #include <libraries/dos.h>
- #include <libraries/reqbase.h>
- #include <devices/printer.h>
- #include <proto/intuition.h>
- #include <proto/graphics.h>
- #include "mlo.h" /* This program's stuff */
- #include "pf2.h"
- #include "global.h"
-
- static char Version_Tag[] = VERSION_TAG; /* For C:VERSION PF2 */
-
- void main(
- int argc,
- char **argv
- ){
-
- /**
- | Main program: look if we were started from CLI or Workbench;
- | then process printer parameters; last, print selected files.
-
- **/
-
- Boolean select = False; /* 'Some file selected' flag */
- struct ESStructure *pESS; /* 'Extended selection' pointer */
- char fileName[FIL_MAX]; /* File name */
- char dirName[DIR_MAX]; /* Directory name */
- char target[TOT_MAX]; /* Complete name */
- int i;
-
- if (argc) {
- IntuitionBase = LibOpen("intuition.library", REVISION);
- FromCLI = True;
- argv = Setup(&argc, argv);
- } else {
- FromCLI = False;
- SetupWB();
-
- /**
- | Set file requester parameters (only if called from the Workbench)
- **/
-
- fr.Title = "File(s) to print:";
- fr.Dir = dirName;
- fr.File = fileName;
- fr.Flags = FRQSHOWINFOM | FRQCACHINGM | FRQINFOGADGETM |
- FRQEXTSELECTM | FRQSAVINGM;
- fr.MaxExtendedSelect = MAX_FILES;
- fr.dirnamescolor = fr.devicenamescolor = RED_PEN;
- fr.stringnamecolor = fr.stringgadgetcolor = BLACK_PEN;
- fr.boxbordercolor = fr.gadgetboxcolor = BLACK_PEN;
- }
-
- InitPrinter();
- bufferLength -= nBlanks;
-
- if (FromCLI) {
- for (; argc--; argv++) {
- DoOutput(*argv);
- }
- } else {
- FOREVER {
- fileName[0] = NIHIL;
- if (FileRequester(&fr)) {
- select = True;
- strcpy(target, dirName);
- if ((i = strlen(target)) && target[i-1] != ':') {
- target[i++] = '/';
- }
- if ((pESS = fr.ExtendedSelect) == NULL) {
- strcpy(target+i, fileName);
- DoOutput(target);
- } else {
- do {
- strcpy(target+i, pESS->thefilename);
- DoOutput(target);
- } while ( (pESS = pESS->NextFile) != NULL);
- }
- } else {
- break;
- }
- }
-
- if (!select) {
- puts("Printer initialised ... Good bye!");
- Cleanup(SYS_NORMAL_CODE);
- }
- }
-
- FlushBuffers();
- ExitProgram();
- }
-