From 2e965710dc9be23350c9f98f65ead77725be039d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Revol?= Date: Fri, 29 Sep 2006 23:54:00 +0000 Subject: [PATCH] Without it you won't get far with nfs =) git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@18984 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/bin/mount_nfs.cpp | 100 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 100 insertions(+) create mode 100644 src/bin/mount_nfs.cpp diff --git a/src/bin/mount_nfs.cpp b/src/bin/mount_nfs.cpp new file mode 100644 index 0000000000..a864c8ee30 --- /dev/null +++ b/src/bin/mount_nfs.cpp @@ -0,0 +1,100 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +struct mount_nfs_params +{ + unsigned int serverIP; + char *server; + char *_export; + uid_t uid; + gid_t gid; + char *hostname; +}; + +void usage (const char *exename); + +void usage (const char *exename) +{ + printf ("usage: %s server:export mountpoint uid gid\n",exename); +} + +int main (int argc, char **argv) +{ + signal(SIGINT, SIG_IGN); + signal(SIGHUP, SIG_IGN); + + BApplication theApp ("application/x-vnd.barecode-mount_nfs"); + + if (argc!=5) + { + usage(argv[0]); + return 1; + } + + struct stat st; + if (stat(argv[2],&st)h_addr)); + + mount_nfs_params params; + + params.serverIP=serverIP; + params.server=server; + params._export=colon+1; + + sscanf (argv[3],"%d",¶ms.uid); + sscanf (argv[4],"%d",¶ms.gid); + + char hostname[256]; + gethostname (hostname,256); + + params.hostname=hostname; + + int result=mount ("nfs",argv[2],NULL,0,¶ms,sizeof(params)); + + delete[] server; + + if (result