tCan now output a new line after each scroll step - 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 90d79c5a47a33f322aa8a376816dde11ce8ff1f7
 (DIR) parent 39c8d624a1306f052a5a57d005ea7046f91028ab
 (HTM) Author: z3bra <willy@mailoo.org>
       Date:   Wed, 26 Mar 2014 13:39:33 +0100
       
       Can now output a new line after each scroll step
       
       Diffstat:
         M skroll.1                            |       8 +++++---
         M skroll.c                            |       8 ++++++--
       
       2 files changed, 11 insertions(+), 5 deletions(-)
       ---
 (DIR) diff --git a/skroll.1 b/skroll.1
       t@@ -3,20 +3,22 @@
        skroll - make a given text scroll
        .SH SYNOPSIS
        .B skroll
       -.RI [\| \-hl\| ]\ [\| -n\ num\| ]\ [\| -d\ delay\| ]
       +.RI [\| \-hlr\| ]\ [\| -n\ num\| ]\ [\| -d\ delay\| ]
        .SH DESCRIPTION
        .PP
        .B skroll
        reads text on stdin and make it scroll to stdout
        .TP
       +.B \-d delay
       +Make scroll steps last <delay> seconds
        .B \-h
        Display a help text
        .B \-l
        Loop text forever
        .B \-n num
        Show <num> char at a time
       -.B \-d delay
       -Make scroll steps last <delay> seconds
       +.B \-r
       +Output a new line after each step
        .SH BUGS
        .PP
        No bugs known actually. Feel free to report them at willy@mailoo.org
 (DIR) diff --git a/skroll.c b/skroll.c
       t@@ -24,6 +24,7 @@
        
        #define BUFFER_SIZE 512
        
       +static bool newline = false;/* print a new line after each step */
        static bool loop = false;   /* wether to loop text or not */
        static float delay = 1;     /* scroll speed, in usec */
        static int number = 10;     /* number of chars to be shown at the same time */
       t@@ -60,6 +61,8 @@ void skroll (const char *input)
                    zero_fill(&buf, number);
                    printf("\r%s", buf);
        
       +            if (newline) putc('\n', stdout);
       +
                    fflush(stdout);
                    usleep(delay*1000000);
                }
       t@@ -91,14 +94,15 @@ int main (int argc, char **argv)
            char ch;
            const char *buf = NULL;
        
       -    while ( (ch = getopt(argc, argv, "hd:ln:")) != -1 ) {
       +    while ( (ch = getopt(argc, argv, "hd:ln:r")) != -1 ) {
                switch (ch) {
                    case 'h':
       -                printf("usage: %s [-hl] [-d delay] [-n number]", argv[0]);
       +                printf("usage: %s [-hlr] [-d delay] [-n number]", argv[0]);
                        break;
                    case 'd': delay = strtof(optarg, NULL); break;
                    case 'n': number = strtoul(optarg, NULL, 10); break;
                    case 'l': loop = true; break;
       +            case 'r': newline = true; break;
                }
            }