diff options
| author | Cyrille Bagard <nocbos@gmail.com> | 2019-08-29 21:43:47 (GMT) | 
|---|---|---|
| committer | Cyrille Bagard <nocbos@gmail.com> | 2019-08-29 21:43:47 (GMT) | 
| commit | fa40856e942a7e1bd1cb2729645182c1fa717468 (patch) | |
| tree | 954db169d2b734e661d904e502cd1c803f51c6ea /src/main.c | |
| parent | 7f973e015eb59b626edc584a19a1ad3ffddf4867 (diff) | |
Defined a new way to launch updates share servers.
Diffstat (limited to 'src/main.c')
| -rw-r--r-- | src/main.c | 45 | 
1 files changed, 20 insertions, 25 deletions
@@ -23,12 +23,17 @@  #include <getopt.h> +#include <libgen.h>  #include <limits.h>  #include <locale.h> +#include <malloc.h> +#include <stdbool.h>  #include <stdlib.h> +#include <string.h>  #include <unistd.h>  #include <gtk/gtk.h> +  #include <config.h>  #include <i18n.h> @@ -37,8 +42,7 @@  #include "analysis/binary.h"  #include "analysis/loading.h"  #include "analysis/contents/file.h" -#include "analysis/db/server.h" -#include "common/xdg.h" +#include "analysis/db/auth.h"  #include "core/core.h"  #include "core/global.h"  #include "core/logs.h" @@ -83,15 +87,20 @@ static int save_binary_caches(void);  static void show_chrysalide_help(const char *name)  { +    char *tmp;                              /* Conservation modifiable     */      char *base;                             /* Version courte du nom       */ -    base = basename(name); +    tmp = strdup(name); + +    base = basename(tmp);      printf("\n");      printf("Usage: %s [--help] [--version]\n", base);      printf("       %s [args] <filename(s)...>\n", base); +    free(tmp); +      printf("\n");      printf("\t-h --help\t\tShow this help message.\n"); @@ -167,13 +176,7 @@ int main(int argc, char **argv)      int ret;                                /* Bilan d'un appel            */      bool status;                            /* Bilan d'opérations          */      GtkWidget *editor;                      /* Fenêtre graphique           */ -    GDbServer *server;                      /* Enregistrements locaux      */      GGenConfig *config;                     /* Configuration globale       */ - - -    char *author;                           /* Identification à diffuser   */ -    char *pub;                              /* Chemin de la clef publique  */ -      bool welcome;                           /* Affichage de la bienvenue ? */      char resolved[PATH_MAX];                /* Résolution de nom de fichier*/      GStudyProject *project;                 /* Nouveau projet courant      */ @@ -313,19 +316,17 @@ int main(int argc, char **argv)          if (!status) goto exit_complete_gui;      } -    /* Utilisateur représenté */ +    /* Lancement du serveur local */ -    if (!g_generic_config_get_value(config, MPK_AUTHOR_NAME, &author)) -        /*goto glbcl_exit*/; +    status = ensure_internal_connections_setup(); -    /* Chemin vers la clef privée */ +    if (!status) +        goto no_internal_server; -    pub = get_xdg_config_dir("chrysalide" G_DIR_SEPARATOR_S "id_rsa.pub"); +    status = launch_internal_server(); -    server = g_db_server_new_internal(author, pub); - -    if (server != NULL) -        g_db_server_start(server); +    if (!status) +        goto no_internal_server;      /* Charge le dernier projet ? */ @@ -404,13 +405,7 @@ int main(int argc, char **argv)   bad_project: -    if (server != NULL) -    { -        g_db_server_stop(server); - -        g_object_unref(G_OBJECT(server)); - -    } + no_internal_server:   exit_complete_gui:  | 
