diff options
author | Christian Neukirchen <chneukirchen@gmail.com> | 2015-10-27 15:19:56 +0100 |
---|---|---|
committer | Christian Neukirchen <chneukirchen@gmail.com> | 2015-10-27 15:19:56 +0100 |
commit | d10807b8daf705c55f1f314a10a8a83a4dfb2fee (patch) | |
tree | 24697c8d27367e0e42ec1970fcaa5578db748ae0 | |
parent | bea00ebe24f618da8fed01f04b691fcaea823e34 (diff) | |
download | lr-d10807b8daf705c55f1f314a10a8a83a4dfb2fee.tar.gz lr-d10807b8daf705c55f1f314a10a8a83a4dfb2fee.tar.xz lr-d10807b8daf705c55f1f314a10a8a83a4dfb2fee.zip |
add rdev
-rw-r--r-- | README.md | 5 | ||||
-rw-r--r-- | lr.c | 5 |
2 files changed, 8 insertions, 2 deletions
diff --git a/README.md b/README.md index 94df935..c35391f 100644 --- a/README.md +++ b/README.md @@ -63,6 +63,7 @@ Over ls: * `%k`: file size in 1024-byte blocks. * `%d`: path depth. * `%D`: device number (`stat.st_dev`). +* `%R`: device ID for special files (`stat.st_rdev`). * `%i`: inode number. * `%I`: one space character for every depth level. * `%p`: full path (without `./` if `-s`). @@ -116,8 +117,8 @@ Default: `n`. | prune -- do not traverse into subdirectories | print -- always true value - <numprop> ::= atime | ctime | depth | dev | entries | gid - | inode | links | mode | mtime | size | total | uid + <numprop> ::= atime | ctime | depth | dev | entries | gid | inode + | links | mode | mtime | rdev | size | total | uid <numop> ::= <= | < | >= | > | == | != diff --git a/lr.c b/lr.c index d7cf116..8a20bfe 100644 --- a/lr.c +++ b/lr.c @@ -138,6 +138,7 @@ enum prop { PROP_MTIME, PROP_NAME, PROP_PATH, + PROP_RDEV, PROP_SIZE, PROP_TARGET, PROP_TOTAL, @@ -468,6 +469,8 @@ parse_cmp() return parse_mode(); else if (token("mtime")) prop = PROP_MTIME; + else if (token("rdev")) + prop = PROP_RDEV; else if (token("size")) prop = PROP_SIZE; else if (token("total")) @@ -813,6 +816,7 @@ eval(struct expr *e, struct fileinfo *fi) case PROP_LINKS: v = fi->sb.st_nlink; break; case PROP_MODE: v = fi->sb.st_mode & 07777; break; case PROP_MTIME: v = fi->sb.st_mtime; break; + case PROP_RDEV: v = fi->sb.st_rdev; break; case PROP_SIZE: v = fi->sb.st_size; break; case PROP_TOTAL: v = fi->total; break; case PROP_UID: v = fi->sb.st_uid; break; @@ -1011,6 +1015,7 @@ print(const void *nodep, const VISIT which, const int depth) case 'k': printf("%jd", (intmax_t)fi->sb.st_blocks / 2); break; case 'd': printf("%d", fi->depth); break; case 'D': printf("%jd", (intmax_t)fi->sb.st_dev); break; + case 'R': printf("%jd", (intmax_t)fi->sb.st_rdev); break; case 'i': printf("%jd", (intmax_t)fi->sb.st_ino); break; case 'I': { int i; |