// Program to replace the partition table in the usbloader // #include #include #ifndef WIN32 //%%%% #include #include #include #else //%%%% #include #include "getopt.h" #include "printf.h" #endif #include "parts.h" //############################################################################################################3 void main(int argc, char* argv[]) { struct ptable_t ptable; FILE* in; if (argc != 2) { printf("\n - Partition table file name is not specified\n"); return; } in=fopen(argv[optind],"r+b"); if (in == 0) { printf("\n Can't open file %s\n",argv[optind]); return; } // read current table fread(&ptable,sizeof(ptable),1,in); if (strncmp(ptable.head, "pTableHead", 16) != 0) { printf("\n File is not a partition table\n"); return ; } show_map(ptable); }