Changeset 1580 for zzuf


Ignore:
Timestamp:
Jan 6, 2007, 4:54:14 PM (14 years ago)
Author:
Sam Hocevar
Message:
  • Fix fread() issue with standard input reading.
Location:
zzuf/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • zzuf/trunk/src/load-stream.c

    r1568 r1580  
    180180    {
    181181        /* XXX: the number of bytes read is not ret * size, because
    182          * a partial read may have advanced the stream pointer */
     182         * a partial read may have advanced the stream pointer. However,
     183         * when reading from a pipe ftell() will return 0, and ret * size
     184         * is then better than nothing. */
    183185        long int newpos = ftell(stream);
     186        if(newpos <= 0)
     187            newpos = ret * size;
    184188        if(newpos != pos)
    185189        {
  • zzuf/trunk/test/testsuite.sh

    r1565 r1580  
    1919    CMD="$2"
    2020    ALIAS="$3"
    21     echo -n " $(echo "$ALIAS:              " | cut -b1-15)"
     21    echo -n " $(echo "$ALIAS .............." | cut -b1-15) "
    2222    NEWMD5="$(eval "$ZZUF $ZZOPTS $CMD" 2>/dev/null | md5sum | cut -b1-32)"
    2323    if [ -z "$MD5" ]; then
     
    7070        MD5=""
    7171        check "$ZZOPTS" "cat $file" "cat"
    72         check "$ZZOPTS" "-i cat < $file" "cat stdin"
     72        check "$ZZOPTS" "-i cat < $file" "|cat"
    7373        case $file in
    7474          *text*)
     
    7777            # initially. (Linux sed doesn't, but OS X sed does.)
    7878            check "$ZZOPTS" "grep -- -a '' $file" "grep -a ''"
    79             check "$ZZOPTS" "-- sed -e n $file" "sed -e n"
    80             #check "$ZZOPTS" "-- cut -b1- $file" "cut -b1-"
     79            check "$ZZOPTS" "-i grep -- -a '' < $file" "|grep -a ''"
     80            check "$ZZOPTS" "sed -- -e n $file" "sed -e n"
     81            check "$ZZOPTS" "-i sed -- -e n < $file" "|sed -e n"
     82            #check "$ZZOPTS" "cut -- -b1- $file" "cut -b1-"
     83            #check "$ZZOPTS" "-i cut -- -b1- < $file" "|cut -b1-"
    8184            ;;
    8285        esac
Note: See TracChangeset for help on using the changeset viewer.