summary refs log tree commit diff
path: root/chat.c
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2020-03-30 19:44:45 -0400
committerJune McEnroe <june@causal.agency>2020-03-30 19:44:45 -0400
commitff783628268470acc02e52126d6a357691723fba (patch)
treeafde924a98359080d9fc329ea4bd133e50ee735d /chat.c
parentAdd text macros (diff)
downloadcatgirl-ff783628268470acc02e52126d6a357691723fba.tar.gz
catgirl-ff783628268470acc02e52126d6a357691723fba.zip
Replace some declaration; while loops with for loops
I should have been using this for getopt loops already but the call here
is slightly too long to fit on one line as a for loop.
Diffstat (limited to '')
-rw-r--r--chat.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/chat.c b/chat.c
index 258dde2..b7bf91b 100644
--- a/chat.c
+++ b/chat.c
@@ -88,8 +88,7 @@ static void execRead(void) {
 	if (len < 0) err(EX_IOERR, "read");
 	if (!len) return;
 	buf[len] = '\0';
-	char *ptr = buf;
-	while (ptr) {
+	for (char *ptr = buf; ptr;) {
 		char *line = strsep(&ptr, "\n");
 		if (line[0]) command(execID, line);
 	}
@@ -101,8 +100,7 @@ static void utilRead(void) {
 	if (len < 0) err(EX_IOERR, "read");
 	if (!len) return;
 	buf[len] = '\0';
-	char *ptr = buf;
-	while (ptr) {
+	for (char *ptr = buf; ptr;) {
 		char *line = strsep(&ptr, "\n");
 		if (line[0]) uiFormat(Network, Warm, NULL, "%s", line);
 	}
@@ -287,8 +285,7 @@ int main(int argc, char *argv[]) {
 
 		if (signals[SIGCHLD]) {
 			signals[SIGCHLD] = 0;
-			int status;
-			while (0 < waitpid(-1, &status, WNOHANG)) {
+			for (int status; 0 < waitpid(-1, &status, WNOHANG);) {
 				if (WIFEXITED(status) && WEXITSTATUS(status)) {
 					uiFormat(
 						Network, Warm, NULL,
ae4c1ee11379e353f2a94201181a3a9dab75b646&follow=1'>Use standard tree-diff function when showing diffstat for single commitLars Hjemli 2007-05-13Add shared diff-handling functionsLars Hjemli 2007-05-12css: fix bad rendering in Internet ExplorerLars Hjemli 2007-05-11Add links to enable downloading of tagged blobsLars Hjemli 2007-05-11Makefile: add support for building w.o. preinstalled gitLars Hjemli 2007-05-11Tag release v0.3Lars Hjemli 2007-05-11Update README with submodule build infoLars Hjemli 2007-05-11Add submodule links in tree listingLars Hjemli 2007-05-11Add submodules.sh and use it during buildsLars Hjemli 2007-05-11Added git as a submoduleLars Hjemli 2007-05-09Add support for downloading single blobsLars Hjemli 2007-05-08ui-view: show pathname if specified in querystringLars Hjemli 2007-05-08Update to libgit 1.5.2-rc2Lars Hjemli 2007-02-21Layout updateLars Hjemli 2007-02-08Make snapshot feature configurableLars Hjemli 2007-02-08Add support for snapshotsLars Hjemli 2007-02-05cgit v0.2Lars Hjemli 2007-02-05Add support for prefix and gitsrc arguments to 'make'Lars Hjemli 2007-02-04Update cgitrc templateLars Hjemli 2007-02-04Add support for lightweight tagsLars Hjemli 2007-02-04Read repo-info from /etc/cgitrcLars Hjemli 2007-02-04Do not die if tag has no messageLars Hjemli 2007-02-03Fix search for non-virtual urlsLars Hjemli 2007-01-28Update README with install/config informationLars Hjemli