As much as I endorse and approve of any effort to create a good solution for handling wifi's, I must say I find the use of perl and json unnecessary for such a project. I've been using a "pure ksh" solution named wiconfig since 2013 and which was posted here at @misc back in 2011 or 2012:
http://openbsd-archive.7691.n7.nabble.com/wiconfig-simplifies-the-configuration-of-wireless-interfaces-td89829.html It is available on github: https://github.com/devious/wiconfig/blob/master/wiconfig wiconfig: - Works great with apm/resume, including trunk(4) interfaces. - Has no dependencies. Just pure old fashioned ksh. - Stores (accepted) connections in plain text format. (/etc/wiconfig.db) - Handles quoted nwids. - Does not require writing to /etc/hostname.if-files. Not sure how/if it handles potentially unsafe nwid names, though. Regards. -- Erling Westenvik ,_____, |_|_|_| |_|X|_| |_|_|_| On Fri, Jun 03, 2016 at 11:58:05AM +0800, Ray Lai wrote: > > On Jun 3, 2016, at 2:36 AM, Kamil Cholewiński <harry6...@gmail.com> wrote: > >> On Thu, 02 Jun 2016, Ray Lai <r...@raylai.com> wrote: > >> use JSON::PP; > > > > That's just my personal opinion, but JSON sucks for configuration files. > > It's more of a human-readable data interchange format. > > > > It feels like the same functionality can be achieved with something much > > simpler, getent or CSV style. > > I agree. All I need are hashes and arrays. Any examples would be welcome, I'm > open to changing the file format. But as wifind.conf(5) says, I chose json > because it's included in Perl. I was more concerned with having a > set-it-and-forget-it solution. The config file is a minor detail that can be > changed. > > > >> my $tmp = "/etc/wifind.tmp"; > > > > mkstemp? > > Will fix > > >> Please avoid nwid or wpakey with quotes, dollar signs, or backslashes. > > > > Without knowing or assuming much about how WiFi works, why would this be > > a concern in a well-designed program? > > Currently wifind parses 'ifconfig if scan' output, which, according to my > reading of the code, simply adds "double quotes" around any nwid with white > space when printing. (I've not tested my theory that nwid with " in the name > would cause problem. ) > > Likewise, netstart takes nwid and wpakey, which could include spaces, but as > netstart is a shell script, I have not tested what happens when the values > contain backslashes, dollar signs, or double quotes. Caveat emptor! > > > Thanks for your feedback, I appreciate it! > > Ray