' This program demonstrates the mib function
' This function may be used to access variables
' from the Sarian's internal MIB.
' Use the command "at\mibs" to see what the variable names are.
'
' For example mib("gprs") will return the string
'    gprs.0.stats.signal = 0
'    gprs.0.stats.registered = 0
'    gprs.0.stats.attached = 0
'
' This example shows how you might split up
' the resultant string into program variables
'
' Try: bas mibtest.bas ppp.1.cfg
' NOTE: the result string is currently limited to 2000 characters
' If the result string is longer the call to the mib function
' will generate an error: "The provided buffer is too short"


const nl = "\r\n"
on error goto ErrorLabel

a = mib(command())

' print  "result = ", a, nl

splita a by "\r\n" to mibarr

print "lbound = ", lbound(mibarr), nl
print "ubound = ", ubound(mibarr), nl

for i = lbound(mibarr) to ubound(mibarr)
	split mibarr[i] by "=" to v_name, v_value
	print "result ", i, ": name = ", v_name, ", value = ", v_value, nl
next i

print "Done\r\n"
stop

ErrorLabel:
print "An Error occured: ", error$, "\r\n"
