version 1.10, 1999/12/12 04:49:19 |
version 1.11, 2000/01/02 21:48:13 |
|
|
/* $OpenBSD$ */ |
/* $OpenBSD$ */ |
|
|
/**************************************************************************** |
/**************************************************************************** |
* Copyright (c) 1998,1999 Free Software Foundation, Inc. * |
* Copyright (c) 1998-2000 Free Software Foundation, Inc. * |
* * |
* * |
* Permission is hereby granted, free of charge, to any person obtaining a * |
* Permission is hereby granted, free of charge, to any person obtaining a * |
* copy of this software and associated documentation files (the * |
* copy of this software and associated documentation files (the * |
|
|
#include <termsort.c> /* this C file is generated */ |
#include <termsort.c> /* this C file is generated */ |
#include <parametrized.h> /* so is this */ |
#include <parametrized.h> /* so is this */ |
|
|
MODULE_ID("$From: dump_entry.c,v 1.43 1999/12/12 02:29:54 tom Exp $") |
MODULE_ID("$From: dump_entry.c,v 1.44 2000/01/02 02:14:35 tom Exp $") |
#define INDENT 8 |
|
|
|
|
#define INDENT 8 |
#define DISCARD(string) string = ABSENT_STRING |
#define DISCARD(string) string = ABSENT_STRING |
|
#define PRINTF (void) printf |
|
|
static int tversion; /* terminfo version */ |
static int tversion; /* terminfo version */ |
static int outform; /* output format to use */ |
static int outform; /* output format to use */ |
static int sortmode; /* sort mode to use */ |
static int sortmode; /* sort mode to use */ |
static int width = 60; /* max line width for listings */ |
static int width = 60; /* max line width for listings */ |
static int column; /* current column, limited by 'width' */ |
static int column; /* current column, limited by 'width' */ |
static int oldcol; /* last value of column before wrap */ |
static int oldcol; /* last value of column before wrap */ |
static int tracelevel; /* level of debug output */ |
static int tracelevel; /* level of debug output */ |
static bool pretty; /* true if we format if-then-else strings */ |
static bool pretty; /* true if we format if-then-else strings */ |
|
|
static char *outbuf; /* the output-buffer */ |
static char *outbuf; /* the output-buffer */ |
static size_t out_used; /* ...its current length */ |
static size_t out_used; /* ...its current length */ |
static size_t out_size; /* ...and its allocated length */ |
static size_t out_size; /* ...and its allocated length */ |
|
|
/* indirection pointers for implementing sort and display modes */ |
/* indirection pointers for implementing sort and display modes */ |
static const int *bool_indirect, *num_indirect, *str_indirect; |
static const int *bool_indirect, *num_indirect, *str_indirect; |
static NCURSES_CONST char *const *bool_names; |
static NCURSES_CONST char *const *bool_names; |
static NCURSES_CONST char *const *num_names; |
static NCURSES_CONST char *const *num_names; |
static NCURSES_CONST char *const *str_names; |
static NCURSES_CONST char *const *str_names; |
|
|
static const char *separator, *trailer; |
static const char *separator, *trailer; |
|
|
/* cover various ports and variants of terminfo */ |
/* cover various ports and variants of terminfo */ |
#define V_ALLCAPS 0 /* all capabilities (SVr4, XSI, ncurses) */ |
#define V_ALLCAPS 0 /* all capabilities (SVr4, XSI, ncurses) */ |
|
|
#endif |
#endif |
|
|
#if NO_LEAKS |
#if NO_LEAKS |
void |
void |
_nc_leaks_dump_entry(void) |
_nc_leaks_dump_entry(void) |
{ |
{ |
if (outbuf != 0) { |
if (outbuf != 0) { |
free(outbuf); |
free(outbuf); |
|
|
return (FALSE); /* pacify the compiler */ |
return (FALSE); /* pacify the compiler */ |
} |
} |
|
|
static |
static void |
void |
|
append_output(const char *src) |
append_output(const char *src) |
{ |
{ |
if (src == 0) { |
if (src == 0) { |
|
|
} |
} |
} |
} |
|
|
static |
static void |
void |
|
force_wrap(void) |
force_wrap(void) |
{ |
{ |
oldcol = column; |
oldcol = column; |
|
|
column = INDENT; |
column = INDENT; |
} |
} |
|
|
static |
static void |
void |
|
wrap_concat(const char *src) |
wrap_concat(const char *src) |
{ |
{ |
int need = strlen(src); |
int need = strlen(src); |
|
|
} |
} |
} |
} |
|
|
if (init_3string != 0 |
if (termcap_reset != ABSENT_STRING) { |
&& termcap_reset != 0 |
if (init_3string != ABSENT_STRING |
&& !strcmp(init_3string, termcap_reset)) |
&& !strcmp(init_3string, termcap_reset)) |
DISCARD(init_3string); |
DISCARD(init_3string); |
|
|
if (reset_2string != 0 |
if (reset_2string != ABSENT_STRING |
&& termcap_reset != 0 |
&& !strcmp(reset_2string, termcap_reset)) |
&& !strcmp(reset_2string, termcap_reset)) |
DISCARD(reset_2string); |
DISCARD(reset_2string); |
} |
} |
} |
|
|
predval = pred(STRING, i); |
predval = pred(STRING, i); |
|
|
|
|
if (((len = fmt_entry(tterm, pred, FALSE, infodump, numbers)) > critlen) |
if (((len = fmt_entry(tterm, pred, FALSE, infodump, numbers)) > critlen) |
&& limited) { |
&& limited) { |
(void) printf("# (untranslatable capabilities removed to fit entry within %d bytes)\n", |
PRINTF("# (untranslatable capabilities removed to fit entry within %d bytes)\n", |
critlen); |
critlen); |
if ((len = fmt_entry(tterm, pred, TRUE, infodump, numbers)) > critlen) { |
if ((len = fmt_entry(tterm, pred, TRUE, infodump, numbers)) > critlen) { |
/* |
/* |
|
|
*/ |
*/ |
char *oldsgr = set_attributes; |
char *oldsgr = set_attributes; |
set_attributes = ABSENT_STRING; |
set_attributes = ABSENT_STRING; |
(void) printf("# (sgr removed to fit entry within %d bytes)\n", |
PRINTF("# (sgr removed to fit entry within %d bytes)\n", |
critlen); |
critlen); |
if ((len = fmt_entry(tterm, pred, TRUE, infodump, numbers)) > critlen) { |
if ((len = fmt_entry(tterm, pred, TRUE, infodump, numbers)) > critlen) { |
int oldversion = tversion; |
int oldversion = tversion; |
|
|
tversion = V_BSD; |
tversion = V_BSD; |
(void) printf("# (terminfo-only capabilities suppressed to fit entry within %d bytes)\n", |
PRINTF("# (terminfo-only capabilities suppressed to fit entry within %d bytes)\n", |
critlen); |
critlen); |
|
|
if ((len = fmt_entry(tterm, pred, TRUE, infodump, numbers)) |
if ((len = fmt_entry(tterm, pred, TRUE, infodump, numbers)) |
|
|
"warning: %s entry is %d bytes long\n", |
"warning: %s entry is %d bytes long\n", |
_nc_first_name(tterm->term_names), |
_nc_first_name(tterm->term_names), |
len); |
len); |
(void) printf( |
PRINTF( |
"# WARNING: this entry, %d bytes long, may core-dump %s libraries!\n", |
"# WARNING: this entry, %d bytes long, may core-dump %s libraries!\n", |
len, legend); |
len, legend); |
} |
} |