home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #3 / NN_1993_3.iso / spool / comp / unix / programm / 6019 < prev    next >
Encoding:
Text File  |  1993-01-21  |  1.8 KB  |  44 lines

  1. Newsgroups: comp.unix.programmer
  2. Path: sparky!uunet!math.fu-berlin.de!tati.chemie.fu-berlin.de!melchers
  3. From: melchers@chemie.fu-berlin.de (Bernd Melchers)
  4. Subject: Re: C's getenv() with UNIX
  5. Message-ID: <8TZ0PAP@math.fu-berlin.de>
  6. Sender: news@math.fu-berlin.de (Math Department)
  7. Organization: Free University of Berlin, Germany
  8. References: <93019.001932BAB127@psuvm.psu.edu> <1jgh3eINNa0m@early-bird.think.com>
  9. Date: Thu, 21 Jan 1993 17:30:13 GMT
  10. Lines: 32
  11.  
  12. barmar@think.com (Barry Margolin) writes:
  13.  
  14. >In article <93019.001932BAB127@psuvm.psu.edu> bab <BAB127@psuvm.psu.edu> writes:
  15. >>     Can anyone tell me how to use the getenv() function with UNIX's
  16. >>environment variables?  For example I tried:
  17. >>getenv( "cwd" )
  18.  
  19. >There is no "cwd" environment variable.  The C shell has a "PWD"
  20. >environment variable, and a "cwd" shell variable.  Shell variables (the
  21. >kind you set with "set" in C shell, and which you get by *not* exporting a
  22. >variable in Bourne shell) are local to that shell, not in the environment
  23. >that's inherited by new processes.
  24.  
  25. to determine the current working directory, use 
  26. char *getcwd (char *buf, int size);
  27. because there is no need, that PWD is the current work. dir.
  28. (just print
  29.  setenv PWD i_am_an_foo___grmmmbl4711
  30.  )
  31.  
  32. -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  33. Bernd Melchers                   | melchers@chemie.fu-berlin.de
  34. Freie Universitaet Berlin        | Lieblingsessen: Pizza, aber nur
  35. Institut fuer Kristallographie   |              selbstgemachte...
  36. Takustr. 6                       |              und ohne Tierkadaver
  37. D 1000 Berlin 33                 |
  38. Earth                            |
  39. Tel.: 0049-30-8383612            |
  40.                                  |
  41. Please replace battery pack, attach external power,
  42. or system will be shutdown in 10 seconds.
  43. -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  44.