X-Git-Url: https://git.deb.at/?a=blobdiff_plain;ds=sidebyside;f=abook.c;h=557ddb2f5818f7a4c5f9c8d855278aa8dc418747;hb=781c0d657fffe80e45d0fda6ed5ddbf5f796fefb;hp=52b7f42d07329a6d5164e2a0b12f31b813c1b505;hpb=6b1d1ce171a1eec61e5c3fbaa806a0df6d109011;p=pkg%2Fabook.git diff --git a/abook.c b/abook.c index 52b7f42..557ddb2 100644 --- a/abook.c +++ b/abook.c @@ -45,7 +45,7 @@ static void convert(char *srcformat, char *srcfile, static void add_email(int); char *datafile = NULL; -char *rcfile = NULL; +static char *rcfile = NULL; bool alternative_datafile = FALSE; bool alternative_rcfile = FALSE; @@ -105,7 +105,7 @@ xmalloc_error_handler(int err) { /* * We don't try to save addressbook here because we don't know - * if it's fully loaded to to memory. + * if it's fully loaded to memory. */ if(is_ui_initialized()) close_ui(); @@ -125,7 +125,6 @@ init_abook() fgetc(stdin); } - signal(SIGKILL, quit_abook_sig); signal(SIGTERM, quit_abook_sig); if(init_ui()) @@ -189,7 +188,7 @@ main(int argc, char **argv) init_abook(); - get_commands(); + get_commands(); quit_abook(QUIT_SAVE); @@ -260,7 +259,7 @@ set_filename(char **var, char *path) assert(path != NULL); if(*path == '/') { - *var = strdup(path); + *var = xstrdup(path); return; } @@ -394,7 +393,7 @@ show_usage() { puts (PACKAGE " v " VERSION "\n"); puts (" -h --help show usage"); - puts (" -C --config use an alternative configuration file"); + puts (" -C --config use an alternative configuration file"); puts (" --datafile use an alternative addressbook file"); puts (" --mutt-query make a query for mutt"); puts (" --add-email " @@ -504,7 +503,7 @@ make_mailstr(int item) ret = *database[item][EMAIL] ? mkstr("%s <%s>", name, email) : - strdup(name); + xstrdup(name); free(name); @@ -555,7 +554,7 @@ launch_mutt(int item) #ifdef DEBUG fprintf(stderr, "cmd: %s\n", cmd); #endif - system(cmd); + system(cmd); free(cmd); /* @@ -592,12 +591,12 @@ launch_wwwbrowser(int item) FILE * abook_fopen (const char *path, const char *mode) -{ +{ struct stat s; bool stat_ok; stat_ok = (stat(path, &s) != -1); - + if(strchr(mode, 'r')) return (stat_ok && S_ISREG(s.st_mode)) ? fopen(path, mode) : NULL; @@ -692,7 +691,6 @@ static void init_add_email() { set_filenames(); - atexit(free_filenames); check_abook_directory(); init_opts(); load_opts(rcfile); @@ -722,7 +720,7 @@ add_email_add_item(int quiet, char *name, char *email) return 0; } } - + if(!quiet) { FILE *in = fopen("/dev/tty", "r"); char c; @@ -747,8 +745,8 @@ add_email_add_item(int quiet, char *name, char *email) } memset(item, 0, sizeof(item)); - item[NAME] = strdup(name); - item[EMAIL] = strdup(email); + item[NAME] = xstrdup(name); + item[EMAIL] = xstrdup(email); add_item2database(item); return 1;