summaryrefslogtreecommitdiff
path: root/src/script.c
diff options
context:
space:
mode:
authorMichael Jennings <mej@kainx.org>2006-02-13 19:52:45 +0000
committerMichael Jennings <mej@kainx.org>2006-02-13 19:52:45 +0000
commit7537403997e4b03fc354eaf14687fda364d1cc77 (patch)
tree5bba6b0e1daa2e3b4e9dab12d8c1d99021785376 /src/script.c
parentfccdc9bb52da2b4293cb97e3c43657ed0e5d922c (diff)
downloadeterm-7537403997e4b03fc354eaf14687fda364d1cc77.tar.gz
Mon Feb 13 14:51:56 2006 Michael Jennings (mej)
Update to libast 0.6+ API. ---------------------------------------------------------------------- SVN revision: 20440
Diffstat (limited to 'src/script.c')
-rw-r--r--src/script.c62
1 files changed, 31 insertions, 31 deletions
diff --git a/src/script.c b/src/script.c
index f019ffe..0894927 100644
--- a/src/script.c
+++ b/src/script.c
@@ -103,13 +103,13 @@ eterm_handle_winop(char *action)
int x, y, n;
char *xx, *yy;
- n = num_words(action);
+ n = spiftool_num_words(action);
if (n == 3 || n == 4) {
if (n == 3) {
win = TermWin.parent;
}
- xx = get_pword(n - 1, action);
- yy = get_pword(n, action);
+ xx = spiftool_get_pword(n - 1, action);
+ yy = spiftool_get_pword(n, action);
x = (int) strtol(xx, (char **) NULL, 0);
y = (int) strtol(yy, (char **) NULL, 0);
XMoveWindow(Xdisplay, win, x, y);
@@ -118,13 +118,13 @@ eterm_handle_winop(char *action)
int w, h, n;
char *ww, *hh;
- n = num_words(action);
+ n = spiftool_num_words(action);
if (n == 3 || n == 4) {
if (n == 3) {
win = TermWin.parent;
}
- ww = get_pword(n - 1, action);
- hh = get_pword(n, action);
+ ww = spiftool_get_pword(n - 1, action);
+ hh = spiftool_get_pword(n, action);
w = (int) strtol(ww, (char **) NULL, 0);
h = (int) strtol(hh, (char **) NULL, 0);
XResizeWindow(Xdisplay, win, w, h);
@@ -134,7 +134,7 @@ eterm_handle_winop(char *action)
} else if (!BEG_STRCASECMP(action, "iconify")) {
XIconifyWindow(Xdisplay, win, Xscreen);
} else {
- print_error("IPC Error: Unrecognized window operation \"%s\"\n", action);
+ libast_print_error("IPC Error: Unrecognized window operation \"%s\"\n", action);
}
}
#endif
@@ -171,7 +171,7 @@ script_handler_copy(spif_charptr_t *params)
} else if (!BEG_STRCASECMP(buffer_id, "secondary")) {
sel = XA_SECONDARY;
} else {
- print_error("Invalid parameter to copy(): \"%s\"\n", buffer_id);
+ libast_print_error("Invalid parameter to copy(): \"%s\"\n", buffer_id);
}
}
}
@@ -214,7 +214,7 @@ script_handler_exit(spif_charptr_t *params)
if (isdigit(params[0][0]) || (params[0][0] == '-' && isdigit(params[0][1]))) {
code = (unsigned char) atoi(params[0]);
} else {
- tmp = join(" ", params);
+ tmp = spiftool_join(" ", params);
printf("Exiting: %s\n", tmp);
FREE(tmp);
}
@@ -272,7 +272,7 @@ script_handler_paste(spif_charptr_t *params)
} else if (!BEG_STRCASECMP(buffer_id, "secondary")) {
sel = XA_SECONDARY;
} else {
- print_error("Invalid parameter to paste(): \"%s\"\n", buffer_id);
+ libast_print_error("Invalid parameter to paste(): \"%s\"\n", buffer_id);
}
}
}
@@ -361,7 +361,7 @@ script_handler_scroll(spif_charptr_t *params)
} else if (str_leading_match("buffers", type)) {
count = (long) (cnt_float * (TermWin.nrow + TermWin.saveLines));
} else {
- print_error("Invalid modifier \"%s\" in scroll()\n", type);
+ libast_print_error("Invalid modifier \"%s\" in scroll()\n", type);
return;
}
} else {
@@ -411,7 +411,7 @@ script_handler_spawn(spif_charptr_t *params)
char *tmp;
if (params && *params) {
- tmp = join(" ", params);
+ tmp = spiftool_join(" ", params);
system_no_wait(tmp);
FREE(tmp);
} else {
@@ -448,7 +448,7 @@ script_handler_exec_dialog(spif_charptr_t *params)
int ret;
if (params && *params) {
- tmp = join(" ", params);
+ tmp = spiftool_join(" ", params);
} else {
tmp = NULL;
}
@@ -474,7 +474,7 @@ script_handler_msgbox(spif_charptr_t *params)
char *tmp;
if (params && *params) {
- tmp = join(" ", params);
+ tmp = spiftool_join(" ", params);
scr_refresh(DEFAULT_REFRESH);
menu_dialog(NULL, tmp, 1, NULL, NULL);
FREE(tmp);
@@ -511,7 +511,7 @@ script_handler_es_display(spif_charptr_t *params)
return;
}
- p = downcase_str(*params);
+ p = spiftool_downcase_str(*params);
a = params[index++];
if (a && isdigit(*a)) {
no = atoi(a);
@@ -565,7 +565,7 @@ script_handler_es_display(spif_charptr_t *params)
D_ESCREEN(("View scrollback on display %d\n", no));
ns_sbb_disp(sess, no);
} else {
- print_error("Error in script: \"display\" has no sub-function \"%s\".\n", p);
+ libast_print_error("Error in script: \"display\" has no sub-function \"%s\".\n", p);
}
}
@@ -606,7 +606,7 @@ script_handler_es_region(spif_charptr_t *params)
return;
}
- p = downcase_str(*params);
+ p = spiftool_downcase_str(*params);
a = params[index++];
if (a && isdigit(*a)) {
no = atoi(a);
@@ -626,7 +626,7 @@ script_handler_es_region(spif_charptr_t *params)
} else if (!strcmp(p, "toggle")) {
D_ESCREEN(("Toggle region of display %8p\n", disp));
ns_tog_region(sess, disp);
- } else if (!strcmp(p, "new") || !strcmp(p, "split")) {
+ } else if (!strcmp(p, "new") || !strcmp(p, "spiftool_split")) {
if (!a || !*a || !strcasecmp(a, "ask")) {
D_ESCREEN(("region new ask\n"));
ns_add_region(sess, disp, no, NULL);
@@ -660,7 +660,7 @@ script_handler_es_region(spif_charptr_t *params)
D_ESCREEN(("View scrollback for region %d of display %8p\n", no, disp));
ns_sbb_region(sess, disp, no);
} else {
- print_error("Error in script: \"region\" has no sub-function \"%s\".\n", p);
+ libast_print_error("Error in script: \"region\" has no sub-function \"%s\".\n", p);
}
}
@@ -676,7 +676,7 @@ script_handler_es_statement(spif_charptr_t *params)
char *tmp;
if (params && *params) {
- tmp = join(" ", params);
+ tmp = spiftool_join(" ", params);
ns_statement(TermWin.screen, tmp);
FREE(tmp);
} else {
@@ -739,7 +739,7 @@ script_parse(char *s)
D_SCRIPT(("Parsing: \"%s\"\n", s));
- token_list = split(";", s);
+ token_list = spiftool_split(";", s);
if (token_list == NULL) {
D_SCRIPT(("No tokens found; ignoring script.\n"));
return;
@@ -747,7 +747,7 @@ script_parse(char *s)
for (i = 0; token_list[i]; i++) {
pstr = token_list[i];
- chomp(pstr);
+ spiftool_chomp(pstr);
if (!(*pstr)) {
continue;
}
@@ -758,15 +758,15 @@ script_parse(char *s)
strncpy(func_name, pstr, len);
func_name[len] = 0;
} else {
- print_error("Error in script \"%s\": Missing function name before \"%s\".\n", s, params);
- free_array((void **) token_list, 0);
+ libast_print_error("Error in script \"%s\": Missing function name before \"%s\".\n", s, params);
+ spiftool_free_array((void **) token_list, 0);
return;
}
} else {
func_name = STRDUP(pstr);
}
if (!func_name) {
- free_array((void **) token_list, 0);
+ spiftool_free_array((void **) token_list, 0);
return;
}
if (params) {
@@ -774,11 +774,11 @@ script_parse(char *s)
if ((tmp = strrchr(params, ')')) != NULL) {
*tmp = 0;
} else {
- print_error("Error in script \"%s\": Missing closing parentheses for \"%s\".\n", s, token_list[i]);
- free_array((void **) token_list, 0);
+ libast_print_error("Error in script \"%s\": Missing closing parentheses for \"%s\".\n", s, token_list[i]);
+ spiftool_free_array((void **) token_list, 0);
return;
}
- param_list = split(", \t", params);
+ param_list = spiftool_split(", \t", params);
} else {
param_list = NULL;
}
@@ -786,12 +786,12 @@ script_parse(char *s)
if ((func = script_find_handler(func_name)) != NULL) {
(func->handler) (param_list);
} else {
- print_error("Error in script \"%s\": No such function \"%s\".\n", s, func_name);
+ libast_print_error("Error in script \"%s\": No such function \"%s\".\n", s, func_name);
}
}
if (params) {
- free_array((void **) param_list, 0);
+ spiftool_free_array((void **) param_list, 0);
}
- free_array((void **) token_list, 0);
+ spiftool_free_array((void **) token_list, 0);
}