#include <stdio.h>
#include <dirent.h>
int main(){
DIR *d1;
struct dirent *dir1;
const int maxline = 100;
char buf[maxline];
printf("please input command\n");
scanf("%s",buf);
int i = 0;
char c;
for(i = 0;i < 100;i ++){
if(buf[i] == 'l' && buf[i + 1] == 's'){
i = i + 2;
while(buf[i] == ' ' || buf[i] == '\t')
i ++;
char *p = &buf[i];
d1 = opendir(p);
printf("%s\n",p);
while((dir1 = readdir(d1)) != NULL)
printf("%s\n",dir1->d_name);
closedir(d1);
break;
}
}
printf("%s\n",buf);
}