Category : Dbase (Clipper, FoxBase, etc) Languages Source Code
Archive   : NETLIB.ZIP
Filename : BINDCFG.PRG
* bindcfg.prg - Demo the use of the bindery for storing user config
* Glenn Scott 10/92
* -------------------------------------------------------------------
* This is an original work by Glenn Scott and is released to the
* public domain AS IS, with no warranties whatsoever.
*
* The point of this sample is to show you how, using the NetKit, you
* might use the bindery to store a particular user's configuration
* information required by your application.
*
* Given a particular user's name on the command line, bindcfg
* will check to see if the user has a bindery object property
* called "TECHNICON." If so, this property will be displayed
* and you'll be prompted for the new setting. If it isn't,
* it will be created and you'll be prompted for the setting,
* which will just be a character string.
*
* You can see that if you concatenate your config info into a
* string like this, the bindery might make a useful location
* for the configuration information.
*
* Be sure this approach is suitable for your task before using it.
* Although Novell's API surely provides a fairly robust interface to
* the bindery (making it somewhat difficult to corrupt the bindery)
* you will always want to do thorough testing, and always make sure
* you back up your bindery before testing programs that modify
* the bindery this way.
*
* When you're done experimenting, you can delete the TECHNICON
* property from any user you attached it to by typing
*
* BINDCFG
*
* The existence of a second command line parameter will cause a
* delete operation.
*
* I don't mean to scare you, I just want you to see that it can
* be done and that you should know what you're doing. Yes, I
* did run it on my server first.
*
* Compile with /n, and link with the Nanforum Toolkit (NANFOR.LIB)
* and the Nanforum NetKit (FNNET.LIB)
*
* WARNING! As in many code samples, error checking is left as
* an exercise for the reader.
*
*/
#include "ftnet.ch"
#define PROPERTY_NAME "TECHNICON"
/* --------------------------------------------------------------- */
function main( cUser, cDel )
local cCfgInfo, cNew
default cUser to fn_whoami()
qout( "Checking for config property for " + cUser + " in bindery..." )
cCfgInfo := fn_rdprova( cUser, OT_USER, PROPERTY_NAME, .f. )
if cCfgInfo == nil
qout( "It's not there." )
if cDel == nil
qout( "Creating property..." )
if fn_creprop( cUser, OT_USER, PROPERTY_NAME, .f., .f., 2, 2 )
accept "New setting: " to cNew
fn_wrprova( cUser, OT_USER, PROPERTY_NAME, cNew )
if fn_error() # 0
qout( "Error: ", fn_error() )
else
qout( "Property written." )
endif
else
qout( "Error: ", fn_error() )
endif
endif
else
if cDel == nil
qout( "Found. Here it is: " )
qout( "[" + (cCfgInfo) + "]" )
accept "New setting: " to cNew
fn_wrprova( cUser, OT_USER, PROPERTY_NAME, cNew )
if fn_error() # 0
qout( "Error: ", fn_error() )
else
qout( "Property written." )
endif
else
qout( "Deleting property..." )
if fn_delprop( cUser, OT_USER, PROPERTY_NAME )
qout( "Successfully deleted." )
else
qout( "Error: ", fn_error() )
endif
endif
endif
return nil
Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!
This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.
But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/