[cfe-dev] linux build fix
Sean Middleditch
sean at awesomeplay.com
Fri Dec 7 21:26:57 PST 2007
On Fri, 2007-12-07 at 21:03 -0800, Chris Lattner wrote:
> On Dec 7, 2007, at 8:59 PM, Sean Middleditch wrote:
> > Various GNU/Linux headers include the stddef.h header, which is
> > in /usr/include/linux, which isn't in the system header search path.
> > So, as a "hello everyone" gift, here's my first patch for the project.
> > Clearly it's the most awesome patch ever, what with it being a whole
> > single line in a part of a file marked as "need's to be replaced." :)
>
> Are you sure that this is the problem? Can you please run "gcc -v
> test.c -c" on something? on my linux box, I get:
>
> #include "..." search starts here:
> #include <...> search starts here:
> /usr/local/include
> /usr/lib/gcc/i586-mandriva-linux-gnu/4.0.1/include
> /usr/include
> End of search list.
>
> do you see /usr/include/linux?
I have close to the same. Looking around, I found that all three of the
headers that are missing are in the /usr/lib/gcc/... path. I'm not
entirely clear on what that means, but I've got a pretty strong
suspicion. I'm pretty sure clang isn't meant to depend on gcc, so are
those headers that need to be supplied with clang?
If so, I'm assuming new ones have to be written from scratch due to the
license these files carry in GCC. (GPL v2+, with exceptions for
binaries compiled by GCC.) Correct?
>
> > Next up is to figure out why both time_t and size_t result in a
> > variety
> > of comical errors such as:
> >
> > ///usr/include/linux/time.h:10:2: error: type name requires a
> > specifier
> > or qualifier
> > time_t tv_sec; /* seconds */
> > ^
> >
> > Out of the pages and pages of errors, almost all of them are either
> > errors from time_t or size_t, so I figure fixing whatever that is will
> > get me pretty close to compiling this little program.
>
> If you send a .i file (produced with clang -E test.c > test.i), I can
> take a look.
Well that would be no fun for me, now, would it? ;) Oh well, attached.
Here are the few errors it prints out when I run the command, as well:
elanthis at stargrazer:~/Source/clc$ ../llvm/Debug/bin/clang -E clc.c >
clc.i
In file included from clc.c:20:
In file included from /usr/include/ncurses.h:140:
In file included from /usr/include/stdio.h:75:
/usr/include/libio.h:53:11: error: 'stdarg.h' file not found
# include <stdarg.h>
^
In file included from clc.c:20:
/usr/include/ncurses.h:142:10: error: 'stdarg.h' file not found
#include <stdarg.h> /* we need va_list */
^
/usr/include/ncurses.h:175:10: error: 'stdbool.h' file not found
#include <stdbool.h>
^
3 diagnostics generated.
Just the include headers issue I mentioned above, as stdarg.h and
stdbool.h don't have copies in /usr/include/linux like stddef.h does.
-------------- next part --------------
# 1 "clc.c" 1
# 0 "clc.c"
# 1 "<predefines>" 1
# 1 "clc.c" 2
# 1 "/usr/include/sys/types.h" 1 3 4
# 27 "/usr/include/sys/types.h"
# 1 "/usr/include/features.h" 1 3 4
# 330 "/usr/include/features.h"
# 1 "/usr/include/sys/cdefs.h" 1 3 4
# 348 "/usr/include/sys/cdefs.h"
# 1 "/usr/include/bits/wordsize.h" 1 3 4
# 349 "/usr/include/sys/cdefs.h" 2 3 4
# 331 "/usr/include/features.h" 2 3 4
# 354 "/usr/include/features.h"
# 1 "/usr/include/gnu/stubs.h" 1 3 4
# 1 "/usr/include/bits/wordsize.h" 1 3 4
# 5 "/usr/include/gnu/stubs.h" 2 3 4
# 1 "/usr/include/gnu/stubs-32.h" 1 3 4
# 8 "/usr/include/gnu/stubs.h" 2 3 4
# 355 "/usr/include/features.h" 2 3 4
# 28 "/usr/include/sys/types.h" 2 3 4
# 1 "/usr/include/bits/types.h" 1 3 4
# 28 "/usr/include/bits/types.h"
# 1 "/usr/include/bits/wordsize.h" 1 3 4
# 29 "/usr/include/bits/types.h" 2 3 4
typedef unsigned char __u_char;
typedef unsigned short int __u_short;
typedef unsigned int __u_int;
typedef unsigned long int __u_long;
typedef signed char __int8_t;
typedef unsigned char __uint8_t;
typedef signed short int __int16_t;
typedef unsigned short int __uint16_t;
typedef signed int __int32_t;
typedef unsigned int __uint32_t;
__extension__ typedef signed long long int __int64_t;
__extension__ typedef unsigned long long int __uint64_t;
# 56 "/usr/include/bits/types.h"
__extension__ typedef long long int __quad_t;
__extension__ typedef unsigned long long int __u_quad_t;
# 131 "/usr/include/bits/types.h"
# 1 "/usr/include/bits/typesizes.h" 1 3 4
# 132 "/usr/include/bits/types.h" 2 3 4
__extension__ typedef __u_quad_t __dev_t;
__extension__ typedef unsigned int __uid_t;
__extension__ typedef unsigned int __gid_t;
__extension__ typedef unsigned long int __ino_t;
__extension__ typedef __u_quad_t __ino64_t;
__extension__ typedef unsigned int __mode_t;
__extension__ typedef unsigned int __nlink_t;
__extension__ typedef long int __off_t;
__extension__ typedef __quad_t __off64_t;
__extension__ typedef int __pid_t;
__extension__ typedef struct { int __val[2]; } __fsid_t;
__extension__ typedef long int __clock_t;
__extension__ typedef unsigned long int __rlim_t;
__extension__ typedef __u_quad_t __rlim64_t;
__extension__ typedef unsigned int __id_t;
__extension__ typedef long int __time_t;
__extension__ typedef unsigned int __useconds_t;
__extension__ typedef long int __suseconds_t;
__extension__ typedef int __daddr_t;
__extension__ typedef long int __swblk_t;
__extension__ typedef int __key_t;
__extension__ typedef int __clockid_t;
__extension__ typedef void * __timer_t;
__extension__ typedef long int __blksize_t;
__extension__ typedef long int __blkcnt_t;
__extension__ typedef __quad_t __blkcnt64_t;
__extension__ typedef unsigned long int __fsblkcnt_t;
__extension__ typedef __u_quad_t __fsblkcnt64_t;
__extension__ typedef unsigned long int __fsfilcnt_t;
__extension__ typedef __u_quad_t __fsfilcnt64_t;
__extension__ typedef int __ssize_t;
typedef __off64_t __loff_t;
typedef __quad_t *__qaddr_t;
typedef char *__caddr_t;
__extension__ typedef int __intptr_t;
__extension__ typedef unsigned int __socklen_t;
# 32 "/usr/include/sys/types.h" 2 3 4
typedef __u_char u_char;
typedef __u_short u_short;
typedef __u_int u_int;
typedef __u_long u_long;
typedef __quad_t quad_t;
typedef __u_quad_t u_quad_t;
typedef __fsid_t fsid_t;
typedef __loff_t loff_t;
typedef __ino_t ino_t;
# 62 "/usr/include/sys/types.h"
typedef __dev_t dev_t;
typedef __gid_t gid_t;
typedef __mode_t mode_t;
typedef __nlink_t nlink_t;
typedef __uid_t uid_t;
typedef __off_t off_t;
# 100 "/usr/include/sys/types.h"
typedef __pid_t pid_t;
typedef __id_t id_t;
typedef __ssize_t ssize_t;
typedef __daddr_t daddr_t;
typedef __caddr_t caddr_t;
typedef __key_t key_t;
# 133 "/usr/include/sys/types.h"
# 1 "/usr/include/linux/time.h" 1 3 4
# 1 "/usr/include/linux/types.h" 1 3 4
# 1 "/usr/include/linux/posix_types.h" 1 3 4
# 1 "/usr/include/linux/stddef.h" 1 3 4
# 5 "/usr/include/linux/posix_types.h" 2 3 4
# 36 "/usr/include/linux/posix_types.h"
typedef struct {
unsigned long fds_bits [(1024/(8 * sizeof(unsigned long)))];
} __kernel_fd_set;
typedef void (*__kernel_sighandler_t)(int);
typedef int __kernel_key_t;
typedef int __kernel_mqd_t;
# 1 "/usr/include/asm/posix_types.h" 1 3 4
# 1 "/usr/include/asm/posix_types_32.h" 1 3 4
# 10 "/usr/include/asm/posix_types_32.h"
typedef unsigned long __kernel_ino_t;
typedef unsigned short __kernel_mode_t;
typedef unsigned short __kernel_nlink_t;
typedef long __kernel_off_t;
typedef int __kernel_pid_t;
typedef unsigned short __kernel_ipc_pid_t;
typedef unsigned short __kernel_uid_t;
typedef unsigned short __kernel_gid_t;
typedef unsigned int __kernel_size_t;
typedef int __kernel_ssize_t;
typedef int __kernel_ptrdiff_t;
typedef long __kernel_time_t;
typedef long __kernel_suseconds_t;
typedef long __kernel_clock_t;
typedef int __kernel_timer_t;
typedef int __kernel_clockid_t;
typedef int __kernel_daddr_t;
typedef char * __kernel_caddr_t;
typedef unsigned short __kernel_uid16_t;
typedef unsigned short __kernel_gid16_t;
typedef unsigned int __kernel_uid32_t;
typedef unsigned int __kernel_gid32_t;
typedef unsigned short __kernel_old_uid_t;
typedef unsigned short __kernel_old_gid_t;
typedef unsigned short __kernel_old_dev_t;
typedef long long __kernel_loff_t;
typedef struct {
int __val[2];
} __kernel_fsid_t;
# 3 "/usr/include/asm/posix_types.h" 2 3 4
# 48 "/usr/include/linux/posix_types.h" 2 3 4
# 6 "/usr/include/linux/types.h" 2 3 4
# 1 "/usr/include/asm/types.h" 1 3 4
typedef unsigned short umode_t;
typedef __signed__ char __s8;
typedef unsigned char __u8;
typedef __signed__ short __s16;
typedef unsigned short __u16;
typedef __signed__ int __s32;
typedef unsigned int __u32;
__extension__ typedef __signed__ long long __s64;
__extension__ typedef unsigned long long __u64;
# 7 "/usr/include/linux/types.h" 2 3 4
# 153 "/usr/include/linux/types.h"
typedef __u16 __le16;
typedef __u16 __be16;
typedef __u32 __le32;
typedef __u32 __be32;
typedef __u64 __le64;
typedef __u64 __be64;
typedef __u16 __sum16;
typedef __u32 __wsum;
struct ustat {
__kernel_daddr_t f_tfree;
__kernel_ino_t f_tinode;
char f_fname[6];
char f_fpack[6];
};
# 5 "/usr/include/linux/time.h" 2 3 4
struct timespec {
time_t tv_sec;
long tv_nsec;
};
struct timeval {
time_t tv_sec;
suseconds_t tv_usec;
};
struct timezone {
int tz_minuteswest;
int tz_dsttime;
};
# 42 "/usr/include/linux/time.h"
struct itimerspec {
struct timespec it_interval;
struct timespec it_value;
};
struct itimerval {
struct timeval it_interval;
struct timeval it_value;
};
# 134 "/usr/include/sys/types.h" 2 3 4
# 151 "/usr/include/sys/types.h"
typedef unsigned long int ulong;
typedef unsigned short int ushort;
typedef unsigned int uint;
# 195 "/usr/include/sys/types.h"
typedef int int8_t __attribute__ ((__mode__ (__QI__)));
typedef int int16_t __attribute__ ((__mode__ (__HI__)));
typedef int int32_t __attribute__ ((__mode__ (__SI__)));
typedef int int64_t __attribute__ ((__mode__ (__DI__)));
typedef unsigned int u_int8_t __attribute__ ((__mode__ (__QI__)));
typedef unsigned int u_int16_t __attribute__ ((__mode__ (__HI__)));
typedef unsigned int u_int32_t __attribute__ ((__mode__ (__SI__)));
typedef unsigned int u_int64_t __attribute__ ((__mode__ (__DI__)));
typedef int register_t __attribute__ ((__mode__ (__word__)));
# 217 "/usr/include/sys/types.h"
# 1 "/usr/include/endian.h" 1 3 4
# 37 "/usr/include/endian.h"
# 1 "/usr/include/bits/endian.h" 1 3 4
# 38 "/usr/include/endian.h" 2 3 4
# 218 "/usr/include/sys/types.h" 2 3 4
# 1 "/usr/include/sys/select.h" 1 3 4
# 31 "/usr/include/sys/select.h"
# 1 "/usr/include/bits/select.h" 1 3 4
# 32 "/usr/include/sys/select.h" 2 3 4
# 1 "/usr/include/bits/sigset.h" 1 3 4
# 24 "/usr/include/bits/sigset.h"
typedef int __sig_atomic_t;
typedef struct
{
unsigned long int __val[(1024 / (8 * sizeof (unsigned long int)))];
} __sigset_t;
# 35 "/usr/include/sys/select.h" 2 3 4
typedef __sigset_t sigset_t;
# 46 "/usr/include/sys/select.h"
# 1 "/usr/include/bits/time.h" 1 3 4
# 69 "/usr/include/bits/time.h"
struct timeval
{
__time_t tv_sec;
__suseconds_t tv_usec;
};
# 47 "/usr/include/sys/select.h" 2 3 4
typedef __suseconds_t suseconds_t;
typedef long int __fd_mask;
# 67 "/usr/include/sys/select.h"
typedef struct
{
# 75 "/usr/include/sys/select.h"
__fd_mask __fds_bits[1024 / (8 * sizeof (__fd_mask))];
} fd_set;
typedef __fd_mask fd_mask;
# 109 "/usr/include/sys/select.h"
extern int select (int __nfds, fd_set *__restrict __readfds,
fd_set *__restrict __writefds,
fd_set *__restrict __exceptfds,
struct timeval *__restrict __timeout);
# 121 "/usr/include/sys/select.h"
extern int pselect (int __nfds, fd_set *__restrict __readfds,
fd_set *__restrict __writefds,
fd_set *__restrict __exceptfds,
const struct timespec *__restrict __timeout,
const __sigset_t *__restrict __sigmask);
# 221 "/usr/include/sys/types.h" 2 3 4
# 1 "/usr/include/sys/sysmacros.h" 1 3 4
# 30 "/usr/include/sys/sysmacros.h"
__extension__
extern unsigned int gnu_dev_major (unsigned long long int __dev)
__attribute__ ((__nothrow__));
__extension__
extern unsigned int gnu_dev_minor (unsigned long long int __dev)
__attribute__ ((__nothrow__));
__extension__
extern unsigned long long int gnu_dev_makedev (unsigned int __major,
unsigned int __minor)
__attribute__ ((__nothrow__));
# 224 "/usr/include/sys/types.h" 2 3 4
# 235 "/usr/include/sys/types.h"
typedef __blkcnt_t blkcnt_t;
typedef __fsblkcnt_t fsblkcnt_t;
typedef __fsfilcnt_t fsfilcnt_t;
# 270 "/usr/include/sys/types.h"
# 1 "/usr/include/bits/pthreadtypes.h" 1 3 4
# 23 "/usr/include/bits/pthreadtypes.h"
# 1 "/usr/include/bits/wordsize.h" 1 3 4
# 24 "/usr/include/bits/pthreadtypes.h" 2 3 4
# 50 "/usr/include/bits/pthreadtypes.h"
typedef unsigned long int pthread_t;
typedef union
{
char __size[36];
long int __align;
} pthread_attr_t;
# 67 "/usr/include/bits/pthreadtypes.h"
typedef struct __pthread_internal_slist
{
struct __pthread_internal_slist *__next;
} __pthread_slist_t;
typedef union
{
struct __pthread_mutex_s
{
int __lock;
unsigned int __count;
int __owner;
int __kind;
unsigned int __nusers;
__extension__ union
{
int __spins;
__pthread_slist_t __list;
};
} __data;
char __size[24];
long int __align;
} pthread_mutex_t;
typedef union
{
char __size[4];
int __align;
} pthread_mutexattr_t;
typedef union
{
struct
{
int __lock;
unsigned int __futex;
__extension__ unsigned long long int __total_seq;
__extension__ unsigned long long int __wakeup_seq;
__extension__ unsigned long long int __woken_seq;
void *__mutex;
unsigned int __nwaiters;
unsigned int __broadcast_seq;
} __data;
char __size[48];
__extension__ long long int __align;
} pthread_cond_t;
typedef union
{
char __size[4];
int __align;
} pthread_condattr_t;
typedef unsigned int pthread_key_t;
typedef int pthread_once_t;
typedef union
{
# 170 "/usr/include/bits/pthreadtypes.h"
struct
{
int __lock;
unsigned int __nr_readers;
unsigned int __readers_wakeup;
unsigned int __writer_wakeup;
unsigned int __nr_readers_queued;
unsigned int __nr_writers_queued;
unsigned char __flags;
unsigned char __shared;
unsigned char __pad1;
unsigned char __pad2;
int __writer;
} __data;
char __size[32];
long int __align;
} pthread_rwlock_t;
typedef union
{
char __size[8];
long int __align;
} pthread_rwlockattr_t;
typedef volatile int pthread_spinlock_t;
typedef union
{
char __size[20];
long int __align;
} pthread_barrier_t;
typedef union
{
char __size[4];
int __align;
} pthread_barrierattr_t;
# 271 "/usr/include/sys/types.h" 2 3 4
# 8 "clc.c" 2
# 1 "/usr/include/sys/socket.h" 1 3 4
# 28 "/usr/include/sys/socket.h"
# 1 "/usr/include/sys/uio.h" 1 3 4
# 29 "/usr/include/sys/uio.h"
# 1 "/usr/include/bits/uio.h" 1 3 4
# 44 "/usr/include/bits/uio.h"
struct iovec
{
void *iov_base;
size_t iov_len;
};
# 30 "/usr/include/sys/uio.h" 2 3 4
# 40 "/usr/include/sys/uio.h"
extern ssize_t readv (int __fd, __const struct iovec *__iovec, int __count);
# 50 "/usr/include/sys/uio.h"
extern ssize_t writev (int __fd, __const struct iovec *__iovec, int __count);
# 29 "/usr/include/sys/socket.h" 2 3 4
# 1 "/usr/include/bits/socket.h" 1 3 4
# 32 "/usr/include/bits/socket.h"
# 1 "/usr/include/linux/limits.h" 1 3 4
# 33 "/usr/include/bits/socket.h" 2 3 4
typedef __socklen_t socklen_t;
enum __socket_type
{
SOCK_STREAM = 1,
SOCK_DGRAM = 2,
SOCK_RAW = 3,
SOCK_RDM = 4,
SOCK_SEQPACKET = 5,
SOCK_PACKET = 10
};
# 147 "/usr/include/bits/socket.h"
# 1 "/usr/include/bits/sockaddr.h" 1 3 4
# 29 "/usr/include/bits/sockaddr.h"
typedef unsigned short int sa_family_t;
# 148 "/usr/include/bits/socket.h" 2 3 4
struct sockaddr
{
sa_family_t sa_family;
char sa_data[14];
};
# 167 "/usr/include/bits/socket.h"
struct sockaddr_storage
{
sa_family_t ss_family;
__uint32_t __ss_align;
char __ss_padding[(128 - (2 * sizeof (__uint32_t)))];
};
enum
{
MSG_OOB = 0x01,
MSG_PEEK = 0x02,
MSG_DONTROUTE = 0x04,
MSG_CTRUNC = 0x08,
MSG_PROXY = 0x10,
MSG_TRUNC = 0x20,
MSG_DONTWAIT = 0x40,
MSG_EOR = 0x80,
MSG_WAITALL = 0x100,
MSG_FIN = 0x200,
MSG_SYN = 0x400,
MSG_CONFIRM = 0x800,
MSG_RST = 0x1000,
MSG_ERRQUEUE = 0x2000,
MSG_NOSIGNAL = 0x4000,
MSG_MORE = 0x8000,
MSG_CMSG_CLOEXEC = 0x40000000
};
struct msghdr
{
void *msg_name;
socklen_t msg_namelen;
struct iovec *msg_iov;
size_t msg_iovlen;
void *msg_control;
size_t msg_controllen;
int msg_flags;
};
struct cmsghdr
{
size_t cmsg_len;
int cmsg_level;
int cmsg_type;
__extension__ unsigned char __cmsg_data [];
};
# 273 "/usr/include/bits/socket.h"
extern struct cmsghdr *__cmsg_nxthdr (struct msghdr *__mhdr,
struct cmsghdr *__cmsg) __attribute__ ((__nothrow__));
# 300 "/usr/include/bits/socket.h"
enum
{
SCM_RIGHTS = 0x01
, SCM_CREDENTIALS = 0x02
};
struct ucred
{
pid_t pid;
uid_t uid;
gid_t gid;
};
# 1 "/usr/include/asm/socket.h" 1 3 4
# 1 "/usr/include/asm/sockios.h" 1 3 4
# 5 "/usr/include/asm/socket.h" 2 3 4
# 321 "/usr/include/bits/socket.h" 2 3 4
struct linger
{
int l_onoff;
int l_linger;
};
# 37 "/usr/include/sys/socket.h" 2 3 4
struct osockaddr
{
unsigned short int sa_family;
unsigned char sa_data[14];
};
enum
{
SHUT_RD = 0,
SHUT_WR,
SHUT_RDWR
};
# 101 "/usr/include/sys/socket.h"
extern int socket (int __domain, int __type, int __protocol) __attribute__ ((__nothrow__));
extern int socketpair (int __domain, int __type, int __protocol,
int __fds[2]) __attribute__ ((__nothrow__));
extern int bind (int __fd, __const struct sockaddr * __addr, socklen_t __len)
__attribute__ ((__nothrow__));
extern int getsockname (int __fd, struct sockaddr *__restrict __addr,
socklen_t *__restrict __len) __attribute__ ((__nothrow__));
# 125 "/usr/include/sys/socket.h"
extern int connect (int __fd, __const struct sockaddr * __addr, socklen_t __len);
extern int getpeername (int __fd, struct sockaddr *__restrict __addr,
socklen_t *__restrict __len) __attribute__ ((__nothrow__));
# 137 "/usr/include/sys/socket.h"
extern ssize_t send (int __fd, __const void *__buf, size_t __n, int __flags);
extern ssize_t recv (int __fd, void *__buf, size_t __n, int __flags);
extern ssize_t sendto (int __fd, __const void *__buf, size_t __n,
int __flags, __const struct sockaddr * __addr,
socklen_t __addr_len);
# 162 "/usr/include/sys/socket.h"
extern ssize_t recvfrom (int __fd, void *__restrict __buf, size_t __n,
int __flags, struct sockaddr *__restrict __addr,
socklen_t *__restrict __addr_len);
# 172 "/usr/include/sys/socket.h"
extern ssize_t sendmsg (int __fd, __const struct msghdr *__message,
int __flags);
# 180 "/usr/include/sys/socket.h"
extern ssize_t recvmsg (int __fd, struct msghdr *__message, int __flags);
extern int getsockopt (int __fd, int __level, int __optname,
void *__restrict __optval,
socklen_t *__restrict __optlen) __attribute__ ((__nothrow__));
extern int setsockopt (int __fd, int __level, int __optname,
__const void *__optval, socklen_t __optlen) __attribute__ ((__nothrow__));
extern int listen (int __fd, int __n) __attribute__ ((__nothrow__));
# 210 "/usr/include/sys/socket.h"
extern int accept (int __fd, struct sockaddr *__restrict __addr,
socklen_t *__restrict __addr_len);
# 219 "/usr/include/sys/socket.h"
extern int shutdown (int __fd, int __how) __attribute__ ((__nothrow__));
extern int sockatmark (int __fd) __attribute__ ((__nothrow__));
# 232 "/usr/include/sys/socket.h"
extern int isfdtype (int __fd, int __fdtype) __attribute__ ((__nothrow__));
# 9 "clc.c" 2
# 1 "/usr/include/sys/poll.h" 1 3 4
# 26 "/usr/include/sys/poll.h"
# 1 "/usr/include/bits/poll.h" 1 3 4
# 27 "/usr/include/sys/poll.h" 2 3 4
# 37 "/usr/include/sys/poll.h"
typedef unsigned long int nfds_t;
struct pollfd
{
int fd;
short int events;
short int revents;
};
# 58 "/usr/include/sys/poll.h"
extern int poll (struct pollfd *__fds, nfds_t __nfds, int __timeout);
# 10 "clc.c" 2
# 1 "/usr/include/arpa/inet.h" 1 3 4
# 23 "/usr/include/arpa/inet.h"
# 1 "/usr/include/netinet/in.h" 1 3 4
# 24 "/usr/include/netinet/in.h"
# 1 "/usr/include/stdint.h" 1 3 4
# 27 "/usr/include/stdint.h"
# 1 "/usr/include/bits/wchar.h" 1 3 4
# 28 "/usr/include/stdint.h" 2 3 4
# 1 "/usr/include/bits/wordsize.h" 1 3 4
# 29 "/usr/include/stdint.h" 2 3 4
# 49 "/usr/include/stdint.h"
typedef unsigned char uint8_t;
typedef unsigned short int uint16_t;
typedef unsigned int uint32_t;
__extension__
typedef unsigned long long int uint64_t;
# 66 "/usr/include/stdint.h"
typedef signed char int_least8_t;
typedef short int int_least16_t;
typedef int int_least32_t;
__extension__
typedef long long int int_least64_t;
typedef unsigned char uint_least8_t;
typedef unsigned short int uint_least16_t;
typedef unsigned int uint_least32_t;
__extension__
typedef unsigned long long int uint_least64_t;
# 91 "/usr/include/stdint.h"
typedef signed char int_fast8_t;
typedef int int_fast16_t;
typedef int int_fast32_t;
__extension__
typedef long long int int_fast64_t;
typedef unsigned char uint_fast8_t;
typedef unsigned int uint_fast16_t;
typedef unsigned int uint_fast32_t;
__extension__
typedef unsigned long long int uint_fast64_t;
# 126 "/usr/include/stdint.h"
typedef int intptr_t;
typedef unsigned int uintptr_t;
# 138 "/usr/include/stdint.h"
__extension__
typedef long long int intmax_t;
__extension__
typedef unsigned long long int uintmax_t;
# 25 "/usr/include/netinet/in.h" 2 3 4
enum
{
IPPROTO_IP = 0,
IPPROTO_HOPOPTS = 0,
IPPROTO_ICMP = 1,
IPPROTO_IGMP = 2,
IPPROTO_IPIP = 4,
IPPROTO_TCP = 6,
IPPROTO_EGP = 8,
IPPROTO_PUP = 12,
IPPROTO_UDP = 17,
IPPROTO_IDP = 22,
IPPROTO_TP = 29,
IPPROTO_IPV6 = 41,
IPPROTO_ROUTING = 43,
IPPROTO_FRAGMENT = 44,
IPPROTO_RSVP = 46,
IPPROTO_GRE = 47,
IPPROTO_ESP = 50,
IPPROTO_AH = 51,
IPPROTO_ICMPV6 = 58,
IPPROTO_NONE = 59,
IPPROTO_DSTOPTS = 60,
IPPROTO_MTP = 92,
IPPROTO_ENCAP = 98,
IPPROTO_PIM = 103,
IPPROTO_COMP = 108,
IPPROTO_SCTP = 132,
IPPROTO_RAW = 255,
IPPROTO_MAX
};
typedef uint16_t in_port_t;
enum
{
IPPORT_ECHO = 7,
IPPORT_DISCARD = 9,
IPPORT_SYSTAT = 11,
IPPORT_DAYTIME = 13,
IPPORT_NETSTAT = 15,
IPPORT_FTP = 21,
IPPORT_TELNET = 23,
IPPORT_SMTP = 25,
IPPORT_TIMESERVER = 37,
IPPORT_NAMESERVER = 42,
IPPORT_WHOIS = 43,
IPPORT_MTP = 57,
IPPORT_TFTP = 69,
IPPORT_RJE = 77,
IPPORT_FINGER = 79,
IPPORT_TTYLINK = 87,
IPPORT_SUPDUP = 95,
IPPORT_EXECSERVER = 512,
IPPORT_LOGINSERVER = 513,
IPPORT_CMDSERVER = 514,
IPPORT_EFSSERVER = 520,
IPPORT_BIFFUDP = 512,
IPPORT_WHOSERVER = 513,
IPPORT_ROUTESERVER = 520,
IPPORT_RESERVED = 1024,
IPPORT_USERRESERVED = 5000
};
typedef uint32_t in_addr_t;
struct in_addr
{
in_addr_t s_addr;
};
# 194 "/usr/include/netinet/in.h"
struct in6_addr
{
union
{
uint8_t u6_addr8[16];
uint16_t u6_addr16[8];
uint32_t u6_addr32[4];
} in6_u;
};
extern const struct in6_addr in6addr_any;
extern const struct in6_addr in6addr_loopback;
# 217 "/usr/include/netinet/in.h"
struct sockaddr_in
{
sa_family_t sin_family;
in_port_t sin_port;
struct in_addr sin_addr;
unsigned char sin_zero[sizeof (struct sockaddr) -
(sizeof (unsigned short int)) -
sizeof (in_port_t) -
sizeof (struct in_addr)];
};
struct sockaddr_in6
{
sa_family_t sin6_family;
in_port_t sin6_port;
uint32_t sin6_flowinfo;
struct in6_addr sin6_addr;
uint32_t sin6_scope_id;
};
struct ip_mreq
{
struct in_addr imr_multiaddr;
struct in_addr imr_interface;
};
struct ip_mreq_source
{
struct in_addr imr_multiaddr;
struct in_addr imr_interface;
struct in_addr imr_sourceaddr;
};
struct ipv6_mreq
{
struct in6_addr ipv6mr_multiaddr;
unsigned int ipv6mr_interface;
};
struct group_req
{
uint32_t gr_interface;
struct sockaddr_storage gr_group;
};
struct group_source_req
{
uint32_t gsr_interface;
struct sockaddr_storage gsr_group;
struct sockaddr_storage gsr_source;
};
struct ip_msfilter
{
struct in_addr imsf_multiaddr;
struct in_addr imsf_interface;
uint32_t imsf_fmode;
uint32_t imsf_numsrc;
struct in_addr imsf_slist[1];
};
struct group_filter
{
uint32_t gf_interface;
struct sockaddr_storage gf_group;
uint32_t gf_fmode;
uint32_t gf_numsrc;
struct sockaddr_storage gf_slist[1];
};
# 343 "/usr/include/netinet/in.h"
# 1 "/usr/include/bits/in.h" 1 3 4
# 82 "/usr/include/bits/in.h"
struct ip_opts
{
struct in_addr ip_dst;
char ip_opts[40];
};
struct ip_mreqn
{
struct in_addr imr_multiaddr;
struct in_addr imr_address;
int imr_ifindex;
};
struct in_pktinfo
{
int ipi_ifindex;
struct in_addr ipi_spec_dst;
struct in_addr ipi_addr;
};
# 344 "/usr/include/netinet/in.h" 2 3 4
# 352 "/usr/include/netinet/in.h"
extern uint32_t ntohl (uint32_t __netlong) __attribute__ ((__nothrow__)) __attribute__ ((__const__));
extern uint16_t ntohs (uint16_t __netshort)
__attribute__ ((__nothrow__)) __attribute__ ((__const__));
extern uint32_t htonl (uint32_t __hostlong)
__attribute__ ((__nothrow__)) __attribute__ ((__const__));
extern uint16_t htons (uint16_t __hostshort)
__attribute__ ((__nothrow__)) __attribute__ ((__const__));
# 1 "/usr/include/bits/byteswap.h" 1 3 4
# 28 "/usr/include/bits/byteswap.h"
# 1 "/usr/include/bits/wordsize.h" 1 3 4
# 29 "/usr/include/bits/byteswap.h" 2 3 4
# 364 "/usr/include/netinet/in.h" 2 3 4
# 426 "/usr/include/netinet/in.h"
extern int bindresvport (int __sockfd, struct sockaddr_in *__sock_in) __attribute__ ((__nothrow__));
extern int bindresvport6 (int __sockfd, struct sockaddr_in6 *__sock_in)
__attribute__ ((__nothrow__));
# 454 "/usr/include/netinet/in.h"
struct in6_pktinfo
{
struct in6_addr ipi6_addr;
unsigned int ipi6_ifindex;
};
struct ip6_mtuinfo
{
struct sockaddr_in6 ip6m_addr;
uint32_t ip6m_mtu;
};
# 24 "/usr/include/arpa/inet.h" 2 3 4
# 35 "/usr/include/arpa/inet.h"
extern in_addr_t inet_addr (__const char *__cp) __attribute__ ((__nothrow__));
extern in_addr_t inet_lnaof (struct in_addr __in) __attribute__ ((__nothrow__));
extern struct in_addr inet_makeaddr (in_addr_t __net, in_addr_t __host)
__attribute__ ((__nothrow__));
extern in_addr_t inet_netof (struct in_addr __in) __attribute__ ((__nothrow__));
extern in_addr_t inet_network (__const char *__cp) __attribute__ ((__nothrow__));
extern char *inet_ntoa (struct in_addr __in) __attribute__ ((__nothrow__));
extern int inet_pton (int __af, __const char *__restrict __cp,
void *__restrict __buf) __attribute__ ((__nothrow__));
extern __const char *inet_ntop (int __af, __const void *__restrict __cp,
char *__restrict __buf, socklen_t __len)
__attribute__ ((__nothrow__));
extern int inet_aton (__const char *__cp, struct in_addr *__inp) __attribute__ ((__nothrow__));
extern char *inet_neta (in_addr_t __net, char *__buf, size_t __len) __attribute__ ((__nothrow__));
extern char *inet_net_ntop (int __af, __const void *__cp, int __bits,
char *__buf, size_t __len) __attribute__ ((__nothrow__));
extern int inet_net_pton (int __af, __const char *__cp,
void *__buf, size_t __len) __attribute__ ((__nothrow__));
extern unsigned int inet_nsap_addr (__const char *__cp,
unsigned char *__buf, int __len) __attribute__ ((__nothrow__));
extern char *inet_nsap_ntoa (int __len, __const unsigned char *__cp,
char *__buf) __attribute__ ((__nothrow__));
# 11 "clc.c" 2
# 1 "/usr/include/arpa/telnet.h" 1 3 4
# 68 "/usr/include/arpa/telnet.h"
extern char *telcmds[];
# 210 "/usr/include/arpa/telnet.h"
extern char *slc_names[];
# 270 "/usr/include/arpa/telnet.h"
extern char *authtype_names[];
# 305 "/usr/include/arpa/telnet.h"
extern char *encrypt_names[];
extern char *enctype_names[];
# 12 "clc.c" 2
# 1 "/usr/include/netdb.h" 1 3 4
# 33 "/usr/include/netdb.h"
# 1 "/usr/include/rpc/netdb.h" 1 3 4
# 46 "/usr/include/rpc/netdb.h"
struct rpcent
{
char *r_name;
char **r_aliases;
int r_number;
};
extern void setrpcent (int __stayopen) __attribute__ ((__nothrow__));
extern void endrpcent (void) __attribute__ ((__nothrow__));
extern struct rpcent *getrpcbyname (__const char *__name) __attribute__ ((__nothrow__));
extern struct rpcent *getrpcbynumber (int __number) __attribute__ ((__nothrow__));
extern struct rpcent *getrpcent (void) __attribute__ ((__nothrow__));
extern int getrpcbyname_r (__const char *__name, struct rpcent *__result_buf,
char *__buffer, size_t __buflen,
struct rpcent **__result) __attribute__ ((__nothrow__));
extern int getrpcbynumber_r (int __number, struct rpcent *__result_buf,
char *__buffer, size_t __buflen,
struct rpcent **__result) __attribute__ ((__nothrow__));
extern int getrpcent_r (struct rpcent *__result_buf, char *__buffer,
size_t __buflen, struct rpcent **__result) __attribute__ ((__nothrow__));
# 34 "/usr/include/netdb.h" 2 3 4
# 43 "/usr/include/netdb.h"
# 1 "/usr/include/bits/netdb.h" 1 3 4
# 27 "/usr/include/bits/netdb.h"
struct netent
{
char *n_name;
char **n_aliases;
int n_addrtype;
uint32_t n_net;
};
# 44 "/usr/include/netdb.h" 2 3 4
# 61 "/usr/include/netdb.h"
extern int *__h_errno_location (void) __attribute__ ((__nothrow__)) __attribute__ ((__const__));
# 88 "/usr/include/netdb.h"
extern void herror (__const char *__str) __attribute__ ((__nothrow__));
extern __const char *hstrerror (int __err_num) __attribute__ ((__nothrow__));
struct hostent
{
char *h_name;
char **h_aliases;
int h_addrtype;
int h_length;
char **h_addr_list;
};
extern void sethostent (int __stay_open);
extern void endhostent (void);
extern struct hostent *gethostent (void);
extern struct hostent *gethostbyaddr (__const void *__addr, __socklen_t __len,
int __type);
extern struct hostent *gethostbyname (__const char *__name);
# 149 "/usr/include/netdb.h"
extern struct hostent *gethostbyname2 (__const char *__name, int __af);
# 161 "/usr/include/netdb.h"
extern int gethostent_r (struct hostent *__restrict __result_buf,
char *__restrict __buf, size_t __buflen,
struct hostent **__restrict __result,
int *__restrict __h_errnop);
extern int gethostbyaddr_r (__const void *__restrict __addr, __socklen_t __len,
int __type,
struct hostent *__restrict __result_buf,
char *__restrict __buf, size_t __buflen,
struct hostent **__restrict __result,
int *__restrict __h_errnop);
extern int gethostbyname_r (__const char *__restrict __name,
struct hostent *__restrict __result_buf,
char *__restrict __buf, size_t __buflen,
struct hostent **__restrict __result,
int *__restrict __h_errnop);
extern int gethostbyname2_r (__const char *__restrict __name, int __af,
struct hostent *__restrict __result_buf,
char *__restrict __buf, size_t __buflen,
struct hostent **__restrict __result,
int *__restrict __h_errnop);
# 192 "/usr/include/netdb.h"
extern void setnetent (int __stay_open);
extern void endnetent (void);
extern struct netent *getnetent (void);
extern struct netent *getnetbyaddr (uint32_t __net, int __type);
extern struct netent *getnetbyname (__const char *__name);
# 231 "/usr/include/netdb.h"
extern int getnetent_r (struct netent *__restrict __result_buf,
char *__restrict __buf, size_t __buflen,
struct netent **__restrict __result,
int *__restrict __h_errnop);
extern int getnetbyaddr_r (uint32_t __net, int __type,
struct netent *__restrict __result_buf,
char *__restrict __buf, size_t __buflen,
struct netent **__restrict __result,
int *__restrict __h_errnop);
extern int getnetbyname_r (__const char *__restrict __name,
struct netent *__restrict __result_buf,
char *__restrict __buf, size_t __buflen,
struct netent **__restrict __result,
int *__restrict __h_errnop);
struct servent
{
char *s_name;
char **s_aliases;
int s_port;
char *s_proto;
};
extern void setservent (int __stay_open);
extern void endservent (void);
extern struct servent *getservent (void);
extern struct servent *getservbyname (__const char *__name,
__const char *__proto);
# 292 "/usr/include/netdb.h"
extern struct servent *getservbyport (int __port, __const char *__proto);
# 303 "/usr/include/netdb.h"
extern int getservent_r (struct servent *__restrict __result_buf,
char *__restrict __buf, size_t __buflen,
struct servent **__restrict __result);
extern int getservbyname_r (__const char *__restrict __name,
__const char *__restrict __proto,
struct servent *__restrict __result_buf,
char *__restrict __buf, size_t __buflen,
struct servent **__restrict __result);
extern int getservbyport_r (int __port, __const char *__restrict __proto,
struct servent *__restrict __result_buf,
char *__restrict __buf, size_t __buflen,
struct servent **__restrict __result);
struct protoent
{
char *p_name;
char **p_aliases;
int p_proto;
};
# 333 "/usr/include/netdb.h"
extern void setprotoent (int __stay_open);
extern void endprotoent (void);
extern struct protoent *getprotoent (void);
extern struct protoent *getprotobyname (__const char *__name);
extern struct protoent *getprotobynumber (int __proto);
# 369 "/usr/include/netdb.h"
extern int getprotoent_r (struct protoent *__restrict __result_buf,
char *__restrict __buf, size_t __buflen,
struct protoent **__restrict __result);
extern int getprotobyname_r (__const char *__restrict __name,
struct protoent *__restrict __result_buf,
char *__restrict __buf, size_t __buflen,
struct protoent **__restrict __result);
extern int getprotobynumber_r (int __proto,
struct protoent *__restrict __result_buf,
char *__restrict __buf, size_t __buflen,
struct protoent **__restrict __result);
# 390 "/usr/include/netdb.h"
extern int setnetgrent (__const char *__netgroup);
# 398 "/usr/include/netdb.h"
extern void endnetgrent (void);
# 407 "/usr/include/netdb.h"
extern int getnetgrent (char **__restrict __hostp,
char **__restrict __userp,
char **__restrict __domainp);
# 418 "/usr/include/netdb.h"
extern int innetgr (__const char *__netgroup, __const char *__host,
__const char *__user, __const char *domain);
# 427 "/usr/include/netdb.h"
extern int getnetgrent_r (char **__restrict __hostp,
char **__restrict __userp,
char **__restrict __domainp,
char *__restrict __buffer, size_t __buflen);
# 446 "/usr/include/netdb.h"
extern int rcmd (char **__restrict __ahost, unsigned short int __rport,
__const char *__restrict __locuser,
__const char *__restrict __remuser,
__const char *__restrict __cmd, int *__restrict __fd2p);
# 458 "/usr/include/netdb.h"
extern int rcmd_af (char **__restrict __ahost, unsigned short int __rport,
__const char *__restrict __locuser,
__const char *__restrict __remuser,
__const char *__restrict __cmd, int *__restrict __fd2p,
sa_family_t __af);
# 474 "/usr/include/netdb.h"
extern int rexec (char **__restrict __ahost, int __rport,
__const char *__restrict __name,
__const char *__restrict __pass,
__const char *__restrict __cmd, int *__restrict __fd2p);
# 486 "/usr/include/netdb.h"
extern int rexec_af (char **__restrict __ahost, int __rport,
__const char *__restrict __name,
__const char *__restrict __pass,
__const char *__restrict __cmd, int *__restrict __fd2p,
sa_family_t __af);
# 500 "/usr/include/netdb.h"
extern int ruserok (__const char *__rhost, int __suser,
__const char *__remuser, __const char *__locuser);
# 510 "/usr/include/netdb.h"
extern int ruserok_af (__const char *__rhost, int __suser,
__const char *__remuser, __const char *__locuser,
sa_family_t __af);
# 522 "/usr/include/netdb.h"
extern int rresvport (int *__alport);
# 531 "/usr/include/netdb.h"
extern int rresvport_af (int *__alport, sa_family_t __af);
struct addrinfo
{
int ai_flags;
int ai_family;
int ai_socktype;
int ai_protocol;
socklen_t ai_addrlen;
struct sockaddr *ai_addr;
char *ai_canonname;
struct addrinfo *ai_next;
};
# 631 "/usr/include/netdb.h"
extern int getaddrinfo (__const char *__restrict __name,
__const char *__restrict __service,
__const struct addrinfo *__restrict __req,
struct addrinfo **__restrict __pai);
extern void freeaddrinfo (struct addrinfo *__ai) __attribute__ ((__nothrow__));
extern __const char *gai_strerror (int __ecode) __attribute__ ((__nothrow__));
extern int getnameinfo (__const struct sockaddr *__restrict __sa,
socklen_t __salen, char *__restrict __host,
socklen_t __hostlen, char *__restrict __serv,
socklen_t __servlen, unsigned int __flags);
# 14 "clc.c" 2
# 1 "/usr/include/linux/signal.h" 1 3 4
# 1 "/usr/include/asm/signal.h" 1 3 4
# 9 "/usr/include/asm/signal.h"
struct siginfo;
typedef unsigned long sigset_t;
# 95 "/usr/include/asm/signal.h"
# 1 "/usr/include/asm-generic/signal.h" 1 3 4
# 16 "/usr/include/asm-generic/signal.h"
typedef void __signalfn_t(int);
typedef __signalfn_t *__sighandler_t;
typedef void __restorefn_t(void);
typedef __restorefn_t *__sigrestore_t;
# 96 "/usr/include/asm/signal.h" 2 3 4
struct sigaction {
union {
__sighandler_t _sa_handler;
void (*_sa_sigaction)(int, struct siginfo *, void *);
} _u;
sigset_t sa_mask;
unsigned long sa_flags;
void (*sa_restorer)(void);
};
# 130 "/usr/include/asm/signal.h"
typedef struct sigaltstack {
void *ss_sp;
int ss_flags;
size_t ss_size;
} stack_t;
# 5 "/usr/include/linux/signal.h" 2 3 4
# 1 "/usr/include/asm/siginfo.h" 1 3 4
# 1 "/usr/include/asm-generic/siginfo.h" 1 3 4
typedef union sigval {
int sival_int;
void *sival_ptr;
} sigval_t;
# 39 "/usr/include/asm-generic/siginfo.h"
typedef struct siginfo {
int si_signo;
int si_errno;
int si_code;
union {
int _pad[((128 - (3 * sizeof(int))) / sizeof(int))];
struct {
pid_t _pid;
uid_t _uid;
} _kill;
struct {
timer_t _tid;
int _overrun;
char _pad[sizeof( uid_t) - sizeof(int)];
sigval_t _sigval;
int _sys_private;
} _timer;
struct {
pid_t _pid;
uid_t _uid;
sigval_t _sigval;
} _rt;
struct {
pid_t _pid;
uid_t _uid;
int _status;
clock_t _utime;
clock_t _stime;
} _sigchld;
struct {
void *_addr;
} _sigfault;
struct {
long _band;
int _fd;
} _sigpoll;
} _sifields;
} siginfo_t;
# 238 "/usr/include/asm-generic/siginfo.h"
typedef struct sigevent {
sigval_t sigev_value;
int sigev_signo;
int sigev_notify;
union {
int _pad[((64 - (sizeof(int) * 2 + sizeof(sigval_t))) / sizeof(int))];
int _tid;
struct {
void (*_function)(sigval_t);
void *_attribute;
} _sigev_thread;
} _sigev_un;
} sigevent_t;
# 9 "/usr/include/asm/siginfo.h" 2 3 4
# 6 "/usr/include/linux/signal.h" 2 3 4
# 15 "clc.c" 2
# 1 "/usr/include/stdlib.h" 1 3 4
# 98 "/usr/include/stdlib.h"
typedef struct
{
int quot;
int rem;
} div_t;
typedef struct
{
long int quot;
long int rem;
} ldiv_t;
# 118 "/usr/include/stdlib.h"
__extension__ typedef struct
{
long long int quot;
long long int rem;
} lldiv_t;
# 140 "/usr/include/stdlib.h"
extern size_t __ctype_get_mb_cur_max (void) __attribute__ ((__nothrow__)) ;
extern double atof (__const char *__nptr)
__attribute__ ((__nothrow__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))) ;
extern int atoi (__const char *__nptr)
__attribute__ ((__nothrow__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))) ;
extern long int atol (__const char *__nptr)
__attribute__ ((__nothrow__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))) ;
__extension__ extern long long int atoll (__const char *__nptr)
__attribute__ ((__nothrow__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))) ;
extern double strtod (__const char *__restrict __nptr,
char **__restrict __endptr)
__attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1))) ;
extern float strtof (__const char *__restrict __nptr,
char **__restrict __endptr) __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1))) ;
extern long double strtold (__const char *__restrict __nptr,
char **__restrict __endptr)
__attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1))) ;
extern long int strtol (__const char *__restrict __nptr,
char **__restrict __endptr, int __base)
__attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1))) ;
extern unsigned long int strtoul (__const char *__restrict __nptr,
char **__restrict __endptr, int __base)
__attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1))) ;
__extension__
extern long long int strtoq (__const char *__restrict __nptr,
char **__restrict __endptr, int __base)
__attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1))) ;
__extension__
extern unsigned long long int strtouq (__const char *__restrict __nptr,
char **__restrict __endptr, int __base)
__attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1))) ;
__extension__
extern long long int strtoll (__const char *__restrict __nptr,
char **__restrict __endptr, int __base)
__attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1))) ;
__extension__
extern unsigned long long int strtoull (__const char *__restrict __nptr,
char **__restrict __endptr, int __base)
__attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1))) ;
# 311 "/usr/include/stdlib.h"
extern char *l64a (long int __n) __attribute__ ((__nothrow__)) ;
extern long int a64l (__const char *__s)
__attribute__ ((__nothrow__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))) ;
# 327 "/usr/include/stdlib.h"
extern long int random (void) __attribute__ ((__nothrow__));
extern void srandom (unsigned int __seed) __attribute__ ((__nothrow__));
extern char *initstate (unsigned int __seed, char *__statebuf,
size_t __statelen) __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (2)));
extern char *setstate (char *__statebuf) __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
# 349 "/usr/include/stdlib.h"
struct random_data
{
int32_t *fptr;
int32_t *rptr;
int32_t *state;
int rand_type;
int rand_deg;
int rand_sep;
int32_t *end_ptr;
};
extern int random_r (struct random_data *__restrict __buf,
int32_t *__restrict __result) __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1, 2)));
extern int srandom_r (unsigned int __seed, struct random_data *__buf)
__attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (2)));
extern int initstate_r (unsigned int __seed, char *__restrict __statebuf,
size_t __statelen,
struct random_data *__restrict __buf)
__attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (2, 4)));
extern int setstate_r (char *__restrict __statebuf,
struct random_data *__restrict __buf)
__attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1, 2)));
extern int rand (void) __attribute__ ((__nothrow__));
extern void srand (unsigned int __seed) __attribute__ ((__nothrow__));
extern int rand_r (unsigned int *__seed) __attribute__ ((__nothrow__));
# 395 "/usr/include/stdlib.h"
extern double drand48 (void) __attribute__ ((__nothrow__));
extern double erand48 (unsigned short int __xsubi[3]) __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
extern long int lrand48 (void) __attribute__ ((__nothrow__));
extern long int nrand48 (unsigned short int __xsubi[3])
__attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
extern long int mrand48 (void) __attribute__ ((__nothrow__));
extern long int jrand48 (unsigned short int __xsubi[3])
__attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
extern void srand48 (long int __seedval) __attribute__ ((__nothrow__));
extern unsigned short int *seed48 (unsigned short int __seed16v[3])
__attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
extern void lcong48 (unsigned short int __param[7]) __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
struct drand48_data
{
unsigned short int __x[3];
unsigned short int __old_x[3];
unsigned short int __c;
unsigned short int __init;
unsigned long long int __a;
};
extern int drand48_r (struct drand48_data *__restrict __buffer,
double *__restrict __result) __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1, 2)));
extern int erand48_r (unsigned short int __xsubi[3],
struct drand48_data *__restrict __buffer,
double *__restrict __result) __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1, 2)));
extern int lrand48_r (struct drand48_data *__restrict __buffer,
long int *__restrict __result)
__attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1, 2)));
extern int nrand48_r (unsigned short int __xsubi[3],
struct drand48_data *__restrict __buffer,
long int *__restrict __result)
__attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1, 2)));
extern int mrand48_r (struct drand48_data *__restrict __buffer,
long int *__restrict __result)
__attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1, 2)));
extern int jrand48_r (unsigned short int __xsubi[3],
struct drand48_data *__restrict __buffer,
long int *__restrict __result)
__attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1, 2)));
extern int srand48_r (long int __seedval, struct drand48_data *__buffer)
__attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (2)));
extern int seed48_r (unsigned short int __seed16v[3],
struct drand48_data *__buffer) __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1, 2)));
extern int lcong48_r (unsigned short int __param[7],
struct drand48_data *__buffer)
__attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1, 2)));
# 471 "/usr/include/stdlib.h"
extern void *malloc (size_t __size) __attribute__ ((__nothrow__)) __attribute__ ((__malloc__)) ;
extern void *calloc (size_t __nmemb, size_t __size)
__attribute__ ((__nothrow__)) __attribute__ ((__malloc__)) ;
# 485 "/usr/include/stdlib.h"
extern void *realloc (void *__ptr, size_t __size)
__attribute__ ((__nothrow__)) __attribute__ ((__warn_unused_result__));
extern void free (void *__ptr) __attribute__ ((__nothrow__));
extern void cfree (void *__ptr) __attribute__ ((__nothrow__));
# 1 "/usr/include/alloca.h" 1 3 4
# 33 "/usr/include/alloca.h"
extern void *alloca (size_t __size) __attribute__ ((__nothrow__));
# 498 "/usr/include/stdlib.h" 2 3 4
extern void *valloc (size_t __size) __attribute__ ((__nothrow__)) __attribute__ ((__malloc__)) ;
extern int posix_memalign (void **__memptr, size_t __alignment, size_t __size)
__attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1))) ;
extern void abort (void) __attribute__ ((__nothrow__)) __attribute__ ((__noreturn__));
extern int atexit (void (*__func) (void)) __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
extern int on_exit (void (*__func) (int __status, void *__arg), void *__arg)
__attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
# 531 "/usr/include/stdlib.h"
extern void exit (int __status) __attribute__ ((__nothrow__)) __attribute__ ((__noreturn__));
extern void _Exit (int __status) __attribute__ ((__nothrow__)) __attribute__ ((__noreturn__));
extern char *getenv (__const char *__name) __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1))) ;
extern char *__secure_getenv (__const char *__name)
__attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1))) ;
extern int putenv (char *__string) __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
extern int setenv (__const char *__name, __const char *__value, int __replace)
__attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (2)));
extern int unsetenv (__const char *__name) __attribute__ ((__nothrow__));
extern int clearenv (void) __attribute__ ((__nothrow__));
# 583 "/usr/include/stdlib.h"
extern char *mktemp (char *__template) __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1))) ;
# 594 "/usr/include/stdlib.h"
extern int mkstemp (char *__template) __attribute__ ((__nonnull__ (1))) ;
# 614 "/usr/include/stdlib.h"
extern char *mkdtemp (char *__template) __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1))) ;
# 645 "/usr/include/stdlib.h"
extern int system (__const char *__command) ;
# 662 "/usr/include/stdlib.h"
extern char *realpath (__const char *__restrict __name,
char *__restrict __resolved) __attribute__ ((__nothrow__)) ;
# 670 "/usr/include/stdlib.h"
typedef int (*__compar_fn_t) (__const void *, __const void *);
# 680 "/usr/include/stdlib.h"
extern void *bsearch (__const void *__key, __const void *__base,
size_t __nmemb, size_t __size, __compar_fn_t __compar)
__attribute__ ((__nonnull__ (1, 2, 5))) ;
extern void qsort (void *__base, size_t __nmemb, size_t __size,
__compar_fn_t __compar) __attribute__ ((__nonnull__ (1, 4)));
extern int abs (int __x) __attribute__ ((__nothrow__)) __attribute__ ((__const__)) ;
extern long int labs (long int __x) __attribute__ ((__nothrow__)) __attribute__ ((__const__)) ;
__extension__ extern long long int llabs (long long int __x)
__attribute__ ((__nothrow__)) __attribute__ ((__const__)) ;
# 705 "/usr/include/stdlib.h"
extern div_t div (int __numer, int __denom)
__attribute__ ((__nothrow__)) __attribute__ ((__const__)) ;
extern ldiv_t ldiv (long int __numer, long int __denom)
__attribute__ ((__nothrow__)) __attribute__ ((__const__)) ;
__extension__ extern lldiv_t lldiv (long long int __numer,
long long int __denom)
__attribute__ ((__nothrow__)) __attribute__ ((__const__)) ;
# 727 "/usr/include/stdlib.h"
extern char *ecvt (double __value, int __ndigit, int *__restrict __decpt,
int *__restrict __sign) __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (3, 4))) ;
extern char *fcvt (double __value, int __ndigit, int *__restrict __decpt,
int *__restrict __sign) __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (3, 4))) ;
extern char *gcvt (double __value, int __ndigit, char *__buf)
__attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (3))) ;
extern char *qecvt (long double __value, int __ndigit,
int *__restrict __decpt, int *__restrict __sign)
__attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (3, 4))) ;
extern char *qfcvt (long double __value, int __ndigit,
int *__restrict __decpt, int *__restrict __sign)
__attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (3, 4))) ;
extern char *qgcvt (long double __value, int __ndigit, char *__buf)
__attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (3))) ;
extern int ecvt_r (double __value, int __ndigit, int *__restrict __decpt,
int *__restrict __sign, char *__restrict __buf,
size_t __len) __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (3, 4, 5)));
extern int fcvt_r (double __value, int __ndigit, int *__restrict __decpt,
int *__restrict __sign, char *__restrict __buf,
size_t __len) __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (3, 4, 5)));
extern int qecvt_r (long double __value, int __ndigit,
int *__restrict __decpt, int *__restrict __sign,
char *__restrict __buf, size_t __len)
__attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (3, 4, 5)));
extern int qfcvt_r (long double __value, int __ndigit,
int *__restrict __decpt, int *__restrict __sign,
char *__restrict __buf, size_t __len)
__attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (3, 4, 5)));
# 779 "/usr/include/stdlib.h"
extern int mblen (__const char *__s, size_t __n) __attribute__ ((__nothrow__)) ;
extern int mbtowc (wchar_t *__restrict __pwc,
__const char *__restrict __s, size_t __n) __attribute__ ((__nothrow__)) ;
extern int wctomb (char *__s, wchar_t __wchar) __attribute__ ((__nothrow__)) ;
extern size_t mbstowcs (wchar_t *__restrict __pwcs,
__const char *__restrict __s, size_t __n) __attribute__ ((__nothrow__));
extern size_t wcstombs (char *__restrict __s,
__const wchar_t *__restrict __pwcs, size_t __n)
__attribute__ ((__nothrow__));
# 804 "/usr/include/stdlib.h"
extern int rpmatch (__const char *__response) __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1))) ;
# 832 "/usr/include/stdlib.h"
extern int posix_openpt (int __oflag) ;
# 867 "/usr/include/stdlib.h"
extern int getloadavg (double __loadavg[], int __nelem)
__attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
# 16 "clc.c" 2
# 1 "/usr/include/linux/errno.h" 1 3 4
# 1 "/usr/include/asm/errno.h" 1 3 4
# 1 "/usr/include/asm-generic/errno.h" 1 3 4
# 1 "/usr/include/asm-generic/errno-base.h" 1 3 4
# 5 "/usr/include/asm-generic/errno.h" 2 3 4
# 3 "/usr/include/asm/errno.h" 2 3 4
# 5 "/usr/include/linux/errno.h" 2 3 4
# 17 "clc.c" 2
# 1 "/usr/include/linux/string.h" 1 3 4
# 1 "/usr/include/linux/string.h" 1 3 4
# 7 "/usr/include/linux/string.h" 2 3 4
# 18 "clc.c" 2
# 1 "/usr/include/ctype.h" 1 3 4
# 48 "/usr/include/ctype.h"
enum
{
_ISupper = ((0) < 8 ? ((1 << (0)) << 8) : ((1 << (0)) >> 8)),
_ISlower = ((1) < 8 ? ((1 << (1)) << 8) : ((1 << (1)) >> 8)),
_ISalpha = ((2) < 8 ? ((1 << (2)) << 8) : ((1 << (2)) >> 8)),
_ISdigit = ((3) < 8 ? ((1 << (3)) << 8) : ((1 << (3)) >> 8)),
_ISxdigit = ((4) < 8 ? ((1 << (4)) << 8) : ((1 << (4)) >> 8)),
_ISspace = ((5) < 8 ? ((1 << (5)) << 8) : ((1 << (5)) >> 8)),
_ISprint = ((6) < 8 ? ((1 << (6)) << 8) : ((1 << (6)) >> 8)),
_ISgraph = ((7) < 8 ? ((1 << (7)) << 8) : ((1 << (7)) >> 8)),
_ISblank = ((8) < 8 ? ((1 << (8)) << 8) : ((1 << (8)) >> 8)),
_IScntrl = ((9) < 8 ? ((1 << (9)) << 8) : ((1 << (9)) >> 8)),
_ISpunct = ((10) < 8 ? ((1 << (10)) << 8) : ((1 << (10)) >> 8)),
_ISalnum = ((11) < 8 ? ((1 << (11)) << 8) : ((1 << (11)) >> 8))
};
# 81 "/usr/include/ctype.h"
extern __const unsigned short int **__ctype_b_loc (void)
__attribute__ ((__const));
extern __const __int32_t **__ctype_tolower_loc (void)
__attribute__ ((__const));
extern __const __int32_t **__ctype_toupper_loc (void)
__attribute__ ((__const));
# 102 "/usr/include/ctype.h"
extern int isalnum (int) __attribute__ ((__nothrow__));
extern int isalpha (int) __attribute__ ((__nothrow__));
extern int iscntrl (int) __attribute__ ((__nothrow__));
extern int isdigit (int) __attribute__ ((__nothrow__));
extern int islower (int) __attribute__ ((__nothrow__));
extern int isgraph (int) __attribute__ ((__nothrow__));
extern int isprint (int) __attribute__ ((__nothrow__));
extern int ispunct (int) __attribute__ ((__nothrow__));
extern int isspace (int) __attribute__ ((__nothrow__));
extern int isupper (int) __attribute__ ((__nothrow__));
extern int isxdigit (int) __attribute__ ((__nothrow__));
extern int tolower (int __c) __attribute__ ((__nothrow__));
extern int toupper (int __c) __attribute__ ((__nothrow__));
# 128 "/usr/include/ctype.h"
extern int isblank (int) __attribute__ ((__nothrow__));
# 142 "/usr/include/ctype.h"
extern int isascii (int __c) __attribute__ ((__nothrow__));
extern int toascii (int __c) __attribute__ ((__nothrow__));
extern int _toupper (int) __attribute__ ((__nothrow__));
extern int _tolower (int) __attribute__ ((__nothrow__));
# 19 "clc.c" 2
# 1 "/usr/include/termio.h" 1 3 4
# 1 "/usr/include/linux/termios.h" 1 3 4
# 1 "/usr/include/asm/termios.h" 1 3 4
# 1 "/usr/include/asm/termbits.h" 1 3 4
typedef unsigned char cc_t;
typedef unsigned int speed_t;
typedef unsigned int tcflag_t;
struct termios {
tcflag_t c_iflag;
tcflag_t c_oflag;
tcflag_t c_cflag;
tcflag_t c_lflag;
cc_t c_line;
cc_t c_cc[19];
};
struct termios2 {
tcflag_t c_iflag;
tcflag_t c_oflag;
tcflag_t c_cflag;
tcflag_t c_lflag;
cc_t c_line;
cc_t c_cc[19];
speed_t c_ispeed;
speed_t c_ospeed;
};
struct ktermios {
tcflag_t c_iflag;
tcflag_t c_oflag;
tcflag_t c_cflag;
tcflag_t c_lflag;
cc_t c_line;
cc_t c_cc[19];
speed_t c_ispeed;
speed_t c_ospeed;
};
# 5 "/usr/include/asm/termios.h" 2 3 4
# 1 "/usr/include/asm/ioctls.h" 1 3 4
# 1 "/usr/include/asm/ioctl.h" 1 3 4
# 1 "/usr/include/asm-generic/ioctl.h" 1 3 4
# 51 "/usr/include/asm-generic/ioctl.h"
extern unsigned int __invalid_size_argument_for_IOC;
# 3 "/usr/include/asm/ioctl.h" 2 3 4
# 5 "/usr/include/asm/ioctls.h" 2 3 4
# 6 "/usr/include/asm/termios.h" 2 3 4
struct winsize {
unsigned short ws_row;
unsigned short ws_col;
unsigned short ws_xpixel;
unsigned short ws_ypixel;
};
struct termio {
unsigned short c_iflag;
unsigned short c_oflag;
unsigned short c_cflag;
unsigned short c_lflag;
unsigned char c_line;
unsigned char c_cc[8];
};
# 6 "/usr/include/linux/termios.h" 2 3 4
# 6 "/usr/include/termio.h" 2 3 4
# 1 "/usr/include/sys/ioctl.h" 1 3 4
# 27 "/usr/include/sys/ioctl.h"
# 1 "/usr/include/bits/ioctls.h" 1 3 4
# 28 "/usr/include/sys/ioctl.h" 2 3 4
# 1 "/usr/include/bits/ioctl-types.h" 1 3 4
# 28 "/usr/include/bits/ioctl-types.h"
struct winsize
{
unsigned short int ws_row;
unsigned short int ws_col;
unsigned short int ws_xpixel;
unsigned short int ws_ypixel;
};
struct termio
{
unsigned short int c_iflag;
unsigned short int c_oflag;
unsigned short int c_cflag;
unsigned short int c_lflag;
unsigned char c_line;
unsigned char c_cc[8];
};
# 31 "/usr/include/sys/ioctl.h" 2 3 4
# 1 "/usr/include/sys/ttydefaults.h" 1 3 4
# 38 "/usr/include/sys/ioctl.h" 2 3 4
extern int ioctl (int __fd, unsigned long int __request, ...) __attribute__ ((__nothrow__));
# 8 "/usr/include/termio.h" 2 3 4
# 20 "clc.c" 2
# 1 "/usr/include/ncurses.h" 1 3 4
# 66 "/usr/include/ncurses.h"
# 1 "/usr/include/ncurses_dll.h" 1 3 4
# 67 "/usr/include/ncurses.h" 2 3 4
# 136 "/usr/include/ncurses.h"
typedef unsigned long chtype;
typedef unsigned long mmask_t;
# 1 "/usr/include/stdio.h" 1 3 4
# 45 "/usr/include/stdio.h"
struct _IO_FILE;
typedef struct _IO_FILE FILE;
# 65 "/usr/include/stdio.h"
typedef struct _IO_FILE __FILE;
# 75 "/usr/include/stdio.h"
# 1 "/usr/include/libio.h" 1 3 4
# 32 "/usr/include/libio.h"
# 1 "/usr/include/_G_config.h" 1 3 4
# 20 "/usr/include/_G_config.h"
# 1 "/usr/include/wchar.h" 1 3 4
# 78 "/usr/include/wchar.h"
typedef struct
{
int __count;
union
{
int __wch;
char __wchb[4];
} __value;
} __mbstate_t;
# 21 "/usr/include/_G_config.h" 2 3 4
typedef struct
{
__off_t __pos;
__mbstate_t __state;
} _G_fpos_t;
typedef struct
{
__off64_t __pos;
__mbstate_t __state;
} _G_fpos64_t;
# 53 "/usr/include/_G_config.h"
typedef int _G_int16_t __attribute__ ((__mode__ (__HI__)));
typedef int _G_int32_t __attribute__ ((__mode__ (__SI__)));
typedef unsigned int _G_uint16_t __attribute__ ((__mode__ (__HI__)));
typedef unsigned int _G_uint32_t __attribute__ ((__mode__ (__SI__)));
# 33 "/usr/include/libio.h" 2 3 4
# 170 "/usr/include/libio.h"
struct _IO_jump_t; struct _IO_FILE;
# 180 "/usr/include/libio.h"
typedef void _IO_lock_t;
struct _IO_marker {
struct _IO_marker *_next;
struct _IO_FILE *_sbuf;
int _pos;
# 203 "/usr/include/libio.h"
};
enum __codecvt_result
{
__codecvt_ok,
__codecvt_partial,
__codecvt_error,
__codecvt_noconv
};
# 271 "/usr/include/libio.h"
struct _IO_FILE {
int _flags;
char* _IO_read_ptr;
char* _IO_read_end;
char* _IO_read_base;
char* _IO_write_base;
char* _IO_write_ptr;
char* _IO_write_end;
char* _IO_buf_base;
char* _IO_buf_end;
char *_IO_save_base;
char *_IO_backup_base;
char *_IO_save_end;
struct _IO_marker *_markers;
struct _IO_FILE *_chain;
int _fileno;
int _flags2;
__off_t _old_offset;
unsigned short _cur_column;
signed char _vtable_offset;
char _shortbuf[1];
_IO_lock_t *_lock;
# 319 "/usr/include/libio.h"
__off64_t _offset;
# 328 "/usr/include/libio.h"
void *__pad1;
void *__pad2;
void *__pad3;
void *__pad4;
size_t __pad5;
int _mode;
char _unused2[15 * sizeof (int) - 4 * sizeof (void *) - sizeof (size_t)];
};
typedef struct _IO_FILE _IO_FILE;
struct _IO_FILE_plus;
extern struct _IO_FILE_plus _IO_2_1_stdin_;
extern struct _IO_FILE_plus _IO_2_1_stdout_;
extern struct _IO_FILE_plus _IO_2_1_stderr_;
# 364 "/usr/include/libio.h"
typedef __ssize_t __io_read_fn (void *__cookie, char *__buf, size_t __nbytes);
# 372 "/usr/include/libio.h"
typedef __ssize_t __io_write_fn (void *__cookie, __const char *__buf,
size_t __n);
# 381 "/usr/include/libio.h"
typedef int __io_seek_fn (void *__cookie, __off64_t *__pos, int __w);
typedef int __io_close_fn (void *__cookie);
# 416 "/usr/include/libio.h"
extern int __underflow (_IO_FILE *);
extern int __uflow (_IO_FILE *);
extern int __overflow (_IO_FILE *, int);
# 458 "/usr/include/libio.h"
extern int _IO_getc (_IO_FILE *__fp);
extern int _IO_putc (int __c, _IO_FILE *__fp);
extern int _IO_feof (_IO_FILE *__fp) __attribute__ ((__nothrow__));
extern int _IO_ferror (_IO_FILE *__fp) __attribute__ ((__nothrow__));
extern int _IO_peekc_locked (_IO_FILE *__fp);
extern void _IO_flockfile (_IO_FILE *) __attribute__ ((__nothrow__));
extern void _IO_funlockfile (_IO_FILE *) __attribute__ ((__nothrow__));
extern int _IO_ftrylockfile (_IO_FILE *) __attribute__ ((__nothrow__));
# 488 "/usr/include/libio.h"
extern int _IO_vfscanf (_IO_FILE * __restrict, const char * __restrict,
__gnuc_va_list, int *__restrict);
extern int _IO_vfprintf (_IO_FILE *__restrict, const char *__restrict,
__gnuc_va_list);
extern __ssize_t _IO_padn (_IO_FILE *, int, __ssize_t);
extern size_t _IO_sgetn (_IO_FILE *, void *, size_t);
extern __off64_t _IO_seekoff (_IO_FILE *, __off64_t, int, int);
extern __off64_t _IO_seekpos (_IO_FILE *, __off64_t, int);
extern void _IO_free_backup_area (_IO_FILE *) __attribute__ ((__nothrow__));
# 76 "/usr/include/stdio.h" 2 3 4
# 91 "/usr/include/stdio.h"
typedef _G_fpos_t fpos_t;
# 141 "/usr/include/stdio.h"
# 1 "/usr/include/bits/stdio_lim.h" 1 3 4
# 142 "/usr/include/stdio.h" 2 3 4
extern struct _IO_FILE *stdin;
extern struct _IO_FILE *stdout;
extern struct _IO_FILE *stderr;
# 155 "/usr/include/stdio.h"
extern int remove (__const char *__filename) __attribute__ ((__nothrow__));
extern int rename (__const char *__old, __const char *__new) __attribute__ ((__nothrow__));
# 172 "/usr/include/stdio.h"
extern FILE *tmpfile (void) ;
# 186 "/usr/include/stdio.h"
extern char *tmpnam (char *__s) __attribute__ ((__nothrow__)) ;
extern char *tmpnam_r (char *__s) __attribute__ ((__nothrow__)) ;
# 204 "/usr/include/stdio.h"
extern char *tempnam (__const char *__dir, __const char *__pfx)
__attribute__ ((__nothrow__)) __attribute__ ((__malloc__)) ;
# 214 "/usr/include/stdio.h"
extern int fclose (FILE *__stream);
extern int fflush (FILE *__stream);
# 229 "/usr/include/stdio.h"
extern int fflush_unlocked (FILE *__stream);
# 249 "/usr/include/stdio.h"
extern FILE *fopen (__const char *__restrict __filename,
__const char *__restrict __modes) ;
extern FILE *freopen (__const char *__restrict __filename,
__const char *__restrict __modes,
FILE *__restrict __stream) ;
# 283 "/usr/include/stdio.h"
extern FILE *fdopen (int __fd, __const char *__modes) __attribute__ ((__nothrow__)) ;
# 307 "/usr/include/stdio.h"
extern void setbuf (FILE *__restrict __stream, char *__restrict __buf) __attribute__ ((__nothrow__));
extern int setvbuf (FILE *__restrict __stream, char *__restrict __buf,
int __modes, size_t __n) __attribute__ ((__nothrow__));
extern void setbuffer (FILE *__restrict __stream, char *__restrict __buf,
size_t __size) __attribute__ ((__nothrow__));
extern void setlinebuf (FILE *__stream) __attribute__ ((__nothrow__));
# 331 "/usr/include/stdio.h"
extern int fprintf (FILE *__restrict __stream,
__const char *__restrict __format, ...);
extern int printf (__const char *__restrict __format, ...);
extern int sprintf (char *__restrict __s,
__const char *__restrict __format, ...) __attribute__ ((__nothrow__));
extern int vfprintf (FILE *__restrict __s, __const char *__restrict __format,
__gnuc_va_list __arg);
extern int vprintf (__const char *__restrict __format, __gnuc_va_list __arg);
extern int vsprintf (char *__restrict __s, __const char *__restrict __format,
__gnuc_va_list __arg) __attribute__ ((__nothrow__));
extern int snprintf (char *__restrict __s, size_t __maxlen,
__const char *__restrict __format, ...)
__attribute__ ((__nothrow__)) __attribute__ ((__format__ (__printf__, 3, 4)));
extern int vsnprintf (char *__restrict __s, size_t __maxlen,
__const char *__restrict __format, __gnuc_va_list __arg)
__attribute__ ((__nothrow__)) __attribute__ ((__format__ (__printf__, 3, 0)));
# 403 "/usr/include/stdio.h"
extern int fscanf (FILE *__restrict __stream,
__const char *__restrict __format, ...) ;
extern int scanf (__const char *__restrict __format, ...) ;
extern int sscanf (__const char *__restrict __s,
__const char *__restrict __format, ...) __attribute__ ((__nothrow__));
# 421 "/usr/include/stdio.h"
extern int fscanf (FILE *__restrict __stream, __const char *__restrict __format, ...) __asm__ ("__USER_LABEL_PREFIX__" "__isoc99_fscanf") ;
extern int scanf (__const char *__restrict __format, ...) __asm__ ("__USER_LABEL_PREFIX__" "__isoc99_scanf") ;
extern int sscanf (__const char *__restrict __s, __const char *__restrict __format, ...) __asm__ ("__USER_LABEL_PREFIX__" "__isoc99_sscanf") __attribute__ ((__nothrow__));
# 449 "/usr/include/stdio.h"
extern int vfscanf (FILE *__restrict __s, __const char *__restrict __format,
__gnuc_va_list __arg)
__attribute__ ((__format__ (__scanf__, 2, 0))) ;
extern int vscanf (__const char *__restrict __format, __gnuc_va_list __arg)
__attribute__ ((__format__ (__scanf__, 1, 0))) ;
extern int vsscanf (__const char *__restrict __s,
__const char *__restrict __format, __gnuc_va_list __arg)
__attribute__ ((__nothrow__)) __attribute__ ((__format__ (__scanf__, 2, 0)));
# 472 "/usr/include/stdio.h"
extern int vfscanf (FILE *__restrict __s, __const char *__restrict __format, __gnuc_va_list __arg) __asm__ ("__USER_LABEL_PREFIX__" "__isoc99_vfscanf")
__attribute__ ((__format__ (__scanf__, 2, 0))) ;
extern int vscanf (__const char *__restrict __format,
__gnuc_va_list __arg) __asm__ ("__USER_LABEL_PREFIX__" "__isoc99_vfscanf")
__attribute__ ((__format__ (__scanf__, 1, 0))) ;
extern int vsscanf
(__const char *__restrict __s,
__const char *__restrict __format, __gnuc_va_list __arg) __asm__ ("__USER_LABEL_PREFIX__" "__isoc99_vsscanf")
__attribute__ ((__nothrow__)) __attribute__ ((__format__ (__scanf__, 2, 0)));
# 509 "/usr/include/stdio.h"
extern int fgetc (FILE *__stream);
extern int getc (FILE *__stream);
extern int getchar (void);
# 528 "/usr/include/stdio.h"
extern int getc_unlocked (FILE *__stream);
extern int getchar_unlocked (void);
# 539 "/usr/include/stdio.h"
extern int fgetc_unlocked (FILE *__stream);
# 551 "/usr/include/stdio.h"
extern int fputc (int __c, FILE *__stream);
extern int putc (int __c, FILE *__stream);
extern int putchar (int __c);
# 572 "/usr/include/stdio.h"
extern int fputc_unlocked (int __c, FILE *__stream);
# 580 "/usr/include/stdio.h"
extern int putc_unlocked (int __c, FILE *__stream);
extern int putchar_unlocked (int __c);
# 588 "/usr/include/stdio.h"
extern int getw (FILE *__stream);
extern int putw (int __w, FILE *__stream);
# 600 "/usr/include/stdio.h"
extern char *fgets (char *__restrict __s, int __n, FILE *__restrict __stream)
;
# 608 "/usr/include/stdio.h"
extern char *gets (char *__s) ;
# 658 "/usr/include/stdio.h"
extern int fputs (__const char *__restrict __s, FILE *__restrict __stream);
extern int puts (__const char *__s);
extern int ungetc (int __c, FILE *__stream);
extern size_t fread (void *__restrict __ptr, size_t __size,
size_t __n, FILE *__restrict __stream) ;
extern size_t fwrite (__const void *__restrict __ptr, size_t __size,
size_t __n, FILE *__restrict __s) ;
# 706 "/usr/include/stdio.h"
extern size_t fread_unlocked (void *__restrict __ptr, size_t __size,
size_t __n, FILE *__restrict __stream) ;
extern size_t fwrite_unlocked (__const void *__restrict __ptr, size_t __size,
size_t __n, FILE *__restrict __stream) ;
# 718 "/usr/include/stdio.h"
extern int fseek (FILE *__stream, long int __off, int __whence);
extern long int ftell (FILE *__stream) ;
extern void rewind (FILE *__stream);
# 742 "/usr/include/stdio.h"
extern int fseeko (FILE *__stream, __off_t __off, int __whence);
extern __off_t ftello (FILE *__stream) ;
# 767 "/usr/include/stdio.h"
extern int fgetpos (FILE *__restrict __stream, fpos_t *__restrict __pos);
extern int fsetpos (FILE *__stream, __const fpos_t *__pos);
# 795 "/usr/include/stdio.h"
extern void clearerr (FILE *__stream) __attribute__ ((__nothrow__));
extern int feof (FILE *__stream) __attribute__ ((__nothrow__)) ;
extern int ferror (FILE *__stream) __attribute__ ((__nothrow__)) ;
extern void clearerr_unlocked (FILE *__stream) __attribute__ ((__nothrow__));
extern int feof_unlocked (FILE *__stream) __attribute__ ((__nothrow__)) ;
extern int ferror_unlocked (FILE *__stream) __attribute__ ((__nothrow__)) ;
# 815 "/usr/include/stdio.h"
extern void perror (__const char *__s);
# 1 "/usr/include/bits/sys_errlist.h" 1 3 4
# 27 "/usr/include/bits/sys_errlist.h"
extern int sys_nerr;
extern __const char *__const sys_errlist[];
# 823 "/usr/include/stdio.h" 2 3 4
extern int fileno (FILE *__stream) __attribute__ ((__nothrow__)) ;
extern int fileno_unlocked (FILE *__stream) __attribute__ ((__nothrow__)) ;
# 842 "/usr/include/stdio.h"
extern FILE *popen (__const char *__command, __const char *__modes) ;
extern int pclose (FILE *__stream);
extern char *ctermid (char *__s) __attribute__ ((__nothrow__));
# 882 "/usr/include/stdio.h"
extern void flockfile (FILE *__stream) __attribute__ ((__nothrow__));
extern int ftrylockfile (FILE *__stream) __attribute__ ((__nothrow__)) ;
extern void funlockfile (FILE *__stream) __attribute__ ((__nothrow__));
# 141 "/usr/include/ncurses.h" 2 3 4
# 1 "/usr/include/unctrl.h" 1 3 4
# 54 "/usr/include/unctrl.h"
# 1 "/usr/include/ncurses.h" 1 3 4
# 55 "/usr/include/unctrl.h" 2 3 4
const char * unctrl (chtype);
# 142 "/usr/include/ncurses.h" 2 3 4
# 165 "/usr/include/ncurses.h"
typedef unsigned char NCURSES_BOOL;
# 231 "/usr/include/ncurses.h"
extern chtype acs_map[];
# 321 "/usr/include/ncurses.h"
typedef struct screen SCREEN;
typedef struct _win_st WINDOW;
typedef chtype attr_t;
# 363 "/usr/include/ncurses.h"
struct ldat;
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;
# 418 "/usr/include/ncurses.h"
};
# 519 "/usr/include/ncurses.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 (int);
extern int attron (int);
extern int attrset (int);
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 const 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 *);
extern int mvprintw (int,int, const char *,...)
;
extern int mvscanw (int,int, const char *,...)
;
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 *);
extern int mvwprintw (WINDOW*,int,int, const char *,...)
;
extern int mvwscanw (WINDOW *,int,int, const char *,...)
;
extern int mvwvline (WINDOW *,int, int, chtype, int);
extern int napms (int);
extern WINDOW * newpad (int,int);
extern SCREEN * newterm (const 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 (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 (*)(WINDOW *, int));
extern int savetty (void);
extern int scanw (const char *,...)
;
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 char * termname (void);
extern void timeout (int);
extern int touchline (WINDOW *, int, int);
extern int touchwin (WINDOW *);
extern int typeahead (int);
extern int ungetch (int);
extern int untouchwin (WINDOW *);
extern void use_env (bool);
extern int vidattr (chtype);
extern int vidputs (chtype, int (*)(int));
extern int vline (chtype, int);
extern int vwprintw (WINDOW *, const char *,va_list);
extern int vw_printw (WINDOW *, const char *,va_list);
extern int vwscanw (WINDOW *, const char *,va_list);
extern int vw_scanw (WINDOW *, const char *,va_list);
extern int waddch (WINDOW *, const chtype);
extern int waddchnstr (WINDOW *,const chtype *,int);
extern int waddchstr (WINDOW *,const chtype *);
extern int waddnstr (WINDOW *,const char *,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 *, 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 *);
extern int wmove (WINDOW *,int,int);
extern int wnoutrefresh (WINDOW *);
extern int wprintw (WINDOW *, const char *,...)
;
extern int wredrawln (WINDOW *,int,int);
extern int wrefresh (WINDOW *);
extern int wscanw (WINDOW *, const char *,...)
;
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 int tigetflag (const char *);
extern int tigetnum (const char *);
extern char * tigetstr (const char *);
extern int putp (const char *);
extern char * tparm (const char *, ...);
# 810 "/usr/include/ncurses.h"
extern int getattrs (const WINDOW *);
extern int getcurx (const WINDOW *);
extern int getcury (const WINDOW *);
extern int getbegx (const WINDOW *);
extern int getbegy (const WINDOW *);
extern int getmaxx (const WINDOW *);
extern int getmaxy (const WINDOW *);
extern int getparx (const WINDOW *);
extern int getpary (const WINDOW *);
# 834 "/usr/include/ncurses.h"
typedef int (*NCURSES_CALLBACK)(WINDOW *, void *);
extern bool is_term_resized (int, int);
extern char * keybound (int, int);
extern const char * curses_version (void);
extern int assume_default_colors (int, int);
extern int define_key (const char *, int);
extern int key_defined (const char *);
extern int keyok (int, bool);
extern int resize_term (int, int);
extern int resizeterm (int, int);
extern int use_default_colors (void);
extern int use_extended_names (bool);
extern int use_legacy_coding (int);
extern int use_screen (SCREEN *, NCURSES_CALLBACK, void *);
extern int use_window (WINDOW *, NCURSES_CALLBACK, void *);
extern int wresize (WINDOW *, int, int);
extern void nofilter(void);
extern WINDOW * wgetparent (const WINDOW *);
extern bool is_cleared (const WINDOW *);
extern bool is_idcok (const WINDOW *);
extern bool is_idlok (const WINDOW *);
extern bool is_immedok (const WINDOW *);
extern bool is_keypad (const WINDOW *);
extern bool is_leaveok (const WINDOW *);
extern bool is_nodelay (const WINDOW *);
extern bool is_notimeout (const WINDOW *);
extern bool is_scrollok (const WINDOW *);
extern bool is_syncok (const WINDOW *);
extern int wgetscrreg (const WINDOW *, int *, int *);
# 1195 "/usr/include/ncurses.h"
extern WINDOW * curscr;
extern WINDOW * newscr;
extern WINDOW * stdscr;
extern char ttytype[];
extern int COLORS;
extern int COLOR_PAIRS;
extern int COLS;
extern int ESCDELAY;
extern int LINES;
extern int TABSIZE;
# 1408 "/usr/include/ncurses.h"
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*, int*, int*, bool);
extern bool mouse_trafo (int*, int*, bool);
extern int mcprint (char *, int);
extern int has_key (int);
extern void _tracef (const char *, ...) ;
extern void _tracedump (const char *, WINDOW *);
extern char * _traceattr (attr_t);
extern char * _traceattr2 (int, chtype);
extern char * _nc_tracebits (void);
extern char * _tracechar (int);
extern char * _tracechtype (chtype);
extern char * _tracechtype2 (int, chtype);
# 1450 "/usr/include/ncurses.h"
extern char * _tracemouse (const MEVENT *);
extern void trace (const unsigned int);
# 21 "clc.c" 2
typedef enum { TELNET_TEXT, TELNET_IAC, TELNET_DO, TELNET_DONT, TELNET_WILL, TELNET_WONT, TELNET_SUB, TELNET_SUBIAC } telnet_state_t;
# 32 "clc.c"
struct TELNET {
telnet_state_t state;
char sub_buf[(1024*8)];
size_t sub_size;
char flags;
} telnet;
static void telnet_on_line(const char* line, size_t len);
static void telnet_on_recv(const char* bytes, size_t len);
static void telnet_on_resize(int w, int h);
static void telnet_send_cmd(int cmd);
static void telnet_send_opt(int type, int opt);
static void telnet_send_esc(const char* bytes, size_t len);
static void telnet_do_subreq(void);
static struct WEBSOCK {
char msg[2048];
size_t msg_size;
} websock;
static void websock_on_line(const char* line, size_t len);
static void websock_on_recv(const char* bytes, size_t len);
static void websock_on_resize(int w, int h);
typedef enum { PROTOCOL_TELNET, PROTOCOL_WEBSOCK } protocol_type_t;
static struct PROTOCOL {
protocol_type_t type;
void (*on_line)(const char* line, size_t len);
void (*on_recv)(const char* bytes, size_t len);
void (*on_resize)(int w, int h);
} protocol;
static void protocol_init(protocol_type_t type);
typedef enum { TERM_ASCII, TERM_ESC, TERM_ESCRUN } term_state_t;
# 82 "clc.c"
static struct TERMINAL {
term_state_t state;
int esc_buf[16];
size_t esc_cnt;
char flags;
int color;
} terminal;
static struct EDITBUF {
char buf[1024];
size_t size;
size_t pos;
} editbuf;
static void editbuf_set(const char*);
static void editbuf_insert(int);
static void editbuf_bs();
static void editbuf_del();
static void editbuf_curleft();
static void editbuf_curright();
static void editbuf_display();
static void editbuf_home();
static void editbuf_end();
static int running = 1;
static char banner[1024];
static int autobanner = 1;
static WINDOW* win_main = 0;
static WINDOW* win_input = 0;
static WINDOW* win_banner = 0;
volatile int have_sigwinch = 0;
volatile int have_sigint = 0;
const char* host = ((void *)0);
const char* port = ((void *)0);
static int sock;
static size_t sent_bytes = 0;
static size_t recv_bytes = 0;
static void on_text_plain (const char* text, size_t len);
static void on_text_ansi (const char* text, size_t len);
static void cleanup (void) {
endwin();
}
static void handle_signal (int sig) {
switch (sig) {
case 28:
have_sigwinch = 1;
break;
case 2:
have_sigint = 1;
break;
}
}
static void editbuf_set (const char* text) {
snprintf(editbuf.buf, 1024, "%s", text);
editbuf.pos = editbuf.size = strlen(text);
}
static void editbuf_insert (int ch) {
if (editbuf.size == 1024)
return;
if (editbuf.pos == editbuf.size) {
editbuf.buf[editbuf.pos] = ch;
editbuf.pos = ++editbuf.size;
return;
}
memmove(editbuf.buf + editbuf.pos + 1, editbuf.buf + editbuf.pos, editbuf.size - editbuf.pos);
editbuf.buf[editbuf.pos] = ch;
++editbuf.pos;
++editbuf.size;
}
static void editbuf_bs () {
if (editbuf.pos == 0)
return;
if (editbuf.pos == editbuf.size) {
editbuf.pos = --editbuf.size;
return;
}
memmove(editbuf.buf + editbuf.pos - 1, editbuf.buf + editbuf.pos, editbuf.size - editbuf.pos);
--editbuf.pos;
--editbuf.size;
}
static void editbuf_del () {
if (editbuf.pos == editbuf.size)
return;
if (editbuf.pos == editbuf.size - 1) {
--editbuf.pos;
--editbuf.size;
return;
}
memmove(editbuf.buf + editbuf.pos, editbuf.buf + editbuf.pos + 1, editbuf.size - editbuf.pos - 1);
--editbuf.size;
}
static void editbuf_home () {
editbuf.pos = 0;
}
static void editbuf_end () {
editbuf.pos = editbuf.size;
}
static void editbuf_curleft () {
if (editbuf.pos > 0)
--editbuf.pos;
}
static void editbuf_curright () {
if (editbuf.pos < editbuf.size)
++editbuf.pos;
}
static void editbuf_display () {
wclear(win_input);
if (terminal.flags & (1<<0)) {
(wmove(win_input,0,0) == (-1) ? (-1) : waddnstr(win_input,editbuf.buf,editbuf.size));
} else {
wmove(win_input, 0, 0);
size_t i;
for (i = 0; i != editbuf.size; ++i)
waddch(win_input, '*');
}
wmove(win_input, 0, editbuf.pos);
}
static void paint_banner (void) {
if (autobanner) {
snprintf(banner, sizeof(banner), "%s:%s - (%s)", host, port, sock == -1 ? "disconnected" : "connected");
}
wclear(win_banner);
(wmove(win_banner,0,0) == (-1) ? (-1) : waddnstr(win_banner,banner,-1));
}
static void redraw_display (void) {
struct winsize ws;
if (ioctl(0, 0x5413, &ws))
return;
resizeterm(ws.ws_row, ws.ws_col);
mvwin(win_input, LINES-1, 0);
wresize(win_input, 1, COLS);
mvwin(win_banner, LINES-2, 0);
wresize(win_banner, 1, COLS);
wresize(win_main, LINES-2, COLS);
paint_banner();
if (running) {
unsigned short w = htons(COLS), h = htons(LINES);
protocol.on_resize(w, h);
}
editbuf_display();
wnoutrefresh(win_main);
wnoutrefresh(win_banner);
wnoutrefresh(win_input);
doupdate();
}
static void do_send (const char* bytes, size_t len) {
int ret;
while (len > 0) {
ret = send(sock, bytes, len, 0);
if (ret == -1) {
if (ret != 11 && ret != 4) {
endwin();
fprintf(stderr, "send() failed: %s\n", strerror(errno));
exit(1);
}
continue;
} else if (ret == 0) {
endwin();
printf("Disconnected from server\n");
exit(0);
} else {
sent_bytes += ret;
bytes += ret;
len -= ret;
}
}
}
static void on_key (int key) {
if (key >= 0401 && key <= 0777) {
if (key == 0527) {
protocol.on_line(editbuf.buf, editbuf.size);
editbuf_set("");
}
else if (key == 0407) {
editbuf_bs();
}
else if (key == 0512) {
editbuf_del();
}
else if (key == 0404) {
editbuf_curleft();
}
else if (key == 0405) {
editbuf_curright();
}
else if (key == 0406) {
editbuf_home();
}
else if (key == 0550) {
editbuf_end();
}
} else {
if (key == '\n' || key == '\r') {
protocol.on_line(editbuf.buf, editbuf.size);
editbuf_set("");
} else {
editbuf_insert(key);
}
}
editbuf_display();
}
static void on_term_esc(char cmd) {
size_t i;
switch (cmd) {
case 'm':
for (i = 0; i < terminal.esc_cnt; ++i) {
if (terminal.esc_buf[i] == 0) {
terminal.color = 9;
wattr_on(win_main, (attr_t)(((terminal.color) << ((0) + 8))), ((void *)0));
}
else if (terminal.esc_buf[i] >= 31 && terminal.esc_buf[i] <= 37) {
terminal.color = terminal.esc_buf[i] - 30;
wattr_on(win_main, (attr_t)(((terminal.color) << ((0) + 8))), ((void *)0));
}
}
break;
case 'J':
if (terminal.esc_buf[0] == 2)
wclear(win_main);
break;
}
}
static void on_text_plain (const char* text, size_t len) {
size_t i;
for (i = 0; i < len; ++i) {
if (text[i] != 27)
waddch(win_main, text[i]);
}
}
static void on_text_ansi (const char* text, size_t len) {
size_t i;
for (i = 0; i < len; ++i) {
switch (terminal.state) {
case TERM_ASCII:
if (text[i] == 27)
terminal.state = TERM_ESC;
else
waddch(win_main, text[i]);
break;
case TERM_ESC:
if (text[i] == '[') {
terminal.state = TERM_ESCRUN;
terminal.esc_cnt = 0;
terminal.esc_buf[0] = 0;
}
else
terminal.state = TERM_ASCII;
break;
case TERM_ESCRUN:
if (((*__ctype_b_loc ())[(int) ((text[i]))] & (unsigned short int) _ISdigit)) {
if (terminal.esc_cnt == 0)
terminal.esc_cnt = 1;
terminal.esc_buf[terminal.esc_cnt-1] *= 10;
terminal.esc_buf[terminal.esc_cnt-1] += text[i] - '0';
}
else if (text[i] == ';') {
if (terminal.esc_cnt < 16) {
terminal.esc_cnt++;
terminal.esc_buf[terminal.esc_cnt-1] = 0;
}
}
else {
on_term_esc(text[i]);
terminal.state = TERM_ASCII;
}
break;
}
}
}
static void protocol_init (protocol_type_t type) {
protocol.type = type;
if (type == PROTOCOL_TELNET) {
protocol.on_line = telnet_on_line;
protocol.on_recv = telnet_on_recv;
protocol.on_resize = telnet_on_resize;
} else if (type == PROTOCOL_WEBSOCK) {
protocol.on_line = websock_on_line;
protocol.on_recv = websock_on_recv;
protocol.on_resize = websock_on_resize;
}
}
static int do_connect (const char* host, const char* port) {
struct addrinfo hints;
struct addrinfo *results;
struct addrinfo *ai;
int ret;
int sock;
memset(&hints, 0, sizeof(struct addrinfo));
hints.ai_family = 0;
hints.ai_socktype = SOCK_STREAM;
if ((ret = getaddrinfo(host, port, &hints, &results)) != 0) {
fprintf(stderr, "Host lookup failed: %s\n", gai_strerror(ret));
return -1;
}
for (ai = results; ai != ((void *)0); ai = ai->ai_next) {
sock = socket(2, SOCK_STREAM, 0);
if (sock == -1) {
fprintf(stderr, "socket() failed: %s\n", strerror(errno));
exit(1);
}
if (connect(sock, ai->ai_addr, ai->ai_addrlen) != -1) {
freeaddrinfo(results);
return sock;
}
shutdown(sock, SHUT_RDWR);
}
freeaddrinfo(results);
return -1;
}
int main (int argc, char** argv) {
protocol_type_t type = PROTOCOL_TELNET;
const char* default_port = "23";
struct sigaction sa;
int i;
# 540 "clc.c"
for (i = 1; i < argc; ++i) {
if (strcmp(argv[i], "-t") == 0) {
type = PROTOCOL_TELNET;
default_port = "23";
continue;
}
if (strcmp(argv[i], "-w") == 0) {
type = PROTOCOL_WEBSOCK;
default_port = "4747";
continue;
}
if (strcmp(argv[i], "-h") == 0) {
printf(
"CLC by Sean Middleditch <elanthis at sourcemud.org>\n"
"This program has been released into the PUBLIC DOMAIN.\n\n"
"Usage:\n"
" clc [-w] [-t] [-h] <host> [<port>]\n\n"
"Options:\n"
" -w WebSock protocol\n"
" -t TELNET protocol\n"
" -h display help\n\n"
"Notes:\n"
" The TELNET protocol is the default if none is specified.\n"
" WebSock connects to port 4747 by default, and TELNET\n"
" connects to port 23 by default. CLC is 8-bit clean by\n"
" default in TELNET mode, and supports UTF-8 if both the\n"
" terminal and server support it.\n"
);
return 0;
}
if (argv[i][0] == '-') {
fprintf(stderr, "Unknown option %s.\nUse -h to see available options.\n", argv[i]);
exit(1);
}
if (host == ((void *)0)) {
host = argv[i];
} else {
port = argv[i];
}
}
if (host == ((void *)0)) {
fprintf(stderr, "No host was given.\nUse -h to see command format.\n");
exit(1);
}
if (port == ((void *)0))
port = default_port;
atexit(cleanup);
memset(&terminal, 0, sizeof(struct TERMINAL));
terminal.state = TERM_ASCII;
terminal.flags = ((1<<0));
terminal.color = 9;
memset(&telnet, 0, sizeof(struct TELNET));
memset(&websock, 0, sizeof(struct WEBSOCK));
protocol_init(type);
sock = do_connect(host, port);
if (sock == -1) {
fprintf(stderr, "Failed to connect to %s:%s\n", host, port);
exit(1);
}
printf("Connected to %s:%s\n", host, port);
snprintf(banner, sizeof(banner), "CLC - %s:%s (connected)", host, port);
initscr();
start_color();
nonl();
cbreak();
noecho();
win_main = newwin(LINES-2, COLS, 0, 0);
win_banner = newwin(1, COLS, LINES-2, 0);
win_input = newwin(1, COLS, LINES-1, 0);
idlok(win_main, 1);
scrollok(win_main, 1);
nodelay(win_input, 0);
keypad(win_input, 1);
use_default_colors();
init_pair(1, 1, -1);
init_pair(4, 4, -1);
init_pair(2, 2, -1);
init_pair(6, 6, -1);
init_pair(5, 5, -1);
init_pair(3, 3, -1);
init_pair(7, 7, -1);
init_pair(9, -1, -1);
wbkgd(win_main, ((9) << ((0) + 8)));
wclear(win_main);
init_pair(10, 7, 4);
wbkgd(win_banner, ((10) << ((0) + 8)));
wclear(win_banner);
init_pair(11, -1, -1);
wbkgd(win_input, ((11) << ((0) + 8)));
wclear(win_input);
redraw_display();
memset(&sa, 0, sizeof(sa));
sa._u._sa_handler = handle_signal;
sigaction(2, &sa, ((void *)0));
sigaction(28, &sa, ((void *)0));
memset(&editbuf, 0, sizeof(struct EDITBUF));
struct pollfd fds[2];
fds[0].fd = 1;
fds[0].events = 0x001;
fds[1].fd = sock;
fds[1].events = 0x001;
while (running) {
if (poll(fds, 2, -1) == -1) {
if (errno != 11 && errno != 4) {
endwin();
fprintf(stderr, "poll() failed: %s\n", strerror(errno));
return 1;
}
}
if (have_sigwinch) {
have_sigwinch = 0;
redraw_display();
}
if (have_sigint) {
exit(0);
}
if (fds[0].revents & 0x001) {
int key = wgetch(win_input);
if (key != (-1))
on_key(key);
}
if (fds[1].revents & 0x001) {
char buffer[2048];
int ret = recv(sock, buffer, sizeof(buffer), 0);
if (ret == -1) {
if (errno != 11 && errno != 4) {
endwin();
fprintf(stderr, "recv() failed: %s\n", strerror(errno));
return 1;
}
} else if (ret == 0) {
running = 0;
} else {
recv_bytes += ret;
protocol.on_recv(buffer, ret);
}
}
paint_banner();
wnoutrefresh(win_main);
wnoutrefresh(win_banner);
wnoutrefresh(win_input);
doupdate();
}
sock = -1;
autobanner = 1;
paint_banner();
wnoutrefresh(win_banner);
doupdate();
wgetch(win_input);
endwin();
printf("Disconnected.\n");
return 0;
}
static void websock_on_line (const char* line, size_t len) {
char cmd = '=';
char nul = 0;
do_send(&cmd, 1);
do_send(line, len);
do_send(&nul, 1);
}
static void websock_on_recv(const char* data, size_t len) {
size_t i;
for (i = 0; i < len; ++i) {
if (data[i] != 0) {
if (websock.msg_size == 2048) {
} else {
websock.msg[websock.msg_size++] = data[i];
}
} else {
switch (websock.msg[0]) {
case '"':
on_text_plain(&websock.msg[1], websock.msg_size - 1);
break;
case '>':
autobanner = 0;
snprintf(banner, sizeof(banner), "%.*s", (int)websock.msg_size - 1, &websock.msg[1]);
paint_banner();
break;
case 'C':
wclear(win_main);
break;
case 'p':
if (websock.msg_size == 2 && websock.msg[1] == '1')
terminal.flags &= ~(1<<0);
else if (websock.msg_size == 2 && websock.msg[1] == '0')
terminal.flags |= (1<<0);
break;
}
websock.msg[0] = 0;
websock.msg_size = 0;
}
}
}
static void websock_on_resize (int w, int h) {
}
static void telnet_on_line (const char* line, size_t len) {
char nl[] = { '\n', '\r' };
telnet_send_esc(line, len);
telnet_send_esc(nl, sizeof(nl));
if (terminal.flags & (1<<0)) {
wattr_on(win_main, (attr_t)(((3) << ((0) + 8))), ((void *)0));
waddnstr(win_main, line, len);
waddch(win_main, '\n');
wattr_on(win_main, (attr_t)(((terminal.color) << ((0) + 8))), ((void *)0));
}
}
static void telnet_on_recv (const char* data, size_t len) {
size_t i;
for (i = 0; i < len; ++i) {
switch (telnet.state) {
case TELNET_TEXT:
if ((unsigned char)data[i] == 255)
telnet.state = TELNET_IAC;
else
on_text_ansi(&data[i], 1);
break;
case TELNET_IAC:
if ((unsigned char)data[i] == 255)
on_text_ansi(&data[i], 1);
else if ((unsigned char)data[i] == 253)
telnet.state = TELNET_DO;
else if ((unsigned char)data[i] == 254)
telnet.state = TELNET_DONT;
else if ((unsigned char)data[i] == 251)
telnet.state = TELNET_WILL;
else if ((unsigned char)data[i] == 252)
telnet.state = TELNET_WONT;
else if ((unsigned char)data[i] == 250) {
telnet.state = TELNET_SUB;
telnet.sub_size = 0;
}
else {
char buf[64];
snprintf(buf, sizeof(buf), "<IAC:%d>", (int)data[i]);
waddnstr(win_main,buf,-1);
telnet.state = TELNET_TEXT;
}
break;
case TELNET_DO:
switch (data[i]) {
case 31:
{
telnet.flags |= (1<<1);
telnet_send_opt(251, 31);
unsigned short w = htons(COLS), h = htons(LINES);
protocol.on_resize(w, h);
break;
}
}
telnet.state = TELNET_TEXT;
break;
case TELNET_DONT:
telnet.state = TELNET_TEXT;
break;
case TELNET_WILL:
if ((unsigned char)data[i] == 1) {
terminal.flags &= ~(1<<0);
telnet_send_opt(253, 1);
}
else if ((unsigned char)data[i] == 93) {
telnet.flags |= (1<<0);
telnet_send_opt(253, 93);
}
telnet.state = TELNET_TEXT;
break;
case TELNET_WONT:
if ((unsigned char)data[i] == 1)
terminal.flags |= (1<<0);
telnet.state = TELNET_TEXT;
break;
case TELNET_SUB:
if ((unsigned char)data[i] == 255)
telnet.state = TELNET_SUBIAC;
else if (telnet.sub_size == (1024*8))
telnet.state = TELNET_TEXT;
else
telnet.sub_buf[telnet.sub_size++] = data[i];
break;
case TELNET_SUBIAC:
if ((unsigned char)data[i] == 255) {
if (telnet.sub_size == (1024*8))
telnet.state = TELNET_TEXT;
else
telnet.sub_buf[telnet.sub_size++] = data[i];
}
else if ((unsigned char)data[i] == 240) {
telnet.state = TELNET_TEXT;
telnet_do_subreq();
}
else
telnet.state = TELNET_TEXT;
break;
}
}
}
static void telnet_on_resize (int w, int h) {
if (telnet.flags & (1<<1)) {
telnet_send_opt(250, 31);
telnet_send_esc((char*)&w, 2);
telnet_send_esc((char*)&h, 2);
telnet_send_cmd(240);
}
}
static void telnet_send_esc (const char* bytes, size_t len) {
size_t last = 0;
size_t i;
char esc[2] = { 255, 255 };
for (i = 0; i < len; ++i) {
if ((unsigned char)bytes[i] == 255) {
if (i > last)
do_send(bytes + last, i - last);
do_send(esc, 2);
last = i + 1;
}
}
if (i > last)
do_send(bytes + last, i - last);
}
static void telnet_send_cmd(int cmd) {
char bytes[2] = { 255, cmd };
do_send(bytes, 2);
}
static void telnet_send_opt(int type, int opt) {
char bytes[3] = { 255, type, opt };
do_send(bytes, 3);
}
static void telnet_do_subreq (void) {
if (telnet.sub_size == 0)
return;
switch (telnet.sub_buf[0]) {
case 93:
if ((telnet.flags & (1<<0)) == 0)
return;
if (telnet.sub_size < 3 || !((*__ctype_b_loc ())[(int) ((telnet.sub_buf[1]))] & (unsigned short int) _ISalpha) || telnet.sub_buf[telnet.sub_size-1] != 0)
return;
break;
}
}
More information about the cfe-dev
mailing list