home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
rtsi.com
/
2014.01.www.rtsi.com.tar
/
www.rtsi.com
/
OS9
/
OSK
/
CMDS
/
checkenv.lzh
/
checkenv.c
< prev
next >
Wrap
C/C++ Source or Header
|
1992-02-22
|
1KB
|
49 lines
#include <stdio.h>
#include <sgstat.h>
#include <termcap.h>
/*
This program allows the user to check the environment list, to
check if a given variable has a particular setting
The most common use would be in a .login file to set up the
correct TERM variable; thus:
-nx
checkenv PORT /term ; setenv TERM st
checkenv PORT /t1 ; setenv TERM dr
-x
This program is copyright (1988) by Cowen Software Ltd
of 21/23 Bristol Ave, Manchester, England, GB-M19 3NU
It is made available for any OS9/68K user freely,
but may not be sold for profit, other than a reasonable
handling charge
*/
main (argc,argv)
int argc;
char *argv[];
{
char *ep;
if ( (argc < 2) | (argc > 3) ) help ();
if (*argv[1] == '-') help ();
ep = getenv( argv[1]);
if ( ep == NULL )
{ if ( argc == 2 ) _exit(0); else _exit(1); }
if ( argc == 2 ) _exit(1);
if ( strcmp(argv[2], getenv( argv[1]) ) ) _exit(1);
_exit(0);
}
help()
{ fprintf (stderr,"\nSyntax: checkenv <eparam> , <evalue>");
fprintf (stderr,"\nFunction: check environment variable value");
fprintf (stderr,"\n errors if <evalue> not = SETENV value");
fprintf (stderr,"\n if <evalue> null, checks <eparam> does not exist");
_exit(0);
}