void __APPFUNC__ handlecmds(int cmd) { if (cmd >= 0x87 ) { /* On/offline options */ switch (cmd) { case 0x87: _DeviceOffline(HANGUP); printf("Hungup\n"); break; case 0x88: _DeviceOffline(NOHANGUP); printf("Offline\n"); break; case 0x89: _DeviceOnline(); printf("Turned device online\n"); } } else { if (process) { putchar(7); /* Beep */ return; } else { process=cmd; switch (cmd) { case 0x81: Ping(); break; case 0x82: do_netstat(); break; case 0x83: UserConfig(); break; case 0x84: exit(0); break; case 0x85: device_report(); break; case 0x86: figures(); } process=0; } } }
int command_sys_dev(struct cli *c, int argc, char **argv) { if(argc == 1) { struct device *dev = device_by_name(argv[0]); if(dev) { device_report(dev); return 0; } else { printf("Unknown device %s.", argv[0]); return 1; } } if(argc == 0) { device_report_all(); return 0; } return 1; }