Home
       fix whitespace - bsleep - Unnamed repository; edit this file 'description' to name the repository.
   DIR Log
   DIR Files
   DIR Refs
   DIR README
   DIR LICENSE
       ---
   DIR commit c712326312e6d2d51d99397d25ea9d1e137ff760
   DIR parent 93eeaeaabcd36f08039ac5ea94ea7e309f2eccb0
  HTML Author: kroovy <me@kroovy.de>
       Date:   Tue, 25 Feb 2025 00:32:16 +0100
       
       fix whitespace
       
       Diffstat:
         M bsleep.c                            |      29 ++++++++++++++---------------
       
       1 file changed, 14 insertions(+), 15 deletions(-)
       ---
   DIR diff --git a/bsleep.c b/bsleep.c
       @@ -8,23 +8,22 @@
        int
        main(void)
        {
       -        int i;
       +        int i;
                int *shared_memory = mmap(NULL, sizeof(char), PROT_READ | PROT_WRITE, MAP_SHARED | MAP_ANONYMOUS, -1, 0);
       -
       -        pid_t pid = fork();
       -
       +        pid_t pid = fork();
       +                
                if (pid == 0) {
       -                /* CHILD */
       -                for (i=1;;i++) {
       -                        printf("\r[ press 'b' to interrupt: %ds ] [ '%c' was pressed ] ", i, *shared_memory); fflush(stdout);
       -                        sleep(1);
       -                }
       +                /* CHILD */
       +                for (i=1;;i++) {
       +                        printf("\r[ press 'b' to interrupt: %ds ] [ '%c' was pressed ] ", i, *shared_memory); fflush(stdout);
       +                        sleep(1);
       +                }
                } else {
       -                /* PARENT */
       -                system("/bin/stty raw -echo");
       -                while ((*shared_memory = getchar()) != 'b');
       +                /* PARENT */
       +                system("/bin/stty raw -echo");
       +                while ((*shared_memory = getchar()) != 'b');
                        kill(pid, SIGKILL);
       -                system("/bin/stty cooked echo");
       -                printf("\n");
       -        }
       +                system("/bin/stty cooked echo");
       +                printf("\n");
       +        }
        }