X-Git-Url: http://git.tuebingen.mpg.de/?a=blobdiff_plain;f=play.c;h=02fd27b3ac381562e2656cb3dc6144d8425cb6f3;hb=181beb316afad036ac01a778544c5dec0a8d51c7;hp=e8dfbde94683fae0a8a10c19874dcb1ba7ae195e;hpb=be3b6f16706c6a93bd46c6dc48caa8109e7860c6;p=paraslash.git diff --git a/play.c b/play.c index e8dfbde9..02fd27b3 100644 --- a/play.c +++ b/play.c @@ -109,10 +109,6 @@ typedef int (*play_cmd_handler_t)(struct lls_parse_result *lpr); struct play_command_info { play_cmd_handler_t handler; }; -#define EXPORT_PLAY_CMD_HANDLER(_cmd) \ - const struct play_command_info lsg_play_cmd_com_ ## _cmd ## _user_data = { \ - .handler = com_ ## _cmd \ - }; static int loglevel = LL_WARNING; @@ -713,6 +709,11 @@ static void detach_stdout(void) btr_remove_node(&pt->btrn); } +#define EXPORT_PLAY_CMD_HANDLER(_cmd) \ + const struct play_command_info lsg_play_cmd_com_ ## _cmd ## _user_data = { \ + .handler = com_ ## _cmd \ + }; + static int com_quit(__a_unused struct lls_parse_result *lpr) { pt->rq = CRT_TERM_RQ; @@ -853,6 +854,7 @@ static int com_pause(__a_unused struct lls_parse_result *lpr) ss = PARA_MAX(ss, 0UL); ss = PARA_MIN(ss, pt->num_chunks); pt->start_chunk = ss; + pt->rq = CRT_REPOS; kill_stream(); return 0; } @@ -1051,9 +1053,16 @@ static void session_open(void) history_file = para_strdup(OPT_STRING_VAL(HISTORY_FILE)); else { char *home = para_homedir(); - history_file = make_message("%s/.paraslash/play.history", - home); + char *dot_para = make_message("%s/.paraslash", home); + free(home); + ret = para_mkdir(dot_para, 0777); + /* warn, but otherwise ignore mkdir error */ + if (ret < 0 && ret != -ERRNO_TO_PARA_ERROR(EEXIST)) + PARA_WARNING_LOG("Can not create %s: %s\n", dot_para, + para_strerror(-ret)); + history_file = make_message("%s/play.history", dot_para); + free(dot_para); } ici.history_file = history_file; ici.loglevel = loglevel; @@ -1094,7 +1103,7 @@ static void session_update_time_string(char *str, unsigned len) if (btr_get_input_queue_size(pt->btrn) > 0) return; } - ie9_print_status_bar(str, len); + i9e_print_status_bar(str, len); } /* @@ -1136,7 +1145,7 @@ static int session_post_select(struct sched *s) { char c; - if (!FD_ISSET(STDIN_FILENO, &s->rfds)) + if (!sched_read_ok(STDIN_FILENO, s)) return 0; if (read(STDIN_FILENO, &c, 1)) do_nothing; @@ -1246,12 +1255,8 @@ int main(int argc, char *argv[]) int ret; unsigned num_inputs; - /* needed this early to make help work */ - recv_init(); - - sched.default_timeout.tv_sec = 5; + sched.default_timeout = 5000; parse_config_or_die(argc, argv); - AFH_RECV->init(); session_open(); num_inputs = lls_num_inputs(play_lpr); init_shuffle_map();