#include <stdio.h>
#include <rpc/rpc.h>
#include "fs.h"
#include <sys/stat.h>

struct zeile *transport_1(a,cl)
CLIENT *cl;
struct uebertrage *a;
{
        static struct zeile ze;
        FILE *fpi;
        char line[300];
        char filename[100];
        int position;
        struct uebertrage abschnitt;

        abschnitt=*a;
        strcpy(filename,abschnitt.filename);
        fpi=fopen(filename,"r");
        if(fpi == NULL) {
                ze.ende_kz=-2;
                return(&ze);
        }
        position=abschnitt.ab_position;
        fseek(fpi,(long) position,SEEK_SET);
        if((fgets(line,300,fpi))  == 0) {
                ze.ende_kz=0;
                fclose(fpi);
                return(&ze);
        }
        fclose(fpi);
        strcpy(ze.zeile,line);
        ze.ende_kz=position+strlen(line);
        return(&ze);
}
