Menu

#204 inifile : allow keys with no assignment

open
inifile (1)
5
2007-10-11
2007-10-11
John Vella
No

First off, the "Category" list is missing "inifile".

I'm attaching a patch to allow section keys that have no assigned value, not even an empty value which is done by doing "key=". This will allow a call to the ::get function to successfully return key "C" in the following example section:

[dummy]
A=first
B=
C

A simple example of where this enhancement comes into play is if you wanted to use a section to hold a simple list of names, for example a list of valid file suffixes:

[suffix_list]
.txt
.tcl
.cxx

The ::value function was modified to return the default value for keys that exist but have no assignment. This allows distinguishing the case where a key exists and is assigned an empty value versus a key that has no assignment.

I've updated the test to cover this new capability.

The patch was made against version 1.13 of ini.tcl and includes the following file updates:

ini.tcl
inifile.test
pkgIndex.tcl
test.ini

Discussion

  • John Vella

    John Vella - 2007-10-11

    patched code and test

     
  • Andreas Kupries

    Andreas Kupries - 2007-10-11

    Logged In: YES
    user_id=75003
    Originator: NO

    Reassigned to author of inifile package.

     
  • Andreas Kupries

    Andreas Kupries - 2007-10-11
    • assigned_to: andreas_kupries --> afaupell
     
  • Andreas Kupries

    Andreas Kupries - 2007-10-11
    • labels: 705571 --> inifile
     
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.