summaryrefslogtreecommitdiff
path: root/src/bin/pg_version/pg_version.c
blob: 91d1609531a54463739b92abf164e6874e92602f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
/*-------------------------------------------------------------------------
 *
 * pg_version.c
 *
 *
 * Portions Copyright (c) 1996-2000, PostgreSQL, Inc
 * Portions Copyright (c) 1994, Regents of the University of California
 *
 *
 * IDENTIFICATION
 *	  $Header: /cvsroot/pgsql/src/bin/pg_version/Attic/pg_version.c,v 1.12 2000/01/26 05:57:40 momjian Exp $
 *
 *-------------------------------------------------------------------------
 */
#include <stdlib.h>
#include <stdio.h>

#include "version.h"			/* interface to SetPgVersion */



int
main(int argc, char **argv)
{
	int			retcode;		/* our eventual return code */
	char	   *reason;			/* Reason that SetPgVersion failed, NULL
								 * if it didn't. */

	if (argc < 2)
	{
		fprintf(stderr, "pg_version: missing argument\n");
		exit(1);
	}
	SetPgVersion(argv[1], &reason);
	if (reason)
	{
		fprintf(stderr,
				"pg_version is unable to create the PG_VERSION file. "
				"SetPgVersion gave this reason: %s\n",
				reason);
		retcode = 10;
	}
	else
		retcode = 0;
	return retcode;
}