logo

oasis

Own branch of Oasis Linux (upstream: <https://git.sr.ht/~mcf/oasis/>) git clone https://anongit.hacktivis.me/git/oasis.git

rsp.awk (453B)


  1. function line() {
  2. if (match($0, /\.d$/))
  3. read($0)
  4. else
  5. libs[++n] = $0
  6. }
  7. function read(name) {
  8. for (;;) {
  9. ret = getline < name
  10. if (ret < 0) {
  11. print "failed to read line from " name > "/proc/self/fd/2"
  12. exit(1)
  13. }
  14. if (ret == 0)
  15. break
  16. line()
  17. }
  18. close(name)
  19. }
  20. {line()}
  21. END {
  22. for (i = n; i > 0; --i) {
  23. lib = libs[i]
  24. if (lib in seen)
  25. continue
  26. seen[lib] = 1
  27. uniq[++m] = lib
  28. }
  29. for (i = m; i > 0; --i)
  30. print uniq[i]
  31. }