home *** CD-ROM | disk | FTP | other *** search
/ Super Net 1 / SUPERNET_1.iso / PC / OTROS / EXTRAS / UUCODE / UUPC / TEST / UPC12ES1.ZIP / LIB / timestmp.c < prev    next >
Encoding:
C/C++ Source or Header  |  1993-11-20  |  7.4 KB  |  230 lines

  1. /*--------------------------------------------------------------------*/
  2. /*    t i m e s t m p . c                                             */
  3. /*                                                                    */
  4. /*    Compiler timestamps for display at program start-up             */
  5. /*--------------------------------------------------------------------*/
  6.  
  7. /*--------------------------------------------------------------------*/
  8. /*       Changes Copyright (c) 1989-1993 by Kendra Electronic         */
  9. /*       Wonderworks.                                                 */
  10. /*                                                                    */
  11. /*       All rights reserved except those explicitly granted by       */
  12. /*       the UUPC/extended license agreement.                         */
  13. /*--------------------------------------------------------------------*/
  14.  
  15. /*--------------------------------------------------------------------*/
  16. /*                          RCS Information                           */
  17. /*--------------------------------------------------------------------*/
  18.  
  19. /*
  20.  *    $Id: timestmp.c 1.11 1993/11/21 02:45:50 ahd Exp $
  21.  *
  22.  *    Revision history:
  23.  *    $Log: timestmp.c $
  24.  *     Revision 1.11  1993/11/21  02:45:50  ahd
  25.  *     Change OS/2 id to 16/32 bit
  26.  *
  27.  *     Revision 1.10  1993/10/31  11:58:18  ahd
  28.  *     Don't include version header if version already defined (for BC++)
  29.  *
  30.  *     Revision 1.9  1993/10/12  00:47:57  ahd
  31.  *     Normalize comments
  32.  *
  33.  *     Revision 1.8  1993/08/11  02:31:12  ahd
  34.  *     Always display the banner
  35.  *
  36.  *     Revision 1.7  1993/08/03  03:11:49  ahd
  37.  *     Drop _EasyWinInit
  38.  *
  39.  *     Revision 1.6  1993/08/02  03:24:59  ahd
  40.  *     Further changes in support of Robert Denny's Windows 3.x support
  41.  *
  42.  *     Revision 1.5  1993/07/31  16:22:16  ahd
  43.  *     Changes in support of Robert Denny's Windows 3.x support
  44.  *
  45.  */
  46.  
  47. /*--------------------------------------------------------------------*/
  48. /*                        System include files                        */
  49. /*--------------------------------------------------------------------*/
  50.  
  51. #include <dos.h>
  52. #include <direct.h>
  53. #include <io.h>
  54.  
  55. #include <stdio.h>
  56. #include <stdlib.h>
  57. #include <string.h>
  58.  
  59. #ifdef _Windows
  60. #include <windows.h>
  61. #include <time.h>
  62. #endif
  63.  
  64. /*--------------------------------------------------------------------*/
  65. /*                    UUPC/extended include files                     */
  66. /*--------------------------------------------------------------------*/
  67.  
  68. #include "lib.h"
  69. #include "timestmp.h"
  70.  
  71. #ifndef UUPCV
  72. #include "win32ver.h"
  73. #endif
  74.  
  75. #ifdef _Windows
  76. #include "winutil.h"
  77. #include "ssleep.h"
  78. #endif
  79.  
  80. /*--------------------------------------------------------------------*/
  81. /*                          Global variables                          */
  82. /*--------------------------------------------------------------------*/
  83.  
  84. #ifdef _Windows
  85. currentfile();
  86. #endif
  87.  
  88. char compiled[] = { __DATE__ } ;
  89. char compilet[] = { __TIME__ } ;
  90. char compilev[] = { UUPCV } ;
  91.  
  92. char compilep[] = { "UUPC/extended" } ;
  93. char *compilen  = compilep;
  94.  
  95. #ifdef _Windows
  96. char *compilew = NULL;
  97. #endif
  98.  
  99. /*--------------------------------------------------------------------*/
  100. /*       b a n n e r                                                  */
  101. /*                                                                    */
  102. /*       Report program name and version at startup                   */
  103. /*--------------------------------------------------------------------*/
  104.  
  105. void banner (char **argv)
  106. {
  107.       char dummy[FILENAME_MAX];
  108.       char program[FILENAME_MAX];
  109.  
  110.  
  111. #if defined(_Windows)
  112.    WORD wVersion;
  113.    WORD wMode;
  114.    char *szMode;
  115.  
  116. /*--------------------------------------------------------------------*/
  117. /*                     Determine Windows version                      */
  118. /*--------------------------------------------------------------------*/
  119.  
  120.    wVersion = LOWORD(GetVersion());
  121.    asm {
  122.          MOV      AX,0x400   /* DPMI Get Version call                 */
  123.          INT      0x31       /* ax=ver,bx=win286/386...               */
  124.          AND      BX,3       /* win386=1,win286=2                     */
  125.          MOV      wMode,BX   /* Put in local                          */
  126.    }
  127.  
  128.    switch(wMode)
  129.    {
  130.       case 1:
  131.          szMode = "386 Enhanced";
  132.          break;
  133.  
  134.       case 2:
  135.          szMode = "Standard (286)";
  136.          break;
  137.  
  138.       default:
  139.          szMode = "Unknown";
  140.          break;
  141.    }
  142.  
  143.    if ( wVersion < 0x301 )
  144.    {
  145.       printmsg(0,"This program requires Windows 3.1, running %u.%u",
  146.                   (WORD)(LOBYTE(wVersion)),
  147.                   (WORD)(HIBYTE(wVersion)));
  148.       panic();
  149.    }
  150.  
  151.    sprintf(dummy, "Windows %u.%u %s",
  152.                   (WORD)(LOBYTE(wVersion)),
  153.                   (WORD)(HIBYTE(wVersion)),
  154.                   szMode );
  155.    compilew = newstr( dummy );
  156.  
  157. #endif
  158.  
  159. /*--------------------------------------------------------------------*/
  160. /*                     Deterine the program name                      */
  161. /*--------------------------------------------------------------------*/
  162.  
  163. #ifdef __TURBOC__
  164.       if (  fnsplit(argv[0],dummy,dummy, program,dummy) && FILENAME )
  165.       {
  166. #else
  167.       if (!equal(argv[0],"C"))    /* Microsoft C for no prog name? */
  168.       {
  169.          _splitpath( argv[0], dummy , dummy , program , dummy );
  170. #endif /* __TURBOC__ */
  171.  
  172.          strcpy(argv[0], program);  /* Reset original program name    */
  173.          compilen = argv[0];
  174.  
  175. /*--------------------------------------------------------------------*/
  176. /*                 Return if input is not the console                 */
  177. /*--------------------------------------------------------------------*/
  178.  
  179. #ifndef _Windows
  180.       if (!isatty(fileno(stdout))) /* Is the console I/O redirected?  */
  181.          return;                 /* Yes --> Run quietly               */
  182. #endif
  183.  
  184. /*--------------------------------------------------------------------*/
  185. /*                       Print the program name                       */
  186. /*--------------------------------------------------------------------*/
  187.  
  188.          fprintf(stderr,"%s: ",program);
  189.       } /* if */
  190.  
  191. /*--------------------------------------------------------------------*/
  192. /*    Now print out the version, operating system and time stamp      */
  193. /*--------------------------------------------------------------------*/
  194.  
  195.       fprintf(stderr,"%s %s (%s mode, %2.2s%3.3s%2.2s %5.5s)\n",
  196.                   compilep,
  197.                   compilev,
  198.  
  199. #ifdef WIN32
  200.                   "Windows 32 bit",
  201. #elif defined(_Windows)
  202.                   /* "Windows 16 bit", */ compilew,
  203. #elif defined(__OS2__)
  204.                   "OS/2 32 bit",
  205. #elif defined(__TURBOC__)
  206.                   "DOS",
  207. #else
  208.                   (_osmode == DOS_MODE) ? "DOS" : "OS/2 16 bit",
  209. #endif
  210.  
  211.                   &compiled[4],
  212.                   &compiled[0],
  213.                   &compiled[9],
  214.                   compilet);
  215.  
  216. #ifdef _Windows
  217.    sprintf( dummy, "%s  (%s %s)", program, compilep, compilev);
  218.  
  219.    hOurTask = GetCurrentTask();
  220.    if ( hOurTask == NULL )
  221.       panic();
  222.    hOurWindow = FindTaskWindow(hOurTask, "BCEasyWin");
  223.    SetWindowText(hOurWindow, dummy);
  224.  
  225.    ddelay(0);           /* To insure we yield control at least once;  */
  226.                         /* see comments in winutil.c.                 */
  227. #endif
  228.  
  229. } /* banner */
  230.