Changeset 330 for trunk/dll/systemf.c


Ignore:
Timestamp:
Jul 25, 2006, 8:45:04 PM (19 years ago)
Author:
root
Message:

Use Runtime_Error

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/dll/systemf.c

    r123 r330  
    77
    88  Copyright (c) 1993-98 M. Kimes
    9   Copyright (c) 2003, 2004 Steven H.Levine
    10 
    11   Revisions     21 Nov 03 SHL - Comments
    12                 31 Jul 04 SHL - Indent -i2
    13                 01 Aug 04 SHL - Rework lstrip/rstrip usage
     9  Copyright (c) 2003, 2006 Steven H.Levine
     10
     11  21 Nov 03 SHL Comments
     12  31 Jul 04 SHL Indent -i2
     13  01 Aug 04 SHL Rework lstrip/rstrip usage
     14  17 Jul 06 SHL Use Runtime_Error
    1415
    1516***********************************************************************/
     
    1920#define INCL_DOS
    2021#define INCL_DOSERRORS
    21 
    2222#include <os2.h>
     23
    2324#include <stdlib.h>
    2425#include <stdio.h>
     
    2728#include <ctype.h>
    2829#include <time.h>
     30
    2931#include "fm3dll.h"
    3032#include "fm3dlg.h"
    3133#include "fm3str.h"
    3234
     35static PSZ pszSrcFile = __FILE__;
     36
    3337#pragma alloc_text(SYSTEMF,ShowSession,ExecOnList,runemf2)
    3438
     
    3943BOOL ShowSession(HWND hwnd, PID pid)
    4044{
    41 
    4245  HSWITCH hswitch;
    4346  SWCNTRL swctl;
     
    6467               char **list, char *prompt)
    6568{
    66 
    6769  /* executes the command once for all files in list */
    6870
     
    177179            sprintf(&listfile[strlen(listfile)], "%s%03x",
    178180                    LISTTEMPROOT, (clock() & 4095L));
    179             fp = fopen(listfile, "w");
     181            fp = xfopen(listfile, "w",pszSrcFile,__LINE__);
    180182            if (fp)
    181183            {
     
    667669            char *formatstring,...)
    668670{
    669 
    670671  /* example:
    671672
     
    713714    hwnd = HWND_DESKTOP;
    714715
    715   rc = DosAllocMem((PVOID) & s,
     716  rc = DosAllocMem((PVOID)&s,
    716717                   MAXSTRG,
    717718                   PAG_COMMIT | OBJ_TILE | PAG_READ | PAG_WRITE);
    718   if (rc)
     719  if (rc) {
     720    Dos_Error(MB_CANCEL,rc,hwnd,pszSrcFile,__LINE__,GetPString(IDS_OUTOFMEMORY));
    719721    return -1;
     722  }
    720723
    721724  *savedir = 0;
     
    761764      p++;
    762765      temp = *p;
    763       if (temp)
    764         rc = DosAllocMem((PVOID) & s2,
     766      if (temp) {
     767        rc = DosAllocMem((PVOID)&s2,
    765768                         MAXSTRG * 2,
    766769                         PAG_COMMIT | OBJ_TILE | PAG_READ | PAG_WRITE);
     770        if (rc)
     771          Dos_Error(MB_CANCEL,rc,hwnd,pszSrcFile,__LINE__,GetPString(IDS_OUTOFMEMORY));
     772      }
    767773      else
    768774        s2 = NULL;
     
    842848          switch_to(directory);
    843849        }
    844         ret = (int) DosQAppType(s,
    845                                 &apptype);
     850        ret = (int) DosQAppType(s,&apptype);
    846851        if (!strchr(s, '\\') &&
    847852            !strchr(s, ':') &&
     
    851856        if (ret)
    852857        {
    853           DosBeep(50, 100);
     858          Dos_Error(MB_CANCEL,ret,hwnd,pszSrcFile,__LINE__,"DosQAppType");
    854859          if (s)
    855860            DosFreeMem(s);
     
    863868              (apptype & FAPPTYP_PHYSDRV) || (apptype & FAPPTYP_PROTDLL))
    864869          {
    865             DosBeep(250, 100);
     870            Runtime_Error(pszSrcFile, __LINE__, "unexpected apptype");
    866871            if (s)
    867872              DosFreeMem(s);
     
    873878              (apptype & FAPPTYP_WINDOWSPROT) || (apptype & 0x1000))
    874879          {
    875             DosBeep(500, 100);
     880            Runtime_Error(pszSrcFile, __LINE__, "unexpected apptype");
    876881            if (s)
    877882              DosFreeMem(s);
     
    893898        if (directory && *directory)
    894899          switch_to(savedir);
    895         if (ret)
    896           Dos_Error(MB_ENTER,
    897                     ret,
    898                     hwnd,
    899                     __FILE__,
    900                     __LINE__,
     900        if (ret) {
     901          Dos_Error(MB_ENTER,ret,hwnd,pszSrcFile,__LINE__,
    901902                    GetPString(IDS_DOSEXECPGMFAILEDTEXT));
     903        }
    902904      }
    903905    }
     
    910912      if (rc)
    911913      {
     914        Dos_Error(MB_CANCEL,rc,hwnd,pszSrcFile,__LINE__,GetPString(IDS_OUTOFMEMORY));
    912915        DosFreeMem(s);
    913916        return -1;
     
    11411144      if (directory && *directory)
    11421145        switch_to(savedir);
    1143       if (ret && ret != ERROR_SMG_START_IN_BACKGROUND)
    1144         Dos_Error(MB_CANCEL | MB_ICONEXCLAMATION,
    1145                   ret,
    1146                   hwnd,
    1147                   __FILE__,
    1148                   __LINE__,
    1149                   GetPString(IDS_DOSSTARTSESSIONFAILEDTEXT),
    1150                   s,
    1151                   s2);
     1146      if (ret && ret != ERROR_SMG_START_IN_BACKGROUND) {
     1147        Dos_Error(MB_CANCEL,ret,hwnd,pszSrcFile,__LINE__,
     1148                  GetPString(IDS_DOSSTARTSESSIONFAILEDTEXT),s,s2);
     1149      }
    11521150      else if (type & WAIT)
    11531151      {
     
    11571155        if (!hque)
    11581156        {
    1159 
    11601157          STATUSDATA sd;
    11611158
     
    12261223          PROGTYPE * progt, ULONG fl, char *formatstring,...)
    12271224{
    1228 
    12291225  PROGDETAILS pgd;
    12301226  register char *p;
     
    12381234    ulOptions |= SAF_STARTCHILDAPP;
    12391235
    1240   executable = malloc(MAXSTRG);
    1241   if (executable)
    1242   {
    1243     memset(executable, 0, MAXSTRG);
     1236  executable = xmallocz(MAXSTRG,pszSrcFile,__LINE__);
     1237  if (executable) {
    12441238    va_start(parguments, formatstring);
    12451239    vsprintf(executable, formatstring, parguments);
     
    12481242    if (*executable)
    12491243    {
    1250       parameters = malloc(MAXSTRG);
     1244      parameters = xmalloc(MAXSTRG,pszSrcFile,__LINE__);
    12511245      if (parameters)
    12521246      {
     
    12881282          char *temp;
    12891283
    1290           temp = malloc(CCHMAXPATH * 2);
     1284          temp = xmalloc(CCHMAXPATH * 2,pszSrcFile,__LINE__);
    12911285          if (temp)
    12921286          {
Note: See TracChangeset for help on using the changeset viewer.