From 459491752734b1c2f0b40b84f41d06dbb865b447 Mon Sep 17 00:00:00 2001 From: Michael Kerrisk Date: Sat, 2 Jun 2007 06:08:57 +0000 Subject: [PATCH] Reformatted code example --- man2/wait.2 | 10 ++++++++-- man3/fmemopen.3 | 15 ++++++++++++--- 2 files changed, 20 insertions(+), 5 deletions(-) diff --git a/man2/wait.2 b/man2/wait.2 index c9fb73bac..b240a2c58 100644 --- a/man2/wait.2 +++ b/man2/wait.2 @@ -537,7 +537,10 @@ main(int argc, char *argv[]) int status; cpid = fork(); - if (cpid == -1) { perror("fork"); exit(EXIT_FAILURE); } + if (cpid == -1) { + perror("fork"); + exit(EXIT_FAILURE); + } if (cpid == 0) { /* Code executed by child */ printf("Child PID is %ld\\n", (long) getpid()); @@ -548,7 +551,10 @@ main(int argc, char *argv[]) } else { /* Code executed by parent */ do { w = waitpid(cpid, &status, WUNTRACED | WCONTINUED); - if (w == -1) { perror("waitpid"); exit(EXIT_FAILURE); } + if (w == -1) { + perror("waitpid"); + exit(EXIT_FAILURE); + } if (WIFEXITED(status)) { printf("exited, status=%d\\n", WEXITSTATUS(status)); diff --git a/man3/fmemopen.3 b/man3/fmemopen.3 index 2a612ccc0..cb88a3084 100644 --- a/man3/fmemopen.3 +++ b/man3/fmemopen.3 @@ -177,10 +177,16 @@ main(int argc, char *argv[]) assert(argc == 2); in = fmemopen(argv[1], strlen(argv[1]), "r"); - if (in == NULL) { perror("fmemopen"); exit(EXIT_FAILURE);} + if (in == NULL) { + perror("fmemopen"); + exit(EXIT_FAILURE); + } out = open_memstream(&ptr, &size); - if (out == NULL) { perror("fmemopen"); exit(EXIT_FAILURE);} + if (out == NULL) { + perror("fmemopen"); + exit(EXIT_FAILURE); + } for (;;) { s = fscanf(in, "%d", &v); @@ -188,7 +194,10 @@ main(int argc, char *argv[]) break; s = fprintf(out, "%d ", v * v); - if (s == -1) { perror("fprintf"); exit(EXIT_FAILURE); } + if (s == -1) { + perror("fprintf"); + exit(EXIT_FAILURE); + } } fclose(in); fclose(out);