#include <stdio.h>#include <string.h>#include <sys/types.h>#include <sys/stat.h>#include <stddef.h>#include <stdlib.h>#include <unistd.h>#include <dirent.h>#include <time.h>#include <pwd.h>#include <grp.h>#include <errno.h>#include <fcntl.h>#include <limits.h>#include <termios.h>#include <sys/ioctl.h>Include dependency graph for ls.c:

Go to the source code of this file.
Data Structures | |
| struct | idname |
| struct | file |
Defines | |
| #define | ifmt(mode) l_ifmt[((mode) >> 12) & 0xF] |
| #define | nil 0 |
| #define | major(dev) ((int) (((dev) >> 8) & 0xFF)) |
| #define | minor(dev) ((int) (((dev) >> 0) & 0xFF)) |
| #define | SUPER_ID uid |
| #define | status stat |
| #define | BLOCK 512 |
| #define | ST_BLOCKS 1 |
| #define | NSEP 3 |
| #define | MAXCOLS 128 |
| #define | NNAMES (1 << (sizeof(int) + sizeof(char *))) |
| #define | uidname(uid) idname((uid), PASSWD) |
| #define | gidname(gid) idname((gid), GROUP) |
| #define | delpath(didx) (path[pidx= didx]= 0) |
| #define | L_INODE 0x0001 |
| #define | L_BLOCKS 0x0002 |
| #define | L_EXTRA 0x0004 |
| #define | L_MODE 0x0008 |
| #define | L_LONG 0x0010 |
| #define | L_GROUP 0x0020 |
| #define | L_BYTIME 0x0040 |
| #define | L_ATIME 0x0080 |
| #define | L_CTIME 0x0100 |
| #define | L_MARK 0x0200 |
| #define | L_MARKDIR 0x0400 |
| #define | L_TYPE 0x0800 |
| #define | L_LONGTIME 0x1000 |
| #define | L_DIR 0x2000 |
| #define | L_KMG 0x4000 |
| #define | PAST (26*7*24*3600L) |
| #define | FUTURE ( 1*7*24*3600L) |
| #define | K 1024L |
| #define | T 1000L |
| #define | nblocks(f) ((f)->blocks) |
| #define | nblk2k(nb) (((nb) + (1024 / BLOCK - 1)) / (1024 / BLOCK)) |
| #define | spaces(n) (nsp= (n)) |
| #define | terpri() (nsp= 0, putchar('\n')) |
Enumerations | |
| enum | whatmap { PASSWD, GROUP } |
| enum | { W_COL, W_INO, W_BLK, W_NLINK, W_UID, W_GID, W_SIZE, W_NAME, MAXFLDS } |
| enum | depth { SURFACE, SURFACE1, SUBMERGED } |
| enum | state { BOTTOM, SINKING, FLOATING } |
Functions | |
| void | heaperr (void) |
| void * | allocate (size_t n) |
| void * | reallocate (void *a, size_t n) |
| void | setflags (char *flgs) |
| int | present (int f) |
| void | report (char *f) |
| char * | idname (unsigned id, enum whatmap map) |
| void | addpath (int *didx, char *name) |
| void | setstat (struct file *f, struct stat *stp) |
| static char * | timestamp (struct file *f) |
| char * | permissions (struct file *f) |
| void | numeral (int i, char **pp) |
| char * | cxsize (struct file *f) |
| static void | mergesort (struct file **al) |
| int | namecmp (struct file *f1, struct file *f2) |
| int | mtimecmp (struct file *f1, struct file *f2) |
| int | atimecmp (struct file *f1, struct file *f2) |
| int | ctimecmp (struct file *f1, struct file *f2) |
| int | typecmp (struct file *f1, struct file *f2) |
| int | revcmp (struct file *f1, struct file *f2) |
| static void | sort (struct file **al) |
| file * | newfile (char *name) |
| void | pushfile (struct file **flist, struct file *new) |
| void | delfile (struct file *old) |
| file * | popfile (struct file **flist) |
| int | dotflag (char *name) |
| int | adddir (struct file **aflist, char *name) |
| off_t | countblocks (struct file *flist) |
| void | printname (char *name) |
| int | mark (struct file *f, int doit) |
| void | maxise (unsigned char *aw, int w) |
| int | numwidth (unsigned long n) |
| int | numxwidth (unsigned long n) |
| void | print1 (struct file *f, int col, int doit) |
| int | countfiles (struct file *flist) |
| void | columnise (struct file *flist, int nplin) |
| int | print (struct file *flist, int nplin, int doit) |
| void | listfiles (struct file *flist, enum depth depth, enum state state) |
| int | main (int argc, char **argv) |
Variables | |
| char | l_ifmt [] = "0pcCd?bB-?l?s???" |
| int | ncols = 79 |
| char * | arg0 |
| int | uid |
| int | gid |
| int | ex = 0 |
| int | istty |
| char | allowed [] = "acdfghilnpqrstu1ACDFLMRTX" |
| char | flags [sizeof(allowed)] |
| char | arg0flag [] = "cdfmrtx" |
| idname * | uids [NNAMES] |
| idname * | gids [NNAMES] |
| char * | path |
| int | plen = 0 |
| int | pidx = 0 |
| int | field = 0 |
| static int(* | CMP )(struct file *f1, struct file *f2) |
| static int(* | rCMP )(struct file *f1, struct file *f2) |
| unsigned char | fieldwidth [MAXCOLS][MAXFLDS] |
| static int | nsp = 0 |
| file * | filecol [MAXCOLS] |
| int | nfiles |
| int | nlines |
|
|
|
|
|
Definition at line 228 of file ls.c. Referenced by cleandir(), listfiles(), main(), and print1(). |
|
|
Definition at line 286 of file ls.c. Referenced by timestamp(). |
|
|
Definition at line 191 of file ls.c. Referenced by print1(). |
|
|
Definition at line 17 of file ls.c. Referenced by permissions(), and typecmp(). |
|
|
|
|
|
Definition at line 240 of file ls.c. Referenced by main(), sort(), and timestamp(). |
|
|
Definition at line 234 of file ls.c. Referenced by listfiles(), main(), and print1(). |
|
|
|
|
|
Definition at line 241 of file ls.c. Referenced by main(), sort(), and timestamp(). |
|
|
Definition at line 246 of file ls.c. Referenced by main(). |
|
|
Definition at line 235 of file ls.c. Referenced by main(), permissions(), and print1(). |
|
|
|
|
|
|
|
|
|
|
|
Definition at line 237 of file ls.c. Referenced by listfiles(), main(), and print1(). |
|
|
Definition at line 245 of file ls.c. Referenced by main(), print1(), and timestamp(). |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Definition at line 74 of file ls.c. Referenced by listfiles(). |
|
|
|
|
|
Definition at line 442 of file ls.c. Referenced by listfiles(), and print1(). |
|
|
Definition at line 435 of file ls.c. Referenced by alloc(), atapi_transfer(), countblocks(), main(), and print1(). |
|
|
|
|
|
Definition at line 140 of file ls.c. Referenced by idname(). |
|
|
Definition at line 72 of file ls.c. Referenced by print1(). |
|
|
|
|
|
Definition at line 718 of file ls.c. Referenced by print1(), and Unexpand(). |
|
|
|
|
|
Definition at line 51 of file ls.c. Referenced by _syscall(), _taskcall(), add(), ar_close(), catch_child(), cdiff(), cgiexec(), chk_table(), compretval(), copydir(), copylink(), crypt(), deflateEnd(), do_backward(), do_comm(), do_forward(), do_printer_output(), do_read(), do_status(), do_write(), dosh(), dsp_command(), dsp_ioctl(), ec_check_ints(), ec_recv(), evalloop(), evaltree(), Exec_Shell(), execute(), exitshell(), f_pshinf(), fdc_out(), fdc_results(), get_work(), getpwd(), give_prompt(), handle_events(), kb_wait(), listfiles(), locked(), lp(), m_shell(), main(), make_dir(), match(), mixer_ioctl(), Mkdir(), newdisk(), nr_Uf(), output_done(), pclose(), precmd(), print_capabilities(), readcmd(), reply(), rpclose(), run(), rundiff(), runvec(), safePopenOut(), scrollb(), scrollf(), SH(), sigchar(), startup(), susystem(), System(), system(), test7b(), unix_exec(), wait_for(), and zcopy(). |
|
|
Definition at line 43 of file ls.c. Referenced by main(). |
|
|
Definition at line 390 of file ls.c. Referenced by adjust(), alloc_segments(), command(), cxsize(), display(), do_exec(), do_fork(), do_trace(), dump_stack(), fill(), lookup(), map_addr(), memmap_dmp(), new_mem(), operator<(), operator>(), patch_mem_chunks(), pm_exit(), proctab_dmp(), pstat(), read(), read_core(), read_info(), read_segmap(), setmap(), umap_local(), update(), and write(). |
|
|
|
|
|
Definition at line 190 of file ls.c. Referenced by print1(). |
|
|
|
|
|
|
|
|
|
|
|
|
|
||||||||||||
|
Definition at line 595 of file ls.c. References access, closedir, d, dotflag(), e, newfile, file::next, nil, opendir, present, pushfile(), readdir, and report(). Referenced by listfiles(). |
|
||||||||||||
|
Definition at line 200 of file ls.c. References allocate(), path, pidx, plen, and reallocate(). |
|
|
|
|
||||||||||||
|
Definition at line 496 of file ls.c. Referenced by sort(). |
|
||||||||||||
|
Definition at line 900 of file ls.c. References filecol, i, j, file::next, nfiles, nil, and nlines. Referenced by print(). |
|
|
Definition at line 620 of file ls.c. References file::mode, nblocks, file::next, nil, S_IFDIR, S_IFLNK, S_IFMT, and S_IFREG. Referenced by listfiles(). |
|
|
Definition at line 887 of file ls.c. References n, file::next, and nil. Referenced by listfiles(). |
|
||||||||||||
|
Definition at line 501 of file ls.c. Referenced by sort(). |
|
|
Definition at line 392 of file ls.c. References f, K, numeral(), p, T, and z. Referenced by print1(). |
|
|
Definition at line 566 of file ls.c. References free, and file::name. Referenced by listfiles(). |
|
|
Definition at line 583 of file ls.c. Referenced by adddir(), and listfiles(). |
|
|
Definition at line 83 of file ls.c. References arg0, exit(), fprintf(), and stderr. Referenced by allocate(), and reallocate(). |
|
||||||||||||
|
Definition at line 149 of file ls.c. References allocate(), getgrgid(), getpwuid(), gids, group::gr_name, i, nil, NNAMES, PASSWD, present, passwd::pw_name, sprintf(), strcpy(), strlen(), and uids. |
|
||||||||||||||||
|
Definition at line 961 of file ls.c. References adddir(), addpath(), BOTTOM, countblocks(), countfiles(), delfile(), delpath, dotflag(), ENOENT, errno, fflush(), L_BLOCKS, L_LONG, lstat, MAXCOLS, file::mode, file::name, nblk2k, nfiles, nil, path, popfile(), present, print, printf, pushfile(), putchar, r, report(), S_IFDIR, S_IFLNK, S_IFMT, setstat(), SINKING, sort(), st, status, stdout, SURFACE1, and white(). Referenced by main(). |
|
||||||||||||
|
Definition at line 1059 of file ls.c. References arg0, arg0flag, BOTTOM, close, ex, getegid, getenv(), geteuid, gid, ioctl, isatty, istty, L_ATIME, L_BLOCKS, L_BYTIME, L_CTIME, L_DIR, L_EXTRA, L_GROUP, L_INODE, L_KMG, L_LONG, L_LONGTIME, L_MARK, L_MARKDIR, L_MODE, L_TYPE, listfiles(), lstat, ncols, newfile, nil, O_WRONLY, open, p, present, pushfile(), setflags(), SINKING, status, strchr, strcmp, strrchr(), SUPER_ID, SURFACE, SURFACE1, t, TIOCGWINSZ, uid, and winsize::ws_col. |
|
||||||||||||
|
Definition at line 652 of file ls.c. References c, f, L_MARK, L_MARKDIR, putchar, S_IFDIR, S_IFIFO, S_IFLNK, S_IFMT, S_IFREG, S_ISDIR, S_IXGRP, S_IXOTH, and S_IXUSR. |
|
||||||||||||
|
Definition at line 688 of file ls.c. References UCHAR_MAX. Referenced by print1(). |
|
|
Definition at line 450 of file ls.c. References CMP, file::next, and nil. Referenced by sort(). |
|
||||||||||||
|
Definition at line 491 of file ls.c. Referenced by sort(). |
|
||||||||||||
|
|
|
|
Definition at line 549 of file ls.c. References allocate(), strcpy(), and strlen(). |
|
||||||||||||
|
Definition at line 380 of file ls.c. References a, int(), and itoa(). Referenced by cxsize(). |
|
|
Definition at line 697 of file ls.c. References width. Referenced by print1(). |
|
|
Definition at line 707 of file ls.c. References width. |
|
|
Definition at line 326 of file ls.c. References f, gid, ifmt, L_EXTRA, p, rwx(), S_IRUSR, S_ISGID, S_ISUID, S_ISVTX, S_IWUSR, S_IXUSR, and uid. Referenced by print1(). |
|
|
Definition at line 573 of file ls.c. References f. |
|
|
|
|
||||||||||||||||
|
Definition at line 918 of file ls.c. References col(), columnise(), fieldwidth, fld, and MAXFLDS. |
|
||||||||||||||||
|
Definition at line 721 of file ls.c. References addpath(), allocate(), cxsize(), delpath, f, fieldwidth, free, gidname, int(), L_BLOCKS, L_EXTRA, L_GROUP, L_INODE, L_KMG, L_LONG, L_LONGTIME, L_MODE, major, mark, MAXFLDS, maxise(), minor, n, nblk2k, nblocks, NSEP, nsp, numwidth(), p, path, permissions(), printf, printname(), putchar, r, readlink, S_IFBLK, S_IFCHR, S_IFLNK, S_IFMT, spaces, strcpy(), strlen(), timestamp(), uidname, W_BLK, W_COL, W_GID, W_INO, W_NAME, W_NLINK, W_SIZE, W_UID, and width. |
|
|
|
|
||||||||||||
|
|
|
||||||||||||
|
Definition at line 98 of file ls.c. References heaperr(), nil, and realloc(). Referenced by addpath(). |
|
|
Definition at line 130 of file ls.c. References arg0, errno, ex, fprintf(), stderr, and strerror(). |
|
||||||||||||
|
Definition at line 511 of file ls.c. Referenced by sort(). |
|
|
Definition at line 109 of file ls.c. References allowed, arg0, c, exit(), flags, fprintf(), nil, stderr, strchr, and strlen(). Referenced by main(). |
|
||||||||||||
|
Definition at line 267 of file ls.c. References f, stat::st_atime, stat::st_ctime, stat::st_gid, stat::st_ino, stat::st_mode, stat::st_mtime, stat::st_nlink, stat::st_rdev, stat::st_size, and stat::st_uid. Referenced by getstat(), listfiles(), and setmodes(). |
|
|
Definition at line 513 of file ls.c. References atimecmp(), CMP, ctimecmp(), L_ATIME, L_BYTIME, L_CTIME, L_TYPE, mergesort(), mtimecmp(), namecmp, nil, present, rCMP, revcmp(), and typecmp(). |
|
|
Definition at line 288 of file ls.c. References date(), f, FUTURE, L_ATIME, L_CTIME, L_LONGTIME, localtime(), month, now, sprintf(), t, time, time_t, tm::tm_hour, tm::tm_mday, tm::tm_min, tm::tm_mon, tm::tm_sec, and tm::tm_year. Referenced by do_chown(), logmsg(), and print1(). |
|
||||||||||||
|
Definition at line 506 of file ls.c. Referenced by sort(). |
|
|
Definition at line 104 of file ls.c. Referenced by do_exec(), and setflags(). |
|
|
|
|
|
Definition at line 107 of file ls.c. Referenced by main(). |
|
|
|
|
|
Definition at line 78 of file ls.c. Referenced by because(), delete(), doexec(), main(), master(), mediator(), perr(), read_map(), report(), scribble_region(), slave(), startprocess(), test5a(), test5b(), test5c(), test5e(), test5f(), test5h(), and write_map(). |
|
|
|
|
|
|
|
|
Definition at line 897 of file ls.c. Referenced by columnise(). |
|
|
|
|
|
|
|
|
Referenced by idname(). |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Referenced by idname(). |
1.4.6