home *** CD-ROM | disk | FTP | other *** search
/ Amiga ISO Collection / AmigaUtilCD2.iso / Misc / DC-POS24.LZX / pOS / pOS_RKRM.lzx / pOS_RKRM / pDos / ConReport.c < prev    next >
Encoding:
C/C++ Source or Header  |  1997-03-18  |  3.4 KB  |  145 lines

  1.  
  2. /*******************************************************************
  3.  $CRT 02 Mar 1997 : hb
  4.  
  5.  $AUT Holger Burkarth
  6.  $DAT >>ConReport.c<<   02 Mar 1997    21:00:04 - (C) ProDAD
  7. *******************************************************************/
  8.  
  9. //##ex mcpp:cppc -gs -o pos:pos/ex/ConReport p:pLib/StartCode.o p:/pOS_RKRM/pDos/ConReport.c p:pLib/StdIO.o -l pOSStub -l pOS
  10.  
  11. /***********************************************************
  12.   pOS programing example - Copyright (C) 1995-97 proDAD
  13.  
  14.   This code was written as an easy to understand example,
  15.   how to program pOS features. It is provided 'as-is',
  16.   without any express or implied warranty.
  17.  
  18.   Permission is hereby granted to use, copy and modify
  19.   this source code for any purpose, without fee, subject
  20.   to the following conditions:
  21.  
  22.     (1) This notice may not be removed or altered from any
  23.         source distribution.
  24.  
  25.     (2) Altered source versions must be plainly marked as
  26.         such, and must not be misrepresented as being
  27.         the original source code.
  28.  
  29.     (3) If only executable code is distributed, then the
  30.         accompanying documentation have to state that
  31.         "this software is based in part on examples of
  32.         the pOS developer packet".
  33.  
  34.     (4) Permission for use of this code is granted only
  35.         if the user accepts full responsibility for any
  36.         undesirable consequences. proDAD accept NO LIABILITY
  37.         for damages of any kind.
  38.  
  39.   ©proDAD
  40. ***********************************************************/
  41.  
  42. /*\
  43. *** Example:
  44. ***
  45. \*/
  46.  
  47.  
  48. #define __COMPUTER_AMIGA 1
  49. #define NOMYDEBUG
  50.  
  51. #include "p:pExec/Types.h"
  52. #include "p:pDOS/ArgTags.h"
  53. #include "p:pDOS/DosSig.h"
  54. #include "p:pDOS/DosErrors.h"
  55. #include "p:pDOS/Process.h"
  56. #include "p:pDos/Files.h"
  57. #include "p:Device/Timer.h"
  58. #include "p:pDOS/DosDev.h"
  59. #include "p:proto/pLibExt.h"
  60. #include "p:proto/pExec2.h"
  61. #include "p:proto/pDOS2.h"
  62.  
  63. #ifdef _____ME_____
  64.   #include "grund/inc_string.h"
  65.   #include "grund/inc_stdio.h"
  66. #else
  67.  #ifdef __cplusplus
  68.  extern "C" {
  69.  #endif
  70.   #include <string.h>
  71.   #include <stdio.h>
  72.  #ifdef __cplusplus
  73.  }
  74.  #endif
  75. #endif
  76.  
  77.  
  78. const CHAR *HelpText=
  79. ""
  80. ;
  81.  
  82. const CHAR *PrgHeader=
  83. "Control Dos-Buffers";
  84.  
  85. const CHAR *PrgVerText=
  86. "$VER: 1.0 ("__DATE2__") (Copyright 1997 by proDAD) (Created by Holger Burkarth)";
  87.  
  88.  
  89.  
  90. /*----------------------------------
  91. -----------------------------------*/
  92. #ifdef __cplusplus
  93. extern "C"
  94. #endif
  95.  
  96. VOID main()
  97. {
  98.   struct pOS_DosArgs* Args;
  99.   ULONG Ops[1]={(ULONG)"CONSOLE:"};
  100.  
  101.   Args=pOS_ReadDosArgs(
  102. // 0
  103. "NAME",
  104. Ops,sizeof(Ops)/sizeof(ULONG),
  105.  
  106.     ARGTAG_PrgHeaderText, (ULONG)PrgHeader,    /* kurze Programm-Beschreibung */
  107.     ARGTAG_HelpText,      (ULONG)HelpText,     /* Help-Texte */
  108.     ARGTAG_PrgVerText,    (ULONG)PrgVerText,   /* VER-String */
  109.     TAG_END);
  110.  
  111.   if(Args) {
  112.     UBYTE Buffer[64];
  113.     size_t Size;
  114.     pOS_FileHandle* FH;
  115.  
  116.     if(FH=pOS_OpenFile(NULL,(dosname_t*)Ops[0],FILEHDMOD_Read)) {
  117.       static const UBYTE WindowStatusReport[] = {0x9b,0x30,0x20,0x71};
  118.  
  119.       pOS_SetDosScreenMode(FH,1);
  120.  
  121. /*\
  122. *** Send Window-Status-Request
  123. \*/
  124.       pOS_WriteFile(FH,(VOID*)WindowStatusReport,sizeof(WindowStatusReport));
  125.       Size=pOS_ReadFile(FH,Buffer,sizeof(Buffer));
  126.  
  127.  
  128.  
  129. /*\
  130. *** Print Window-Status-Request - Result
  131. \*/
  132.       Buffer[Size]='\0';
  133.       printf("Window-Status-Report: Resultsize=%ld: [%.12p] <%s>\n",Size,Buffer,Buffer+1);
  134.  
  135.       pOS_SetDosScreenMode(FH,0);
  136.       pOS_CloseFile(FH);
  137.     }
  138.     else pOS_PrintDosErr(NULL,(CHAR*)Ops[0],0);
  139.  
  140.     pOS_DeleteDosArgs(Args);
  141.   }
  142. }
  143.  
  144.  
  145.