tRemoved a useless if() that broke the program - skroll - scroll a text to stdout
 (HTM) git clone git://z3bra.org/skroll
 (DIR) Log
 (DIR) Files
 (DIR) Refs
 (DIR) README
 (DIR) LICENSE
       ---
 (DIR) commit 023883a38d9337827af5d81c34ec7bca1c5c2763
 (DIR) parent 1a40c6b37cd6aec6c0e0694d95b2bf43a7d51a96
 (HTM) Author: z3bra <willy@mailoo.org>
       Date:   Wed,  3 Sep 2014 17:32:35 +0200
       
       Removed a useless if() that broke the program
       
       Diffstat:
         M skroll.c                            |      16 +++++++---------
       
       1 file changed, 7 insertions(+), 9 deletions(-)
       ---
 (DIR) diff --git a/skroll.c b/skroll.c
       t@@ -52,14 +52,9 @@ void zero_fill (char **str, size_t num)
            return; /* void */
        }
        
       -/* 
       - * pad a string with <num> spaces, and append chars from <str> to it, until its
       - * lenght is <len>
       - */ 
       +/* pad string <pad> string with <num> spaces and fill out to <len> with <str> */
        void zero_pad (char **pad, const char *str, size_t len, size_t num)
        {
       -    /* fill the memory with zeros */
       -    memset ( (*pad), 0, len );
        
            /* pad the string with 0x20 (space char) */
            memset ( (*pad), 0x20, num );
       t@@ -90,6 +85,10 @@ void skroll (const char *input)
        
                /* loop executed on each step, after <delay> seconds */
                while ( input[offset] != 0 ) {
       +
       +            /* fill the memory with zeros */
       +            memset ( buf, 0, number );
       +
                    /*
                     * There are two different parts: padding, and filling.
                     * padding is adding spaces at the beginning to simulate text
       t@@ -104,11 +103,10 @@ void skroll (const char *input)
                         */
                        zero_pad(&buf, input, number, padder);
                        padder--;
       -            } else
                    /* Once padding is finished, we start "hiding" text to the left */
       -            if ( offset < number ) {
       +            } else {
                        /* copy the number of char we want to the buffer */
       -                strncpy(buf, input + offset, number-1);
       +                strncpy(buf, input + offset, number);
        
                        /* fill missing chars with spaces */
                        zero_fill(&buf, number);