mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Dec 2009
Posts: 2
K
Kylar Offline OP
Bowl of petunias
OP Offline
Bowl of petunias
K
Joined: Dec 2009
Posts: 2
Hey,

When you pass item names with multiple words to $readini, the extra words are appended to the result:
Code:
//echo -a $readini(file, n, section, item)
value

//echo -a $readini(file, n, section, item extra stuff)
value extra stuff

The expected behaviour is to use "item" as the item name and not append " extra stuff" to the result.

I'm using version 7.14.


Thanks.

Joined: Dec 2002
Posts: 2,962
S
Hoopy frood
Offline
Hoopy frood
S
Joined: Dec 2002
Posts: 2,962
The current behaviour could well be considered a bug, I'm not sure I agree with your 'expected' behaviour though. I would expect it to return $null as there is no item "item extra stuff".


Spelling mistakes, grammatical errors, and stupid comments are intentional.
Joined: Oct 2003
Posts: 3,918
A
Hoopy frood
Offline
Hoopy frood
A
Joined: Oct 2003
Posts: 3,918
What starbucks_mafia said is more accurate. If you use "item extra sutff" as your item name, mIRC should search for the item named "item extra stuff" and return $null, not search for "item".

The lack of support for spaces in item names is an implementation limitation, not a design limitation. It is theoretically possible for an item name to contain spaces with proper escaping or quoting, it's just not implemented currently. Since there is no standard for ini files, there's no reason why mIRC can't extend support for item names with spaces in a future version. This functionality should be therefore reserved for future use, which means relying on searching just the first word would/could break things in an update.


- argv[0] on EFnet #mIRC
- "Life is a pointer to an integer without a cast"
Joined: Dec 2009
Posts: 2
K
Kylar Offline OP
Bowl of petunias
OP Offline
Bowl of petunias
K
Joined: Dec 2009
Posts: 2
Right. Using "item extra stuff" as the item name makes much more sense, even if /writeini doesn't support item names with spaces yet.

Joined: Nov 2003
Posts: 50
X
x64 Offline
Babel fish
Offline
Babel fish
X
Joined: Nov 2003
Posts: 50
This is obviously a holdover from when $read and $readini didn't use parenthesis, which made it impossible for the item name to have spaces. For example:

set %blah $readini file.ini group item more things on this line

I'm willing to bet the original code for this function just appends the rest of the line to the output as it used to.


Link Copied to Clipboard