X-Git-Url: https://git.deb.at/w?a=blobdiff_plain;f=abook.c;h=cc5f2a05ca0d055453c9e2fd30188e837b6de5af;hb=4e82af5614805d49188448e66b9e0c37a47edebd;hp=613d34c45a6f5055f746dc833a76dadb3331c99f;hpb=0b00c480406a335994892ad9de9e9d80edfc77ba;p=pkg%2Fabook.git diff --git a/abook.c b/abook.c index 613d34c..cc5f2a0 100644 --- a/abook.c +++ b/abook.c @@ -178,7 +178,7 @@ parse_command_line(int argc, char **argv) convert(argv[i+1], argv[i+2], argv[i+3], "-"); } else if( !strcmp(argv[i], "--add-email") ) { add_email(0); - } else if( !strcmp(argv[i], "--add-email-force") ) { + } else if( !strcmp(argv[i], "--add-email-quiet") ) { add_email(1); } else { printf("option %s not recognized\n", argv[i]); @@ -202,7 +202,7 @@ show_usage() "read an e-mail message from stdin and\n" " " "add the sender to the addressbook"); - puts (" --add-email-force " + puts (" --add-email-quiet " "same as --add-email but doesn't\n" " confirm adding"); putchar('\n'); @@ -456,22 +456,25 @@ convert(char *srcformat, char *srcfile, char *dstformat, char *dstfile) switch( import(srcformat, srcfile) ) { case -1: - printf("input format %s not supported\n", srcformat); + fprintf(stderr, + "input format %s not supported\n", srcformat); ret = 1; case 1: - printf("cannot read file %s\n", srcfile); + fprintf(stderr, "cannot read file %s\n", srcfile); ret = 1; } if(!ret) switch( export(dstformat, dstfile) ) { case -1: - printf("output format %s not supported\n", - dstformat); + fprintf(stderr, + "output format %s not supported\n", + dstformat); ret = 1; break; case 1: - printf("cannot write file %s\n", dstfile); + fprintf(stderr, + "cannot write file %s\n", dstfile); ret = 1; break; } @@ -503,6 +506,12 @@ quit_add_email() exit(0); } +static void +quit_add_email_sig(int signal) +{ + quit_add_email(); +} + static void init_add_email() { @@ -518,7 +527,7 @@ init_add_email() atexit(close_database); - signal(SIGINT, quit_add_email); + signal(SIGINT, quit_add_email_sig); } static int @@ -531,7 +540,7 @@ add_email_add_item(int quiet, char *name, char *email) char c; if(!in) { fprintf(stderr, "cannot open /dev/tty\n" - "you may want to use --add-email-force\n"); + "you may want to use --add-email-quiet\n"); exit(1); } printf("Add ``%s <%s>'' to %s ? (y/n)\n", @@ -569,7 +578,6 @@ add_email(int quiet) line = getaline(stdin); if(line && !strncasecmp("From:", line, 5) ) { getname(line, &name, &email); - my_free(line); add_email_count += add_email_add_item(quiet, name, email); my_free(name);