diff options
Diffstat (limited to 'src/bin/pg_config/pg_config.c')
-rw-r--r-- | src/bin/pg_config/pg_config.c | 91 |
1 files changed, 46 insertions, 45 deletions
diff --git a/src/bin/pg_config/pg_config.c b/src/bin/pg_config/pg_config.c index 5e9a86dea9b..547628d911c 100644 --- a/src/bin/pg_config/pg_config.c +++ b/src/bin/pg_config/pg_config.c @@ -11,13 +11,13 @@ * accomodate the possibility that the installation has been relocated from * the place originally configured. * - * author of C translation: Andrew Dunstan mailto:andrew@dunslane.net + * author of C translation: Andrew Dunstan mailto:andrew@dunslane.net * * This code is released under the terms of the PostgreSQL License. * * Portions Copyright (c) 1996-2004, PostgreSQL Global Development Group * - * $PostgreSQL: pgsql/src/bin/pg_config/pg_config.c,v 1.5 2004/08/29 04:13:01 momjian Exp $ + * $PostgreSQL: pgsql/src/bin/pg_config/pg_config.c,v 1.6 2004/08/29 05:06:52 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -33,9 +33,9 @@ static char *progname; static void help() { - printf(_("\n%s provides information about the installed version of PostgreSQL.\n\n"),progname); + printf(_("\n%s provides information about the installed version of PostgreSQL.\n\n"), progname); printf(_("Usage:\n")); - printf(_(" %s OPTION...\n\n"),progname); + printf(_(" %s OPTION...\n\n"), progname); printf(_("Options:\n")); printf(_(" --bindir show location of user executables\n")); printf(_(" --includedir show location of C header files of the client\n")); @@ -54,97 +54,98 @@ help() static void advice() { - fprintf(stderr,_("\nTry \"%s --help\" for more information\n"),progname); + fprintf(stderr, _("\nTry \"%s --help\" for more information\n"), progname); } int -main (int argc, char ** argv) +main(int argc, char **argv) { - int i; - int ret; - char mypath[MAXPGPATH]; - char otherpath[MAXPGPATH]; + int i; + int ret; + char mypath[MAXPGPATH]; + char otherpath[MAXPGPATH]; - progname = (char *)get_progname(argv[0]); + progname = (char *) get_progname(argv[0]); if (argc < 2) { - fprintf(stderr,_("%s: argument required\n"),progname); + fprintf(stderr, _("%s: argument required\n"), progname); advice(); exit(1); } - for (i=1; i < argc; i++) + for (i = 1; i < argc; i++) { - if (strcmp(argv[i],"--bindir") == 0 || - strcmp(argv[i],"--includedir") == 0 || - strcmp(argv[i],"--includedir-server") == 0 || - strcmp(argv[i],"--libdir") == 0 || - strcmp(argv[i],"--pkglibdir") == 0 || - strcmp(argv[i],"--pgxs") == 0 || - strcmp(argv[i],"--configure") == 0) + if (strcmp(argv[i], "--bindir") == 0 || + strcmp(argv[i], "--includedir") == 0 || + strcmp(argv[i], "--includedir-server") == 0 || + strcmp(argv[i], "--libdir") == 0 || + strcmp(argv[i], "--pkglibdir") == 0 || + strcmp(argv[i], "--pgxs") == 0 || + strcmp(argv[i], "--configure") == 0) { /* come back to these later */ - continue; + continue; } - if (strcmp(argv[i],"--version") == 0) + if (strcmp(argv[i], "--version") == 0) { printf("PostgreSQL " PG_VERSION "\n"); exit(0); } - if (strcmp(argv[i],"--help") == 0 || strcmp(argv[i],"-?") == 0) + if (strcmp(argv[i], "--help") == 0 || strcmp(argv[i], "-?") == 0) { help(); exit(0); } - fprintf(stderr,_("%s: invalid argument: %s\n"),progname,argv[i]); + fprintf(stderr, _("%s: invalid argument: %s\n"), progname, argv[i]); advice(); exit(1); } - ret = find_my_exec(argv[0],mypath); + ret = find_my_exec(argv[0], mypath); if (ret) { - fprintf(stderr,"%s: could not locate my own executable\n",progname); + fprintf(stderr, "%s: could not locate my own executable\n", progname); exit(1); } - for (i=1; i < argc; i++) + for (i = 1; i < argc; i++) { - if (strcmp(argv[i],"--configure") == 0) + if (strcmp(argv[i], "--configure") == 0) { /* the VAL_CONFIGURE macro must be defined by the Makefile */ - printf("%s\n",VAL_CONFIGURE); + printf("%s\n", VAL_CONFIGURE); continue; } - if (strcmp(argv[i],"--bindir") == 0) + if (strcmp(argv[i], "--bindir") == 0) { /* assume we are located in the bindir */ - char *lastsep; - strcpy(otherpath,mypath); - lastsep = strrchr(otherpath,'/'); + char *lastsep; + + strcpy(otherpath, mypath); + lastsep = strrchr(otherpath, '/'); if (lastsep) *lastsep = '\0'; } - else if (strcmp(argv[i],"--includedir") == 0) - get_include_path(mypath,otherpath); - else if (strcmp(argv[i],"--includedir-server") ==0) - get_includeserver_path(mypath,otherpath); - else if (strcmp(argv[i],"--libdir") == 0) - get_lib_path(mypath,otherpath); - else if (strcmp(argv[i],"--pkglibdir") == 0) - get_pkglib_path(mypath,otherpath); - else if (strcmp(argv[i],"--pgxs") == 0) + else if (strcmp(argv[i], "--includedir") == 0) + get_include_path(mypath, otherpath); + else if (strcmp(argv[i], "--includedir-server") == 0) + get_includeserver_path(mypath, otherpath); + else if (strcmp(argv[i], "--libdir") == 0) + get_lib_path(mypath, otherpath); + else if (strcmp(argv[i], "--pkglibdir") == 0) + get_pkglib_path(mypath, otherpath); + else if (strcmp(argv[i], "--pgxs") == 0) { - get_pkglib_path(mypath,otherpath); - strncat(otherpath, "/pgxs/src/makefiles/pgxs.mk", MAXPGPATH-1); + get_pkglib_path(mypath, otherpath); + strncat(otherpath, "/pgxs/src/makefiles/pgxs.mk", MAXPGPATH - 1); } - printf("%s\n",otherpath); + printf("%s\n", otherpath); } return 0; |