xref: /original-bsd/lib/libcurses/fullname.c (revision 53787e02)
1 /*
2  * Copyright (c) 1980 Regents of the University of California.
3  * All rights reserved.  The Berkeley software License Agreement
4  * specifies the terms and conditions for redistribution.
5  */
6 
7 #ifndef lint
8 static char sccsid[] = "@(#)fullname.c	5.1 (Berkeley) 06/07/85";
9 #endif not lint
10 
11 # define	reg	register
12 
13 /*
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  */
18 char *
19 fullname(bp, def)
20 reg char	*bp, *def;
21 {
22 
23 	reg char	*cp;
24 
25 	*def = 0;			/* in case no name */
26 
27 	while (*bp && *bp != ':') {
28 		cp = def;		/* start of answer */
29 		while (*bp && *bp != ':' && *bp != '|') {
30 			*cp++ = *bp++;	/* copy name over */
31 		}
32 		*cp = 0;		/* zero end of name */
33 		if (*bp == '|') {
34 			bp++;		/* skip over '|' if that is case */
35 		}
36 	}
37 	return(def);
38 }
39