Usenet comp.unix.osf.osf1 (1992-2004)
 help / color / mirror / Atom feed
* Re: Executing a CSH command from Digital UNIX C
       [not found] <31448D13.167E@nynexst.com>
@ 1996-03-14  5:00 ` Scott Tringali
  0 siblings, 0 replies; only message in thread
From: Scott Tringali @ 1996-03-14  5:00 UTC (permalink / raw)


Farai Nyoni (farai@nynexst.com) wrote:
> I'm not a regular C programmer, but would like to execute a C shell
> command from within a C program ( setenv VARIABLE XXX). The error I get
> after execution is "setenv: not found"
> when I echo the shell before this command I get "/bin/csh"
> but after I execute the setenv command I get "/bin/sh"

Environment variables are attributes of the process.  They are set by the
command interpreter, and are not external programs.  Thus, you cannot do a
system() on "setenv" because there is no such setenv program; it lives inside
of csh.

To set an environment variable from C:

  int status;
  status = putenv("VARNAME=value");

and to read one:

  char var_p;
  var_p = getenv("VARNAME");


> Is BOURNE the only environment I can operate in or can I change the
> operating shell.  

Nope.  Environment variables are attributes of all processes, but different
shells let you change them differently.

--
Scott J. Tringali, tringali@ultranet.com
Raytheon Electronic Systems, International Air Traffic Control



^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~1996-03-14  5:00 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <31448D13.167E@nynexst.com>
1996-03-14  5:00 ` Executing a CSH command from Digital UNIX C Scott Tringali

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox