home *** CD-ROM | disk | FTP | other *** search
- /*****************************************************************************/
- /** Copyright 1988 by Evans & Sutherland Computer Corporation, **/
- /** Salt Lake City, Utah **/
- /** **/
- /** All Rights Reserved **/
- /** **/
- /** Permission to use, copy, modify, and distribute this software and **/
- /** its documentation for any purpose and without fee is hereby **/
- /** granted, provided that the above copyright notice appear in all **/
- /** copies and that both that copyright notice and this permis- **/
- /** sion notice appear in supporting documentation, and that the **/
- /** name of Evans & Sutherland not be used in advertising or publi- **/
- /** city pertaining to distribution of the software without specif- **/
- /** ic, written prior permission. **/
- /** **/
- /** EVANS & SUTHERLAND DISCLAIMS ALL WARRANTIES WITH REGARD TO **/
- /** THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILI- **/
- /** TY AND FITNESS, IN NO EVENT SHALL EVANS & SUTHERLAND BE LIABLE **/
- /** FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAM- **/
- /** AGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, **/
- /** WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS **/
- /** ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PER- **/
- /** FORMANCE OF THIS SOFTWARE. **/
- /*****************************************************************************/
-
- /**********************************************************************
- *
- * $Header: list.c,v 1.2 88/04/15 07:09:53 tlastran Exp $
- *
- * TWM code to deal with the name lists for the NoTitle list and
- * the AutoRaise list
- *
- * 11-Apr-88 Tom LaStrange Initial Version.
- *
- **********************************************************************/
-
- #ifndef lint
- static char RCSinfo[]=
- "$Header: list.c,v 1.2 88/04/15 07:09:53 tlastran Exp $";
- #endif lint
-
- #include <stdio.h>
- #include "twm.h"
- #include "gram.h"
-
- typedef struct name_list name_list;
-
- struct name_list
- {
- name_list *next; /* pointer to the next name */
- char *name; /* the name of the window */
- };
-
- name_list *NoTitle = NULL; /* list of window names with no title bar */
- name_list *AutoRaise = NULL; /* list of window names to auto-raise */
-
- /***********************************************************************
- *
- * Procedure:
- * AddToList - add a window name to the appropriate list
- *
- * Inputs:
- * list - a #define to identify the list
- * name - a pointer to the name of the window
- *
- ***********************************************************************
- */
-
- void
- AddToList(list, name)
- int list;
- char *name;
- {
- name_list *ptr;
-
- ptr = (name_list *)malloc(sizeof(name_list));
- if (ptr == NULL)
- {
- fprintf(stderr, "twm: out of memory\n");
- exit(1);
- }
-
- ptr->name = name;
-
- switch (list)
- {
- case AUTO_RAISE:
- ptr->next = AutoRaise;
- AutoRaise = ptr;
- break;
-
- case NO_TITLE:
- ptr->next = NoTitle;
- NoTitle = ptr;
- break;
- }
- }
-
- /***********************************************************************
- *
- * Procedure:
- * LookInList - look through a list for a window name
- *
- * Returned Value:
- * TRUE - the window was found in the list
- * FALSE - the window was not found in the list
- *
- * Inputs:
- * list - a #define to identify the list
- * name - a pointer to the name to look for
- *
- ***********************************************************************
- */
-
- int
- LookInList(list, name)
- int list;
- char *name;
- {
- name_list *l;
- name_list *ptr;
-
- switch (list)
- {
- case AUTO_RAISE:
- l = AutoRaise;
- break;
-
- case NO_TITLE:
- l = NoTitle;
- break;
- }
-
- for (ptr = l; ptr != NULL; ptr = ptr->next)
- {
- int len;
-
- len = strlen(ptr->name);
- if (strncmp(name, ptr->name, len) == 0)
- return (TRUE);
- }
- return (FALSE);
- }
-