Changeset 4364 for zzuf


Ignore:
Timestamp:
Feb 15, 2010, 10:25:30 PM (10 years ago)
Author:
Sam Hocevar
Message:

Rename zzcat to zzat to avoid conflicts with zziplib.

Location:
zzuf/trunk
Files:
9 edited
2 moved

Legend:

Unmodified
Added
Removed
  • zzuf/trunk/.gitignore

    r4279 r4364  
    2525m4/lt~obsolete.m4
    2626src/zzuf
    27 src/zzcat
     27src/zzat
    2828test/zzero
    2929test/zznop
     
    3232test/bug-memory
    3333test/bug-overflow
    34 doc/zzcat.1
     34doc/zzat.1
    3535doc/zzuf.1
    3636doc/libzzuf.3
  • zzuf/trunk/configure.ac

    r4311 r4364  
    180180])
    181181AC_CONFIG_FILES([
    182   doc/zzcat.1
     182  doc/zzat.1
    183183  doc/zzuf.1
    184184  doc/libzzuf.3
  • zzuf/trunk/doc/Makefile.am

    r4244 r4364  
    11# $Id: Makefile.am 871 2006-09-25 15:58:33Z sam $
    22
    3 EXTRA_DIST = zzuf.1.in libzzuf.3.in zzcat.1.in
     3EXTRA_DIST = zzuf.1.in libzzuf.3.in zzat.1.in
    44
    5 man_MANS = zzuf.1 libzzuf.3 zzcat.1
     5man_MANS = zzuf.1 libzzuf.3 zzat.1
    66
  • zzuf/trunk/doc/zzat.1.in

    r4358 r4364  
    1 .TH zzcat 1 "2010-01-07" "zzcat @PACKAGE_VERSION@"
     1.TH zzat 1 "2010-01-07" "zzat @PACKAGE_VERSION@"
    22.SH NAME
    3 zzcat \- concatenate files using different instruction sequences
     3zzat \- concatenate files using different instruction sequences
    44.SH SYNOPSIS
    5 \fBzzcat\fR [\fB\-AbdeEntTv\fR] [\fB\-r\fR \fIloops\fR]
     5\fBzzat\fR [\fB\-AbdeEntTv\fR] [\fB\-r\fR \fIloops\fR]
    66[\fB\-x\fR \fIsequence\fR] [\fIFILE\fR]...
    77.br
    8 \fBzzcat \-l\fR | \fB\-\-list\fR
     8\fBzzat \-l\fR | \fB\-\-list\fR
    99.br
    10 \fBzzcat \-h\fR | \fB\-\-help\fR
     10\fBzzat \-h\fR | \fB\-\-help\fR
    1111.br
    12 \fBzzcat \-V\fR | \fB\-\-version\fR
     12\fBzzat \-V\fR | \fB\-\-version\fR
    1313.SH DESCRIPTION
    1414.PP
    15 The \fBzzcat\fR utility reads files sequentially, writing them to the
     15The \fBzzat\fR utility reads files sequentially, writing them to the
    1616standard output. The user can decide which sequence of library calls is
    1717used to seek and read data.
    1818
    19 \fBzzcat\fR is primarily used as a debugging tool for \fBzzuf\fR, because
     19\fBzzat\fR is primarily used as a debugging tool for \fBzzuf\fR, because
    2020it can emulate different programs' ways to read files.
    2121.SH OPTIONS
     
    7070using this command:
    7171
    72 \fB    zzcat \-l\fR
     72\fB    zzat \-l\fR
    7373
    7474If no sequence is specified, the following default sequence is used:
     
    8989Read the first 1000 bytes of f, then exit:
    9090.PP
    91 \fB    zzcat \-x \(aqfread(1,1000)\(aq f\fR
     91\fB    zzat \-x \(aqfread(1,1000)\(aq f\fR
    9292.PP
    9393Read the first four bytes of f, using four different instructions:
    9494.PP
    95 \fB    zzcat \-x \(aqgetc(),fgetc(),getc_unlocked(),_IO_getc()\(aq f\fR
     95\fB    zzat \-x \(aqgetc(),fgetc(),getc_unlocked(),_IO_getc()\(aq f\fR
    9696.PP
    9797Read f entirely, by calling \fBgetc()\fR repeatedly until end-of-file is
    9898reached:
    9999.PP
    100 \fB    zzcat \-x \(aqrepeat(\-1, getc(), feof(1))\(aq \fRf
     100\fB    zzat \-x \(aqrepeat(\-1, getc(), feof(1))\(aq \fRf
    101101.PP
    102102Read f entirely, in chunks of 32768 bytes until end-of-file is reached:
    103103.PP
    104 \fB    zzcat \-x \(aqrepeat(\-1, fread(1,32768), feof(1))\(aq \fRf
     104\fB    zzat \-x \(aqrepeat(\-1, fread(1,32768), feof(1))\(aq \fRf
    105105.\" .PP
    106106.\" Read only odd bytes, rewind file, then read all even bytes:
    107107.\" .PP
    108 .\" \fB    zzcat \-x \(aqrepeat(\-1, getc(), feof(1), fseek(1,SEEK_CUR)),
     108.\" \fB    zzat \-x \(aqrepeat(\-1, getc(), feof(1), fseek(1,SEEK_CUR)),
    109109.\" \fB              rewind(),
    110110.\" \fB              repeat(\-1, fseek(1,SEEK_CUR), getc(), feof(1))\(aq
     
    116116Copyright \(co 2002\-2010 Sam Hocevar <sam@hocevar.net>.
    117117.PP
    118 \fBzzcat\fR and this manual page are free software. They come without any
     118\fBzzat\fR and this manual page are free software. They come without any
    119119warranty, to the extent permitted by applicable law. You can redistribute
    120120them and/or modify them under the terms of the Do What The Fuck You Want
  • zzuf/trunk/doc/zzuf.1.in

    r4308 r4364  
    455455.SH SEE ALSO
    456456.PP
    457 \fBlibzzuf(3)\fR, \fBzzcat(1)\fR
     457\fBlibzzuf(3)\fR, \fBzzat(1)\fR
    458458.SH AUTHOR
    459459.PP
  • zzuf/trunk/src/Makefile.am

    r4253 r4364  
    11
    2 bin_PROGRAMS = zzuf zzcat
     2bin_PROGRAMS = zzuf zzat
    33pkglib_LTLIBRARIES = libzzuf.la
    44
     
    66    zzuf.c opts.c opts.h md5.c md5.h timer.c timer.h myfork.c myfork.h
    77
    8 ZZCAT = \
    9     zzcat.c
     8ZZAT = \
     9    zzat.c
    1010
    1111LIBZZUF = \
     
    3333zzuf_DEPENDENCIES = libzzuf.la
    3434
    35 zzcat_SOURCES = $(ZZCAT) $(GETOPT)
     35zzat_SOURCES = $(ZZAT) $(GETOPT)
    3636
    3737libzzuf_la_SOURCES = $(LIBZZUF) $(COMMON)
  • zzuf/trunk/src/zzat.c

    r4358 r4364  
    11/*
    2  *  zzcat - various cat reimplementations for testing purposes
     2 *  zzat - various cat reimplementations for testing purposes
    33 *  Copyright (c) 2006-2010 Sam Hocevar <sam@hocevar.net>
    44 *                All Rights Reserved
     
    173173    if (myoptind >= argc)
    174174    {
    175         fprintf(stderr, "E: zzcat: too few arguments\n");
     175        fprintf(stderr, "E: zzat: too few arguments\n");
    176176        return EXIT_FAILURE;
    177177    }
     
    260260        if (!f) \
    261261        { \
    262             fprintf(stderr, "E: zzcat: cannot open `%s'\n", file); \
     262            fprintf(stderr, "E: zzat: cannot open `%s'\n", file); \
    263263            return EXIT_FAILURE; \
    264264        } \
     
    285285            { \
    286286                if (debug) \
    287                     fprintf(stderr, "D: zzcat: allocating %i bytes for %i\n", \
     287                    fprintf(stderr, "D: zzat: allocating %i bytes for %i\n", \
    288288                            (int)ROUNDUP(retlen), (int)retlen); \
    289289                retbuf = realloc(retbuf, ROUNDUP(retlen)); \
     
    293293        { \
    294294            if (debug) \
    295                 fprintf(stderr, "D: zzcat: writing %i byte%s at offset %i\n", \
     295                fprintf(stderr, "D: zzat: writing %i byte%s at offset %i\n", \
    296296                        (int)_cnt, _cnt == 1 ? "" : "s", (int)retoff); \
    297297            memcpy(retbuf + retoff, address, _cnt); \
     
    310310            if (!f) \
    311311            { \
    312                 fprintf(stderr, "E: zzcat: cannot open `%s'\n", file); \
     312                fprintf(stderr, "E: zzat: cannot open `%s'\n", file); \
    313313                return EXIT_FAILURE; \
    314314            } \
     
    327327            if (!f) \
    328328            { \
    329                 fprintf(stderr, "E: zzcat: cannot open `%s'\n", file); \
     329                fprintf(stderr, "E: zzat: cannot open `%s'\n", file); \
    330330                return EXIT_FAILURE; \
    331331            } \
     
    423423            if (nloops == 0)
    424424            {
    425                 fprintf(stderr, "E: zzcat: ')' outside a loop\n");
     425                fprintf(stderr, "E: zzat: ')' outside a loop\n");
    426426                return EXIT_FAILURE;
    427427            }
     
    573573            snprintf(buf, 16, strlen(sequence) < 16 ? "%s" : "%.12s...",
    574574                     sequence);
    575             fprintf(stderr, "E: zzcat: syntax error near `%s'\n", buf);
     575            fprintf(stderr, "E: zzat: syntax error near `%s'\n", buf);
    576576            return EXIT_FAILURE;
    577577        }
     
    600600#if 0
    601601/* Only read() calls */
    602 static int zzcat_read(char const *name, unsigned char *data, int64_t len,
     602static int zzat_read(char const *name, unsigned char *data, int64_t len,
    603603                      int64_t chunk)
    604604{
     
    613613
    614614/* Socket seeks and reads */
    615 static int zzcat_random_socket(char const *name, unsigned char *data,
     615static int zzat_random_socket(char const *name, unsigned char *data,
    616616                               int64_t len)
    617617{
     
    635635
    636636/* Standard stream seeks and reads */
    637 static int zzcat_random_stream(char const *name, unsigned char *data,
     637static int zzat_random_stream(char const *name, unsigned char *data,
    638638                               int64_t len)
    639639{
     
    663663#ifdef HAVE_MMAP
    664664/* mmap() followed by random memory reads */
    665 static int zzcat_random_mmap(char const *name, unsigned char *data,
    666                                int64_t len)
     665static int zzat_random_mmap(char const *name, unsigned char *data,
     666                            int64_t len)
    667667{
    668668    int i, j, fd = open(name, O_RDONLY);
     
    788788static void version(void)
    789789{
    790     printf("zzcat %s\n", PACKAGE_VERSION);
     790    printf("zzat %s\n", PACKAGE_VERSION);
    791791    printf("Copyright (C) 2002-2010 Sam Hocevar <sam@hocevar.net>\n");
    792792    printf("This program is free software. It comes without any warranty, to the extent\n");
     
    800800static void usage(void)
    801801{
    802     printf("Usage: zzcat [AbdeEntTv] [-x sequence] [FILE...]\n");
    803     printf("       zzcat -l | --list\n");
    804     printf("       zzcat -h | --help\n");
    805     printf("       zzcat -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");
    806806    printf("Read FILE using a sequence of various I/O methods.\n");
    807807    printf("\n");
  • zzuf/trunk/test/check-utils

    r4287 r4364  
    1414. "$(dirname "$0")/functions.inc"
    1515
    16 HAVE_GETLINE=$("$ZZCAT" -l | grep >/dev/null 2>&1 '^  getline(' && echo "y")
    17 HAVE_GETDELIM=$("$ZZCAT" -l | grep >/dev/null 2>&1 '^  getdelim(' && echo "y")
    18 HAVE_GETC_UNLOCKED=$("$ZZCAT" -l | grep >/dev/null 2>&1 '^  getc_unlocked(' && echo "y")
    19 HAVE_FGETC_UNLOCKED=$("$ZZCAT" -l | grep >/dev/null 2>&1 '^  fgetc_unlocked(' && echo "y")
     16HAVE_GETLINE=$("$ZZAT" -l | grep >/dev/null 2>&1 '^  getline(' && echo "y")
     17HAVE_GETDELIM=$("$ZZAT" -l | grep >/dev/null 2>&1 '^  getdelim(' && echo "y")
     18HAVE_GETC_UNLOCKED=$("$ZZAT" -l | grep >/dev/null 2>&1 '^  getc_unlocked(' && echo "y")
     19HAVE_FGETC_UNLOCKED=$("$ZZAT" -l | grep >/dev/null 2>&1 '^  fgetc_unlocked(' && echo "y")
    2020
    2121checkutils()
     
    7171        esac
    7272        # Regression tests for stuff that used to break
    73         check "$ZZOPTS" "$ZZCAT -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" \
    7474              "eglibc (2.9-21) bug regression"
    7575        if [ "$HAVE_GET_UNLOCKED $HAVE_GETLINE" = "y y" ]; then
    76           check "$ZZOPTS" "$ZZCAT -x \"repeat(33000,getc_unlocked(),feof(10),ungetc(),getline()))\" $file" \
     76          check "$ZZOPTS" "$ZZAT -x \"repeat(33000,getc_unlocked(),feof(10),ungetc(),getline()))\" $file" \
    7777                "sed getc_unlocked() bug regression"
    7878        fi
     
    100100          "fread(1,33000) fseek(1000,SEEK_CUR) repeat(-1,fgetc(),feof(10))" \
    101101          ; do
    102             check "$ZZOPTS" "$ZZCAT -x \"$n\" $file" "$n"
     102            check "$ZZOPTS" "$ZZAT -x \"$n\" $file" "$n"
    103103        done
    104104        # Platform-specific tests
     
    109109              "repeat(-1,fgetc(),feof(10),ungetc(),getline())" \
    110110              ; do
    111                 check "$ZZOPTS" "$ZZCAT -x \"$n\" $file" "$n"
     111                check "$ZZOPTS" "$ZZAT -x \"$n\" $file" "$n"
    112112            done
    113113        fi
     
    117117              "repeat(10,getdelim(' ')) fread(1,33000)" \
    118118              ; do
    119                 check "$ZZOPTS" "$ZZCAT -x \"$n\" $file" "$n"
     119                check "$ZZOPTS" "$ZZAT -x \"$n\" $file" "$n"
    120120            done
    121121        fi
     
    128128              "fread(1,33000) fseek(1000,SEEK_CUR) repeat(-1,getc_unlocked(),feof(10))" \
    129129              ; do
    130                 check "$ZZOPTS" "$ZZCAT -x \"$n\" $file" "$n"
     130                check "$ZZOPTS" "$ZZAT -x \"$n\" $file" "$n"
    131131            done
    132132        fi
     
    138138              "repeat(8000,fgetc_unlocked()) fread(1,33000)" \
    139139              ; do
    140                 check "$ZZOPTS" "$ZZCAT -x \"$n\" $file" "$n"
     140                check "$ZZOPTS" "$ZZAT -x \"$n\" $file" "$n"
    141141            done
    142142        fi
  • zzuf/trunk/test/check-zzuf-A-autoinc

    r4272 r4364  
    1717
    1818# Check -A with no fuzzing: output must match
    19 new_test "zzuf -A -r0 zzcat file-random file-random"
    20 m1=$($ZZUF -m -r0 $ZZCAT "$DIR/file-random" "$DIR/file-random" | cut -f2 -d' ')
    21 m2=$($ZZUF -m -A -r0 $ZZCAT "$DIR/file-random" "$DIR/file-random" | cut -f2 -d' ')
     19new_test "zzuf -A -r0 zzat file-random file-random"
     20m1=$($ZZUF -m -r0 $ZZAT "$DIR/file-random" "$DIR/file-random" | cut -f2 -d' ')
     21m2=$($ZZUF -m -A -r0 $ZZAT "$DIR/file-random" "$DIR/file-random" | cut -f2 -d' ')
    2222if [ "$m1" = "$m2" ]; then
    2323    pass_test "ok"
     
    2727
    2828# Check -A with fuzzing: output must be different
    29 new_test "zzuf -A -r0.1 zzcat file-random file-random"
    30 m1=$($ZZUF -m -r0.1 $ZZCAT "$DIR/file-random" "$DIR/file-random" | cut -f2 -d' ')
    31 m2=$($ZZUF -m -A -r0.1 $ZZCAT "$DIR/file-random" "$DIR/file-random" | cut -f2 -d' ')
     29new_test "zzuf -A -r0.1 zzat file-random file-random"
     30m1=$($ZZUF -m -r0.1 $ZZAT "$DIR/file-random" "$DIR/file-random" | cut -f2 -d' ')
     31m2=$($ZZUF -m -A -r0.1 $ZZAT "$DIR/file-random" "$DIR/file-random" | cut -f2 -d' ')
    3232if [ "$m1" != "$m2" ]; then
    3333    pass_test "ok"
  • zzuf/trunk/test/check-zzuf-s-seed

    r4281 r4364  
    3232  while test $zeroes -gt 0 -a $passes -lt 200000; do
    3333    printf " doing $passes passes..."
    34     zeroes=$($ZZUF -r $ratio -s $seed -A $ZZCAT -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)
    3535    echo " $zeroes"
    3636    passes=$(expr '(' $passes '*' 7 + 3 ')' / 4)
  • zzuf/trunk/test/functions.inc

    r4287 r4364  
    1616ZZUF="$DIR/../src/zzuf -E [.]ilist$"
    1717
    18 ZZCAT="$DIR/../src/zzcat"
    19 if [ ! -f "$ZZCAT" ]; then
    20   echo "error: src/zzcat is missing"
     18ZZAT="$DIR/../src/zzat"
     19if [ ! -f "$ZZAT" ]; then
     20  echo "error: src/zzat is missing"
    2121  exit 1
    2222fi
Note: See TracChangeset for help on using the changeset viewer.