Functions | |
int | parseCommandLine (int argc, char *argv[]) |
void | listAccess (Key *key, char *readable) |
void | listTime (time_t when, char *readable) |
void | listSingleKey (Key *key) |
void | listAllKeys (KeySet *ks) |
void | listAllKeysForShell (KeySet *ks) |
int | commandRemove (KDBHandle handle) |
The business logic behind 'kdb rm' command. | |
int | commandMove (KDBHandle handle) |
The business logic behind 'kdb mv' command. | |
int | commandSet (KDBHandle handle) |
The business logic behind 'kdb set' command. | |
int | commandLink (KDBHandle handle) |
The business logic behind 'kdb ln' command. | |
int | commandList (KDBHandle handle) |
The business logic behind 'kdb ls' command. | |
int | commandGet (KDBHandle handle) |
Business logic behind the 'kdb get' command. | |
int | commandEdit (KDBHandle handle) |
Opens an editor to edit an XML representation of the keys. | |
int | commandInfo (KDBHandle handle) |
Business logic behind the 'kdb info' command. | |
int | commandImport (KDBHandle handle) |
Business logic behind the 'kdb import' command. | |
int | commandExport (KDBHandle *handle) |
Business logic behind the 'kdb export' command. | |
int | commandMonitor (KDBHandle handle) |
Business logic behind 'kdb mon' command. | |
int | loadToolsLib (void) |
int | doCommand (int command, KDBHandle *handle) |
int | main (int argc, char **argv) |
Variables | |
char * | argComment = 0 |
char * | argFile = 0 |
char * | argData = 0 |
char * | argKeyName = 0 |
char * | argDomain = 0 |
uid_t * | argUID = 0 |
uid_t * | argGID = 0 |
int | argCommand = 0 |
int | argRecursive = 0 |
int | argLong = 0 |
int | argValue = 0 |
int | argAll = 0 |
int | argSort = 1 |
int | argDescriptive = 0 |
int | argFullName = 0 |
int | argShow = 1 |
int | argShell = 0 |
int | argXML = 0 |
int | argDir = 0 |
int | argHelp = 0 |
mode_t | argMode = 0 |
int | argType = KEY_TYPE_UNDEFINED |
int parseCommandLine | ( | int | argc, | |
char * | argv[] | |||
) |
Use KDB_ROOT as prefix in key name
Definition at line 120 of file kdb/kdb.c.
References argAll, argCommand, argComment, argData, argDescriptive, argDir, argFile, argFullName, argGID, argHelp, argKeyName, argLong, argMode, argRecursive, argShell, argShow, argSort, argType, argUID, argValue, argXML, KDB_O_RECURSIVE, KEY_TYPE_BINARY, KEY_TYPE_LINK, KEY_TYPE_STRING, KEY_TYPE_UNDEFINED, and strblen().
Referenced by main().
int commandRemove | ( | KDBHandle | handle | ) |
The business logic behind 'kdb rm' command.
bash$ kdb rm user/env/alias/ls # get rid to the ls alias
argKeyName | name of the key that will be removed |
Definition at line 565 of file kdb/kdb.c.
References argKeyName, kdbPrintError(), and kdbRemove().
Referenced by doCommand().
int commandMove | ( | KDBHandle | handle | ) |
The business logic behind 'kdb mv' command.
The central method used is kdbRename() but this function is way more robust, and is an example on how to handle errors.
bash# kdb mv user/env user:tatiana/env
argKeyName | name of the source key | |
argData | name of the target key |
Definition at line 596 of file kdb/kdb.c.
References argData, argKeyName, kdbPrintError(), kdbRename(), KEY_SWITCH_END, keyDel(), keyGetNameSize(), and keyNew().
Referenced by doCommand().
int commandSet | ( | KDBHandle | handle | ) |
The business logic behind 'kdb set' command.
Sets value to a single key.
bash$ kdb set -c "My shell prompt" user/env/env1/PS1 '\h:\w\$'
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 659 of file kdb/kdb.c.
References argComment, argData, argDir, argFile, argGID, argKeyName, argMode, argType, argUID, KDB_RET_NOTFOUND, kdbGetKey(), kdbPrintError(), kdbSetKey(), KEY_SWITCH_END, KEY_TYPE_BINARY, KEY_TYPE_LINK, KEY_TYPE_STRING, KEY_TYPE_UNDEFINED, keyDel(), keyGetType(), keyNew(), keySetAccess(), keySetComment(), keySetDir(), keySetGID(), keySetLink(), keySetRaw(), keySetString(), keySetType(), keySetUID(), and strblen().
Referenced by doCommand().
int commandLink | ( | KDBHandle | handle | ) |
The business logic behind 'kdb ln' command.
bash$ kdb ln user:valeria/sw/MyApp user/sw/MyApp # make my personal MyApp configurations be a link to valerias configs
argKeyName | name of the target key | |
argData | name of the link key to be created |
Definition at line 783 of file kdb/kdb.c.
References argData, argKeyName, kdbLink(), and kdbPrintError().
Referenced by doCommand().
int commandList | ( | KDBHandle | handle | ) |
The business logic behind 'kdb ls' command.
argKeyName | key name to be listed | |
argRecursive | whether to act recursively (-R) | |
argValue | whether to show key values or not (-v) | |
argAll | whether to list also inactive keys (-a) | |
argShell | operate in a shell script friendly mode (-s) | |
argXML | whether to create XML output (-x) |
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
commandExport() for the 'kdb export' command
Definition at line 838 of file kdb/kdb.c.
References argAll, argFullName, argKeyName, argRecursive, argShell, argShow, argSort, argValue, argXML, KDB_O_DIR, KDB_O_FULLNAME, KDB_O_FULLUGID, KDB_O_HIER, KDB_O_INACTIVE, KDB_O_NFOLLOWLINK, KDB_O_RECURSIVE, KDB_O_SORT, KDB_O_STATONLY, KDB_O_XMLHEADERS, kdbGetChildKeys(), kdbGetKey(), kdbGetKeyChildKeys(), kdbGetRootKeys(), kdbPrintError(), kdbStatKey(), KEY_SWITCH_END, keyDel(), keyNew(), ksAppend(), ksAppendKeys(), ksDel(), ksNew(), ksPop(), ksToStream(), listAllKeys(), and listAllKeysForShell().
Referenced by commandExport(), and doCommand().
int commandGet | ( | KDBHandle | handle | ) |
Business logic behind the 'kdb get' command.
Get a key and return its value to you.
bash$ kdb get user/env/alias/ls
ls -Fh --color=tty
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) |
Definition at line 984 of file kdb/kdb.c.
References argDescriptive, argFullName, argKeyName, argLong, argShell, kdbGetKey(), kdbPrintError(), KEY_SWITCH_END, keyDel(), keyGetBaseName(), keyGetBaseNameSize(), keyGetBinary(), keyGetComment(), keyGetCommentSize(), keyGetFullName(), keyGetFullNameSize(), keyGetName(), keyGetNameSize(), keyGetString(), keyGetType(), keyGetValueSize(), keyIsBin(), keyNew(), and keySetName().
Referenced by doCommand().
int commandEdit | ( | KDBHandle | handle | ) |
Opens an editor to edit an XML representation of the keys.
This is one of the most complex commands of the kdb program. It will
bash$ EDITOR=kedit kdb edit -R user/env # edit with kedit bash# kdb edit -R system/sw/MyApp # defaults to vi editor
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 1113 of file kdb/kdb.c.
References argAll, argKeyName, argRecursive, KDB_O_FULLNAME, KDB_O_FULLUGID, KDB_O_HIER, KDB_O_INACTIVE, KDB_O_NFOLLOWLINK, KDB_O_RECURSIVE, KDB_O_SORT, KDB_O_XMLHEADERS, kdbGetChildKeys(), kdbGetKey(), kdbPrintError(), kdbRemove(), kdbSetKeys(), KEY_SWITCH_END, keyDel(), keyGetFullName(), keyNew(), ksAppend(), ksCompare(), ksCurrent(), ksDel(), ksFromXMLfile(), ksGetSize(), ksNew(), ksNext(), ksRewind(), and ksToStream().
Referenced by doCommand().
int commandInfo | ( | KDBHandle | handle | ) |
Business logic behind the 'kdb info' command.
Displays some information about the Elektra library, version, backend, etc.
bash$ kdb info
Definition at line 1244 of file kdb/kdb.c.
References kdbGetInfo(), and kdbInfoToString().
Referenced by doCommand().
int commandImport | ( | KDBHandle | handle | ) |
Business logic behind the 'kdb import' command.
Import an XML file (or standard input) into the key database. This is usefull to import full application's keys, or restore backups.
bash$ kdb import myAppDefaultKeys.xml bash$ generateKeys | kdb import
Definition at line 1270 of file kdb/kdb.c.
References argKeyName, kdbPrintError(), kdbSetKeys(), keyGetFullName(), ksCurrent(), ksDel(), ksFromXML(), ksFromXMLfile(), ksNew(), ksNext(), and ksRewind().
Referenced by doCommand().
int commandExport | ( | KDBHandle * | handle | ) |
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'
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
Definition at line 1325 of file kdb/kdb.c.
References argAll, argRecursive, argShow, argSort, argValue, argXML, commandList(), kdbClose(), and kdbOpen().
Referenced by doCommand().
int commandMonitor | ( | KDBHandle | handle | ) |
Business logic behind 'kdb mon' command.
Will block your command line until some change happens to the interested key.
bash$ kdb mon system/sw/MyApp/someKey
Definition at line 1364 of file kdb/kdb.c.
References argKeyName, kdbMonitorKey(), KEY_SWITCH_END, KEY_SWITCH_NEEDSYNC, KEY_SWITCH_VALUE, keyDel(), keyNew(), and keyStealValue().
Referenced by doCommand().