summaryrefslogtreecommitdiff
path: root/net/sharity-light/files
diff options
context:
space:
mode:
authorDmitrij Tejblum <dt@FreeBSD.org>1998-07-06 19:32:07 +0000
committerDmitrij Tejblum <dt@FreeBSD.org>1998-07-06 19:32:07 +0000
commite2800035bd57c6b90f44090611b3bb4820b5c51c (patch)
treec7e5941fa13f3554d17f8f94db6bf87c3a2da470 /net/sharity-light/files
parentAdditional patches (already committed to krb5-current): (diff)
Replace rumba 0.6a with Sharity-Light 1.0.
Also, make the build obey local settings for CC. This is Submitted by: Mikhail Teterin <mi@video-collage.com>
Notes
Notes: svn path=/head/; revision=11769
Diffstat (limited to 'net/sharity-light/files')
-rw-r--r--net/sharity-light/files/Makefile.unshlight4
-rw-r--r--net/sharity-light/files/patch-ad2
-rw-r--r--net/sharity-light/files/unshlight.c73
3 files changed, 78 insertions, 1 deletions
diff --git a/net/sharity-light/files/Makefile.unshlight b/net/sharity-light/files/Makefile.unshlight
new file mode 100644
index 000000000000..7026b344fa38
--- /dev/null
+++ b/net/sharity-light/files/Makefile.unshlight
@@ -0,0 +1,4 @@
+PROG=unshlight
+NOMAN=sorry
+
+.include <bsd.prog.mk>
diff --git a/net/sharity-light/files/patch-ad b/net/sharity-light/files/patch-ad
index e3c08e1d19f2..3a3f6b16f96a 100644
--- a/net/sharity-light/files/patch-ad
+++ b/net/sharity-light/files/patch-ad
@@ -27,7 +27,7 @@
-#RPC_WARNFLAGS = -Wno-unused -Wno-switch -Wno-uninitialized
+CFLAGS += -Wall
+INCLUDES = $(MYINCL) $(INCL)
-+THE_CC = cc
++THE_CC := $(CC)
+RPC_WARNFLAGS = -Wno-unused -Wno-switch -Wno-uninitialized
# For NetBsd
diff --git a/net/sharity-light/files/unshlight.c b/net/sharity-light/files/unshlight.c
new file mode 100644
index 000000000000..e167b3611687
--- /dev/null
+++ b/net/sharity-light/files/unshlight.c
@@ -0,0 +1,73 @@
+#include <sys/param.h>
+#include <sys/mount.h>
+
+#include <err.h>
+#include <sysexits.h>
+#include <unistd.h>
+#include <stdlib.h>
+#include <signal.h>
+
+static void usage(void);
+
+int
+main(int argc, char** argv)
+{
+ struct statfs* mntbuf;
+ int mntcount, i;
+ int aflag=0;
+ int ch;
+
+ while ( (ch = getopt(argc, argv, "a")) != -1) {
+ switch (ch) {
+ case 'a':
+ aflag=1;
+ break;
+ case '?':
+ default:
+ usage();
+ }
+ }
+ argc -= optind;
+ argv += optind;
+ if (aflag && argc != 0)
+ usage();
+ if (!aflag && argc == 0)
+ usage();
+
+ for (; argc>0 || aflag; aflag?(void)(aflag=0):(void)(argc--, argv++)) {
+ char abspath[MAXPATHLEN];
+ pid_t pid=0;
+ if (argc > 0) {
+ if (realpath(argv[0], abspath) == 0) {
+ warn(abspath);
+ continue;
+ }
+ }
+ mntcount=getmntinfo(&mntbuf, MNT_NOWAIT);
+ if (mntcount < 0)
+ err(EX_OSERR, "getmntinfo");
+ for (i=0; i<mntcount; i++) {
+ char* s;
+ int error;
+ if (argc > 0 && strcmp(abspath, mntbuf[i].f_mntonname) != 0) continue;
+ if (mntbuf[i].f_type != MOUNT_NFS) continue;
+ if (strncmp(mntbuf[i].f_mntfromname, "shlight-", 8) != 0) continue;
+ pid=strtoul(mntbuf[i].f_mntfromname+8, &s, 10);
+ if (*s) continue;
+ error = unmount (mntbuf[i].f_mntonname, 0);
+ if (error == 0) {
+ kill (pid, SIGHUP);
+ } else {
+ warn(mntbuf[i].f_mntonname);
+ }
+ }
+ if (argc > 0 && !pid)
+ warnx("%s: not currently mounted", abspath);
+ }
+}
+
+void
+usage(void)
+{
+ errx(EX_USAGE, "Usage: unshlight [-a] [node]");
+}