I'll start this by saying I know little of C. I was playing with some code for something to do, and to cut a long story short it appears our C compiler on the Tru64 box at work doesn't want to getenv properly. Or at least, it doesn't conform to whatever standards everyone elses C compilers do for getting environment variables.
For instance, if I run the below example (to get the terminal type), I actually get the value of the envvar PWD. Fbog, you might say.
(When compiling the original program from which the following fragment was taken, I just copied-and-pasted it verbatim.)
Original code is [link|http://www.personal.usyd.edu.au/~rjohnson/target/target.txt|here]. It's a program to solve word puzzles like [link|http://www.smh.com.au/entertainment/target/index.html|this].
/*
Print an environment variable
This is a fragment of a program written by Rod Johnson, November 6, 1995.
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define BUFFER_LENGTH 60
/***************************************************************************/
main(int argc, char *argv[])
{
FILE *fp;
int wordcount, i, key_length, key_distribution[26], got_big_one = 0;
char *query_string, key[BUFFER_LENGTH], c;
query_string = getenv("TERM");
for (; query_string && *query_string != '='; query_string++) ;
if (query_string)
query_string++;
if (!query_string)
{
printf("\\nInvalid or insufficient input
\\n");
exit(1);
} /* if not enough arguments */
printf("Query String=%s\\n",query_string);
} /* main */
All being well I'll be able to try it on OS X tonight as my 10.1 cd has come in. (Yay.)