home *** CD-ROM | disk | FTP | other *** search
-
- #line 2
-
- /*«««««««««««««««««««« SetDefPubScreen/main »»»»»»»»»»»»»»»»»»»»»»»»»»»»>
- « »
- « Program: SetDefPubScreen »
- « »
- « Module: SetDefPubScreen.c »
- « »
- « Abstract: CLI-prgm to change def PubScreen »
- « »
- « Author: Benjamin Lear (BL) »
- « »
- « Date: 17.8.1993 »
- « »
- « Last modified: 23.8.1993 »
- « »
- « Version: $VER: SetDefPubScreen 1.0 ( 23.8.1993 ) »
- « »
- «««««««««««««««««««««««««« ««««« · »»»»» »»»»»»»»»»»»»»»»»»»»»»»»»»»*/
-
- /*««««««««««««««««««««««««««« DESCRIPTION »»»»»»»»»»»»»»»»»»»»»»»»»»»»>
- « »
- «««««««««««««««««««««««««« ««««« · »»»»» »»»»»»»»»»»»»»»»»»»»»»»»»»»*/
-
- /*««««««««««««««««««««««««««««« HISTORY »»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»>
- « »
- «««««««««««««««««««««««««« ««««« · »»»»» »»»»»»»»»»»»»»»»»»»»»»»»»»»*/
-
-
- /* «««««««««« preprocessor definitions »»»»»»»»» */
-
- #define BL_STD 1
- #define BL_INTUITION 1
- #define BL_PROTOS 1
-
- /* #define BL_DEBUG 1*/
-
- #include <BL_std.h>
-
-
- /* «««««««««««««««« Declarations »»»»»»»»»»»»»»»»» */
-
- /* globals for messages to user */
- extern UBYTE currname[];
-
- /* ««««««««««««««««« Prototypes »»»»»»»»»»»»»»»»»» */
-
- void cleanup( UBYTE *str, int code );
-
- /* ««««««««««««««««« Definitions »»»»»»»»»»»»»»»»» */
-
- struct Library *IntuitionBase = NULL;
- struct Library *GfxBase = NULL;
-
- /* «««««««««««««««««« Functions »»»»»»»»»»»»»»»»»» */
-
-
-
- /* ««««««««« Internal Functions »»»»»»»»» */
-
-
- /*-\i«««««««««««««««««« SetDefPubScreen/main »»»»»»»»»»»»»»»»»»»»»»»»»»>
- <
- < NAME
- < main()
- < SYNOPSIS
- <
- < FUNCTION
- < Change the Default Publicscreen
- < INPUTS
- < Name of new Publicscreen ( -> argv[1] )
- < RESULT
- <
- < EXAMPLE
- < NOTES
- < BUGS
- < SEE ALSO
- <
- <««««««««««««««««««««««««« ««««« · »»»»» »»»»»»»»»»»»»»»»»»»»»»»»»»*/
-
-
- void
- main(int argc, char** argv)
- {
-
- struct Library *OpenLibrary();
-
- /*
- * Currname is the name of the default public screen.
- * It's the null string if it is the Workbench.
- */
-
- UBYTE currname[ MAXPUBSCREENNAME+256] = "";
-
- /* a small check if arg could be correctly */
- if ( argc != 2 )
- {
- exit(0);
- }
-
-
-
- if (! (IntuitionBase = OpenLibrary("intuition.library", 36L) ) )
- cleanup( "no v36 Intuition", 20 );
-
- if ( ! (GfxBase = OpenLibrary("graphics.library", 36L) ) )
- cleanup( "no v36 Graphics", 20 );
-
- /* recieve the name of the default public screen */
-
- GetDefaultPubScreen( currname );
-
- /* create a environment variable to store the old value */
- strins(currname,"PUBLICSCREEN=" );
-
- putenv( currname );
-
-
- #ifdef BL_DEBUG
- printf( " Pubscreen was: %s\n", currname );
- #endif // BL_DEBUG
-
-
- /* changing the public screen */
- SetDefaultPubScreen( (UBYTE *) argv[1] );
-
-
- #ifdef BL_DEBUG
- GetDefaultPubScreen( currname );
- printf( " Pubscreen is now: %s\n", currname,0,0 );
- #endif // BL_DEBUG
-
-
- cleanup( "O.K", 0 );
-
- }
-
-
- /* ----------------------------- · ---------------------------- */
-
-
- /* Function cleanup() tries to do exactly what its name proposes */
-
- void
- cleanup( UBYTE *str, int code )
- {
-
- if ( str ) printf( "%s\n", str );
-
- if (GfxBase) CloseLibrary(GfxBase);
- if (IntuitionBase) CloseLibrary(IntuitionBase);
-
- exit ( code );
- }
-
-
-
- /* ««« THE · END »»» */
-