Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 12 Sep 2012 13:34:23 +0000 (UTC)
From:      Dag-Erling Smørgrav <des@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-user@freebsd.org
Subject:   svn commit: r240395 - in user/des: bsddom election evilhttpd fetch grok
Message-ID:  <201209121334.q8CDYNJb077367@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: des
Date: Wed Sep 12 13:34:23 2012
New Revision: 240395
URL: http://svn.freebsd.org/changeset/base/240395

Log:
  Remove accidentally committed crap.

Added:
  user/des/grok/Makefile
  user/des/grok/grok.c
  user/des/grok/grok.h
  user/des/grok/index.c
  user/des/grok/search.c
  user/des/grok/version.h
Deleted:
  user/des/bsddom/
  user/des/election/
  user/des/evilhttpd/
  user/des/fetch/

Added: user/des/grok/Makefile
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ user/des/grok/Makefile	Wed Sep 12 13:34:23 2012	(r240395)
@@ -0,0 +1,11 @@
+# $Id$
+
+PROG	 = grok
+SRCS	 = grok.c
+SRCS	+= index.c index_dir.c index_file.c
+SRCS	+= search.c
+MAN	 =
+
+WARNS	?= 6
+
+.include <bsd.prog.mk>

Added: user/des/grok/grok.c
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ user/des/grok/grok.c	Wed Sep 12 13:34:23 2012	(r240395)
@@ -0,0 +1,104 @@
+/*-
+ * Copyright (c) 2011 Dag-Erling Smørgrav
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer
+ *    in this position and unchanged.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * $Id$
+ */
+
+#include <sys/param.h>
+
+#include <err.h>
+#include <locale.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+#include "grok.h"
+
+static char cwd[MAXPATHLEN];
+
+const char *corpusdir;		/* where the corpus is */
+const char *indexdir;		/* where our index is */
+int verbose;			/* verbosity level */
+
+void
+grok_version(void)
+{
+
+	fprintf(stderr, "grok %8lu\n", GROK_VERSION);
+	fprintf(stderr, "%s\n", GROK_COPYRIGHT);
+}
+
+void
+grok_usage(void)
+{
+
+	fprintf(stderr, "usage: %s [-Vv] [-c corpus] [-i index]\n",
+	    getprogname());
+}
+
+int
+grok_opt(int opt, const char *arg)
+{
+
+	switch (opt) {
+	case 'c':
+		corpusdir = arg;
+		break;
+	case 'i':
+		indexdir = arg;
+		break;
+	case 'V':
+		grok_version();
+		exit(0);
+	case 'v':
+		verbose++;
+		break;
+	default:
+		return (0);
+	}
+	return (1);
+}
+
+int
+main(int argc, char *argv[])
+{
+
+	setlocale(LC_CTYPE, "");
+
+	/* default corpus and index dir are cwd */
+	if (getcwd(cwd, sizeof(cwd)) == NULL)
+		err(1, "getcwd()");
+	corpusdir = indexdir = cwd;
+
+	if (strstr(getprogname(), "index") != NULL)
+		index_main(argc, argv);
+	else
+		search_main(argc, argv);
+
+	/* not reached */
+	exit(1);
+}

Added: user/des/grok/grok.h
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ user/des/grok/grok.h	Wed Sep 12 13:34:23 2012	(r240395)
@@ -0,0 +1,63 @@
+/*-
+ * Copyright (c) 2011 Dag-Erling Smørgrav
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer
+ *    in this position and unchanged.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * $Id$
+ */
+
+#ifndef GROK_H_INCLUDED
+#define GROK_H_INCLUDED
+
+#include <wchar.h>
+
+#include "version.h"
+
+void grok_version(void);
+void grok_usage(void);
+
+#define GROK_OPTS "c:i:Vv"
+int grok_opt(int, const char *);
+
+extern const char *corpusdir;
+extern const char *indexdir;
+extern int verbose;
+
+int index_main(int, char **);
+int search_main(int, char **);
+
+#ifdef WEOF /* we have <wchar.h>  */
+
+#define WBOW ((wint_t)-3)	/* beginning-of-word */
+#define WEOW ((wint_t)-2)	/* end-of-word */
+
+struct grok_node {
+	wint_t ch;		/* can be a character, WBOW or WEOW */
+	unsigned int child;	/* first child, if any, or 0 */
+	unsigned int sibling;	/* next sibling, if any, or 0 */
+	
+};
+#endif
+
+#endif

Added: user/des/grok/index.c
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ user/des/grok/index.c	Wed Sep 12 13:34:23 2012	(r240395)
@@ -0,0 +1,84 @@
+/*-
+ * Copyright (c) 2011 Dag-Erling Smørgrav
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer
+ *    in this position and unchanged.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * $Id$
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+
+#include "grok.h"
+#include "index.h"
+
+struct grok_filter *filter_list;
+struct grok_filter default_filter_list[] = {
+	{ .type = FILTER_EXCLUDE, .pattern = "*/.svn/*" },
+	{ .type = FILTER_EXCLUDE, .pattern = "*/CVS/*" },
+	{ .type = FILTER_EXCLUDE, .pattern = "*.uue" },
+	{ .type = FILTER_EXCLUDE, .pattern = "*.b64" },
+	{ .type = FILTER_EXCLUDE, .pattern = "*~" },
+	{ .type = FILTER_EXCLUDE, .pattern = "*.orig" },
+	{ .type = FILTER_EXCLUDE, .pattern = "*.rej" },
+};
+
+int skip_comments;
+int include_binary;
+
+static void
+usage(void)
+{
+
+	grok_usage();
+	exit(1);
+}
+
+int
+index_main(int argc, char *argv[])
+{
+	int opt;
+
+	while ((opt = getopt(argc, argv, GROK_OPTS "C")) != -1)
+		switch (opt) {
+		case 'b':
+			include_binary = 1;
+			break;
+		case 'C':
+			skip_comments = 1;
+			break;
+		default:
+			if (!grok_opt(opt, optarg))
+				usage();
+		}
+
+	argc -= optind;
+	argv += optind;
+
+	while (argc--)
+		add_file_to_index(*argv++);
+
+	exit(0);
+}

Added: user/des/grok/search.c
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ user/des/grok/search.c	Wed Sep 12 13:34:23 2012	(r240395)
@@ -0,0 +1,63 @@
+/*-
+ * Copyright (c) 2011 Dag-Erling Smørgrav
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer
+ *    in this position and unchanged.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * $Id$
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+
+#include "grok.h"
+
+static void
+usage(void)
+{
+
+	grok_version();
+	exit(1);
+}
+
+int
+search_main(int argc, char *argv[])
+{
+	int opt;
+
+	while ((opt = getopt(argc, argv, GROK_OPTS)) != -1)
+		switch (opt) {
+		default:
+			if (!grok_opt(opt, optarg))
+				usage();
+		}
+
+	argc -= optind;
+	argv += optind;
+
+	if (argc == 0)
+		usage();
+
+	exit(0);
+}

Added: user/des/grok/version.h
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ user/des/grok/version.h	Wed Sep 12 13:34:23 2012	(r240395)
@@ -0,0 +1,36 @@
+/*-
+ * Copyright (c) 2011 Dag-Erling Smørgrav
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer
+ *    in this position and unchanged.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * $Id$
+ */
+
+#ifndef VERSION_H_INCLUDED
+#define VERSION_H_INCLUDED
+
+#define GROK_COPYRIGHT "Copyright (c) 2011 Dag-Erling Smørgrav"
+#define GROK_VERSION 20111014LU
+
+#endif



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201209121334.q8CDYNJb077367>