17 сент. 2012 г.

Выгодоприобретатели

#include ""
#include ""
#include ""
#include ""

#define MAXSTRING 1024
#define BUFFERSIZE  10
#define HEADERSIZE  4
#define BODYSIZE    8 /* body lines counter+delimiter! */
#define NOTEBEGIN   108
#define NOTELENGTH  40

char * my_strlwr(char * s);

int cdecl main(unsigned argc, char *argv[])
{
  char *expression[]={

  "агент","поруч","комис","доверии","управл","принци","комит","цессии",
  "ао","ассоциац","гуп","зао","оао","ооо","тоо","муп","ичп","пбоюл",
  "ип","нко","филиал","предст","копер","фонд","союз","сп","гоу","доу",
  "тсж","гск","гпк","роо","траст","нко"};

  FILE *from, *to;
  unsigned char *str[BUFFERSIZE],*found;
  unsigned char *drive, *dir,*path_in,*path_out;
  unsigned char *name,*ext, *notefull;
  register i;
  if(argc!=2) {
    printf("Usage: filter \n");  exit(1);  }
  if( (drive = (char*)malloc(sizeof(char)*MAXSTRING)) == NULL){
    printf("Cannot allocate memory.\n");     exit(1);
  }
  if( (dir = (char*)malloc(sizeof(char)*MAXSTRING)) == NULL){
    printf("Cannot allocate memory.\n");     exit(1);
  }
  if( (path_in = (char*)malloc(sizeof(char)*MAXSTRING)) == NULL){
    printf("Cannot allocate memory.\n");     exit(1);
  }
  if( (path_out = (char*)malloc(sizeof(char)*MAXSTRING)) == NULL){
    printf("Cannot allocate memory.\n");     exit(1);
  }
  if( (name = (char*)malloc(sizeof(char)*MAXSTRING)) == NULL){
    printf("Cannot allocate memory.\n");    exit(1);
  }
  if( (ext = (char*)malloc(sizeof(char)*MAXSTRING)) == NULL){
    printf("Cannot allocate memory.\n");    exit(1);
  }
  if( (notefull = (char*)malloc(sizeof(char)*MAXSTRING)) == NULL){
    printf("Cannot allocate memory.\n");    exit(1);
  }
  strcpy(path_out,argv[1]);
  strcpy(path_in,argv[1]);
  fnsplit(path_in,drive,dir,name,ext);
  fnmerge(path_in,drive,dir,name,".TMP");
  free(drive);
  free(dir);
  free(ext);
  /*rename source to SRCNAME.tmp */
  if((rename(path_out,path_in)!=NULL)){
    printf("Cannot rename source file.\n"); exit(1);
  }
  /* open source file */
  if((from = fopen(path_in, "rb"))==NULL){
    printf("Cannot open source file.\n"); exit(1);
  }
  /* open destination file */
  if((to = fopen(path_out, "wb"))==NULL){
    printf("Cannot open destination file.\n"); exit(1);
  }
  /* allocate memory for BUFFERSIZE lines */
  for(i=0;i= 'A' && *t <= 'Z' ){
                *t = *t + ('a' - 'A');
        }
        if (*t >= 0x80 && *t <= 0x8F ){
                *t = *t + (0xA0 - 0x80);
        }
        if (*t >= 0x90 && *t <= 0x9F ){
                *t = *t + (0xE0 - 0x90);
        }
        t++;
  }
  return s;
}