資源簡介
非常好的Qt程序 軟件工程的程序 可以作為很好的參考

代碼片段和文件信息
#include?
#include?
#include?
#include?
#include?
#include?
#include?
static?void?usage(char?*prog_name)
{
????printf(“LIST?1.0?by?Jiang?jiangyanjun0718@163.com?“__DATE__“?“__TIME__“\n“
????????“Usage:?%s?[OPTION]...?[FILE]...\n“
????????“List?information?about?the?FILEs?(the?current?directory?by?default)\n\n“
????????“??-??--help??????????Display?this?help?and?exit\n“
????????“??-a?--all???????????Do?not?hide?entries?starting?with?.\n“
????????“??-r?--recursive?????List?subdirectories?recursively\n“
????????“??-l?--low=???Minimum?of?file?size\n“
????????“??-h?--high=??Maximum?of?file?size\n“
????????“??-m?--mdays=??Limit?file?last?modified?time\n\n“?prog_name);
}
static?struct?option?longopts[]?=?{
????{?“help“??????no_argument?????????NULL?‘?‘?}
????{?“all“???????no_argument?????????NULL?‘a(chǎn)‘?}
????{?“recursive“?no_argument?????????NULL?‘r‘?}
????{?“l(fā)ow“???????required_argument???NULL?‘l‘?}
????{?“high“??????required_argument???NULL?‘h‘?}
????{?“mdays“?????required_argument???NULL?‘m‘?}
????{?0?}
};
static?unsigned?int?recur?=?0?all?=?0?low?=?0?high?=?0xffffffff?mtime?=?0;
static?void?list(char?*name?int?expand)
{
????char?path[1024];
????DIR?*dir;
????struct?dirent?*ent;
????struct?stat?st;
????strcpy(path?name[0]???name?:?“.“);//鑻ヨ緭鍏ヤ負(fù)絀猴紝琛ㄧず褰撳墠鐩綍錛涜礋璐e皢鍏惰祴緇檖ath
????if?(stat(path?&st)?==?-1)?{
????????fprintf(stderr?“%s:?%s\n“?name?strerror(errno));
????????return;
????}
????if?(S_ISREG(st.st_mode))?{//鍒ゆ柇鏄惁鏄竴涓父瑙勬枃浠?
????????if?(st.st_size?>=?low?&&?st.st_size?<=?high?&&?st.st_mtime?>=?mtime)
????????????printf(“%10d??%s\n“?st.st_size?name);
????????return;
????}
????if?(S_ISDIR(st.st_mode)?&&?expand)?{
????????if?((dir?=?opendir(path))?==?NULL)?{
????????????fprintf(stderr?“%s:?%s\n“?name?strerror(errno));
????????????return;
????????}
????????while?((ent?=?readdir(dir))?!=?NULL)?{
????????????if?(strcmp(ent->d_name?“.“)?==?0?||?strcmp(ent->d_name?“..“)?==?0)//蹇界暐.鍜?.
????????????????continue;
????????????if?(!all?&&?ent->d_name[0]?==?‘.‘)//鑻ll?==?0?涓?鏂囦歡鐨勭涓€涓瓧絎︿負(fù)‘.‘
????????????????continue;
????????????sprintf(path?“%s%s%s“?name?name[0]???“/“?:?““?ent->d_name);
????????????list(path?recur);//閫氳繃recur鐨勫€兼潵鎵ц鏄惁閫掑綊
????????}
????????closedir(dir);
????}
}
int?main(int?argc?char?**argv)
{
????int?k?opt;
????while?((opt?=?getopt_long(argc?argv?“arl:h:m:?“?longopts?NULL))?!=?-1)
????????switch?(opt)?{
????????case?‘?‘:?usage(argv[0]);? exit(0);
????????case?‘r‘:?recur?=?1;? break;
????????case?‘a(chǎn)‘:?all?=?1;? break;
????????case?‘l‘:?low?=?atoi(optarg);? break;
????????case?‘h‘:?high?=?atoi(optarg);? break;
????????case?‘m‘:?mtime?=?time(0)?-?atoi(optarg)?*?86400;?break;
????????}
????if?(optind?==?argc)
????????list(““?1);
????else
????????for?(k?=?optind;?k?????????????lis
?屬性????????????大小?????日期????時(shí)間???名稱
-----------?---------??----------?-----??----
?????目錄???????????0??2013-05-26?17:16??server\
?????文件????????3184??2013-05-17?00:30??server\a.cpp
?????文件??????????80??2013-05-17?00:30??server\a.h
?????文件????????1154??2013-05-24?12:10??server\main.cpp
?????文件?????????343??2013-05-23?19:01??server\server.pro
?????文件???????17679??2013-05-26?17:16??server\server.pro.user
?????文件???????27823??2013-05-20?20:49??server\server.pro.user.2.5pre1
?????目錄???????????0??2013-05-25?00:19??slave\
?????文件?????????918??2010-04-21?09:25??slave\globals.h
?????文件?????????177??2013-05-25?00:09??slave\main.cpp
?????文件????????7450??2013-05-04?22:21??slave\sensor.cpp
?????文件?????????927??2010-04-24?11:19??slave\sensor.h
?????文件???????10019??2013-05-25?00:19??slave\slave.cpp
?????文件????????1124??2010-04-24?09:54??slave\slave.h
?????文件?????????457??2013-05-25?00:14??slave\slave.pro
?????文件???????17674??2013-05-25?00:19??slave\slave.pro.user
?????文件?????????639??2013-05-25?00:09??slave\slave.ui
?????文件????????6904??2013-05-04?22:20??slave\slavethread.cpp
?????文件?????????485??2010-04-24?09:50??slave\slavethread.h
- 上一篇:A1超級aWp專用精悍CS1.5腳本
- 下一篇:京東多線程版易語言源碼
評論
共有 條評論