home *** CD-ROM | disk | FTP | other *** search
- /* setenv.c -- program to modify parent environment */
- /* by "David J. Camp" <david%wubios@wucs1.wustl.edu> */
-
- #include <stdio.h>
- #include <stddef.h>
- #include <conio.h>
- #include <dos.h>
- #include <string.h>
-
- int msetenv (char *, char *);
-
- main(argc, argv)
- int argc;
- char * argv [];
-
- {
- char varbuf[128];
- char * varloc;
- char * varname;
- char * eqloc;
- int i;
-
- for (i = 2; i < argc; i++)
- {
- argv [i] [-1] = ' ';
- }
- eqloc = strchr (argv [1], '=');
- if (argc <= 1 || eqloc == NULL)
- {
- fprintf (stderr,"usage: setenv variable=text\n");
- exit (1);
- }
- *eqloc = '\0';
- msetenv(argv [1], ++eqloc);
- exit(0);
- }
-