/* Copy */
while ((read_num = read(src_fd, buf, 1024)) > 0)
{
- write(dst_fd, buf, read_num);
+ int write_num = 0;
+ while (write_num < read_num)
+ {
+ int ret = write(dst_fd, buf + write_num, read_num - write_num);
+ if (ret < 0) {
+ /* Close files */
+ fd_close(src_fd);
+ fd_close(dst_fd);
+
+ return ret;
+ }
+ write_num += ret;
+ }
}
/* Close files */
{TRUE, "KP_1]", SKEY_BOTTOM},
{FALSE, NULL, 0},
};
+
+ static const struct {
+ cptr keyname;
+ int keycode;
+ } gcu_special_key_list[] = {
+ {"A", SKEY_UP},
+ {"B", SKEY_DOWN},
+ {"C", SKEY_RIGHT},
+ {"D", SKEY_LEFT},
+ {"1~", SKEY_TOP},
+ {"4~", SKEY_BOTTOM},
+ {"5~", SKEY_PGUP},
+ {"6~", SKEY_PGDOWN},
+ {NULL, 0},
+ };
+
char buf[1024];
cptr str = buf;
char key;
}
}
+ if (prefix(str, "\\e["))
+ {
+ str += 3;
+
+ for (i = 0; gcu_special_key_list[i].keyname; i++)
+ {
+ if (streq(str, gcu_special_key_list[i].keyname))
+ {
+ return gcu_special_key_list[i].keycode;
+ }
+ }
+ }
+
/* No special key found? */
/* Don't bother with this trigger no more */