Windows NT 4.0 source code leak
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

55 lines
1.2 KiB

4 years ago
  1. /*****************************************************************/
  2. /** Microsoft LAN Manager **/
  3. /** Copyright(c) Microsoft Corp., 1990 **/
  4. /*****************************************************************/
  5. /*
  6. * LOG.C -- keystroke saving, keystroke replaying, and logfile
  7. * routines. For DAMAGE.
  8. *
  9. * created by Dave Brown, 4/20/89
  10. *
  11. * modification log:
  12. * date: by: what:
  13. * =======================================================
  14. * 4/20/89 davidbro created file
  15. * 4/25/89 S. Hern allowed redirected input
  16. *
  17. */
  18. #include <conio.h>
  19. #include <stdio.h>
  20. #include "defs.h"
  21. #include "globals.h"
  22. UCHAR
  23. log_getch()
  24. {
  25. UCHAR ch, x;
  26. if (redirect_input)
  27. {
  28. ch = getchar();
  29. while ((x = getchar()) != '\n');
  30. }
  31. else if (szKeyReplay == NULL)
  32. ch = _getch();
  33. else
  34. ch = fgetc(fpReplay);
  35. if (szKeySave != NULL)
  36. fputc(ch, fpSave);
  37. return ch;
  38. }
  39. void
  40. log_gets(UCHAR *s)
  41. {
  42. if (szKeyReplay == NULL)
  43. gets(s);
  44. else {
  45. fgets(s, 80, fpReplay);
  46. printf(s);
  47. s[strlen(s) - 1] = '\0';
  48. }
  49. if (szKeySave != NULL)
  50. fprintf(fpSave, "%s\n", s);
  51. }