#
#
# IDENTIFICATION
-# $Header: /cvsroot/pgsql/src/bin/initdb/Attic/initdb.sh,v 1.64 1999/12/12 05:57:30 momjian Exp $
+# $Header: /cvsroot/pgsql/src/bin/initdb/Attic/initdb.sh,v 1.65 1999/12/16 20:09:56 momjian Exp $
#
#-------------------------------------------------------------------------
exit 100
fi
;;
+ --help)
+ usage=t
+ ;;
+ -\?)
+ usage=t
+ ;;
*)
- echo "Unrecognized option '$1'. Syntax is:"
- if [ -z "$MULTIBYTE" ];then
- echo "initdb [-t | --template] [-d | --debug]" \
- "[-n | --noclean]" \
- "[-u SUPERUSER | --username=SUPERUSER]" \
- "[-r DATADIR | --pgdata=DATADIR]" \
- "[-l LIBDIR | --pglib=LIBDIR]"
- else
- echo "initdb [-t | --template] [-d | --debug]" \
- "[-n | --noclean]" \
- "[-u SUPERUSER | --username=SUPERUSER]" \
- "[-r DATADIR | --pgdata=DATADIR]" \
- "[-l LIBDIR | --pglib=LIBDIR]" \
- "[-e ENCODING | --pgencoding=ENCODING]"
- fi
- exit 100
+ echo "Unrecognized option '$1'. Try -? for help."
+ exit 100
esac
shift
done
+if [ "$usage" ]; then
+ echo ""
+ echo "Usage: $CMDNAME [options]"
+ echo ""
+ echo " -t, --template "
+ echo " -d, --debug "
+ echo " -n, --noclean "
+ echo " -u SUPERUSER, --username=SUPERUSER "
+ echo " -r DATADIR, --pgdata=DATADIR "
+ echo " -l LIBDIR, --pglib=LIBDIR "
+
+ if [ -n "$MULTIBYTE" ]; then
+ echo " -e ENCODING, --pgencoding=ENCODING"
+ fi
+
+ echo " -?, --help "
+ echo ""
+
+ exit 100
+fi
+
#-------------------------------------------------------------------------
# Make sure he told us where to find the Postgres files.
#-------------------------------------------------------------------------
#
#
# IDENTIFICATION
-# $Header: /cvsroot/pgsql/src/bin/initlocation/Attic/initlocation.sh,v 1.2 1998/10/05 02:51:21 thomas Exp $
+# $Header: /cvsroot/pgsql/src/bin/initlocation/Attic/initlocation.sh,v 1.3 1999/12/16 20:09:57 momjian Exp $
#
#-------------------------------------------------------------------------
--location) shift; PGALTDATA="$1"; ;;
--username) shift; POSTGRES_SUPERUSERNAME="$1"; ;;
+ --help) usage=1; ;;
-u) shift; POSTGRES_SUPERUSERNAME="$1"; ;;
-D) shift; PGALTDATA="$1"; ;;
- -*) badparm=$1; usage=1; ;;
+ -h) usage=t; ;;
+ -\?) usage=t; ;;
+ -*) badparm=$1; ;;
*) PGALTDATA="$1"; ;;
esac
shift
done
if [ -n "$badparm" ]; then
- echo "$CMDNAME: Unrecognized parameter '$badparm'"
+ echo "$CMDNAME: Unrecognized parameter '$badparm'. Try -? for help."
+ exit 1
fi
-if [ -n "$usage" ]; then
- echo "Usage: $CMDNAME [-u SUPERUSER] DATADIR"
+if [ "$usage" ]; then
+ echo ""
+ echo "Usage: $CMDNAME [options] datadir"
+ echo ""
+ echo " -u SUPERUSER, --username=SUPERUSER "
+ echo " -D DATADIR, --location=DATADIR "
+ echo " -?, --help "
+ echo ""
exit 1
fi
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_dump.c,v 1.125 1999/12/11 00:31:05 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_dump.c,v 1.126 1999/12/16 20:09:58 momjian Exp $
*
* Modifications - 6/10/96 - dave@bensoft.com - version 1.13.dhb
*
usage(const char *progname)
{
fprintf(stderr,
- "usage: %s [options] dbname\n", progname);
- fprintf(stderr,
- "\t -a \t\t dump out only the data, no schema\n");
- fprintf(stderr,
- "\t -c \t\t clean(drop) schema prior to create\n");
- fprintf(stderr,
- "\t -d \t\t dump data as proper insert strings\n");
- fprintf(stderr,
- "\t -D \t\t dump data as inserts"
- " with attribute names\n");
- fprintf(stderr,
- "\t -f filename \t\t script output filename\n");
- fprintf(stderr,
- "\t -h hostname \t\t server host name\n");
- fprintf(stderr,
- "\t -n \t\t suppress most quotes around identifiers\n");
- fprintf(stderr,
- "\t -N \t\t enable most quotes around identifiers\n");
- fprintf(stderr,
- "\t -o \t\t dump object id's (oids)\n");
- fprintf(stderr,
- "\t -p port \t\t server port number\n");
- fprintf(stderr,
- "\t -s \t\t dump out only the schema, no data\n");
- fprintf(stderr,
- "\t -t table \t\t dump for this table only\n");
- fprintf(stderr,
- "\t -u \t\t use password authentication\n");
+ "\nUsage: %s [options] dbname\n\n", progname);
+
+#ifdef HAVE_GETOPT_LONG
fprintf(stderr,
- "\t -v \t\t verbose\n");
+
+ " -a, --data-only dump out only the data, no schema\n"
+ " -c, --clean clean(drop) schema prior to create\n"
+ " -d, --insert-proper dump data as proper insert strings\n"
+ " -D, --insert-attr dump data as inserts with attribute names\n"
+ " -f, --out file script output filename\n"
+ " -h, --host hostname server host name\n"
+ " -n, --no-quotes suppress most quotes around identifiers\n"
+ " -N, --quotes enable most quotes around identifiers\n"
+ " -o, --oids dump object id's (oids)\n"
+ " -p, --port port server port number\n"
+ " -s, --schema-only dump out only the schema, no data\n"
+ " -t, --table table dump for this table only\n"
+ " -u, --password use password authentication\n"
+ " -v, --verbose verbose\n"
+ " -x, --no-acl do not dump ACL's (grant/revoke)\n"
+ " -?, --help show this help message\n"
+
+ ); /* fprintf */
+#else
fprintf(stderr,
- "\t -x \t\t do not dump ACL's (grant/revoke)\n");
+
+ " -a dump out only the data, no schema\n"
+ " -c clean(drop) schema prior to create\n"
+ " -d dump data as proper insert strings\n"
+ " -D dump data as inserts with attribute names\n"
+ " -f filename script output filename\n"
+ " -h hostname server host name\n"
+ " -n suppress most quotes around identifiers\n"
+ " -N enable most quotes around identifiers\n"
+ " -o dump object id's (oids)\n"
+ " -p port server port number\n"
+ " -s dump out only the schema, no data\n"
+ " -t table dump for this table only\n"
+ " -u use password authentication\n"
+ " -v verbose\n"
+ " -x do not dump ACL's (grant/revoke)\n"
+ " -? show this help message\n"
+
+ ); /* fprintf */
+#endif
+
fprintf(stderr,
- "\nIf dbname is not supplied, then the DATABASE environment "
- "variable value is used.\n");
- fprintf(stderr, "\n");
+ "\nIf dbname is not supplied, then the DATABASE environment variable value is used.\n\n");
exit(1);
}
char password[100];
bool use_password = false;
+#ifdef HAVE_GETOPT_LONG
+ static struct option long_options[] = {
+ {"data-only", no_argument, NULL, 'a'},
+ {"clean", no_argument, NULL, 'c'},
+ {"insert-proper",no_argument, NULL, 'd'},
+ {"insert-attr", no_argument, NULL, 'D'},
+ {"out", required_argument, NULL, 'f'},
+ {"to-file", required_argument, NULL, 'f'},
+ {"host", required_argument, NULL, 'h'},
+ {"no-quotes", no_argument, NULL, 'n'},
+ {"quotes", no_argument, NULL, 'N'},
+ {"oids", no_argument, NULL, 'o'},
+ {"port", required_argument, NULL, 'p'},
+ {"schema-only", no_argument, NULL, 's'},
+ {"table", required_argument, NULL, 't'},
+ {"password", no_argument, NULL, 'u'},
+ {"verbose", no_argument, NULL, 'v'},
+ {"no-acl", no_argument, NULL, 'x'},
+ {"help", no_argument, NULL, '?'},
+ };
+ int optindex;
+#endif
+
g_verbose = false;
force_quotes = true;
dropSchema = false;
progname = *argv;
- while ((c = getopt(argc, argv, "acdDf:h:nNop:st:uvxz")) != EOF)
+#ifdef HAVE_GETOPT_LONG
+ while ((c = getopt_long(argc, argv, "acdDf:h:nNop:st:uvxz?", long_options, &optindex)) != -1)
+#else
+ while ((c = getopt(argc, argv, "acdDf:h:nNop:st:uvxz?")) != -1)
+#endif
{
switch (c)
{
"%s: The -z option(dump ACLs) is now the default, continuing.\n",
progname);
break;
+ case '?':
default:
usage(progname);
break;
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/bin/pg_encoding/Attic/pg_encoding.c,v 1.4 1999/07/17 20:18:20 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/bin/pg_encoding/Attic/pg_encoding.c,v 1.5 1999/12/16 20:10:00 momjian Exp $
*
*-------------------------------------------------------------------------
*/
static void
usage()
{
- fprintf(stderr, "pg_encoding: encoding_name | encoding_number\n");
+ fprintf(stderr, "\nUsage: pg_encoding encoding_name | encoding_number\n\n");
}
#
#
# IDENTIFICATION
-# $Header: /cvsroot/pgsql/src/bin/scripts/Attic/createdb,v 1.3 1999/12/08 10:29:55 momjian Exp $
+# $Header: /cvsroot/pgsql/src/bin/scripts/Attic/createdb,v 1.4 1999/12/16 20:10:02 momjian Exp $
#
#-------------------------------------------------------------------------
case "$1" in
--help|-\?)
usage=t
- break
;;
# options passed on to psql
--host|-h)
shift
done
-
if [ "$usage" ]; then
- echo "Usage: $CMDNAME [-h server] [-p port] [-D path] \\"
- echo " [-E encoding] [-U username] dbname [description]"
- exit 0
+ echo ""
+ echo "Usage: $CMDNAME [options] dbname [description]"
+ echo ""
+ echo " -h HOSTNAME, --host=HOSTNAME "
+ echo " -p PORT, --port=PORT "
+ echo " -U USERNAME, --username=USERNAME "
+ echo " -W, --password "
+ echo " -e, --echo "
+ echo " -q, --quiet "
+ echo " -D PATH, --location=PATH "
+ echo " -E ENCODING --encoding=ENCODING "
+ echo " -?, --help "
+ echo ""
+ exit 1
fi
#
#
# IDENTIFICATION
-# $Header: /cvsroot/pgsql/src/bin/scripts/Attic/createlang.sh,v 1.2 1999/12/07 22:41:44 momjian Exp $
+# $Header: /cvsroot/pgsql/src/bin/scripts/Attic/createlang.sh,v 1.3 1999/12/16 20:10:02 momjian Exp $
#
#-------------------------------------------------------------------------
case "$1" in
--help|-\?)
usage=t
- break
;;
--list|-l)
list=t
shift
done
-
-
-if [ "$usage" ]; then
- echo "Usage: $CMDNAME [-h server] [-p port] [-U username] [-d dbname] \\"
- echo " [-L|--pglib PGLIB] [langname [dbname]]"
- exit 0
+if [ "$usage" ]; then
+ echo ""
+ echo "Usage: $CMDNAME [options] [langname [dbname]]"
+ echo ""
+ echo " -h HOSTNAME, --host=HOSTNAME "
+ echo " -p PORT, --port=PORT "
+ echo " -U USERNAME, --username=USERNAME "
+ echo " -W, --password "
+ echo " -d DBNAME, --database=DBNAME "
+ echo " -e, --echo "
+ echo " -q, --quiet "
+ echo " -D PATH, --location=PATH "
+ echo " -L PGLIB --pglib=PGLIB "
+ echo " -?, --help "
+ echo ""
+ exit 1
fi
if [ "$list" ]; then
#
#
# IDENTIFICATION
-# $Header: /cvsroot/pgsql/src/bin/scripts/Attic/createuser,v 1.3 1999/12/07 22:41:44 momjian Exp $
+# $Header: /cvsroot/pgsql/src/bin/scripts/Attic/createuser,v 1.4 1999/12/16 20:10:02 momjian Exp $
#
# Note - this should NOT be setuid.
#
case "$1" in
--help|-\?)
usage=t
- break
;;
# options passed on to psql
--host|-h)
shift;
done
-
-# Help
-
-if [ "$usage" ]; then
- echo "Usage: $CMDNAME [-h server] [-p port] [-d|-D] [-a|-A] [-P] [-i id] [username]"
- exit 0
+if [ "$usage" ]; then
+ echo ""
+ echo "Usage: $CMDNAME [options] [username]"
+ echo ""
+ echo " -h HOSTNAME, --host=HOSTNAME "
+ echo " -p PORT, --port=PORT "
+ echo " -d, --createdb "
+ echo " -D, --no-createdb "
+ echo " -a, --adduser "
+ echo " -A, --no-adduser "
+ echo " -i SYSID, --sysid=SYSID "
+ echo " -P, --pwprompt "
+ echo " -U USERNAME, --username=USERNAME (for connect to db)"
+ echo " -W, --password (for connect to db)"
+ echo " -e, --echo "
+ echo " -q, --quiet "
+ echo " -?, --help "
+ echo ""
+ exit 1
fi
-
if [ "$SysID" ]; then
if [ "$SysID" != "`echo $SysID | sed 's/[^0-9]//g'`" ]; then
echo "$CMDNAME: User sysid must be a positive number."
#
#
# IDENTIFICATION
-# $Header: /cvsroot/pgsql/src/bin/scripts/Attic/dropdb,v 1.3 1999/12/07 22:41:44 momjian Exp $
+# $Header: /cvsroot/pgsql/src/bin/scripts/Attic/dropdb,v 1.4 1999/12/16 20:10:02 momjian Exp $
#
#-------------------------------------------------------------------------
if [ "$usage" ]; then
- echo "Usage: $CMDNAME [-h server] [-p port] [-U username] [-i] dbname"
- exit 0
+ echo ""
+ echo "Usage: $CMDNAME [options] dbname"
+ echo ""
+ echo " -h HOSTNAME, --host=HOSTNAME "
+ echo " -p PORT, --port=PORT "
+ echo " -u USERNAME, --username=USERNAME "
+ echo " -W, --password "
+ echo " -e, --echo "
+ echo " -q, --quiet "
+ echo " -i, --interactive "
+ echo " -?, --help "
+ echo ""
+ exit 1
fi
if [ -z "$dbname" ]; then
#
#
# IDENTIFICATION
-# $Header: /cvsroot/pgsql/src/bin/scripts/Attic/droplang,v 1.3 1999/12/07 22:41:44 momjian Exp $
+# $Header: /cvsroot/pgsql/src/bin/scripts/Attic/droplang,v 1.4 1999/12/16 20:10:02 momjian Exp $
#
#-------------------------------------------------------------------------
case "$1" in
--help|-\?)
usage=t
- break
;;
--list|-l)
list=t
if [ "$usage" ]; then
- echo "Usage: $CMDNAME [-h server] [-p port] [-U username] [-d dbname] [langname [dbname]]"
- exit 0
+ echo ""
+ echo "Usage: $CMDNAME [options] [language [dbname]]"
+ echo ""
+ echo " -h HOSTNAME, --host=HOSTNAME "
+ echo " -p PORT, --port=PORT "
+ echo " -u USERNAME, --username=USERNAME "
+ echo " -W, --password "
+ echo " -d DBNAME --database=DBNAME "
+ echo " -e, --echo "
+ echo " -q, --quiet "
+ echo " -?, --help "
+ echo ""
+ exit 1
fi
+
if [ "$list" ]; then
psql $PSQLOPT -d "$dbname" -c "SELECT lanname, lanpltrusted, lancompiler FROM pg_language WHERE lanispl = 't'"
exit $?
#
#
# IDENTIFICATION
-# $Header: /cvsroot/pgsql/src/bin/scripts/Attic/dropuser,v 1.3 1999/12/07 22:41:44 momjian Exp $
+# $Header: /cvsroot/pgsql/src/bin/scripts/Attic/dropuser,v 1.4 1999/12/16 20:10:02 momjian Exp $
#
# Note - this should NOT be setuid.
#
case "$1" in
--help|-\?)
usage=t
- break
;;
# options passed on to psql
--host|-h)
done
-# Help
-
if [ "$usage" ]; then
- echo "Usage: $CMDNAME [-h server] [-p port] [-i] [username]"
- exit 0
+ echo ""
+ echo "Usage: $CMDNAME [options] [username]"
+ echo ""
+ echo " -h HOSTNAME, --host=HOSTNAME "
+ echo " -p PORT, --port=PORT "
+ echo " -u USERNAME, --username=USERNAME (for connect to db)"
+ echo " -W, --password "
+ echo " -e, --echo "
+ echo " -q, --quiet "
+ echo " -i, --interactive "
+ echo " -?, --help "
+ echo ""
+ exit 1
fi
# Prompt for username if missing
#
#
# IDENTIFICATION
-# $Header: /cvsroot/pgsql/src/bin/scripts/Attic/vacuumdb,v 1.3 1999/12/07 22:41:44 momjian Exp $
+# $Header: /cvsroot/pgsql/src/bin/scripts/Attic/vacuumdb,v 1.4 1999/12/16 20:10:02 momjian Exp $
#
#-------------------------------------------------------------------------
case "$1" in
--help|-\?)
usage=t
- break
;;
# options passed on to psql
--host|-h)
shift
done
-
-if [ "$usage" ]; then
- echo "Usage: $CMDNAME [-h server] [-p port] [-U username] [-d dbname] \\"
- echo " [-z|--analyze] [-v|--verbose] [-t|--table 'table[(columns)]'] [dbname]"
- exit 0
+if [ "$usage" ]; then
+ echo ""
+ echo "Usage: $CMDNAME [options] [dbname]"
+ echo ""
+ echo " -h HOSTNAME, --host=HOSTNAME "
+ echo " -p PORT, --port=PORT "
+ echo " -u USERNAME, --username=USERNAME "
+ echo " -W, --password "
+ echo " -d DBNAME, --database=DBNAME "
+ echo " -z, --analyze "
+ echo " -t TABLE[(columns)], --table=TABLE[(columns)]"
+ echo " -v, --verbose "
+ echo " -e, --echo "
+ echo " -q, --quiet "
+ echo " -?, --help "
+ echo ""
+ exit 1
fi
if [ -z "$dbname" ]; then