finger

a simple finger client
Log | Files | Refs

commit 63a97679fe23f4d6ed46cc134fe3fd205c912e22
parent 861d4fc180b4b6648e5fd2ebb1e011720898b197
Author: Naveen Narayanan <zerous@nocebo.space>
Date:   Sat, 25 Sep 2021 17:21:28 +0200

Use a while instead of a for loop

Diffstat:
Mfinger.c | 6++++--
1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/finger.c b/finger.c @@ -103,13 +103,15 @@ main(int argc, char **argv) do { byt = recv(sockfd, msg, BUFSZ, 0); - for (int i = 0; i < byt; ++i) - putchar(msg[i]); if (byt == -1) { fprintf(stderr, "recv failed: %s\n", strerror(errno)); goto err3; } + + while (msg - buf < byt) + putchar(*msg++); + msg = buf; } while (byt > 0); }