问题前导
我在读《Unix环境高级编程》的第一章,其中给出了一个Unix环境下 ls 命令的简单例子:
#include <dirent.h>
#include "apue.h"
int
main(int argc, char *argv[])
{
DIR *dp;
struct dirent *dirp;
if (agrc != 2)
err_quit("usage: ls directory_name");
if ((dp = opendir(argv[1])) == NULL)
err_sys("Can't open %s",