# 1 "export.c"
 




# 1 "tags.h" 1
 





































 




 










 









# 6 "export.c" 2

# 1 "ml_os.h" 1
 












# 1 "/usr/include/sys/types.h" 1 3
# 1 "/usr/include/linux/types.h" 1 3





typedef unsigned int size_t;




typedef int ssize_t;




typedef long time_t;




typedef long clock_t;




typedef int ptrdiff_t;






typedef int pid_t;
typedef unsigned short uid_t;
typedef unsigned short gid_t;
typedef unsigned short dev_t;



typedef unsigned long ino_t;

typedef unsigned short mode_t;
typedef unsigned short umode_t;
typedef unsigned short nlink_t;
typedef int daddr_t;
typedef long off_t;

 
typedef unsigned char u_char;
typedef unsigned short u_short;
typedef unsigned int u_int;
typedef unsigned long u_long;

 
typedef unsigned char unchar;
typedef unsigned short ushort;
typedef unsigned int uint;
typedef unsigned long ulong;

typedef char *caddr_t;

typedef unsigned char cc_t;
typedef unsigned int speed_t;
typedef unsigned long tcflag_t;

 










 






typedef struct fd_set {
	unsigned long fds_bits [8 ];
} fd_set;
































struct ustat {
	daddr_t f_tfree;
	ino_t f_tinode;
	char f_fname[6];
	char f_fpack[6];
};


# 1 "/usr/include/sys/types.h" 2 3

# 14 "ml_os.h" 2














 



typedef void SIGH_RET_TYPE;


# 44 "ml_os.h"














# 72 "ml_os.h"




 
# 94 "ml_os.h"






 




 





# 119 "ml_os.h"


 

# 153 "ml_os.h"


























# 190 "ml_os.h"


 



# 1 "/usr/include/sys/dirent.h" 1 3








# 1 "/usr/lib/gcc-lib/i386-linux/2.3.3/include/limits.h" 1 3
 


 





 
# 1 "/usr/lib/gcc-lib/i386-linux/2.3.3/include/syslimits.h" 1 3
 




# 1 "/usr/include/limits.h" 1 3
 

















 






# 1 "/usr/include/features.h" 1 3
 





















 




































 









 







 



 





 








 




































 





 
# 1 "/usr/include/sys/cdefs.h" 1 3
 




















# 1 "/usr/include/features.h" 1 3
 

















# 143 "/usr/include/features.h" 3

# 22 "/usr/include/sys/cdefs.h" 2 3



















# 49 "/usr/include/sys/cdefs.h" 3




 







 

typedef long double __long_double_t;

# 73 "/usr/include/sys/cdefs.h" 3


 









 









# 141 "/usr/include/features.h" 2 3



# 26 "/usr/include/limits.h" 2 3



 
# 1 "/usr/include/posix1_lim.h" 1 3
 

















 








 

 


 


 


 


 



 


 


 


 


 


 


 


 



 
# 1 "/usr/include/linux/limits.h" 1 3

















# 72 "/usr/include/posix1_lim.h" 2 3



 













 







# 30 "/usr/include/limits.h" 2 3




# 1 "/usr/include/posix2_lim.h" 1 3
 






















 


 


 


 


 



 



 


 




 


































# 34 "/usr/include/limits.h" 2 3




# 106 "/usr/include/limits.h" 3




 




# 6 "/usr/lib/gcc-lib/i386-linux/2.3.3/include/syslimits.h" 2 3

# 11 "/usr/lib/gcc-lib/i386-linux/2.3.3/include/limits.h" 2 3





 



 



 



 





 



 












 





 



 





 



 






 




 





 






 



# 9 "/usr/include/sys/dirent.h" 2 3

# 1 "/usr/include/sys/types.h" 1 3

# 10 "/usr/include/sys/dirent.h" 2 3

# 1 "/usr/include/linux/dirent.h" 1 3





struct dirent {
	long		d_ino;
	off_t		d_off;
	unsigned short	d_reclen;
	char		d_name[        255	+1];
};


# 11 "/usr/include/sys/dirent.h" 2 3







# 196 "ml_os.h" 2


   typedef struct dirent DIR_ENTRY_TY;
# 224 "ml_os.h"



























extern int edata, etext;







# 7 "export.c" 2
















# 1 "/usr/include/a.out.h" 1 3
# 1 "/usr/include/linux/a.out.h" 1 3







struct exec
{
  unsigned long a_info;		 
  unsigned a_text;		 
  unsigned a_data;		 
  unsigned a_bss;		 
  unsigned a_syms;		 
  unsigned a_entry;		 
  unsigned a_trsize;		 
  unsigned a_drsize;		 
};



 
enum machine_type {



  M_OLDSUN2 = 0,




  M_68010 = 1,




  M_68020 = 2,




  M_SPARC = 3,

   
  M_386 = 100,
};





















 

 

 


 






































 




 































 





struct nlist {
  union {
    char *n_name;
    struct nlist *n_next;
    long n_strx;
  } n_un;
  unsigned char n_type;
  char n_other;
  short n_desc;
  unsigned long n_value;
};































 









 










 





 



 




struct relocation_info
{
   
  int r_address;
   
  unsigned int r_symbolnum:24;
   


  unsigned int r_pcrel:1;
   

  unsigned int r_length:2;
   





  unsigned int r_extern:1;
   






  unsigned int r_pad:4;

};




# 1 "/usr/include/a.out.h" 2 3

# 23 "export.c" 2

































# 107 "export.c"

















 
 








extern int old_high;

static int textstart,datastart;




extern int startptr;



















int export (filid)   
    int filid;
{
    int bytcount;
   static struct exec E;   














    ((E).a_info = (((E).a_info & 0xffff0000) | ((0413 ) & 0xffff))) ;






# 196 "export.c"





    ((E).a_info = ((E).a_info&0xff00ffff) | ((((int)(M_386))&0xff) << 16)) ;


    textstart = 0 ;






    E.a_text = (int) ((((int)(               ((int)(&etext)) ))+(getpagesize())-1)&~((getpagesize())-1)) -textstart;




    datastart = (((E).a_info & 0xffff) ==0407 ? ((0 +(E).a_text) ) : (((((0 +(E).a_text) ) + 1024  - 1) & ~(1024  - 1)) )) ;

    E.a_bss = 0;

    E.a_syms = 0;


    E.a_entry = startptr;
    E.a_trsize = 0;
    E.a_drsize = 0;



    E.a_data = ((((int)(old_high-datastart))+( getpagesize())-1)&~(( getpagesize())-1)) ;

    fchmod(filid,0755);



    if (bulletproofWrite0(filid,&E,sizeof(E))) return 1;else{} ;
    bytcount = sizeof(E);




























     if (bulletproofWrite0(filid,textstart,E.a_text)) return 1;else{} ;


    if (bulletproofWrite0(filid,datastart,E.a_data)) return 1;else{} ;

    return 0;
}

# 352 "export.c"

# 446 "export.c"

# 583 "export.c"

# 721 "export.c"




# 740 "export.c"


 




int bulletproofWrite0 (fd, buf, nbytes)
    int		fd;
    char	*buf;
    int		nbytes;
{
    extern int	errno;
    int		bytesWritten = 0, i;

    do {
	if ((i = write(fd, buf, nbytes-bytesWritten)) < 0) return 1;
	bytesWritten += i;
	buf += i;
	if (bytesWritten < nbytes)
	    chatting("[Write incomplete (%d/%d), retrying]\n", bytesWritten, nbytes);
    } while (bytesWritten < nbytes);
  return 0;

}  




