+ name = "gw.auto.show";
+ break;
+ case 5:
+ name = "gw.default.show";
+ break;
+ case 6:
+ name = "gw.language";
+ break;
+ default:
+ return 0;
+ }
+ gw_log (GW_LOG_DEBUG, KERNEL_LOG, "update file %s with %s=%s",
+ fname, name, value);
+ gw_res_put (info.kernel_res, "gw.username", info.from_str, fname);
+ gw_res_put (info.kernel_res, name, value, fname);
+ gw_res_commit (info.kernel_res, fname);
+ if (setting_no == 6)
+ read_kernel_res ();
+ }
+ return 0;
+}
+
+
+/*
+ * exec_command: parse and execute ccl command in str.
+ * str: ccl command string
+ * stop_flag pointer to integer. On completion the integer
+ * is 1 (stop) or 2 (continue); 0 (other command)
+ * return: 0 success; non-zero otherwise
+ */
+static int exec_command (const char *str, int *stop_flag)
+{
+ static struct command_word command_tab [] =
+ {
+ { "find", "find"},
+ { "show", "show"},
+ { "base", "base" },
+ { "help", "help" },
+ { "info", "info" },
+ { "continue", "continue" },
+ { "status", "status" },
+ { "stop", "stop" },
+ { "target", "target" },
+ { "def", "def" },
+ { "account", "account" },
+ { NULL, NULL }
+ };
+
+ struct ccl_token *cmd;
+ const char *cp = str;
+ int no;
+
+ while (*cp && *cp != ' ' && *cp != '\n' && *cp != '\t' && *cp != '\r')
+ cp++;
+
+ *stop_flag = 0;
+ no = command_search_str (command_tab, str, cp-str, "ccl.command.");
+ if (no)
+ {
+ if (no == 1 || no == 2 || no == 3) /* find/show/base? */
+ {
+ if (!info.zass) /* open if not already opened */
+ reopen_target ();
+ fprintf (reply_fd, "\n> %s\n", str);
+ if (!info.zass) /* fail? */
+ {
+ fprintf (reply_fd, "\n%s\n",
+ gw_res_get (info.kernel_res, "gw.err.no.target",
+ "No connection established - "
+ "command ignored"));
+ return 0;
+ }
+ }
+ else
+ fprintf (reply_fd, "\n> %s\n", str);
+ switch (no)
+ {
+ case 1: /* find */
+ cmd = ccl_tokenize (cp);
+ exec_find (cmd, str);
+ break;
+ case 2: /* show */
+ cmd = ccl_tokenize (cp);
+ exec_show (cmd);
+ break;
+ case 3: /* base */
+ cmd = ccl_token_simple (cp);
+ exec_base (cmd);
+ break;
+ case 4: /* help */
+ cmd = ccl_token_simple (cp);
+ exec_help (cmd);
+ break;
+ case 6: /* continue */
+ *stop_flag = 2;
+ return 0;
+ case 7: /* status */
+ exec_status (cmd);
+ return 0;
+ case 8: /* stop */
+ *stop_flag = 1;
+ return 0;
+ case 9: /* target */
+ cmd = ccl_token_simple (cp);
+ exec_target (cmd);
+ break;
+ case 10: /* def */
+ cmd = ccl_token_simple (cp);
+ exec_def (cmd);
+ break;
+ case 11: /* account */
+ cmd = ccl_token_simple (cp);
+ exec_account (cmd);
+ break;