summary refs log tree commit diff
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2018-10-28 02:14:22 -0400
committerJune McEnroe <june@causal.agency>2018-10-28 02:14:22 -0400
commit36ec6cf258e9b5c3aa49cbfd3179a8714b52fee5 (patch)
tree5fe128d5375d5ea18a14ef1641da49e94d0f6f60
parentFix verbose view name in man page (diff)
downloadcatgirl-36ec6cf258e9b5c3aa49cbfd3179a8714b52fee5.tar.gz
catgirl-36ec6cf258e9b5c3aa49cbfd3179a8714b52fee5.zip
Use const char *argv[] signatures
C is really weird about this stuff, but this makes more sense to me.
Diffstat (limited to '')
-rw-r--r--chat.h4
-rw-r--r--event.c8
-rw-r--r--input.c3
-rw-r--r--url.c4
4 files changed, 9 insertions, 10 deletions
diff --git a/chat.h b/chat.h
index a4d1366..5502665 100644
--- a/chat.h
+++ b/chat.h
@@ -40,8 +40,8 @@ void selfNick(const char *nick);
 void selfUser(const char *user);
 void selfJoin(const char *join);
 
-void eventWait(char *const argv[]);
-void eventPipe(char *const argv[]);
+void eventWait(const char *argv[static 2]);
+void eventPipe(const char *argv[static 2]);
 void eventLoop(int ui, int irc);
 
 struct Tag {
diff --git a/event.c b/event.c
index cad170f..e9864ff 100644
--- a/event.c
+++ b/event.c
@@ -33,18 +33,18 @@ static struct {
 	int fd;
 } spawn;
 
-void eventWait(char *const argv[]) {
+void eventWait(const char *argv[static 2]) {
 	uiHide();
 	pid_t pid = fork();
 	if (pid < 0) err(EX_OSERR, "fork");
 	if (!pid) {
-		execvp(argv[0], argv);
+		execvp(argv[0], (char *const *)argv);
 		err(EX_CONFIG, "%s", argv[0]);
 	}
 	spawn.wait = true;
 }
 
-void eventPipe(char *const argv[]) {
+void eventPipe(const char *argv[static 2]) {
 	if (spawn.pipe) {
 		uiLog(TagStatus, UIHot, L"event: existing pipe");
 		return;
@@ -62,7 +62,7 @@ void eventPipe(char *const argv[]) {
 		dup2(rw[1], STDOUT_FILENO);
 		dup2(rw[1], STDERR_FILENO);
 		close(rw[1]);
-		execvp(argv[0], argv);
+		execvp(argv[0], (char *const *)argv);
 		perror(argv[0]);
 		exit(EX_CONFIG);
 	}
diff --git a/input.c b/input.c
index 7866c5a..84ca71c 100644
--- a/input.c
+++ b/input.c
@@ -144,8 +144,7 @@ static void inputClose(struct Tag tag, char *params) {
 static void inputMan(struct Tag tag, char *params) {
 	(void)tag;
 	(void)params;
-	char *argv[] = { "man", "1", "chatte", NULL };
-	eventWait(argv);
+	eventWait((const char *[]) { "man", "1", "chatte", NULL });
 }
 
 static const struct {
diff --git a/url.c b/url.c
index b62baba..de2ebd9 100644
--- a/url.c
+++ b/url.c
@@ -91,14 +91,14 @@ void urlOpenMatch(struct Tag tag, const char *substr) {
 		struct Entry entry = ringEntry(i);
 		if (!entry.url || entry.tag != tag.id) continue;
 		if (!strstr(entry.url, substr)) continue;
-		eventPipe((char *[]) { "open", entry.url, NULL });
+		eventPipe((const char *[]) { "open", entry.url, NULL });
 		break;
 	}
 }
 
 void urlOpenRange(struct Tag tag, size_t at, size_t to) {
 	size_t argc = 1;
-	char *argv[2 + RingLen] = { "open" };
+	const char *argv[2 + RingLen] = { "open" };
 	size_t tagIndex = 0;
 	for (size_t i = RingLen - 1; i < RingLen; --i) {
 		struct Entry entry = ringEntry(i);
23 -0500'>2020-11-04Remove modified sensitivity settingsJune McEnroe 2020-10-29Remove editJune McEnroe 2020-10-27Switch gr alias back to git rebaseJune McEnroe I always type out git reset and sometimes still expect gr to be rebase... Never got used to it I guess. 2020-10-27Allow cd host: to cd to same path over sshJune McEnroe 2020-10-27Use SendEnv for cd host:pathJune McEnroe Works properly for weird paths, etc. 2020-10-27Allow cd host:path over sshJune McEnroe Requires AcceptEnv SSH_CD in the remote sshd_config. 2020-10-07Use mandoc -T utf8 for text.June McEnroe Don't depend on LANG being set. 2020-09-20Add The Awakened KingdomJune McEnroe A cute extra novella. Finally finished this series. 2020-09-12Move /opt/local back, cheat port select to use system manJune McEnroe This is not really how you're supposed to use the select system, I don't think, since the mandoc package actually creates those files, but it does work. This lets me actually use the git installed by MacPorts. 2020-09-12Move /opt/local behind /usr againJune McEnroe The reason I did this with pkgsrc was because I actually don't want the man(1) from mandoc, since it won't follow MANSECT. Same applies to MacPorts. I wish I could disable its man(1) with a variant or whatever. 2020-09-12Enable toc in cgit renderings of man pagesJune McEnroe But keep it disabled for READMEs since they always use non-standard sections and the TOC is just distracting there, I think. Also add the style so its h1 is the same size as the ones inside sections... 2020-09-11Install mandoc on macOSJune McEnroe 2020-09-11Rewrite install script yet againJune McEnroe 2020-09-11Remove NetBSD from install scriptJune McEnroe I never use it. 2020-09-11Use MacPorts rather than pkgsrcJune McEnroe My system is probably such a mess now... 2020-09-11Add debian VM name to sshJune McEnroe 2020-09-11Add influencer tweetJune McEnroe 2020-09-10Add The Kingdom of GodsJune McEnroe Reading has really slowed down :( 2020-09-07Add SunglassesJune McEnroe An IRC find. 2020-09-06Add Between the BreathsJune McEnroe One of those good songs from a soundtrack of a film that probably isn't? The summary sounds a lot more interesting than the title implies, at least. 2020-09-04Open /dev/tty in nudgeJune McEnroe This makes it work even when it's run connected to a pipe, i.e. as the notify command of catgirl... 2020-09-04Add nudgeJune McEnroe 2020-09-03Build fbclock with -lzJune McEnroe I guess this got lost somewhere, long ago... 2020-08-29Add tweets from retweetsJune McEnroe