diff options
Diffstat (limited to 'src/bin/pg_encoding')
-rw-r--r-- | src/bin/pg_encoding/Makefile | 51 | ||||
-rw-r--r-- | src/bin/pg_encoding/pg_encoding.c | 89 |
2 files changed, 0 insertions, 140 deletions
diff --git a/src/bin/pg_encoding/Makefile b/src/bin/pg_encoding/Makefile deleted file mode 100644 index 94d3e08c5ae..00000000000 --- a/src/bin/pg_encoding/Makefile +++ /dev/null @@ -1,51 +0,0 @@ -#------------------------------------------------------------------------- -# -# Makefile for src/bin/pg_encoding -# -# Copyright (c) 1998, PostgreSQL Global Development Group -# -# $Header: /cvsroot/pgsql/src/bin/pg_encoding/Attic/Makefile,v 1.14 2001/03/23 05:46:05 ishii Exp $ -# -#------------------------------------------------------------------------- - -subdir = src/bin/pg_encoding -top_builddir = ../../.. -include $(top_builddir)/src/Makefile.global - -OBJS= pg_encoding.o - -all: submake pg_encoding - -ifdef STRTOUL -OBJS+=$(top_builddir)/src/backend/port/strtoul.o - -$(top_builddir)/src/backend/port/strtoul.o: - $(MAKE) -C $(top_builddir)/src/backend/port strtoul.o -endif - -pg_encoding: $(OBJS) - $(CC) $(CFLAGS) $^ $(libpq) $(LDFLAGS) $(LIBS) -o $@ - -.PHONY: submake - -submake: - $(MAKE) -C $(libpq_builddir) all - -install: all installdirs - $(INSTALL_PROGRAM) pg_encoding$(X) $(DESTDIR)$(bindir)/pg_encoding$(X) - -installdirs: - $(mkinstalldirs) $(DESTDIR)$(bindir) - -uninstall: - rm -f $(DESTDIR)$(bindir)/pg_encoding$(X) - -depend dep: - $(CC) -MM $(CFLAGS) *.c >depend - -clean distclean maintainer-clean: - rm -f pg_encoding$(X) pg_encoding.o - -ifeq (depend,$(wildcard depend)) -include depend -endif diff --git a/src/bin/pg_encoding/pg_encoding.c b/src/bin/pg_encoding/pg_encoding.c deleted file mode 100644 index f63a01b90e3..00000000000 --- a/src/bin/pg_encoding/pg_encoding.c +++ /dev/null @@ -1,89 +0,0 @@ -/*------------------------------------------------------------------------- - * - * pg_encoding.c - * - * - * Copyright (c) 1998, PostgreSQL development group - * - * - * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/bin/pg_encoding/Attic/pg_encoding.c,v 1.10 2001/10/25 05:49:53 momjian Exp $ - * - *------------------------------------------------------------------------- - */ -#include "postgres.h" -#include "miscadmin.h" -#include "mb/pg_wchar.h" - -#include <ctype.h> - -static void usage(void); - -int -main(int argc, char **argv) -{ - char *p; - int enc; - bool be_only = FALSE; - - if (argc < 2) - { - usage(); - exit(1); - } - - if (strcmp(argv[1], "-b") == 0) - { - if (argc < 3) - { - usage(); - exit(1); - } - be_only = TRUE; - p = argv[2]; - } - else - p = argv[1]; - - if (p && *p && isdigit((unsigned char) *p)) - { - /* - * Encoding number to name - */ - char *name; - - enc = atoi(p); - - if ((name = (char *) pg_encoding_to_char(enc))) - { - if (be_only && pg_valid_server_encoding(name) < 0) - exit(0); - printf("%s\n", name); - } - exit(0); - } - else if (p && *p) - { - /* - * Encoding name to encoding number - */ - if ((enc = pg_char_to_encoding(p)) >= 0) - { - if (be_only && pg_valid_server_encoding(p) < 0) - exit(0); - printf("%d\n", enc); - } - exit(0); - } - exit(1); -} - -static void -usage() -{ - fprintf(stderr, - "\nUsage: pg_encoding [options] encoding_name | encoding_number\n\n" - "options:" - " -b check if encoding is valid for backend\n\n" - ); -} |