32 lines
453 B
Fortran
32 lines
453 B
Fortran
/**
|
|
* Constants
|
|
*/
|
|
const str prompt = "Enter a string: ";
|
|
const str nl = "\n";
|
|
|
|
plex Terminal {
|
|
nat handle;
|
|
|
|
init() {
|
|
handle = open("/dev/term/0", 0);
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Main function
|
|
*/
|
|
function main() {
|
|
Terminal term();
|
|
pln(term, prompt);
|
|
pln(term, term.read(32));
|
|
return 0;
|
|
}
|
|
|
|
/**
|
|
* Print with a newline
|
|
*/
|
|
function pln(Terminal term, str message) {
|
|
write(term, message, message.length);
|
|
write(term, nl, nl.length);
|
|
}
|