diff --git a/src/bin/initdb/initdb.c b/src/bin/initdb/initdb.c index f40ad87..4855f99 100644 *** a/src/bin/initdb/initdb.c --- b/src/bin/initdb/initdb.c *************** static char infoversion[100]; *** 111,116 **** --- 111,117 ---- static bool caught_signal = false; static bool output_failed = false; static int output_errno = 0; + static char **append_config_buffer; /* defaults */ static int n_connections = 10; *************** xstrdup(const char *s) *** 271,276 **** --- 272,298 ---- return result; } + /* like xstrdup, but appends a newline to the duplicated string*/ + static char * + xstrdupln(const char *s) + { + char *result; + int len = strlen(s); + + result = (char*)malloc(len+2); + if (!result) + { + fprintf(stderr, _("%s: out of memory\n"), progname); + exit(1); + } + memcpy(result,s,len); + + result[len] = '\n'; + result[len+1] = 0; + + return result; + } + /* * make a copy of the array of lines, with token replaced by replacement * the first time it occurs on each line. *************** readfile(const char *path) *** 417,422 **** --- 439,517 ---- } /* + * return a char** created by appending the source** with the dest** + * + * adds newlines to the end of any line which are missing one. + */ + static char ** + append_lines(char **src, char **lines) + { + char **buf; + int i; + int src_lines = 0; + int app_lines = 0; + + for (i=0; src[i]; i++) + src_lines++; + for (i=0; lines[i]; i++) + app_lines++; + + buf = (char**) pg_malloc((src_lines + app_lines + 1) * (sizeof(char *))); + + memcpy(buf,src,(sizeof(char *))*src_lines); + + for (i=0; i