diff options
author | Dan McGee <dan@archlinux.org> | 2007-04-27 01:20:46 +0200 |
---|---|---|
committer | Dan McGee <dan@archlinux.org> | 2007-04-27 01:20:46 +0200 |
commit | 63588aff191f5bf982cc0c8ee8af2b46de084c4b (patch) | |
tree | 63e5f1fd1f2bef649c0ffb32efcad5053a3706cd /src | |
parent | b39aba99f922d3e4451d6be09ea9201ea20ba102 (diff) | |
download | pacman-63588aff191f5bf982cc0c8ee8af2b46de084c4b.tar.gz pacman-63588aff191f5bf982cc0c8ee8af2b46de084c4b.tar.xz |
Remove output.c and output.h
One function was left in this set of files after the earlier cleansing, so
I moved yesno to util.c.
Signed-off-by: Dan McGee <dan@archlinux.org>
Diffstat (limited to 'src')
-rw-r--r-- | src/pacman/Makefile.am | 1 | ||||
-rw-r--r-- | src/pacman/add.c | 1 | ||||
-rw-r--r-- | src/pacman/callback.c | 1 | ||||
-rw-r--r-- | src/pacman/deptest.c | 1 | ||||
-rw-r--r-- | src/pacman/output.c | 72 | ||||
-rw-r--r-- | src/pacman/output.h | 30 | ||||
-rw-r--r-- | src/pacman/package.c | 1 | ||||
-rw-r--r-- | src/pacman/pacman.c | 1 | ||||
-rw-r--r-- | src/pacman/query.c | 1 | ||||
-rw-r--r-- | src/pacman/remove.c | 1 | ||||
-rw-r--r-- | src/pacman/sync.c | 1 | ||||
-rw-r--r-- | src/pacman/util.c | 35 | ||||
-rw-r--r-- | src/pacman/util.h | 9 |
13 files changed, 39 insertions, 116 deletions
diff --git a/src/pacman/Makefile.am b/src/pacman/Makefile.am index be0374a2..2b1a8a3f 100644 --- a/src/pacman/Makefile.am +++ b/src/pacman/Makefile.am @@ -16,7 +16,6 @@ pacman_SOURCES = \ add.c \ conf.h conf.c \ deptest.c \ - output.h output.c \ package.h package.c \ pacman.h pacman.c \ query.c \ diff --git a/src/pacman/add.c b/src/pacman/add.c index a42d2286..cf636234 100644 --- a/src/pacman/add.c +++ b/src/pacman/add.c @@ -30,7 +30,6 @@ /* pacman */ #include "pacman.h" -#include "output.h" #include "callback.h" #include "conf.h" #include "util.h" diff --git a/src/pacman/callback.c b/src/pacman/callback.c index 89c508cc..8654b4ef 100644 --- a/src/pacman/callback.c +++ b/src/pacman/callback.c @@ -36,7 +36,6 @@ /* pacman */ #include "callback.h" #include "util.h" -#include "output.h" #include "conf.h" /* TODO this should not have to be defined twice- trans.c & log.c */ diff --git a/src/pacman/deptest.c b/src/pacman/deptest.c index 120c8a00..933f9384 100644 --- a/src/pacman/deptest.c +++ b/src/pacman/deptest.c @@ -32,7 +32,6 @@ #include "pacman.h" #include "util.h" #include "conf.h" -#include "output.h" extern config_t *config; diff --git a/src/pacman/output.c b/src/pacman/output.c deleted file mode 100644 index 4c970b2e..00000000 --- a/src/pacman/output.c +++ /dev/null @@ -1,72 +0,0 @@ -/* - * output.c - * - * Copyright (c) 2002-2007 by Judd Vinet <jvinet@zeroflux.org> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, - * USA. - */ - -#include "config.h" - -#include <stdio.h> -#include <string.h> -#include <stdarg.h> -#include <ctype.h> -#include <time.h> - -#include <alpm.h> - -/* pacman */ -#include "output.h" -#include "conf.h" -#include "util.h" - -#define LOG_STR_LEN 256 - -extern config_t *config; - -/* presents a prompt and gets a Y/N answer */ -/* TODO there must be a better way */ -int yesno(char *fmt, ...) -{ - char str[LOG_STR_LEN]; - char response[32]; - va_list args; - - if(config->noconfirm) { - return(1); - } - - va_start(args, fmt); - vsnprintf(str, LOG_STR_LEN, fmt, args); - va_end(args); - - /* Use stderr so questions are always displayed when redirecting output */ - fprintf(stderr, str); - - if(fgets(response, 32, stdin)) { - if(strlen(response) != 0) { - strtrim(response); - } - - if(!strcasecmp(response, _("Y")) || !strcasecmp(response, _("YES")) || strlen(response) == 0) { - return(1); - } - } - return(0); -} - -/* vim: set ts=2 sw=2 noet: */ diff --git a/src/pacman/output.h b/src/pacman/output.h deleted file mode 100644 index 29a70b87..00000000 --- a/src/pacman/output.h +++ /dev/null @@ -1,30 +0,0 @@ -/* - * output.h - * - * Copyright (c) 2002-2007 by Judd Vinet <jvinet@zeroflux.org> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, - * USA. - */ -#ifndef _PM_OUTPUT_H -#define _PM_OUTPUT_H - -#include <stdio.h> - -int yesno(char *fmt, ...); - -#endif /* _PM_OUTPUT_H */ - -/* vim: set ts=2 sw=2 noet: */ diff --git a/src/pacman/package.c b/src/pacman/package.c index 81bcad17..65045a53 100644 --- a/src/pacman/package.c +++ b/src/pacman/package.c @@ -32,7 +32,6 @@ /* pacman */ #include "package.h" -#include "output.h" #include "util.h" /* Display the content of an installed package diff --git a/src/pacman/pacman.c b/src/pacman/pacman.c index 409cf2ef..62b7cd02 100644 --- a/src/pacman/pacman.c +++ b/src/pacman/pacman.c @@ -43,7 +43,6 @@ /* pacman */ #include "pacman.h" #include "util.h" -#include "output.h" #include "callback.h" #include "conf.h" #include "package.h" diff --git a/src/pacman/query.c b/src/pacman/query.c index 93da5480..5aebf723 100644 --- a/src/pacman/query.c +++ b/src/pacman/query.c @@ -35,7 +35,6 @@ /* pacman */ #include "pacman.h" #include "package.h" -#include "output.h" #include "conf.h" #include "util.h" diff --git a/src/pacman/remove.c b/src/pacman/remove.c index aef30144..e4f34886 100644 --- a/src/pacman/remove.c +++ b/src/pacman/remove.c @@ -31,7 +31,6 @@ /* pacman */ #include "pacman.h" #include "util.h" -#include "output.h" #include "callback.h" #include "conf.h" diff --git a/src/pacman/sync.c b/src/pacman/sync.c index 06936172..1b629429 100644 --- a/src/pacman/sync.c +++ b/src/pacman/sync.c @@ -37,7 +37,6 @@ /* pacman */ #include "pacman.h" #include "util.h" -#include "output.h" #include "package.h" #include "callback.h" #include "conf.h" diff --git a/src/pacman/util.c b/src/pacman/util.c index 8d7be69b..780434cd 100644 --- a/src/pacman/util.c +++ b/src/pacman/util.c @@ -27,6 +27,7 @@ #include <stdio.h> #include <stdlib.h> +#include <stdarg.h> #include <string.h> #include <errno.h> #include <fcntl.h> @@ -40,7 +41,8 @@ /* pacman */ #include "util.h" #include "conf.h" -#include "output.h" + +#define LOG_STR_LEN 256 extern config_t *config; @@ -336,4 +338,35 @@ void display_targets(alpm_list_t *syncpkgs) FREELIST(targets); } +/* presents a prompt and gets a Y/N answer */ +/* TODO there must be a better way */ +int yesno(char *fmt, ...) +{ + char str[LOG_STR_LEN]; + char response[32]; + va_list args; + + if(config->noconfirm) { + return(1); + } + + va_start(args, fmt); + vsnprintf(str, LOG_STR_LEN, fmt, args); + va_end(args); + + /* Use stderr so questions are always displayed when redirecting output */ + fprintf(stderr, str); + + if(fgets(response, 32, stdin)) { + if(strlen(response) != 0) { + strtrim(response); + } + + if(!strcasecmp(response, _("Y")) || !strcasecmp(response, _("YES")) || strlen(response) == 0) { + return(1); + } + } + return(0); +} + /* vim: set ts=2 sw=2 noet: */ diff --git a/src/pacman/util.h b/src/pacman/util.h index 5ab3599e..d6c33ed4 100644 --- a/src/pacman/util.h +++ b/src/pacman/util.h @@ -1,8 +1,8 @@ /* * util.h - * - * Copyright (c) 2002-2006 by Judd Vinet <jvinet@zeroflux.org> - * + * + * Copyright (c) 2002-2007 by Judd Vinet <jvinet@zeroflux.org> + * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or @@ -15,7 +15,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, * USA. */ #ifndef _PM_UTIL_H @@ -42,6 +42,7 @@ char *strtrim(char *str); int reg_match(char *string, char *pattern); void list_display(const char *title, alpm_list_t *list); void display_targets(alpm_list_t *syncpkgs); +int yesno(char *fmt, ...); #endif /* _PM_UTIL_H */ |