#include <xdot/xdot.h>
#include <cgraph/agxbuf.h>
#include <cgraph/exit.h>
+#include <cgraph/startswith.h>
#include <cgraph/strcasecmp.h>
#include <stdbool.h>
#include <stddef.h>
nfiles = 0;
agxbinit(&xb, SMALLBUF, buf);
for (i = 1; i < argc; i++) {
- if (argv[i] && argv[i][0] == '-') {
+ if (argv[i] &&
+ (startswith(argv[i], "-V") || strcmp(argv[i], "--version") == 0)) {
+ fprintf(stderr, "%s - %s version %s (%s)\n",
+ gvc->common.cmdname, gvc->common.info[0],
+ gvc->common.info[1], gvc->common.info[2]);
+ if (GvExitOnUsage) graphviz_exit(0);
+ return 1;
+ } else if (argv[i] && argv[i][0] == '-') {
rest = &argv[i][2];
switch (c = argv[i][1]) {
case 'G':
case 'P':
P_graph = gvplugin_graph(gvc);
break;
- case 'V':
- fprintf(stderr, "%s - %s version %s (%s)\n",
- gvc->common.cmdname, gvc->common.info[0],
- gvc->common.info[1], gvc->common.info[2]);
- if (GvExitOnUsage) graphviz_exit(0);
- return (1);
- break;
case 'l':
val = getFlagOpt(argc, argv, &i);
if (!val) {
assert "line 3:" in stderr, \
"GVPR did not identify correct line of syntax error"
-@pytest.mark.parametrize("long,short", (("--help", "-?"),
+@pytest.mark.parametrize("long,short", (pytest.param("--help", "-?",
+ marks=pytest.mark.xfail(strict=True)),
("--version", "-V")))
-@pytest.mark.xfail(strict=True)
def test_1618(long: str, short: str):
"""
Graphviz should understand `--help` and `--version`