added error handling

git-svn-id: file:///srv/svn/repos/haiku/trunk/current@8743 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Jérôme Duval 2004-08-31 09:57:34 +00:00
parent bab3205a73
commit b00721dd1e
3 changed files with 10 additions and 4 deletions

View File

@ -220,13 +220,18 @@ Keymap::Dump()
}
void
status_t
Keymap::LoadCurrent()
{
key_map *keys;
key_map *keys = NULL;
get_key_map(&keys, &fChars);
if (!keys) {
fprintf(stderr, "error while getting current keymap!\n");
return B_ERROR;
}
memcpy(&fKeys, keys, sizeof(fKeys));
delete keys;
return B_OK;
}
/*

View File

@ -23,7 +23,7 @@
class Keymap
{
public:
void LoadCurrent();
status_t LoadCurrent();
status_t Load(entry_ref &ref);
status_t Save(entry_ref &ref);
status_t LoadSource(FILE *f);

View File

@ -46,7 +46,8 @@ int main(int argc, char **argv)
break;
if (operation == 'd') {
Keymap keymap;
keymap.LoadCurrent();
if (keymap.LoadCurrent() != B_OK)
return 1;
keymap.Dump();
return 0;
} else if (operation == 'r') {