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