util.c (228763) | util.c (228776) |
---|---|
1/*- 2 * Copyright (c) 2003-2007 Tim Kientzle 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 10 unchanged lines hidden (view full) --- 19 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 20 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 21 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 23 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 */ 25 26#include "bsdtar_platform.h" | 1/*- 2 * Copyright (c) 2003-2007 Tim Kientzle 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 10 unchanged lines hidden (view full) --- 19 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 20 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 21 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 23 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 */ 25 26#include "bsdtar_platform.h" |
27__FBSDID("$FreeBSD: head/contrib/libarchive/tar/util.c 228763 2011-12-21 11:13:29Z mm $"); | 27__FBSDID("$FreeBSD: head/contrib/libarchive/tar/util.c 228776 2011-12-21 15:30:49Z mm $"); |
28 29#ifdef HAVE_SYS_STAT_H 30#include <sys/stat.h> 31#endif 32#ifdef HAVE_SYS_TYPES_H 33#include <sys/types.h> /* Linux doesn't define mode_t, etc. in sys/stat.h. */ 34#endif 35#include <ctype.h> --- 185 unchanged lines hidden (view full) --- 221 va_list ap; 222 va_start(ap, fmt); 223 vfprintf(stderr, fmt, ap); 224 va_end(ap); 225 fprintf(stderr, " (y/N)? "); 226 fflush(stderr); 227 228 l = read(2, buff, sizeof(buff) - 1); | 28 29#ifdef HAVE_SYS_STAT_H 30#include <sys/stat.h> 31#endif 32#ifdef HAVE_SYS_TYPES_H 33#include <sys/types.h> /* Linux doesn't define mode_t, etc. in sys/stat.h. */ 34#endif 35#include <ctype.h> --- 185 unchanged lines hidden (view full) --- 221 va_list ap; 222 va_start(ap, fmt); 223 vfprintf(stderr, fmt, ap); 224 va_end(ap); 225 fprintf(stderr, " (y/N)? "); 226 fflush(stderr); 227 228 l = read(2, buff, sizeof(buff) - 1); |
229 if (l <= 0) | 229 if (l < 0) { 230 fprintf(stderr, "Keyboard read failed\n"); 231 exit(1); 232 } 233 if (l == 0) |
230 return (0); 231 buff[l] = 0; 232 233 for (p = buff; *p != '\0'; p++) { 234 if (isspace((unsigned char)*p)) 235 continue; 236 switch(*p) { 237 case 'y': case 'Y': --- 322 unchanged lines hidden --- | 234 return (0); 235 buff[l] = 0; 236 237 for (p = buff; *p != '\0'; p++) { 238 if (isspace((unsigned char)*p)) 239 continue; 240 switch(*p) { 241 case 'y': case 'Y': --- 322 unchanged lines hidden --- |