#include <stdio.h>
#include <string.h>
#include <elf.h>
#include <sys/types.h>
#include <sys/uio.h>
#include <unistd.h>
#include <fcntl.h>
int main( int argc, char *argv[] ){
Elf32_Ehdr ehdr;
Elf32_Shdr shdr;
int fd, i, shstrtbl;
if( (fd = open( argv[0], O_RDONLY )) == -1 ){
perror("open");
return 1;
}
if( read( fd, &ehdr, sizeof(ehdr)) == -1 ){
perror("read");
close(fd);
return 1;
}
printf("OS/ABI: %d\n", ehdr.e_ident[EI_OSABI] );
printf("e_machine: %d\n", ehdr.e_machine );
return 0;
}