[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: tin/getenv

Operator writes:
> Hi everyone,
>    I'm trying to compile tin for news access via NNTP.  The compilation
> is complete and when run tin talks via NNTP and gets all its information 
> correctly.  

btw hav you looked at (s)trn?  as opposed to tin & frieds trn does _real_
threading i.e. it uses the References: not just the Subject:s...
> However, I seem to have a problem reading the TERM environment variable; 
> tin reports that "the TERM variable needs to be set...".  My TERM 
> variable is set (to stv52, or whichever terminal type I am in).
> The offending piece of code is:
> 	if ((p = (char *) getenv ("TERM")) == NULL) {
> 		fprintf (stderr, "%s: TERM variable must be set to use screen capabilities\n", progname);
> 		return (FALSE);
> 	}
> It seems that getenv is returning NULL and unfortunately I can't find 
> a man page or the source for getenv.

 hmm this should work...  can you use a debugger?

 assuming its not something simple like forgot exporting the variable...
or something. :)  (try /bin/sh -c set and see if it appears there.)
> If somebody can fix this line for me, or send me a man page for the mintlibs 
> getenv, I can quickly complete the port and make it available to others.

 heres a BSD one...

GETENV(3)		   BSD Programmer's Manual		  GETENV(3)

     ggeetteennvv, ppuutteennvv, sseetteennvv, uunnsseetteennvv - environment variable functions

     ##iinncclluuddee <<ssttddlliibb..hh>>

     _c_h_a_r _*
     ggeetteennvv(_c_o_n_s_t _c_h_a_r _*_n_a_m_e);

     sseetteennvv(_c_o_n_s_t _c_h_a_r _*_n_a_m_e, _c_o_n_s_t _c_h_a_r _*_v_a_l_u_e, _i_n_t _o_v_e_r_w_r_i_t_e);

     ppuutteennvv(_c_o_n_s_t _c_h_a_r _*_s_t_r_i_n_g);

     uunnsseetteennvv(_c_o_n_s_t _c_h_a_r _*_n_a_m_e);

     These functions set, unset and fetch environment variables from the host
     _e_n_v_i_r_o_n_m_e_n_t _l_i_s_t. For compatibility with differing environment conven-
     tions, the given arguments _n_a_m_e and _v_a_l_u_e may be appended and prepended,
     respectively, with an equal sign ``=''.

     The ggeetteennvv() function obtains the current value of the environment vari-
     able, _n_a_m_e. If the variable _n_a_m_e is not in the current environment, a
     null pointer is returned.

     The sseetteennvv() function inserts or resets the environment variable _n_a_m_e in
     the current environment list.  If the variable _n_a_m_e does not exist in the
     list, it is inserted with the given _v_a_l_u_e_. If the variable does exist,
     the argument _o_v_e_r_w_r_i_t_e is tested; if _o_v_e_r_w_r_i_t_e _i_s zero, the variable is
     not reset, otherwise it is reset to the given _v_a_l_u_e.

     The ppuutteennvv() function takes an argument of the form ``name=value'' and is
     equivalent to:

	   setenv(name, value, 1);

     The uunnsseetteennvv() function deletes all instances of the variable name point-
     ed to by _n_a_m_e from the list.

     The functions sseetteennvv() and ppuutteennvv() return zero if successful; otherwise
     the global variable _e_r_r_n_o is set to indicate the error and a -1 is re-

     [ENOMEM]  The function sseetteennvv() or ppuutteennvv() failed because they were un-
	       able to allocate memory for the environment.

     csh(1),  sh(1),  execve(2),  environ(7)

     The ggeetteennvv() function conforms to ANSI C X3.159-1989 (``ANSI C '').

     The functions sseetteennvv() and uunnsseetteennvv() appeared in Version 7 AT&T UNIX.
     The ppuutteennvv() function appeared in 4.3BSD-Reno.

4.4BSD			 December 11, 1993			     1
> Yours,
>                        Andrew.