//ADStoDiss.C
{
  FILE *pInp = fopen("ADS.txt", "rt");
  FILE *pOut = fopen("Diss.txt", "wt");
  char szBuf[256];
  char szLastName[256];
  char szInitials[256];
  char *p, *p1;
  char c;
  int iCnt;
  
  for (;;)
  {
    p = szBuf;
    for (;;)
    {
      iCnt = fscanf(pInp, "%c", &c);
      if (iCnt != 1 || c == ';')
        break;
      if (c != ' ' && c != '\n')
      { 
        *p++ = c;
      }
    }
    *p = 0;
    
    p = szBuf;
    p1 = szLastName;
    
    int iInitials;
    for (;;)
    {
      if (*p == ',') 
      {
        p++;
        iInitials = 1;
        break;
      }
      if (*p == 0)
      {
        iInitials = 0;
        break;
      }
      *p1++ = *p++;
    }
    *p1 = 0;
    
    p1 = szInitials;
    if (iInitials == 1)
    {
      for (;;)
      {
        if (*p == 0) break;
        *p1++ = *p++;
      }
      *p1++ = ' ';
      *p1 = 0;
    }
    else
    {
      *p1 = 0;
    }
    
    fprintf(pOut, "%s%s, ", szInitials, szLastName);
    printf(       "%s%s, ", szInitials, szLastName);
    
    if (iCnt != 1)
    {
      break;
    }
  }
  fprintf(pOut, "\n");
  printf("\n");
  
  fclose(pInp);
  fclose(pOut);
}
