我想在C中實現'whereis'命令,但我能夠部分實現它。當我在Linux shell中嘗試'whereis'時,可以說例如whereis ls ..我得到以下結果在Linux中查找Builtins和命令的可執行文件的路徑
$ whereis ls
/bin/ls
/usr/share/man/man1p/ls.1p.gz
/usr/share/man/man1/ls.1.gz
我能夠使用PATH env.variable獲得第一個路徑。但我不知道如何找到其他兩條路徑。任何指針如何找到這些路徑。