1 /* $Id: d_io.c,v 1.5 2003-02-18 20:35:35 btb Exp $ */
3 * some misc. file/disk routines
17 //added 05/17/99 Matt Mueller
23 #define lseek(a,b,c) _lseek(a,b,c)
26 long filelength(int fd) {
29 if ((old_pos = lseek(fd, 0, SEEK_CUR)) == -1 ||
30 (size = lseek(fd, 0, SEEK_END)) == -1 ||
31 (lseek(fd, old_pos, SEEK_SET)) == -1)
36 long ffilelength(FILE *fh)
38 return filelength(fileno(fh));
42 unsigned long d_getdiskfree()
58 return cbCluster * cClusters;
66 unsigned long GetDiskFree()
68 return d_getdiskfree();
71 // remove extension from filename, doesn't work with paths.
72 void removeext(const char *filename, char *out) {
74 if ((p = strrchr(filename, '.'))) {
75 strncpy(out, filename, p - filename);
76 out[p - filename] = 0;
78 strcpy(out, filename);