Mumpster
http://mumpster.org/

MUMPS routine for reading INI files
http://mumpster.org/viewtopic.php?f=16&t=1734
Page 1 of 1

Author:  jollis [ Wed Feb 20, 2013 10:22 pm ]
Post subject:  MUMPS routine for reading INI files

Here's a MUMPS routine for reading INI files in the following format:

[Section]
key1=value1
key2=value2

Code:
KBBMINI ;CLD/JOLLIS-INI FILE TOOLS ;8:58 PM 2-20-2013
 ;;0.1;CLIME;****;Feb. 20, 2013

STRGET(FILE,SECTION,KEY)
 N LINE,SECMAT,INSEC,RETVAL S SECMAT="["_SECTION_"]"
 S INSEC=0 S RETVAL=""
 O FILE:(READONLY)
 F  K LINE U FILE R LINE Q:$ZEOF  D
 .I LINE[SECMAT S INSEC=1
 .I INSEC=1 D
 ..S TMPKEY=$P(LINE,"=",1)
 ..I TMPKEY=KEY S RETVAL=$P(LINE,"=",2)
 C FILE
 U $P
 Q RETVAL


FILE must contain the full path to the INI file.

Page 1 of 1 All times are UTC - 8 hours [ DST ]
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/