Skip to content

Commit

Permalink
first Version
Browse files Browse the repository at this point in the history
  • Loading branch information
jlzhucas committed Dec 29, 2011
0 parents commit 1b43233
Show file tree
Hide file tree
Showing 8 changed files with 712 additions and 0 deletions.
41 changes: 41 additions & 0 deletions LinkList.h
@@ -0,0 +1,41 @@
/* *************************************************************************
* name: LinkList.h
* Programmer: ZhuJinliang
* Description:
* Version: 1.0
* Created: 2011/11/03
* Function:
* Modified by ZhuJinliang 2011-11-8
* ************************************************************************/
#ifndef _LINKLIST_H_
#define _LINKLIST_H_

#include <stdio.h>
#include <malloc.h>
#include <string.h>

#define TRUE 1
#define FAIL 0


typedef struct list
{
void *data;
struct list *next;
}ListNode, *PListNode;


/******************statement********************************/
PListNode InitList(void);
PListNode CreateNode(void);
int DeleteNode(PListNode pNode, int position);
int DeleteList(PListNode pHead);
int AddTail(PListNode pHeader, void *data);
int InsertAfter(PListNode pHead, int position, void *data);
int UpdateNode(PListNode pHead, int position, void *data);
int GetListCount(PListNode pHead);
PListNode FindNode(PListNode pHead, int position);
int SortList(PListNode pHead, char *compare);


#endif
9 changes: 9 additions & 0 deletions Makefile
@@ -0,0 +1,9 @@
ls : ls.o libmyList.a
cc -L ../lib -lmyList -o ls ls.o
ls.o : ls.c
cc -c ls.c

.PHONY : clean
clean:
rm ls *.o

38 changes: 38 additions & 0 deletions README
@@ -0,0 +1,38 @@
Copyright (c) 2011 Zhu Jinliang

Overview:
----------
It is just like the shell command ls, but it is realized by C language.

How to use:
---------
Do as this:
cd ls
make #compile the ls.c,then will creat "ls" which is an executable file.

Then there will be an executable file exists. Now, you can run it by clicking
"./ls" into the terminal.

Function:
----------
1.与ls命令类似,命令行参数可以有0到多个
2.0个参数:列出当前目录下所有文件
3.参数为目录:列出目录下所有文件
4.-a:列出目录下所有文件包括以“.”和“..”开头的
5.-d:当遇到目录时列出目录本身而非目录内的文件
6.-l:使用较长格式列出信息
7.-S:根据文件大小排序
8.-t:根据文件修改时间排序

Note:
-------
Since the author's ability is limited, the software may exist many bugs that I
didn't have found and solve them. Please write them in a file, and send to me
if possible. I'll appreciate your work very much!

Contact:
---------
If you want to make contact with me, mail me at this:
zhujinlianghust#gmail.com

-Zhu Jinliang, Nov 2011
42 changes: 42 additions & 0 deletions includes.h
@@ -0,0 +1,42 @@
#ifndef _INCLUDES_H
#define _INCLUDES_H

#include <sys/stat.h>
#include <dirent.h>
#include <unistd.h>
#include <time.h>
#include <stddef.h>
/* header file in ourhdr.h*/
#include <sys/types.h> /* required for some of our prototypes */
#include <stdio.h> /* for convenience */
#include <stdlib.h> /* for convenience */
#include <string.h> /* for convenience */
#include <unistd.h> /* for convenience */
/* header file in myErr.h*/
#include <errno.h> /* for definition of errno */
#include <stdarg.h> /* ISO C variable aruments */

#include "ourhdr.h"
#include "myErr.h"

#include "LinkList.h"

typedef struct file
{
char *name;
off_t size;
time_t time;
}fileInfo, *pFile;


void GetOptions(int argc, char *argv[]);
int List(char *path);
int ListDir(char *path);
int Print(char *path);
void PrintNode(void *file);
int CompareString(void *file1, void *file2);
int CompareSize(void *file1, void *file2);
int CompareTime(void *file1, void *file2);


#endif
Binary file added libmyList.a
Binary file not shown.

0 comments on commit 1b43233

Please sign in to comment.