Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit e9f11c6

Browse files
committed
pg_config should print an error message to stderr and exit if an
information item is not available.
1 parent cb8b661 commit e9f11c6

File tree

1 file changed

+35
-11
lines changed

1 file changed

+35
-11
lines changed

src/bin/pg_config/pg_config.c

Lines changed: 35 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
*
1818
* Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
1919
*
20-
* $PostgreSQL: pgsql/src/bin/pg_config/pg_config.c,v 1.14 2005/10/05 12:16:28 momjian Exp $
20+
* $PostgreSQL: pgsql/src/bin/pg_config/pg_config.c,v 1.15 2005/10/06 12:04:58 petere Exp $
2121
*
2222
*-------------------------------------------------------------------------
2323
*/
@@ -255,7 +255,10 @@ show_configure(bool all)
255255
printf("%s\n", VAL_CONFIGURE);
256256
#else
257257
if (!all)
258-
printf("not recorded\n");
258+
{
259+
fprintf(stderr, _("not recorded\n"));
260+
exit(1);
261+
}
259262
#endif
260263
}
261264

@@ -268,7 +271,10 @@ show_cc(bool all)
268271
printf("%s\n", VAL_CC);
269272
#else
270273
if (!all)
271-
printf("not recorded\n");
274+
{
275+
fprintf(stderr, _("not recorded\n"));
276+
exit(1);
277+
}
272278
#endif
273279
}
274280

@@ -281,7 +287,10 @@ show_cppflags(bool all)
281287
printf("%s\n", VAL_CPPFLAGS);
282288
#else
283289
if (!all)
284-
printf("not recorded\n");
290+
{
291+
fprintf(stderr, _("not recorded\n"));
292+
exit(1);
293+
}
285294
#endif
286295
}
287296

@@ -294,7 +303,10 @@ show_cflags(bool all)
294303
printf("%s\n", VAL_CFLAGS);
295304
#else
296305
if (!all)
297-
printf("not recorded\n");
306+
{
307+
fprintf(stderr, _("not recorded\n"));
308+
exit(1);
309+
}
298310
#endif
299311
}
300312

@@ -307,7 +319,10 @@ show_cflags_sl(bool all)
307319
printf("%s\n", VAL_CFLAGS_SL);
308320
#else
309321
if (!all)
310-
printf("not recorded\n");
322+
{
323+
fprintf(stderr, _("not recorded\n"));
324+
exit(1);
325+
}
311326
#endif
312327
}
313328

@@ -320,7 +335,10 @@ show_ldflags(bool all)
320335
printf("%s\n", VAL_LDFLAGS);
321336
#else
322337
if (!all)
323-
printf("not recorded\n");
338+
{
339+
fprintf(stderr, _("not recorded\n"));
340+
exit(1);
341+
}
324342
#endif
325343
}
326344

@@ -333,7 +351,10 @@ show_ldflags_sl(bool all)
333351
printf("%s\n", VAL_LDFLAGS_SL);
334352
#else
335353
if (!all)
336-
printf("not recorded\n");
354+
{
355+
fprintf(stderr, _("not recorded\n"));
356+
exit(1);
357+
}
337358
#endif
338359
}
339360

@@ -346,7 +367,10 @@ show_libs(bool all)
346367
printf("%s\n", VAL_LIBS);
347368
#else
348369
if (!all)
349-
printf("not recorded\n");
370+
{
371+
fprintf(stderr, _("not recorded\n"));
372+
exit(1);
373+
}
350374
#endif
351375
}
352376

@@ -427,14 +451,14 @@ help(void)
427451
printf(_(" --libs show LIBS value used when PostgreSQL was built\n"));
428452
printf(_(" --version show the PostgreSQL version\n"));
429453
printf(_(" --help show this help, then exit\n"));
430-
printf(_("With no arguments, all known items are shown.\n\n"));
454+
printf(_("\nWith no arguments, all known items are shown.\n\n"));
431455
printf(_("Report bugs to <pgsql-bugs@postgresql.org>.\n"));
432456
}
433457

434458
static void
435459
advice(void)
436460
{
437-
fprintf(stderr, _("\nTry \"%s --help\" for more information\n"), progname);
461+
fprintf(stderr, _("Try \"%s --help\" for more information.\n"), progname);
438462
}
439463

440464
static void

0 commit comments

Comments
 (0)