X-Git-Url: http://git.archive.openwrt.org/?p=project%2Fuqmi.git;a=blobdiff_plain;f=main.c;h=5a4a8e818f4eb3f69717cb69e0a4beef2862d307;hp=47e0ff2084883f85bc661af871b215d670f7fde9;hb=bfe1be97f0cbf840ea7adba7eaaf90e57b6904c9;hpb=b29e4d756726e9685ad812210c5f2e5298100140 diff --git a/main.c b/main.c index 47e0ff2..5a4a8e8 100644 --- a/main.c +++ b/main.c @@ -6,6 +6,7 @@ #include #include #include +#include #include "uqmi.h" #include "commands.h" @@ -38,6 +39,10 @@ static int usage(const char *progname) " --set-client-id ,: Set Client ID for service to \n" " --get-client-id : Connect and get Client ID for service \n" " (implies --keep-client-id)\n" + wds_helptext + dms_helptext + nas_helptext + wms_helptext "\n", progname); return 1; } @@ -52,11 +57,21 @@ static void keep_client_id(struct qmi_dev *qmi, const char *optarg) qmi_service_get_client_id(qmi, svc); } +static void handle_exit_signal(int signal) +{ + cancel_all_requests = true; + uloop_end(); +} + int main(int argc, char **argv) { static struct qmi_dev dev; int ch; + uloop_init(); + signal(SIGINT, handle_exit_signal); + signal(SIGTERM, handle_exit_signal); + while ((ch = getopt_long(argc, argv, "d:k:", uqmi_getopt, NULL)) != -1) { int cmd_opt = CMD_OPT(ch);