static void add_email(int);
char *datafile = NULL;
-char *rcfile = NULL;
+static char *rcfile = NULL;
bool alternative_datafile = FALSE;
bool alternative_rcfile = FALSE;
{
/*
* 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();
fgetc(stdin);
}
- signal(SIGKILL, quit_abook_sig);
signal(SIGTERM, quit_abook_sig);
if(init_ui())
init_abook();
- get_commands();
+ get_commands();
quit_abook(QUIT_SAVE);
assert(path != NULL);
if(*path == '/') {
- *var = strdup(path);
+ *var = xstrdup(path);
return;
}
{
puts (PACKAGE " v " VERSION "\n");
puts (" -h --help show usage");
- puts (" -C --config <file> use an alternative configuration file");
+ puts (" -C --config <file> use an alternative configuration file");
puts (" --datafile <file> use an alternative addressbook file");
puts (" --mutt-query <string> make a query for mutt");
puts (" --add-email "
ret = *database[item][EMAIL] ?
mkstr("%s <%s>", name, email) :
- strdup(name);
+ xstrdup(name);
free(name);
#ifdef DEBUG
fprintf(stderr, "cmd: %s\n", cmd);
#endif
- system(cmd);
+ system(cmd);
free(cmd);
/*
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;
init_add_email()
{
set_filenames();
- atexit(free_filenames);
check_abook_directory();
init_opts();
load_opts(rcfile);
return 0;
}
}
-
+
if(!quiet) {
FILE *in = fopen("/dev/tty", "r");
char c;
}
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;