Date: Sat, 23 Aug 2025 14:51:44 +0300 From: Sulev-Madis Silber <freebsd-hackers-freebsd-org952@ketas.si.pri.ee> To: freebsd-hackers@freebsd.org Subject: Re: My experiences with Rust Message-ID: <FC047867-713A-42C7-AF5D-2DD8645096EF@ketas.si.pri.ee> In-Reply-To: <20250822214215.2b6d98ac@nuclight.lan> References: <aKiWZ1I3pqZSOsfk@kib.kiev.ua> <20250822214215.2b6d98ac@nuclight.lan>
index | next in thread | previous in thread | raw e-mail
On August 22, 2025 9:42:15 PM GMT+03:00, Vadim Goncharov <vadimnuclight@gmail.com> wrote:
>On Fri, 22 Aug 2025 19:10:15 +0300
>Konstantin Belousov <kostikbel@gmail.com> wrote:
>
>> For ktcplist, the more natural action would be to extend netstat(8)
>> then to write a new tool, but I cannot make myself to use libxo. It
>> is less painful to write Rust then to try to use libxo, at least for
>> me.
>
>What's the problem with libxo?
>
the problem with libxo is that it makes this:
bin/df/df.c
xo_emit("{T:/%-*s}", mwp->mntfrom, "Filesystem");
if (Tflag)
xo_emit(" {T:/%-*s}", mwp->fstype, "Type");
xo_emit(" {T:/%*s} {T:/%*s} {T:/%*s} {T:Capacity}",
mwp->total, header,
mwp->used, "Used", mwp->avail, "Avail");
if (iflag) {
mwp->iused = imax(hflag ? 0 : mwp->iused,
(int)strlen(" iused"));
mwp->ifree = imax(hflag ? 0 : mwp->ifree,
(int)strlen("ifree"));
xo_emit(" {T:/%*s} {T:/%*s} {T:\%iused}",
mwp->iused - 2, "iused", mwp->ifree, "ifree");
}
xo_emit(" {T:Mounted on}\n");
if you have feeling that this is written by disgruntled employee or perhaps even satan himself to annoy others then you're right
it also makes all your utils need to have --libxo or similar option
it's easy to make mistakes with this crazy formatting. i recall spotting one and reporting
on good side it does indeed allow machine readable and other outputs. currently it was iirc still text/json/xml/html. all that hassle for little good
of course, what's alternative? write lib for that? maybe libsys?
this has been discussed within "Massive libxo-zation that breaks everything" (which i created because i was pissed about using utils converted to it) and possibly earlier or later too, god knows in which lists, irc channels, forums or what not
i think he meant that if he found xo bad
help
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?FC047867-713A-42C7-AF5D-2DD8645096EF>
