process_file(buffer)
char	*buffer;
{
	int	i, n;
	char	*p, *q;
	short	dsize, nblk, lnch;

	int	c;
	short	*s;

	int 	procf;

	s = (short *) buffer;

	/* check the header word */
	if (*s != 257) {
		printf("Snark: invalid data header\n");
		exit(1);
	}

	c = 2;
	for (i = 0; i < FANO; i++) {
		file_table[i] = (struct bsa *) &buffer[c];
#ifndef	SWAP
		dsize = file_table[i]->bsa_dol_w_size;
#else
		Swap_This(&file_table[i]->bsa_dol_w_size, &dsize, sizeof(short));
#endif
		c += dsize + 4;
	}

	/* extract file name */
#ifndef	SWAP
	dsize = file_table[0]->bsa_dol_w_size;
#else
	Swap_This(&file_table[0]->bsa_dol_w_size, &dsize, sizeof(short));
#endif
	p = file_table[0]->bsa_dol_t_text;
	q = filename;
	for (i = 0; i < dsize; i++)
		*q++ = *p++;
	*q = '\0';

	/* extract file's record attributes */
#ifndef	SWAP
	dsize = file_table[5]->bsa_dol_w_size;
#else
	Swap_This(&file_table[5]->bsa_dol_w_size, &dsize, sizeof(short));
#endif
	p = file_table[5]->bsa_dol_t_text;
	recfmt = p[0];
	recatt = p[1];
#ifndef	SWAP
	bcopy(&p[2], &recsize, sizeof(short));
#else
	Swap_This(&p[2], &recsize, sizeof(short));
#endif
	vfcsize = p[15];
	if (vfcsize == 0)
		vfcsize = 2;
#ifdef	DEBUG
	printf("recfmt = %d\n", recfmt);
	printf("recatt = %d\n", recatt);
	printf("reclen = %d\n", recsize);
	printf("vfcsize = %d\n", vfcsize);
#endif
#ifndef	SWAP
	bcopy(&p[10], &nblk, sizeof(short));
	bcopy(&p[12], &lnch, sizeof(short));
#else
	Swap_This(&p[10], &nblk, sizeof(short));
	Swap_This(&p[12], &lnch, sizeof(short));
#endif
	filesize = (nblk-1)*512 + lnch;
#ifdef DEBUG
	printf("nbk = %d, lnch = %d\n", nblk, lnch);
	printf("filesize = 0x%x\n", filesize);
#endif

	/* open the file */
	if (f != NULL) {
		fclose(f);
		file_count = 0;
		reclen = 0;
	}
	procf = 0;
	if (goptind < gargc) 
		for(i=goptind; i < gargc; i++) {
			procf |= match(filename,gargv[i]);
		}
	else
		procf = 1;
	if (tflag && procf) 
		printf( " %-35s %8d \n",filename,filesize);
	if (xflag && procf) {
		/* open file */
		f = openfile(filename);
		if(f != NULL && vflag) printf("extracting %s\n", filename);
	}
}
