Source code of Windows XP (NT5)
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.

58 lines
780 B

  1. /*++
  2. Copyright (c) 1997 Microsoft Corporation
  3. Module Name:
  4. confirm.c
  5. Abstract:
  6. Routine to allow the user to confirm an operation
  7. with a y/n response.
  8. Author:
  9. Ted Miller (tedm) 29-May-1997
  10. Revision History:
  11. --*/
  12. #include <mytypes.h>
  13. #include <misclib.h>
  14. #include <stdio.h>
  15. #include <conio.h>
  16. #include <ctype.h>
  17. BOOL
  18. _far
  19. ConfirmOperation(
  20. IN FPCHAR ConfirmationText,
  21. IN char textYesChar,
  22. IN char textNoChar
  23. )
  24. {
  25. char c;
  26. printf(ConfirmationText);
  27. printf(" ");
  28. prompt:
  29. c = (char)getch();
  30. if(toupper(c) == toupper(textYesChar)) {
  31. printf("%c\n\n",c);
  32. return(TRUE);
  33. }
  34. if(toupper(c) == toupper(textNoChar)) {
  35. printf("%c\n\n",c);
  36. return(FALSE);
  37. }
  38. goto prompt;
  39. }