💾 Archived View for gmi.noulin.net › gitRepositories › playStdin › file › playStdin.c.gmi captured on 2023-01-29 at 13:20:00. Gemini links have been rewritten to link to archived content

View Raw

More Information

-=-=-=-=-=-=-

playStdin

Log

Files

Refs

LICENSE

playStdin.c (655B)

     1 #! /usr/bin/env sheepy
     2 
     3 #include "libsheepyObject.h"
     4 
     5 int main(int ARGC, char** ARGV) {
     6 
     7     if (ARGC < 2) {
     8         puts(BLD RED "Missing record name!" RST);
     9         XFAILURE
    10     }
    11 
    12     FILE *f = fopen(ARGV[1], "r");
    13     if (!f) {
    14         puts(BLD RED "Couldn't open record file!" RST);
    15         XFAILURE
    16     }
    17 
    18     char b[2*1024*1024];
    19     while (fgets(b, sizeof b, f)) {
    20         char **l = split(b, ",");
    21         char *timeS = dequeueG(&l, unusedV);
    22         char *s  = join(l, ",");
    23         freeG(l);
    24 
    25         printf("%s", s);
    26 
    27         u64 time = parseInt(timeS);
    28         nanoSleep(time * 1000000); 
    29 
    30         freeManyS(timeS, s);
    31     }
    32     fclose(f);
    33 }