PostgreSQL Source Code: src/bin/pg_test_timing/pg_test_timing.c File Reference (original) (raw)

44{

45 static struct option long_options[] = {

47 {NULL, 0, NULL, 0}

48 };

49

50 int option;

51 int optindex = 0;

52 unsigned long optval;

53 char *endptr;

54

55 if (argc > 1)

56 {

57 if (strcmp(argv[1], "--help") == 0 || strcmp(argv[1], "-?") == 0)

58 {

60 exit(0);

61 }

62 if (strcmp(argv[1], "--version") == 0 || strcmp(argv[1], "-V") == 0)

63 {

64 puts("pg_test_timing (PostgreSQL) " PG_VERSION);

65 exit(0);

66 }

67 }

68

70 long_options, &optindex)) != -1)

71 {

73 {

74 case 'd':

75 errno = 0;

76 optval = strtoul(optarg, &endptr, 10);

77

78 if (endptr == optarg || *endptr != '\0' ||

79 errno != 0 || optval != (unsigned int) optval)

80 {

81 fprintf(stderr, _("%s: invalid argument for option %s\n"),

83 fprintf(stderr, _("Try \"%s --help\" for more information.\n"), progname);

84 exit(1);

85 }

86

89 {

90 fprintf(stderr, _("%s: %s must be in range %u..%u\n"),

91 progname, "--duration", 1, UINT_MAX);

92 exit(1);

93 }

94 break;

95

96 default:

97 fprintf(stderr, _("Try \"%s --help\" for more information.\n"),

99 exit(1);

100 break;

101 }

102 }

103

105 {

107 _("%s: too many command-line arguments (first is \"%s\")\n"),

109 fprintf(stderr, _("Try \"%s --help\" for more information.\n"),

111 exit(1);

112 }

113

114

115 printf(ngettext("Testing timing overhead for %u second.\n",

116 "Testing timing overhead for %u seconds.\n",

119}

#define ngettext(s, p, n)

#define fprintf(file, fmt, msg)

int getopt_long(int argc, char *const argv[], const char *optstring, const struct option *longopts, int *longindex)

#define required_argument

PGDLLIMPORT char * optarg

static const char * progname

static unsigned int test_duration