Last active
April 7, 2017 19:41
-
-
Save neikeq/f7835c6b237e07dcbe3a710324ca3b70 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import std.stdio; | |
| import std.file; | |
| import std.algorithm; | |
| import core.thread; | |
| import std.process; | |
| int main(string[] args) | |
| { | |
| writeln("Working directory: " ~ getcwd()); | |
| //stdout.flush(); | |
| writeln("Arguments:"); | |
| //stdout.flush(); | |
| string[string] env = environment.toAA(); | |
| writeln(env); | |
| //stdout.flush(); | |
| foreach (string arg; args) { | |
| writeln(arg); | |
| //stdout.flush(); | |
| } | |
| //Thread.sleep(dur!"seconds"(5)); | |
| writeln("Infinite input loop (until you type q or quit):"); | |
| //stdout.flush(); | |
| while (true) { | |
| string line = readln(); | |
| if (line is null) | |
| continue; | |
| if (line.endsWith("\n")) { | |
| line = line[0..$-1]; | |
| } | |
| if (line == "quit" || line == "q") { | |
| //writeln("Quit!"); | |
| //stdout.flush(); | |
| break; | |
| } | |
| foreach (char elem; line) { | |
| writef("%x\n", elem); | |
| //stdout.flush(); | |
| } | |
| stderr.writeln("Input: " ~ line); | |
| stderr.writeln("Input: " ~ line[1..$]); | |
| } | |
| //Thread.sleep(dur!"seconds"(5)); | |
| writeln("Finished!"); | |
| //stdout.flush(); | |
| return 0; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment