Date: Thu, 8 May 2025 10:32:17 -0400 From: Phil Shafer <phil@juniper.net> To: Warner Losh <imp@freebsd.org> Cc: <src-committers@freebsd.org>, <dev-commits-src-all@freebsd.org>, <dev-commits-src-main@freebsd.org> Subject: Re: git: c759aca606ce - main - devinfo: Add support for libxo Message-ID: <0F9E0431-84E0-46E2-B28F-99F5A7DB70C5@juniper.net> In-Reply-To: <202505062202.546M2O1b042545@gitrepo.freebsd.org> References: <202505062202.546M2O1b042545@gitrepo.freebsd.org>
next in thread | previous in thread | raw e-mail | index | archive | help
On 6 May 2025, at 18:02, Warner Losh wrote: > xo_emit(" <{d:%s}>", dev->dd_desc); Missing the field name and the "/". With "--libxo:W", you should see "foo: invalid XML tag name: '%s'". Annoying, 'xolint' does not catch this. + xo_emit(" <{d:%s}>", dev->dd_desc); + xo_emit("{e:description/%s}", dev->dd_desc); I'm not sure why you need both lines here, given that: xo_emit("<{:description/%s}>", dev->dd_desc); should suffice, since the "encoding" styles will not emit the surrounding text: % cat /tmp/foo.c #include <libxo/xo.h> int main (int argc, char **argv) { xo_parse_args(argc, argv); xo_open_container("data"); xo_emit(" <{:description/%s}>\n", argv[0]); xo_close_container(NULL); xo_finish(); return 0; } % /tmp/foo </tmp/foo> % /tmp/foo --libxo:XPW <data> <description>/tmp/foo</description> </data> % /tmp/foo --libxo:JPW { "data": { "description": "/tmp/foo" } } % The same issue ("{d:%s}") is repeated in print_rman, etc. + if (xo_finish() < 0) { + exit(1); } return(0); Should I make a more convenient form, so one can just: return xo_finish_rc(); /* xo_finish_exit_code()? */ Thanks, Phil
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?0F9E0431-84E0-46E2-B28F-99F5A7DB70C5>