Changeset 32 for rxprtutl


Ignore:
Timestamp:
Jul 11, 2016, 2:43:58 PM (9 years ago)
Author:
Alex Taylor
Message:

Move several common functions into shared directory.

Location:
rxprtutl/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • rxprtutl/trunk/Makefile

    r7 r32  
    11# Makefile for IBM C Compiler 3.x and NMAKE32.
     2
     3SHARED = ..\..\shared
     4
    25CC     = icc
    36LINK   = ilink
    4 CFLAGS = /Ss /Q /Wuse /Gm /Gd
     7CFLAGS = /Ss /Q /Wuse /Gm /Gd /I$(SHARED) /DSZ_ERROR_NAME="\"RPUERROR\""
    58LFLAGS = /NOLOGO /MAP
    69NAME   = rxprtutl
     
    912# Set environment variable DEBUG (=anything) to build with debugging symbols
    1013!ifdef DEBUG
    11     CFLAGS = $(CFLAGS) /Ti /Tm
    12     LFLAGS = $(LFLAGS) /DEBUG
     14CFLAGS = $(CFLAGS) /Ti /Tm
     15LFLAGS = $(LFLAGS) /DEBUG
    1316!endif
    1417
    15 $(NAME).dll : $(NAME).obj
     18$(NAME).dll : $(NAME).obj shfuncs.obj Makefile
    1619                @makedesc -N"Alex Taylor" -D"REXX Printer Management Utilities" -V"^#define=SZ_VERSION,$(NAME).c" $(NAME).def
    17                 $(LINK) $(LFLAGS) $(NAME).obj $(NAME).def $(LIBS) /O:$@
     20                $(LINK) $(LFLAGS) $(NAME).obj shfuncs.obj $(NAME).def $(LIBS) /O:$@
    1821                @dllrname.exe $@ CPPOM30=OS2OM30 /Q /R
    1922
    20 $(NAME).obj : $(NAME).c $(NAME).def
     23$(NAME).obj : $(NAME).c {$(SHARED)}shfuncs.h $(NAME).def Makefile
    2124                $(CC) $(CFLAGS) /C /Ge- $(NAME).c
     25
     26shfuncs.obj : $(SHARED)\shfuncs.c {$(SHARED)}shfuncs.h Makefile
     27                $(CC) $(CFLAGS) /C /Ge- $(SHARED)\shfuncs.c
    2228
    2329clean       :
    2430                if exist $(NAME).dll del $(NAME).dll
    2531                if exist $(NAME).obj del $(NAME).obj
     32                if exist shfuncs.obj del shfuncs.obj
    2633
    27 
  • rxprtutl/trunk/rxprtutl.c

    r27 r32  
    5555#include <rexxsaa.h>
    5656
     57#include "shfuncs.h"
     58
    5759
    5860// CONSTANTS
    5961
    6062#define SZ_LIBRARY_NAME         "RXPRTUTL"  // Name of this library
    61 #define SZ_ERROR_NAME           "RPUERROR"  // REXX variable used to store error codes
     63//#define SZ_ERROR_NAME           "RPUERROR"  // REXX variable used to store error codes
    6264#define SZ_VERSION              "0.2.4"     // Current version of this library
    6365
     
    8789
    8890// Maximum string lengths...
    89 #define US_COMPOUND_MAXZ        250                                  // ...of a compound variable
     91#ifdef NO_SHARED_SOURCE
     92    #define US_COMPOUND_MAXZ    250                                  // ...of a compound variable
     93    #define US_ERRSTR_MAXZ      250                                  // ...of an error string
     94#endif
     95
    9096#define US_INTEGER_MAXZ         12                                   // ...of an integer string
    9197#define US_STEM_MAXZ          ( US_COMPOUND_MAXZ - US_INTEGER_MAXZ ) // ...of a stem
    92 #define US_ERRSTR_MAXZ          250                                  // ...of an error string
    9398#define US_DRVINFO_MAXZ       ( CCHMAXPATH + 8 + 32 )                // ...of an driver/port info string
    9499#define US_PRTINFO_MAXZ         180                                  // ...of a printer info string
     
    122127// List of functions to be registered by RPULoadFuncs
    123128static PSZ RxFunctionTbl[] = {
     129    "RPULoadFuncs",         // drop only
    124130    "RPUDropFuncs",
    125131    "RPUDeviceDelete",
     
    173179PSZ     GetObjectID( PSZ pszHandle );
    174180HOBJECT PrinterObjectHandle( PSZ pszQueueName );
    175 BOOL    SaveResultString( PRXSTRING prsResult, PCH pchBytes, ULONG ulBytes );
    176181ULONG   UniqueDeviceName( PSZ pszName );
    177 BOOL    WriteCompoundVariable( PSZ pszStem, PSZ pszTail, PSZ pszValue );
    178 BOOL    WriteSimpleVariable( PSZ pszName, PSZ pszValue );
    179 BOOL    WriteStemElement( PSZ pszStem, ULONG ulIndex, PSZ pszValue );
    180 void    WriteErrorCode( ULONG ulError, PSZ pszContext );
    181 
     182#ifdef NO_SHARED_SOURCE
     183    BOOL    SaveResultString( PRXSTRING prsResult, PCH pchBytes, ULONG ulBytes );
     184    BOOL    WriteCompoundVariable( PSZ pszStem, PSZ pszTail, PSZ pszValue );
     185//    BOOL    WriteSimpleVariable( PSZ pszName, PSZ pszValue );
     186    BOOL    WriteStemElement( PSZ pszStem, ULONG ulIndex, PSZ pszValue );
     187    void    WriteErrorCode( ULONG ulError, PSZ pszContext );
     188#endif
    182189
    183190
     
    204211    if ( argc > 0 ) return ( 40 );
    205212    entries = sizeof(RxFunctionTbl) / sizeof(PSZ);
    206     for ( i = 0; i < entries; i++ )
     213
     214    // Start from 1 to skip RPULoadFuncs (we don't want to re-register ourselves)
     215    for ( i = 1; i < entries; i++ )
    207216        RexxRegisterFunctionDll( RxFunctionTbl[i], SZ_LIBRARY_NAME, RxFunctionTbl[i] );
    208217
    209     MAKERXSTRING( *prsResult, "", 0 );
     218    SaveResultString( prsResult, NULL, 0 );
    210219    return ( 0 );
    211220}
     
    233242        RexxDeregisterFunction( RxFunctionTbl[i] );
    234243
    235     MAKERXSTRING( *prsResult, "", 0 );
     244    SaveResultString( prsResult, NULL, 0 );
    236245    return ( 0 );
    237246}
     
    256265    sprintf( szVersion, "%s", SZ_VERSION );
    257266
    258     MAKERXSTRING( *prsResult, szVersion, strlen(szVersion) );
     267    SaveResultString( prsResult, szVersion, strlen(szVersion) );
    259268    return ( 0 );
    260269}
     
    291300    if ( rc != NO_ERROR ) {
    292301        WriteErrorCode( rc, "SplDeleteDevice");
    293         MAKERXSTRING( *prsResult, "0", 1 );
     302        SaveResultString( prsResult, PSZ_ZERO, 1 );
    294303        return 0;
    295304    }
    296305
    297     MAKERXSTRING( *prsResult, "1", 1 );
     306    SaveResultString( prsResult, PSZ_ONE, 1 );
    298307    return ( 0 );
    299308}
     
    346355    if ( !hab ) {
    347356        WriteErrorCode( 0, "WinInitialize");
    348         MAKERXSTRING( *prsResult, "0", 1 );
     357        SaveResultString( prsResult, PSZ_ZERO, 1 );
    349358        return ( 0 );
    350359    }
     
    354363    if ( !fSuccess ) {
    355364        WriteErrorCode( ERRORIDERROR( WinGetLastError( hab )), "DevQueryDeviceNames");
    356         MAKERXSTRING( *prsResult, "0", 1 );
     365        SaveResultString( prsResult, PSZ_ZERO, 1 );
    357366        goto cleanup;
    358367    }
    359368
    360369    // Now get the actual data
     370    /* (This originally used malloc() - switched to DosAllocMem() while in the
     371     * process of trying to hunt down an intermittent trap.  In fact, the trap
     372     * was probably caused by a flaw in WriteStemElement() which has since been
     373     * fixed.)
     374     */
    361375#if 1
    362376    rc = DosAllocMem( (PVOID) &aDeviceName, (ULONG) pldn * sizeof( STR32 ), PAG_WRITE | PAG_COMMIT );
    363377    if ( rc != NO_ERROR ) {
    364378        WriteErrorCode( rc, "DosAllocMem");
    365         MAKERXSTRING( *prsResult, "0", 1 );
     379        SaveResultString( prsResult, PSZ_ZERO, 1 );
    366380        goto cleanup;
    367381    }
     
    369383    if ( rc != NO_ERROR ) {
    370384        WriteErrorCode( rc, "DosAllocMem");
    371         MAKERXSTRING( *prsResult, "0", 1 );
     385        SaveResultString( prsResult, PSZ_ZERO, 1 );
    372386        DosFreeMem( aDeviceName );
    373387        goto cleanup;
     
    376390    if ( rc != NO_ERROR ) {
    377391        WriteErrorCode( rc, "DosAllocMem");
    378         MAKERXSTRING( *prsResult, "0", 1 );
     392        SaveResultString( prsResult, PSZ_ZERO, 1 );
    379393        DosFreeMem( aDeviceName );
    380394        DosFreeMem( aDeviceDesc );
     
    385399    if ( !aDeviceName ) {
    386400        WriteErrorCode( ERROR_NOT_ENOUGH_MEMORY, "malloc");
    387         MAKERXSTRING( *prsResult, "0", 1 );
     401        SaveResultString( prsResult, PSZ_ZERO, 1 );
    388402        goto cleanup;
    389403    }
     
    391405    if ( !aDeviceDesc ) {
    392406        WriteErrorCode( ERROR_NOT_ENOUGH_MEMORY, "malloc");
    393         MAKERXSTRING( *prsResult, "0", 1 );
     407        SaveResultString( prsResult, PSZ_ZERO, 1 );
    394408        free( aDeviceName );
    395409        goto cleanup;
     
    398412    if ( !aDataType ) {
    399413        WriteErrorCode( ERROR_NOT_ENOUGH_MEMORY, "malloc");
    400         MAKERXSTRING( *prsResult, "0", 1 );
     414        SaveResultString( prsResult, PSZ_ZERO, 1 );
    401415        free( aDeviceName );
    402416        free( aDeviceDesc );
     
    413427
    414428    // Return 1 on success
    415     MAKERXSTRING( *prsResult, "1", 1 );
     429    SaveResultString( prsResult, PSZ_ONE, 1 );
    416430
    417431#if 1
     
    472486    if (( rc != ERROR_MORE_DATA ) && ( rc != NERR_BufTooSmall )) {
    473487        WriteErrorCode( rc, "SplEnumPort");
    474         MAKERXSTRING( *prsResult, "0", 1 );
     488        SaveResultString( prsResult, PSZ_ZERO, 1 );
    475489        return ( 0 );
    476490    }
     
    480494    if ( !pbuf ) {
    481495        WriteErrorCode( ERROR_NOT_ENOUGH_MEMORY, "malloc");
    482         MAKERXSTRING( *prsResult, "0", 1 );
     496        SaveResultString( prsResult, PSZ_ZERO, 1 );
    483497        return ( 0 );
    484498    }
     
    498512        sprintf( szNumber, "%u", cReturned );
    499513        WriteStemElement( szStem, 0, szNumber );
    500         MAKERXSTRING( *prsResult, "1", 1 );
     514        SaveResultString( prsResult, PSZ_ONE, 1 );
    501515    }
    502516    else {
    503517        WriteErrorCode( rc, "SplEnumPort");
    504         MAKERXSTRING( *prsResult, "0", 1 );
     518        SaveResultString( prsResult, PSZ_ZERO, 1 );
    505519    }
    506520    free( pbuf );
     
    550564    if (( rc != ERROR_MORE_DATA ) && ( rc != NERR_BufTooSmall )) {
    551565        WriteErrorCode( rc, "SplEnumDriver");
    552         MAKERXSTRING( *prsResult, "0", 1 );
     566        SaveResultString( prsResult, PSZ_ZERO, 1 );
    553567        return ( 0 );
    554568    }
     
    558572    if ( !pbuf ) {
    559573        WriteErrorCode( ERROR_NOT_ENOUGH_MEMORY, "malloc");
    560         MAKERXSTRING( *prsResult, "0", 1 );
     574        SaveResultString( prsResult, PSZ_ZERO, 1 );
    561575        return ( 0 );
    562576    }
     
    571585        sprintf( szNumber, "%u", cReturned );
    572586        WriteStemElement( szStem, 0, szNumber );
    573         MAKERXSTRING( *prsResult, "1", 1 );
     587        SaveResultString( prsResult, PSZ_ONE, 1 );
    574588    }
    575589    else {
    576590        WriteErrorCode( rc, "SplEnumDriver");
    577         MAKERXSTRING( *prsResult, "0", 1 );
     591        SaveResultString( prsResult, PSZ_ZERO, 1 );
    578592    }
    579593    free( pbuf );
     
    670684    {
    671685        WriteErrorCode( rc, "SplEnumPrinter");
    672         MAKERXSTRING( *prsResult, "0", 1 );
     686        SaveResultString( prsResult, PSZ_ZERO, 1 );
    673687        return ( 0 );
    674688    }
     
    678692    if ( !pbEnum ) {
    679693        WriteErrorCode( ERROR_NOT_ENOUGH_MEMORY, "malloc");
    680         MAKERXSTRING( *prsResult, "0", 1 );
     694        SaveResultString( prsResult, PSZ_ZERO, 1 );
    681695        return ( 0 );
    682696    }
     
    686700    if ( rc != NO_ERROR ) {
    687701        WriteErrorCode( rc, "SplEnumPrinter");
    688         MAKERXSTRING( *prsResult, "0", 1 );
     702        SaveResultString( prsResult, PSZ_ZERO, 1 );
    689703        goto cleanup;
    690704    }
     
    723737            if (( rc != NO_ERROR ) && ( rc != NERR_BufTooSmall )) {
    724738                WriteErrorCode( rc, "SplQueryQueue");
    725                 MAKERXSTRING( *prsResult, "0", 1 );
     739                SaveResultString( prsResult, PSZ_ZERO, 1 );
    726740                //goto cleanup;
    727741                continue;
     
    730744            if ( !pbQueue ) {
    731745                WriteErrorCode( ERROR_NOT_ENOUGH_MEMORY, "malloc");
    732                 MAKERXSTRING( *prsResult, "0", 1 );
     746                SaveResultString( prsResult, PSZ_ZERO, 1 );
    733747                //goto cleanup;
    734748                continue;
     
    739753            if ( rc != NO_ERROR ) {
    740754                WriteErrorCode( rc, "SplQueryQueue");
    741                 MAKERXSTRING( *prsResult, "0", 1 );
     755                SaveResultString( prsResult, PSZ_ZERO, 1 );
    742756                free( pbQueue );
    743757                //goto cleanup;
     
    782796    sprintf( szNumber, "%u", ulCount );
    783797    WriteStemElement( szStem, 0, szNumber );
    784     MAKERXSTRING( *prsResult, "1", 1 );
     798    SaveResultString( prsResult, PSZ_ONE, 1 );
    785799
    786800cleanup:
     
    844858    hObj = PrinterObjectHandle( pszName );
    845859    if ( !hObj ) {
    846         MAKERXSTRING( *prsResult, "0", 1 );
     860        SaveResultString( prsResult, PSZ_ZERO, 1 );
    847861        return ( 0 );
    848862    }
     
    850864    fRC = WinOpenObject( hObj, ulView, TRUE );
    851865
    852     MAKERXSTRING( *prsResult, fRC? "1": "0", 1 );
     866    SaveResultString( prsResult, fRC? PSZ_ONE: PSZ_ZERO, 1 );
    853867    return ( 0 );
    854868}
     
    909923    {
    910924        WriteErrorCode( rc, "SplQueryPort");
    911         MAKERXSTRING( *prsResult, "0", 1 );
     925        SaveResultString( prsResult, PSZ_ZERO, 1 );
    912926        return ( 0 );
    913927    }
     
    917931    if ( !pbuf ) {
    918932        WriteErrorCode( ERROR_NOT_ENOUGH_MEMORY, "malloc");
    919         MAKERXSTRING( *prsResult, "0", 1 );
     933        SaveResultString( prsResult, PSZ_ZERO, 1 );
    920934        return ( 0 );
    921935    }
     
    927941        WriteCompoundVariable( szStem, "!driver",    pInfo->pszPortDriver );
    928942        WriteCompoundVariable( szStem, "!converter", pInfo->pszProtocolConverter );
    929         MAKERXSTRING( *prsResult, "1", 1 );
     943        SaveResultString( prsResult, PSZ_ONE, 1 );
    930944    }
    931945    else {
    932946        WriteErrorCode( rc, "SplQueryPort");
    933         MAKERXSTRING( *prsResult, "0", 1 );
     947        SaveResultString( prsResult, PSZ_ZERO, 1 );
    934948    }
    935949
     
    985999    if ( !hab ) {
    9861000        WriteErrorCode( 0, "WinInitialize");
    987         MAKERXSTRING( *prsResult, "0", 1 );
     1001        SaveResultString( prsResult, PSZ_ZERO, 1 );
    9881002        return ( 0 );
    9891003    }
     
    9931007    if ( !ulCB ) {
    9941008        WriteErrorCode( ERRORIDERROR( WinGetLastError( hab )), "PrfQueryProfileString");
    995         MAKERXSTRING( *prsResult, "0", 1 );
     1009        SaveResultString( prsResult, PSZ_ZERO, 1 );
    9961010        goto cleanup;
    9971011    }
     
    10011015    if ( rc != NO_ERROR || !hPdr ) {
    10021016        WriteErrorCode( rc, "DosLoadModule");
    1003         MAKERXSTRING( *prsResult, "0", 1 );
     1017        SaveResultString( prsResult, PSZ_ZERO, 1 );
    10041018        goto cleanup;
    10051019    }
     
    10071021    if ( rc != NO_ERROR ) {
    10081022        WriteErrorCode( rc, "DosQueryProcAddr");
    1009         MAKERXSTRING( *prsResult, "0", 1 );
     1023        SaveResultString( prsResult, PSZ_ZERO, 1 );
    10101024        goto finish;
    10111025    }
     
    10151029    if ( rc == NO_ERROR ) {
    10161030        // Return 1 on success
    1017         MAKERXSTRING( *prsResult, "1", 1 );
     1031        SaveResultString( prsResult, PSZ_ONE, 1 );
    10181032    }
    10191033    else {
    10201034        WriteErrorCode( rc, "SplPdInstallPort");
    1021         MAKERXSTRING( *prsResult, "0", 1 );
     1035        SaveResultString( prsResult, PSZ_ZERO, 1 );
    10221036    }
    10231037
     
    10801094    if ( !hab ) {
    10811095        WriteErrorCode( 0, "WinInitialize");
    1082         MAKERXSTRING( *prsResult, "", 0 );
     1096        SaveResultString( prsResult, NULL, 0 );
    10831097        return ( 0 );
    10841098    }
     
    10881102    if ( !ulCB ) {
    10891103        WriteErrorCode( ERRORIDERROR( WinGetLastError( hab )), "PrfQueryProfileString");
    1090         MAKERXSTRING( *prsResult, "", 0 );
     1104        SaveResultString( prsResult, NULL, 0 );
    10911105        goto cleanup;
    10921106    }
     
    10961110    if ( rc != NO_ERROR || !hPdr ) {
    10971111        WriteErrorCode( rc, "DosLoadModule");
    1098         MAKERXSTRING( *prsResult, "", 0 );
     1112        SaveResultString( prsResult, NULL, 0 );
    10991113        goto cleanup;
    11001114    }
     
    11021116    if ( rc != NO_ERROR ) {
    11031117        WriteErrorCode( rc, "DosQueryProcAddr");
    1104         MAKERXSTRING( *prsResult, "", 0 );
     1118        SaveResultString( prsResult, NULL, 0 );
    11051119        goto finish;
    11061120    }
     
    11171131                // Write the data contents to our return RXSTRING
    11181132                if ( !SaveResultString( prsResult, pBuf, cBuf ))
    1119                     MAKERXSTRING( *prsResult, "", 0 );
     1133                    SaveResultString( prsResult, NULL, 0 );
    11201134            }
    11211135            else {
    11221136                WriteErrorCode( rc, "SplPdQuery 2");
    1123                 MAKERXSTRING( *prsResult, "", 0 );
     1137                SaveResultString( prsResult, NULL, 0 );
    11241138            }
    11251139            free( pBuf );
     
    11271141        else {
    11281142            WriteErrorCode( ERROR_NOT_ENOUGH_MEMORY, "malloc");
    1129             MAKERXSTRING( *prsResult, "", 0 );
     1143            SaveResultString( prsResult, NULL, 0 );
    11301144        }
    11311145    }
    11321146    else {
    11331147        WriteErrorCode( rc, "SplPdQuery 1");
    1134         MAKERXSTRING( *prsResult, "", 0 );
     1148        SaveResultString( prsResult, NULL, 0 );
    11351149    }
    11361150
     
    12091223    if ( !hab ) {
    12101224        WriteErrorCode( 0, "WinInitialize");
    1211         MAKERXSTRING( *prsResult, "0", 1 );
     1225        SaveResultString( prsResult, PSZ_ZERO, 1 );
    12121226        return ( 0 );
    12131227    }
     
    12171231    if ( !ulCB ) {
    12181232        WriteErrorCode( ERRORIDERROR( WinGetLastError( hab )), "PrfQueryProfileString");
    1219         MAKERXSTRING( *prsResult, "0", 1 );
     1233        SaveResultString( prsResult, PSZ_ZERO, 1 );
    12201234        goto cleanup;
    12211235    }
     
    12251239    if ( rc != NO_ERROR || !hPdr ) {
    12261240        WriteErrorCode( rc, "DosLoadModule");
    1227         MAKERXSTRING( *prsResult, "0", 1 );
     1241        SaveResultString( prsResult, PSZ_ZERO, 1 );
    12281242        goto cleanup;
    12291243    }
     
    12311245    if ( rc != NO_ERROR ) {
    12321246        WriteErrorCode( rc, "DosQueryProcAddr");
    1233         MAKERXSTRING( *prsResult, "0", 1 );
     1247        SaveResultString( prsResult, PSZ_ZERO, 1 );
    12341248        goto finish;
    12351249    }
     
    12391253    if ( rc == NO_ERROR ) {
    12401254        // Return 1 on success
    1241         MAKERXSTRING( *prsResult, "1", 1 );
     1255        SaveResultString( prsResult, PSZ_ONE, 1 );
    12421256    }
    12431257    else {
    12441258        WriteErrorCode( rc, "SplPdSet");
    1245         MAKERXSTRING( *prsResult, "0", 1 );
     1259        SaveResultString( prsResult, PSZ_ZERO, 1 );
    12461260    }
    12471261
     
    12971311    if ( !hab ) {
    12981312        WriteErrorCode( 0, "WinInitialize");
    1299         MAKERXSTRING( *prsResult, "0", 1 );
     1313        SaveResultString( prsResult, PSZ_ZERO, 1 );
    13001314        return ( 0 );
    13011315    }
     
    13051319    if ( !ulCB ) {
    13061320        WriteErrorCode( ERRORIDERROR( WinGetLastError( hab )), "PrfQueryProfileString");
    1307         MAKERXSTRING( *prsResult, "0", 1 );
     1321        SaveResultString( prsResult, PSZ_ZERO, 1 );
    13081322        goto cleanup;
    13091323    }
     
    13131327    if ( rc != NO_ERROR || !hPdr ) {
    13141328        WriteErrorCode( rc, "DosLoadModule");
    1315         MAKERXSTRING( *prsResult, "0", 1 );
     1329        SaveResultString( prsResult, PSZ_ZERO, 1 );
    13161330        goto cleanup;
    13171331    }
     
    13191333    if ( rc != NO_ERROR ) {
    13201334        WriteErrorCode( rc, "DosQueryProcAddr");
    1321         MAKERXSTRING( *prsResult, "0", 1 );
     1335        SaveResultString( prsResult, PSZ_ZERO, 1 );
    13221336        goto finish;
    13231337    }
     
    13271341    if ( rc == NO_ERROR ) {
    13281342        // Return 1 if settings were modified
    1329         MAKERXSTRING( *prsResult, flModified? "1": "0", 1 );
     1343        SaveResultString( prsResult, flModified? PSZ_ONE: PSZ_ZERO, 1 );
    13301344    }
    13311345    else {
    13321346        WriteErrorCode( rc, "SplPdSetPort");
    1333         MAKERXSTRING( *prsResult, "0", 1 );
     1347        SaveResultString( prsResult, PSZ_ZERO, 1 );
    13341348    }
    13351349
     
    13691383    if ( rc == NO_ERROR ) {
    13701384        // Return 1 on success
    1371         MAKERXSTRING( *prsResult, "1", 1 );
     1385        SaveResultString( prsResult, PSZ_ONE, 1 );
    13721386    }
    13731387    else {
    13741388        WriteErrorCode( rc, "SplDeletePort");
    1375         MAKERXSTRING( *prsResult, "0", 1 );
     1389        SaveResultString( prsResult, PSZ_ZERO, 1 );
    13761390    }
    13771391
     
    14391453        else
    14401454            WriteErrorCode( rc, "SplEnumDevice");
    1441         MAKERXSTRING( *prsResult, "0", 1 );
     1455        SaveResultString( prsResult, PSZ_ZERO, 1 );
    14421456        return ( 0 );
    14431457    }
     
    14531467    if ( rc != NO_ERROR ) {
    14541468        WriteErrorCode( rc, "SplCreateDevice");
    1455         MAKERXSTRING( *prsResult, "0", 1 );
     1469        SaveResultString( prsResult, PSZ_ZERO, 1 );
    14561470        return ( 0 );
    14571471    }
     
    14681482    if ( rc != NO_ERROR ) {
    14691483        WriteErrorCode( rc, "SplCreateQueue");
    1470         MAKERXSTRING( *prsResult, "0", 1 );
     1484        SaveResultString( prsResult, PSZ_ZERO, 1 );
    14711485        SplDeleteDevice( NULL, szDevice );
    14721486        return ( 0 );
    14731487    }
    14741488
    1475     MAKERXSTRING( *prsResult, "1", 1 );
     1489    SaveResultString( prsResult, PSZ_ONE, 1 );
    14761490    return ( 0 );
    14771491}
     
    15141528    if (( rc != NO_ERROR ) && ( rc != NERR_BufTooSmall )) {
    15151529        WriteErrorCode( rc, "SplQueryQueue");
    1516         MAKERXSTRING( *prsResult, "0", 1 );
     1530        SaveResultString( prsResult, PSZ_ZERO, 1 );
    15171531        return ( 0 );
    15181532    }
     
    15201534    if ( !pInfo ) {
    15211535        WriteErrorCode( ERROR_NOT_ENOUGH_MEMORY, "malloc");
    1522         MAKERXSTRING( *prsResult, "0", 1 );
     1536        SaveResultString( prsResult, PSZ_ZERO, 1 );
    15231537        return ( 0 );
    15241538    }
     
    15261540    if ( rc != NO_ERROR ) {
    15271541        WriteErrorCode( rc, "SplQueryQueue");
    1528         MAKERXSTRING( *prsResult, "0", 1 );
     1542        SaveResultString( prsResult, PSZ_ZERO, 1 );
    15291543        goto cleanup;
    15301544    }
     
    15331547    if ( rc != NO_ERROR ) {
    15341548        WriteErrorCode( rc, "SplDeleteDevice");
    1535         MAKERXSTRING( *prsResult, "0", 1 );
     1549        SaveResultString( prsResult, PSZ_ZERO, 1 );
    15361550        goto cleanup;
    15371551    }
     
    15411555    if ( hObj != NULLHANDLE ) WinDestroyObject( hObj );
    15421556
    1543     MAKERXSTRING( *prsResult, "1", 1 );
     1557    SaveResultString( prsResult, PSZ_ONE, 1 );
    15441558cleanup:
    15451559    free( pInfo );
     
    16051619    {
    16061620        WriteErrorCode( rc, "SplQueryDevice");
    1607         MAKERXSTRING( *prsResult, "0", 1 );
     1621        SaveResultString( prsResult, PSZ_ZERO, 1 );
    16081622        return ( 0 );
    16091623    }
     
    16131627    if ( !pbuf ) {
    16141628        WriteErrorCode( ERROR_NOT_ENOUGH_MEMORY, "malloc");
    1615         MAKERXSTRING( *prsResult, "0", 1 );
     1629        SaveResultString( prsResult, PSZ_ZERO, 1 );
    16161630        return ( 0 );
    16171631    }
     
    16311645        if ( pInfo->fsStatus & PRJ_DESTNOPAPER ) strcat( szFlags, "P");
    16321646        WriteCompoundVariable( szStem, "!jobflags", szFlags );
    1633         MAKERXSTRING( *prsResult, "1", 1 );
     1647        SaveResultString( prsResult, PSZ_ONE, 1 );
    16341648    }
    16351649    else {
    16361650        WriteErrorCode( rc, "SplQueryDevice");
    1637         MAKERXSTRING( *prsResult, "0", 1 );
     1651        SaveResultString( prsResult, PSZ_ZERO, 1 );
    16381652    }
    16391653
     
    16711685    fRC = WinSetObjectData( hObj, "APPDEFAULT=YES;");
    16721686
    1673     MAKERXSTRING( *prsResult, fRC? "1": "0", 1 );
     1687    SaveResultString( prsResult, fRC? PSZ_ONE: PSZ_ZERO, 1 );
    16741688    return ( 0 );
    16751689}
     
    17221736    if ( rc != NO_ERROR ) {
    17231737        WriteErrorCode( rc, fHold ? "SplHoldQueue" : "SplReleaseQueue");
    1724         MAKERXSTRING( *prsResult, "0", 1 );
    1725     }
    1726     else MAKERXSTRING( *prsResult, "1", 1 );
     1738        SaveResultString( prsResult, PSZ_ZERO, 1 );
     1739    }
     1740    else
     1741        SaveResultString( prsResult, PSZ_ONE, 1 );
    17271742
    17281743    return ( 0 );
     
    20072022 * ************************************************************************* */
    20082023
     2024#ifdef NO_SHARED_SOURCE
    20092025
    20102026/* ------------------------------------------------------------------------- *
     
    20152031 * zero length, nothing is done.                                             *
    20162032 *                                                                           *
    2017  * This function should be used in place of MAKERXSTRING if there is a       *
    2018  * possibility that the string contents could be longer than 256 characters. *
     2033 * This function should be used in place of MAKERXSTRING to generate all     *
     2034 * REXX return values.                                                      *
    20192035 *                                                                           *
    20202036 * ARGUMENTS:                                                                *
     
    22062222}
    22072223
    2208 
     2224#endif
  • rxprtutl/trunk/rxprtutl.def

    r15 r32  
    11LIBRARY     RXPRTUTL INITINSTANCE TERMINSTANCE
    22DATA        MULTIPLE NONSHARED
    3 DESCRIPTION '@#Alex Taylor:0.2.4#@##1## 8 Sep 2013 20:30:22      REINFORCE::::::@@REXX Printer Management Utilities'
     3DESCRIPTION '@#Alex Taylor:0.2.4#@##1## 11 May 2016 18:58:22     REINFORCE::::::@@REXX Printer Management Utilities'
    44
    55EXPORTS     RPULoadFuncs
Note: See TracChangeset for help on using the changeset viewer.