--- embedtools/src/cfexec.c 2011/06/08 12:45:41 1.2 +++ embedtools/src/cfexec.c 2011/06/13 20:04:12 1.2.2.1 @@ -3,7 +3,7 @@ * by Michael Pounov * * $Author: misho $ - * $Id: cfexec.c,v 1.2 2011/06/08 12:45:41 misho Exp $ + * $Id: cfexec.c,v 1.2.2.1 2011/06/13 20:04:12 misho Exp $ * *************************************************************************/ #include "global.h" @@ -37,7 +37,11 @@ static int update(int flags) memset(&mnt, 0, sizeof mnt); mnt.fspec = szDev; +#ifdef __NetBSD__ + if (mount("ufs", szMount, flags, &mnt, sizeof mnt) == -1) { +#else if (mount("ufs", szMount, flags, &mnt) == -1) { +#endif printf("Error:: can`t update mount %s #%d - %s\n", szMount, errno, strerror(errno)); return -1; } @@ -88,7 +92,7 @@ static int mkevent(struct kevent *chg, struct kevent * memset(chg, 0, sizeof(struct kevent)); memset(evt, 0, sizeof(struct kevent)); - EV_SET(chg, f, EVFILT_VNODE, EV_ADD, NOTE_DELETE | NOTE_RENAME | NOTE_REVOKE, 0, NULL); + EV_SET(chg, f, EVFILT_VNODE, EV_ADD, NOTE_DELETE | NOTE_RENAME | NOTE_REVOKE, 0, (intptr_t) NULL); } return f; @@ -99,7 +103,7 @@ static int mkevent(struct kevent *chg, struct kevent * int main(int argc, char **argv) { char ch; - const char *err; + const char *err = NULL; struct kevent chg, evt; struct timespec ts; pid_t pid; @@ -110,7 +114,11 @@ int main(int argc, char **argv) // Load variables from config if exists if (!LoadConfig(szConfig, &cfg)) { cfg_LoadAttribute(&cfg, CFG("cfexec"), CFG("timeout"), CFG(szUser), MAX_STR, DEFAULT_TIMEOUT); +#ifndef HAVE_STRTONUM + Timeout = (int) strtol(szUser, NULL, 0); +#else Timeout = strtonum(szUser, 0, 3600, &err); +#endif if (!Timeout && err) { printf("Error:: in seconds for timeout %s - %s\n", optarg, err); UnloadConfig(&cfg); @@ -149,7 +157,11 @@ int main(int argc, char **argv) strlcpy(szMount, optarg, MAXPATHLEN); break; case 't': +#ifndef HAVE_STRTONUM + Timeout = (int) strtol(szUser, NULL, 0); +#else Timeout = strtonum(optarg, 0, 3600, &err); +#endif if (!Timeout && err) { printf("Error:: in seconds for timeout %s - %s\n", optarg, err);