Make lash_simple_client handle LASH_Restore_Data_Set and LASH_Quit events.

git-svn-id: svn://svn.savannah.nongnu.org/lash/trunk@466 1de19dc7-4e3f-0410-a61d-eddf686bf0b7
This commit is contained in:
Juuso Alasuutari 2008-07-31 21:55:45 +00:00
parent 8cf05ee29e
commit c048ed46dc
1 changed files with 15 additions and 9 deletions

View File

@ -115,6 +115,16 @@ main(int argc, char **argv)
lash_send_config(client, config);
lash_send_event(client, event);
break;
case LASH_Restore_Data_Set:
while ((config = lash_get_config(client))) {
printf("%s: got config with key '%s', value_size %d\n",
__FUNCTION__, lash_config_get_key(config),
lash_config_get_value_size(config));
lash_config_free(config);
free(config);
}
lash_send_event(client, event);
break;
case LASH_Save_File:
{
FILE *config_file;
@ -151,6 +161,11 @@ main(int argc, char **argv)
lash_send_event(client, event);
break;
}
case LASH_Quit:
printf("server told us to quit; exiting\n");
done = 1;
break;
case LASH_Server_Lost:
printf("server connection lost; exiting\n");
exit(0);
@ -165,15 +180,6 @@ main(int argc, char **argv)
}
}
config = lash_get_config(client);
if (config) {
printf("%s: got config with key '%s', value_size %d\n",
__FUNCTION__, lash_config_get_key(config),
lash_config_get_value_size(config));
lash_config_free(config);
free(config);
}
sleep(5);
}