Edit

kc3-lang/linenoise/example.c

Branch :

  • Show log

    Commit

  • Author : antirez
    Date : 2010-03-22 17:24:28
    Hash : 2c54c88c
    Message : API converted to be readline alike. Ctrl-d behavior fixed.

  • example.c
  • #include <stdio.h>
    #include <stdlib.h>
    #include "linenoise.h"
    
    int main(void) {
        char *line;
    
        while((line = linenoise("hello> ")) != NULL) {
            if (line[0] != '\0') {
                printf("echo: '%s'\n", line);
                linenoiseHistoryAdd(line);
            }
            free(line);
        }
        return 0;
    }