Changeset 4364
- Timestamp:
- Feb 15, 2010, 10:25:30 PM (12 years ago)
- Location:
- zzuf/trunk
- Files:
-
- 9 edited
- 2 moved
Legend:
- Unmodified
- Added
- Removed
-
zzuf/trunk/.gitignore
r4279 r4364 25 25 m4/lt~obsolete.m4 26 26 src/zzuf 27 src/zz cat27 src/zzat 28 28 test/zzero 29 29 test/zznop … … 32 32 test/bug-memory 33 33 test/bug-overflow 34 doc/zz cat.134 doc/zzat.1 35 35 doc/zzuf.1 36 36 doc/libzzuf.3 -
zzuf/trunk/configure.ac
r4311 r4364 180 180 ]) 181 181 AC_CONFIG_FILES([ 182 doc/zz cat.1182 doc/zzat.1 183 183 doc/zzuf.1 184 184 doc/libzzuf.3 -
zzuf/trunk/doc/Makefile.am
r4244 r4364 1 1 # $Id: Makefile.am 871 2006-09-25 15:58:33Z sam $ 2 2 3 EXTRA_DIST = zzuf.1.in libzzuf.3.in zz cat.1.in3 EXTRA_DIST = zzuf.1.in libzzuf.3.in zzat.1.in 4 4 5 man_MANS = zzuf.1 libzzuf.3 zz cat.15 man_MANS = zzuf.1 libzzuf.3 zzat.1 6 6 -
zzuf/trunk/doc/zzat.1.in
r4358 r4364 1 .TH zz cat 1 "2010-01-07" "zzcat @PACKAGE_VERSION@"1 .TH zzat 1 "2010-01-07" "zzat @PACKAGE_VERSION@" 2 2 .SH NAME 3 zz cat \- concatenate files using different instruction sequences3 zzat \- concatenate files using different instruction sequences 4 4 .SH SYNOPSIS 5 \fBzz cat\fR [\fB\-AbdeEntTv\fR] [\fB\-r\fR \fIloops\fR]5 \fBzzat\fR [\fB\-AbdeEntTv\fR] [\fB\-r\fR \fIloops\fR] 6 6 [\fB\-x\fR \fIsequence\fR] [\fIFILE\fR]... 7 7 .br 8 \fBzz cat \-l\fR | \fB\-\-list\fR8 \fBzzat \-l\fR | \fB\-\-list\fR 9 9 .br 10 \fBzz cat \-h\fR | \fB\-\-help\fR10 \fBzzat \-h\fR | \fB\-\-help\fR 11 11 .br 12 \fBzz cat \-V\fR | \fB\-\-version\fR12 \fBzzat \-V\fR | \fB\-\-version\fR 13 13 .SH DESCRIPTION 14 14 .PP 15 The \fBzz cat\fR utility reads files sequentially, writing them to the15 The \fBzzat\fR utility reads files sequentially, writing them to the 16 16 standard output. The user can decide which sequence of library calls is 17 17 used to seek and read data. 18 18 19 \fBzz cat\fR is primarily used as a debugging tool for \fBzzuf\fR, because19 \fBzzat\fR is primarily used as a debugging tool for \fBzzuf\fR, because 20 20 it can emulate different programs' ways to read files. 21 21 .SH OPTIONS … … 70 70 using this command: 71 71 72 \fB zz cat \-l\fR72 \fB zzat \-l\fR 73 73 74 74 If no sequence is specified, the following default sequence is used: … … 89 89 Read the first 1000 bytes of f, then exit: 90 90 .PP 91 \fB zz cat \-x \(aqfread(1,1000)\(aq f\fR91 \fB zzat \-x \(aqfread(1,1000)\(aq f\fR 92 92 .PP 93 93 Read the first four bytes of f, using four different instructions: 94 94 .PP 95 \fB zz cat \-x \(aqgetc(),fgetc(),getc_unlocked(),_IO_getc()\(aq f\fR95 \fB zzat \-x \(aqgetc(),fgetc(),getc_unlocked(),_IO_getc()\(aq f\fR 96 96 .PP 97 97 Read f entirely, by calling \fBgetc()\fR repeatedly until end-of-file is 98 98 reached: 99 99 .PP 100 \fB zz cat \-x \(aqrepeat(\-1, getc(), feof(1))\(aq \fRf100 \fB zzat \-x \(aqrepeat(\-1, getc(), feof(1))\(aq \fRf 101 101 .PP 102 102 Read f entirely, in chunks of 32768 bytes until end-of-file is reached: 103 103 .PP 104 \fB zz cat \-x \(aqrepeat(\-1, fread(1,32768), feof(1))\(aq \fRf104 \fB zzat \-x \(aqrepeat(\-1, fread(1,32768), feof(1))\(aq \fRf 105 105 .\" .PP 106 106 .\" Read only odd bytes, rewind file, then read all even bytes: 107 107 .\" .PP 108 .\" \fB zz cat \-x \(aqrepeat(\-1, getc(), feof(1), fseek(1,SEEK_CUR)),108 .\" \fB zzat \-x \(aqrepeat(\-1, getc(), feof(1), fseek(1,SEEK_CUR)), 109 109 .\" \fB rewind(), 110 110 .\" \fB repeat(\-1, fseek(1,SEEK_CUR), getc(), feof(1))\(aq … … 116 116 Copyright \(co 2002\-2010 Sam Hocevar <sam@hocevar.net>. 117 117 .PP 118 \fBzz cat\fR and this manual page are free software. They come without any118 \fBzzat\fR and this manual page are free software. They come without any 119 119 warranty, to the extent permitted by applicable law. You can redistribute 120 120 them and/or modify them under the terms of the Do What The Fuck You Want -
zzuf/trunk/doc/zzuf.1.in
r4308 r4364 455 455 .SH SEE ALSO 456 456 .PP 457 \fBlibzzuf(3)\fR, \fBzz cat(1)\fR457 \fBlibzzuf(3)\fR, \fBzzat(1)\fR 458 458 .SH AUTHOR 459 459 .PP -
zzuf/trunk/src/Makefile.am
r4253 r4364 1 1 2 bin_PROGRAMS = zzuf zz cat2 bin_PROGRAMS = zzuf zzat 3 3 pkglib_LTLIBRARIES = libzzuf.la 4 4 … … 6 6 zzuf.c opts.c opts.h md5.c md5.h timer.c timer.h myfork.c myfork.h 7 7 8 ZZ CAT = \9 zz cat.c8 ZZAT = \ 9 zzat.c 10 10 11 11 LIBZZUF = \ … … 33 33 zzuf_DEPENDENCIES = libzzuf.la 34 34 35 zz cat_SOURCES = $(ZZCAT) $(GETOPT)35 zzat_SOURCES = $(ZZAT) $(GETOPT) 36 36 37 37 libzzuf_la_SOURCES = $(LIBZZUF) $(COMMON) -
zzuf/trunk/src/zzat.c
r4358 r4364 1 1 /* 2 * zz cat - various cat reimplementations for testing purposes2 * zzat - various cat reimplementations for testing purposes 3 3 * Copyright (c) 2006-2010 Sam Hocevar <sam@hocevar.net> 4 4 * All Rights Reserved … … 173 173 if (myoptind >= argc) 174 174 { 175 fprintf(stderr, "E: zz cat: too few arguments\n");175 fprintf(stderr, "E: zzat: too few arguments\n"); 176 176 return EXIT_FAILURE; 177 177 } … … 260 260 if (!f) \ 261 261 { \ 262 fprintf(stderr, "E: zz cat: cannot open `%s'\n", file); \262 fprintf(stderr, "E: zzat: cannot open `%s'\n", file); \ 263 263 return EXIT_FAILURE; \ 264 264 } \ … … 285 285 { \ 286 286 if (debug) \ 287 fprintf(stderr, "D: zz cat: allocating %i bytes for %i\n", \287 fprintf(stderr, "D: zzat: allocating %i bytes for %i\n", \ 288 288 (int)ROUNDUP(retlen), (int)retlen); \ 289 289 retbuf = realloc(retbuf, ROUNDUP(retlen)); \ … … 293 293 { \ 294 294 if (debug) \ 295 fprintf(stderr, "D: zz cat: writing %i byte%s at offset %i\n", \295 fprintf(stderr, "D: zzat: writing %i byte%s at offset %i\n", \ 296 296 (int)_cnt, _cnt == 1 ? "" : "s", (int)retoff); \ 297 297 memcpy(retbuf + retoff, address, _cnt); \ … … 310 310 if (!f) \ 311 311 { \ 312 fprintf(stderr, "E: zz cat: cannot open `%s'\n", file); \312 fprintf(stderr, "E: zzat: cannot open `%s'\n", file); \ 313 313 return EXIT_FAILURE; \ 314 314 } \ … … 327 327 if (!f) \ 328 328 { \ 329 fprintf(stderr, "E: zz cat: cannot open `%s'\n", file); \329 fprintf(stderr, "E: zzat: cannot open `%s'\n", file); \ 330 330 return EXIT_FAILURE; \ 331 331 } \ … … 423 423 if (nloops == 0) 424 424 { 425 fprintf(stderr, "E: zz cat: ')' outside a loop\n");425 fprintf(stderr, "E: zzat: ')' outside a loop\n"); 426 426 return EXIT_FAILURE; 427 427 } … … 573 573 snprintf(buf, 16, strlen(sequence) < 16 ? "%s" : "%.12s...", 574 574 sequence); 575 fprintf(stderr, "E: zz cat: syntax error near `%s'\n", buf);575 fprintf(stderr, "E: zzat: syntax error near `%s'\n", buf); 576 576 return EXIT_FAILURE; 577 577 } … … 600 600 #if 0 601 601 /* Only read() calls */ 602 static int zz cat_read(char const *name, unsigned char *data, int64_t len,602 static int zzat_read(char const *name, unsigned char *data, int64_t len, 603 603 int64_t chunk) 604 604 { … … 613 613 614 614 /* Socket seeks and reads */ 615 static int zz cat_random_socket(char const *name, unsigned char *data,615 static int zzat_random_socket(char const *name, unsigned char *data, 616 616 int64_t len) 617 617 { … … 635 635 636 636 /* Standard stream seeks and reads */ 637 static int zz cat_random_stream(char const *name, unsigned char *data,637 static int zzat_random_stream(char const *name, unsigned char *data, 638 638 int64_t len) 639 639 { … … 663 663 #ifdef HAVE_MMAP 664 664 /* mmap() followed by random memory reads */ 665 static int zz cat_random_mmap(char const *name, unsigned char *data,666 665 static int zzat_random_mmap(char const *name, unsigned char *data, 666 int64_t len) 667 667 { 668 668 int i, j, fd = open(name, O_RDONLY); … … 788 788 static void version(void) 789 789 { 790 printf("zz cat %s\n", PACKAGE_VERSION);790 printf("zzat %s\n", PACKAGE_VERSION); 791 791 printf("Copyright (C) 2002-2010 Sam Hocevar <sam@hocevar.net>\n"); 792 792 printf("This program is free software. It comes without any warranty, to the extent\n"); … … 800 800 static void usage(void) 801 801 { 802 printf("Usage: zz cat [AbdeEntTv] [-x sequence] [FILE...]\n");803 printf(" zz cat -l | --list\n");804 printf(" zz cat -h | --help\n");805 printf(" zz cat -V | --version\n");802 printf("Usage: zzat [AbdeEntTv] [-x sequence] [FILE...]\n"); 803 printf(" zzat -l | --list\n"); 804 printf(" zzat -h | --help\n"); 805 printf(" zzat -V | --version\n"); 806 806 printf("Read FILE using a sequence of various I/O methods.\n"); 807 807 printf("\n"); -
zzuf/trunk/test/check-utils
r4287 r4364 14 14 . "$(dirname "$0")/functions.inc" 15 15 16 HAVE_GETLINE=$("$ZZ CAT" -l | grep >/dev/null 2>&1 '^ getline(' && echo "y")17 HAVE_GETDELIM=$("$ZZ CAT" -l | grep >/dev/null 2>&1 '^ getdelim(' && echo "y")18 HAVE_GETC_UNLOCKED=$("$ZZ CAT" -l | grep >/dev/null 2>&1 '^ getc_unlocked(' && echo "y")19 HAVE_FGETC_UNLOCKED=$("$ZZ CAT" -l | grep >/dev/null 2>&1 '^ fgetc_unlocked(' && echo "y")16 HAVE_GETLINE=$("$ZZAT" -l | grep >/dev/null 2>&1 '^ getline(' && echo "y") 17 HAVE_GETDELIM=$("$ZZAT" -l | grep >/dev/null 2>&1 '^ getdelim(' && echo "y") 18 HAVE_GETC_UNLOCKED=$("$ZZAT" -l | grep >/dev/null 2>&1 '^ getc_unlocked(' && echo "y") 19 HAVE_FGETC_UNLOCKED=$("$ZZAT" -l | grep >/dev/null 2>&1 '^ fgetc_unlocked(' && echo "y") 20 20 21 21 checkutils() … … 71 71 esac 72 72 # Regression tests for stuff that used to break 73 check "$ZZOPTS" "$ZZ CAT -x \"fread(1,33000) fseek(1,SEEK_SET) fread(1,1) fseek(4093,SEEK_CUR) fread(1,1) fseek(1,SEEK_CUR) fread(1,1)\" $file" \73 check "$ZZOPTS" "$ZZAT -x \"fread(1,33000) fseek(1,SEEK_SET) fread(1,1) fseek(4093,SEEK_CUR) fread(1,1) fseek(1,SEEK_CUR) fread(1,1)\" $file" \ 74 74 "eglibc (2.9-21) bug regression" 75 75 if [ "$HAVE_GET_UNLOCKED $HAVE_GETLINE" = "y y" ]; then 76 check "$ZZOPTS" "$ZZ CAT -x \"repeat(33000,getc_unlocked(),feof(10),ungetc(),getline()))\" $file" \76 check "$ZZOPTS" "$ZZAT -x \"repeat(33000,getc_unlocked(),feof(10),ungetc(),getline()))\" $file" \ 77 77 "sed getc_unlocked() bug regression" 78 78 fi … … 100 100 "fread(1,33000) fseek(1000,SEEK_CUR) repeat(-1,fgetc(),feof(10))" \ 101 101 ; do 102 check "$ZZOPTS" "$ZZ CAT -x \"$n\" $file" "$n"102 check "$ZZOPTS" "$ZZAT -x \"$n\" $file" "$n" 103 103 done 104 104 # Platform-specific tests … … 109 109 "repeat(-1,fgetc(),feof(10),ungetc(),getline())" \ 110 110 ; do 111 check "$ZZOPTS" "$ZZ CAT -x \"$n\" $file" "$n"111 check "$ZZOPTS" "$ZZAT -x \"$n\" $file" "$n" 112 112 done 113 113 fi … … 117 117 "repeat(10,getdelim(' ')) fread(1,33000)" \ 118 118 ; do 119 check "$ZZOPTS" "$ZZ CAT -x \"$n\" $file" "$n"119 check "$ZZOPTS" "$ZZAT -x \"$n\" $file" "$n" 120 120 done 121 121 fi … … 128 128 "fread(1,33000) fseek(1000,SEEK_CUR) repeat(-1,getc_unlocked(),feof(10))" \ 129 129 ; do 130 check "$ZZOPTS" "$ZZ CAT -x \"$n\" $file" "$n"130 check "$ZZOPTS" "$ZZAT -x \"$n\" $file" "$n" 131 131 done 132 132 fi … … 138 138 "repeat(8000,fgetc_unlocked()) fread(1,33000)" \ 139 139 ; do 140 check "$ZZOPTS" "$ZZ CAT -x \"$n\" $file" "$n"140 check "$ZZOPTS" "$ZZAT -x \"$n\" $file" "$n" 141 141 done 142 142 fi -
zzuf/trunk/test/check-zzuf-A-autoinc
r4272 r4364 17 17 18 18 # Check -A with no fuzzing: output must match 19 new_test "zzuf -A -r0 zz cat file-random file-random"20 m1=$($ZZUF -m -r0 $ZZ CAT "$DIR/file-random" "$DIR/file-random" | cut -f2 -d' ')21 m2=$($ZZUF -m -A -r0 $ZZ CAT "$DIR/file-random" "$DIR/file-random" | cut -f2 -d' ')19 new_test "zzuf -A -r0 zzat file-random file-random" 20 m1=$($ZZUF -m -r0 $ZZAT "$DIR/file-random" "$DIR/file-random" | cut -f2 -d' ') 21 m2=$($ZZUF -m -A -r0 $ZZAT "$DIR/file-random" "$DIR/file-random" | cut -f2 -d' ') 22 22 if [ "$m1" = "$m2" ]; then 23 23 pass_test "ok" … … 27 27 28 28 # Check -A with fuzzing: output must be different 29 new_test "zzuf -A -r0.1 zz cat file-random file-random"30 m1=$($ZZUF -m -r0.1 $ZZ CAT "$DIR/file-random" "$DIR/file-random" | cut -f2 -d' ')31 m2=$($ZZUF -m -A -r0.1 $ZZ CAT "$DIR/file-random" "$DIR/file-random" | cut -f2 -d' ')29 new_test "zzuf -A -r0.1 zzat file-random file-random" 30 m1=$($ZZUF -m -r0.1 $ZZAT "$DIR/file-random" "$DIR/file-random" | cut -f2 -d' ') 31 m2=$($ZZUF -m -A -r0.1 $ZZAT "$DIR/file-random" "$DIR/file-random" | cut -f2 -d' ') 32 32 if [ "$m1" != "$m2" ]; then 33 33 pass_test "ok" -
zzuf/trunk/test/check-zzuf-s-seed
r4281 r4364 32 32 while test $zeroes -gt 0 -a $passes -lt 200000; do 33 33 printf " doing $passes passes..." 34 zeroes=$($ZZUF -r $ratio -s $seed -A $ZZ CAT -r $passes -x "fread(1,$bytes)" /dev/zero | $DIR/zzone $bytes $passes)34 zeroes=$($ZZUF -r $ratio -s $seed -A $ZZAT -r $passes -x "fread(1,$bytes)" /dev/zero | $DIR/zzone $bytes $passes) 35 35 echo " $zeroes" 36 36 passes=$(expr '(' $passes '*' 7 + 3 ')' / 4) -
zzuf/trunk/test/functions.inc
r4287 r4364 16 16 ZZUF="$DIR/../src/zzuf -E [.]ilist$" 17 17 18 ZZ CAT="$DIR/../src/zzcat"19 if [ ! -f "$ZZ CAT" ]; then20 echo "error: src/zz cat is missing"18 ZZAT="$DIR/../src/zzat" 19 if [ ! -f "$ZZAT" ]; then 20 echo "error: src/zzat is missing" 21 21 exit 1 22 22 fi
Note: See TracChangeset
for help on using the changeset viewer.