home *** CD-ROM | disk | FTP | other *** search
- /*
- * Config program for use by savers that just need a font selected.
- *
- * Copyright (c) 1991, Mike Meyer
- * All Rights Reserved
- *
- * See the file "ShadowMaster:Distribution" for information on distribution.
- *
- * ===build instructions
- * % lc font-config ; output= font-config.o input= font-config.c
- * % blink font-config.o lib lib:amiga.lib to font-config SC SD ; output= font-config input= font-config.o
- * % copy font-config //config
- * ===endbuild
- */
-
- #include <exec/types.h>
- #include <utility/tagitem.h>
- #include <dos/dos.h>
- #include <libraries/asl.h>
- #include <proto/exec.h>
- #include <proto/dos.h>
- #include <proto/asl.h>
-
- struct ExecBase *SysBase = NULL ;
- struct DosLibrary *DOSBase = NULL ;
- struct Library *AslBase = NULL ;
-
- #define done(x) do { status = x; goto out; } while (0) ;
- int __saveds
- start(void) {
- int status ;
- struct RDArgs *args = NULL ;
- struct FontRequester *my_req = NULL ;
- long opts[3] = { 0, 0, 0} ;
-
-
- SysBase = *((struct ExecBase **) 4);
- if (!(DOSBase = (struct DosLibrary *) OpenLibrary("dos.library", 37)))
- done(RETURN_FAIL) ;
- if (!(AslBase = OpenLibrary("asl.library", 37)))
- done(RETURN_FAIL) ;
- if (!(args = ReadArgs("NAME/A,FONT,SIZE/N", opts, NULL)))
- done(RETURN_ERROR) ;
-
- if (!(my_req = AllocAslRequestTags(ASL_FontRequest,
- ASL_Hail, (LONG) opts[0],
- ASL_LeftEdge, 0, ASL_TopEdge, 11,
- ASL_FontName, opts[1] ? ((char *) opts[1]) : "topaz.font",
- ASL_FontHeight, opts[2] ? *((long *) opts[2]) : 8,
- TAG_DONE, 0)))
- done(RETURN_FAIL) ;
- if (AslRequest(my_req, NULL))
- Printf("%s FONT %s SIZE %ld\n", opts[0],
- my_req->fo_Attr.ta_Name, my_req->fo_Attr.ta_YSize) ;
-
- status = RETURN_OK ;
- out:
- if (my_req) FreeAslRequest(my_req) ;
- FreeArgs(args) ;
- if (AslBase) CloseLibrary(AslBase) ;
- if (DOSBase) CloseLibrary((struct Library *) DOSBase) ;
- return status ;
- }
-