/*---------------------------------*//* Program : UNZIP.C               *//* Version : 1.13                  *//* Coding  : Ivo van Poorten       *//*---------------------------------*//* UNZIP Utility     UnShrink Only *//*---------------------------------*//* Starting Date : 19 May 1993     *//*---------------------------------*//* v1.10 First working version.    *//*       Terribly slow !           *//* v1.11 Speeded up the readbyte() *//*       routine.                  *//* v1.12 Speeded up the outbyte()  *//*       routine.                  *//* v1.13 Added percentage counter  *//*---------------------------------*/    /* Version Defenitions */#define version "v1.13"       /*  5 Bytes */#define date "  6/June/1993"  /* 13 Bytes *//* System Defenitions          *//* Change this when porting to *//* another system.             */#define defdrive "D1:"/* Include Files */#include STDIO.H#include GETA.H/*---------------------------------*//* Command Line Parameters. Delete *//* these and the GetArgs call when *//* compiling at a MesSDOS, GEM or  *//* UNIX system. Also change main() *//* in main(int argc,char *argv[])  *//*---------------------------------*/int argc;int argv[16];char args[256];/*---------------------------------*//* ZIP LAYOUT Declarations         *//* No 'typedef struct'-format      *//* because Lightspeed C does not   *//* support that.                   *//*---------------------------------*/int siglw,sighw;/* Local_file_header */int vneed1,gpb1,cmeth1,ltime1,ldate1;int crc1lw,crc1hw;      /* longint */int csize1lw,csize1hw;  /* longint */ int usize1lw,usize1hw;  /* longint */int namelen1,xtralen1;/* Central_directory_file_header */int vmb,vneed2,gpb2,cmeth2,ltime2,ldate2;int crc2lw,crc2hw;int csize2lw,csize2hw;int usize2lw,usize2hw;int namelen2,xtralen2,commlen1,nrstart;int inta;int extalw,extahw;int relof1lw,relof1hw;/* End_central_dir_record */int nrthis,nrdws,totaldt,totald;int sizdirlw,sizdirhw;int offscdlw,offscdhw;int commlen2;/* And a dummy string */char dummys[256];/*-----------------*//* Input Variables *//*-----------------*/FILE iocb;char zipfn[256];char command;/*------------------*//* Output Variables *//*------------------*/char filename[256];/*---------------------------------*/parse()$(int x,status,option,search,found;char *y,help[64];  command='U';  zipfn[0]='\00';  status=0;/* Do Options */  x=1;  y=argv[x];  while(*y=='-')  $(    y+=1;    option=*y;    switch(option)    $(      case 'v' :      case 'V' : command='V';        break;      default  : status+=1;    $)    x+=1;    y=argv[x];  $)/* Get ZipFileName */  if(x<argc)  $(    strcpy(zipfn,argv[x]);    x+=1;  $)  else  $(    status+=1;  $)  search=0;  found=0;  while(zipfn[search]!='\00')  $(    if(zipfn[search]=='.')    $(      found+=1;    $)    if(zipfn[search]==':')    $(      found+=2;    $)    search+=1;  $)  strcpy(help,zipfn);  switch(found)  $(    case 1:    $(      strcpy(zipfn,defdrive);      strcat(zipfn,help);      break;    $)    case 2:    $(      strcpy(zipfn,help);      strcat(zipfn,".ZIP");      break;    $)    case 0:    $(      strcpy(zipfn,defdrive);      strcat(zipfn,help);      strcat(zipfn,".ZIP");      break;    $)    default: break;  $)  return status;$)/*---------------------------------*/prtline()$(  printf("------------------------------------\n");$)/*---------------------------------*/usage()$(  printf("UNZIP [-v] ZipFile\n\n");  printf("-v view contents\n\n");  prtline();  printf("\n");$)/*---------------------------------*/main()$(char pstat;  GetArgs(args,&argc,argv);  printf("\n");  prtline();  printf("UNZIP %s       by Ivo van Poorten\n",version);  printf("(C) BeWare Productions %s\n",date);  prtline();  printf("\n");  if (argc==1)  $(    usage();    exit();  $)  pstat=parse();  if(pstat!=0)  $(    printf("Invalid Parameters\n");    printf("\n");    prtline();    printf("\n");    exit();  $)  printf("Processing %s\n",zipfn);  printf("\n");  prtline();  printf("\n");  switch(command)  $(    case 'v':    case 'V':    $(      view();      break;    $)    case 'u':    case 'U':    $(      expand();      break;    $)  $)$)