#include <stdio.h>
#include <jaz.h>
THEAD *rsplist(fname)
char *fname;
{
  TNAME *p;

  THEAD *whead,*readlist();

  whead = (THEAD *) malloc(sizeof(THEAD));

  whead->listlen = 0;
  whead->first = whead->last = 0;

  whead = readlist(fname,whead);

}

THEAD *readlist(fname,fhead)
char *fname;
THEAD *fhead;
{
  FILE *fd;
  int num;
  char wbuf[256],*ch;
  TNAME *wnew;

  if ( !(fd = fopen(fname ,"r"))) return(0);

  while ( (ch = fgets(wbuf,num,fd)) ) {
    wbuf[strlen(wbuf)-1] = 0; /* get rid of newline char */
    wnew = (TNAME *) malloc(sizeof(TNAME));
    wnew->filename = (char *) malloc(strlen(wbuf)+1);
    if (fhead->first)
      fhead->last->next = wnew;
    else
      fhead->first = wnew;
    wnew->next = 0;
    fhead->last = wnew;
    fhead->listlen ++;
    strcpy(wnew->filename,wbuf);
  }
  fclose(fd);

  return(fhead);
}

