// JMsgBox.c ansi_c
// JIDA sample application MessageBox
// Copyright 2001 JUMPtec AG
// {G)U(2} 2001.03.06 2001.11.06

//***************************************************************************

#ifndef WIN32

#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>

#include "JMsgBox.h"

//***************************************************************************

DWORD MessageBox(HANDLE handle, PTCHAR message, PTCHAR title, DWORD flag)
  {
  TCHAR s[256];
    
  switch (flag) {
    case MB_OKCANCEL:
      for (;;) {
        printf("%s (ok or cancel)", message);
        scanf("%s", s);
        switch (tolower(*s)) {
          case 0:
          case 'o': return IDOK;
          case 'c': return IDCANCEL;
          }
        }
      break;

    case MB_YESNO:
      for (;;) {
        printf("%s (yes or no)", message);
        scanf("%s", s);
        switch (tolower(*s)) {
          case 'y': return IDYES;
          case 'n': return IDNO;
          }
        }
      break;

    default:
      printf("%s\n", message);
    }
  
  return 0;
  }

//***************************************************************************

#endif
