c/7203: Internal compiler error in reload_cse_simplify_operands, at reload1.c:8368

zorzella@zorzella.com zorzella@zorzella.com
Wed Jul 3 15:16:00 GMT 2002


>Number:         7203
>Category:       c
>Synopsis:       Internal compiler error in reload_cse_simplify_operands, at reload1.c:8368
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          ice-on-legal-code
>Submitter-Id:   net
>Arrival-Date:   Wed Jul 03 14:46:17 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator:     
>Release:        3.1
>Organization:

>Environment:
System: SunOS canada 5.7 Generic_106541-18 sun4u sparc SUNW,Ultra-5_10
Architecture: sun4

	
host: sparc-sun-solaris2.7
build: sparc-sun-solaris2.7
target: sparc-sun-solaris2.7
configured with: ../gcc-3.1/configure --prefix=/home/raid2/zorzella/root/usr/local/gcc32-3.1
>Description:

Compilation of ncurses generates ICE. .i in the bottom.

zorzella@canada:~/root/usr/src/ncurses-5.2/objects [zorzella_2.0] $ gcc -v --save-temps -I../progs -I.  -DNDEBUG -I. -I../include -I/home/raid2/zorzella/root/usr/local/include -DHAVE_CONFIG_H -O2  -c ../progs/infocmp.c
Reading specs from /home/raid2/zorzella/root/usr/local/gcc/bin/../lib/gcc-lib/sparc-sun-solaris2.7/3.1/specs
Configured with: ../gcc-3.1/configure --prefix=/home/raid2/zorzella/root/usr/local/gcc32-3.1
Thread model: posix
gcc version 3.1
 /home/raid2/zorzella/root/usr/local/gcc/bin/../lib/gcc-lib/sparc-sun-solaris2.7/3.1/cpp0 -lang-c -v -I../progs -I. -I. -I../include -I/home/raid2/zorzella/root/usr/local/include -iprefix /home/raid2/zorzella/root/usr/local/gcc/bin/../lib/gcc-lib/sparc-sun-solaris2.7/3.1/ -D__GNUC__=3 -D__GNUC_MINOR__=1 -D__GNUC_PATCHLEVEL__=0 -Dsparc -Dsun -Dunix -D__svr4__ -D__SVR4 -D__PRAGMA_REDEFINE_EXTNAME -D__sparc__ -D__sun__ -D__unix__ -D__svr4__ -D__SVR4 -D__PRAGMA_REDEFINE_EXTNAME -D__sparc -D__sun -D__unix -Asystem=unix -Asystem=svr4 -D__OPTIMIZE__ -D__STDC_HOSTED__=1 -D__SIZE_TYPE__=unsigned int -D__PTRDIFF_TYPE__=int -D__WCHAR_TYPE__=long int -D__WINT_TYPE__=long int -D__GCC_NEW_VARARGS__ -Acpu=sparc -Amachine=sparc -DNDEBUG -DHAVE_CONFIG_H ../progs/infocmp.c infocmp.i
GNU CPP version 3.1 (cpplib) (sparc ELF)
ignoring nonexistent directory "/home/raid2/zorzella/root/usr/local/gcc/sparc-sun-solaris2.7/include"
ignoring nonexistent directory "/home/raid2/zorzella/root/usr/local/gcc32-3.1/sparc-sun-solaris2.7/include"
ignoring duplicate directory "."
ignoring duplicate directory "/home/raid2/zorzella/root/usr/local/gcc32-3.1/lib/gcc-lib/sparc-sun-solaris2.7/3.1/include"
#include "..." search starts here:
#include <...> search starts here:
 ../progs
 .
 ../include
 /home/raid2/zorzella/root/usr/local/include
 /home/raid2/zorzella/root/usr/local/gcc/lib/gcc-lib/sparc-sun-solaris2.7/3.1/include
 /usr/local/include
 /home/raid2/zorzella/root/usr/local/gcc32-3.1/include
 /usr/include
End of search list.
 /home/raid2/zorzella/root/usr/local/gcc/bin/../lib/gcc-lib/sparc-sun-solaris2.7/3.1/cc1 -fpreprocessed infocmp.i -quiet -dumpbase infocmp.c -O2 -version -o infocmp.s
GNU CPP version 3.1 (cpplib) (sparc ELF)
GNU C version 3.1 (sparc-sun-solaris2.7)
        compiled by GNU C version 3.1.
../progs/infocmp.c: In function `use_predicate':
../progs/infocmp.c:218: insn does not satisfy its constraints:
(insn 631 66 59 (set (reg:SI 9 %o1)
        (reg/f:SI 254)) 51 {*movsi_insn} (nil)
    (nil))
../progs/infocmp.c:218: Internal compiler error in reload_cse_simplify_operands, at reload1.c:8368
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://www.gnu.org/software/gcc/bugs.html> for instructions.







>How-To-Repeat:
	
>Fix:
	






# 1 "../progs/infocmp.c"
# 1 "<built-in>"
# 1 "<command line>"
# 1 "../progs/infocmp.c"
# 39 "../progs/infocmp.c"
# 1 "../progs/progs.priv.h" 1
# 40 "../progs/progs.priv.h"
# 1 "../include/ncurses_cfg.h" 1
# 129 "../include/ncurses_cfg.h"
# 1 "../include/ncurses_def.h" 1
# 130 "../include/ncurses_cfg.h" 2
# 41 "../progs/progs.priv.h" 2







# 1 "/home/raid2/zorzella/root/usr/local/gcc/lib/gcc-lib/sparc-sun-solaris2.7/3.1/include/stdlib.h" 1 3 4
# 25 "/home/raid2/zorzella/root/usr/local/gcc/lib/gcc-lib/sparc-sun-solaris2.7/3.1/include/stdlib.h" 3 4
#pragma ident "@(#)stdlib.h	1.44	98/01/22 SMI" 

# 1 "/usr/include/sys/feature_tests.h" 1 3 4
# 13 "/usr/include/sys/feature_tests.h" 3 4
#pragma ident "@(#)feature_tests.h	1.17	97/12/04 SMI"

# 1 "/usr/include/sys/isa_defs.h" 1 3 4
# 9 "/usr/include/sys/isa_defs.h" 3 4
#pragma ident "@(#)isa_defs.h	1.16	99/05/25 SMI"
# 16 "/usr/include/sys/feature_tests.h" 2 3 4
# 28 "/home/raid2/zorzella/root/usr/local/gcc/lib/gcc-lib/sparc-sun-solaris2.7/3.1/include/stdlib.h" 2 3 4
# 38 "/home/raid2/zorzella/root/usr/local/gcc/lib/gcc-lib/sparc-sun-solaris2.7/3.1/include/stdlib.h" 3 4
typedef struct {
        int quot;
        int rem;
} div_t;

typedef struct {
        long quot;
        long rem;
} ldiv_t;


typedef struct {
        long long quot;
        long long rem;
} lldiv_t;
# 66 "/home/raid2/zorzella/root/usr/local/gcc/lib/gcc-lib/sparc-sun-solaris2.7/3.1/include/stdlib.h" 3 4
typedef unsigned int size_t;
# 77 "/home/raid2/zorzella/root/usr/local/gcc/lib/gcc-lib/sparc-sun-solaris2.7/3.1/include/stdlib.h" 3 4
typedef long uid_t;
# 107 "/home/raid2/zorzella/root/usr/local/gcc/lib/gcc-lib/sparc-sun-solaris2.7/3.1/include/stdlib.h" 3 4
typedef long int wchar_t;
# 148 "/home/raid2/zorzella/root/usr/local/gcc/lib/gcc-lib/sparc-sun-solaris2.7/3.1/include/stdlib.h" 3 4
extern unsigned char __ctype[];



extern double atof(const char *);
extern int atoi(const char *);
extern long int atol(const char *);
extern double strtod(const char *, char **);
extern long int strtol(const char *, char **, int);
extern unsigned long int strtoul(const char *, char **, int);

extern int rand(void);
extern void srand(unsigned int);





extern void *calloc(size_t, size_t);
extern void free(void *);
extern void *malloc(size_t);
extern void *realloc(void *, size_t);

extern void abort(void);
extern int atexit(void (*)(void));
extern void exit(int);
extern void _exithandle(void);
extern char *getenv(const char *);
extern int system(const char *);

extern void *bsearch(const void *, const void *, size_t, size_t,
        int (*)(const void *, const void *));
extern void qsort(void *, size_t, size_t,
        int (*)(const void *, const void *));

extern int abs(int);
extern div_t div(int, int);
extern long int labs(long);
extern ldiv_t ldiv(long, long);

extern int mbtowc(wchar_t *, const char *, size_t);
extern int mblen(const char *, size_t);
extern int wctomb(char *, wchar_t);

extern size_t mbstowcs(wchar_t *, const char *, size_t);
extern size_t wcstombs(char *, const wchar_t *, size_t);




extern double drand48(void);
extern double erand48(unsigned short *);
extern long jrand48(unsigned short *);
extern void lcong48(unsigned short *);
extern long lrand48(void);
extern long mrand48(void);
extern long nrand48(unsigned short *);
extern unsigned short *seed48(unsigned short *);
extern void srand48(long);
extern int putenv(char *);
extern void setkey(const char *);





extern void swab(const char *, char *, int);




extern int mkstemp(char *);


extern int mkstemp64(char *);






extern long a64l(const char *);
extern char *ecvt(double, int, int *, int *);
extern char *fcvt(double, int, int *, int *);
extern char *gcvt(double, int, char *);
extern int getsubopt(char **, char *const *, char **);
extern int grantpt(int);
extern char *initstate(unsigned, char *, size_t);
extern char *l64a(long);
extern char *mktemp(char *);
extern char *ptsname(int);
extern long random(void);
extern char *realpath(const char *, char *);
extern char *setstate(const char *);
extern void srandom(unsigned);
extern int ttyslot(void);
extern int unlockpt(int);
extern void *valloc(size_t);




extern int dup2(int, int);
extern char *qecvt(long double, int, int *, int *);
extern char *qfcvt(long double, int, int *, int *);
extern char *qgcvt(long double, int, char *);
extern char *getcwd(char *, size_t);
extern const char *getexecname(void);
extern char *getlogin(void);
extern int getopt(int, char *const *, const char *);
extern char *optarg;
extern int optind, opterr, optopt;
extern char *getpass(const char *);
extern char *getpassphrase(const char *);
extern int getpw(uid_t, char *);
extern int isatty(int);
extern void *memalign(size_t, size_t);
extern char *ttyname(int);


extern long long atoll(const char *);
extern long long llabs(long long);
extern lldiv_t lldiv(long long, long long);
extern char *lltostr(long long, char *);
extern long long strtoll(const char *, char **, int);
extern unsigned long long strtoull(const char *, char **, int);
extern char *ulltostr(unsigned long long, char *);
# 49 "../progs/progs.priv.h" 2
# 1 "/usr/include/ctype.h" 1 3 4
# 16 "/usr/include/ctype.h" 3 4
#pragma ident "@(#)ctype.h	1.30	98/01/16 SMI" 
# 48 "/usr/include/ctype.h" 3 4
extern int isalnum(int);
extern int isalpha(int);
extern int iscntrl(int);
extern int isdigit(int);
extern int isgraph(int);
extern int islower(int);
extern int isprint(int);
extern int ispunct(int);
extern int isspace(int);
extern int isupper(int);
extern int isxdigit(int);
extern int tolower(int);
extern int toupper(int);




extern int isascii(int);
extern int toascii(int);
extern int _tolower(int);
extern int _toupper(int);



extern unsigned char __ctype[];
extern unsigned int *__ctype_mask;
extern int *__trans_upper;
extern int *__trans_lower;
# 50 "../progs/progs.priv.h" 2
# 1 "/usr/include/string.h" 1 3 4
# 16 "/usr/include/string.h" 3 4
#pragma ident "@(#)string.h	1.22	97/12/22 SMI" 
# 43 "/usr/include/string.h" 3 4
extern void *memcpy(void *, const void *, size_t);
extern void *memmove(void *, const void *, size_t);
extern char *strcpy(char *, const char *);
extern char *strncpy(char *, const char *, size_t);

extern char *strcat(char *, const char *);
extern char *strncat(char *, const char *, size_t);

extern int memcmp(const void *, const void *, size_t);
extern int strcmp(const char *, const char *);
extern int strcoll(const char *, const char *);
extern int strncmp(const char *, const char *, size_t);
extern size_t strxfrm(char *, const char *, size_t);

extern void *memchr(const void *, int, size_t);
extern char *strchr(const char *, int);
extern size_t strcspn(const char *, const char *);
extern char *strpbrk(const char *, const char *);
extern char *strrchr(const char *, int);
extern size_t strspn(const char *, const char *);
extern char *strstr(const char *, const char *);
extern char *strtok(char *, const char *);




extern void *memset(void *, int, size_t);
extern char *strerror(int);
extern size_t strlen(const char *);



extern void *memccpy(void *, const void *, int, size_t);




extern char *strsignal(int);
extern int ffs(int);
extern int strcasecmp(const char *, const char *);
extern int strncasecmp(const char *, const char *, size_t);





extern char *strdup(const char *);
# 51 "../progs/progs.priv.h" 2
# 1 "/home/raid2/zorzella/root/usr/local/gcc/lib/gcc-lib/sparc-sun-solaris2.7/3.1/include/sys/types.h" 1 3 4
# 25 "/home/raid2/zorzella/root/usr/local/gcc/lib/gcc-lib/sparc-sun-solaris2.7/3.1/include/sys/types.h" 3 4
#pragma ident "@(#)types.h	1.63	98/04/28 SMI"







# 1 "/usr/include/sys/machtypes.h" 1 3 4
# 16 "/usr/include/sys/machtypes.h" 3 4
#pragma ident "@(#)machtypes.h	1.12	96/08/01 SMI"
# 33 "/usr/include/sys/machtypes.h" 3 4
typedef struct _physadr_t { int r[1]; } *physadr_t;

typedef struct _label_t { long val[2]; } label_t;



typedef unsigned char lock_t;
# 34 "/home/raid2/zorzella/root/usr/local/gcc/lib/gcc-lib/sparc-sun-solaris2.7/3.1/include/sys/types.h" 2 3 4
# 45 "/home/raid2/zorzella/root/usr/local/gcc/lib/gcc-lib/sparc-sun-solaris2.7/3.1/include/sys/types.h" 3 4
# 1 "/usr/include/sys/int_types.h" 1 3 4
# 9 "/usr/include/sys/int_types.h" 3 4
#pragma ident "@(#)int_types.h	1.6	97/08/20 SMI"
# 62 "/usr/include/sys/int_types.h" 3 4
typedef char int8_t;





typedef short int16_t;
typedef int int32_t;




typedef long long int64_t;



typedef unsigned char uint8_t;
typedef unsigned short uint16_t;
typedef unsigned int uint32_t;




typedef unsigned long long uint64_t;
# 94 "/usr/include/sys/int_types.h" 3 4
typedef int64_t intmax_t;
typedef uint64_t uintmax_t;
# 110 "/usr/include/sys/int_types.h" 3 4
typedef int intptr_t;
typedef unsigned int uintptr_t;







typedef char int_least8_t;





typedef short int_least16_t;
typedef int int_least32_t;




typedef long long int_least64_t;



typedef unsigned char uint_least8_t;
typedef unsigned short uint_least16_t;
typedef unsigned int uint_least32_t;




typedef unsigned long long uint_least64_t;
# 46 "/home/raid2/zorzella/root/usr/local/gcc/lib/gcc-lib/sparc-sun-solaris2.7/3.1/include/sys/types.h" 2 3 4
# 62 "/home/raid2/zorzella/root/usr/local/gcc/lib/gcc-lib/sparc-sun-solaris2.7/3.1/include/sys/types.h" 3 4
typedef long long longlong_t;
typedef unsigned long long u_longlong_t;
# 85 "/home/raid2/zorzella/root/usr/local/gcc/lib/gcc-lib/sparc-sun-solaris2.7/3.1/include/sys/types.h" 3 4
typedef long t_scalar_t;
typedef unsigned long t_uscalar_t;





typedef unsigned char uchar_t;
typedef unsigned short ushort_t;
typedef unsigned int uint_t;
typedef unsigned long ulong_t;

typedef char *caddr_t;
typedef long daddr_t;
typedef short cnt_t;


typedef ulong_t paddr_t;
# 116 "/home/raid2/zorzella/root/usr/local/gcc/lib/gcc-lib/sparc-sun-solaris2.7/3.1/include/sys/types.h" 3 4
typedef int ptrdiff_t;
# 125 "/home/raid2/zorzella/root/usr/local/gcc/lib/gcc-lib/sparc-sun-solaris2.7/3.1/include/sys/types.h" 3 4
typedef ulong_t pfn_t;
typedef ulong_t pgcnt_t;
typedef long spgcnt_t;

typedef uchar_t use_t;
typedef short sysid_t;
typedef short index_t;
typedef void *timeout_id_t;
typedef void *bufcall_id_t;
# 147 "/home/raid2/zorzella/root/usr/local/gcc/lib/gcc-lib/sparc-sun-solaris2.7/3.1/include/sys/types.h" 3 4
typedef long off_t;
# 156 "/home/raid2/zorzella/root/usr/local/gcc/lib/gcc-lib/sparc-sun-solaris2.7/3.1/include/sys/types.h" 3 4
typedef longlong_t off64_t;






typedef ulong_t ino_t;
typedef long blkcnt_t;
typedef ulong_t fsblkcnt_t;
typedef ulong_t fsfilcnt_t;
# 181 "/home/raid2/zorzella/root/usr/local/gcc/lib/gcc-lib/sparc-sun-solaris2.7/3.1/include/sys/types.h" 3 4
typedef u_longlong_t ino64_t;
typedef longlong_t blkcnt64_t;
typedef u_longlong_t fsblkcnt64_t;
typedef u_longlong_t fsfilcnt64_t;






typedef long blksize_t;





typedef enum { B_FALSE, B_TRUE } boolean_t;
# 208 "/home/raid2/zorzella/root/usr/local/gcc/lib/gcc-lib/sparc-sun-solaris2.7/3.1/include/sys/types.h" 3 4
typedef int64_t pad64_t;
typedef uint64_t upad64_t;
# 221 "/home/raid2/zorzella/root/usr/local/gcc/lib/gcc-lib/sparc-sun-solaris2.7/3.1/include/sys/types.h" 3 4
typedef longlong_t offset_t;
typedef u_longlong_t u_offset_t;
typedef u_longlong_t len_t;
typedef longlong_t diskaddr_t;
# 242 "/home/raid2/zorzella/root/usr/local/gcc/lib/gcc-lib/sparc-sun-solaris2.7/3.1/include/sys/types.h" 3 4
typedef union {
        offset_t _f;
        struct {
                int32_t _u;
                int32_t _l;
        } _p;
} lloff_t;
# 262 "/home/raid2/zorzella/root/usr/local/gcc/lib/gcc-lib/sparc-sun-solaris2.7/3.1/include/sys/types.h" 3 4
typedef union {
        diskaddr_t _f;
        struct {
                int32_t _u;
                int32_t _l;
        } _p;
} lldaddr_t;


typedef uint_t k_fltset_t;
# 287 "/home/raid2/zorzella/root/usr/local/gcc/lib/gcc-lib/sparc-sun-solaris2.7/3.1/include/sys/types.h" 3 4
typedef long id_t;






typedef uint_t useconds_t;



typedef long suseconds_t;
# 308 "/home/raid2/zorzella/root/usr/local/gcc/lib/gcc-lib/sparc-sun-solaris2.7/3.1/include/sys/types.h" 3 4
typedef ulong_t major_t;
typedef ulong_t minor_t;





typedef short pri_t;
# 328 "/home/raid2/zorzella/root/usr/local/gcc/lib/gcc-lib/sparc-sun-solaris2.7/3.1/include/sys/types.h" 3 4
typedef ushort_t o_mode_t;
typedef short o_dev_t;
typedef ushort_t o_uid_t;
typedef o_uid_t o_gid_t;
typedef short o_nlink_t;
typedef short o_pid_t;
typedef ushort_t o_ino_t;





typedef int key_t;



typedef ulong_t mode_t;
# 356 "/home/raid2/zorzella/root/usr/local/gcc/lib/gcc-lib/sparc-sun-solaris2.7/3.1/include/sys/types.h" 3 4
typedef uid_t gid_t;






typedef unsigned int pthread_t;
typedef unsigned int pthread_key_t;

typedef struct _pthread_mutex {
        struct {
                uint8_t __pthread_mutex_flag[4];
                uint32_t __pthread_mutex_type;
        } __pthread_mutex_flags;
        union {
                struct {
                        uint8_t __pthread_mutex_pad[8];
                } __pthread_mutex_lock64;
                upad64_t __pthread_mutex_owner64;
        } __pthread_mutex_lock;
        upad64_t __pthread_mutex_data;
} pthread_mutex_t;

typedef struct _pthread_cond {
        struct {
                uint8_t __pthread_cond_flag[4];
                uint32_t __pthread_cond_type;
        } __pthread_cond_flags;
        upad64_t __pthread_cond_data;
} pthread_cond_t;




typedef struct _pthread_rwlock {
        int32_t __pthread_rwlock_readers;
        uint16_t __pthread_rwlock_type;
        uint16_t __pthread_rwlock_magic;
        upad64_t __pthread_rwlock_pad1[3];
        upad64_t __pthread_rwlock_pad2[2];
        upad64_t __pthread_rwlock_pad3[2];
} pthread_rwlock_t;




typedef struct _pthread_attr {
        void *__pthread_attrp;
} pthread_attr_t;





typedef struct _pthread_mutexattr {
        void *__pthread_mutexattrp;
} pthread_mutexattr_t;





typedef struct _pthread_condattr {
        void *__pthread_condattrp;
} pthread_condattr_t;




typedef struct _once {
        upad64_t __pthread_once_pad[4];
} pthread_once_t;





typedef struct _pthread_rwlockattr {
        void *__pthread_rwlockattrp;
} pthread_rwlockattr_t;

typedef ulong_t dev_t;





typedef ulong_t nlink_t;
typedef long pid_t;
# 470 "/home/raid2/zorzella/root/usr/local/gcc/lib/gcc-lib/sparc-sun-solaris2.7/3.1/include/sys/types.h" 3 4
typedef int ssize_t;





typedef long time_t;




typedef long clock_t;




typedef int clockid_t;




typedef int timer_t;






typedef unsigned char unchar;
typedef unsigned short ushort;
typedef unsigned int uint;
typedef unsigned long ulong;
# 552 "/home/raid2/zorzella/root/usr/local/gcc/lib/gcc-lib/sparc-sun-solaris2.7/3.1/include/sys/types.h" 3 4
typedef unsigned char u_char;
typedef unsigned short u_short;
typedef unsigned int u_int;
typedef unsigned long u_long;
typedef struct _quad { int val[2]; } quad_t;
typedef quad_t quad;






# 1 "/usr/include/sys/select.h" 1 3 4
# 12 "/usr/include/sys/select.h" 3 4
#pragma ident "@(#)select.h	1.16	98/04/27 SMI" 




# 1 "/usr/include/sys/time.h" 1 3 4
# 22 "/usr/include/sys/time.h" 3 4
#pragma ident "@(#)time.h	2.62	98/02/04 SMI" 
# 49 "/usr/include/sys/time.h" 3 4
struct timeval {
        time_t tv_sec;
        suseconds_t tv_usec;
};
# 82 "/usr/include/sys/time.h" 3 4
struct timezone {
        int tz_minuteswest;
        int tz_dsttime;
};
# 100 "/usr/include/sys/time.h" 3 4
# 1 "/home/raid2/zorzella/root/usr/local/gcc/lib/gcc-lib/sparc-sun-solaris2.7/3.1/include/sys/types.h" 1 3 4
# 101 "/usr/include/sys/time.h" 2 3 4
# 155 "/usr/include/sys/time.h" 3 4
struct itimerval {
        struct timeval it_interval;
        struct timeval it_value;
};
# 203 "/usr/include/sys/time.h" 3 4
typedef longlong_t hrtime_t;
# 315 "/usr/include/sys/time.h" 3 4
int adjtime(struct timeval *, struct timeval *);
# 326 "/usr/include/sys/time.h" 3 4
int getitimer(int, struct itimerval *);
int utimes(const char *, const struct timeval *);



int setitimer(int, struct itimerval *, struct itimerval *);
# 364 "/usr/include/sys/time.h" 3 4
int settimeofday(struct timeval *, void *);

hrtime_t gethrtime(void);
hrtime_t gethrvtime(void);
# 384 "/usr/include/sys/time.h" 3 4
int gettimeofday(struct timeval *, void *);
# 405 "/usr/include/sys/time.h" 3 4
# 1 "/usr/include/time.h" 1 3 4
# 16 "/usr/include/time.h" 3 4
#pragma ident "@(#)time.h	1.36	98/03/27 SMI" 
# 64 "/usr/include/time.h" 3 4
struct tm {
        int tm_sec;
        int tm_min;
        int tm_hour;
        int tm_mday;
        int tm_mon;
        int tm_year;
        int tm_wday;
        int tm_yday;
        int tm_isdst;
};



extern clock_t clock(void);
extern double difftime(time_t, time_t);
extern time_t mktime(struct tm *);
extern time_t time(time_t *);
extern char *asctime(const struct tm *);
extern char *ctime(const time_t *);
extern struct tm *gmtime(const time_t *);
extern struct tm *localtime(const time_t *);
extern size_t strftime(char *, size_t, const char *, const struct tm *);
# 97 "/usr/include/time.h" 3 4
extern char *strptime(const char *, const char *, struct tm *);





# 1 "/usr/include/sys/time_impl.h" 1 3 4
# 15 "/usr/include/sys/time_impl.h" 3 4
#pragma ident "@(#)time_impl.h	1.3	98/02/13 SMI"
# 36 "/usr/include/sys/time_impl.h" 3 4
typedef struct timespec {
        time_t tv_sec;
        long tv_nsec;
} timespec_t;
# 60 "/usr/include/sys/time_impl.h" 3 4
typedef struct timespec timestruc_t;
# 79 "/usr/include/sys/time_impl.h" 3 4
typedef struct itimerspec {
        struct timespec it_interval;
        struct timespec it_value;
} itimerspec_t;
# 104 "/usr/include/time.h" 2 3 4
# 118 "/usr/include/time.h" 3 4
union sigval {
        int sival_int;
        void *sival_ptr;
};




struct sigevent {
        int sigev_notify;
        int sigev_signo;
        union sigval sigev_value;
        void (*sigev_notify_function)(union sigval);
        pthread_attr_t *sigev_notify_attributes;
        int __sigev_pad2;
};


extern int clock_getres(clockid_t, struct timespec *);
extern int clock_gettime(clockid_t, struct timespec *);
extern int clock_settime(clockid_t, const struct timespec *);
extern int timer_create(clockid_t, struct sigevent *, timer_t *);
extern int timer_delete(timer_t);
extern int timer_getoverrun(timer_t);
extern int timer_gettime(timer_t, struct itimerspec *);
extern int timer_settime(timer_t, int, const struct itimerspec *,
                struct itimerspec *);
extern int nanosleep(const struct timespec *, struct timespec *);




extern void tzset(void);

extern char *tzname[2];


extern long _sysconf(int);






extern long timezone;
extern int daylight;





extern int cftime(char *, char *, const time_t *);
extern int ascftime(char *, const char *, const struct tm *);
extern long altzone;




extern struct tm *getdate(const char *);






extern int getdate_err;
# 406 "/usr/include/sys/time.h" 2 3 4
# 418 "/usr/include/sys/time.h" 3 4
# 1 "/usr/include/sys/select.h" 1 3 4
# 419 "/usr/include/sys/time.h" 2 3 4
# 18 "/usr/include/sys/select.h" 2 3 4
# 45 "/usr/include/sys/select.h" 3 4
typedef long fd_mask;

typedef long fds_mask;
# 73 "/usr/include/sys/select.h" 3 4
typedef struct fd_set {



        long fds_bits[(((1024)+(((sizeof (fds_mask) * 8))-1))/((sizeof (fds_mask) * 8)))];
} fd_set;
# 97 "/usr/include/sys/select.h" 3 4
extern int select(int, fd_set *, fd_set *, fd_set *, struct timeval *);
# 565 "/home/raid2/zorzella/root/usr/local/gcc/lib/gcc-lib/sparc-sun-solaris2.7/3.1/include/sys/types.h" 2 3 4
# 52 "../progs/progs.priv.h" 2


# 1 "/home/raid2/zorzella/root/usr/local/gcc/lib/gcc-lib/sparc-sun-solaris2.7/3.1/include/unistd.h" 1 3 4
# 25 "/home/raid2/zorzella/root/usr/local/gcc/lib/gcc-lib/sparc-sun-solaris2.7/3.1/include/unistd.h" 3 4
#pragma ident "@(#)unistd.h	1.55	98/04/14 SMI" 




# 1 "/usr/include/sys/unistd.h" 1 3 4
# 25 "/usr/include/sys/unistd.h" 3 4
#pragma ident "@(#)unistd.h	1.36	98/07/16 SMI" 
# 31 "/home/raid2/zorzella/root/usr/local/gcc/lib/gcc-lib/sparc-sun-solaris2.7/3.1/include/unistd.h" 2 3 4
# 209 "/home/raid2/zorzella/root/usr/local/gcc/lib/gcc-lib/sparc-sun-solaris2.7/3.1/include/unistd.h" 3 4
extern int access(const char *, int);


extern int acct(const char *);

extern unsigned alarm(unsigned);


extern int brk(void *);

extern int chdir(const char *);
extern int chown(const char *, uid_t, gid_t);


extern int chroot(const char *);

extern int close(int);







extern char *ctermid(char *);




extern char *cuserid(char *);
extern int dup(int);
extern int dup2(int, int);




extern int execl(const char *, const char *, ...);
extern int execle(const char *, const char *, ...);
extern int execlp(const char *, const char *, ...);
extern int execv(const char *, char *const *);
extern int execve(const char *, char *const *, char *const *);
extern int execvp(const char *, char *const *);
extern void _exit(int);







extern int fattach(int, const char *);



extern int fchdir(int);
extern int fchown(int, uid_t, gid_t);



extern int fchroot(int);



extern int fdatasync(int);
# 281 "/home/raid2/zorzella/root/usr/local/gcc/lib/gcc-lib/sparc-sun-solaris2.7/3.1/include/unistd.h" 3 4
extern int fdetach(const char *);

extern pid_t fork(void);


extern pid_t fork1(void);

extern long fpathconf(int, int);


extern int fsync(int);



extern int ftruncate(int, off_t);

extern char *getcwd(char *, size_t);


extern int getdtablesize(void);

extern gid_t getegid(void);
extern uid_t geteuid(void);
extern gid_t getgid(void);
extern int getgroups(int, gid_t *);


extern long gethostid(void);





extern int gethostname(char *, int);

extern char *getlogin(void);
# 326 "/home/raid2/zorzella/root/usr/local/gcc/lib/gcc-lib/sparc-sun-solaris2.7/3.1/include/unistd.h" 3 4
extern int getpagesize(void);
extern pid_t getpgid(pid_t);

extern pid_t getpid(void);
extern pid_t getppid(void);
extern pid_t getpgrp(void);


char *gettxt(const char *, const char *);



extern pid_t getsid(pid_t);

extern uid_t getuid(void);


extern char *getwd(char *);
# 352 "/home/raid2/zorzella/root/usr/local/gcc/lib/gcc-lib/sparc-sun-solaris2.7/3.1/include/unistd.h" 3 4
extern int ioctl(int, int, ...);



extern int isaexec(const char *, char *const *, char *const *);

extern int isatty(int);
extern int link(const char *, const char *);


extern int lchown(const char *, uid_t, gid_t);
extern int lockf(int, int, off_t);
extern int readlink(const char *, char *, size_t);

extern off_t lseek(int, off_t, int);


extern int nice(int);

extern long pathconf(const char *, int);
extern int pause(void);
extern int pipe(int *);


extern offset_t llseek(int, offset_t, int);
extern off_t tell(int);
extern int mincore(caddr_t, size_t, char *);



extern ssize_t pread(int, void *, size_t, off_t);



extern void profil(unsigned short *, size_t, unsigned long, unsigned int);



extern int pthread_atfork(void (*) (void), void (*) (void), void (*) (void));



extern long ptrace(int, pid_t, long, long);



extern ssize_t pwrite(int, const void *, size_t, off_t);

extern ssize_t read(int, void *, size_t);


extern int rename(const char *, const char *);



extern int resolvepath(const char *, char *, size_t);

extern int rmdir(const char *);


extern void *sbrk(intptr_t);

extern int setgid(gid_t);


extern int setegid(gid_t);



extern int setgroups(int, const gid_t *);

extern int setpgid(pid_t, pid_t);


extern pid_t setpgrp(void);
extern int setregid(gid_t, gid_t);
extern int setreuid(uid_t, uid_t);

extern pid_t setsid(void);
extern int setuid(uid_t);


extern int seteuid(uid_t);

extern unsigned sleep(unsigned);


extern int stime(const time_t *);







extern int symlink(const char *, const char *);
extern void sync(void);

extern long sysconf(int);
# 459 "/home/raid2/zorzella/root/usr/local/gcc/lib/gcc-lib/sparc-sun-solaris2.7/3.1/include/unistd.h" 3 4
extern pid_t tcgetpgrp(int);
extern int tcsetpgrp(int, pid_t);


extern off_t tell(int);



extern int truncate(const char *, off_t);

extern char *ttyname(int);


extern useconds_t ualarm(useconds_t, useconds_t);

extern int unlink(const char *);


extern int usleep(useconds_t);



extern pid_t vfork(void);



extern void vhangup(void);

extern ssize_t write(int, const void *, size_t);


extern void yield(void);







extern int ftruncate64(int, off64_t);

extern off64_t lseek64(int, off64_t, int);


extern ssize_t pread64(int, void *, size_t, off64_t);
extern ssize_t pwrite64(int, const void *, size_t, off64_t);
extern off64_t tell64(int);
extern int truncate64(const char *, off64_t);
extern int lockf64(int, int, off64_t);
# 808 "/home/raid2/zorzella/root/usr/local/gcc/lib/gcc-lib/sparc-sun-solaris2.7/3.1/include/unistd.h" 3 4
#pragma unknown_control_flow(vfork)
# 55 "../progs/progs.priv.h" 2
# 66 "../progs/progs.priv.h"
# 1 "/home/raid2/zorzella/root/usr/local/gcc/lib/gcc-lib/sparc-sun-solaris2.7/3.1/include/limits.h" 1 3 4
# 11 "/home/raid2/zorzella/root/usr/local/gcc/lib/gcc-lib/sparc-sun-solaris2.7/3.1/include/limits.h" 3 4
# 1 "/home/raid2/zorzella/root/usr/local/gcc/lib/gcc-lib/sparc-sun-solaris2.7/3.1/include/syslimits.h" 1 3 4
# 25 "/home/raid2/zorzella/root/usr/local/gcc/lib/gcc-lib/sparc-sun-solaris2.7/3.1/include/syslimits.h" 3 4
#pragma ident "@(#)limits.h	1.48	98/07/20 SMI" 
# 40 "/home/raid2/zorzella/root/usr/local/gcc/lib/gcc-lib/sparc-sun-solaris2.7/3.1/include/syslimits.h" 3 4
# 1 "/usr/include/sys/int_limits.h" 1 3 4
# 9 "/usr/include/sys/int_limits.h" 3 4
#pragma ident "@(#)int_limits.h	1.5	98/01/06 SMI"
# 41 "/home/raid2/zorzella/root/usr/local/gcc/lib/gcc-lib/sparc-sun-solaris2.7/3.1/include/syslimits.h" 2 3 4
# 12 "/home/raid2/zorzella/root/usr/local/gcc/lib/gcc-lib/sparc-sun-solaris2.7/3.1/include/limits.h" 2 3 4
# 67 "../progs/progs.priv.h" 2





# 1 "/usr/include/dirent.h" 1 3 4
# 16 "/usr/include/dirent.h" 3 4
#pragma ident "@(#)dirent.h	1.28	97/04/19 SMI" 




# 1 "/usr/include/sys/dirent.h" 1 3 4
# 16 "/usr/include/sys/dirent.h" 3 4
#pragma ident "@(#)dirent.h	1.31	97/04/19 SMI" 
# 28 "/usr/include/sys/dirent.h" 3 4
typedef struct dirent {
        ino_t d_ino;
        off_t d_off;
        unsigned short d_reclen;
        char d_name[1];
} dirent_t;
# 54 "/usr/include/sys/dirent.h" 3 4
typedef struct dirent64 {
        ino64_t d_ino;
        off64_t d_off;
        unsigned short d_reclen;
        char d_name[1];
} dirent64_t;
# 99 "/usr/include/sys/dirent.h" 3 4
extern int getdents(int, struct dirent *, size_t);
# 22 "/usr/include/dirent.h" 2 3 4
# 37 "/usr/include/dirent.h" 3 4
typedef struct {
        int dd_fd;
        int dd_loc;
        int dd_size;
        char *dd_buf;
} DIR;
# 76 "/usr/include/dirent.h" 3 4
extern DIR *opendir(const char *);
extern struct dirent *readdir(DIR *);


extern long telldir(DIR *);
extern void seekdir(DIR *, long);

extern void rewinddir(DIR *);
extern int closedir(DIR *);




extern struct dirent64 *readdir64(DIR *);
# 73 "../progs/progs.priv.h" 2
# 88 "../progs/progs.priv.h"
# 1 "/usr/include/errno.h" 1 3 4
# 11 "/usr/include/errno.h" 3 4
#pragma ident "@(#)errno.h	1.15	98/03/02 SMI" 





# 1 "/usr/include/sys/errno.h" 1 3 4
# 11 "/usr/include/sys/errno.h" 3 4
#pragma ident "@(#)errno.h	1.19	98/01/14 SMI" 
# 18 "/usr/include/errno.h" 2 3 4
# 35 "/usr/include/errno.h" 3 4
extern int errno;
# 89 "../progs/progs.priv.h" 2
# 100 "../progs/progs.priv.h"
extern char *optarg;
extern int optind;


# 1 "../include/curses.h" 1
# 74 "../include/curses.h"
typedef unsigned long chtype;

# 1 "/home/raid2/zorzella/root/usr/local/gcc/lib/gcc-lib/sparc-sun-solaris2.7/3.1/include/stdio.h" 1 3 4
# 14 "/home/raid2/zorzella/root/usr/local/gcc/lib/gcc-lib/sparc-sun-solaris2.7/3.1/include/stdio.h" 3 4
# 1 "/home/raid2/zorzella/root/usr/local/gcc/lib/gcc-lib/sparc-sun-solaris2.7/3.1/include/stdarg.h" 1 3 4
# 43 "/home/raid2/zorzella/root/usr/local/gcc/lib/gcc-lib/sparc-sun-solaris2.7/3.1/include/stdarg.h" 3 4
typedef __builtin_va_list __gnuc_va_list;
# 15 "/home/raid2/zorzella/root/usr/local/gcc/lib/gcc-lib/sparc-sun-solaris2.7/3.1/include/stdio.h" 2 3 4
# 34 "/home/raid2/zorzella/root/usr/local/gcc/lib/gcc-lib/sparc-sun-solaris2.7/3.1/include/stdio.h" 3 4
#pragma ident "@(#)stdio.h	1.69	98/07/13 SMI" 


# 1 "/usr/include/sys/va_list.h" 1 3 4
# 9 "/usr/include/sys/va_list.h" 3 4
#pragma ident "@(#)va_list.h	1.11	97/11/22 SMI"
# 26 "/usr/include/sys/va_list.h" 3 4
typedef void *__va_list;
# 38 "/home/raid2/zorzella/root/usr/local/gcc/lib/gcc-lib/sparc-sun-solaris2.7/3.1/include/stdio.h" 2 3 4
# 1 "/home/raid2/zorzella/root/usr/local/gcc/lib/gcc-lib/sparc-sun-solaris2.7/3.1/include/stdio_tag.h" 1 3 4
# 18 "/home/raid2/zorzella/root/usr/local/gcc/lib/gcc-lib/sparc-sun-solaris2.7/3.1/include/stdio_tag.h" 3 4
#pragma ident "@(#)stdio_tag.h	1.3	98/04/20 SMI"
# 30 "/home/raid2/zorzella/root/usr/local/gcc/lib/gcc-lib/sparc-sun-solaris2.7/3.1/include/stdio_tag.h" 3 4
typedef struct __FILE __FILE;
# 39 "/home/raid2/zorzella/root/usr/local/gcc/lib/gcc-lib/sparc-sun-solaris2.7/3.1/include/stdio.h" 2 3 4
# 1 "/usr/include/stdio_impl.h" 1 3 4
# 9 "/usr/include/stdio_impl.h" 3 4
#pragma ident "@(#)stdio_impl.h	1.8	99/06/30 SMI"
# 38 "/usr/include/stdio_impl.h" 3 4
struct __FILE
{




        ssize_t _cnt;
        unsigned char *_ptr;

        unsigned char *_base;
        unsigned char _flag;
        unsigned char _file;
        unsigned __orientation:2;
        unsigned __ionolock:1;
        unsigned __filler:5;
};
# 40 "/home/raid2/zorzella/root/usr/local/gcc/lib/gcc-lib/sparc-sun-solaris2.7/3.1/include/stdio.h" 2 3 4
# 55 "/home/raid2/zorzella/root/usr/local/gcc/lib/gcc-lib/sparc-sun-solaris2.7/3.1/include/stdio.h" 3 4
typedef __FILE FILE;
# 74 "/home/raid2/zorzella/root/usr/local/gcc/lib/gcc-lib/sparc-sun-solaris2.7/3.1/include/stdio.h" 3 4
typedef long long __longlong_t;
# 103 "/home/raid2/zorzella/root/usr/local/gcc/lib/gcc-lib/sparc-sun-solaris2.7/3.1/include/stdio.h" 3 4
typedef long fpos_t;







typedef __longlong_t fpos64_t;
# 203 "/home/raid2/zorzella/root/usr/local/gcc/lib/gcc-lib/sparc-sun-solaris2.7/3.1/include/stdio.h" 3 4
extern FILE __iob[20];
# 215 "/home/raid2/zorzella/root/usr/local/gcc/lib/gcc-lib/sparc-sun-solaris2.7/3.1/include/stdio.h" 3 4
extern unsigned char _sibuf[], _sobuf[];
# 244 "/home/raid2/zorzella/root/usr/local/gcc/lib/gcc-lib/sparc-sun-solaris2.7/3.1/include/stdio.h" 3 4
extern unsigned char *_bufendtab[];
extern FILE *_lastbuf;
# 275 "/home/raid2/zorzella/root/usr/local/gcc/lib/gcc-lib/sparc-sun-solaris2.7/3.1/include/stdio.h" 3 4
extern int remove(const char *);
extern int rename(const char *, const char *);
extern FILE *tmpfile(void);
extern char *tmpnam(char *);



extern int fclose(FILE *);
extern int fflush(FILE *);
extern FILE *fopen(const char *, const char *);
extern FILE *freopen(const char *, const char *, FILE *);
extern void setbuf(FILE *, char *);


extern void setbuffer(FILE *, char *, size_t);
extern int setlinebuf(FILE *);

extern int setvbuf(FILE *, char *, int, size_t);

extern int fprintf(FILE *, const char *, ...);

extern int fscanf(FILE *, const char *, ...);

extern int printf(const char *, ...);

extern int scanf(const char *, ...);




extern int snprintf(char *, size_t, const char *, ...);


extern int sprintf(char *, const char *, ...);

extern int sscanf(const char *, const char *, ...);
extern int vfprintf(FILE *, const char *, __gnuc_va_list);
extern int vprintf(const char *, __gnuc_va_list);



extern int vsnprintf(char *, size_t, const char *, __gnuc_va_list);

extern int vsprintf(char *, const char *, __gnuc_va_list);
extern int fgetc(FILE *);
extern char *fgets(char *, int, FILE *);
extern int fputc(int, FILE *);
extern int fputs(const char *, FILE *);
extern int getc(FILE *);
extern int getchar(void);
extern char *gets(char *);
extern int putc(int, FILE *);
extern int putchar(int);
extern int puts(const char *);
extern int ungetc(int, FILE *);
extern size_t fread(void *, size_t, size_t, FILE *);
extern size_t fwrite(const void *, size_t, size_t, FILE *);
extern int fgetpos(FILE *, fpos_t *);
extern int fseek(FILE *, long, int);
extern int fsetpos(FILE *, const fpos_t *);
extern long ftell(FILE *);
extern void rewind(FILE *);
extern void clearerr(FILE *);
extern int feof(FILE *);
extern int ferror(FILE *);
extern void perror(const char *);


extern int __filbuf(FILE *);
extern int __flsbuf(int, FILE *);
# 353 "/home/raid2/zorzella/root/usr/local/gcc/lib/gcc-lib/sparc-sun-solaris2.7/3.1/include/stdio.h" 3 4
extern FILE *fdopen(int, const char *);
extern char *ctermid(char *);
extern int fileno(FILE *);
# 379 "/home/raid2/zorzella/root/usr/local/gcc/lib/gcc-lib/sparc-sun-solaris2.7/3.1/include/stdio.h" 3 4
extern FILE *popen(const char *, const char *);
extern char *cuserid(char *);
extern char *tempnam(const char *, const char *);
extern int getopt(int, char *const *, const char *);

extern int getsubopt(char **, char *const *, char **);

extern char *optarg;
extern int optind, opterr, optopt;
extern int getw(FILE *);
extern int putw(int, FILE *);
extern int pclose(FILE *);







extern int fseeko(FILE *, off_t, int);
extern off_t ftello(FILE *);
# 408 "/home/raid2/zorzella/root/usr/local/gcc/lib/gcc-lib/sparc-sun-solaris2.7/3.1/include/stdio.h" 3 4
extern FILE *fopen64(const char *, const char *);
extern FILE *freopen64(const char *, const char *, FILE *);
extern FILE *tmpfile64(void);
extern int fgetpos64(FILE *, fpos64_t *);
extern int fsetpos64(FILE *, const fpos64_t *);
extern int fseeko64(FILE *, off64_t, int);
extern off64_t ftello64(FILE *);
# 77 "../include/curses.h" 2
# 1 "../include/unctrl.h" 1
# 54 "../include/unctrl.h"
# 1 "../include/curses.h" 1
# 55 "../include/unctrl.h" 2


extern char *unctrl(chtype);
# 78 "../include/curses.h" 2
# 1 "/home/raid2/zorzella/root/usr/local/gcc/lib/gcc-lib/sparc-sun-solaris2.7/3.1/include/stdarg.h" 1 3 4
# 90 "/home/raid2/zorzella/root/usr/local/gcc/lib/gcc-lib/sparc-sun-solaris2.7/3.1/include/stdarg.h" 3 4
typedef __gnuc_va_list va_list;
# 79 "../include/curses.h" 2
# 96 "../include/curses.h"
typedef unsigned bool;
# 126 "../include/curses.h"
extern int COLORS;
extern int COLOR_PAIRS;
# 140 "../include/curses.h"
extern chtype acs_map[];
# 229 "../include/curses.h"
typedef struct screen SCREEN;
typedef struct _win_st WINDOW;

typedef chtype attr_t;
# 251 "../include/curses.h"
struct ldat
{
        chtype *text;
        short firstchar;
        short lastchar;
        short oldindex;
};

struct _win_st
{
        short _cury, _curx;


        short _maxy, _maxx;
        short _begy, _begx;

        short _flags;


        attr_t _attrs;
        chtype _bkgd;


        bool _notimeout;
        bool _clear;
        bool _leaveok;
        bool _scroll;
        bool _idlok;
        bool _idcok;
        bool _immed;
        bool _sync;
        bool _use_keypad;
        int _delay;

        struct ldat *_line;


        short _regtop;
        short _regbottom;


        int _parx;
        int _pary;
        WINDOW *_parent;


        struct pdat
        {
            short _pad_y, _pad_x;
            short _pad_top, _pad_left;
            short _pad_bottom, _pad_right;
        } _pad;

        short _yoffset;
};

extern WINDOW *stdscr;
extern WINDOW *curscr;
extern WINDOW *newscr;

extern int LINES;
extern int COLS;
extern int TABSIZE;




extern int ESCDELAY;

extern char ttytype[];




extern char *keybound (int, int);
extern const char *curses_version (void);
extern int assume_default_colors (int, int);
extern int define_key (char *, int);
extern int keyok (int, bool);
extern int resizeterm (int, int);
extern int use_default_colors (void);
extern int use_extended_names (bool);
extern int wresize (WINDOW *, int, int);
# 387 "../include/curses.h"
extern int addch(const chtype);
extern int addchnstr(const chtype *, int);
extern int addchstr(const chtype *);
extern int addnstr(const char *, int);
extern int addstr(const char *);







extern int attroff(attr_t);
extern int attron(attr_t);
extern int attrset(attr_t);
extern int attr_get(attr_t *, short *, void *);
extern int attr_off(attr_t, void *);
extern int attr_on(attr_t, void *);
extern int attr_set(attr_t, short, void *);
extern int baudrate(void);
extern int beep(void);
extern int bkgd(chtype);
extern void bkgdset(chtype);




extern int border(chtype,chtype,chtype,chtype,chtype,chtype,chtype,chtype);



extern int box(WINDOW *, chtype, chtype);



extern bool can_change_color(void);
extern int cbreak(void);
extern int chgat(int, attr_t, short, const void *);
extern int clear(void);
extern int clearok(WINDOW *,bool);
extern int clrtobot(void);
extern int clrtoeol(void);
extern int color_content(short,short*,short*,short*);
extern int color_set(short,void*);
extern int COLOR_PAIR(int);
extern int copywin(const WINDOW*,WINDOW*,int,int,int,int,int,int,int);
extern int curs_set(int);
extern int def_prog_mode(void);
extern int def_shell_mode(void);
extern int delay_output(int);
extern int delch(void);
extern void delscreen(SCREEN *);
extern int delwin(WINDOW *);
extern int deleteln(void);
extern WINDOW *derwin(WINDOW *,int,int,int,int);
extern int doupdate(void);
extern WINDOW *dupwin(WINDOW *);
extern int echo(void);
extern int echochar(const chtype);
extern int erase(void);




extern int endwin(void);
extern char erasechar(void);
extern void filter(void);
extern int flash(void);
extern int flushinp(void);
extern chtype getbkgd(WINDOW *);




extern int getch(void);
extern int getnstr(char *, int);



extern int getstr(char *);



extern WINDOW *getwin(FILE *);



extern int halfdelay(int);
extern bool has_colors(void);
extern bool has_ic(void);
extern bool has_il(void);
extern int hline(chtype, int);



extern void idcok(WINDOW *, bool);
extern int idlok(WINDOW *, bool);
extern void immedok(WINDOW *, bool);
extern chtype inch(void);
extern int inchnstr(chtype *, int);
extern int inchstr(chtype *);
extern WINDOW *initscr(void);
extern int init_color(short,short,short,short);
extern int init_pair(short,short,short);
extern int innstr(char *, int);



extern int insch(chtype);
extern int insdelln(int);
extern int insertln(void);
extern int insnstr(const char *, int);
extern int insstr(const char *);
extern int instr(char *);





extern int intrflush(WINDOW *,bool);






extern bool isendwin(void);
extern bool is_linetouched(WINDOW *,int);
extern bool is_wintouched(WINDOW *);
extern char *keyname(int);



extern int keypad(WINDOW *,bool);
extern char killchar(void);



extern int leaveok(WINDOW *,bool);
extern char *longname(void);
extern int meta(WINDOW *,bool);
extern int move(int, int);
extern int mvaddch(int, int, const chtype);
extern int mvaddchnstr(int, int, const chtype *, int);
extern int mvaddchstr(int, int, const chtype *);
extern int mvaddnstr(int, int, const char *, int);
extern int mvaddstr(int, int, const char *);







extern int mvchgat(int, int, int, attr_t, short, const void *);
extern int mvcur(int,int,int,int);
extern int mvdelch(int, int);
extern int mvderwin(WINDOW *, int, int);
extern int mvgetch(int, int);
extern int mvgetnstr(int, int, char *, int);



extern int mvgetstr(int, int, char *);






extern int mvhline(int, int, chtype, int);



extern chtype mvinch(int, int);
extern int mvinchnstr(int, int, chtype *, int);
extern int mvinchstr(int, int, chtype *);
extern int mvinnstr(int, int, char *, int);



extern int mvinsch(int, int, chtype);
extern int mvinsnstr(int, int, const char *, int);
extern int mvinsstr(int, int, const char *);
extern int mvinstr(int, int, char *);
# 581 "../include/curses.h"
extern int mvprintw(int,int, char *,...)
                __attribute__((format(printf,3,4)));
extern int mvscanw(int,int, char *,...)
                __attribute__((format(scanf,3,4)));
extern int mvvline(int, int, chtype, int);



extern int mvwaddch(WINDOW *, int, int, const chtype);
extern int mvwaddchnstr(WINDOW *, int, int, const chtype *, int);
extern int mvwaddchstr(WINDOW *, int, int, const chtype *);
extern int mvwaddnstr(WINDOW *, int, int, const char *, int);
extern int mvwaddstr(WINDOW *, int, int, const char *);







extern int mvwchgat(WINDOW *, int, int, int, attr_t, short, const void *);
extern int mvwdelch(WINDOW *, int, int);
extern int mvwgetch(WINDOW *, int, int);
extern int mvwgetnstr(WINDOW *, int, int, char *, int);



extern int mvwgetstr(WINDOW *, int, int, char *);






extern int mvwhline(WINDOW *, int, int, chtype, int);



extern int mvwin(WINDOW *,int,int);
extern chtype mvwinch(WINDOW *, int, int);
extern int mvwinchnstr(WINDOW *, int, int, chtype *, int);
extern int mvwinchstr(WINDOW *, int, int, chtype *);
extern int mvwinnstr(WINDOW *, int, int, char *, int);



extern int mvwinsch(WINDOW *, int, int, chtype);
extern int mvwinsnstr(WINDOW *, int, int, const char *, int);
extern int mvwinsstr(WINDOW *, int, int, const char *);
extern int mvwinstr(WINDOW *, int, int, char *);
# 640 "../include/curses.h"
extern int mvwprintw(WINDOW*,int,int, char *,...)
                __attribute__((format(printf,4,5)));
extern int mvwscanw(WINDOW *,int,int, char *,...)
                __attribute__((format(scanf,4,5)));
extern int mvwvline(WINDOW *,int, int, chtype, int);



extern int napms(int);
extern WINDOW *newpad(int,int);
extern SCREEN *newterm( char *,FILE *,FILE *);
extern WINDOW *newwin(int,int,int,int);
extern int nl(void);
extern int nocbreak(void);
extern int nodelay(WINDOW *,bool);
extern int noecho(void);
extern int nonl(void);
extern void noqiflush(void);
extern int noraw(void);
extern int notimeout(WINDOW *,bool);
extern int overlay(const WINDOW*,WINDOW *);
extern int overwrite(const WINDOW*,WINDOW *);
extern int pair_content(short,short*,short*);
extern int PAIR_NUMBER(int);
extern int pechochar(WINDOW *, const chtype);



extern int pnoutrefresh(WINDOW*,int,int,int,int,int,int);
extern int prefresh(WINDOW *,int,int,int,int,int,int);
extern int printw( char *,...)
                __attribute__((format(printf,1,2)));
extern int putp(const char *);
extern int putwin(WINDOW *, FILE *);
extern void qiflush(void);
extern int raw(void);
extern int redrawwin(WINDOW *);
extern int refresh(void);
extern int resetty(void);
extern int reset_prog_mode(void);
extern int reset_shell_mode(void);
extern int ripoffline(int, int (*init)(WINDOW *, int));
extern int savetty(void);
extern int scanw( char *,...)
                __attribute__((format(scanf,1,2)));
extern int scr_dump(const char *);
extern int scr_init(const char *);
extern int scrl(int);
extern int scroll(WINDOW *);
extern int scrollok(WINDOW *,bool);
extern int scr_restore(const char *);
extern int scr_set(const char *);



extern int setscrreg(int,int);
extern SCREEN *set_term(SCREEN *);
extern int slk_attroff(const chtype);
extern int slk_attr_off(const attr_t, void *);
extern int slk_attron(const chtype);
extern int slk_attr_on(attr_t,void*);
extern int slk_attrset(const chtype);
extern attr_t slk_attr(void);
extern int slk_attr_set(const attr_t,short,void*);
extern int slk_clear(void);
extern int slk_color(short);
extern int slk_init(int);
extern char *slk_label(int);
extern int slk_noutrefresh(void);
extern int slk_refresh(void);
extern int slk_restore(void);
extern int slk_set(int,const char *,int);
extern int slk_touch(void);



extern int standout(void);
extern int standend(void);
extern int start_color(void);
extern WINDOW *subpad(WINDOW *, int, int, int, int);
extern WINDOW *subwin(WINDOW *,int,int,int,int);
extern int syncok(WINDOW *, bool);
extern chtype termattrs(void);
extern attr_t term_attrs(void);
extern char *termname(void);
extern int tigetflag( char *);
extern int tigetnum( char *);
extern char *tigetstr( char *);
extern void timeout(int);
extern int touchline(WINDOW *, int, int);
extern int touchwin(WINDOW *);
extern char *tparm( char *, ...);
extern int typeahead(int);
extern int ungetch(int);



extern int untouchwin(WINDOW *);
extern void use_env(bool);
extern int vidattr(chtype);
extern int vid_attr(attr_t, short, void *);
extern int vidputs(chtype, int (*)(int));



extern int vline(chtype, int);



extern int vwprintw(WINDOW *, char *,va_list);
extern int vw_printw(WINDOW *, char *,va_list);
extern int vwscanw(WINDOW *, char *,va_list);
extern int vw_scanw(WINDOW *, char *,va_list);
extern int waddch(WINDOW *, const chtype);
extern int waddchnstr(WINDOW *,const chtype *const,int);
extern int waddchstr(WINDOW *,const chtype *);
extern int waddnstr(WINDOW *,const char *const,int);
extern int waddstr(WINDOW *,const char *);







extern int wattron(WINDOW *, int);
extern int wattroff(WINDOW *, int);
extern int wattrset(WINDOW *, int);
extern int wattr_get(WINDOW *, attr_t *, short *, void *);
extern int wattr_on(WINDOW *, attr_t, void *);
extern int wattr_off(WINDOW *, attr_t, void *);
extern int wattr_set(WINDOW *, attr_t, short, void *);
extern int wbkgd(WINDOW *,const chtype);
extern void wbkgdset(WINDOW *,chtype);




extern int wborder(WINDOW *,chtype,chtype,chtype,chtype,chtype,chtype,chtype,chtype);



extern int wchgat(WINDOW *, int, attr_t, short, const void *);
extern int wclear(WINDOW *);
extern int wclrtobot(WINDOW *);
extern int wclrtoeol(WINDOW *);
extern int wcolor_set(WINDOW*,short,void*);
extern void wcursyncup(WINDOW *);
extern int wdelch(WINDOW *);
extern int wdeleteln(WINDOW *);
extern int wechochar(WINDOW *, const chtype);



extern int werase(WINDOW *);



extern int wgetch(WINDOW *);
extern int wgetnstr(WINDOW *,char *,int);



extern int wgetstr(WINDOW *, char *);




extern int whline(WINDOW *, chtype, int);



extern chtype winch(WINDOW *);
extern int winchnstr(WINDOW *, chtype *, int);
extern int winchstr(WINDOW *, chtype *);
extern int winnstr(WINDOW *, char *, int);



extern int winsch(WINDOW *, chtype);
extern int winsdelln(WINDOW *,int);
extern int winsertln(WINDOW *);
extern int winsnstr(WINDOW *, const char *,int);
extern int winsstr(WINDOW *, const char *);
extern int winstr(WINDOW *, char *);
# 834 "../include/curses.h"
extern int wmove(WINDOW *,int,int);
extern int wnoutrefresh(WINDOW *);
extern int wprintw(WINDOW *, char *,...)
                __attribute__((format(printf,2,3)));
extern int wredrawln(WINDOW *,int,int);
extern int wrefresh(WINDOW *);
extern int wscanw(WINDOW *, char *,...)
                __attribute__((format(scanf,2,3)));
extern int wscrl(WINDOW *,int);
extern int wsetscrreg(WINDOW *,int,int);
extern int wstandout(WINDOW *);
extern int wstandend(WINDOW *);
extern void wsyncdown(WINDOW *);
extern void wsyncup(WINDOW *);
extern void wtimeout(WINDOW *,int);
extern int wtouchln(WINDOW *,int,int,int);



extern int wvline(WINDOW *,chtype,int);




extern bool mouse_trafo(int*, int*, bool);
# 1294 "../include/curses.h"
typedef unsigned long mmask_t;

typedef struct
{
    short id;
    int x, y, z;
    mmask_t bstate;
}
MEVENT;

extern int getmouse(MEVENT *);
extern int ungetmouse(MEVENT *);
extern mmask_t mousemask(mmask_t, mmask_t *);
extern bool wenclose(const WINDOW *, int, int);
extern int mouseinterval(int);
extern bool wmouse_trafo(const WINDOW* win,int* y, int* x, bool to_screen);





extern int mcprint(char *, int);
extern int has_key(int);



extern void _tracef(const char *, ...) __attribute__((format(printf,1,2)));
extern void _tracedump(const char *, WINDOW *);
extern char *_traceattr(attr_t);
extern char *_traceattr2(int, chtype);
extern char *_nc_tracebits(void);
extern char *_tracechar(const unsigned char);
extern char *_tracechtype(chtype);
extern char *_tracechtype2(int, chtype);
extern char *_tracemouse(const MEVENT *);
extern void trace(const unsigned int);
# 105 "../progs/progs.priv.h" 2
# 1 "../include/term_entry.h" 1
# 47 "../include/term_entry.h"
# 1 "../include/term.h" 1
# 86 "../include/term.h"
# 1 "/usr/include/termios.h" 1 3 4
# 11 "/usr/include/termios.h" 3 4
#pragma ident "@(#)termios.h	1.6	92/07/14 SMI" 

# 1 "/usr/include/sys/termios.h" 1 3 4
# 16 "/usr/include/sys/termios.h" 3 4
#pragma ident "@(#)termios.h	1.38	98/02/20 SMI"





# 1 "/usr/include/sys/ttydev.h" 1 3 4
# 11 "/usr/include/sys/ttydev.h" 3 4
#pragma ident "@(#)ttydev.h	1.7	92/07/14 SMI" 
# 23 "/usr/include/sys/termios.h" 2 3 4
# 56 "/usr/include/sys/termios.h" 3 4
typedef unsigned int tcflag_t;
typedef unsigned char cc_t;
typedef unsigned int speed_t;




struct termios {
        tcflag_t c_iflag;
        tcflag_t c_oflag;
        tcflag_t c_cflag;
        tcflag_t c_lflag;
        cc_t c_cc[19];
};
# 80 "/usr/include/sys/termios.h" 3 4
extern speed_t cfgetospeed(const struct termios *);
extern int cfsetospeed(struct termios *, speed_t);
extern speed_t cfgetispeed(const struct termios *);
extern int cfsetispeed(struct termios *, speed_t);
extern int tcgetattr(int, struct termios *);
extern int tcsetattr(int, int, const struct termios *);
extern int tcsendbreak(int, int);
extern int tcdrain(int);
extern int tcflush(int, int);
extern int tcflow(int, int);
# 110 "/usr/include/sys/termios.h" 3 4
extern pid_t tcgetsid(int);
# 374 "/usr/include/sys/termios.h" 3 4
struct ppsclockev {
        struct timeval tv;
        uint_t serial;
};
# 556 "/usr/include/sys/termios.h" 3 4
struct winsize {
        unsigned short ws_row;
        unsigned short ws_col;
        unsigned short ws_xpixel;
        unsigned short ws_ypixel;
};
# 14 "/usr/include/termios.h" 2 3 4
# 87 "../include/term.h" 2
# 678 "../include/term.h"
typedef struct termtype {
    char *term_names;
    char *str_table;
    char *Booleans;
    short *Numbers;
    char **Strings;


    char *ext_str_table;
    char **ext_Names;

    unsigned short num_Booleans;
    unsigned short num_Numbers;
    unsigned short num_Strings;

    unsigned short ext_Booleans;
    unsigned short ext_Numbers;
    unsigned short ext_Strings;


} TERMTYPE;

typedef struct term {
    TERMTYPE type;
    short Filedes;
    struct termios Ottyb,
                Nttyb;
    int _baudrate;
} TERMINAL;

extern TERMINAL *cur_term;
# 733 "../include/term.h"
extern char *const boolnames[];
extern char *const boolcodes[];
extern char *const boolfnames[];
extern char *const numnames[];
extern char *const numcodes[];
extern char *const numfnames[];
extern char *const strnames[];
extern char *const strcodes[];
extern char *const strfnames[];




extern int _nc_set_tty_mode(struct termios *buf);
extern int _nc_get_tty_mode(struct termios *buf);
extern int _nc_read_entry(const char * const, char * const, TERMTYPE *const);
extern int _nc_read_file_entry(const char *const, TERMTYPE *);
extern char *_nc_first_name(const char *const);
extern int _nc_name_match(const char *const, const char *const, const char *const);
extern int _nc_read_termcap_entry(const char *const, TERMTYPE *const);
extern const TERMTYPE *_nc_fallback(const char *);


extern TERMINAL *set_curterm(TERMINAL *);
extern int del_curterm(TERMINAL *);


extern int restartterm( char *, int, int *);
extern int setupterm( char *,int,int *);
# 775 "../include/term.h"
extern char *tgetstr( char *, char **);
extern char *tgoto(const char *, int, int);
extern int tgetent(char *, const char *);
extern int tgetflag( char *);
extern int tgetnum( char *);
extern int tputs(const char *, int, int (*)(int));
# 48 "../include/term_entry.h" 2




typedef struct entry {
        TERMTYPE tterm;
        int nuses;
        struct
        {
            char *name;
            struct entry *link;
            long line;
        }
        uses[32];
        int ncrosslinks;
        struct entry *crosslinks[16];
        long cstart, cend;
        long startline;
        struct entry *next;
        struct entry *last;
}
ENTRY;
# 93 "../include/term_entry.h"
extern ENTRY *_nc_head, *_nc_tail;
# 119 "../include/term_entry.h"
extern ENTRY *_nc_copy_entry(ENTRY *oldp);
extern char *_nc_save_str(const char *const);
extern void _nc_init_entry(TERMTYPE *const);
extern void _nc_merge_entry(TERMTYPE *const, TERMTYPE *const);
extern void _nc_wrap_entry(ENTRY *const);


extern void _nc_align_termtype(TERMTYPE *, TERMTYPE *);
extern void _nc_copy_termtype(TERMTYPE *, TERMTYPE *);


extern void _nc_free_termtype(TERMTYPE *);


extern void _nc_init_acs(void);



extern bool _nc_user_definable;
extern bool _nc_disable_period;

extern int _nc_parse_entry(ENTRY *, int, bool);
extern int _nc_capcmp(const char *, const char *);


extern void _nc_set_writedir(char *);
extern void _nc_write_entry(TERMTYPE *const);


extern void _nc_read_entry_source(FILE*, char*, int, bool, bool (*)(ENTRY*));
extern bool _nc_entry_match(char *, char *);
extern int _nc_resolve_uses(bool);
extern void _nc_free_entries(ENTRY *);
extern void (*_nc_check_termtype)(TERMTYPE *);


extern void _nc_trace_xnames(TERMTYPE *);
# 106 "../progs/progs.priv.h" 2
# 1 "../include/tic.h" 1
# 119 "../include/tic.h"
extern unsigned _nc_tracing;
extern void _nc_tracef(char *, ...) __attribute__((format(printf,1,2)));
extern const char *_nc_visbuf(const char *);
# 145 "../include/tic.h"
struct token
{
        char *tk_name;
        int tk_valnumber;
        char *tk_valstring;
};

extern struct token _nc_curr_token;




struct kn {
        const char *name;
        int code;
};

extern const struct kn _nc_key_names[];





struct tinfo_fkeys {
        unsigned offset;
        chtype code;
        };
# 180 "../include/tic.h"
extern struct tinfo_fkeys _nc_tinfo_fkeys[];
# 190 "../include/tic.h"
struct name_table_entry
{
        const char *nte_name;
        int nte_type;
        short nte_index;
        short nte_link;
};

struct alias
{
        const char *from;
        const char *to;
        const char *source;
};

extern const struct name_table_entry * const _nc_info_hash_table[];
extern const struct name_table_entry * const _nc_cap_hash_table[];

extern const struct alias _nc_capalias_table[];
extern const struct alias _nc_infoalias_table[];

extern const struct name_table_entry *_nc_get_table(bool);
extern const struct name_table_entry * const *_nc_get_hash_table(bool);
# 241 "../include/tic.h"
extern char *_nc_basename(char *);


struct name_table_entry const *_nc_find_entry(const char *,
                                    const struct name_table_entry *const *);
struct name_table_entry const *_nc_find_type_entry(const char *,
                                         int,
                                         const struct name_table_entry *);


extern int _nc_get_token(void);
extern void _nc_push_token(int);
extern void _nc_reset_input(FILE *, char *);
extern void _nc_panic_mode(char);
extern int _nc_curr_line;
extern int _nc_curr_col;
extern long _nc_curr_file_pos;
extern long _nc_comment_start, _nc_comment_end;
extern int _nc_syntax;
extern long _nc_start_line;




extern void _nc_set_source(const char *const name);
extern void _nc_get_type(char *name);
extern void _nc_set_type(const char *const name);
extern void _nc_syserr_abort(const char *const,...) __attribute__((format(printf,1,2))) __attribute__((noreturn));
extern void _nc_err_abort(const char *const,...) __attribute__((format(printf,1,2))) __attribute__((noreturn));
extern void _nc_warning(const char *const,...) __attribute__((format(printf,1,2)));
extern bool _nc_suppress_warnings;


extern char *_nc_tic_expand(const char *, bool, int);


extern char _nc_trans_string(char *, char *);


extern char *_nc_captoinfo(const char *, const char *, int const);
extern char *_nc_infotocap(const char *, const char *, int const);


extern int _nc_nulls_sent;


extern const char *_nc_progname;


extern const char *_nc_tic_dir(const char *);


extern int _nc_tic_written(void);
# 107 "../progs/progs.priv.h" 2
# 1 "../include/nc_alloc.h" 1
# 73 "../include/nc_alloc.h"
extern void *_nc_doalloc(void *, size_t);
# 108 "../progs/progs.priv.h" 2
# 40 "../progs/infocmp.c" 2


# 1 "../progs/dump_entry.h" 1
# 59 "../progs/dump_entry.h"
extern char *nametrans(const char *);
extern void dump_init(const char *, int, int, int, int, bool);
extern int fmt_entry(TERMTYPE *, int (*)(int, int), bool, bool, int);
extern int dump_entry(TERMTYPE *, bool, int, int (*)(int, int));
extern int dump_uses(const char *, bool);
extern void compare_entry(void (*)(int, int, const char *), TERMTYPE *, bool);
extern void repair_acsc(TERMTYPE * tp);
# 43 "../progs/infocmp.c" 2









const char *_nc_progname = "infocmp";

typedef char path[1024];
# 63 "../progs/infocmp.c"
static char *tname[32];
static ENTRY entries[32];
static int termcount;

static bool limited = 1;
static bool quiet = 0;
static const char *bool_sep = ":";
static const char *s_absent = "NULL";
static const char *s_cancel = "NULL";
static const char *tversion;
static int itrace;
static int mwidth = 60;
static int numbers = 0;
static int outform = 0;
static int sortmode;


static int compare;





static bool ignorepads;
# 103 "../progs/infocmp.c"
static char *
canonical_name(char *ptr, char *buf)

{
    char *bp;

    (void) strcpy(buf, ptr);
    if ((bp = strchr(buf, '|')) != 0)
        *bp = '\0';

    return (buf);
}







static int
capcmp(int idx, const char *s, const char *t)

{
    if (!((s) != (char *)-1 && (s) != (char *)0) && !((t) != (char *)-1 && (t) != (char *)0))
        return (s != t);
    else if (!((s) != (char *)-1 && (s) != (char *)0) || !((t) != (char *)-1 && (t) != (char *)0))
        return (1);

    if ((idx == 146) || !ignorepads)
        return (strcmp(s, t));
    else
        return (_nc_capcmp(s, t));
}

static int
use_predicate(int type, int idx)

{
    ENTRY *ep;

    switch (type) {
    case 0:
        {
            int is_set = 0;
# 159 "../progs/infocmp.c"
            for (ep = &entries[1]; ep < entries + termcount; ep++)
                if (ep->tterm.Booleans[idx] == 1) {
                    is_set = entries[0].tterm.Booleans[idx];
                    break;
                }
            if (is_set != entries[0].tterm.Booleans[idx])
                return (!is_set);
            else
                return (-1);
        }

    case 1:
        {
            int value = -1;






            for (ep = &entries[1]; ep < entries + termcount; ep++)
                if (((ep->tterm.Numbers[idx]) >= 0)) {
                    value = ep->tterm.Numbers[idx];
                    break;
                }

            if (value != entries[0].tterm.Numbers[idx])
                return (value != -1);
            else
                return (-1);
        }

    case 2:
        {
            char *termstr, *usestr = (char *)0;

            termstr = entries[0].tterm.Strings[idx];






            for (ep = &entries[1]; ep < entries + termcount; ep++)
                if (ep->tterm.Strings[idx]) {
                    usestr = ep->tterm.Strings[idx];
                    break;
                }

            if (usestr == (char *)0 && termstr == (char *)0)
                return (-1);
            else if (!usestr || !termstr || capcmp(idx, usestr, termstr))
                return (1);
            else
                return (-1);
        }
    }

    return (0);
}

static bool
useeq(ENTRY * e1, ENTRY * e2)

{
    int i, j;

    if (e1->nuses != e2->nuses)
        return (0);


    for (i = 0; i < e1->nuses; i++) {
        bool foundmatch = 0;


        for (j = 0; j < e2->nuses; j++)
            if (!strcmp(e1->uses[i].name, e2->uses[j].name)) {
                foundmatch = 1;
                break;
            }

        if (!foundmatch)
            return (0);
    }

    return (1);
}

static bool
entryeq(TERMTYPE * t1, TERMTYPE * t2)

{
    int i;

    for (i = 0; i < (t1)->num_Booleans; i++)
        if (t1->Booleans[i] != t2->Booleans[i])
            return (0);

    for (i = 0; i < (t1)->num_Numbers; i++)
        if (t1->Numbers[i] != t2->Numbers[i])
            return (0);

    for (i = 0; i < (t1)->num_Strings; i++)
        if (capcmp(i, t1->Strings[i], t2->Strings[i]))
            return (0);

    return (1);
}



static void
print_uses(ENTRY * ep, FILE * fp)

{
    int i;

    if (!ep->nuses)
        fputs("NULL", fp);
    else
        for (i = 0; i < ep->nuses; i++) {
            fputs(ep->uses[i].name, fp);
            if (i < ep->nuses - 1)
                fputs(" ", fp);
        }
}

static const char *
dump_boolean(int val)

{
    switch (val) {
    case -1:
        return (s_absent);
    case (char)(-2):
        return (s_cancel);
    case 0:
        return ("F");
    case 1:
        return ("T");
    default:
        return ("?");
    }
}

static void
dump_numeric(int val, char *buf)

{
    switch (val) {
    case -1:
        strcpy(buf, s_absent);
        break;
    case -2:
        strcpy(buf, s_cancel);
        break;
    default:
        sprintf(buf, "%d", val);
        break;
    }
}

static void
dump_string(char *val, char *buf)

{
    if (val == (char *)0)
        strcpy(buf, s_absent);
    else if (val == (char *)-1)
        strcpy(buf, s_cancel);
    else {
        sprintf(buf, "'%.*s'", 1024 - 3, _nc_tic_expand(val, outform==0, numbers));
    }
}

static void
compare_predicate(int type, int idx, const char *name)

{
    register ENTRY *e1 = &entries[0];
    register ENTRY *e2 = &entries[1];
    char buf1[1024], buf2[1024];
    int b1, b2;
    int n1, n2;
    char *s1, *s2;

    switch (type) {
    case 0:
        b1 = e1->tterm.Booleans[idx];
        b2 = e2->tterm.Booleans[idx];
        switch (compare) {
        case 1:
            if (!(b1 == -1 && b2 == -1) && b1 != b2)
                (void) printf("\t%s: %s%s%s.\n",
                              name,
                              dump_boolean(b1),
                              bool_sep,
                              dump_boolean(b2));
            break;

        case 2:
            if (b1 == b2 && b1 != -1)
                (void) printf("\t%s= %s.\n", name, dump_boolean(b1));
            break;

        case 3:
            if (b1 == -1 && b2 == -1)
                (void) printf("\t!%s.\n", name);
            break;
        }
        break;

    case 1:
        n1 = e1->tterm.Numbers[idx];
        n2 = e2->tterm.Numbers[idx];
        dump_numeric(n1, buf1);
        dump_numeric(n2, buf2);
        switch (compare) {
        case 1:
            if (!((n1 == -1 && n2 == -1)) && n1 != n2)
                (void) printf("\t%s: %s, %s.\n", name, buf1, buf2);
            break;

        case 2:
            if (n1 != -1 && n2 != -1 && n1 == n2)
                (void) printf("\t%s= %s.\n", name, buf1);
            break;

        case 3:
            if (n1 == -1 && n2 == -1)
                (void) printf("\t!%s.\n", name);
            break;
        }
        break;

    case 2:
        s1 = e1->tterm.Strings[idx];
        s2 = e2->tterm.Strings[idx];
        switch (compare) {
        case 1:
            if (capcmp(idx, s1, s2)) {
                dump_string(s1, buf1);
                dump_string(s2, buf2);
                if (strcmp(buf1, buf2))
                    (void) printf("\t%s: %s, %s.\n", name, buf1, buf2);
            }
            break;

        case 2:
            if (s1 && s2 && !capcmp(idx, s1, s2))
                (void) printf("\t%s= '%s'.\n", name, _nc_tic_expand(s1, outform==0, numbers));
            break;

        case 3:
            if (!s1 && !s2)
                (void) printf("\t!%s.\n", name);
            break;
        }
        break;

    case 3:

        switch (compare) {
        case 1:
            if (!useeq(e1, e2)) {
                (void) fputs("\tuse: ", (&__iob[1]));
                print_uses(e1, (&__iob[1]));
                fputs(", ", (&__iob[1]));
                print_uses(e2, (&__iob[1]));
                fputs(".\n", (&__iob[1]));
            }
            break;

        case 2:
            if (e1->nuses && e2->nuses && useeq(e1, e2)) {
                (void) fputs("\tuse: ", (&__iob[1]));
                print_uses(e1, (&__iob[1]));
                fputs(".\n", (&__iob[1]));
            }
            break;

        case 3:
            if (!e1->nuses && !e2->nuses)
                (void) printf("\t!use.\n");
            break;
        }
    }
}







typedef struct {
    const char *from;
    const char *to;
} assoc;

static const assoc std_caps[] =
{

    {"\033c", "RIS"},
    {"\0337", "SC"},
    {"\0338", "RC"},
    {"\033[r", "RSR"},
    {"\033[m", "SGR0"},
    {"\033[2J", "ED2"},


    {"\033(0", "ISO DEC G0"},
    {"\033(A", "ISO UK G0"},
    {"\033(B", "ISO US G0"},
    {"\033)0", "ISO DEC G1"},
    {"\033)A", "ISO UK G1"},
    {"\033)B", "ISO US G1"},


    {"\033=", "DECPAM"},
    {"\033>", "DECPNM"},
    {"\033<", "DECANSI"},

    {(char *) 0, (char *) 0}
};

static const assoc private_modes[] =

{
    {"1", "CKM"},
    {"2", "ANM"},
    {"3", "COLM"},
    {"4", "SCLM"},
    {"5", "SCNM"},
    {"6", "OM"},
    {"7", "AWM"},
    {"8", "ARM"},
    {(char *) 0, (char *) 0}
};

static const assoc ecma_highlights[] =

{
    {"0", "NORMAL"},
    {"1", "+BOLD"},
    {"2", "+DIM"},
    {"3", "+ITALIC"},
    {"4", "+UNDERLINE"},
    {"5", "+BLINK"},
    {"6", "+FASTBLINK"},
    {"7", "+REVERSE"},
    {"8", "+INVISIBLE"},
    {"9", "+DELETED"},
    {"10", "MAIN-FONT"},
    {"11", "ALT-FONT-1"},
    {"12", "ALT-FONT-2"},
    {"13", "ALT-FONT-3"},
    {"14", "ALT-FONT-4"},
    {"15", "ALT-FONT-5"},
    {"16", "ALT-FONT-6"},
    {"17", "ALT-FONT-7"},
    {"18", "ALT-FONT-1"},
    {"19", "ALT-FONT-1"},
    {"20", "FRAKTUR"},
    {"21", "DOUBLEUNDER"},
    {"22", "-DIM"},
    {"23", "-ITALIC"},
    {"24", "-UNDERLINE"},
    {"25", "-BLINK"},
    {"26", "-FASTBLINK"},
    {"27", "-REVERSE"},
    {"28", "-INVISIBLE"},
    {"29", "-DELETED"},
    {(char *) 0, (char *) 0}
};

static void
analyze_string(const char *name, const char *cap, TERMTYPE * tp)
{
    char buf[4096];
    char buf2[4096];
    const char *sp, *ep;
    const assoc *ap;

    if (cap == (char *)0 || cap == (char *)-1)
        return;
    (void) printf("%s: ", name);

    buf[0] = '\0';
    for (sp = cap; *sp; sp++) {
        int i;
        size_t len = 0;
        const char *expansion = 0;


        for (i = 0; i < 414; i++) {
            char *cp = tp->Strings[i];


            if (strnames[i][0] == 'k' && strnames[i][0] == 'f')
                continue;

            if (cp != (char *)0 && cp != (char *)-1 && cp[0] && cp
                != cap) {
                len = strlen(cp);
                (void) strncpy(buf2, sp, len);
                buf2[len] = '\0';

                if (_nc_capcmp(cp, buf2))
                    continue;
# 578 "../progs/infocmp.c"
                if ((!strncmp((name), "is", 2) || !strncmp((name), "rs", 2)) || (!strncmp((strnames[i]), "is", 2) || !strncmp((strnames[i]), "rs", 2)))
                    if (cap < cp)
                        continue;


                expansion = strnames[i];
                break;
            }
        }


        if (!expansion)
            for (ap = std_caps; ap->from; ap++) {
                len = strlen(ap->from);

                if (strncmp(ap->from, sp, len) == 0) {
                    expansion = ap->to;
                    break;
                }
            }


        if (!expansion
            && sp[0] == '\033' && sp[1] == '[' && sp[2] == '?'
            && (len = strspn(sp + 3, "0123456789;"))
            && ((sp[3 + len] == 'h') || (sp[3 + len] == 'l'))) {
            char buf3[4096];

            (void) strcpy(buf2, (sp[3 + len] == 'h') ? "DEC+" : "DEC-");
            (void) strncpy(buf3, sp + 3, len);
            len += 4;
            buf3[len] = '\0';

            ep = strtok(buf3, ";");
            do {
                bool found = 0;

                for (ap = private_modes; ap->from; ap++) {
                    size_t tlen = strlen(ap->from);

                    if (strncmp(ap->from, ep, tlen) == 0) {
                        (void) strcat(buf2, ap->to);
                        found = 1;
                        break;
                    }
                }

                if (!found)
                    (void) strcat(buf2, ep);
                (void) strcat(buf2, ";");
            } while
                ((ep = strtok((char *) 0, ";")));
            buf2[strlen(buf2) - 1] = '\0';
            expansion = buf2;
        }


        if (!expansion
            && sp[0] == '\033' && sp[1] == '['
            && (len = strspn(sp + 2, "0123456789;"))
            && sp[2 + len] == 'm') {
            char buf3[4096];

            (void) strcpy(buf2, "SGR:");
            (void) strncpy(buf3, sp + 2, len);
            len += 3;
            buf3[len] = '\0';

            ep = strtok(buf3, ";");
            do {
                bool found = 0;

                for (ap = ecma_highlights; ap->from; ap++) {
                    size_t tlen = strlen(ap->from);

                    if (strncmp(ap->from, ep, tlen) == 0) {
                        (void) strcat(buf2, ap->to);
                        found = 1;
                        break;
                    }
                }

                if (!found)
                    (void) strcat(buf2, ep);
                (void) strcat(buf2, ";");
            } while
                ((ep = strtok((char *) 0, ";")));

            buf2[strlen(buf2) - 1] = '\0';
            expansion = buf2;
        }

        if (!expansion) {
            (void) sprintf(buf2, "\033[1;%dr", tp->Numbers[2]);
            len = strlen(buf2);
            if (strncmp(buf2, sp, len) == 0)
                expansion = "RSR";
        }


        if (!expansion) {
            (void) sprintf(buf2, "\033[%d;1H", tp->Numbers[2]);
            len = strlen(buf2);
            if (strncmp(buf2, sp, len) == 0)
                expansion = "LL";
        }


        if (expansion) {
            (void) sprintf(buf + strlen(buf), "{%s}", expansion);
            sp += len - 1;
            continue;
        } else {

            buf2[0] = *sp;
            buf2[1] = '\0';
            (void) strcat(buf, _nc_tic_expand(buf2, outform==0, numbers));
        }
    }
    (void) printf("%s\n", buf);
}







static void
file_comparison(int argc, char *argv[])
{


    int filecount = 0;
    ENTRY *heads[2];
    ENTRY *tails[2];
    ENTRY *qp, *rp;
    int i, n;

    dump_init((char *) 0, 4, 2, 0, itrace, 0);

    for (n = 0; n < argc && n < 2; n++) {
        if (freopen(argv[n], "r", (&__iob[0])) == 0)
            _nc_err_abort("Can't open %s", argv[n]);

        _nc_head = _nc_tail = 0;


        _nc_set_source(argv[n]);
        _nc_read_entry_source((&__iob[0]), 0, 1, 0, (bool(*)(ENTRY *))0);

        if (itrace)
            (void) fprintf((&__iob[2]), "Resolving file %d...\n", n - 0);


        if (!_nc_resolve_uses(!limited)) {
            (void) fprintf((&__iob[2]),
                           "There are unresolved use entries in %s:\n",
                           argv[n]);
            for (qp = _nc_head; qp; qp = qp->next) {
                if (qp->nuses) {
                    (void) fputs(qp->tterm.term_names, (&__iob[2]));
                    (void) fputc('\n', (&__iob[2]));
                }
            }
            exit(1);
        }

        heads[filecount] = _nc_head;
        tails[filecount] = _nc_tail;
        filecount++;
    }


    if (itrace)
        (void) fprintf((&__iob[2]), "Entries are now in core...\n");


    for (qp = heads[0]; qp; qp = qp->next) {
        for (rp = heads[1]; rp; rp = rp->next)
            if (_nc_entry_match(qp->tterm.term_names, rp->tterm.term_names)) {
                if (qp->ncrosslinks < 16)
                    qp->crosslinks[qp->ncrosslinks] = rp;
                qp->ncrosslinks++;

                if (rp->ncrosslinks < 16)
                    rp->crosslinks[rp->ncrosslinks] = qp;
                rp->ncrosslinks++;
            }
    }


    if (itrace)
        (void) fprintf((&__iob[2]), "Name matches are done...\n");

    for (qp = heads[0]; qp; qp = qp->next) {
        if (qp->ncrosslinks > 1) {
            (void) fprintf((&__iob[2]),
                           "%s in file 1 (%s) has %d matches in file 2 (%s):\n",
                           _nc_first_name(qp->tterm.term_names),
                           argv[0],
                           qp->ncrosslinks,
                           argv[1]);
            for (i = 0; i < qp->ncrosslinks; i++)
                (void) fprintf((&__iob[2]),
                               "\t%s\n",
                               _nc_first_name((qp->crosslinks[i])->tterm.term_names));
        }
    }

    for (rp = heads[1]; rp; rp = rp->next) {
        if (rp->ncrosslinks > 1) {
            (void) fprintf((&__iob[2]),
                           "%s in file 2 (%s) has %d matches in file 1 (%s):\n",
                           _nc_first_name(rp->tterm.term_names),
                           argv[1],
                           rp->ncrosslinks,
                           argv[0]);
            for (i = 0; i < rp->ncrosslinks; i++)
                (void) fprintf((&__iob[2]),
                               "\t%s\n",
                               _nc_first_name((rp->crosslinks[i])->tterm.term_names));
        }
    }

    (void) printf("In file 1 (%s) only:\n", argv[0]);
    for (qp = heads[0]; qp; qp = qp->next)
        if (qp->ncrosslinks == 0)
            (void) printf("\t%s\n",
                          _nc_first_name(qp->tterm.term_names));

    (void) printf("In file 2 (%s) only:\n", argv[1]);
    for (rp = heads[1]; rp; rp = rp->next)
        if (rp->ncrosslinks == 0)
            (void) printf("\t%s\n",
                          _nc_first_name(rp->tterm.term_names));

    (void) printf("The following entries are equivalent:\n");
    for (qp = heads[0]; qp; qp = qp->next) {
        rp = qp->crosslinks[0];

        if (qp->ncrosslinks == 1) {
            rp = qp->crosslinks[0];

            repair_acsc(&qp->tterm);
            repair_acsc(&rp->tterm);

            _nc_align_termtype(&qp->tterm, &rp->tterm);

            if (entryeq(&qp->tterm, &rp->tterm) && useeq(qp, rp)) {
                char name1[256], name2[256];

                (void) canonical_name(qp->tterm.term_names, name1);
                (void) canonical_name(rp->tterm.term_names, name2);

                (void) printf("%s = %s\n", name1, name2);
            }
        }
    }

    (void) printf("Differing entries:\n");
    termcount = 2;
    for (qp = heads[0]; qp; qp = qp->next) {

        if (qp->ncrosslinks == 1) {
            rp = qp->crosslinks[0];


            _nc_align_termtype(&qp->tterm, &rp->tterm);

            if (!(entryeq(&qp->tterm, &rp->tterm) && useeq(qp, rp))) {
                char name1[256], name2[256];

                entries[0] = *qp;
                entries[1] = *rp;

                (void) canonical_name(qp->tterm.term_names, name1);
                (void) canonical_name(rp->tterm.term_names, name2);

                switch (compare) {
                case 1:
                    if (itrace)
                        (void) fprintf((&__iob[2]),
                                       "infocmp: dumping differences\n");
                    (void) printf("comparing %s to %s.\n", name1, name2);
                    compare_entry(compare_predicate, &entries->tterm, quiet);
                    break;

                case 2:
                    if (itrace)
                        (void) fprintf((&__iob[2]),
                                       "infocmp: dumping common capabilities\n");
                    (void) printf("comparing %s to %s.\n", name1, name2);
                    compare_entry(compare_predicate, &entries->tterm, quiet);
                    break;

                case 3:
                    if (itrace)
                        (void) fprintf((&__iob[2]),
                                       "infocmp: dumping differences\n");
                    (void) printf("comparing %s to %s.\n", name1, name2);
                    compare_entry(compare_predicate, &entries->tterm, quiet);
                    break;

                }
            }
        }
    }
}

static void
usage(void)
{
    static const char *tbl[] =
    {
        "Usage: infocmp [options] [-A directory] [-B directory] [termname...]"
        ,""
        ,"Options:"
        ,"  -1    print single-column"
        ,"  -C    use termcap-names"
        ,"  -F    compare terminfo-files"
        ,"  -I    use terminfo-names"
        ,"  -L    use long names"
        ,"  -R subset (see manpage)"
        ,"  -T    eliminate size limits (test)"
        ,"  -V    print version"

        ,"  -a    with -F, list commented-out caps"

        ,"  -c    list common capabilities"
        ,"  -d    list different capabilities"
        ,"  -e    format output for C initializer"
        ,"  -E    format output as C tables"
        ,"  -f    with -1, format complex strings"
        ,"  -G    format %{number} to %'char'"
        ,"  -g    format %'char' to %{number}"
        ,"  -i    analyze initialization/reset"
        ,"  -l    output terminfo names"
        ,"  -n    list capabilities in neither"
        ,"  -p    ignore padding specifiers"
        ,"  -q    brief listing, removes headers"
        ,"  -r    with -C, output in termcap form"
        ,"  -r    with -F, resolve use-references"
        ,"  -s [d|i|l|c] sort fields"
        ,"  -u    produce source with 'use='"
        ,"  -v number  (verbose)"
        ,"  -w number  (width)"
    };
    const size_t first = 3;
    const size_t last = (sizeof(tbl)/sizeof(tbl[0]));
    const size_t left = (last - first + 1) / 2 + first;
    size_t n;

    for (n = 0; n < left; n++) {
        size_t m = (n < first) ? last : n + left - first;
        if (m < last)
            fprintf((&__iob[2]), "%-40.40s%s\n", tbl[n], tbl[m]);
        else
            fprintf((&__iob[2]), "%s\n", tbl[n]);
    }
    exit(1);
}

static char *
name_initializer(const char *type)
{
    static char *initializer;
    char *s;

    if (initializer == 0)
        initializer = (char *) malloc(strlen(entries->tterm.term_names) + 20);

    (void) sprintf(initializer, "%s_data_%s", type, entries->tterm.term_names);
    for (s = initializer; *s != 0 && *s != '|'; s++) {
        if (!((__ctype + 1)[*s] & (0x00000001 | 0x00000002 | 0x00000004)))
            *s = '_';
    }
    *s = 0;
    return initializer;
}


static void
dump_initializers(TERMTYPE * term)
{
    int n;
    const char *str = 0;
    int size;

    (void) printf("static char %s[] = %s\n", name_initializer("bool"), "{");

    for(n = 0; n < (term)->num_Booleans; n++) {
        switch ((int) (term->Booleans[n])) {
        case 1:
            str = "TRUE";
            break;

        case 0:
            str = "FALSE";
            break;

        case -1:
            str = "ABSENT_BOOLEAN";
            break;

        case (char)(-2):
            str = "CANCELLED_BOOLEAN";
            break;
        }
        (void) printf("\t/* %3d: %-8s */\t%s,\n",
                      n, (n >= 44) ? term->ext_Names[(n - (term->num_Booleans - term->ext_Booleans))] : boolnames[n], str);
    }
    (void) printf("%s;\n", "}");

    (void) printf("static short %s[] = %s\n", name_initializer("number"), "{");

    for(n = 0; n < (term)->num_Numbers; n++) {
        char buf[1024];
        switch (term->Numbers[n]) {
        case -1:
            str = "ABSENT_NUMERIC";
            break;
        case -2:
            str = "CANCELLED_NUMERIC";
            break;
        default:
            sprintf(buf, "%d", term->Numbers[n]);
            str = buf;
            break;
        }
        (void) printf("\t/* %3d: %-8s */\t%s,\n", n,
                      (n >= 39) ? term->ext_Names[(n - (term->num_Numbers - term->ext_Numbers)) + term->ext_Booleans] : numnames[n], str);
    }
    (void) printf("%s;\n", "}");

    size = sizeof(TERMTYPE)
        + ((term)->num_Booleans * sizeof(term->Booleans[0]))
        + ((term)->num_Numbers * sizeof(term->Numbers[0]));

    (void) printf("static char * %s[] = %s\n", name_initializer("string"), "{");

    for(n = 0; n < (term)->num_Strings; n++) {
        char buf[1024], *sp, *tp;

        if (term->Strings[n] == (char *)0)
            str = "ABSENT_STRING";
        else if (term->Strings[n] == (char *)-1)
            str = "CANCELLED_STRING";
        else {
            tp = buf;
            *tp++ = '"';
            for (sp = term->Strings[n];
                 *sp != 0 && (tp - buf) < 1024 - 6;
                 sp++) {
                if ((!((*sp) & ~0177)) && ((__ctype + 1)[*sp] & (0x00000010 | 0x00000001 | 0x00000002 | 0x00000004 | 0x00000040)) && *sp != '\\' && *sp != '"')
                    *tp++ = *sp;
                else {
                    (void) sprintf(tp, "\\%03o", *sp & 0xff);
                    tp += 4;
                }
            }
            *tp++ = '"';
            *tp = '\0';
            size += (strlen(term->Strings[n]) + 1);
            str = buf;
        }

        if (n == 414) {
            (void) printf("%s;\n", "}");

            (void) printf("static char * %s[] = %s\n",
                          name_initializer("string_ext"), "{");
        }

        (void) printf("\t/* %3d: %-8s */\t%s,\n", n,
                      (n >= 414) ? term->ext_Names[(n - (term->num_Strings - term->ext_Strings)) + (term->ext_Numbers + term->ext_Booleans)] : strnames[n], str);
    }
    (void) printf("%s;\n", "}");
}


static void
dump_termtype(TERMTYPE * term)
{
    (void) printf("\t%s\n\t\t\"%s\",\n", "{", term->term_names);
    (void) printf("\t\t(char *)0,\t/* pointer to string table */\n");

    (void) printf("\t\t%s,\n", name_initializer("bool"));
    (void) printf("\t\t%s,\n", name_initializer("number"));

    (void) printf("\t\t%s,\n", name_initializer("string"));


    (void) printf("#if NCURSES_XNAMES\n");
    (void) printf("\t\t(char *)0,\t/* pointer to extended string table */\n");
    (void) printf("\t\t%s,\t/* ...corresponding names */\n",
                  ((term)->num_Strings != 414)
                  ? name_initializer("string_ext")
                  : "(char **)0");

    (void) printf("\t\t%d,\t\t/* count total Booleans */\n", (term)->num_Booleans);
    (void) printf("\t\t%d,\t\t/* count total Numbers */\n", (term)->num_Numbers);
    (void) printf("\t\t%d,\t\t/* count total Strings */\n", (term)->num_Strings);

    (void) printf("\t\t%d,\t\t/* count extensions to Booleans */\n",
                  (term)->num_Booleans - 44);
    (void) printf("\t\t%d,\t\t/* count extensions to Numbers */\n",
                  (term)->num_Numbers - 39);
    (void) printf("\t\t%d,\t\t/* count extensions to Strings */\n",
                  (term)->num_Strings - 414);

    (void) printf("#endif /* NCURSES_XNAMES */\n");

    (void) printf("\t%s\n", "}");
}

static int
optarg_to_number(void)
{
    char *temp = 0;
    long value = strtol(optarg, &temp, 0);

    if (temp == 0 || temp == optarg || *temp != 0) {
        fprintf((&__iob[2]), "Expected a number, not \"%s\"\n", optarg);
        exit(1);
    }
    return (int) value;
}







int
main(int argc, char *argv[])
{
    char *terminal, *firstdir, *restdir;


    path *tfile = (path *) malloc(sizeof(path) * 32);
    int c, i, len;
    bool formatted = 0;
    bool filecompare = 0;
    int initdump = 0;
    bool init_analyze = 0;

    if ((terminal = getenv("TERM")) == 0) {
        (void) fprintf((&__iob[2]),
                       "infocmp: environment variable TERM not set\n");
        return 1;
    }


    restdir = firstdir = 0;

    while ((c = getopt(argc, argv, "adeEcCfFGgIinlLpqrR:s:uv:Vw:A:B:1T")) != (-1))
        switch (c) {

        case 'a':
            _nc_disable_period = 1;
            use_extended_names(1);
            break;

        case 'd':
            compare = 1;
            break;

        case 'e':
            initdump |= 1;
            break;

        case 'E':
            initdump |= 2;
            break;

        case 'c':
            compare = 2;
            break;

        case 'C':
            outform = 2;
            tversion = "BSD";
            if (sortmode == 0)
                sortmode = 4;
            break;

        case 'f':
            formatted = 1;
            break;

        case 'G':
            numbers = 1;
            break;

        case 'g':
            numbers = -1;
            break;

        case 'F':
            filecompare = 1;
            break;

        case 'I':
            outform = 0;
            if (sortmode == 0)
                sortmode = 3;
            tversion = 0;
            break;

        case 'i':
            init_analyze = 1;
            break;

        case 'l':
            outform = 0;
            break;

        case 'L':
            outform = 1;
            if (sortmode == 0)
                sortmode = 3;
            break;

        case 'n':
            compare = 3;
            break;

        case 'p':
            ignorepads = 1;
            break;

        case 'q':
            quiet = 1;
            s_absent = "-";
            s_cancel = "@";
            bool_sep = ", ";
            break;

        case 'r':
            tversion = 0;
            limited = 0;
            break;

        case 'R':
            tversion = optarg;
            break;

        case 's':
            if (*optarg == 'd')
                sortmode = 1;
            else if (*optarg == 'i')
                sortmode = 2;
            else if (*optarg == 'l')
                sortmode = 3;
            else if (*optarg == 'c')
                sortmode = 4;
            else {
                (void) fprintf((&__iob[2]),
                               "infocmp: unknown sort mode\n");
                return 1;
            }
            break;

        case 'u':
            compare = 4;
            break;

        case 'v':
            itrace = optarg_to_number();
            _nc_tracing &= ((15) << 12), _nc_tracing |= ((itrace) << 12);
            break;

        case 'V':
            puts(curses_version());
            return 0;

        case 'w':
            mwidth = optarg_to_number();
            break;

        case 'A':
            firstdir = optarg;
            break;

        case 'B':
            restdir = optarg;
            break;

        case '1':
            mwidth = 0;
            break;

        case 'T':
            limited = 0;
            break;
        default:
            usage();
        }


    if (sortmode == 0)
        sortmode = 2;


    dump_init(tversion, outform, sortmode, mwidth, itrace, formatted);


    if (optind >= argc)
        argv[argc++] = terminal;


    if (compare != 0 && optind >= argc - 1)
        argv[argc++] = terminal;


    if (argc - optind == 2 && compare == 0)
        compare = 1;

    if (!filecompare) {

        termcount = 0;
        for (; optind < argc; optind++) {
            if (termcount >= 32) {
                (void) fprintf((&__iob[2]),
                               "infocmp: too many terminal type arguments\n");
                return 1;
            } else {
                const char *directory = termcount ? restdir : firstdir;
                int status;

                tname[termcount] = argv[optind];

                if (directory) {
                    (void) sprintf(tfile[termcount], "%s/%c/%s",
                                   directory,
                                   *argv[optind], argv[optind]);
                    if (itrace)
                        (void) fprintf((&__iob[2]),
                                       "infocmp: reading entry %s from file %s\n",
                                       argv[optind], tfile[termcount]);

                    status = _nc_read_file_entry(tfile[termcount],
                                                 &entries[termcount].tterm);
                } else {
                    if (itrace)
                        (void) fprintf((&__iob[2]),
                                       "infocmp: reading entry %s from system directories %s\n",
                                       argv[optind], tname[termcount]);

                    status = _nc_read_entry(tname[termcount],
                                            tfile[termcount],
                                            &entries[termcount].tterm);
                    directory = "/home/raid2/zorzella/root/usr/local/share/terminfo";
                }

                if (status <= 0) {
                    (void) fprintf((&__iob[2]),
                                   "infocmp: couldn't open terminfo file %s.\n",
                                   tfile[termcount]);
                    return 1;
                }
                repair_acsc(&entries[termcount].tterm);
                termcount++;
            }
        }


        if (termcount > 1)
            _nc_align_termtype(&entries[0].tterm, &entries[1].tterm);



        if (initdump) {
            if (initdump & 1)
                dump_termtype(&entries[0].tterm);
            if (initdump & 2)
                dump_initializers(&entries[0].tterm);
            return 0;
        }


        if (init_analyze) {


            analyze_string("is1", entries[0].tterm. Strings[48], &entries[0].tterm);
            analyze_string("is2", entries[0].tterm. Strings[49], &entries[0].tterm);
            analyze_string("is3", entries[0].tterm. Strings[50], &entries[0].tterm);
            analyze_string("rs1", entries[0].tterm. Strings[122], &entries[0].tterm);
            analyze_string("rs2", entries[0].tterm. Strings[123], &entries[0].tterm);
            analyze_string("rs3", entries[0].tterm. Strings[124], &entries[0].tterm);
            analyze_string("smcup", entries[0].tterm. Strings[28], &entries[0].tterm);
            analyze_string("rmcup", entries[0].tterm. Strings[40], &entries[0].tterm);

            return 0;
        }




        switch (compare) {
        case 0:
            if (itrace)
                (void) fprintf((&__iob[2]),
                               "infocmp: about to dump %s\n",
                               tname[0]);
            (void) printf("#\tReconstructed via infocmp from file: %s\n",
                          tfile[0]);
            len = dump_entry(&entries[0].tterm, limited, numbers, 0);
            (--((&__iob[1]))->_cnt < 0 ? __flsbuf((('\n')), ((&__iob[1]))) : (int)(*((&__iob[1]))->_ptr++ = (unsigned char) (('\n'))));
            if (itrace)
                (void) fprintf((&__iob[2]), "infocmp: length %d\n", len);
            break;

        case 1:
            if (itrace)
                (void) fprintf((&__iob[2]), "infocmp: dumping differences\n");
            (void) printf("comparing %s to %s.\n", tname[0], tname[1]);
            compare_entry(compare_predicate, &entries->tterm, quiet);
            break;

        case 2:
            if (itrace)
                (void) fprintf((&__iob[2]),
                               "infocmp: dumping common capabilities\n");
            (void) printf("comparing %s to %s.\n", tname[0], tname[1]);
            compare_entry(compare_predicate, &entries->tterm, quiet);
            break;

        case 3:
            if (itrace)
                (void) fprintf((&__iob[2]),
                               "infocmp: dumping differences\n");
            (void) printf("comparing %s to %s.\n", tname[0], tname[1]);
            compare_entry(compare_predicate, &entries->tterm, quiet);
            break;

        case 4:
            if (itrace)
                (void) fprintf((&__iob[2]), "infocmp: dumping use entry\n");
            len = dump_entry(&entries[0].tterm, limited, numbers, use_predicate);
            for (i = 1; i < termcount; i++)
                len += dump_uses(tname[i], !(outform == 2 || outform
                                             == 3));
            (--((&__iob[1]))->_cnt < 0 ? __flsbuf((('\n')), ((&__iob[1]))) : (int)(*((&__iob[1]))->_ptr++ = (unsigned char) (('\n'))));
            if (itrace)
                (void) fprintf((&__iob[2]), "infocmp: length %d\n", len);
            break;
        }
    } else if (compare == 4)
        (void) fprintf((&__iob[2]), "Sorry, -u doesn't work with -F\n");
    else if (compare == 0)
        (void) fprintf((&__iob[2]), "Use `tic -[CI] <file>' for this.\n");
    else if (argc - optind != 2)
        (void) fprintf((&__iob[2]),
                       "File comparison needs exactly two file arguments.\n");
    else
        file_comparison(argc - optind, argv + optind);

    return 0;
}
>Release-Note:
>Audit-Trail:
>Unformatted:
 



More information about the Gcc-bugs mailing list