Exemple #1
0
int main(int argc, char *argv[]){
	Console con;
	const char *spinner[] = {
		"/", "-", "\\", "|"
	};
	if(argc <= 1){
		con.errWriteLine("You must at least provide an address to be pinged.\n");
		return 1;
	}
	for(int i = 1, j = 0; i < argc; i++){
		ping p(argv[i]);
		con << argv[i] << " ";
		ThreadManager::start(p);
		while(!p.finished()){
			System::usleep(2000);
			con << spinner[(++j) % 4] << "\b";
		}
		if(p.alive){
			con << "is alive\n";
		}
		else{
			con << "no response\n";
		}
	}
	return 0;
}