On 9/8/12 11:41 AM, Danek Duvall wrote:
Philip Brown wrote:

Because I'm a sharing kinda guy... and I get easily distracted ;-)
I thought I'd share the stupid code I'd written so far.

http://www.bolthole.com/solaris/ipsutil/parseipscatalog.c
I would strongly recommend using an existing JSON parser, rather than
rolling your own.  There are a dozen listed at json.org, though I can't
personally recommend any particular one.

Danek

Why the "strong" recommendation?

yes, its a pain in the butt to write a parser :-} but I dislike adding dependencies on anything unless really neccessary.

Speaking of JSON, though, it claims on the json.org page:

" . It is easy for humans to read and write."


I would amend that to say,
It is easy for humans to read and write, *if you use line breaks*

Which you don't, in the IPS catalog.
Which was rather mean of you.
It would have been a whoooole lot easier to parse
(both by code,and by human)
if you had. But instead, there is a 1 megabyte single-line mess, for a catalog. That breaks all nice simple standard unix tool approaches to look at it directly.
(was this by design?)


I'm also wondering why, if JSON format is so wonderful, there is no
/usr/lib/libjson.so
or some such, in Solaris 11?

But I digress.
The built in "stupidparser(tm)" is good enough for my immediate needs. If I ever get to the point where my experimentation leads me to take advantage of ALL the catalog sections, things may lead to using an external lib.
I pray I never wander so far down that dark alleyway :-D



_______________________________________________
pkg-discuss mailing list
[email protected]
http://mail.opensolaris.org/mailman/listinfo/pkg-discuss

Reply via email to