summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXavier Santolaria <xsa@cvs.openbsd.org>2007-01-03 14:08:10 +0000
committerXavier Santolaria <xsa@cvs.openbsd.org>2007-01-03 14:08:10 +0000
commit2953b6fa05a679466b6901e8c4b47552ce9e520c (patch)
tree6e8d27761fc5a88e4fd0a8166eaad22ebffc1b8f
parentb11aced460f181abd0ce4b9319145c01d92c31fd (diff)
bring back cvs_yesno() as is it going to be used pretty soon now.
-rw-r--r--usr.bin/cvs/util.c21
-rw-r--r--usr.bin/cvs/util.h3
2 files changed, 22 insertions, 2 deletions
diff --git a/usr.bin/cvs/util.c b/usr.bin/cvs/util.c
index 022c7311410..531a15e6eed 100644
--- a/usr.bin/cvs/util.c
+++ b/usr.bin/cvs/util.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: util.c,v 1.94 2006/12/05 15:59:48 xsa Exp $ */
+/* $OpenBSD: util.c,v 1.95 2007/01/03 14:08:09 xsa Exp $ */
/*
* Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org>
* Copyright (c) 2005, 2006 Joris Vink <joris@openbsd.org>
@@ -930,3 +930,22 @@ cvs_revision_select(RCSFILE *file, char *range)
return (nrev);
}
+
+int
+cvs_yesno(void)
+{
+ int c, ret;
+
+ ret = 0;
+
+ fflush(stderr);
+ fflush(stdout);
+
+ if ((c = getchar()) != 'y' && c != 'Y')
+ ret = -1;
+ else
+ while (c != EOF && c != '\n')
+ c = getchar();
+
+ return (ret);
+}
diff --git a/usr.bin/cvs/util.h b/usr.bin/cvs/util.h
index 4f2eb52e624..e1b1d3530b3 100644
--- a/usr.bin/cvs/util.h
+++ b/usr.bin/cvs/util.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: util.h,v 1.10 2006/06/14 15:14:47 xsa Exp $ */
+/* $OpenBSD: util.h,v 1.11 2007/01/03 14:08:09 xsa Exp $ */
/*
* Copyright (c) 2006 Niall O'Higgins <niallo@openbsd.org>
* All rights reserved.
@@ -73,5 +73,6 @@ struct cvs_lines *cvs_splitlines(const char *);
void cvs_freelines(struct cvs_lines *);
struct cvs_argvector *cvs_strsplit(char *, const char *);
void cvs_argv_destroy(struct cvs_argvector *);
+int cvs_yesno(void);
#endif /* UTIL_H */