program WIN32CUI 'test';
#include 'ch.zir';
char buf[32];
repeat {
print('Enter command: ');
edx = gets(@buf, 32);
al = [edx];
case (al) {
state "q":
if (strCmp(edx, 'quit') == true) {
print('Goodbye!\r\n');
break 1;
} else {
goto @casedef;
}
break;
state "h":
if (strCmp(edx, 'help') == true) {
print(' ********** HELP ********** \r\nhelp\t-\tDisplay this help\r\nquit\t-\tQuit application\r\nspam\t-\tPrint 1000 spam messages\r\n/ ************************** /\r\n');
} else {
goto @casedef;
}
break;
state "s":
if (strCmp(edx, 'spam') == true) {
for (ecx = 1 to 1000) {
print('spam ', ecx:int, '\r\n');
}
} else {
goto @casedef;
}
break;
default:
@casedef:
print('Unknown command: ', edx:string, '\r\n');
break;
}
};
wait_key();
ExitProcess(0);