D&C GLug - Home Page

[ Date Index ] [ Thread Index ] [ <= Previous by date / thread ] [ Next by date / thread => ]

[LUG] Parsing INI files

 

Anyone got/know of any shell/scriptable code for working with Windows- style .ini files, with section headers like:

[Section]

Each followed by an arbitrary number of lines of the form:

key=value

For some reason Mint LXDE PPC (one of the Debian-based Mint respins, not a Ubuntu-based one) uses one of these unrighteous things at

/var/run/ConsoleKit/database

I'd rather not reinvent this wheel. Lots of lower-level stuff out there as libraries for calling from languages I don't use day-to-day, each with no ready-to-go stdin/stdout interface; it will be quicker for me to roll my own solution than tool up and build using those.

BTW, what I'm trying to do is detect who (if anyone) is the active user, defined as not just logged in but "owning" the display and keyboard for the time being, so if you've got a smarter way of doing this, please tell me. (Obviously, this is a multi-user system we're talking about). This information is definitely accessible in the file mentioned above, but if there's a better way of getting it, I'm all ears.

--
Phil Hudson                  http://hudson-it.no-ip.biz
@UWascalWabbit                 PGP/GnuPG ID: 0x887DCA63


--
The Mailing List for the Devon & Cornwall LUG
http://mailman.dclug.org.uk/listinfo/list
FAQ: http://www.dcglug.org.uk/listfaq