static void params_free(char **params)
{
int i;
+
for (i=0; i < PARAMS_MAX; i++)
- free(params[i]);
+ if (params[i] != NULL)
+ free(params[i]);
}
void process_cmd(char *cmdline, int clinep, mwdata_t *mwdata)
{
unsigned char mdata[32];
- unsigned int intopt;
+ unsigned int intopt=0;
char cmd[128], pbuf[128], *params[PARAMS_MAX];
int i, pcnt;
char *inbuf = cmdline;
pcnt = 0;
if (strncmp(cmd, "quit", 4) == 0) {
- //close(mw_fd);
- //exit(0);
/* just in case we quit and show another screen */
mw_update_display(&mwdata->mwdevice, MW_SCREEN_MODE_IDLE, 0);
- params_free(params);
+ // params_free(params);
g_main_loop_quit (mwdata->mloop);
}
if (strncmp(cmd, "help", 4) == 0) {
if (strncmp(cmd, "wet", 3) == 0) {
do_weather(mwdata);
}
+ if (strncmp(cmd, "lang_de", 7) == 0) {
+ mdata[0] = MW_LANG_DE;
+ mw_nval_operation(&mwdata->mwdevice, MW_NVAL_OPERATION_WRITE, MW_NVAL_LANGUAGE
+
+ ls -l , 1, mdata);
+ }
if (strncmp(cmd, "c24", 3) == 0) {
mdata[0] = MW_RTC_CLOCK_24HR;
mw_nval_operation(&mwdata->mwdevice, MW_NVAL_OPERATION_WRITE, MW_NVAL_TIME_FORMAT, 1, mdata);