1 2 3 4 5 6 7 8 9 10 11 12 13
#!/usr/bin/perl open (IOCTLS,'/usr/include/sys/ioctl.h') || die "ioctl open failed"; while (<IOCTLS>) { if (/^\s*#\s*define\s+\w+\s+_IO(R|W|WR)\('?\w+'?,\s*\w+,\s*([^)]+)/) { $need{$2}++; } } foreach $key ( sort keys %need ) { print $key,"\n"; }