Edit

kc3-lang/linenoise/example.c

Branch :

  • Show log

    Commit

  • Author : antirez
    Date : 2010-03-21 00:01:52
    Hash : 6de19082
    Message : first commit

  • example.c
  • #include <stdio.h>
    #include <stdlib.h>
    #include "linenoise.h"
    
    int main(void) {
        char buf[1024];
        int retval;
    
        while(1) {
            retval = linenoise(buf,1024,"hello> ");
            if (retval > 0) {
                printf("echo: '%s'\n", buf);
                linenoiseHistoryAdd(buf);
            } else if (retval == -1) {
                exit(1);
            }
        }
        return 0;
    }