xref: /haiku/src/tests/servers/input/portspy/PortSpy.cpp (revision 379c42b927b2cc1dc7b4ce66a4fa9532c081d936)
1 #include <stdio.h>
2 #include "OS.h"
3 
4 //
5 // Sequentially search for valid ports by port number and display
6 // their properties.
7 //
main(int argc,char * argv[])8 int main(int argc, char* argv[])
9 {
10 	port_info info;
11 
12 	for (int port_num = 0; port_num < 9999; port_num++)
13 	{
14 		if (B_OK == get_port_info(port_num, &info) )
15 		{
16 			// Found a valid port - display it's properties.
17 			//
18 			printf("%04u: Team %u - %s\n",
19 				(unsigned int)info.port,
20 				(unsigned int)info.team,
21 				info.name);
22 		}
23 	}
24 
25 	return 0;
26 }
27