home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Frozen Fish 1: Amiga
/
FrozenFish-Apr94.iso
/
bbs
/
alib
/
d4xx
/
d494
/
vscreen.lha
/
vScreen
/
Utilities
/
Source
/
wList.c
< prev
next >
Wrap
C/C++ Source or Header
|
1991-06-06
|
2KB
|
110 lines
#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)
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);
}
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");
}
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];
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);
}
}