diff --git a/ChangeLog b/ChangeLog index 46b5fbb5..87fdd1ea 100644 --- a/ChangeLog +++ b/ChangeLog @@ -26,22 +26,25 @@ v0.91.10 21-Aug-2007 mbcico: Fixed a lot of compiler warnings. + Fixed compiling on NetBSD 3.1. mbfido: Fixed a lot of compiler warnings. + Fixed compiling on NetBSD 3.1. mbdiff: Fixed a lot of compiler warnings. mbsebbs: Fixed a lot of compiler warnings. + Fixed compiling on NetBSD 3.1. mbmon: Added support or the ARM processor. mbtask: Added support or the ARM processor. - + Fixed compiling on NetBSD 3.1. v0.91.9 16-May-2007 - 21-Aug-2007 diff --git a/mbcico/binkp.c b/mbcico/binkp.c index 46c468e1..da688b4d 100644 --- a/mbcico/binkp.c +++ b/mbcico/binkp.c @@ -1053,7 +1053,11 @@ int file_transfer(void) TrType binkp_receiver(void) { +#ifdef __NetBSD__ + struct statvfs sfs; +#else struct statfs sfs; +#endif int written; off_t rxbytes; int bcmd, rc = 0; @@ -1208,7 +1212,11 @@ TrType binkp_receiver(void) return Failure; } +#ifdef __NetBSD__ + if (statvfs(tempinbound, &sfs) == 0) { +#else if (statfs(tempinbound, &sfs) == 0) { +#endif if ((bp.rsize / (sfs.f_bsize + 1)) >= sfs.f_bfree) { Syslog('!', "Binkp: only %u blocks free (need %u) in %s for this file", sfs.f_bfree, (unsigned int)(bp.rsize / (sfs.f_bsize + 1)), tempinbound); diff --git a/mbcico/inbound.c b/mbcico/inbound.c index a8691554..856b1f25 100644 --- a/mbcico/inbound.c +++ b/mbcico/inbound.c @@ -198,9 +198,15 @@ int inbound_close(int success) */ int inbound_space(void) { +#ifdef __NetBSD__ + struct statvfs sfs; + + if (statvfs(tempinbound, &sfs) != 0) { +#else struct statfs sfs; if (statfs(tempinbound, &sfs) != 0) { +#endif Syslog('!', "Cannot statfs \"%s\", assume enough space", tempinbound); return -1L; } else diff --git a/mbcico/zmrecv.c b/mbcico/zmrecv.c index 8bfb2a1b..3c727ded 100644 --- a/mbcico/zmrecv.c +++ b/mbcico/zmrecv.c @@ -558,6 +558,15 @@ int putsec(char *buf, int n) int getfree(void) { +#ifdef __NetBSD__ + struct statvfs sfs; + + if (statvfs(inbound, &sfs) != 0) { + WriteError("$cannot statvfs \"%s\", assume enough space", inbound); + return -1L; + } else + return (sfs.f_bsize * sfs.f_bfree); +#else struct statfs sfs; if (statfs(inbound, &sfs) != 0) { @@ -565,6 +574,7 @@ int getfree(void) return -1L; } else return (sfs.f_bsize * sfs.f_bfree); +#endif } diff --git a/mbfido/unpack.c b/mbfido/unpack.c index 5edb9699..be3a05eb 100644 --- a/mbfido/unpack.c +++ b/mbfido/unpack.c @@ -4,7 +4,7 @@ * Purpose ...............: Unpacker * ***************************************************************************** - * Copyright (C) 1997-2005 + * Copyright (C) 1997-2007 * * Michiel Broek FIDO: 2:280/2802 * Beekmansbos 10 @@ -43,9 +43,15 @@ extern int do_quiet; int checkspace(char *dir, char *fn, int factor) { struct stat st; +#ifdef __NetBSD__ + struct statvfs sfs; + + if ((stat(fn,&st) != 0) || (statvfs(dir,&sfs) != 0)) { +#else struct statfs sfs; if ((stat(fn,&st) != 0) || (statfs(dir,&sfs) != 0)) { +#endif WriteError("Cannot stat \"%s\" or statfs \"%s\", assume enough space", fn, dir); return 1; } diff --git a/mbsebbs/zmrecv.c b/mbsebbs/zmrecv.c index 1112bb32..80c8430d 100644 --- a/mbsebbs/zmrecv.c +++ b/mbsebbs/zmrecv.c @@ -614,13 +614,21 @@ int putsec(char *buf, int n) int getfree(void) { +#ifdef __NetBSD__ + struct statvfs sfs; +#else struct statfs sfs; +#endif char *temp; temp = calloc(PATH_MAX, sizeof(char)); snprintf(temp, PATH_MAX, "%s/%s/upl", CFG.bbs_usersdir, exitinfo.Name); - + +#ifdef __NetBSD__ + if (statvfs(temp, &sfs) != 0) { +#else if (statfs(temp, &sfs) != 0) { +#endif WriteError("$cannot statfs \"%s\", assume enough space", temp); free(temp); return -1L; diff --git a/mbtask/taskdisk.c b/mbtask/taskdisk.c index 51d940cd..34292427 100644 --- a/mbtask/taskdisk.c +++ b/mbtask/taskdisk.c @@ -321,12 +321,20 @@ void disk_getfs_r(char *buf) */ void update_diskstat(void) { +#ifdef __NetBSD__ + struct statvfs sfs; +#else struct statfs sfs; +#endif unsigned int temp; mfs_list *tmp; for (tmp = mfs; tmp; tmp = tmp->next) { +#ifdef __NetBSD__ + if (statvfs(tmp->mountpoint, &sfs) == 0) { +#else if (statfs(tmp->mountpoint, &sfs) == 0) { +#endif temp = (unsigned int)(sfs.f_bsize / 512L); tmp->size = (unsigned int)(sfs.f_blocks * temp) / 2048L; tmp->avail = (unsigned int)(sfs.f_bavail * temp) / 2048L; @@ -337,11 +345,16 @@ void update_diskstat(void) * See man 2 statvfs about what approximately is defined. */ tmp->ro = (strstr(tmp->fstype, "iso") != NULL); -#elif defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) +#elif defined(__FreeBSD__) || defined(__OpenBSD__) /* * XxxxBSD has the info in the statfs structure. */ tmp->ro = (sfs.f_flags & MNT_RDONLY); +#elif defined(__NetBSD__) + /* + * NetBSD 3.1 is a bit different again + */ + tmp->ro = (sfs.f_flag & ST_RDONLY); #else #error "Don't know how to get sfs read-only status" #endif @@ -362,10 +375,14 @@ void add_path(char *lpath) #if defined(__linux__) char *mtab, *fs; FILE *fp; -#elif defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) +#elif defined(__FreeBSD__) || defined(__OpenBSD__) struct statfs *mntbuf; int mntsize; int i; +#elif defined(__NetBSD__) + struct statvfs *mntbuf; + int mntsize; + int i; #else #error "Don't know how to get mount paths" #endif