summaryrefslogtreecommitdiff
path: root/usr.bin/tic
diff options
context:
space:
mode:
authorTodd C. Miller <millert@cvs.openbsd.org>1999-12-06 02:14:35 +0000
committerTodd C. Miller <millert@cvs.openbsd.org>1999-12-06 02:14:35 +0000
commited0ef13119b0600b79a09ecaab7b6e8a725d4820 (patch)
treeac25e45529e72e422572ea6104baa92690f462f6 /usr.bin/tic
parent93f153c898a0b816862eaf10532cbb586e2a293a (diff)
update to ncurses-5.0-19991204
Diffstat (limited to 'usr.bin/tic')
-rw-r--r--usr.bin/tic/MKtermsort.sh24
-rw-r--r--usr.bin/tic/dump_entry.c41
-rw-r--r--usr.bin/tic/tic.c14
3 files changed, 48 insertions, 31 deletions
diff --git a/usr.bin/tic/MKtermsort.sh b/usr.bin/tic/MKtermsort.sh
index ae02e353747..ae594a09bf0 100644
--- a/usr.bin/tic/MKtermsort.sh
+++ b/usr.bin/tic/MKtermsort.sh
@@ -1,11 +1,12 @@
#!/bin/sh
+# $From: MKtermsort.sh,v 1.5 1999/12/04 21:45:35 tom Exp $
#
# MKtermsort.sh -- generate indirection vectors for the various sort methods
#
# The output of this script is C source for nine arrays that list three sort
# orders for each of the three different classes of terminfo capabilities.
#
-# $OpenBSD: MKtermsort.sh,v 1.2 1999/01/18 18:57:52 millert Exp $
+# $OpenBSD: MKtermsort.sh,v 1.3 1999/12/06 02:14:33 millert Exp $
#
AWK=${1-awk}
DATA=${2-../include/Caps}
@@ -13,7 +14,7 @@ DATA=${2-../include/Caps}
echo "/*";
echo " * termsort.c --- sort order arrays for use by infocmp.";
echo " *";
-echo " * Note: this file is generated using termsort.sh, do not edit by hand.";
+echo " * Note: this file is generated using MKtermsort.sh, do not edit by hand.";
echo " */";
echo "static const int bool_terminfo_sort[] = {";
@@ -97,27 +98,26 @@ $3 == "str" {printf("%s\t%d\n", $4, i++);}
echo "};";
echo "";
-echo "static const int bool_from_termcap[] = {";
+echo "static const bool bool_from_termcap[] = {";
$AWK <$DATA '
-$3 == "bool" && substr($5, 1, 1) == "-" {print "0,\t/* ", $2, " */";}
-$3 == "bool" && substr($5, 1, 1) == "Y" {print "1,\t/* ", $2, " */";}
+$3 == "bool" && substr($5, 1, 1) == "-" {print "\tFALSE,\t/* ", $2, " */";}
+$3 == "bool" && substr($5, 1, 1) == "Y" {print "\tTRUE,\t/* ", $2, " */";}
'
echo "};";
echo "";
-echo "static const int num_from_termcap[] = {";
+echo "static const bool num_from_termcap[] = {";
$AWK <$DATA '
-$3 == "num" && substr($5, 1, 1) == "-" {print "0,\t/* ", $2, " */";}
-$3 == "num" && substr($5, 1, 1) == "Y" {print "1,\t/* ", $2, " */";}
+$3 == "num" && substr($5, 1, 1) == "-" {print "\tFALSE,\t/* ", $2, " */";}
+$3 == "num" && substr($5, 1, 1) == "Y" {print "\tTRUE,\t/* ", $2, " */";}
'
echo "};";
echo "";
-echo "static const int str_from_termcap[] = {";
+echo "static const bool str_from_termcap[] = {";
$AWK <$DATA '
-$3 == "str" && substr($5, 1, 1) == "-" {print "0,\t/* ", $2, " */";}
-$3 == "str" && substr($5, 1, 1) == "Y" {print "1,\t/* ", $2, " */";}
+$3 == "str" && substr($5, 1, 1) == "-" {print "\tFALSE,\t/* ", $2, " */";}
+$3 == "str" && substr($5, 1, 1) == "Y" {print "\tTRUE,\t/* ", $2, " */";}
'
echo "};";
echo "";
-
diff --git a/usr.bin/tic/dump_entry.c b/usr.bin/tic/dump_entry.c
index d1bc69ada01..1616f99fe18 100644
--- a/usr.bin/tic/dump_entry.c
+++ b/usr.bin/tic/dump_entry.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: dump_entry.c,v 1.8 1999/11/28 17:58:57 millert Exp $ */
+/* $OpenBSD: dump_entry.c,v 1.9 1999/12/06 02:14:34 millert Exp $ */
/****************************************************************************
* Copyright (c) 1998,1999 Free Software Foundation, Inc. *
@@ -40,7 +40,7 @@
#include <termsort.c> /* this C file is generated */
#include <parametrized.h> /* so is this */
-MODULE_ID("$From: dump_entry.c,v 1.38 1999/11/27 23:00:21 tom Exp $")
+MODULE_ID("$From: dump_entry.c,v 1.41 1999/12/05 02:03:59 tom Exp $")
#define INDENT 8
@@ -74,7 +74,13 @@ static const char *separator, *trailer;
#define V_AIX 3 /* AIX */
#define V_BSD 4 /* BSD */
+#if NCURSES_XNAMES
+#define OBSOLETE(n) (!_nc_user_definable && (n[0] == 'O' && n[1] == 'T'))
+#else
#define OBSOLETE(n) (n[0] == 'O' && n[1] == 'T')
+#endif
+
+#define isObsolete(f,n) ((f == F_TERMINFO || f == F_VARIABLE) && OBSOLETE(n))
#if NCURSES_XNAMES
#define BoolIndirect(j) ((j >= BOOLCOUNT) ? (j) : ((sortmode == S_NOSORT) ? j : bool_indirect[j]))
@@ -406,6 +412,8 @@ static char * fmt_complex(char *dst, char *src, int level)
{
int percent = 0;
int n;
+ bool if_then = strstr(src, "%?") != 0;
+ bool params = !if_then && (strlen(src) > 50) && (strstr(src, "%p") != 0);
dst += strlen(dst);
while (*src != '\0') {
@@ -452,6 +460,15 @@ static char * fmt_complex(char *dst, char *src, int level)
_nc_warning("%%; without %%?");
}
break;
+ case 'p':
+ if (percent && params) {
+ dst[-1] = '\n';
+ for (n = 0; n <= level; n++)
+ *dst++ = '\t';
+ *dst++ = '%';
+ }
+ percent = 0;
+ break;
default:
percent = 0;
break;
@@ -500,8 +517,7 @@ bool outcount = 0;
if (!version_filter(BOOLEAN, i))
continue;
- else if ((outform == F_LITERAL || outform == F_TERMINFO || outform == F_VARIABLE)
- && (OBSOLETE(name) && outform != F_LITERAL))
+ else if (isObsolete(outform,name))
continue;
predval = pred(BOOLEAN, i);
@@ -524,8 +540,7 @@ bool outcount = 0;
if (!version_filter(NUMBER, i))
continue;
- else if ((outform == F_LITERAL || outform == F_TERMINFO || outform == F_VARIABLE)
- && (OBSOLETE(name) && outform != F_LITERAL))
+ else if (isObsolete(outform,name))
continue;
predval = pred(NUMBER, i);
@@ -557,8 +572,7 @@ bool outcount = 0;
if (!version_filter(STRING, i))
continue;
- else if ((outform == F_LITERAL || outform == F_TERMINFO || outform == F_VARIABLE)
- && (OBSOLETE(name) && outform != F_LITERAL))
+ else if (isObsolete(outform,name))
continue;
/*
@@ -608,7 +622,7 @@ bool outcount = 0;
sprintf(buffer, "%s@", name);
else if (outform == F_TERMCAP || outform == F_TCONVERR)
{
- char *srccap = _nc_tic_expand(tterm->Strings[i], FALSE, numbers);
+ char *srccap = _nc_tic_expand(tterm->Strings[i], TRUE, numbers);
char *cv = _nc_infotocap(name, srccap, parametrized[i]);
if (cv == 0)
@@ -819,8 +833,7 @@ void compare_entry(void (*hook)(int t, int i, const char *name), TERMTYPE *tp GC
i = BoolIndirect(j);
name = ExtBoolname(tp,i,bool_names);
- if ((outform == F_LITERAL || outform == F_TERMINFO || outform == F_VARIABLE)
- && (OBSOLETE(name) && outform != F_LITERAL))
+ if (isObsolete(outform,name))
continue;
(*hook)(BOOLEAN, i, name);
@@ -832,8 +845,7 @@ void compare_entry(void (*hook)(int t, int i, const char *name), TERMTYPE *tp GC
i = NumIndirect(j);
name = ExtNumname(tp,i,num_names);
- if ((outform==F_LITERAL || outform==F_TERMINFO || outform==F_VARIABLE)
- && (OBSOLETE(name) && outform != F_LITERAL))
+ if (isObsolete(outform,name))
continue;
(*hook)(NUMBER, i, name);
@@ -845,8 +857,7 @@ void compare_entry(void (*hook)(int t, int i, const char *name), TERMTYPE *tp GC
i = StrIndirect(j);
name = ExtStrname(tp,i,str_names);
- if ((outform==F_LITERAL || outform==F_TERMINFO || outform==F_VARIABLE)
- && (OBSOLETE(name) && outform != F_LITERAL))
+ if (isObsolete(outform,name))
continue;
(*hook)(STRING, i, name);
diff --git a/usr.bin/tic/tic.c b/usr.bin/tic/tic.c
index 6e31152bf7c..1f29d9770cd 100644
--- a/usr.bin/tic/tic.c
+++ b/usr.bin/tic/tic.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: tic.c,v 1.12 1999/11/28 17:58:57 millert Exp $ */
+/* $OpenBSD: tic.c,v 1.13 1999/12/06 02:14:34 millert Exp $ */
/****************************************************************************
* Copyright (c) 1998,1999 Free Software Foundation, Inc. *
@@ -44,7 +44,7 @@
#include <dump_entry.h>
#include <term_entry.h>
-MODULE_ID("$From: tic.c,v 1.52 1999/09/25 22:47:54 tom Exp $")
+MODULE_ID("$From: tic.c,v 1.53 1999/12/04 22:45:52 tom Exp $")
const char *_nc_progname = "tic";
@@ -410,8 +410,14 @@ bool check_only = FALSE;
else
_nc_progname++;
- infodump = (strcmp(_nc_progname, "captoinfo") == 0);
- capdump = (strcmp(_nc_progname, "infotocap") == 0);
+ if ((infodump = (strcmp(_nc_progname, "captoinfo") == 0)) != FALSE) {
+ outform = F_TERMINFO;
+ sortmode = S_TERMINFO;
+ }
+ if ((capdump = (strcmp(_nc_progname, "infotocap") == 0)) != FALSE) {
+ outform = F_TERMCAP;
+ sortmode = S_TERMCAP;
+ }
#if NCURSES_XNAMES
use_extended_names(FALSE);
#endif