]> granicus.if.org Git - postgresql/commitdiff
Add --help and --version options. Message cleanup. NLS.
authorPeter Eisentraut <peter_e@gmx.net>
Wed, 21 Aug 2002 22:24:34 +0000 (22:24 +0000)
committerPeter Eisentraut <peter_e@gmx.net>
Wed, 21 Aug 2002 22:24:34 +0000 (22:24 +0000)
src/bin/pg_controldata/nls.mk [new file with mode: 0644]
src/bin/pg_controldata/pg_controldata.c
src/bin/pg_controldata/po/de.po [new file with mode: 0644]

diff --git a/src/bin/pg_controldata/nls.mk b/src/bin/pg_controldata/nls.mk
new file mode 100644 (file)
index 0000000..bf629ce
--- /dev/null
@@ -0,0 +1,5 @@
+# $Header: /cvsroot/pgsql/src/bin/pg_controldata/nls.mk,v 1.1 2002/08/21 22:24:34 petere Exp $
+CATALOG_NAME   := pg_controldata
+AVAIL_LANGUAGES        := de
+GETTEXT_FILES  := pg_controldata.c
+GETTEXT_TRIGGERS:= _
index d9e4709e4ba712c634c3928e635956dbfa1c6ba2..6b52982b51739fb4bc097059ec2925c75f52703b 100644 (file)
@@ -6,7 +6,7 @@
  * copyright (c) Oliver Elphick <olly@lfix.co.uk>, 2001;
  * licence: BSD
  *
- * $Header: /cvsroot/pgsql/src/bin/pg_controldata/pg_controldata.c,v 1.2 2002/08/18 02:48:41 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/bin/pg_controldata/pg_controldata.c,v 1.3 2002/08/21 22:24:34 petere Exp $
  */
 #include "postgres.h"
 
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <fcntl.h>
+#include <locale.h>
+#include <errno.h>
 
 #include "catalog/pg_control.h"
 
+#define _(x) gettext((x))
+
+
+static void
+usage(const char *progname)
+{
+       printf(_("%s displays PostgreSQL database cluster control information.\n"), progname);
+       printf(_("Usage:\n  %s [DATADIR]\n\n"), progname);
+       printf(_("If not data directory is specified, the environment variable PGDATA\nis used.\n\n"));
+       printf(_("Report bugs to <pgsql-bugs@postgresql.org>.\n"));
+}
+
 
 static const char *
 dbState(DBState state)
@@ -35,7 +49,7 @@ dbState(DBState state)
                case DB_IN_PRODUCTION:
                        return "IN_PRODUCTION";
        }
-       return "unrecognized status code";
+       return _("unrecognized status code");
 }
 
 
@@ -50,6 +64,32 @@ main(int argc, char *argv[])
        char            pgctime_str[32];
        char            ckpttime_str[32];
        char       *strftime_fmt = "%c";
+       char       *progname;
+
+       setlocale(LC_ALL, "");
+#ifdef ENABLE_NLS
+       bindtextdomain("pg_controldata", LOCALEDIR);
+       textdomain("pg_controldata");
+#endif
+
+       if (!strrchr(argv[0], '/'))
+               progname = argv[0];
+       else
+               progname = strrchr(argv[0], '/') + 1;
+
+       if (argc > 1)
+       {
+               if (strcmp(argv[1], "--help") == 0 || strcmp(argv[1], "-?") == 0)
+               {
+                       usage(progname);
+                       exit(0);
+               }
+               if (strcmp(argv[1], "--version") == 0 || strcmp(argv[1], "-V") == 0)
+               {
+                       puts("pg_controldata (PostgreSQL) " PG_VERSION);
+                       exit(0);
+               }
+       }
 
        if (argc > 1)
                DataDir = argv[1];
@@ -57,7 +97,7 @@ main(int argc, char *argv[])
                DataDir = getenv("PGDATA");
        if (DataDir == NULL)
        {
-               fprintf(stderr, "no data directory specified\n");
+               fprintf(stderr, _("%s: no data directory specified\n"), progname);
                exit(1);
        }
 
@@ -65,13 +105,15 @@ main(int argc, char *argv[])
 
        if ((fd = open(ControlFilePath, O_RDONLY)) == -1)
        {
-               perror("Failed to open $PGDATA/global/pg_control for reading");
+               fprintf(stderr, _("%s: could not open file \"%s\" for reading (%s)\n"),
+                               progname, ControlFilePath, strerror(errno));
                exit(2);
        }
 
        if (read(fd, &ControlFile, sizeof(ControlFileData)) != sizeof(ControlFileData))
        {
-               perror("Failed to read $PGDATA/global/pg_control");
+               fprintf(stderr, _("%s: could not read file \"%s\" (%s)\n"),
+                               progname, ControlFilePath, strerror(errno));
                exit(2);
        }
        close(fd);
@@ -84,9 +126,9 @@ main(int argc, char *argv[])
        FIN_CRC64(crc);
 
        if (!EQ_CRC64(crc, ControlFile.crc))
-               printf("WARNING: Calculated CRC checksum does not match value stored in file.\n"
-                          "Either the file is corrupt, or it has a different layout than this program\n"
-                          "is expecting.  The results below are untrustworthy.\n\n");
+               printf(_("WARNING: Calculated CRC checksum does not match value stored in file.\n"
+                                "Either the file is corrupt, or it has a different layout than this program\n"
+                                "is expecting.  The results below are untrustworthy.\n\n"));
 
        /*
         * Use variable for format to suppress overly-anal-retentive gcc warning
@@ -97,56 +139,33 @@ main(int argc, char *argv[])
        strftime(ckpttime_str, sizeof(ckpttime_str), strftime_fmt,
                         localtime(&(ControlFile.checkPointCopy.time)));
 
-       printf("pg_control version number:            %u\n"
-                  "Catalog version number:               %u\n"
-                  "Database state:                       %s\n"
-                  "pg_control last modified:             %s\n"
-                  "Current log file id:                  %u\n"
-                  "Next log file segment:                %u\n"
-                  "Latest checkpoint location:           %X/%X\n"
-                  "Prior checkpoint location:            %X/%X\n"
-                  "Latest checkpoint's REDO location:    %X/%X\n"
-                  "Latest checkpoint's UNDO location:    %X/%X\n"
-                  "Latest checkpoint's StartUpID:        %u\n"
-                  "Latest checkpoint's NextXID:          %u\n"
-                  "Latest checkpoint's NextOID:          %u\n"
-                  "Time of latest checkpoint:            %s\n"
-                  "Database block size:                  %u\n"
-                  "Blocks per segment of large relation: %u\n"
-                  "Maximum length of names:              %u\n"
-                  "Maximum number of function arguments: %u\n"
-                  "Date/time type storage:               %s\n"
-                  "Maximum length of locale name:        %u\n"
-                  "LC_COLLATE:                           %s\n"
-                  "LC_CTYPE:                             %s\n",
-
-                  ControlFile.pg_control_version,
-                  ControlFile.catalog_version_no,
-                  dbState(ControlFile.state),
-                  pgctime_str,
-                  ControlFile.logId,
-                  ControlFile.logSeg,
-                  ControlFile.checkPoint.xlogid,
-                  ControlFile.checkPoint.xrecoff,
-                  ControlFile.prevCheckPoint.xlogid,
-                  ControlFile.prevCheckPoint.xrecoff,
-                  ControlFile.checkPointCopy.redo.xlogid,
-                  ControlFile.checkPointCopy.redo.xrecoff,
-                  ControlFile.checkPointCopy.undo.xlogid,
-                  ControlFile.checkPointCopy.undo.xrecoff,
-                  ControlFile.checkPointCopy.ThisStartUpID,
-                  ControlFile.checkPointCopy.nextXid,
-                  ControlFile.checkPointCopy.nextOid,
-                  ckpttime_str,
-                  ControlFile.blcksz,
-                  ControlFile.relseg_size,
-                  ControlFile.nameDataLen,
-                  ControlFile.funcMaxArgs,
-                  (ControlFile.enableIntTimes ?
-                       "64-bit integers" : "Floating point"),
-                  ControlFile.localeBuflen,
-                  ControlFile.lc_collate,
-                  ControlFile.lc_ctype);
-
-       return (0);
+       printf(_("pg_control version number:            %u\n"), ControlFile.pg_control_version);
+       printf(_("Catalog version number:               %u\n"), ControlFile.catalog_version_no);
+       printf(_("Database cluster state:               %s\n"), dbState(ControlFile.state));
+       printf(_("pg_control last modified:             %s\n"), pgctime_str);
+       printf(_("Current log file ID:                  %u\n"), ControlFile.logId);
+       printf(_("Next log file segment:                %u\n"), ControlFile.logSeg);
+       printf(_("Latest checkpoint location:           %X/%X\n"),
+                  ControlFile.checkPoint.xlogid, ControlFile.checkPoint.xrecoff);
+       printf(_("Prior checkpoint location:            %X/%X\n"),
+                  ControlFile.prevCheckPoint.xlogid, ControlFile.prevCheckPoint.xrecoff);
+       printf(_("Latest checkpoint's REDO location:    %X/%X\n"),
+                  ControlFile.checkPointCopy.redo.xlogid, ControlFile.checkPointCopy.redo.xrecoff);
+       printf(_("Latest checkpoint's UNDO location:    %X/%X\n"),
+                  ControlFile.checkPointCopy.undo.xlogid, ControlFile.checkPointCopy.undo.xrecoff);
+       printf(_("Latest checkpoint's StartUpID:        %u\n"), ControlFile.checkPointCopy.ThisStartUpID);
+       printf(_("Latest checkpoint's NextXID:          %u\n"), ControlFile.checkPointCopy.nextXid);
+       printf(_("Latest checkpoint's NextOID:          %u\n"), ControlFile.checkPointCopy.nextOid);
+       printf(_("Time of latest checkpoint:            %s\n"), ckpttime_str);
+       printf(_("Database block size:                  %u\n"), ControlFile.blcksz);
+       printf(_("Blocks per segment of large relation: %u\n"), ControlFile.relseg_size);
+       printf(_("Maximum length of identifiers:        %u\n"), ControlFile.nameDataLen);
+       printf(_("Maximum number of function arguments: %u\n"), ControlFile.funcMaxArgs);
+       printf(_("Date/time type storage:               %s\n"),
+                  (ControlFile.enableIntTimes ? _("64-bit integers") : _("Floating point")));
+       printf(_("Maximum length of locale name:        %u\n"), ControlFile.localeBuflen);
+       printf(_("LC_COLLATE:                           %s\n"), ControlFile.lc_collate);
+       printf(_("LC_CTYPE:                             %s\n"), ControlFile.lc_ctype);
+
+       return 0;
 }
diff --git a/src/bin/pg_controldata/po/de.po b/src/bin/pg_controldata/po/de.po
new file mode 100644 (file)
index 0000000..10ec2be
--- /dev/null
@@ -0,0 +1,197 @@
+# German message translation file for pg_controldata
+# Peter Eisentraut <peter_e@gmx.net>, 2002.
+#
+# $Header: /cvsroot/pgsql/src/bin/pg_controldata/po/de.po,v 1.1 2002/08/21 22:24:34 petere Exp $
+#
+# Use these quotes: »%s«
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: PostgreSQL 7.3\n"
+"POT-Creation-Date: 2002-08-22 00:15+0200\n"
+"PO-Revision-Date: 2002-08-22 00:14+0200\n"
+"Last-Translator: Peter Eisentraut <peter_e@gmx.net>\n"
+"Language-Team: German <peter_e@gmx.net>\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=ISO-8859-1\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#: pg_controldata.c:29
+#, c-format
+msgid "%s displays PostgreSQL database cluster control information.\n"
+msgstr "%s zeigt Kontrollinformationen über PostgreSQL-Datenbankcluster an.\n"
+
+#: pg_controldata.c:30
+#, c-format
+msgid ""
+"Usage:\n"
+"  %s [DATADIR]\n"
+"\n"
+msgstr ""
+"Benutzung:\n"
+"  %s [DATENVERZEICHNIS]\n"
+"\n"
+
+#: pg_controldata.c:31
+msgid ""
+"If not data directory is specified, the environment variable PGDATA\n"
+"is used.\n"
+"\n"
+msgstr ""
+"Wenn kein Datenverzeichnis angegeben ist, wird die Umgebungsvariable\n"
+"PGDATA verwendent.\n"
+"\n"
+
+#: pg_controldata.c:32
+msgid "Report bugs to <pgsql-bugs@postgresql.org>.\n"
+msgstr "Berichten Sie Fehler an <pgsql-bugs@postgresql.org>.\n"
+
+#: pg_controldata.c:52
+msgid "unrecognized status code"
+msgstr "unerkannter Statuscode"
+
+#: pg_controldata.c:100
+#, c-format
+msgid "%s: no data directory specified\n"
+msgstr "%s: kein Datenverzeichnis angegeben\n"
+
+#: pg_controldata.c:108
+#, c-format
+msgid "%s: could not open file \"%s\" for reading (%s)\n"
+msgstr "%s: konnte Datei »%s« nicht zum Lesen öffnen (%s)\n"
+
+#: pg_controldata.c:115
+#, c-format
+msgid "%s: could not read file \"%s\" (%s)\n"
+msgstr "%s: konnte Datei »%s« nicht zum Lesen öffnen (%s)\n"
+
+#: pg_controldata.c:129
+msgid ""
+"WARNING: Calculated CRC checksum does not match value stored in file.\n"
+"Either the file is corrupt, or it has a different layout than this program\n"
+"is expecting.  The results below are untrustworthy.\n"
+"\n"
+msgstr ""
+"WARNUNG: Berechnete CRC-Checksumme stimmt nicht mit dem Wert in der Datei\n"
+"überein. Entweder ist die Datei kaputt oder sie hat ein anderes Layout\n"
+"als von diesem Program erwartet. Die Ergebnisse unten sind nicht\n"
+"verlässlich.\n"
+"\n"
+
+#: pg_controldata.c:142
+#, c-format
+msgid "pg_control version number:            %u\n"
+msgstr "pg_control-Versionsnummer:            %u\n"
+
+#: pg_controldata.c:143
+#, c-format
+msgid "Catalog version number:               %u\n"
+msgstr "Katalog-Versionsnummer:               %u\n"
+
+#: pg_controldata.c:144
+#, c-format
+msgid "Database cluster state:               %s\n"
+msgstr "Datenbank-Cluster-Status:             %s\n"
+
+#: pg_controldata.c:145
+#, c-format
+msgid "pg_control last modified:             %s\n"
+msgstr "pg_control zuletzt geändert:          %s\n"
+
+#: pg_controldata.c:146
+#, c-format
+msgid "Current log file ID:                  %u\n"
+msgstr "Aktuelle Logdatei-ID:                 %u\n"
+
+#: pg_controldata.c:147
+#, c-format
+msgid "Next log file segment:                %u\n"
+msgstr "Nächstes Logdatei-Segment:            %u\n"
+
+#: pg_controldata.c:148
+#, c-format
+msgid "Latest checkpoint location:           %X/%X\n"
+msgstr "Letzter Checkpoint-Ort:               %X/%X\n"
+
+#: pg_controldata.c:150
+#, c-format
+msgid "Prior checkpoint location:            %X/%X\n"
+msgstr "Voriger Checkpoint-Ort:               %X/%X\n"
+
+#: pg_controldata.c:152
+#, c-format
+msgid "Latest checkpoint's REDO location:    %X/%X\n"
+msgstr "REDO-Ort vom letzten Checkpoint:      %X/%X\n"
+
+#: pg_controldata.c:154
+#, c-format
+msgid "Latest checkpoint's UNDO location:    %X/%X\n"
+msgstr "UNDO-Ort vom letzten Checkpoint:      %X/%X\n"
+
+#: pg_controldata.c:156
+#, c-format
+msgid "Latest checkpoint's StartUpID:        %u\n"
+msgstr "StartUpID vom letzten Checkpoint:     %u\n"
+
+#: pg_controldata.c:157
+#, c-format
+msgid "Latest checkpoint's NextXID:          %u\n"
+msgstr "NextXID vom letzten Checkpoint:       %u\n"
+
+#: pg_controldata.c:158
+#, c-format
+msgid "Latest checkpoint's NextOID:          %u\n"
+msgstr "NextOID vom letzten Checkpoint:       %u\n"
+
+#: pg_controldata.c:159
+#, c-format
+msgid "Time of latest checkpoint:            %s\n"
+msgstr "Zeit vom letzten Checkpoint:          %s\n"
+
+#: pg_controldata.c:160
+#, c-format
+msgid "Database block size:                  %u\n"
+msgstr "Datenbank-Blockgröße:                 %u\n"
+
+#: pg_controldata.c:161
+#, c-format
+msgid "Blocks per segment of large relation: %u\n"
+msgstr "Blöcke pro Segment:                   %u\n"
+
+#: pg_controldata.c:162
+#, c-format
+msgid "Maximum length of identifiers:        %u\n"
+msgstr "Höchstlänge von Namen:                %u\n"
+
+#: pg_controldata.c:163
+#, c-format
+msgid "Maximum number of function arguments: %u\n"
+msgstr "Maximale Funktionsargumente:          %u\n"
+
+#: pg_controldata.c:164
+#, c-format
+msgid "Date/time type storage:               %s\n"
+msgstr "Speicherung von Datum/Zeit-Typen:     %s\n"
+
+#: pg_controldata.c:165
+msgid "64-bit integers"
+msgstr "64-Bit Ganzzahlen"
+
+#: pg_controldata.c:165
+msgid "Floating point"
+msgstr "Fließkommazahlen"
+
+#: pg_controldata.c:166
+#, c-format
+msgid "Maximum length of locale name:        %u\n"
+msgstr "Maximallänge eines Locale-Namens:     %u\n"
+
+#: pg_controldata.c:167
+#, c-format
+msgid "LC_COLLATE:                           %s\n"
+msgstr "LC_COLLATE:                           %s\n"
+
+#: pg_controldata.c:168
+#, c-format
+msgid "LC_CTYPE:                             %s\n"
+msgstr "LC_CTYPE:                             %s\n"