17c478bdstevel@tonic-gate/*
27c478bdstevel@tonic-gate * Copyright 2001 Sun Microsystems, Inc.  All rights reserved.
37c478bdstevel@tonic-gate * Use is subject to license terms.
47c478bdstevel@tonic-gate */
57c478bdstevel@tonic-gate
67c478bdstevel@tonic-gate/*	Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T	*/
77c478bdstevel@tonic-gate/*	  All Rights Reserved  	*/
87c478bdstevel@tonic-gate
97c478bdstevel@tonic-gate/*
107c478bdstevel@tonic-gate * Copyright (c) 1980 Regents of the University of California.
117c478bdstevel@tonic-gate * All rights reserved.  The Berkeley software License Agreement
127c478bdstevel@tonic-gate * specifies the terms and conditions for redistribution.
137c478bdstevel@tonic-gate */
147c478bdstevel@tonic-gate
157c478bdstevel@tonic-gate#pragma ident	"%Z%%M%	%I%	%E% SMI"
167c478bdstevel@tonic-gate
177c478bdstevel@tonic-gate/*LINTLIBRARY*/
187c478bdstevel@tonic-gate
197c478bdstevel@tonic-gate#ifndef lint
207c478bdstevel@tonic-gatestatic char
217c478bdstevel@tonic-gatesccsid[] = "@(#)fullname.c 1.3 88/02/08 SMI"; /* from UCB 5.1 85/06/07 */
227c478bdstevel@tonic-gate#endif /* not lint */
237c478bdstevel@tonic-gate
247c478bdstevel@tonic-gate/*
257c478bdstevel@tonic-gate *	This routine fills in "def" with the full name of the terminal.
267c478bdstevel@tonic-gate * This is assumed to be the last name in the list of aliases.
277c478bdstevel@tonic-gate */
287c478bdstevel@tonic-gate
297c478bdstevel@tonic-gatechar *
307c478bdstevel@tonic-gatefullname(char *bp, char *def)
317c478bdstevel@tonic-gate{
327c478bdstevel@tonic-gate	char	*cp;
337c478bdstevel@tonic-gate
347c478bdstevel@tonic-gate	*def = 0;			/* in case no name */
357c478bdstevel@tonic-gate
367c478bdstevel@tonic-gate	while (*bp && *bp != ':') {
377c478bdstevel@tonic-gate		cp = def;		/* start of answer */
387c478bdstevel@tonic-gate		while (*bp && *bp != ':' && *bp != '|') {
397c478bdstevel@tonic-gate			*cp++ = *bp++;	/* copy name over */
407c478bdstevel@tonic-gate		}
417c478bdstevel@tonic-gate		*cp = 0;		/* zero end of name */
427c478bdstevel@tonic-gate		if (*bp == '|') {
437c478bdstevel@tonic-gate			bp++;		/* skip over '|' if that is case */
447c478bdstevel@tonic-gate		}
457c478bdstevel@tonic-gate	}
467c478bdstevel@tonic-gate	return (def);
477c478bdstevel@tonic-gate}
48