欧美性猛交XXXX免费看蜜桃,成人网18免费韩国,亚洲国产成人精品区综合,欧美日韩一区二区三区高清不卡,亚洲综合一区二区精品久久

打開(kāi)APP
userphoto
未登錄

開(kāi)通VIP,暢享免費電子書(shū)等14項超值服

開(kāi)通VIP
ls code
#include <stdio.h>
#include <string.h>
#include <dirent.h>
#include <sys/types.h>
#include <sys/stat.h>

int main(int argc, char *argv[])
{
        DIR *dp;
        struct dirent *dirp;
        char path[MAXNAMLEN + 1];
        struct stat sb;
        char mode[10];

        const char *time_fmt = "%Y-%m-%d %H:%M:%S";
        char fdate[20];

        if (argc == 1)
        {
                strcpy(path, ".");
        }
        else if (argc == 2)
        {
                strcpy(path, argv[1]);
        }
        else
        {
                printf("cannot ls too few directories.\n");
                return 0;
        }

        if ((dp = opendir(path)) == NULL)
        {
                printf("cannot open this directories.\n");
                return 0;
        }

        while ((dirp = readdir(dp)) != NULL)
        {
                stat(dirp->d_name, &sb);
                mode[9] = (sb.st_mode & S_IFDIR) ? ‘d‘ : ‘-‘;
                if (sb.st_mode & S_IFIFO)
                        mode[9] = ‘i‘;
                else if (sb.st_mode & S_IFCHR)
                        mode[9] = ‘c‘;
                else if (sb.st_mode & S_IFDIR)
                        mode[9] = ‘d‘;
                else if (sb.st_mode & S_IFBLK)
                        mode[9] = ‘b‘;
                else if (sb.st_mode & S_IFREG)
                        mode[9] = ‘-‘;
                else if (sb.st_mode & S_IFLNK)
                        mode[9] = ‘l‘;
                else if (sb.st_mode & S_IFSOCK)
                        mode[9] = ‘s‘;
                else if (sb.st_mode & S_IFWHT)
                        mode[9] = ‘w‘;
                else if (sb.st_mode & S_ISUID)
                        mode[9] = ‘u‘;
                else if (sb.st_mode & S_ISGID)
                        mode[9] = ‘g‘;
                else
                        mode[9] = ‘ ‘;

                strftime(fdate, sizeof(fdate), time_fmt, localtime(&(sb.st_ctime)));
                printf("%crwxr--r-- %5d %5d %8d", mode[9],sb.st_uid, sb.st_gid, sb.st_size);
                printf("  %20s  %-16s\n", fdate, dirp->d_name);
        }

        closedir(dp);

        return 0;
}
本站僅提供存儲服務(wù),所有內容均由用戶(hù)發(fā)布,如發(fā)現有害或侵權內容,請點(diǎn)擊舉報。
打開(kāi)APP,閱讀全文并永久保存 查看更多類(lèi)似文章
猜你喜歡
類(lèi)似文章
C語(yǔ)言字符串函數大全
ls命令的實(shí)現(2)
操作系統第四次實(shí)驗報告——文件系統之使用LinuxAPI實(shí)現ls -lai命令
用C語(yǔ)言編寫(xiě)一個(gè)Linux下的簡(jiǎn)單shell程序
framebuff操作程序
【原創(chuàng )】自制編程語(yǔ)言-6 輸入語(yǔ)句
更多類(lèi)似文章 >>
生活服務(wù)
分享 收藏 導長(cháng)圖 關(guān)注 下載文章
綁定賬號成功
后續可登錄賬號暢享VIP特權!
如果VIP功能使用有故障,
可點(diǎn)擊這里聯(lián)系客服!

聯(lián)系客服

欧美性猛交XXXX免费看蜜桃,成人网18免费韩国,亚洲国产成人精品区综合,欧美日韩一区二区三区高清不卡,亚洲综合一区二区精品久久