home *** CD-ROM | disk | FTP | other *** search
- #include <exec/types.h>
- #include <intuition/intuitionbase.h>
- #include <intuition/screens.h>
- #include <proto/intuition.h>
- #include <proto/exec.h>
- #define INTUITION_REV 0L
- extern struct IntuitionBase *IntuitionBase;
- extern struct IntuitionBase *OpenLibrary();
- static void ShowUsage()
- {
- printf("Usage: WLIST [screen]\n");
- exit(10L);
- }
- static struct Screen *FindScreen(ScreenName)
- --MORE--(71%)char *ScreenName;
- {
- struct Screen *theScreen;
- if (ScreenName && ScreenName[0])
- {
- Forbid();
- theScreen = IntuitionBase->FirstScreen;
- while (theScreen && (theScreen->Title == NULL ||
- stricmp(theScreen->Title,ScreenName) != 0))
- theScreen = theScreen->NextScreen;
- Permit();
- } else {
- Forbid();
- theScreen = IntuitionBase->FirstScreen;
- Permit();
- }
- if (theScreen == NULL)
- {
- Permit();
- printf("Can't find screen '%s'\n",ScreenName);
- exit(10L);
- --MORE--(73%) }
- return(theScreen);
- }
- static void PrintWindowTitle(theWindow)
- struct Window *theWindow;
- {
- if (theWindow && theWindow->Title)
- printf(" '%s'\n",theWindow->Title);
- else
- printf(" [No Title]\n");
- }
- static void PrintScreenTitle(theScreen)
- struct Screen *theScreen;
- {
- if (theScreen && theScreen->Title)
- printf("'%s'\n",theScreen->Title);
- else
- printf("[No Title]\n");
- }
- --MORE--(74%)
- static void PrintScreenWindows(theScreen)
- struct Screen *theScreen;
- {
- struct Window *theWindow = theScreen->FirstWindow;
-
- while (theWindow)
- {
- PrintWindowTitle(theWindow);
- theWindow = theWindow->NextWindow;
- }
- }
- void main(argc,argv)
- int argc;
- char *argv[];
- {
- char *ScreenName = NULL;
- struct Screen *theScreen;
- if (argc > 2) ShowUsage();
- if (argc > 1 && argv[1] && argv[1][0] != '\0') ScreenName = argv[1];
- --MORE--(75%)
- IntuitionBase = OpenLibrary("intuition.library",INTUITION_REV);
- if (IntuitionBase)
- {
- theScreen = FindScreen(ScreenName);
- printf("\n");
- while (theScreen)
- {
- PrintScreenTitle(theScreen);
- PrintScreenWindows(theScreen);
- if (ScreenName)
- theScreen = NULL;
- else
- theScreen = theScreen->NextScreen;
- }
- printf("\n");
- CloseLibrary(IntuitionBase);
- }
- }
-