From e8efd710cb7178d80d7abfefef372fac29c8c827 Mon Sep 17 00:00:00 2001 From: "C. McEnroe" Date: Fri, 1 Oct 2021 15:06:41 -0400 Subject: Remove igp I'm not serving gopher anymore. --- www/text.causal.agency/Makefile | 13 +--- www/text.causal.agency/igp.1 | 49 -------------- www/text.causal.agency/igp.c | 143 ---------------------------------------- 3 files changed, 3 insertions(+), 202 deletions(-) delete mode 100644 www/text.causal.agency/igp.1 delete mode 100644 www/text.causal.agency/igp.c (limited to 'www') diff --git a/www/text.causal.agency/Makefile b/www/text.causal.agency/Makefile index 913fc586..5b3c86b8 100644 --- a/www/text.causal.agency/Makefile +++ b/www/text.causal.agency/Makefile @@ -1,7 +1,4 @@ -WEBROOT ?= /var/www/text.causal.agency -LIBEXEC ?= /usr/local/libexec - -CFLAGS += -Wall -Wextra +WEBROOT = /var/www/text.causal.agency TXTS += 001-make.txt TXTS += 002-writing-mdoc.txt @@ -38,15 +35,11 @@ all: colb ${TXTS} .7.txt: mandoc -T utf8 $< | ./colb > $@ -feed.atom: feed.sh ${TXTS} +feed.atom: feed.sh colb ${TXTS} sh feed.sh > feed.atom clean: - rm -f ${TXTS} feed.atom igp + rm -f colb ${TXTS} feed.atom install: colb ${TXTS} feed.atom install -p -m 644 ${TXTS} feed.atom ${WEBROOT} - -install-igp: igp - install igp ${LIBEXEC} - install -p -m 644 igp.c ${WEBROOT} diff --git a/www/text.causal.agency/igp.1 b/www/text.causal.agency/igp.1 deleted file mode 100644 index ccfaeaa6..00000000 --- a/www/text.causal.agency/igp.1 +++ /dev/null @@ -1,49 +0,0 @@ -.Dd January 14, 2021 -.Dt IGP 1 -.Os -. -.Sh NAME -.Nm igp -.Nd insane gopher posse -. -.Sh SYNOPSIS -.Nm -.Op Fl h Ar host -.Op Fl p Ar port -.Ar directory -. -.Sh DESCRIPTION -The -.Nm -utility is a simple -Internet Gopher server -which can be started by -.Xr inetd 8 . -It serves directory listings -and files under -.Ar directory . -. -.Pp -The arguments are as follows: -.Bl -tag -width Ds -.It Fl h Ar host -Set the host used in directory listings. -The default is the local host name. -.It Fl p Ar port -Set the port used in directory listeings. -The default is port 70. -.El -. -.Sh STANDARDS -.Rs -.%A B. Alberti -.%A F. Anklesaria -.%A D. Johnson -.%A P. Lindner -.%A M. McCahill -.%A D. Torrey -.%T The Internet Gopher Protocol -.%I IETF -.%R RFC 1436 -.%D March 1993 -.Re diff --git a/www/text.causal.agency/igp.c b/www/text.causal.agency/igp.c deleted file mode 100644 index d7db2b28..00000000 --- a/www/text.causal.agency/igp.c +++ /dev/null @@ -1,143 +0,0 @@ -/* Copyright (C) 2021 C. McEnroe - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#ifdef __FreeBSD__ -#include -#endif - -static int compar(const void *_a, const void *_b) { - const struct dirent *a = _a; - const struct dirent *b = _b; - if (a->d_type != b->d_type) { - return (a->d_type > b->d_type) - (a->d_type < b->d_type); - } - return strcmp(a->d_name, b->d_name); -} - -int main(int argc, char *argv[]) { - int error; - const char *host = NULL; - const char *port = "70"; - for (int opt; 0 < (opt = getopt(argc, argv, "h:p:"));) { - switch (opt) { - break; case 'h': host = optarg; - break; case 'p': port = optarg; - break; default: return EX_USAGE; - } - } - if (optind == argc) return EX_USAGE; - if (!host) { - static char buf[256]; - error = gethostname(buf, sizeof(buf)); - if (error) abort(); - host = buf; - } - - const char *path = argv[optind]; - int root = open(path, O_RDONLY | O_DIRECTORY); - if (root < 0) err(EX_NOINPUT, "/"); - -#ifdef __FreeBSD__ - cap_rights_t cap; - error = cap_enter() - || cap_rights_limit(STDIN_FILENO, cap_rights_init(&cap, CAP_READ)) - || cap_rights_limit(STDOUT_FILENO, cap_rights_init(&cap, CAP_WRITE)) - || cap_rights_limit(STDERR_FILENO, &cap) - || cap_rights_limit( - root, cap_rights_init(&cap, CAP_PREAD, CAP_FSTATAT, CAP_FSTATFS) - ); - if (error) abort(); -#else -#warning "This is completely insecure without capsicum(4)!" -#endif - - char buf[1024]; - if (!fgets(buf, sizeof(buf), stdin)) return EX_PROTOCOL; - char *ptr = buf; - char *sel = strsep(&ptr, "\t\r\n"); - if (sel[0] == '/') sel++; - - int fd = (sel[0] ? openat(root, sel, O_RDONLY) : root); - if (fd < 0) err(EX_NOINPUT, "%s", sel); - - struct stat stat; - error = fstat(fd, &stat); - if (error) err(EX_IOERR, "%s", sel); - if (!(stat.st_mode & (S_IFREG | S_IFDIR))) { - errx(EX_NOINPUT, "%s: Not a file or directory", sel); - } - - if (stat.st_mode & S_IFREG) { -#ifdef __FreeBSD__ - error = sendfile(fd, STDOUT_FILENO, 0, 0, NULL, NULL, 0); - if (!error) return EX_OK; -#endif - char buf[4096]; - for (ssize_t len; 0 < (len = read(fd, buf, sizeof(buf)));) { - fwrite(buf, len, 1, stdout); - } - return EX_OK; - } - - DIR *dir = fdopendir(fd); - if (!dir) err(EX_IOERR, "%s", sel); - - size_t len = 0; - size_t width = 0; - static struct dirent ents[4096]; - for (struct dirent *ent; len < 4096 && (ent = readdir(dir));) { - if (ent->d_name[0] == '.') continue; - if (ent->d_type != DT_REG && ent->d_type != DT_DIR) continue; - if (ent->d_namlen > width) width = ent->d_namlen; - ents[len++] = *ent; - } - - qsort(ents, len, sizeof(ents[0]), compar); - for (size_t i = 0; i < len; ++i) { - char mtime[26] = ""; - if (ents[i].d_type == DT_REG) { - error = fstatat(fd, ents[i].d_name, &stat, 0); - if (error) err(EX_IOERR, "%s/%s", sel, ents[i].d_name); - ctime_r(&stat.st_mtime, mtime); - mtime[24] = '\0'; - } - printf( - "%c%-*s %s\t%s%s%s\t%s\t%s\r\n", - (ents[i].d_type == DT_DIR ? '1' : '0'), - (int)width, ents[i].d_name, mtime, - sel, (sel[0] ? "/" : ""), ents[i].d_name, host, port - ); - } - - printf("i-- \t\t%s\t%s\r\n", host, port); - printf("0Served by IGP (AGPLv3)\tigp.c\ttext.causal.agency\t70\r\n"); - printf(".\r\n"); -} -- cgit 1.4.1 lt;cgit@cryptocrack.de> 2013-04-08Maŕk cgit_environment members constLukas Fleischer These reflect the values of environment variables and should never be changed. Add another xstrdup() when we assign environment variables to strings that are potentially non-constant. Signed-off-by: Lukas Fleischer <cgit@cryptocrack.de> 2013-04-08Return const char * in cgit_{httpscheme, hosturl, rooturl}()Lukas Fleischer The return values of these functions are essentially constant and should never be modified. Note that this will introduce a compiler warning when we try to free the return value of any of these functions. However, given that all of these currently return statically allocated strings in some cases, they need to be refactored before this can be done anyway. Signed-off-by: Lukas Fleischer <cgit@cryptocrack.de> 2013-04-08Update git to v1.8.2.1John Keeping This requires a small change to how we handle notes, but otherwise just works. Note that we can't use anything from v1.8.0 until v1.8.2.1 because some of the symbols that we need for graph drawing were made private in v1.8.0 and this was not reverted until v1.8.2.1. Signed-off-by: John Keeping <john@keeping.me.uk> 2013-04-07ui-blob: don't segfault when no path is givenJohn Keeping It it possible to inspect blobs by specifying only the SHA-1, and CGit provides links to do so, for example if a tag points directly at a blob. In this case the path_items structure is never used, but creating it still causes strlen to be run on a null pointer. Fix this. This error was introduced by commit c1633c6 (Update git to v1.7.6.5 - 2013-03-02). Signed-off-by: John Keeping <john@keeping.me.uk> 2013-03-20Convert pager navigation into a unordered listLukas Fleischer It is common practice and semantically appropriate to use unordered lists for long navigation lists. This also fixes the layout of very long pager navigations in Webkit-based browsers. Signed-off-by: Lukas Fleischer <cgit@cryptocrack.de> 2013-03-20Makefile: remove CGIT-CFLAGS files in clean stageJason A. Donenfeld 2013-03-20ui-summary.c: Move urls variable into print_urls()Lukas Fleischer There's no need for this variable to be global. Printing the header in print_urls() instead of print_url() allows for moving this variable into print_urls() without having to pass any status to print_url(). Note that this only works as long as we don't call print_urls() more than once. Signed-off-by: Lukas Fleischer <cgit@cryptocrack.de> 2013-03-20Fix colspan valuesLukas Fleischer This fixes a couple of minor oversights in previous commits and adjusts all cells using colspan to use the correct width. Signed-off-by: Lukas Fleischer <cgit@cryptocrack.de> 2013-03-20html: check return value of writeJason A. Donenfeld This squelches a gcc warning. It's also correct that we check to see if there are any partial or failed writes. For now, we just print a warning to stderr. In the future, perhaps it will prove wise to exit(1) on partial writes. 2013-03-20ui-shared: squelch compiler warning.Jason A. Donenfeld Since tail is initialized to 0, we will never get a warning on the last if statement, but recent gcc complains anyway. So, we initialize len as well. Future gcc versions should be able to optimize this out anyway. 2013-03-20cgit.mk: Use SHELL_PATH_SQ to run gen-version.shJohn Keeping On some platforms (notably Solaris) /bin/sh doesn't support enough of POSIX for gen-version.sh to run. Git's Makefile provides SHELL_PATH_SQ to address this issue so we just have to use it. Signed-off-by: John Keeping <john@keeping.me.uk> 2013-03-20cgit.mk: don't rebuild everything if CGIT_VERSION changesJohn Keeping If CGIT_VERSION is in CGIT_CFLAGS then a change in version (for example because you have committed your changes) causes all of the CGit objects to be rebuilt. Avoid this by using EXTRA_CPPFLAGS to add the version for only those files that are affected and make them depend on VERSION. Signed-off-by: John Keeping <john@keeping.me.uk> 2013-03-20ui-patch: use cgit_version not CGIT_VERSIONJohn Keeping We already have a global cgit_version which is set from the #define'd CGIT_VERSION in cgit.c. Change ui-patch.c to use this so that we only need to rebuild cgit.o when the version changes. Signed-off-by: John Keeping <john@keeping.me.uk> 2013-03-20Makefile: re-use Git's Makefile where possibleJohn Keeping