diff options
Diffstat (limited to 'usr.bin/cvs')
-rw-r--r-- | usr.bin/cvs/util.c | 21 | ||||
-rw-r--r-- | usr.bin/cvs/util.h | 3 |
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 */ |