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

  1. /* +++Date last modified: 05-Jul-1997 */
  2.  
  3. /*
  4. **  Call undocumented Int 2Eh to invoke COMMAND.COM
  5. **
  6. **  demo by Bob Stout
  7. **
  8. **  NOTES: Dangerous code - will abort batch files in progress and
  9. **         occasionally have other undesirable effects.
  10. **
  11. **         Requires INT2E.ASM
  12. */
  13.  
  14. #include <string.h>
  15. #include <stdlib.h>
  16. #include "int2e.h"
  17.  
  18. void C_Com_Call(char *string)
  19. {
  20.       char *buf;
  21.  
  22.       buf = (char *)malloc(strlen(string) + 3);
  23.       strcat(strcpy(&buf[1], string), "\r");
  24.       buf[0] = (char)strlen(&buf[1]);
  25.       _Int_2E(buf);
  26.       free(buf);
  27. }
  28.  
  29. #ifdef TEST
  30.  
  31. #ifdef __WATCOMC__
  32.  #pragma off (unreferenced);
  33. #endif
  34.  
  35. #ifdef __TURBOC__
  36.  #pragma argsused
  37. #endif
  38.  
  39. main(int argc, char *argv[])
  40. {
  41.       C_Com_Call(argv[1]);
  42.       return 0;
  43. }
  44.  
  45. #endif /* TEST */
  46.