mkdevlist 612 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. #!/bin/rc
  2. awk -v 'objtype='$objtype '
  3. BEGIN{
  4. if(ARGC < 2)
  5. exit;
  6. collect = isdev = 0;
  7. }
  8. /^[ \t]*$/{
  9. next;
  10. }
  11. /^#/{
  12. next;
  13. }
  14. collect && /^[^ \t]/{
  15. collect = isdev = 0;
  16. }
  17. collect && $0 ~ /[^ \t]+/{
  18. if(isdev)
  19. obj["dev" $1 "'.$O'"]++;
  20. else
  21. obj[$1 "'.$O'"]++;
  22. for(i = 2; i <= NF; i++){
  23. if($i !~ "[+=-].*")
  24. obj[$i "'.$O'"]++;
  25. }
  26. }
  27. $0 ~ /^[^ \t]/{
  28. if($1 ~ "dev"){
  29. isdev = 1;
  30. collect = 1;
  31. }
  32. else if($1 ~ "misc" || $1 ~ "link" || $1 ~ "ip")
  33. collect = 1;
  34. next;
  35. }
  36. END{
  37. x = ""
  38. for(i in obj)
  39. x = x i "\n";
  40. if(objtype ~ "386" && obj["pci" "'.$O'"])
  41. x = x "bios32'.$O' \n";
  42. printf x;
  43. }' $*