#include "bitmap.h"
#define MESSAGE_LENGTH 65536


/* Decoder for the stream*/
int main(int argc,char *argv[])
{
  FILE *fsrc;
  char buffer[MESSAGE_LENGTH];
  int length=0,c=0;
  
  if(argc < 2)
    {
      printf("usage: ./decrypt <encrypted-bitmap-filename>\n");
      printf("eg: ./decrypt " STEGO_IMAGE_DIR "/Nova.bmp");
      printf("This file has some secret in it!!\n");
      printf("(C) 2004 Muthiah Annmalai. GPL'ed\n");
      return -1;
    }
  fsrc=fopen(argv[1],"rb");
#ifdef DEBUG_BMP
  printf("Opened,data.bmp\n");
#endif

  fseek(fsrc,54,SEEK_CUR);

  length=decode_message_to_file(stdout,fsrc,buffer,MESSAGE_LENGTH);
  while(c<length)
    printf("%c",buffer[c++]);

  printf("\n");//better for bash'ers!
  fclose(fsrc);
  return 0;
}

//gcc -Wall decrypt.c -o decrypt
