home *** CD-ROM | disk | FTP | other *** search
/ Power CD-ROM!! 7 / POWERCD7.ISO / prgmming / clipper / envcount.c < prev    next >
C/C++ Source or Header  |  1993-10-14  |  1KB  |  60 lines

  1. /*
  2.  * GT CLIPPER STANDARD HEADER
  3.  *
  4.  * File......: envcount.c
  5.  * Author....: Andy M Leighton
  6.  * BBS.......: The Dark Knight Returns
  7.  * Net/Node..: 050/069
  8.  * User Name.: Andy Leighton
  9.  * Date......: $Date$
  10.  * Revision..: $Revision$
  11.  *
  12.  * This is an original work by Andy Leighton and is placed in the
  13.  * public domain.
  14.  *
  15.  * Modification history:
  16.  * ---------------------
  17.  *
  18.  * $Log$
  19.  *
  20.  */
  21.  
  22. /*
  23.  *  $DOC$
  24.  *  $FUNCNAME$
  25.  *      GT_ENVCOUNT()
  26.  *  $CATEGORY$
  27.  *      Environment
  28.  *  $ONELINER$
  29.  *      Returns the number of environment entries
  30.  *  $SYNTAX$
  31.  *      GT_EnvCount() --> nCount
  32.  *  $ARGUMENTS$
  33.  *      None
  34.  *  $RETURNS$
  35.  *      nCount  - The number of environment varibales
  36.  *  $DESCRIPTION$
  37.  *      Get the number of variables in the program's environment
  38.  *      Reads the C startup variable to find the number of
  39.  *      environment variables
  40.  *  $EXAMPLES$
  41.  *      ?  "There are " + str(GT_EnvCount(), 3) + " entries in the "
  42.  *      ?? "environment table."
  43.  *  $END$
  44.  */
  45.  
  46. #include "extend.h"
  47.  
  48. extern char **environ;
  49.  
  50. CLIPPER
  51. GT_envCount()
  52. {
  53.   int n = 0;
  54.  
  55.   while (environ[n++] != '\0')
  56.     ;
  57.  
  58.   _retni(--n);
  59. }
  60.