home *** CD-ROM | disk | FTP | other *** search
/ swCHIP 1991 January / swCHIP_95-1.bin / utility / gsview13 / src / gvpprn.c < prev    next >
C/C++ Source or Header  |  1995-12-09  |  16KB  |  506 lines

  1. /* Copyright (C) 1993, 1994, Russell Lang.  All rights reserved.
  2.   
  3.   This file is part of GSview.
  4.   
  5.   This program is distributed with NO WARRANTY OF ANY KIND.  No author
  6.   or distributor accepts any responsibility for the consequences of using it,
  7.   or for whether it serves any particular purpose or works at all, unless he
  8.   or she says so in writing.  Refer to the GSview Free Public Licence 
  9.   (the "Licence") for full details.
  10.   
  11.   Every copy of GSview must include a copy of the Licence, normally in a 
  12.   plain ASCII text file named LICENCE.  The Licence grants you the right 
  13.   to copy, modify and redistribute GSview, but only under certain conditions 
  14.   described in the Licence.  Among other things, the Licence requires that 
  15.   the copyright notice and this notice be preserved on all copies.
  16. */
  17.  
  18. /* gvpprn.c */
  19. /* Printer routines for PM GSview */
  20. #include "gvpm.h"
  21.  
  22. char not_defined[] = "[Not defined]";
  23.  
  24. MRESULT EXPENTRY
  25. SpoolDlgProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
  26. {
  27. int notify_message;
  28. int i;
  29. char *entry;
  30.     switch(msg) {
  31.       case WM_INITDLG:
  32.     entry = (char *)mp2;
  33.     while (*entry) {
  34.         WinSendMsg( WinWindowFromID(hwnd, SPOOL_PORT),
  35.             LM_INSERTITEM, MPFROMLONG(LIT_END), MPFROMP(entry));
  36.         entry += strlen(entry)+1;
  37.     }
  38.     i = (int)WinSendMsg( WinWindowFromID(hwnd, SPOOL_PORT),
  39.         LM_SEARCHSTRING, MPFROM2SHORT(LSS_CASESENSITIVE, LIT_FIRST),
  40.         MPFROMP(option.printer_port) );
  41.     if ((i == LIT_ERROR) || (i == LIT_NONE))
  42.         i = 0;
  43.     WinSendMsg( WinWindowFromID(hwnd, SPOOL_PORT),
  44.             LM_SELECTITEM, MPFROMLONG(i), MPFROMLONG(TRUE) );
  45.     break;
  46.     case WM_CONTROL:
  47.     notify_message = SHORT2FROMMP(mp1);
  48.     switch (notify_message) {
  49.         case LN_ENTER:
  50.             if (SHORT1FROMMP(mp1) == SPOOL_PORT)
  51.             WinPostMsg(hwnd, WM_COMMAND, (MPARAM)DID_OK, MPFROM2SHORT(CMDSRC_OTHER, TRUE));
  52.         break;
  53.     }
  54.     break;
  55.     case  WM_COMMAND:
  56.       switch(LOUSHORT(mp1)) {
  57.         case DID_OK:
  58.         i = (int)WinSendMsg(WinWindowFromID(hwnd, SPOOL_PORT), 
  59.             LM_QUERYSELECTION, (MPARAM)0, (MPARAM)0);
  60.         if (i != LIT_NONE)
  61.             WinSendMsg(WinWindowFromID(hwnd, SPOOL_PORT), LM_QUERYITEMTEXT,  MPFROM2SHORT(i, sizeof(option.printer_port)), MPFROMP(option.printer_port));
  62.         WinDismissDlg(hwnd, 1+(int)WinSendMsg(WinWindowFromID(hwnd, SPOOL_PORT), 
  63.         LM_QUERYSELECTION, (MPARAM)0, (MPARAM)0));
  64.             return (MRESULT)TRUE;
  65.       }
  66.       break;
  67.     }
  68.     return WinDefDlgProc(hwnd, msg, mp1, mp2);
  69. }
  70.  
  71. char *
  72. get_ports(char *p, int len)
  73. {
  74. PROFILE *prf;
  75. #define PORTSECTION "Ports"
  76.     if ( (prf = profile_open(szIniFile)) == (PROFILE *)NULL)
  77.         return (char *)NULL;
  78.  
  79.     profile_read_string(prf, PORTSECTION, NULL, "", p, PROFILE_SIZE);
  80.     if (strlen(p) == 0) {
  81.         /* [Ports] section doesn't exist.  Initialise from resources */
  82.         profile_create_section(prf, PORTSECTION, IDR_PORTS);
  83.         profile_read_string(prf, PORTSECTION, NULL, "", p, len);
  84.     }
  85.     profile_close(prf);
  86.     return p;
  87. }
  88.  
  89.  
  90. /* Print File to port */
  91. /* port==NULL means prompt for port with dialog box */
  92. int
  93. gp_printfile(char *filename, char *port)
  94. {
  95. #define PRINT_BUF_SIZE 16384u
  96. char *buffer;
  97. char *portname;
  98. int i, iport;
  99. unsigned int count;
  100. FILE *f;
  101. FILE *printer;
  102. int error = FALSE;
  103. long lsize;
  104. long ldone;
  105. char fmt[MAXSTR];
  106. char pcdone[10];
  107.  
  108.     if ((buffer = malloc(PRINT_BUF_SIZE)) == (char *)NULL)
  109.         return FALSE;
  110.     if (port == (char *)NULL) {
  111.         /* get list of ports */
  112.         get_ports(buffer, PRINT_BUF_SIZE);
  113.         /* select a port */
  114.         iport = WinDlgBox(HWND_DESKTOP, hwnd_frame, SpoolDlgProc, 0, IDD_SPOOL, buffer);
  115.         if (!iport || iport == 65536) {
  116.         free(buffer);
  117.         return FALSE;
  118.         }
  119.         portname = buffer;
  120.         for (i=1; i<iport && strlen(portname)!=0; i++)
  121.         portname += strlen(portname)+1;
  122.     }
  123.     else
  124.         portname = port;
  125.     if (strcmp(portname,"FILE:") == 0) {
  126.         strcpy(buffer, "*.prn");
  127.         if (!get_filename(buffer, TRUE, FILTER_ALL, IDS_PRINTFILE, IDS_TOPICPRINT)) {
  128.             free(buffer);
  129.             return FALSE;
  130.         }
  131.         portname = buffer;
  132.     }
  133.     else {
  134.         portname[strlen(portname)-1] = '\0';  /* remove trailing colon */
  135.     }
  136.     
  137.     if ((f = fopen(filename, "rb")) == (FILE *)NULL) {
  138.         free(buffer);
  139.         return FALSE;
  140.     }
  141.     fseek(f, 0L, SEEK_END);
  142.     lsize = ftell(f);
  143.     if (lsize <= 0)
  144.         lsize = 1;
  145.     fseek(f, 0L, SEEK_SET);
  146.  
  147.     printer = fopen(portname, "wb");
  148.     if (printer == (FILE *)NULL) {
  149.             fclose(f);
  150.         free(buffer);
  151.             return FALSE;
  152.     }
  153.  
  154. /*
  155.     hDlgModeless = CreateDialog(phInstance, "CancelDlgBox", hwndimg, lpfnCancelProc);
  156. */
  157.     ldone = 0;
  158.     load_string(IDS_CANCELDONE, fmt, sizeof(fmt));
  159.  
  160.     while (!error /* && hDlgModeless  */
  161.       && (count = fread(buffer, 1, PRINT_BUF_SIZE, f)) != 0 ) {
  162.         if (fwrite(buffer, 1, count, printer) != count)
  163.         error = TRUE;
  164.         ldone += count;
  165.         sprintf(pcdone, fmt, (int)(ldone * 100 / lsize));
  166.         /* WinSetWindowText(WinWindowFromID(hwnd_cancel, CANCEL_PCDONE), pcdone); */
  167. /*
  168.         while (PeekMessage(&msg, hDlgModeless, 0, 0, PM_REMOVE)) {
  169.             if ((hDlgModeless == 0) || !IsDialogMessage(hDlgModeless, &msg)) {
  170.             TranslateMessage(&msg);
  171.             DispatchMessage(&msg);
  172.         }
  173.         }
  174. */
  175.     }
  176.     free(buffer);
  177.     fclose(f);
  178.     fclose(printer);
  179.  
  180.     return !error;
  181. }
  182.  
  183.  
  184. /* dialog box for selecting printer properties */
  185. MRESULT EXPENTRY
  186. PropDlgProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
  187. {
  188.     char buf[128];
  189.     int iprop;
  190.     int ivalue;
  191.     char *p;
  192.     char *value;
  193.     static char device[MAXSTR];    /* contains printer device name */
  194.     static struct prop_item_s* propitem;
  195.     char section[MAXSTR];
  196.  
  197.     switch (msg) {
  198.       case WM_INITDLG:
  199.     strcpy(device, mp2);    /* initialise device name */
  200.     propitem = get_properties(device);
  201.     if (propitem == (struct prop_item_s *)NULL) {
  202.         WinDismissDlg(hwnd, FALSE);
  203.         return (MRESULT)TRUE;
  204.     }
  205.     for (iprop=0; propitem[iprop].name[0]; iprop++) {
  206.         WinSendMsg( WinWindowFromID(hwnd, PROP_NAME),
  207.             LM_INSERTITEM, MPFROMLONG(LIT_END), MPFROMP(propitem[iprop].name+1));
  208.     }
  209.     WinSendMsg( WinWindowFromID(hwnd, PROP_NAME),
  210.             LM_SELECTITEM, MPFROMLONG(0), MPFROMLONG(TRUE) );
  211. /*
  212.     WinSendMsg(hwnd, WM_CONTROL, MPFROM2SHORT(PROP_NAME, CBN_LBSELECT),
  213.             MPFROMLONG(WinWindowFromID(hwnd, PROP_NAME)));
  214. */
  215.     break;
  216.       case WM_CONTROL:
  217.     if (mp1 == MPFROM2SHORT(PROP_NAME, CBN_LBSELECT)) {
  218.         iprop = (int)WinSendMsg(WinWindowFromID(hwnd, PROP_NAME), LM_QUERYSELECTION, (MPARAM)0, (MPARAM)0);
  219.         if (iprop == LIT_NONE)
  220.             return FALSE;
  221.         /* now look up entry in gsview.ini */
  222.         /* and update PROP_VALUE list box */
  223.         strcpy(section, device);
  224.         strcat(section, " values");
  225.         {PROFILE *prf;
  226. /* need to reopen profile file - this is wasteful */
  227.         if ( (prf = profile_open(szIniFile)) != (PROFILE *)NULL ) {
  228.                 profile_read_string(prf, section, propitem[iprop].name, "", buf, sizeof(buf)-2);
  229.             profile_close(prf);
  230.         }
  231.         else
  232.             buf[0] = '\0';
  233.         }
  234.         while ((*buf) && (buf[strlen(buf)-1]==' '))
  235.         buf[strlen(buf)-1] = '\0';    /* remove trailing spaces */
  236.         buf[strlen(buf)+1] = '\0';    /* put double NULL at end */
  237.         WinSendMsg(WinWindowFromID(hwnd, PROP_VALUE), LM_DELETEALL, (MPARAM)0, (MPARAM)0);
  238.         WinSendMsg( WinWindowFromID(hwnd, PROP_VALUE),
  239.                     LM_INSERTITEM, MPFROMLONG(LIT_END), MPFROMP(not_defined) );
  240.         p = buf;
  241.         if (*p != '\0') {
  242.           WinEnableWindow(WinWindowFromID(hwnd, PROP_VALUE), TRUE);
  243.           while (*p!='\0') {
  244.         value = p;
  245.         while ((*p!='\0') && (*p!=','))
  246.             p++;
  247.         *p++ = '\0';
  248.             WinSendMsg( WinWindowFromID(hwnd, PROP_VALUE),
  249.                     LM_INSERTITEM, MPFROMLONG(LIT_END), MPFROMP(value) );
  250.           }
  251.         }
  252.         iprop = (int)WinSendMsg( WinWindowFromID(hwnd, PROP_VALUE),
  253.                 LM_SEARCHSTRING, MPFROM2SHORT(LSS_CASESENSITIVE, LIT_FIRST),
  254.             MPFROMP(propitem[iprop].value) );
  255.         if ((iprop == LIT_ERROR) || (iprop == LIT_NONE))
  256.         iprop = 0;
  257.         WinSendMsg( WinWindowFromID(hwnd, PROP_VALUE),
  258.             LM_SELECTITEM, MPFROMLONG(iprop), MPFROMLONG(TRUE) );
  259. /*
  260.             SetDlgItemText(hDlg, PROP_VALUE, propitem[iprop].value);
  261. */
  262.     }
  263.     if (mp1 == MPFROM2SHORT(PROP_VALUE, CBN_LBSELECT)) {
  264.         iprop = (int)WinSendMsg(WinWindowFromID(hwnd, PROP_NAME), LM_QUERYSELECTION, (MPARAM)0, (MPARAM)0);
  265.         if (iprop == LIT_NONE)
  266.             return FALSE;
  267.         ivalue = (int)WinSendMsg(WinWindowFromID(hwnd, PROP_VALUE), LM_QUERYSELECTION, (MPARAM)0, (MPARAM)0);
  268.         if (ivalue == LIT_NONE)
  269.             return FALSE;
  270.         WinSendMsg(WinWindowFromID(hwnd, PROP_VALUE), LM_QUERYITEMTEXT,  
  271.         MPFROM2SHORT(ivalue, sizeof(propitem->value)), 
  272.         MPFROMP(propitem[iprop].value));
  273.     }
  274.     if (mp1 == MPFROM2SHORT(PROP_VALUE, CBN_EFCHANGE)) {
  275.         iprop = (int)WinSendMsg(WinWindowFromID(hwnd, PROP_NAME), LM_QUERYSELECTION, (MPARAM)0, (MPARAM)0);
  276.         if (iprop == LIT_NONE)
  277.             return FALSE;
  278.         WinQueryWindowText(WinWindowFromID(hwnd, PROP_VALUE), 
  279.              sizeof(propitem->value), propitem[iprop].value);
  280.     }
  281.     break;
  282.     case WM_COMMAND:
  283.     switch(LOUSHORT(mp1)) {
  284.         case ID_HELP:
  285.         get_help();
  286.         return (MRESULT)TRUE;
  287.         case DID_OK:
  288.             {PROFILE *prf;
  289. /* need to reopen profile file - this is wasteful */
  290.           if ( (prf = profile_open(szIniFile)) != (PROFILE *)NULL ) {
  291.             for (iprop=0; propitem[iprop].name[0]; iprop++) {
  292.             profile_write_string(prf, device, propitem[iprop].name, propitem[iprop].value);
  293.             }
  294.             profile_close(prf);
  295.           }
  296.         }
  297.         free((char *)propitem);
  298.         WinDismissDlg(hwnd, DID_OK);
  299.                 return (MRESULT)TRUE;
  300.         case DID_CANCEL:
  301.         free((char *)propitem);
  302.         WinDismissDlg(hwnd, DID_CANCEL);
  303.         return (MRESULT)TRUE;
  304.     }
  305.     break;
  306.     }
  307.     return WinDefDlgProc(hwnd, msg, mp1, mp2);
  308. }
  309.  
  310.  
  311. /* dialog box for selecting printer device and resolution */
  312. MRESULT EXPENTRY
  313. DeviceDlgProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
  314. {
  315.     char buf[128];
  316.     int idevice;
  317.     int i;
  318.     char *p;
  319.     char *res;
  320.     int numentry;
  321.     char entry[MAXSTR];
  322.     struct prop_item_s *proplist;
  323.  
  324.     switch (msg) {
  325.     case WM_INITDLG:
  326.         p = get_devices();
  327.         res = p;    /* save for free() */
  328.         idevice = 0;
  329.         for (numentry=0; p!=(char *)NULL && strlen(p)!=0; numentry++) {
  330.             WinSendMsg( WinWindowFromID(hwnd, DEVICE_NAME),
  331.                 LM_INSERTITEM, MPFROMLONG(LIT_END), MPFROMP(p) );
  332.         if (strcmp(p, option.device_name) == 0)
  333.             idevice = numentry;
  334.             p += strlen(p) + 1;
  335.         }
  336.         free(res);
  337.         WinSendMsg( WinWindowFromID(hwnd, DEVICE_NAME),
  338.             LM_SELECTITEM, MPFROMLONG(idevice), MPFROMLONG(TRUE) );
  339.         /* force update of DEVICE_RES */
  340.         WinSendMsg(hwnd, WM_CONTROL, MPFROM2SHORT(DEVICE_NAME, CBN_LBSELECT),
  341.             MPFROMLONG(WinWindowFromID(hwnd, DEVICE_NAME)));
  342.         i = (int)WinSendMsg( WinWindowFromID(hwnd, DEVICE_RES),
  343.                 LM_SEARCHSTRING, MPFROM2SHORT(LSS_CASESENSITIVE, LIT_FIRST),
  344.             MPFROMP(option.device_resolution) );
  345.         if ((i == LIT_ERROR) || (i == LIT_NONE))
  346.         i = 0;
  347.         WinSendMsg( WinWindowFromID(hwnd, DEVICE_RES),
  348.             LM_SELECTITEM, MPFROMLONG(i), MPFROMLONG(TRUE) );
  349.         break;
  350.         case WM_CONTROL:
  351.         if (mp1 == MPFROM2SHORT(DEVICE_NAME, CBN_LBSELECT)) {
  352.         idevice = (int)WinSendMsg(WinWindowFromID(hwnd, DEVICE_NAME), LM_QUERYSELECTION, (MPARAM)0, (MPARAM)0);
  353.         if (idevice == LIT_NONE)
  354.             return FALSE;
  355.         WinSendMsg(WinWindowFromID(hwnd, DEVICE_NAME), LM_QUERYITEMTEXT,  MPFROM2SHORT(idevice, sizeof(entry)), MPFROMP(entry));
  356.         if ( (proplist = get_properties(entry)) != (struct prop_item_s *)NULL ) {
  357.                 free((char *)proplist);
  358.             WinEnableWindow(WinWindowFromID(hwnd, DEVICE_PROP), TRUE);
  359.         }
  360.         else
  361.             WinEnableWindow(WinWindowFromID(hwnd, DEVICE_PROP), FALSE);
  362.         /* now look up entry in gvpm.ini */
  363.         /* and update DEVICE_RES list box */
  364.         {PROFILE *prf;
  365. /* need to reopen profile file - this is wasteful */
  366.           if ( (prf = profile_open(szIniFile)) != (PROFILE *)NULL ) {
  367.             profile_read_string(prf, DEVSECTION, entry, "", buf, sizeof(buf)-2);
  368.             profile_close(prf);
  369.           }
  370.           else
  371.             buf[0] = '\0';
  372.         }
  373.             while ((*buf) && (buf[strlen(buf)-1]==' '))
  374.             buf[strlen(buf)-1] = '\0';    /* remove trailing spaces */
  375.         buf[strlen(buf)+1] = '\0';    /* double NULL at end */
  376.         WinSendMsg(WinWindowFromID(hwnd, DEVICE_RES), LM_DELETEALL, (MPARAM)0, (MPARAM)0);
  377.         p = buf;
  378.         if (*p == '\0') {
  379.             /* no resolutions can be set */
  380.             WinEnableWindow(WinWindowFromID(hwnd, DEVICE_RES), FALSE);
  381.             WinEnableWindow(WinWindowFromID(hwnd, DEVICE_RESTEXT), FALSE);
  382.         }
  383.         else {
  384.           WinEnableWindow(WinWindowFromID(hwnd, DEVICE_RES), TRUE);
  385.           WinEnableWindow(WinWindowFromID(hwnd, DEVICE_RESTEXT), TRUE);
  386.           while (*p!='\0') {
  387.             res = p;
  388.             while ((*p!='\0') && (*p!=','))
  389.             p++;
  390.             *p++ = '\0';
  391.                 WinSendMsg( WinWindowFromID(hwnd, DEVICE_RES),
  392.                     LM_INSERTITEM, MPFROMLONG(LIT_END), MPFROMP(res) );
  393.           }
  394.         }
  395.             WinSendMsg( WinWindowFromID(hwnd, DEVICE_RES),
  396.                 LM_SELECTITEM, MPFROMLONG(0), MPFROMLONG(TRUE) );
  397.         if ((int)WinSendMsg(WinWindowFromID(hwnd, DEVICE_RES), LM_QUERYSELECTION, (MPARAM)0, (MPARAM)0)
  398.             != LIT_NONE)
  399.             WinSetWindowText(WinWindowFromID(hwnd, DEVICE_RES), buf);
  400.         }
  401.         break;
  402.     case WM_COMMAND:
  403.         switch(LOUSHORT(mp1)) {
  404.         case DID_OK:
  405.             /* save device name and resolution */
  406.             WinQueryWindowText(WinWindowFromID(hwnd, DEVICE_NAME), 
  407.              sizeof(option.device_name), option.device_name);
  408.             WinQueryWindowText(WinWindowFromID(hwnd, DEVICE_RES), 
  409.             sizeof(option.device_resolution), option.device_resolution);
  410.             WinDismissDlg(hwnd, DID_OK);
  411.                     return (MRESULT)TRUE;
  412.             case ID_HELP:
  413.             get_help();
  414.             return (MRESULT)TRUE;
  415.         case DEVICE_PROP:
  416.             idevice = (int)WinSendMsg(WinWindowFromID(hwnd, DEVICE_NAME), 
  417.             LM_QUERYSELECTION, (MPARAM)0, (MPARAM)0);
  418.             if (idevice == LIT_NONE)
  419.                 return (MRESULT)TRUE;
  420.             WinSendMsg(WinWindowFromID(hwnd, DEVICE_NAME), LM_QUERYITEMTEXT,  MPFROM2SHORT(idevice, sizeof(entry)), MPFROMP(entry));
  421.             if ( (proplist = get_properties(entry)) != (struct prop_item_s *)NULL ) {
  422.                     free((char *)proplist);
  423.                 load_string(IDS_TOPICPRINT, szHelpTopic, sizeof(szHelpTopic));
  424.                     WinDlgBox(HWND_DESKTOP, hwnd, PropDlgProc, 0, IDD_PROP, entry);
  425.             }
  426.             else
  427.                 play_sound(SOUND_ERROR);
  428.             return (MRESULT)TRUE;
  429.         }
  430.         break;
  431.     }
  432.     return WinDefDlgProc(hwnd, msg, mp1, mp2);
  433. }
  434.  
  435.  
  436. /* print a range of pages using a Ghostscript device */
  437. void
  438. gsview_print(BOOL to_file)
  439. {
  440.     int flag;
  441.     char command[MAXSTR+MAXSTR];
  442.     char progname[256];
  443.     char *args;
  444.     PRINTER *prn = &printer;
  445.     
  446.  
  447.     if (psfile.name[0] == '\0') {
  448.         gserror(IDS_NOTOPEN, NULL, MB_ICONEXCLAMATION, SOUND_NOTOPEN);
  449.         return;
  450.     }
  451.     
  452.     load_string(IDS_TOPICPRINT, szHelpTopic, sizeof(szHelpTopic));
  453.     if (WinDlgBox(HWND_DESKTOP, hwnd_frame, DeviceDlgProc, 0, IDD_DEVICE, NULL)
  454.         != DID_OK)
  455.         return;
  456.  
  457.     if (!gsview_cprint(to_file, prn->cfname, prn->fname))
  458.         return;
  459.  
  460.     args = strchr(option.gscommand, ' ');
  461.     if (args) {
  462.         strncpy(progname, option.gscommand, (int)(args-option.gscommand));
  463.         progname[(int)(args-option.gscommand)] = '\0';
  464.         args++;
  465.     }
  466.     else {
  467.         strncpy(progname, option.gscommand, MAXSTR);
  468.         args = "";
  469.     }
  470.  
  471.     sprintf(command,"%s @%s", args, prn->fname);
  472.  
  473.     if (strlen(command) > MAXSTR-1) {
  474.         /* command line too long */
  475.         gserror(IDS_TOOLONG, command, MB_ICONHAND, SOUND_ERROR);
  476.         if (!debug)
  477.             unlink(prn->fname);
  478.         prn->fname[0] = '\0';
  479.             if ((prn->cfname[0] != '\0') && !debug)
  480.             unlink(prn->cfname);
  481.             prn->cfname[0] = '\0';
  482.         return;
  483.     }
  484.  
  485.     load_string(IDS_WAITPRINT, szWait, sizeof(szWait));
  486.     info_wait(TRUE);
  487.  
  488.     flag = exec_pgm(progname, command, FALSE, &prn->prog);
  489.     if (!flag || !prn->prog.valid) {
  490.             cleanup_pgm(&prn->prog);
  491.         gserror(IDS_CANNOTRUN, command, MB_ICONHAND, SOUND_ERROR);
  492.         if (!debug)
  493.             unlink(prn->fname);
  494.         prn->fname[0] = '\0';
  495.             if ((prn->cfname[0] != '\0') && !debug)
  496.             unlink(prn->cfname);
  497.             prn->cfname[0] = '\0';
  498.         info_wait(FALSE);
  499.         return;
  500.     }
  501.     info_wait(FALSE);
  502.     
  503.     return;
  504. }
  505.  
  506.