From: schmidt@net1.ics.uci.edu (Douglas C. Schmidt)
Subject: g++ 2.3.2 internal error
Organization: GNUs Not Usenet
Distribution: gnu
Date: Mon, 14 Dec 1992 07:29:40 GMT

gcc -v x.C
Reading specs from /usr/gnu/version/gcc/2.3.2/lib/gcc-lib/sparc-sun-sunos4.2/2.3.2/specs
gcc version 2.3.2
 /usr/gnu/version/gcc/2.3.2/lib/gcc-lib/sparc-sun-sunos4.2/2.3.2/cpp -lang-c++ -v -undef -D__GNUC__=2 -D__GNUG__=2 -D__cplusplus -Dsparc -Dsun -Dunix -D__sparc__ -D__sun__ -D__unix__ -D__sparc -D__sun -D__unix x.C /i0/da/ud/schmidt/.trash/cca11385.i
GNU CPP version 2.3.2 (sparc)
 /usr/gnu/version/gcc/2.3.2/lib/gcc-lib/sparc-sun-sunos4.2/2.3.2/cc1plus /i0/da/ud/schmidt/.trash/cca11385.i -quiet -dumpbase x.cc -version -fdelayed-branch -fstrength-reduce -finline-functions -o /i0/da/ud/schmidt/.trash/cca11385.s
GNU C++ version 2.3.2 (sparc) compiled by GNU C version 2.3.2.
x.C: In function `int  main ()':
x.C:1739: Internal compiler error.
x.C:1739: Please report this to `bug-g++@prep.ai.mit.edu'.

----------------------------------------
extern "C" {
typedef	int		sigset_t;
typedef	unsigned int	speed_t;
typedef	unsigned long	tcflag_t;
typedef	unsigned char	cc_t;
typedef	int		pid_t;
typedef	unsigned short	mode_t;
typedef	short		nlink_t;
typedef	long		clock_t;
typedef	long		time_t;
typedef	int		size_t;
typedef int		ptrdiff_t;
typedef	unsigned short	wchar_t;
}
extern "C" {
int       abs(int);
void volatile abort(void);
double    atof(const char*);
int       atoi(const char*);
long      atol(const char*);
int       atexit(auto void (*p) (void));
int       bsearch (const void *, const void *, size_t,
                   size_t, auto int (*ptf)(const void*, const void*));
void*     calloc(size_t, size_t);
void      cfree(void*);
void volatile exit(int);
char*     fcvt(double, int, int*, int*);
void      free(void*);
char*     getenv(const char*);
int       getopt(int, char * const *, const char*);
int       getpw(int, char*);
char*     gcvt(double, int, char*);
char*     ecvt(double, int, int*, int*);
extern char**   environ;
long      labs(long);
void*     malloc(size_t);
size_t    malloc_usable_size(void*);
int       putenv(const char*);
extern char*    optarg;
extern int      opterr;
extern int      optind;
void      qsort(void*, size_t, size_t, auto int (*ptf)(void*,void*));
int       rand(void);
void*     realloc(void*, size_t);
int       setkey(const char*);
int       srand(unsigned int);
double    strtod(const char*, char**);
long      strtol(const char*, char**, int);
unsigned long stroul(const char**, int);
int       system(const char*);
long      random(void);
void      srandom(int);
char*     setstate(char*);
char*     initstate(unsigned, char*, int);
double    drand48(void);
void      lcong48(short*);
long      jrand48(short*);
long      lrand48(void);
long      mrand48(void);
long      nrand48(short*);
short*    seed48(short*);
void      srand48(long);
char*     ctermid(char*);
char*     cuserid(char*);
char*     tempnam(const char*, const char*);
char*     tmpnam(char*);
}
extern "C" {
}
extern "C" {
char*     strcat(char*, const char*);
char*     strchr(const char*, int);
int       strcmp(const char*, const char*);
int       strcoll(const char*, const char*);
char*     strcpy(char*, const char*);
int      strcspn(const char*, const char*);
char*     strdup(const char*);
int      strlen(const char*);
char*     strncat(char*, const char*, int  );
int       strncmp(const char*, const char*, int  );
char*     strncpy(char*, const char*, int  );
char*     strpbrk(const char*, const char*);
char*     strrchr(const char*, int);
int      strspn(const char*, const char*);
char*     strstr(const char*, const char *);
char*     strtok(char*, const char*);
int      strxfrm(char*, const char*, int  );
char*     index(const char*, int);
char*     rindex(const char*, int);
}
extern "C" {
}
extern "C" {
void*     memalign (...) ;
void*     memccpy (...) ;
void*     memchr (...) ;
int       memcmp (...) ;
void*     memcpy (...) ;
void*     memmove (...) ;
void*     memset (...) ;
int       ffs (...) ;
int     getpagesize (...) ;
void*     valloc (...) ;
void      bcopy (...) ;
int       bcmp (...) ;
void      bzero (...) ;
}
extern "C" {
extern "C"
{
extern "C" {
}
typedef	unsigned char	u_char;
typedef	unsigned short	u_short;
typedef	unsigned int	u_int;
typedef	unsigned long	u_long;
typedef	unsigned short	ushort;
typedef	unsigned int	uint;
typedef	struct  _physadr_t { int r[1]; } *physadr_t;
typedef	struct label_t {
	int	val[2];
} label_t;
typedef	struct	_quad_t { long val[2]; } quad_t;
typedef	long	daddr_t;
typedef	char *	caddr_t;
typedef	unsigned long	ino_t;
typedef	short	dev_t;
typedef	long	off_t;
typedef	unsigned short	uid_t;
typedef	unsigned short	gid_t;
typedef	long	key_t;
typedef	char *	addr_t;
typedef	long	fd_mask;
typedef	struct fd_set {
	fd_mask	fds_bits[(((256 )+(( (sizeof (fd_mask) * 8		)	)-1))/( (sizeof (fd_mask) * 8		)	)) ];
} fd_set;
}
extern void	_exit( );
extern int	access( );
extern unsigned	alarm( );
extern int	chdir( );
extern int	__hide_chmod ( );
extern int	__hide_chown ( );
extern int	close( );
extern char	*ctermid( );
extern char	*cuserid( );
extern int	dup( );
extern int	dup2( );
extern int	__hide_execl ( );
extern int	__hide_execle ( );
extern int	__hide_execlp ( );
extern int	execv( );
extern int	execve( );
extern int	execvp( );
extern pid_t	fork( );
extern long	fpathconf( );
extern char	*getcwd( );
extern gid_t	getegid( );
extern uid_t	geteuid( );
extern gid_t	getgid( );
extern int	getgroups( );
extern char	*getlogin( );
extern pid_t	getpgrp( );
extern pid_t	getpid( );
extern pid_t	getppid( );
extern uid_t	getuid( );
extern int	isatty( );
extern int	link( );
extern off_t	lseek( );
extern long	pathconf( );
extern int	pause( );
extern int	pipe( );
extern int	read( );
extern int	rmdir( );
extern int	__hide_setgid ( );
extern int	setpgid( );
extern pid_t	setsid( );
extern int	__hide_setuid ( );
extern unsigned	sleep( );
extern long	sysconf( );
extern pid_t	tcgetpgrp( );
extern int	tcsetpgrp( );
extern char	*ttyname( );
extern int	unlink( );
extern int	write( );
extern void volatile _exit(int);
extern unsigned alarm (...) ;
extern int      brk (...) ;
extern int      chdir (...) ;
extern int      chmod  (...) ;
extern int      chown (const char*, unsigned short , unsigned short );
extern int      close (...) ;
extern char*    crypt (...) ;
extern int      dup (...) ;
extern int      dup2 (...) ;
extern void	encrypt (...) ;
extern int      execl (const char*, const char *, ...);
extern int      execle (const char*, const char *, ...);
extern int      execlp (const char*, const char*, ...);
extern int      exect (...) ;
extern int      execv (...) ;
extern int      execve (...) ;
extern int      execvp (...) ;
extern int      fchown (int, unsigned short , unsigned short );
extern int  fork (...) ;
extern int      fsync (...) ;
extern int      ftruncate (...) ;
extern char*    getcwd (...) ;
extern int      getdomainname (...) ;
extern int      getdtablesize (...) ;
extern int      getgroups (...) ;
extern unsigned short  geteuid (...) ;
extern unsigned short  getegid (...) ;
extern unsigned short  getgid (...) ;
extern long     gethostid (...) ;
extern int      gethostname (...) ;
extern int  getpgrp (...) ;
extern int  getpid (...) ;
extern int  getppid (...) ;
extern char*    getlogin (...) ;
extern char*    getpass (...) ;
extern unsigned short  getuid (...) ;
extern int      ioctl (int, int, ... );
extern int      isatty (...) ;
extern int      link (...) ;
extern int      mkstemp (...) ;
extern char*    mktemp (...) ;
extern int      nice (...) ;
extern int      pause (...) ;
extern int      pipe (...) ;
extern int      readlink (...) ;
extern int      rename (...) ;
extern int      rmdir (...) ;
extern void*    sbrk (...) ;
extern int      syscall (...) ;
extern int      setgid (unsigned short );
extern int      sethostname (...) ;
extern int  setpgrp (...) ;
extern int      setregid (...) ;
extern int      setreuid (...) ;
extern int      setuid (unsigned short );
extern unsigned sleep (...) ;
extern void     swab (...) ;
extern int      symlink (...) ;
extern long     sysconf (...) ;
extern int      truncate (...) ;
extern char*    ttyname (...) ;
extern int      ttyslot (...) ;
extern int      unlink (...) ;
extern int  vfork (...) ;
extern int      vadvise (...) ;
extern int      vhangup (...) ;
extern long  lseek (...) ;
extern int  read (...) ;
extern int  write (...) ;
extern int      access (...) ;
extern int      flock (...) ;
}
extern "C" {
extern	struct	_iobuf {
	int	_cnt;
	unsigned char *_ptr;
	unsigned char *_base;
	int	_bufsiz;
	short	_flag;
	char	_file;
} _iob[];
extern struct _iobuf 	*__hide_fopen ();
extern struct _iobuf 	*__hide_fdopen ();
extern struct _iobuf 	*__hide_freopen ();
extern struct _iobuf 	*__hide_popen ();
extern struct _iobuf 	*tmpfile();
extern long	__hide_ftell ();
extern char	*fgets();
extern char	*gets();
extern char	*__hide_sprintf ();
extern char	*ctermid();
extern char	*cuserid();
extern char	*__hide_tempnam ();
extern char	*tmpnam();
}
extern "C" {
int    fclose(struct _iobuf *);
struct _iobuf *  fdopen(int, const char*);
int    fflush(struct _iobuf *);
int    fgetc(struct _iobuf *);
char*  fgets(char*, int, struct _iobuf  *);
struct _iobuf *  fopen(const char*, const char*);
int    fprintf(struct _iobuf *, const char* ...);
int    fputc(int, struct _iobuf *);
int    fputs(const char*, struct _iobuf *);
int   fread(void*, int  , int  , struct _iobuf *);
struct _iobuf *  freopen(const char*, const char*, struct _iobuf *);
int    fscanf(struct _iobuf *, const char* ...);
int    fseek(struct _iobuf *, long, int);
long   ftell(struct _iobuf  *);
int   fwrite(const void*, int  , int  , struct _iobuf *);
char*  gets(char*);
int    getw(struct _iobuf *);
int    pclose(struct _iobuf *);
void   perror(const char*);
struct _iobuf *  popen(const char*, const char*);
int    printf(const char* ...);
int    puts(const char*);
int    putw(int, struct _iobuf *);
int    rewind(struct _iobuf *);
int    scanf(const char* ...);
void   setbuf(struct _iobuf *, char*);
void   setbuffer(struct _iobuf *, char*, int);
int    setlinebuf(struct _iobuf *);
int    setvbuf(struct _iobuf *, char*, int, int  );
int    sscanf(char*, const char* ...);
struct _iobuf *  tmpfile();
int    ungetc(int, struct _iobuf *);
int    vfprintf (...) ;
int    vprintf (...) ;
char*  sprintf (...) ;
char*  vsprintf (...) ;
extern int _filbuf (...) ;
extern int _flsbuf (...) ;
}
extern "C" {
extern int errno;
extern char*    sys_errlist[];
extern int      sys_nerr;
extern int      errno;
void      perror(const char*);
char*     strerr(int);
}
extern "C" {
struct flock {
	short	l_type;
	short	l_whence;
	long	l_start;
	long	l_len;
	short	l_pid;
	short	l_xxx;
};
struct eflock {
	short	l_type;
	short	l_whence;
	long	l_start;
	long	l_len;
	short	l_pid;
	short	l_xxx;
	long	l_rpid;
	long	l_rsys;
};
extern "C"
{
struct	stat {
	dev_t	st_dev;
	ino_t	st_ino;
	mode_t	st_mode;
	short	st_nlink;
	uid_t	st_uid;
	gid_t	st_gid;
	dev_t	st_rdev;
	off_t	st_size;
	time_t	st_atime;
	int	st_spare1;
	time_t	st_mtime;
	int	st_spare2;
	time_t	st_ctime;
	int	st_spare3;
	long	st_blksize;
	long	st_blocks;
	long	st_spare4[2];
};
int	__hide_chmod ( );
int	fstat( );
int	mkdir( );
int	mkfifo( );
int	stat( );
mode_t	umask( );
extern int       chmod  (...) ;
extern int       stat (...) ;
extern int       lstat (...) ;
extern int       fstat (...) ;
}
int	 __hide_open ( );
int	__hide_creat ( );
int	__hide_fcntl ( );
int       fcntl(int, int, ...);
int	  creat (...) ;
int       open (...) ;
}
extern "C" {
int strcasecmp (...) ;
}
extern "C" {
struct	tm {
	int	tm_sec;
	int	tm_min;
	int	tm_hour;
	int	tm_mday;
	int	tm_mon;
	int	tm_year;
	int	tm_wday;
	int	tm_yday;
	int	tm_isdst;
	char	*tm_zone;
	long	tm_gmtoff;
};
extern	struct tm *__hide_gmtime (), *__hide_localtime ();
extern	char *__hide_asctime (), *__hide_ctime ();
extern	void __hide_tzset (), __hide_tzsetwall ();
extern  int dysize();
extern  time_t timelocal(), timegm();
extern char* asctime (...) ;
extern char* ctime (...) ;
double difftime (...) ;
extern struct tm* gmtime (...) ;
extern struct tm* localtime (...) ;
extern long  mktime(struct tm*);
extern int  strftime (...) ;
extern void tzset();
extern void tzsetwall();
extern int getitimer(int, struct itimerval*);
extern int setitimer (...) ;
extern int gettimeofday(struct timeval*, struct timezone*);
extern int settimeofday (...) ;
extern int stime (...) ;
extern int dysize(int);
long      clock(void);
long       time(long *);
unsigned  ualarm(unsigned, unsigned);
unsigned  usleep(unsigned);
void      profil (...) ;
}
extern "C"
{
struct	linger {
	int	l_onoff;
	int	l_linger;
};
struct sockaddr {
	u_short	sa_family;
	char	sa_data[14];
};
struct sockproto {
	u_short	sp_family;
	u_short	sp_protocol;
};
struct msghdr {
	caddr_t	msg_name;
	int	msg_namelen;
	struct	iovec *msg_iov;
	int	msg_iovlen;
	caddr_t	msg_accrights;
	int	msg_accrightslen;
};
int       select (...) ;
int       accept (...) ;
int       bind (...) ;
int       connect (...) ;
int       getsockname (...) ;
int       getpeername (...) ;
int       getsockopt(int, int, int, void*, int*);
int       listen(int, int);
int       rcmd (...) ;
int       recv(int, void*, int, int);
int       recvfrom (...) ;
int       recvmsg(int, struct msghdr*, int);
int       rexec(char**, int, const char*, const char*, const char*, int*);
int       rresvport(int*);
int       send (...) ;
int       sendto (...) ;
int       sendmsg (...) ;
int       setsockopt (...) ;
int       shutdown(int, int);
int       socket(int, int, int);
int       socketpair(int, int, int, int sv[2]);
}
extern "C"
{
struct timeval {
	long	tv_sec;
	long	tv_usec;
};
struct timezone {
	int	tz_minuteswest;
	int	tz_dsttime;
};
struct	itimerval {
	struct	timeval it_interval;
	struct	timeval it_value;
};
}
extern "C"
{
struct	rusage {
	struct timeval ru_utime;
	struct timeval ru_stime;
	long	ru_maxrss;
	long	ru_ixrss;
	long	ru_idrss;
	long	ru_isrss;
	long	ru_minflt;
	long	ru_majflt;
	long	ru_nswap;
	long	ru_inblock;
	long	ru_oublock;
	long	ru_msgsnd;
	long	ru_msgrcv;
	long	ru_nsignals;
	long	ru_nvcsw;
	long	ru_nivcsw;
};
struct rlimit {
	int	rlim_cur;
	int	rlim_max;
};
int getrusage(int, struct rusage*);
int getrlimit (int resource, struct rlimit *rlp);
int setrlimit (...) ;
long      ulimit(int, long);
int       getpriority(int, int);
int       setpriority(int, int, int);
}
struct	iovec {
	caddr_t	iov_base;
	int	iov_len;
};
struct	uio {
	struct	iovec *uio_iov;
	int	uio_iovcnt;
	off_t	uio_offset;
	short	uio_segflg;
	short	uio_fmode;
	int	uio_resid;
};
enum	uio_rw { UIO_READ, UIO_WRITE };
extern "C" {
}
extern "C" {
extern caddr_t mmap();
}
struct	sockaddr_un {
	short	sun_family;
	char	sun_path[108];
};
struct ifnet {
	char	*if_name;
	short	if_unit;
	short	if_mtu;
	short	if_flags;
	short	if_timer;
	u_short	if_promisc;
	int	if_metric;
	struct	ifaddr *if_addrlist;
	struct	ifqueue {
		struct	mbuf *ifq_head;
		struct	mbuf *ifq_tail;
		int	ifq_len;
		int	ifq_maxlen;
		int	ifq_drops;
	} if_snd;
	int	(*if_init)();
	int	(*if_output)();
	int	(*if_ioctl)();
	int	(*if_reset)();
	int	(*if_watchdog)();
	int	if_ipackets;
	int	if_ierrors;
	int	if_opackets;
	int	if_oerrors;
	int	if_collisions;
	struct	ifnet *if_next;
	struct	ifnet *if_upper;
	struct	ifnet *if_lower;
	int	(*if_input)();
	int	(*if_ctlin)();
	int	(*if_ctlout)();
	struct map *if_memmap;
};
struct ifaddr {
	struct	sockaddr ifa_addr;
	union {
		struct	sockaddr ifu_broadaddr;
		struct	sockaddr ifu_dstaddr;
	} ifa_ifu;
	struct	ifnet *ifa_ifp;
	struct	ifaddr *ifa_next;
};
struct	ifreq {
	char	ifr_name[16 ];
	union {
		struct	sockaddr ifru_addr;
		struct	sockaddr ifru_dstaddr;
		char	ifru_oname[16 ];
		struct	sockaddr ifru_broadaddr;
		short	ifru_flags;
		int	ifru_metric;
		char	ifru_data[1];
		struct ifr_dnld_reqs {
			caddr_t	v_addr;
			caddr_t	m_addr;
			caddr_t	ex_addr;
			u_int	size;
		} ifru_dnld_req;
		struct ifr_fddi_stats {
			u_int	stat_size;
			caddr_t	fddi_stats;
		} ifru_fddi_stat;
		struct ifr_netmapents {
			u_int	map_ent_size,
				entry_number;
			caddr_t	fddi_map_ent;
		} ifru_netmapent;
		struct ifr_fddi_gen_struct {
			int	ifru_fddi_gioctl;
			caddr_t ifru_fddi_gaddr ;
		} ifru_fddi_gstruct;
	} ifr_ifru;
};
struct	ifconf {
	int	ifc_len;
	union {
		caddr_t	ifcu_buf;
		struct	ifreq *ifcu_req;
	} ifc_ifcu;
};
struct in_addr {
	union {
		struct { u_char s_b1,s_b2,s_b3,s_b4; } S_un_b;
		struct { u_short s_w1,s_w2; } S_un_w;
		u_long S_addr;
	} S_un;
};
struct sockaddr_in {
	short	sin_family;
	u_short	sin_port;
	struct	in_addr sin_addr;
	char	sin_zero[8];
};
extern "C" {
extern "C" {
extern void __eprintf (const char *, const char *, unsigned, const char *);
}
}
extern "C" {
typedef char * __gnuc_va_list;
void va_end (__gnuc_va_list);
typedef __gnuc_va_list va_list;
}
extern "C"
{
extern "C" {
typedef	int	faultcode_t;
void	(*__hide_signal ())();
void  (*sigset())();
int   sighold();
int   sigrelse();
int   sigignore();
struct	sigvec {
	void	(*sv_handler)();
	int	sv_mask;
	int	sv_flags;
};
struct	sigstack {
	char	*ss_sp;
	int	ss_onstack;
};
struct	sigcontext {
	int	sc_onstack;
	int	sc_mask;
	int	sc_sp;
	int	sc_pc;
	int	sc_npc;
	int	sc_psr;
	int	sc_g1;
	int	sc_o0;
	int	sc_wbcnt;
	char	*sc_spbuf[31	];
	int	sc_wbuf[31	][16];
};
struct	sigaction {
	void 		(*sa_handler)();
	sigset_t	sa_mask;
	int		sa_flags;
};
void	(*__hide_signal ())();
int	kill( );
int	sigaction(
);
int	sigaddset( );
int	sigdelset( );
int	sigemptyset( );
int	sigfillset( );
int	sigismember( );
int	sigpending( );
int	sigprocmask( );
int	sigsuspend( );
}
}
struct ipc_perm {
	ushort	uid;
	ushort	gid;
	ushort	cuid;
	ushort	cgid;
	ushort	mode;
	ushort	seq;
	key_t	key;
};
extern int ioc;
extern u_int nctxs;
extern u_int shm_alignment;
extern void vac_flushall( );
extern u_int	mmu_getctx(   );
extern u_int	mmu_getsyncflt(   );
extern void     mmu_getasyncflt(   );
extern u_int    mmu_getcr(   );
extern u_int    mmu_getctp(   );
extern void     mmu_getkpte(   );
extern void     mmu_getpte(   );
extern u_int    mmu_probe(   );
extern void     mmu_setcr(   );
extern void     mmu_setctp(   );
extern void     mmu_setctx(   );
extern void     mmu_setpte(   );
struct shmid_ds {
	struct ipc_perm	shm_perm;
	uint		shm_segsz;
	ushort		shm_lpid;
	ushort		shm_cpid;
	ushort		shm_nattch;
	time_t		shm_atime;
	time_t		shm_dtime;
	time_t		shm_ctime;
	struct anon_map	*shm_amp;
};
struct semid_ds {
	struct ipc_perm	sem_perm;
	struct sem	*sem_base;
	ushort		sem_nsems;
	time_t		sem_otime;
	time_t		sem_ctime;
};
struct sem {
	ushort	semval;
	short	sempid;
	ushort	semncnt;
	ushort	semzcnt;
};
struct sembuf {
	short	sem_num;
	short	sem_op;
	short	sem_flg;
};
union semun {
	int		val;
	struct semid_ds	*buf;
	ushort		*array;
};
struct msqid_ds {
	struct ipc_perm	msg_perm;
	struct msg	*msg_first;
	struct msg	*msg_last;
	ushort		msg_cbytes;
	ushort		msg_qnum;
	ushort		msg_qbytes;
	ushort		msg_lspid;
	ushort		msg_lrpid;
	time_t		msg_stime;
	time_t		msg_rtime;
	time_t		msg_ctime;
};
struct msgbuf {
	long	mtype;
	char	mtext[1];
};
struct msg {
	struct msg	*msg_next;
	long		msg_type;
	ushort		msg_ts;
	ushort		msg_spot;
};
class ostream; class streambuf; class backupbuf;
extern "C" int __underflow(streambuf*);
extern "C" int __overflow(streambuf*, int);
typedef long  streamoff;
typedef long  streampos;
typedef unsigned long __fmtflags;
typedef unsigned char __iostate;
struct _ios_fields {
    streambuf *_strbuf;
    ostream* _tie;
    int _width;
    __fmtflags _flags;
    char _fill;
    __iostate _state;
    unsigned short _precision;
};
class ios : public _ios_fields {
  public:
    typedef __fmtflags fmtflags;
    typedef __iostate iostate;
    enum io_state {
	goodbit = 0 ,
	eofbit = 1 ,
	failbit = 2 ,
	badbit = 4  };
    enum open_mode {
	in = 1 ,
	out = 2 ,
	ate = 4 ,
	app = 8 ,
	trunc = 16 ,
	nocreate = 32 ,
	noreplace = 64  };
    enum seek_dir { beg, cur, end};
    enum { skipws=01, left=02, right=04, internal=010,
	   dec=020, oct=040, hex=0100,
	   showbase=0200, showpoint=0400, uppercase=01000, showpos=02000,
	   scientific=04000, fixed=0100000, unitbuf=020000, stdio=040000,
	   dont_close=0x80000000
	   };
    ostream* tie() const { return _tie; }
    ostream* tie(ostream* val) { ostream* save=_tie; _tie=val; return save; }
    char fill() const { return _fill; }
    char fill(char newf) { char oldf = _fill; _fill = newf; return oldf; }
    fmtflags flags() const { return _flags; }
    fmtflags flags(fmtflags new_val) {
	fmtflags old_val = _flags; _flags = new_val; return old_val; }
    int precision() const { return _precision; }
    int precision(int newp) {
	unsigned short oldp = _precision; _precision = (unsigned short)newp;
	return oldp; }
    fmtflags setf(fmtflags val) {
	fmtflags oldbits = _flags;
	_flags |= val; return oldbits; }
    fmtflags setf(fmtflags val, fmtflags mask) {
	fmtflags oldbits = _flags;
	_flags = (_flags & ~mask) | (val & mask); return oldbits; }
    fmtflags unsetf(fmtflags mask) {
	fmtflags oldbits = _flags & mask;
	_flags &= ~mask; return oldbits; }
    int width() const { return _width; }
    int width(int val) { int save = _width; _width = val; return save; }
    static const unsigned long basefield;
    static const unsigned long adjustfield;
    static const unsigned long floatfield;
    streambuf* rdbuf() const { return _strbuf; }
    void clear(iostate state = 0) { _state = state; }
    void set(iostate flag) { _state |= flag; }
    int good() const { return _state == 0; }
    int eof() const { return _state & ios::eofbit; }
    int fail() const { return _state & (ios::badbit|ios::failbit); }
    int bad() const { return _state & ios::badbit; }
    int rdstate() const { return _state; }
    operator void*() const { return fail() ? (void*)0 : (void*)(-1); }
    int operator!() const { return fail(); }
  protected:
    ios(streambuf* sb = 0, ostream* tie = 0);
    ~ios();
};
typedef ios::seek_dir _seek_dir;
class streammarker {
    friend class streambuf;
    friend int __underflow(streambuf*);
    struct streammarker *_next;
    streambuf *_sbuf;
    streampos _spos;
    void set_streampos(streampos sp) { _spos = sp; }
    void set_offset(int offset) { _pos = offset; _spos = (streampos)(-2); }
    int _pos;
  public:
    streammarker(streambuf *sb);
    ~streammarker();
    int saving() { return  _spos == -2; }
    int delta(streammarker&);
    int delta();
};
struct __streambuf {
    int _flags;
    char* _gptr;
    char* _egptr;
    char* _eback;
    char* _pbase;
    char* _pptr;
    char* _epptr;
    char* _base;
    char* _ebuf;
    struct streambuf *_chain;
    friend class streammarker;
    char *_other_gbase;
    char *_aux_limit;
    char *_other_egptr;
    streammarker *_markers;
    unsigned short _cur_column;
    char _unused;
    char _shortbuf[1];
};
extern unsigned __adjust_column(unsigned start, const char *line, int count);
struct streambuf : private __streambuf {
    friend class ios;
    friend class istream;
    friend class ostream;
    friend class streammarker;
    friend int __underflow(streambuf*);
  protected:
    static streambuf* _list_all;
    streambuf*& xchain() { return _chain; }
    void _un_link();
    void _link_in();
    char* gptr() const { return _gptr; }
    char* pptr() const { return _pptr; }
    char* egptr() const { return _egptr; }
    char* epptr() const { return _epptr; }
    char* pbase() const { return _pbase; }
    char* eback() const { return _eback; }
    char* ebuf() const { return _ebuf; }
    char* base() const { return _base; }
    void xput_char(char c) { *_pptr++ = c; }
    int xflags() { return _flags; }
    int xflags(int f) { int fl = _flags; _flags = f; return fl; }
    void xsetflags(int f) { _flags |= f; }
    void xsetflags(int f, int mask) { _flags = (_flags & ~mask) | (f & mask); }
    void gbump(int n) { _gptr += n; }
    void pbump(int n) { _pptr += n; }
    void setb(char* b, char* eb, int a=0);
    void setp(char* p, char* ep) { _pbase=_pptr=p; _epptr=ep; }
    void setg(char* eb, char* g, char *eg) { _eback=eb; _gptr=g; _egptr=eg; }
    char *shortbuf() { return _shortbuf; }
    int in_backup() { return _flags & 0x100 ; }
    char *Gbase() { return in_backup() ? _other_gbase : _eback; }
    char *eGptr() { return in_backup() ? _other_egptr : _egptr; }
    char *Bbase() { return in_backup() ? _eback : _other_gbase; }
    char *Bptr() { return _aux_limit; }
    char *eBptr() { return in_backup() ? _egptr : _other_egptr; }
    char *Nbase() { return _other_gbase; }
    char *eNptr() { return _other_egptr; }
    int have_backup() { return _other_gbase != 0 ; }
    int have_markers() { return _markers != 0 ; }
    int _least_marker();
    void switch_to_main_get_area();
    void switch_to_backup_area();
    void free_backup_area();
    void unsave_markers();
    int put_mode() { return _flags & 0x800 ; }
    int switch_to_get_mode();
    streambuf(int flags=0);
  public:
    static int flush_all();
    static void flush_all_linebuffered();
    virtual int underflow() = 0;
    virtual int overflow(int c = (-1) ) = 0;
    virtual int doallocate();
    virtual streampos seekoff(streamoff, _seek_dir, int mode=ios::in|ios::out);
    virtual streampos seekpos(streampos pos, int mode = ios::in|ios::out);
    int seekmark(streammarker& mark, int delta = 0);
    int sputbackc(char c);
    int sungetc();
    virtual ~streambuf();
    int unbuffered() { return _flags & 2  ? 1 : 0; }
    int linebuffered() { return _flags & 0x200  ? 1 : 0; }
    void unbuffered(int i)
	{ if (i) _flags |= 2 ; else _flags &= ~2 ; }
    void linebuffered(int i)
	{ if (i) _flags |= 0x200 ; else _flags &= ~0x200 ; }
    int allocate() {
	if (base() || unbuffered()) return 0;
	else return doallocate(); }
    void allocbuf() { if (base() == 0 ) doallocbuf(); }
    void doallocbuf();
    virtual int sync();
    virtual int pbackfail(int c);
    virtual int ungetfail();
    virtual streambuf* setbuf(char* p, int len);
    int in_avail() { return _egptr - _gptr; }
    int out_waiting() { return _pptr - _pbase; }
    virtual int sputn(const char* s, int n);
    int padn(char pad, int n);
    virtual int sgetn(char* s, int n);
    int ignore(int);
    virtual int get_column();
    virtual int set_column(int);
    long sgetline(char* buf, int  n, char delim, int putback_delim);
    int sbumpc() {
	if (_gptr >= _egptr && __underflow(this) == (-1) ) return (-1) ;
	else return *(unsigned char*)_gptr++; }
    int sgetc() {
	if (_gptr >= _egptr && __underflow(this) == (-1) ) return (-1) ;
	else return *(unsigned char*)_gptr; }
    int snextc() {
	if (++_gptr >= _egptr && __underflow(this) == (-1) ) return (-1) ;
	else return *(unsigned char*)_gptr; }
    int sputc(int c) {
	if (_pptr >= _epptr) return __overflow(this, (unsigned char)c);
	return *_pptr++ = c, (unsigned char)c; }
    void stossc() { if (_gptr < _egptr) _gptr++; }
    int vscan(char const *fmt0, char *  ap, ios::iostate* = 0 );
    int vform(char const *fmt0, char *  ap);
};
class backupbuf : public streambuf {
    friend class streammarker;
  protected:
    backupbuf(int flags=0) : streambuf(flags|0x4000 ) { }
  public:
    virtual int pbackfail(int c);
    virtual int underflow();
    virtual int overflow(int c = (-1) );
};
struct __file_fields {
    short _fileno;
    int _blksize;
    long   _offset;
};
class filebuf : public backupbuf {
  protected:
    struct __file_fields _fb;
    void init();
  public:
    filebuf();
    filebuf(int fd);
    filebuf(int fd, char* p, int len);
    ~filebuf();
    filebuf* attach(int fd);
    filebuf* open(const char *filename, const char *mode);
    filebuf* open(const char *filename, int mode, int prot = 0664);
    virtual int underflow();
    virtual int overflow(int c = (-1) );
    int is_open() { return _fb._fileno >= 0; }
    int fd() { return is_open() ? _fb._fileno : (-1) ; }
    filebuf* close();
    virtual int doallocate();
    virtual streampos seekoff(streamoff, _seek_dir, int mode=ios::in|ios::out);
    int sputn(const char* s, int n);
    int sgetn(char* s, int n);
    virtual int sync();
  protected:
    int is_reading() { return eback() != egptr(); }
    char* cur_ptr() { return is_reading() ?  gptr() : pptr(); }
    char* file_ptr() { return eGptr(); }
    int do_write(const char *data, int to_do);
    int do_flush() { return do_write(_pbase, _pptr-_pbase); }
    virtual int  sys_read(char* buf, int  size);
    virtual long   sys_seek(long  , _seek_dir);
    virtual int  sys_write(const void*, long);
    virtual int sys_stat(void*);
    virtual int sys_close();
};
inline ios::ios(streambuf* sb  , ostream* tie  ) {
		_tie = tie; _strbuf=sb; _state=0; _width=0; _fill=' ';
		_flags=ios::skipws; _precision=6; }
inline ios::~ios() {
    if (!(_flags & (unsigned int)ios::dont_close)) delete _strbuf; }
class istream; class ostream;
typedef ios& (*__manip)(ios&);
typedef istream& (*__imanip)(istream&);
typedef ostream& (*__omanip)(ostream&);
extern istream& ws(istream& ins);
extern ostream& flush(ostream& outs);
extern ostream& endl(ostream& outs);
extern ostream& ends(ostream& outs);
class ostream : public ios
{
    void do_osfx();
  public:
    ostream() { }
    ostream(streambuf* sb, ostream* tied=0 );
    int opfx() { if (!good()) return 0; if (_tie) _tie->flush(); return 1; }
    void osfx() { if (flags() & (ios::unitbuf|ios::stdio))
		      do_osfx(); }
    streambuf* ostreambuf() const { return _strbuf; }
    ostream& flush();
    ostream& put(char c) { _strbuf->sputc(c); return *this; }
    ostream& write(const char *s, int n);
    ostream& write(const unsigned char *s, int n) { return write((const char*)s, n);}
    ostream& write(const signed char *s, int n) { return write((const char*)s, n);}
    ostream& write(const void *s, int n) { return write((const char*)s, n);}
    ostream& seekp(streampos);
    ostream& seekp(streamoff, _seek_dir);
    streampos tellp();
    ostream& form(const char *format ...);
    ostream& vform(const char *format, char *  args);
};
extern ostream& operator<<(ostream&, char c);
inline ostream& operator<<(ostream& os, unsigned char c)
{ return os << (char)c; }
extern ostream& operator<<(ostream &os, signed char c) { return os << (char)c;}
extern ostream& operator<<(ostream&, const char *s);
inline ostream& operator<<(ostream& os, const unsigned char *s)
{ return os << (const char*)s; }
inline ostream& operator<<(ostream& os, const signed char *s)
{ return os << (const char*)s; }
extern ostream& operator<<(ostream&, void *p);
extern ostream& operator<<(ostream&, int n);
extern ostream& operator<<(ostream&, long n);
extern ostream& operator<<(ostream&, unsigned int n);
extern ostream& operator<<(ostream&, unsigned long n);
inline ostream& operator<<(ostream& os, short n) {return os << (int)n;}
inline ostream& operator<<(ostream& os, unsigned short n)
{return os << (unsigned int)n;}
extern ostream& operator<<(ostream&, float n);
extern ostream& operator<<(ostream&, double n);
inline ostream& operator<<(ostream& os, __omanip func) { return (*func)(os); }
inline ostream& operator<<(ostream& os, __manip func) {(*func)(os); return os;}
extern ostream& operator<<(ostream&, streambuf*);
class istream : public ios
{
    int  _gcount;
    int _skip_ws();
  public:
    istream() { _gcount = 0; }
    istream(streambuf* sb, ostream*tied=0 );
    streambuf* istreambuf() const { return _strbuf; }
    istream& get(char& c);
    istream& get(unsigned char& c) { return get((char&)c); }
    istream& get(signed char& c)  { return get((char&)c); }
    istream& read(char *ptr, int n);
    istream& read(unsigned char *ptr, int n) { return read((char*)ptr, n); }
    istream& read(signed char *ptr, int n) { return read((char*)ptr, n); }
    istream& read(void *ptr, int n) { return read((char*)ptr, n); }
    istream& getline(char* ptr, int len, char delim = '\n');
    istream& get(char* ptr, int len, char delim = '\n');
    istream& get(streambuf& sb, char delim = '\n');
    istream& gets(char **s, char delim = '\n');
    int ipfx(int need) {
	if (!good()) { set(ios::failbit); return 0; }
	if (_tie && (need == 0 || rdbuf()->in_avail() < need)) _tie->flush();
	if (!need && (flags() & ios::skipws)) return _skip_ws();
	return 1;
    }
    int ipfx0() {
	if (!good()) { set(ios::failbit); return 0; }
	if (_tie) _tie->flush();
	if (flags() & ios::skipws) return _skip_ws();
	return 1;
    }
    int ipfx1() {
	if (!good()) { set(ios::failbit); return 0; }
	if (_tie && rdbuf()->in_avail() == 0) _tie->flush();
	return 1;
    }
    int get() { if (!ipfx1()) return (-1) ;
		int ch = _strbuf->sbumpc();
		if (ch == (-1) ) set(ios::eofbit);
		return ch; }
    int peek() { if (!ipfx1()) return (-1) ;
		int ch = _strbuf->sgetc();
		if (ch == (-1) ) set(ios::eofbit);
		return ch; }
    int  gcount() { return _gcount; }
    istream& ignore(int n=1, int delim = (-1) );
    istream& seekg(streampos);
    istream& seekg(streamoff, _seek_dir);
    streampos tellg();
    istream& putback(char ch) {
	if (good() && _strbuf->sputbackc(ch) == (-1) ) clear(ios::badbit);
	return *this;}
    istream& unget() {
	if (good() && _strbuf->sungetc() == (-1) ) clear(ios::badbit);
	return *this;}
    istream& scan(const char *format ...);
    istream& vscan(const char *format, char *  args);
};
extern istream& operator>>(istream&, char*);
inline istream& operator>>(istream& is, unsigned char* p)
{ return is >> (char*)p; }
inline istream& operator>>(istream& is, signed char*p) {return is >> (char*)p;}
extern istream& operator>>(istream&, char& c);
extern istream& operator>>(istream& s, unsigned char& c) {return s>>(char&)c;}
extern istream& operator>>(istream& s, signed char& c) {return s >> (char&)c;}
extern istream& operator>>(istream&, int&);
extern istream& operator>>(istream&, long&);
extern istream& operator>>(istream&, short&);
extern istream& operator>>(istream&, unsigned int&);
extern istream& operator>>(istream&, unsigned long&);
extern istream& operator>>(istream&, unsigned short&);
extern istream& operator>>(istream&, float&);
extern istream& operator>>(istream&, double&);
inline istream& operator>>(istream& is, __manip func) {(*func)(is); return is;}
inline istream& operator>>(istream& is, __imanip func) { return (*func)(is); }
extern istream& operator>>(istream&, streambuf*);
class iostream : public ios {
    int  _gcount;
  public:
    iostream() { _gcount = 0; }
    iostream(streambuf* sb, ostream*tied=0 );
    operator istream&() { return *(istream*)this; }
    operator ostream&() { return *(ostream*)this; }
    istream& get(char& c) { return ((istream*)this)->get(c); }
    istream& get(unsigned char& c) { return ((istream*)this)->get((char&)c); }
    istream& get(signed char& c) { return ((istream*)this)->get((char&)c); }
    istream& read(char *ptr, int n) { return ((istream*)this)->read(ptr, n); }
    istream& read(unsigned char *ptr, int n)
	{ return ((istream*)this)->read((char*)ptr, n); }
    istream& read(signed char *ptr, int n)
	{ return ((istream*)this)->read((char*)ptr, n); }
    istream& read(void *ptr, int n)
	{ return ((istream*)this)->read((char*)ptr, n); }
    istream& getline(char* ptr, int len, char delim = '\n')
	{ return ((istream*)this)->getline(ptr, len, delim); }
    istream& get(char* ptr, int len, char delim = '\n')
	{ return ((istream*)this)->get(ptr, len, delim); }
    istream& gets(char **s, char delim = '\n')
	{ return ((istream*)this)->gets(s, delim); }
    istream& ignore(int n=1, int delim = (-1) )
	{ return ((istream*)this)->ignore(n, delim); }
    int ipfx(int need) { return ((istream*)this)->ipfx(need); }
    int ipfx0()  { return ((istream*)this)->ipfx0(); }
    int ipfx1()  { return ((istream*)this)->ipfx1(); }
    int get() { return _strbuf->sbumpc(); }
    int peek() { return ipfx1() ? _strbuf->sgetc() : (-1) ; }
    int  gcount() { return _gcount; }
    istream& putback(char ch) { return ((istream*)this)->putback(ch); }
    istream& unget() { return ((istream*)this)->unget(); }
    istream& seekg(streampos pos) { return ((istream*)this)->seekg(pos); }
    istream& seekg(streamoff off, _seek_dir dir)
	{ return ((istream*)this)->seekg(off, dir); }
    streampos tellg() { return ((istream*)this)->tellg(); }
    istream& scan(const char *format ...);
    istream& vscan(const char *format, char *  args)
	{ return ((istream*)this)->vscan(format, args); }
    int opfx() { return ((ostream*)this)->opfx(); }
    void osfx() { ((ostream*)this)->osfx(); }
    ostream& flush() { return ((ostream*)this)->flush(); }
    ostream& put(char c) { return ((ostream*)this)->put(c); }
    ostream& write(const char *s, int n)
	{ return ((ostream*)this)->write(s, n); }
    ostream& write(const unsigned char *s, int n)
	{ return ((ostream*)this)->write((const char*)s, n); }
    ostream& write(const signed char *s, int n)
	{ return ((ostream*)this)->write((const char*)s, n); }
    ostream& write(const void *s, int n)
	{ return ((ostream*)this)->write((const char*)s, n); }
    ostream& form(const char *format ...);
    ostream& vform(const char *format, char *  args)
	{ return ((ostream*)this)->vform(format, args); }
    ostream& seekp(streampos pos) { return ((ostream*)this)->seekp(pos); }
    ostream& seekp(streamoff off, _seek_dir dir)
	{ return ((ostream*)this)->seekp(off, dir); }
    streampos tellp() { return ((ostream*)this)->tellp(); }
};
extern istream cin;
extern ostream cout, cerr, clog;
struct Iostream_init { } ;
inline ios& dec(ios& i)
{ i.setf(ios::dec, ios::dec|ios::hex|ios::oct); return i; }
inline ios& hex(ios& i)
{ i.setf(ios::hex, ios::dec|ios::hex|ios::oct); return i; }
inline ios& oct(ios& i)
{ i.setf(ios::oct, ios::dec|ios::hex|ios::oct); return i; }
extern "C"
{
pid_t wait (int *);
unsigned long inet_addr();
char	*inet_ntoa();
struct	in_addr inet_makeaddr();
unsigned long inet_network();
extern "C"
{
struct	hostent {
	char	*h_name;
	char	**h_aliases;
	int	h_addrtype;
	int	h_length;
	char	**h_addr_list;
};
struct	netent {
	char		*n_name;
	char		**n_aliases;
	int		n_addrtype;
	unsigned long	n_net;
};
struct	servent {
	char	*s_name;
	char	**s_aliases;
	int	s_port;
	char	*s_proto;
};
struct	protoent {
	char	*p_name;
	char	**p_aliases;
	int	p_proto;
};
struct rpcent {
	char	*r_name;
	char	**r_aliases;
	int	r_number;
};
struct hostent	*gethostbyname(), *gethostbyaddr(), *gethostent();
struct netent	*getnetbyname(), *getnetbyaddr(), *getnetent();
struct servent	*getservbyname(), *getservbyport(), *getservent();
struct protoent	*getprotobyname(), *getprotobynumber(), *getprotoent();
struct rpcent	*getrpcbyname(), *getrpcbynumber(), *getrpcent();
extern  int h_errno;
}
extern "C" {
struct	direct {
	off_t   d_off;
	u_long	d_fileno;
	u_short	d_reclen;
	u_short	d_namlen;
	char	d_name[255  + 1];
};
typedef struct _dirdesc {
	int	dd_fd;
	long	dd_loc;
	long	dd_size;
	long	dd_bsize;
	long	dd_off;
	char	*dd_buf;
} DIR;
extern	DIR *__hide_opendir ();
extern	struct direct *__hide_readdir ();
extern	long __hide_telldir ();
extern	void __hide_seekdir ();
extern	int __hide_closedir ();
DIR *opendir(const char *);
int closedir(DIR *);
struct direct *readdir(DIR *);
long telldir(DIR *);
void seekdir(DIR *, long);
}
}
struct	mallinfo  {
	int arena;
	int ordblks;
	int smblks;
	int hblks;
	int hblkhd;
	int usmblks;
	int fsmblks;
	int uordblks;
	int fordblks;
	int keepcost;
	int mxfast;
	int nlblks;
	int grain;
	int uordbytes;
	int allocated;
	int treeoverhead;
};
typedef	char *	malloc_t;
extern	malloc_t	calloc( );
extern	int		free( );
extern	malloc_t	malloc( );
extern	malloc_t	realloc( );
extern	int		mallopt();
extern	struct mallinfo mallinfo();
extern "C" {
extern	char	_ctype_[];
extern int toupper (...) ;
extern int tolower (...) ;
}
extern "C" {
typedef void  (*SignalHandler) (...);
typedef int (*SSignalHandler) (...);
extern SignalHandler signal (...) ;
extern SSignalHandler ssignal (...) ;
extern int           gsignal  (...) ;
extern int           kill  (...) ;
extern int           killpg (...) ;
extern int           siginterrupt (...) ;
extern void	     psignal (...) ;
extern int           sigsetmask (...) ;
extern int           sigblock (...) ;
extern int           sigpause (...) ;
extern int           sigvec (...) ;
}
extern "C"
{
}
struct	ttychars {
	char	tc_erase;
	char	tc_kill;
	char	tc_intrc;
	char	tc_quitc;
	char	tc_startc;
	char	tc_stopc;
	char	tc_eofc;
	char	tc_brkc;
	char	tc_suspc;
	char	tc_dsuspc;
	char	tc_rprntc;
	char	tc_flushc;
	char	tc_werasc;
	char	tc_lnextc;
};
struct tchars {
	char	t_intrc;
	char	t_quitc;
	char	t_startc;
	char	t_stopc;
	char	t_eofc;
	char	t_brkc;
};
struct ltchars {
	char	t_suspc;
	char	t_dsuspc;
	char	t_rprntc;
	char	t_flushc;
	char	t_werasc;
	char	t_lnextc;
};
struct	sgttyb {
	char	sg_ispeed;
	char	sg_ospeed;
	char	sg_erase;
	char	sg_kill;
	short	sg_flags;
};
struct winsize {
	unsigned short	ws_row;
	unsigned short	ws_col;
	unsigned short	ws_xpixel;
	unsigned short	ws_ypixel;
};
struct ttysize {
	int	ts_lines;
	int	ts_cols;
};
extern "C" {
struct passwd {
	char	*pw_name;
	char	*pw_passwd;
	int	pw_uid;
	int	pw_gid;
	char	*pw_age;
	char	*pw_comment;
	char	*pw_gecos;
	char	*pw_dir;
	char	*pw_shell;
};
extern struct passwd *c_proto_getpwent ();
struct comment {
        char    *c_dept;
        char    *c_name;
        char    *c_acct;
        char    *c_bin;
};
struct passwd *c_proto_getpwuid ( );
struct passwd *c_proto_getpwnam ( );
extern struct passwd* getpwent();
extern struct passwd* getpwuid(int);
extern struct passwd* getpwnam(const char*);
extern int            setpwent();
extern int            endpwent();
}
extern "C"
{
  int semget (key_t, int, int);
  int semop (int, sembuf *, int);
  int semctl (int, int, int, semun);
  int msgsnd (int, void *, int, int);
  int msgrcv (int, void *, int, int, int);
  int msgctl (int, int, struct msqid_ds *);
  int msgget (int, int);
}
class Message
{
public:
  Message (int type = 0);
  ~Message (void);
  int get_type (void);
  void set_type (int type);
protected:
  long type;
};
inline
Message::Message (int t): type (t)
{
}
inline
Message::~Message (void)
{
}
inline  int
Message::get_type (void)
{
  return this->type;
}
inline  void
Message::set_type (int t)
{
  this->type = t;
}
class Message_Queue
{
public:
  enum {CREATE = 0001000		, OPEN = 0, NONBLOCK = 0004000		};
  Message_Queue (void);
  Message_Queue (key_t external_id, int create = Message_Queue::OPEN, int perms = 0666);
  ~Message_Queue (void);
  int open (key_t external_id, int create = Message_Queue::OPEN, int perms = 0666);
  int close (void);
  int remove (void);
  int recv (Message *mb, int length, int mtype, int mflags = 0);
  int send (Message *mb, int length, int mflags = 0);
  int control (int option, void *arg = 0);
  int get_id (void);
  void set_id (int);
protected:
  int internal_id;
};
inline  int
Message_Queue::open (key_t external_id, int create, int perms)
{
  return this->internal_id = ::msgget (external_id, create | perms);
}
inline  int
Message_Queue::close (void)
{
  return 1;
}
inline  int
Message_Queue::control (int option, void *arg)
{
  return ::msgctl (this->internal_id, option, (struct msqid_ds *) arg);
}
inline  int
Message_Queue::remove (void)
{
  return this->control (0	);
}
inline  int
Message_Queue::get_id (void)
{
  return this->internal_id;
}
inline  void
Message_Queue::set_id (int id)
{
  this->internal_id = id;
}
inline
Message_Queue::Message_Queue (void)
{
}
inline
Message_Queue::Message_Queue (key_t external_id, int create, int perms)
{
  if (this->open (external_id, create, perms) < 0)
    perror ("Message_Queue::Message_Queue");
}
inline
Message_Queue::~Message_Queue (void)
{
}
inline  int
Message_Queue::recv (Message *mb, int length, int type, int mflags)
{
  return ::msgrcv (this->internal_id, mb, length, type, mflags);
}
inline  int
Message_Queue::send (Message *mb, int length, int mflags)
{
  return ::msgsnd (this->internal_id, mb, length, mflags);
}
template <class T>
class Typed_Message : public Message
{
public:
  Typed_Message (int type = 0, int length = sizeof (T), int max = sizeof (T));
  Typed_Message (const T &data, int type = 0, int length = sizeof (T), int max = sizeof (T));
  ~Typed_Message (void);
  int get_type (void);
  void set_type (int type);
  int get_length (void);
  void set_length (int l);
  int get_max (void);
  void set_max (int m);
  T &get_data (void);
  void set_data (const T &data);
private:
  int  length;
  int  max;
  T    data;
};
template <class T> inline
Typed_Message<T>::Typed_Message (int t, int l, int m)
{
  this->set_type (t);
  this->set_length (l);
  this->set_max (m);
}
template <class T> inline
Typed_Message<T>::Typed_Message (const T &d, int t, int l, int m)
				: data (d)
{
  this->set_type (t);
  this->set_length (l);
  this->set_max (m);
}
template <class T> inline
Typed_Message<T>::~Typed_Message (void)
{
}
template <class T> inline  int
Typed_Message<T>::get_type (void)
{
  return Message::get_type ();
}
template <class T> inline  void
Typed_Message<T>::set_type (int t)
{
  Message::set_type (t);
}
template <class T> inline  int
Typed_Message<T>::get_length (void)
{
  return this->length;
}
template <class T> inline  void
Typed_Message<T>::set_length (int l)
{
  this->length =  (sizeof *this - (sizeof this->type + sizeof this->data)) + l;
}
template <class T> inline  int
Typed_Message<T>::get_max (void)
{
  return this->max;
}
template <class T> inline  void
Typed_Message<T>::set_max (int m)
{
  this->max =  (sizeof *this - (sizeof this->type + sizeof this->data)) + m;
}
template <class T> inline  T &
Typed_Message<T>::get_data (void)
{
  return this->data;
}
template <class T> inline  void
Typed_Message<T>::set_data (const T &d)
{
  this->data = d;
}
template <class T>
class Typed_Message_Queue
{
public:
  enum {CREATE = 0001000		, OPEN = 0, NONBLOCK = 0004000		};
  Typed_Message_Queue (void);
  Typed_Message_Queue (key_t external_id, int create = Typed_Message_Queue::OPEN, int perms = 0666);
  ~Typed_Message_Queue (void);
  int recv (Typed_Message<T> &mb, int mflags = 0);
  int send (Typed_Message<T> &mb, int mflags = 0);
  int open (key_t external_id, int create = Message_Queue::OPEN, int perms = 0666);
  int close (void);
  int remove (void);
  int control (int option, void *arg = 0);
private:
  Message_Queue message_queue;
};
template <class T> inline  int
Typed_Message_Queue<T>::open (key_t external_id, int create, int perms)
{
  return this->message_queue.open (external_id, create, perms);
}
template <class T> inline  int
Typed_Message_Queue<T>::close (void)
{
  return 1;
}
template <class T> inline
Typed_Message_Queue<T>::Typed_Message_Queue (void)
{
}
template <class T> inline
Typed_Message_Queue<T>::Typed_Message_Queue (key_t external_id, int create, int perms)
{
  if (this->open (external_id, create, perms) < 0)
    perror ("Typed_Message_Queue::Typed_Message_Queue");
}
template <class T> inline
Typed_Message_Queue<T>::~Typed_Message_Queue (void)
{
}
template <class T> inline  int
Typed_Message_Queue<T>::recv (Typed_Message<T> &mb, int mflags)
{
  int length = this->message_queue.recv (&mb, mb.get_max (), mb.get_type (), mflags);
  if (length != -1)
    mb.set_length (length);
  return length;
}
template <class T> inline  int
Typed_Message_Queue<T>::send (Typed_Message<T> &mb, int mflags)
{
  return this->message_queue.send (&mb, mb.get_length (), mflags);
}
template <class T> inline  int
Typed_Message_Queue<T>::remove (void)
{
  return this->message_queue.remove ();
}
template <class T> inline  int
Typed_Message_Queue<T>::control (int option, void *arg = 0)
{
  return this->message_queue.control (option, arg);
}
class Message_Data
{
public:
  Message_Data (int p = -1, const char user[] = "", char text[] = "")
  {
    this->pid = p;
    strncpy (this->username, user, 9);
    strncpy (this->mtext, text, 	128 );
  }
  int get_pid (void) { return this->pid; }
  void set_pid (int p) { this->pid = p; }
  char *get_user (void) { return this->username; }
  void set_user (char user[]) { strncpy (username, user, 9); }
  char *get_text (void) { return this->mtext; }
  void set_text (char text[]) { strncpy (mtext, text, 	128 ); }
  int get_length (void) { return sizeof *this - sizeof this->mtext + strlen (this->mtext) + 1; }
protected:
  int	pid;
  char 	username[9];
  char	mtext[	128 ];
};
class Message_Block : public Message, public Message_Data
{
public:
  Message_Block (int t, int pid = 0, char login[] = "", char message[] = "")
  : Message (t), Message_Data (pid, login, message)
  {
  }
};
typedef Typed_Message<Message_Data> T_Msg;
typedef Typed_Message_Queue<Message_Data> T_Msg_Que;
T_Msg_Que msgque (1234 , Typed_Message_Queue<Message_Data>::CREATE);
void
SIGNAL_handler (int sig)
{
  if (msgque.remove () < 0)
    perror ("msgque.close"), exit (1);
  exit (0);
}
int
main (void)
{
  ;
  T_Msg send_msg (Message_Data (getpid (), getlogin (), "I received your message."), 0, md.get_length ());
  T_Msg recv_msg (1 );
  signal (2	, SIGNAL_handler);
  for (;;)
    {
      if (msgque.recv (recv_msg) == -1)
	perror ("msgque.recv"), exit (1);
      Message_Data &recv_msg_data = recv_msg.get_data ();
      cout << "a msg of length "
	   << recv_msg_data.get_length ()
	   << " sent from client "
	   << recv_msg_data.get_pid ()
	   << " (user "
	   << recv_msg_data.get_user () << "): "
	   << recv_msg_data.get_text () << "\n";
      send_msg.set_type (recv_msg_data.get_pid ());
      if (msgque.send (send_msg) < 0)
	perror ("msgque.send"), exit (1);
    }
}

Newsgroups: gnu.g++.bug