LCOV - code coverage report
Current view: top level - mogwai-scheduled - main.c (source / functions) Hit Total Coverage
Test: Code coverage Lines: 12 16 75.0 %
Date: 2022-06-30 20:59:16 Functions: 1 1 100.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 4 8 50.0 %

           Branch data     Line data    Source code
       1                 :            : /* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*-
       2                 :            :  *
       3                 :            :  * Copyright © 2017 Endless Mobile, Inc.
       4                 :            :  *
       5                 :            :  * This library is free software; you can redistribute it and/or
       6                 :            :  * modify it under the terms of the GNU Lesser General Public
       7                 :            :  * License as published by the Free Software Foundation; either
       8                 :            :  * version 2.1 of the License, or (at your option) any later version.
       9                 :            :  *
      10                 :            :  * This library is distributed in the hope that it will be useful,
      11                 :            :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
      12                 :            :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
      13                 :            :  * Lesser General Public License for more details.
      14                 :            :  *
      15                 :            :  * You should have received a copy of the GNU Lesser General Public
      16                 :            :  * License along with this library; if not, write to the Free Software
      17                 :            :  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
      18                 :            :  *
      19                 :            :  * Authors:
      20                 :            :  *  - Philip Withnall <withnall@endlessm.com>
      21                 :            :  */
      22                 :            : 
      23                 :            : #include "config.h"
      24                 :            : 
      25                 :            : #include <glib.h>
      26                 :            : #include <glib/gi18n.h>
      27                 :            : #include <libgsystemservice/service.h>
      28                 :            : #include <libmogwai-schedule/service.h>
      29                 :            : #include <signal.h>
      30                 :            : 
      31                 :            : 
      32                 :            : int
      33                 :          1 : main (int   argc,
      34                 :            :       char *argv[])
      35                 :            : {
      36                 :          1 :   g_autoptr(GError) error = NULL;
      37                 :          1 :   g_autoptr(MwsService) service = NULL;
      38                 :            : 
      39                 :            :   /* Set up a D-Bus service and run until we are killed. */
      40                 :          1 :   service = mws_service_new ();
      41                 :          1 :   gss_service_run (GSS_SERVICE (service), argc, argv, &error);
      42                 :            : 
      43         [ +  - ]:          1 :   if (error != NULL)
      44                 :            :     {
      45                 :            :       int code;
      46                 :            : 
      47         [ -  + ]:          1 :       if (g_error_matches (error,
      48                 :            :                            GSS_SERVICE_ERROR, GSS_SERVICE_ERROR_SIGNALLED))
      49                 :          0 :         raise (gss_service_get_exit_signal (GSS_SERVICE (service)));
      50         [ -  + ]:          1 :       else if (g_error_matches (error,
      51                 :            :                                 GSS_SERVICE_ERROR, GSS_SERVICE_ERROR_TIMEOUT))
      52                 :            :         {
      53                 :          0 :           g_message ("Exiting due to reaching inactivity timeout");
      54                 :          0 :           return 0;
      55                 :            :         }
      56                 :            : 
      57                 :          1 :       g_printerr ("%s: %s\n", argv[0], error->message);
      58                 :          1 :       code = error->code;
      59         [ -  + ]:          1 :       g_assert (code != 0);
      60                 :            : 
      61                 :          1 :       return code;
      62                 :            :     }
      63                 :            : 
      64                 :          0 :   return 0;
      65                 :            : }
      66                 :            : 

Generated by: LCOV version 1.16