Blame view

misc/maintenance/find_unused_programs.sh 530 Bytes
8dcb6dfcb   Yannick Estève   first commit
1
2
3
4
5
6
7
8
9
10
11
12
13
14
  #!/usr/bin/env bash
  
  
  # to be run from top level of repo.
  find egs -maxdepth 7 \( -name '*.sh' -o -name '*.py' \) -exec cat {} \; | awk '{for (n=1;n<=NF;n++) seen[$n] = 1; } END{ for (k in seen) { print k; }}' > seen_tokens
  
  for d in src/*bin; do
    if [ -d $d ] && [ -f $d/Makefile ]; then
      cat $d/Makefile | perl -ane ' while(<>){ s/\\
  //g; print; }' | grep -E '^BINFILES' | awk '{for(n=3;n<=NF;n++){print $n;}}';
    fi
  done > all_binaries
  
  for f in $(cat all_binaries); do if ! grep -q $f seen_tokens; then echo $f; fi; done