Dear
I was to give one make in circle30bpl17 with Oasis that I caught in the ftp
of the CircleMUD... and I appeared the following error
gcc -g -02 -Wall -c diskio.c -o diskio.o
diskio.c: In function `fbopen_for_read':
diskio.c:144: structure has no member named `_fileno'
diskio.c: In function `fbcat':
diskio.c:324: structure has no member named `_fileno'
make[1]: *** [diskio.o] Error 1
make: *** [all] Error 2
-----
is:
FBFILE *fbopen_for_read(char *fname)
{
int err;
FILE *fl;
struct stat sb;
FBFILE *fbfl;
if(!(fbfl = (FBFILE *)malloc(sizeof(FBFILE))))
return NULL;
if(!(fl = fopen(fname, "r"))) {
free(fbfl);
return NULL;
}
err = fstat(fl->_fileno, &sb);
if(err < 0 || sb.st_size <= 0) {
free(fbfl);
fclose(fl);
return NULL;
}
fbfl->size = sb.st_size;
if(!(fbfl->buf = malloc(fbfl->size))) {
free(fbfl);
return NULL;
}
if(!(fbfl->name = malloc(strlen(fname)))) {
free(fbfl->buf);
free(fbfl);
return NULL;
}
fbfl->ptr = fbfl->buf;
fbfl->flags = FB_READ;
strcpy(fbfl->name, fname);
fread(fbfl->buf, sizeof(char), fbfl->size, fl);
fclose(fl);
return fbfl;
}
------------
int fbcat(char *fromfilename, FBFILE *tofile)
{
struct stat sb;
FILE *fromfile;
char *in_buf = 0;
int errnum = 0, length = 0;
if(!fromfilename || !*fromfilename || !tofile)
return 0;
if(!(fromfile = fopen(fromfilename, "r+b")))
return 0;
errnum = fstat(fromfile->_fileno, &sb);
if(errnum < 0 || sb.st_size <= 0)
return 0;
length = tofile->ptr - tofile->buf;
tofile->buf = realloc(tofile->buf, tofile->size + sb.st_size);
tofile->ptr = tofile->buf + length;
tofile->size += sb.st_size;
in_buf = malloc(sb.st_size + 1);
in_buf[0] = 0;
errnum = fread(in_buf, sb.st_size, 1, fromfile);
fbprintf(tofile, "%s", in_buf);
fclose(fromfile);
free(in_buf);
return 1;
}
Help me please ?
[] s
Eduardo Bertin
Implementor do InfernoMUD
--
+---------------------------------------------------------------+
| FAQ: http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html |
| Archives: http://post.queensu.ca/listserv/wwwarch/circle.html |
+---------------------------------------------------------------+
This archive was generated by hypermail 2b30 : 12/06/01 PST