home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / snip9707.zip / SETENVAR.C < prev    next >
C/C++ Source or Header  |  1997-07-05  |  1KB  |  39 lines

  1. /* +++Date last modified: 05-Jul-1997 */
  2.  
  3. /*
  4. **  SETENVAR.C - Program which sets the DOS master environment upon exit
  5. **
  6. **  Original Copyright 1988-1991 by Bob Stout as part of
  7. **  the MicroFirm Function Library (MFL)
  8. **
  9. **  The user is granted a free limited license to use this source file
  10. **  to create royalty-free programs, subject to the terms of the
  11. **  license restrictions specified in the LICENSE.MFL file.
  12. */
  13.  
  14. #include <stdio.h>
  15. #include <string.h>
  16. #include <stdlib.h>
  17. #include <conio.h>
  18. #include "sniptype.h"
  19. #include "errors.h"                 /* For cant()                       */
  20. #include "snipkbio.h"               /* For ungetkey() & KB_stuff()      */
  21.  
  22. main(int argc, char *argv[])
  23. {
  24.       FILE *bfile;
  25.  
  26.       if (3 > argc)
  27.       {
  28.             puts("\aUsage: SETENVAR envar datum");
  29.             abort();
  30.       }
  31.       bfile = cant("$TMP$.BAT", "w");
  32.       fprintf(bfile, "SET %s=%s\ndel $tmp$.bat\x1a", argv[1], argv[2]);
  33.       fclose(bfile);
  34.       while (kbhit())
  35.             getch();
  36.       KB_stuff("$tmp$\r");
  37.       return 0;
  38. }
  39.