#ifndef _INC_H
#define _INC_H
#include <stdio.h>
#include <stdarg.h>
#include <stdlib.h>
#include <errno.h>
#include <ctype.h>
#include <unistd.h>
#include <signal.h>
#include <sys/stat.h>
#include <errno.h>
#include <string.h>
#include <fcntl.h>
#include <sys/types.h>
#include <sys/param.h>
#include <time.h>
#include <locale.h>
#include <ar.h>
#include <libelf.h>
#include "sgs.h"
#include "msg.h"
#define CHUNK 500
#define SYMCHUNK 1000
#define SNAME 16
#define ROUNDUP(x) (((x) + 1) & ~1)
#define DATESIZE 60
typedef struct arfile ARFILE;
typedef ARFILE *ARFILEP;
struct arfile {
char ar_name[SNAME];
time_t ar_date;
int ar_uid;
int ar_gid;
unsigned long ar_mode;
size_t ar_size;
char *ar_longname;
char *ar_rawname;
Elf *ar_elf;
char *ar_pathname;
char *ar_contents;
size_t ar_offset;
unsigned char ar_flag;
unsigned char ar_padding;
ARFILE *ar_next;
};
struct cmd_info;
typedef void Cmd_func(struct cmd_info *);
typedef struct cmd_info {
char *arnam;
int afd;
Elf *arf;
char *ponam;
char **namv;
int namc;
int opt_flgs;
Cmd_func *comfun;
int modified;
} Cmd_info;
#define a_FLAG 0x00000001
#define b_FLAG 0x00000002
#define c_FLAG 0x00000004
#define C_FLAG 0x00000008
#define d_FLAG 0x00000010
#define m_FLAG 0x00000020
#define p_FLAG 0x00000040
#define q_FLAG 0x00000080
#define r_FLAG 0x00000100
#define s_FLAG 0x00000200
#define S_FLAG 0x00000400
#define t_FLAG 0x00000800
#define T_FLAG 0x00001000
#define u_FLAG 0x00002000
#define v_FLAG 0x00004000
#define x_FLAG 0x00008000
#define z_FLAG 0x00010000
#define F_ELFRAW 0x01
#define F_CLASS32 0x02
#define F_CLASS64 0x04
Cmd_func qcmd;
Cmd_func rcmd;
Cmd_func dcmd;
Cmd_func xcmd;
Cmd_func pcmd;
Cmd_func mcmd;
Cmd_func tcmd;
extern ARFILE *listhead, *listend;
extern void establish_sighandler(void (*)());
extern int getaf(Cmd_info *);
extern ARFILE *getfile(Cmd_info *);
extern ARFILE *newfile(void);
extern char *trim(char *);
extern void writefile(Cmd_info *cmd_info);
#endif