#include
#include
int main(int argc, char *argv[])
{
int fd;
int arg;
while ((arg = getopt(argc, argv, "ps:" )) != EOF) {
switch (arg) {
case 'p': {
int num = 0;
for (;;) {
if ((fd = open_ups()) < 0) {
if (num == 0)
fprintf(stderr, "no ups!\n");
return -1;
}
num++;
printf("[%02d] 0x%04x:0x%04x\n", fd, ups[fd].udev->descriptor.idVendor, ups[fd].udev->descriptor.idProduct);
}
} break;
case 's': {
printf("%s\n", optarg);
} break;
default: break;
}
}
}
阅读(2247) | 评论(0) | 转发(0) |