home *** CD-ROM | disk | FTP | other *** search
/ Gold Fish 3 / goldfish_volume_3.bin / files / gfx / misc / imagefx_sdk / sas / scanlib / getvar.c < prev    next >
Encoding:
C/C++ Source or Header  |  1994-01-25  |  668 b   |  38 lines

  1. /*
  2.  * Requires 2.0
  3.  */
  4.  
  5. #include <scan/modall.h>
  6. #include <clib/dos_protos.h>
  7. #include <string.h>
  8. #include <stdlib.h>
  9.  
  10. LONG GetIfxVar (char *varname, LONG def)
  11. {
  12.    char fname[128];
  13.    char varbuf[128] = "0";
  14.  
  15.    strcpy(fname, ScanBase->sb_EnvDir);
  16.    AddPart(fname, varname, 127);
  17.  
  18.    if (GetVar(fname, varbuf, 128, 0) > 0) {
  19.       return(atol(varbuf));
  20.    }
  21.    else {
  22.       return(def);
  23.    }
  24. }
  25.  
  26. BOOL SetIfxVar (char *varname, LONG value)
  27. {
  28.    char fname[128];
  29.    char varbuf[128];
  30.  
  31.    strcpy(fname, ScanBase->sb_EnvDir);
  32.    AddPart(fname, varname, 127);
  33.  
  34.    msprintf(varbuf, "%ld", value);
  35.  
  36.    return((BOOL)SetVar(fname, varbuf, strlen(varbuf), GVF_GLOBAL_ONLY));
  37. }
  38.