infotocap.c revision 2
2N/A * The contents of this file are subject to the terms of the 2N/A * Common Development and Distribution License, Version 1.0 only 2N/A * (the "License"). You may not use this file except in compliance 2N/A * See the License for the specific language governing permissions 2N/A * and limitations under the License. 2N/A * When distributing Covered Code, include this CDDL HEADER in each 2N/A * If applicable, add the following below this CDDL HEADER, with the 2N/A * fields enclosed by brackets "[]" replaced with your own identifying 2N/A * information: Portions Copyright [yyyy] [name of copyright owner] 2N/A * Copyright 2004 Sun Microsystems, Inc. All rights reserved. 2N/A * Use is subject to license terms. 2N/A/* Copyright (c) 1988 AT&T */ 2N/A/* All Rights Reserved */ 2N/A * University Copyright- Copyright (c) 1982, 1986, 1988 2N/A * The Regents of the University of California 2N/A * All Rights Reserved 2N/A * University Acknowledgment- Portions of this document are derived from 2N/A * software developed by the University of California, Berkeley, and its 2N/A#
pragma ident "%Z%%M% %I% %E% SMI" 2N/A Routines to convert terminfo string parameters to termcap form. 2N/A Not all terminfo strings will be, or could be, converted. 2N/A The following parameter forms will at least be handled. 2N/A %p2 before %p1 -> %r 2N/A %p1%'x'% > %+%p1%'y'%+%; -> % > xy 2N/A/* externs from libc */ 2N/A /* handle both Sys Vr2 and Vr3 curses */ 2N/A#
endif /* SYSV || USG */ 2N/A lookat looks at a string such as "%p1%d" and a pattern such as "%p*%d", 2N/A where '*' is the only wild character. Each place that the star matches, 2N/A the corresponding character in the string is placed in args. If the 2N/A pattern matches the string, 1 is returned. 2N/A Setparms() and checkparms() are used by infotocap() to make 2N/A sure that the parameters in the terminfo entry alternate and are 2N/A only '1' or '2'. If the order has been reversed, then %r is added 2N/A in to the new value being built. 2N/A Infotocap looks at the string capability to see if it has any 2N/A stack manipulation operators. If possible, they are converted to 2N/A termcap form. If any operator is found that cannot be modified, 2N/A prepend a message to the beginning of the original value and 2N/A set err to 1. A pointer to the new copy of the string is returned