xref: /original-bsd/lib/libcurses/fullname.c (revision 6b4229fb)
1 /*
2  * Copyright (c) 1981, 1993
3  *	The Regents of the University of California.  All rights reserved.
4  *
5  * %sccs.include.redist.c%
6  */
7 
8 #ifndef lint
9 static char sccsid[] = "@(#)fullname.c	8.1 (Berkeley) 06/04/93";
10 #endif	/* not lint */
11 
12 /*
13  * fullname --
14  *	This routine fills in "def" with the full name of the terminal.
15  *	This is assumed to be the last name in the list of aliases.
16  */
17 char *
18 fullname(bp, def)
19 	register char *bp, *def;
20 {
21 	register char *cp;
22 
23 	*def = '\0';		/* In case no name. */
24 
25 	while (*bp && *bp != ':') {
26 		cp = def;	/* Start of answer. */
27 		while (*bp && *bp != ':' && *bp != '|')
28 			*cp++ = *bp++;	/* Copy name over. */
29 		*cp = '\0';		/* Zero end of name. */
30 		if (*bp == '|')
31 			bp++;		/* Skip over '|' if that is case. */
32 	}
33 	return (def);
34 }
35