150276Speter/**************************************************************************** 2262629Sdelphij * Copyright (c) 1998-2009,2010 Free Software Foundation, Inc. * 350276Speter * * 450276Speter * Permission is hereby granted, free of charge, to any person obtaining a * 550276Speter * copy of this software and associated documentation files (the * 650276Speter * "Software"), to deal in the Software without restriction, including * 750276Speter * without limitation the rights to use, copy, modify, merge, publish, * 850276Speter * distribute, distribute with modifications, sublicense, and/or sell * 950276Speter * copies of the Software, and to permit persons to whom the Software is * 1050276Speter * furnished to do so, subject to the following conditions: * 1150276Speter * * 1250276Speter * The above copyright notice and this permission notice shall be included * 1350276Speter * in all copies or substantial portions of the Software. * 1450276Speter * * 1550276Speter * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * 1650276Speter * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * 1750276Speter * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * 1850276Speter * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * 1950276Speter * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * 2050276Speter * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * 2150276Speter * THE USE OR OTHER DEALINGS IN THE SOFTWARE. * 2250276Speter * * 2350276Speter * Except as contained in this notice, the name(s) of the above copyright * 2450276Speter * holders shall not be used in advertising or otherwise to promote the * 2550276Speter * sale, use or other dealings in this Software without prior written * 2650276Speter * authorization. * 2750276Speter ****************************************************************************/ 2850276Speter 2950276Speter/**************************************************************************** 3050276Speter * Author: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995 * 3150276Speter * and: Eric S. Raymond <esr@snark.thyrsus.com> * 32262629Sdelphij * and: Thomas E. Dickey 1996-on * 33262629Sdelphij * and: Juergen Pfeifer 2009 * 3450276Speter ****************************************************************************/ 3550276Speter 3650276Speter/* 3750276Speter** lib_longname.c 3850276Speter** 3950276Speter** The routine longname(). 4050276Speter** 4150276Speter*/ 4250276Speter 4350276Speter#include <curses.priv.h> 4450276Speter 45262629SdelphijMODULE_ID("$Id: lib_longname.c,v 1.12 2010/12/20 00:31:26 tom Exp $") 4650276Speter 47262629Sdelphij#if USE_REENTRANT 4876726SpeterNCURSES_EXPORT(char *) 49262629SdelphijNCURSES_SP_NAME(longname) (NCURSES_SP_DCL0) 50262629Sdelphij{ 51262629Sdelphij static char empty[] = 52262629Sdelphij {'\0'}; 53262629Sdelphij char *ptr; 54262629Sdelphij 55262629Sdelphij T((T_CALLED("longname(%p)"), (void *) SP_PARM)); 56262629Sdelphij 57262629Sdelphij if (SP_PARM) { 58262629Sdelphij for (ptr = SP_PARM->_ttytype + strlen(SP_PARM->_ttytype); 59262629Sdelphij ptr > SP_PARM->_ttytype; 60262629Sdelphij ptr--) 61262629Sdelphij if (*ptr == '|') 62262629Sdelphij returnPtr(ptr + 1); 63262629Sdelphij returnPtr(SP_PARM->_ttytype); 64262629Sdelphij } 65262629Sdelphij return empty; 66262629Sdelphij} 67262629Sdelphij 68262629Sdelphij#if NCURSES_SP_FUNCS 69262629SdelphijNCURSES_EXPORT(char *) 7050276Speterlongname(void) 7150276Speter{ 72262629Sdelphij return NCURSES_SP_NAME(longname) (CURRENT_SCREEN); 73262629Sdelphij} 74262629Sdelphij#endif 75262629Sdelphij 76262629Sdelphij#else 77262629SdelphijNCURSES_EXPORT(char *) 78262629Sdelphijlongname(void) 79262629Sdelphij{ 8076726Speter char *ptr; 8150276Speter 8276726Speter T((T_CALLED("longname()"))); 8350276Speter 84262629Sdelphij for (ptr = ttytype + strlen(ttytype); 85262629Sdelphij ptr > ttytype; 86262629Sdelphij ptr--) 8776726Speter if (*ptr == '|') 8876726Speter returnPtr(ptr + 1); 8976726Speter returnPtr(ttytype); 9050276Speter} 91262629Sdelphij#endif 92