2004 by Marc J. Rochkind. All rights reserved. Portions marked "Open Source" may be copied under license.

 

Main Page   Modules   Namespace List   Class Hierarchy   Compound List   File List   Namespace Members   Compound Members   File Members  

c3/aupls.c File Reference


Detailed Description

ls command [Sec. 3.5, 3.6.5]

Definition in file aupls.c.

Go to the source code of this file.

Compounds

struct  traverse_info

Defines

#define WANT_LSDIR_FIXEDx
#define AUPLS_FULL
#define USAGE   "Usage: aupls [-Rd] [dir]\n"
#define TYPE(b)   ((statp->st_mode & (S_IFMT)) == (b))
#define MODE(b)   ((statp->st_mode & (b)) == (b))

Enumerations

enum  SHOW_OP { SHOW_PATH, SHOW_INFO }

Functions

void print_mode (const struct stat *statp)
void print_numlinks (const struct stat *statp)
void print_owner (const struct stat *statp)
void print_group (const struct stat *statp)
void print_size (const struct stat *statp)
void print_date (const struct stat *statp)
long get_max_pathname (const char *path)
void print_name (const struct stat *statp, const char *name)
void ls_long (const struct stat *statp, const char *name)
char * get_cwd (bool cleanup)
bool print_cwd (bool cleanup)
bool show_stat (struct traverse_info *p, SHOW_OP op)
bool check_parent (int dirfd, const char *name)
bool do_entry (struct traverse_info *p, bool stat_only)
bool do_dir (struct traverse_info *p)
bool ls_one (const char *name)
bool biggest (struct traverse_info *p, SHOW_OP op)
void biggest_file (void)
bool runtest (char testtype, const char *name)
int main (int argc, char *argv[])

Variables

long total_entries = 0
long total_dirs = 0
char * big_cwd = NULL
char big_name [FILENAME_MAX+1]
off_t big_size = 0


Define Documentation

#define AUPLS_FULL
 

Definition at line 22 of file aupls.c.

#define MODE  )     ((statp->st_mode & (b)) == (b))
 

Definition at line 43 of file aupls.c.

Referenced by print_mode().

#define TYPE  )     ((statp->st_mode & (S_IFMT)) == (b))
 

Definition at line 42 of file aupls.c.

Referenced by print_mode().

#define USAGE   "Usage: aupls [-Rd] [dir]\n"
 

Definition at line 29 of file aupls.c.

Referenced by main().

#define WANT_LSDIR_FIXEDx
 

Definition at line 21 of file aupls.c.


Enumeration Type Documentation

enum SHOW_OP
 

Enumeration values:
SHOW_PATH 
SHOW_INFO 

Definition at line 33 of file aupls.c.


Function Documentation

bool biggest struct traverse_info p,
SHOW_OP  op
[static]
 

Definition at line 561 of file aupls.c.

References big_cwd, big_name, big_size, EC_CLEANUP_BGN, EC_CLEANUP_END, ec_null, get_cwd(), stat::st_mode, stat::st_size, traverse_info::ti_name, and traverse_info::ti_stat.

Referenced by biggest_file().

void biggest_file void   )  [static]
 

Definition at line 581 of file aupls.c.

References big_cwd, big_name, big_size, biggest(), do_entry(), EC_CLEANUP_BGN, EC_CLEANUP_END, ec_false, EC_FLUSH, traverse_info::ti_fcn, traverse_info::ti_name, and traverse_info::ti_recursive.

Referenced by runtest().

bool check_parent int  dirfd,
const char *  name
[static]
 

Definition at line 295 of file aupls.c.

References EC_CLEANUP_BGN, EC_CLEANUP_END, EC_FAIL, ec_neg1, errno, fstat(), lstat(), print_cwd(), stat::st_dev, and stat::st_ino.

Referenced by do_dir().

bool do_dir struct traverse_info p  )  [static]
 

Definition at line 322 of file aupls.c.

References chdir(), check_parent(), close(), closedir(), do_entry(), EC_CLEANUP, EC_CLEANUP_BGN, EC_CLEANUP_END, ec_false, ec_neg1, errno, fchdir(), open(), opendir(), readdir(), rewinddir(), SHOW_PATH, syserr_print(), traverse_info::ti_fcn, traverse_info::ti_name, and traverse_info::ti_recursive.

Referenced by do_entry().

bool do_entry struct traverse_info p,
bool  stat_only
[static]
 

Definition at line 407 of file aupls.c.

References do_dir(), EC_CLEANUP_BGN, EC_CLEANUP_END, ec_false, ec_neg1, lstat(), SHOW_INFO, stat::st_mode, traverse_info::ti_fcn, traverse_info::ti_name, traverse_info::ti_stat, total_dirs, and total_entries.

Referenced by biggest_file(), do_dir(), and main().

char* get_cwd bool  cleanup  )  [static]
 

Definition at line 238 of file aupls.c.

References EC_CLEANUP_BGN, EC_CLEANUP_END, ec_neg1, ec_null, get_max_pathname(), and getcwd().

Referenced by biggest(), print_cwd(), and runtest().

long get_max_pathname const char *  path  )  [static]
 

Definition at line 167 of file aupls.c.

References EC_CLEANUP_BGN, EC_CLEANUP_END, EC_FAIL, errno, and pathconf().

Referenced by get_cwd(), and runtest().

void ls_long const struct stat statp,
const char *  name
[static]
 

Definition at line 206 of file aupls.c.

References print_date(), print_group(), print_mode(), print_name(), print_numlinks(), print_owner(), and print_size().

Referenced by ls_one(), and show_stat().

bool ls_one const char *  name  )  [static]
 

Definition at line 544 of file aupls.c.

References EC_CLEANUP_BGN, EC_CLEANUP_END, ec_neg1, ls_long(), and lstat().

Referenced by runtest().

int main int  argc,
char *  argv[]
 

Definition at line 683 of file aupls.c.

References do_entry(), EC_CLEANUP, EC_CLEANUP_BGN, EC_CLEANUP_END, ec_false, exit(), print_cwd(), runtest(), show_stat(), traverse_info::ti_fcn, traverse_info::ti_name, traverse_info::ti_recursive, total_dirs, total_entries, and USAGE.

bool print_cwd bool  cleanup  )  [static]
 

Definition at line 262 of file aupls.c.

References EC_CLEANUP_BGN, EC_CLEANUP_END, ec_null, and get_cwd().

Referenced by check_parent(), main(), and show_stat().

void print_date const struct stat statp  )  [static]
 

Definition at line 144 of file aupls.c.

References difftime(), localtime(), Ux::now, stat::st_mtime, strftime(), and time().

Referenced by ls_long(), and runtest().

void print_group const struct stat statp  )  [static]
 

Definition at line 121 of file aupls.c.

References getgrgid(), group::gr_name, and stat::st_gid.

Referenced by ls_long(), and runtest().

void print_mode const struct stat statp  )  [static]
 

Definition at line 45 of file aupls.c.

References MODE, and TYPE.

Referenced by ls_long(), and runtest().

void print_name const struct stat statp,
const char *  name
[static]
 

Definition at line 187 of file aupls.c.

References readlink(), stat::st_mode, and stat::st_size.

Referenced by ls_long(), and runtest().

void print_numlinks const struct stat statp  )  [static]
 

Definition at line 106 of file aupls.c.

References stat::st_nlink.

Referenced by ls_long(), and runtest().

void print_owner const struct stat statp  )  [static]
 

Definition at line 111 of file aupls.c.

References getpwuid(), passwd::pw_name, and stat::st_uid.

Referenced by ls_long(), and runtest().

void print_size const struct stat statp  )  [static]
 

Definition at line 131 of file aupls.c.

References stat::st_mode, stat::st_rdev, and stat::st_size.

Referenced by ls_long(), and runtest().

bool runtest char  testtype,
const char *  name
[static]
 

Definition at line 598 of file aupls.c.

References biggest_file(), EC_CLEANUP_BGN, EC_CLEANUP_END, EC_FAIL, ec_false, ec_neg1, ec_null, errno, get_cwd(), get_max_pathname(), ls_one(), lstat(), print_date(), print_group(), print_mode(), print_name(), print_numlinks(), print_owner(), print_size(), and system().

Referenced by main().

bool show_stat struct traverse_info p,
SHOW_OP  op
[static]
 

Definition at line 279 of file aupls.c.

References EC_CLEANUP_BGN, EC_CLEANUP_END, ec_false, ls_long(), print_cwd(), SHOW_INFO, SHOW_PATH, traverse_info::ti_name, and traverse_info::ti_stat.

Referenced by main().


Variable Documentation

char* big_cwd = NULL [static]
 

Definition at line 557 of file aupls.c.

Referenced by biggest(), and biggest_file().

char big_name[FILENAME_MAX + 1] [static]
 

Definition at line 558 of file aupls.c.

Referenced by biggest(), and biggest_file().

off_t big_size = 0 [static]
 

Definition at line 559 of file aupls.c.

Referenced by biggest(), and biggest_file().

long total_dirs = 0 [static]
 

Definition at line 31 of file aupls.c.

Referenced by do_entry(), and main().

long total_entries = 0 [static]
 

Definition at line 31 of file aupls.c.

Referenced by do_entry(), and main().


Generated on Fri Apr 23 10:57:07 2004 for AUP2 Example Source by doxygen 1.3.1