/* xtcolorwrap.c - Simple program wrapper. */ /* Revision: 060328 */ /* ------------------------------------------------------------ */ /* Assumption: The preprocessor symbol "__META_EXEPATH__" spec- */ /* ifies a full pathname for an executable file. */ /* This program simply chains to the specified executable file */ /* [passing all arguments unchanged], with one special opera- */ /* tion: If the environment variable TERM is equal to "xterm", */ /* the wrapper changes TERM to "xterm-color". */ /* ------------------------------------------------------------ */ /* standard header file(s) */ /* ------------------------------------------------------------ */ #include #include /* ------------------------------------------------------------ */ /* basic definitions */ /* ------------------------------------------------------------ */ #define ZERO 0 #define NULLCP ((char *) ZERO) /* ------------------------------------------------------------ */ /* main program */ /* ------------------------------------------------------------ */ int main (int argc, char **argv) { /* Get value of "TERM" variable */ char *term = getenv ("TERM"); /* Change "TERM" setting? */ if ((term != NULLCP) && !strcmp (term, "xterm")) { /* Yes */ putenv ("TERM=xterm-color"); } /* Chain to target executable */ execv (__META_EXEPATH__, argv); return (ZERO); /* This shouldn't be reached */ }