summary refs log tree commit diff
path: root/bin
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2020-03-03 02:01:12 -0500
committerJune McEnroe <june@causal.agency>2020-03-03 02:01:41 -0500
commit33a92e1bf4bf57ec3c25d21670ee8f11a5302084 (patch)
tree23be9427a4ce96353016018538ee9eaface647d5 /bin
parentUse getopts in shell scripts (diff)
downloadsrc-33a92e1bf4bf57ec3c25d21670ee8f11a5302084.tar.gz
src-33a92e1bf4bf57ec3c25d21670ee8f11a5302084.zip
Remove setopt
Diffstat (limited to 'bin')
-rw-r--r--bin/.gitignore1
-rw-r--r--bin/Makefile1
-rw-r--r--bin/README.74
-rw-r--r--bin/man1/setopt.148
-rw-r--r--bin/setopt.c55
5 files changed, 1 insertions, 108 deletions
diff --git a/bin/.gitignore b/bin/.gitignore
index a476740d..540d14ec 100644
--- a/bin/.gitignore
+++ b/bin/.gitignore
@@ -26,7 +26,6 @@ ptee
 relay
 scheme
 scheme.h
-setopt
 shotty
 tags
 title
diff --git a/bin/Makefile b/bin/Makefile
index 299356d7..3d85542c 100644
--- a/bin/Makefile
+++ b/bin/Makefile
@@ -33,7 +33,6 @@ BINS += pngo
 BINS += psf2png
 BINS += ptee
 BINS += scheme
-BINS += setopt
 BINS += shotty
 BINS += title
 BINS += ttpre
diff --git a/bin/README.7 b/bin/README.7
index 98717614..c480ef5d 100644
--- a/bin/README.7
+++ b/bin/README.7
@@ -1,4 +1,4 @@
-.Dd September 3, 2019
+.Dd March  3, 2020
 .Dt BIN 7
 .Os "Causal Agency"
 .
@@ -58,8 +58,6 @@ tee for PTYs
 IRC relay bot
 .It Xr scheme 1
 color scheme
-.It Xr setopt 1
-quoting getopt
 .It Xr shotty 1
 terminal capture
 .It Xr title 1
diff --git a/bin/man1/setopt.1 b/bin/man1/setopt.1
deleted file mode 100644
index 246f06fe..00000000
--- a/bin/man1/setopt.1
+++ /dev/null
@@ -1,48 +0,0 @@
-.Dd February 24, 2019
-.Dt SETOPT 1
-.Os
-.
-.Sh NAME
-.Nm setopt
-.Nd quoting getopt
-.
-.Sh SYNOPSIS
-.Nm
-.Ar optstring
-.Op Ar args ...
-.
-.Sh DESCRIPTION
-.Nm
-behaves similarly to
-.Xr getopt 1 ,
-except that it produces quoted output
-appropriate for use with the
-.Nm eval
-shell builtin.
-This allows arguments containing whitespace
-to survive parsing.
-.
-.Sh EXAMPLES
-.Bd -literal -offset indent
-args=$(setopt abo: "$@")
-eval set -- "$args"
-.Ed
-.
-.Sh SEE ALSO
-.Xr getopt 1 ,
-.Xr sh 1 ,
-.Xr getopt 3
-.
-.Sh HISTORY
-The
-.Xr getopt 1
-manual page of
-.Fx
-reads,
-.Do
-Arguments containing white space
-or embedded shell metacharacters
-generally will not survive intact;
-this looks easy to fix but isn't.
-.Dc
-Yet here we are.
diff --git a/bin/setopt.c b/bin/setopt.c
deleted file mode 100644
index ad303730..00000000
--- a/bin/setopt.c
+++ /dev/null
@@ -1,55 +0,0 @@
-/* Copyright (C) 2019  June McEnroe <june@causal.agency>
- *
- * 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 <http://www.gnu.org/licenses/>.
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <sysexits.h>
-#include <unistd.h>
-
-static void printArg(const char *str) {
-	printf(" ");
-	if (!str[0]) {
-		printf("''");
-		return;
-	}
-	while (str[0]) {
-		size_t sq = strcspn(str, "'");
-		if (sq) {
-			printf("'%.*s'", (int)sq, str);
-		} else {
-			printf("\"'\"");
-			sq++;
-		}
-		str = &str[sq];
-	}
-}
-
-int main(int argc, char *argv[]) {
-	if (argc < 2) return EX_USAGE;
-	int opt;
-	optind = 2;
-	while (0 < (optarg = NULL, opt = getopt(argc, argv, argv[1]))) {
-		if (opt == '?') return EX_USAGE;
-		printf(" -%c", opt);
-		if (optarg) printArg(optarg);
-	}
-	printf(" --");
-	for (; optind < argc; ++optind) {
-		printArg(argv[optind]);
-	}
-	printf("\n");
-}
to clear current cacheLars Hjemli Signed-off-by: Lars Hjemli <hjemli@gmail.com> 2006-12-13Remove implementation details from READMELars Hjemli Let README describe the "bigger picture" instead. Signed-off-by: Lars Hjemli <hjemli@gmail.com> 2006-12-13Small layout adjustments to summary and blob viewLars Hjemli Signed-off-by: Lars Hjemli <hjemli@gmail.com> 2006-12-13Add display of tree content w/ui-tree.cLars Hjemli Signed-off-by: Lars Hjemli <hjemli@gmail.com> 2006-12-12cache_lock: do xstrdup/free on lockfileLars Hjemli Since fmt() uses 8 alternating static buffers, and cache_lock might call cache_create_dirs() multiple times, which in turn might call fmt() twice, after four iterations lockfile would be overwritten by a cachedirectory path. In worst case, this could cause the cachedirectory to be unlinked and replaced by a cachefile. Fix: use xstrdup() on the result from fmt() before assigning to lockfile, and call free(lockfile) before exit. Signed-off-by: Lars Hjemli <hjemli@gmail.com> 2006-12-11Don't truncate valid cachefilesLars Hjemli An embarrassing thinko in cgit_check_cache() would truncate valid cachefiles in the following situation: 1) process A notices a missing/expired cachefile 2) process B gets scheduled, locks, fills and unlocks the cachefile 3) process A gets scheduled, locks the cachefile, notices that the cachefile now exist/is not expired anymore, and continues to overwrite it with an empty lockfile. Thanks to Linus for noticing (again). Signed-off-by: Lars Hjemli <hjemli@gmail.com> 2006-12-11Move global variables + callback functions into shared.cLars Hjemli Signed-off-by: Lars Hjemli <hjemli@gmail.com> 2006-12-11Move functions for generic object output into ui-view.cLars Hjemli Signed-off-by: Lars Hjemli <hjemli@gmail.com> 2006-12-11Move log-functions into ui-log.cLars Hjemli Signed-off-by: Lars Hjemli <hjemli@gmail.com> 2006-12-11Move repo summary functions into ui-summary.cLars Hjemli Signed-off-by: Lars Hjemli <hjemli@gmail.com> 2006-12-11Move functions for repolist output into ui-repolist.cLars Hjemli Signed-off-by: Lars Hjemli <hjemli@gmail.com> 2006-12-11Move common output-functions into ui-shared.cLars Hjemli While at it, replace the cgit_[lib_]error constants with a proper function Signed-off-by: Lars Hjemli <hjemli@gmail.com> 2006-12-11Rename config.c to parsing.c + move cgit_parse_query from cgit.c to parsing.cLars Hjemli Signed-off-by: Lars Hjemli <hjemli@gmail.com> 2006-12-11Avoid infinite loops in caching layerLars Hjemli Add a global variable, cgit_max_lock_attemps, to avoid the possibility of infinite loops when failing to acquire a lockfile. This could happen on broken setups or under crazy server load. Incidentally, this also fixes a lurking bug in cache_lock() where an uninitialized returnvalue was used. Signed-off-by: Lars Hjemli <hjemli@gmail.com> 2006-12-11Let 'make install' clear all cachefilesLars Hjemli Signed-off-by: Lars Hjemli <hjemli@gmail.com> 2006-12-11Fix cache algorithm loopholeLars Hjemli This closes the door for unneccessary calls to cgit_fill_cache(). Noticed by Linus. Signed-off-by: Lars Hjemli <hjemli@gmail.com> 2006-12-10Add version identifier in generated filesLars Hjemli Signed-off-by: Lars Hjemli <hjemli@gmail.com> 2006-12-10Add license file and copyright noticesLars Hjemli Signed-off-by: Lars Hjemli <hjemli@gmail.com> 2006-12-10Add caching infrastructureLars Hjemli