Main Page | Modules | File List

Example of Full Library Utilization: kdb command


Functions

int commandRemove ()
int commandSet ()
int commandLink ()
int commandList ()
int commandGet ()
int commandEdit ()
int commandImport ()
int commandExport ()
int commandMonitor ()

Function Documentation

int commandEdit  ) 
 

Opens an editor to edit an XML representation of the keys. This is one of the most complex commands of the kdb program. Is will

  1. retrieve the desired keys
  2. put them as inside an editor in an XML format to let the user edit
  3. wait for the editor to finish
  4. reread the edited XML, converting to an internal KeySet
  5. compare original and edited KeySets to detect differences
  6. remove removed keys
  7. update updated keys
  8. add added keys
  9. leave untouched the not changed keys

Example:
 bash$ EDITOR=kedit kdb edit -R user/env # edit with kedit
 bash# kdb edit -R system/sw/MyApp       # defaults to vi editor
See also:
keyCompare()

ksCompare()

kdbGetChildKeys()

ksToStream()

kdbSetKeys()

Parameters:
argKeyName the parent key name (and children) that will be edited
argRecursive whether to act recursivelly or not
argAll whether to edit inactive keys or not
EDITOR environment var that defines editor to use, or vi

Definition at line 1057 of file kdb.c.

References KDB_O_NFOLLOWLINK, KDB_O_SORT, KDB_O_XMLHEADERS, kdbGetChildKeys(), kdbGetKey(), kdbRemove(), kdbSetKeys(), keyClose(), keyGetFullName(), keyInit(), keySetName(), ksAppend(), ksCompare(), ksCurrent(), ksInit(), ksNext(), ksRewind(), and ksToStream().

int commandExport  ) 
 

Business logic behind the 'kdb export' command. Export a set of keys to an XML format. Usefull to make backups or copy keys to other machine or user. Equivalent to 'kdb ls -xRv base/key/name'

Example:
 bash# kdb export system > systemConfigurationBackup.xml
 bash# kdb export system/sw/MyApp > myAppConfiguration.xml
 bash$ kdb export system/sw/MyApp | sed -e 's|system/sw|user/sw|g' | kdb import
See also:
commandList()

commandImport()

Definition at line 1206 of file kdb.c.

References commandList(), kdbClose(), and kdbOpen().

int commandGet  ) 
 

Business logic behind the 'kdb get' command. Get a key and return its value to you.

Example:
 bash$ kdb get user/env/alias/ls
 ls -Fh --color=tty
Parameters:
argKeyName key to get value
argDescriptive show also the key comment (-d)
argShell output suitable for shell scripts (-s)
argLong show also the key name (-l)
argFullName with argLong, show the user domain too (-f)
See also:
kdbGetKey()

kdbGetBaseName()

keyGetComment()

keyGetString()

Definition at line 721 of file kdb.c.

References kdbGetKey(), keyGetBaseName(), keyGetBaseNameSize(), keyGetBinary(), keyGetComment(), keyGetCommentSize(), keyGetDataSize(), keyGetFullName(), keyGetFullNameSize(), keyGetName(), keyGetNameSize(), keyGetString(), keyGetType(), keyInit(), and keySetName().

int commandImport  ) 
 

Business logic behind the 'kdb import' command. Import an XML file (or standard input) into the key database. This is usefull to import full programs keys, or restore backups.

Example:
 bash$ kdb import myAppDefaultKeys.xml
 bash$ generateKeys | kdb import
See also:
kdbSetKeys()

commandExport()

Definition at line 1158 of file kdb.c.

References kdbSetKeys(), keyGetFullName(), ksCurrent(), ksInit(), and ksRewind().

int commandLink  ) 
 

The business logic behind 'kdb ln' command

Example:
 bash$ kdb ln user:valeria/sw/MyApp user/sw/MyApp  # make my personal MyApp configurations be a link to valerias configs
See also:
kdbLink()

keySetType()

Parameters:
argKeyName name of the target key
argData name of the link key to be created

Definition at line 537 of file kdb.c.

References kdbLink().

int commandList  ) 
 

The business logic behind 'kdb ls' command.

Parameters:
argKeyName key name to be listed
argRecursive whether to act recursivelly (-R)
argValue whether to show key values or not (-v)
argAll whether to list also inactive keys (-a)
argXML whether to create XML output (-x)
Example:
 bash$ kdb ls -R   # list all keys from system and user trees
 bash$ kdb ls -Ra  # list them all plus the hidden/inactive keys
 bash$ kdb ls -Rav # list all showing value
 bash# kdb ls -Rxv # equivalent to 'kdb export'
 bash$ kdb ls -Rv user/env # list my aliases and environment vars
See also:
kdbGetRootKeys()

kdbGetChildKeys()

keyToStream()

ksToStream()

commandExport() for the 'kdb export' command

Definition at line 594 of file kdb.c.

References KDB_O_DIR, KDB_O_NFOLLOWLINK, KDB_O_STATONLY, KDB_O_XMLHEADERS, kdbGetChildKeys(), kdbGetKey(), kdbGetRootKeys(), kdbStatKey(), keyClose(), keyGetFullName(), keyInit(), keySetName(), keyToStream(), ksAppend(), ksAppendKeys(), ksClose(), ksInit(), ksNext(), ksRewind(), and ksToStream().

Referenced by commandExport().

int commandMonitor  ) 
 

Business logic behind 'kdb mon' command.

Will block your command line until some change happens to the interested key.

Example:
 bash$ kdb mon system/sw/MyApp/someKey
See also:
kdbMonitorKey()

kdbMonitorKeys()

Definition at line 1244 of file kdb.c.

References kdbGetKey(), kdbMonitorKey(), KEY_FLAG_HASDATA, keyGetDataSize(), keyGetString(), keyInit(), and keySetName().

int commandRemove  ) 
 

The business logic behind 'kdb rm' command

Example:
 bash$ kdb rm user/env/alias/ls   # get rid to the ls alias
See also:
kdbRemove()
Parameters:
argKeyName name of the key that will be removed

Definition at line 400 of file kdb.c.

References kdbRemove().

int commandSet  ) 
 

The business logic behind 'kdb set' command. Sets value to a single key.

Example:
 bash$ kdb set -c "My shell prompt" user/env/env1/PS1 '\h:\w\$'
See also:
kdbSetKey()
Parameters:
argKeyName name of the key that will be set
argComment comment to be set to key (-c)
argType type of the key (-t)
argMode access permissions that will be set to sey (-m)
argUID UID to be set to sey
argGID GID to be set to sey
argData the value to the key
argFile a filename to use as the input for the value

Definition at line 437 of file kdb.c.

References kdbGetKey(), kdbSetKey(), KEY_TYPE_BINARY, KEY_TYPE_DIR, KEY_TYPE_LINK, KEY_TYPE_STRING, keyGetType(), keyInit(), keySetAccess(), keySetBinary(), keySetComment(), keySetGID(), keySetName(), keySetString(), keySetType(), and keySetUID().


Generated on Sun May 8 02:29:55 2005 for Elektra Project by  doxygen 1.3.9.1