home *** CD-ROM | disk | FTP | other *** search
/ Info-Mac 3 / Info_Mac_1994-01.iso / Development / Source / Macintosh Tracker 1.1 Source / Tracker Server Folder / tools.c < prev   
Encoding:
C/C++ Source or Header  |  1993-05-18  |  838 b   |  45 lines  |  [TEXT/KAHL]

  1. /* tools.c */
  2.  
  3. /* standard routines for use in tracker. Used to be in main.c
  4.  */
  5.  
  6. /* $Id: tools.c,v 3.1 1992/11/19 20:44:47 espie Exp espie $
  7.  * $Log: tools.c,v $
  8.  * Revision 3.1  1992/11/19  20:44:47  espie
  9.  * Protracker commands.
  10.  *
  11.  * Revision 3.0  1992/11/18  16:08:05  espie
  12.  * New release.
  13.  */
  14.      
  15.  
  16. #include <stdio.h>
  17. #include <stdlib.h>
  18. #include <string.h>
  19.      
  20. #include "defs.h"
  21. #include "extern.h"
  22.      
  23. LOCAL char *id = "$Id: tools.c,v 3.1 1992/11/19 20:44:47 espie Exp espie $";
  24.  
  25.  
  26. /* v = read_env(name, default): reads the scalar value v
  27.  * in the environment, supplies a defaults.
  28.  */
  29. int read_env(name, def)
  30. char *name;
  31. int def;
  32.     {
  33.     char *var;
  34.     int value;
  35.  
  36.     var = getenv(name);
  37.     if (!var)
  38.         return def;
  39.     if (sscanf(var, "%d", &value) == 1)
  40.         return value;
  41.     else
  42.         return def;
  43.     }
  44.  
  45.