summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--bin/htagml.c23
1 files changed, 14 insertions, 9 deletions
diff --git a/bin/htagml.c b/bin/htagml.c
index 9ab1e1c2..b4101b64 100644
--- a/bin/htagml.c
+++ b/bin/htagml.c
@@ -81,10 +81,10 @@ int main(int argc, char *argv[]) {
 	bool pre = false;
 	bool pipe = false;
 	bool index = false;
-	const char *tagsFile = "tags";
+	const char *tagsPath = "tags";
 	for (int opt; 0 < (opt = getopt(argc, argv, "f:ipx"));) {
 		switch (opt) {
-			break; case 'f': tagsFile = optarg;
+			break; case 'f': tagsPath = optarg;
 			break; case 'i': pipe = true;
 			break; case 'p': pre = true;
 			break; case 'x': index = true;
@@ -94,8 +94,16 @@ int main(int argc, char *argv[]) {
 	if (optind == argc) errx(EX_USAGE, "name required");
 	const char *name = argv[optind];
 
-	FILE *file = fopen(tagsFile, "r");
-	if (!file) err(EX_NOINPUT, "%s", tagsFile);
+	FILE *file = fopen(name, "r");
+	if (!file) err(EX_NOINPUT, "%s", name);
+
+	FILE *tagsFile = fopen(tagsPath, "r");
+	if (!tagsFile) err(EX_NOINPUT, "%s", tagsPath);
+
+#ifdef __OpenBSD__
+	int error = pledge("stdio", NULL);
+	if (error) err(EX_OSERR, "pledge");
+#endif
 
 	size_t len = 0;
 	size_t cap = 256;
@@ -109,7 +117,7 @@ int main(int argc, char *argv[]) {
 
 	char *buf = NULL;
 	size_t bufCap = 0;
-	while (0 < getline(&buf, &bufCap, file)) {
+	while (0 < getline(&buf, &bufCap, tagsFile)) {
 		char *line = buf;
 		char *tag = strsep(&line, "\t");
 		char *file = strsep(&line, "\t");
@@ -142,10 +150,7 @@ int main(int argc, char *argv[]) {
 		}
 		len++;
 	}
-	fclose(file);
-
-	file = fopen(name, "r");
-	if (!file) err(EX_NOINPUT, "%s", name);
+	fclose(tagsFile);
 
 	int num = 0;
 	printf(pre ? "<pre>" : index ? "<ul class=\"index\">\n" : "");
2c9d20000c63014666bf5791&follow=1'>Maintain stateCaps and offer them to clientsJune McEnroe 2019-11-09Parse capabilitiesJune McEnroe The list that I've defined are the ones that I expect to be able to enable probably without any clients breaking... And of course server-time which pounce implements itself. 2019-11-09Avoid the reserved _A names with BIT macroJune McEnroe 2019-11-09Define macro for bit flag enumsJune McEnroe 2019-11-08Check that password is hashedJune McEnroe 2019-11-08Avoid calling getopt_long again after it returns -1June McEnroe On GNU, calling getopt_long again will reset optind back to the first non-option argument, which would cause an infinite loop of reading the same configurtion file forever. 2019-11-08Only change AWAY status for registered clientsJune McEnroe Turns out I did eventually fix this, because I may want to implement "passive clients" for logging or notification stuff, which wouldn't affect AWAY status either. 2019-11-07Just write the example normallyJune McEnroe 2019-11-07Include path in readlinkat errorJune McEnroe 2019-11-07Call clientConsume before clientRecvJune McEnroe This might reduce the frequency of a client getting its own message back because it was behind in the ring when it sent it. 2019-11-06Use -l:filename in Linux.mkJune McEnroe 2019-11-06Fix compat.h for #defined strlcpyJune McEnroe 2019-11-06Allow unsetting LIBRESSL_PREFIXJune McEnroe 2019-11-06Document calico service configurationJune McEnroe 2019-11-06Document SASL EXTERNAL configuration in more detailJune McEnroe 2019-11-06Document pounce service configurationJune McEnroe 2019-11-06Mention Darwin and GNU/Linux in READMEJune McEnroe 2019-11-06Assume LibreSSL from brew on DarwinJune McEnroe 2019-11-06Remove -DNO_EXPLICIT_BZERO from Darwin.mkJune McEnroe 2019-11-06Don't install rc scripts or dirs on LinuxJune McEnroe