I'm trying to make a terminal input preprocessor with alias/shortcuts and history.

import std.stdio;

void main() {
    string line;
    string[] history;

    line = readln();
    foreach(int i; 0..100) history = history + [""]; // XXX

    while(!stdin.eof) {
        writeln(line);
        if(line != history[0]) {
            history[1..100] = history[0..99];
            history[0] = line;
        }
        line = readln();
    }
}


Reply via email to