home *** CD-ROM | disk | FTP | other *** search
/ Fresh Fish 1 / FFMCD01.bin / bbs / util / mfrinced.lha / MFRinCED / src / SetDefPubScreen.c < prev   
C/C++ Source or Header  |  1993-08-23  |  4KB  |  160 lines

  1.  
  2. #line 2
  3.  
  4. /*««««««««««««««««««««  SetDefPubScreen/main  »»»»»»»»»»»»»»»»»»»»»»»»»»»»>
  5.  «                                                                       »
  6.  «    Program:          SetDefPubScreen                                  »
  7.  «                                                                       »
  8.  «    Module:           SetDefPubScreen.c                                »
  9.  «                                                                       »
  10.  «    Abstract:         CLI-prgm  to change def PubScreen                »
  11.  «                                                                       »
  12.  «    Author:       Benjamin Lear (BL)                               »
  13.  «                                                                       »
  14.  «    Date:             17.8.1993                                        »
  15.  «                                                                       »
  16.  «    Last modified:    23.8.1993                                        »
  17.  «                                                                       »
  18.  «    Version:        $VER:     SetDefPubScreen 1.0 ( 23.8.1993 )        »
  19.  «                                                                       »
  20.  ««««««««««««««««««««««««««   ««««« · »»»»»   »»»»»»»»»»»»»»»»»»»»»»»»»»»*/
  21.  
  22. /*«««««««««««««««««««««««««««  DESCRIPTION   »»»»»»»»»»»»»»»»»»»»»»»»»»»»>
  23.  «                                                                       »
  24.  ««««««««««««««««««««««««««   ««««« · »»»»»   »»»»»»»»»»»»»»»»»»»»»»»»»»»*/
  25.  
  26. /*«««««««««««««««««««««««««««««  HISTORY  »»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»>
  27.  «                                                                       »
  28.  ««««««««««««««««««««««««««   ««««« · »»»»»   »»»»»»»»»»»»»»»»»»»»»»»»»»»*/
  29.  
  30.  
  31. /*          ««««««««««  preprocessor definitions    »»»»»»»»»           */
  32.  
  33. #define BL_STD         1
  34. #define BL_INTUITION     1
  35. #define BL_PROTOS     1
  36.  
  37. /* #define BL_DEBUG    1*/
  38.  
  39. #include <BL_std.h>
  40.  
  41.  
  42. /*          ««««««««««««««««  Declarations  »»»»»»»»»»»»»»»»»           */
  43.  
  44. /* globals for messages to user    */
  45. extern UBYTE            currname[];
  46.  
  47. /*          «««««««««««««««««  Prototypes  »»»»»»»»»»»»»»»»»»           */
  48.  
  49. void cleanup( UBYTE    *str, int code );
  50.  
  51. /*          «««««««««««««««««  Definitions  »»»»»»»»»»»»»»»»»           */
  52.  
  53. struct Library    *IntuitionBase = NULL;
  54. struct Library    *GfxBase = NULL;
  55.  
  56. /*          ««««««««««««««««««  Functions  »»»»»»»»»»»»»»»»»»           */
  57.  
  58.  
  59.  
  60. /*               «««««««««  Internal Functions  »»»»»»»»»        */
  61.  
  62.  
  63. /*-\i««««««««««««««««««  SetDefPubScreen/main  »»»»»»»»»»»»»»»»»»»»»»»»»»>
  64. <
  65. <    NAME
  66. <        main()
  67. <    SYNOPSIS
  68. <
  69. <    FUNCTION
  70. <        Change the Default Publicscreen 
  71. <    INPUTS
  72. <        Name of new Publicscreen ( -> argv[1] )
  73. <    RESULT
  74. <
  75. <    EXAMPLE
  76. <    NOTES
  77. <    BUGS
  78. <    SEE ALSO
  79. <
  80.  <«««««««««««««««««««««««««   ««««« · »»»»»   »»»»»»»»»»»»»»»»»»»»»»»»»»*/
  81.  
  82.  
  83. void 
  84. main(int argc, char** argv)
  85. {
  86.  
  87.   struct Library    *OpenLibrary();
  88.  
  89.   /*
  90.    *    Currname is the name of the default public screen.
  91.    *    It's the null string if it is the Workbench.
  92.    */
  93.  
  94.   UBYTE        currname[ MAXPUBSCREENNAME+256] = "";
  95.  
  96.   /* a small check if arg could be correctly */
  97.   if ( argc != 2 )
  98.   {
  99.     exit(0);
  100.   }
  101.   
  102.  
  103.  
  104.   if (! (IntuitionBase =  OpenLibrary("intuition.library", 36L) ) )
  105.   cleanup( "no v36 Intuition", 20 );
  106.  
  107.   if ( ! (GfxBase =   OpenLibrary("graphics.library", 36L) ) )
  108.     cleanup( "no v36 Graphics", 20 );
  109.  
  110.   /* recieve the name of the default public screen */
  111.  
  112.   GetDefaultPubScreen( currname );
  113.  
  114.   /* create a environment variable to store the old value */
  115.   strins(currname,"PUBLICSCREEN=" );
  116.  
  117.   putenv( currname  );
  118.  
  119.  
  120. #ifdef BL_DEBUG 
  121.   printf( " Pubscreen was: %s\n", currname );
  122. #endif // BL_DEBUG 
  123.  
  124.  
  125.   /* changing the public screen */
  126.   SetDefaultPubScreen( (UBYTE *) argv[1] );
  127.  
  128.  
  129. #ifdef BL_DEBUG 
  130.   GetDefaultPubScreen( currname );
  131.   printf( " Pubscreen is now: %s\n", currname,0,0 );
  132. #endif // BL_DEBUG 
  133.   
  134.  
  135.   cleanup( "O.K", 0 );
  136.  
  137. }
  138.  
  139.  
  140. /*    ----------------------------- · ----------------------------      */
  141.  
  142.  
  143. /* Function cleanup() tries to do exactly what its name proposes */
  144.  
  145. void
  146. cleanup( UBYTE    *str, int code )
  147. {
  148.  
  149.     if ( str ) printf( "%s\n", str );
  150.  
  151.     if (GfxBase) CloseLibrary(GfxBase);
  152.     if (IntuitionBase) CloseLibrary(IntuitionBase);
  153.  
  154.     exit ( code );
  155. }
  156.  
  157.  
  158.  
  159. /*                          ««« THE · END »»»                */
  160.