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");
-}