home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / ioctlapi.zip / appsrc.zip / main.c < prev    next >
C/C++ Source or Header  |  1999-11-16  |  2KB  |  80 lines

  1. //-----------------------------------------------------------------------------
  2. // Freeware.  This file may be used freely to promote the ioctl90 mixer API.
  3. //
  4. //-----------------------------------------------------------------------------
  5. // File: ioctl90.c                                      Date Created: 03/11/99
  6. // Description: Exercise IOCTL 90 mixer API             Last Update : 11/16/99
  7. //-----------------------------------------------------------------------------
  8. //
  9. // MODIFICATION HISTORY
  10. // 03-Sep-1998  Joe Nord   Create
  11. //-----------------------------------------------------------------------------
  12.  
  13. #include <stdlib.h>
  14. #include <stdio.h>
  15. #include <signal.h>
  16. #include <memory.h>
  17. #include <string.h>
  18. #include <ctype.h>
  19. #include <io.h>
  20.  
  21. #define INCL_DOSDEVICES      // DosDevIOCtl 
  22. #define INCL_DOSFILEMGR      // DosDevIOCtl 
  23. #define INCL_DOSSEMAPHORES   // Semaphore values
  24. #define INCL_DOSDATETIME     // Timer support
  25. #define INCL_DOSERRORS       // DOS error values
  26. #include <os2.h>
  27.  
  28. #include "data.h"
  29. #include "parse.h"
  30. #include "help.h"
  31. #include "ioctl90.h"           
  32. #include "mixerapi.h"
  33. #include "commands.h"
  34. #include "callback.h"
  35.  
  36.  
  37.  
  38. // Control break signal handler
  39. #pragma off (unreferenced)
  40. void SIGINT_Handler(int a)
  41. {
  42.    fprintf (stderr, "* Ctrl-Break *\n");
  43.    mixerapiDeInit ();
  44.    exit (99); // Normal exit code for SIGINT
  45. }
  46. #pragma on (unreferenced)
  47.  
  48.  
  49. int main (int argc, char *argv[])
  50. {
  51.    ULONG ulRC;
  52.  
  53.    setbuf (stdout, NULL);
  54.    setbuf (stderr, NULL);
  55.  
  56.    if (signal(SIGINT, SIGINT_Handler) == SIG_ERR)
  57.    {
  58.       fprintf (stderr, "\nCtrl-Break handler install failed\n");
  59.       return (1);
  60.    }
  61.  
  62.    ParseCommandLine (argc, argv); // Sets global variables to reflect options
  63.  
  64.    if (Options.Help)
  65.    {
  66.       Help (Options.ExtendedHelp);
  67.    }
  68.    else
  69.    {
  70.       ulRC = mixerapiInit (callbackMain);
  71.       if (ulRC == 0)
  72.       {
  73.          CommandsMain ();
  74.          mixerapiDeInit ();
  75.       }
  76.    }
  77.  
  78.    return (0);
  79. }
  80.