Mercurial > masqmail
comparison src/peopen.c @ 15:f671821d8222
code beautifying; 0 -> \0 if appropriate
author | meillo@marmaro.de |
---|---|
date | Thu, 06 Nov 2008 09:18:38 +0100 |
parents | 26e34ae9a3e3 |
children | 3654c502a4df |
comparison
equal
deleted
inserted
replaced
14:a8f3424347dc | 15:f671821d8222 |
---|---|
5 #include <stdio.h> | 5 #include <stdio.h> |
6 #include <stdlib.h> | 6 #include <stdlib.h> |
7 #include <unistd.h> | 7 #include <unistd.h> |
8 #include <string.h> | 8 #include <string.h> |
9 #include <sys/types.h> | 9 #include <sys/types.h> |
10 #include <sysexits.h> | |
10 | 11 |
11 #include "peopen.h" | 12 #include "peopen.h" |
12 #include "sysexits.h" | |
13 | |
14 #include "masqmail.h" | 13 #include "masqmail.h" |
15 | 14 |
16 static void | 15 static void |
17 destroy_argv(char **arr) | 16 destroy_argv(char **arr) |
18 { | 17 { |
33 char **arr, *q; | 32 char **arr, *q; |
34 const char *p; | 33 const char *p; |
35 int i = 0; | 34 int i = 0; |
36 | 35 |
37 arr = (char **) malloc(sizeof(char *) * count); | 36 arr = (char **) malloc(sizeof(char *) * count); |
37 /* FIXME: check return value of malloc() */ | |
38 | 38 |
39 p = cmd; | 39 p = cmd; |
40 while (*p && i < (count - 1)) { | 40 while (*p && i < (count - 1)) { |
41 while (*p && isspace(*p)) | 41 while (*p && isspace(*p)) |
42 p++; | 42 p++; |
43 q = buf; | 43 q = buf; |
44 while (*p && !isspace(*p)) | 44 while (*p && !isspace(*p)) |
45 *q++ = *p++; | 45 *q++ = *p++; |
46 *q = 0; | 46 *q = '\0'; |
47 arr[i++] = strdup(buf); | 47 arr[i++] = strdup(buf); |
48 while (*p && isspace(*p)) | 48 while (*p && isspace(*p)) |
49 p++; | 49 p++; |
50 } | 50 } |
51 arr[i] = NULL; | 51 arr[i] = NULL; |