tools/adflib: build only host variant which is used by Sam440 target
[AROS.git] / rom / intuition / nextpubscreen.c
blob99912f73610b8d47cac708e05881ce16edf588cd
1 /*
2 Copyright © 1995-2013, The AROS Development Team. All rights reserved.
3 Copyright © 2001-2003, The MorphOS Development Team. All Rights Reserved.
4 $Id$
5 */
7 #include <string.h>
8 #include "intuition_intern.h"
10 /*****************************************************************************
12 NAME */
13 #include <proto/intuition.h>
15 AROS_LH2(UBYTE *, NextPubScreen,
17 /* SYNOPSIS */
18 AROS_LHA(struct Screen *, screen , A0),
19 AROS_LHA(UBYTE * , namebuff, A1),
21 /* LOCATION */
22 struct IntuitionBase *, IntuitionBase, 89, Intuition)
24 /* FUNCTION
25 Gets the next public screen in the system; this allows visitor windows
26 to jump among public screens in a cycle.
28 INPUTS
29 screen - Pointer to the public screen your window is open in or
30 NULL if you don't have a pointer to a public screen.
31 namebuff - Pointer to a buffer with (at least) MAXPUBSCREENNAME+1
32 characters to put the name of the next public screen in.
34 RESULT
35 Returns 'namebuff' or NULL if there are no public screens.
37 NOTES
38 We cannot guarantee that the public screen, the name of which you got
39 by using this function, is available when you call for instance
40 LockPubScreen(). Therefore you must be prepared to handle failure of
41 that kind of functions.
43 This function may return the name of a public screen which is in
44 private mode.
46 The cycle order is undefined, so draw no conclusions based on it!
48 EXAMPLE
50 BUGS
52 SEE ALSO
53 OpenScreen(), PubScreenStatus()
55 INTERNALS
56 Maybe we should correct the + 1 stupidity.
58 *****************************************************************************/
60 AROS_LIBFUNC_INIT
62 struct PubScreenNode *ps;
63 struct IntScreen *scr = (struct IntScreen *)screen;
64 struct List *list;
66 list = LockPubScreenList();
68 if(scr == NULL)
70 ps = (struct PubScreenNode *)list->lh_Head;
71 ASSERT(ps != NULL);
73 else
75 ps = scr->pubScrNode;
76 if (ps != NULL)
78 ps = (struct PubScreenNode *)ps->psn_Node.ln_Succ;
79 ASSERT(ps != NULL);
81 else
82 namebuff = NULL;
85 /* A "valid" node in a list must have ln_Succ != NULL */
87 if (ps->psn_Node.ln_Succ == NULL)
88 namebuff = NULL;
90 if (namebuff != NULL)
91 strcpy(namebuff, ps->psn_Node.ln_Name);
93 UnlockPubScreenList();
95 return namebuff;
97 AROS_LIBFUNC_EXIT
98 } /* NextPubScreen */