diff options
-rw-r--r-- | README.md | 1 | ||||
-rw-r--r-- | lr.c | 4 |
2 files changed, 5 insertions, 0 deletions
diff --git a/README.md b/README.md index cb9afff..248af49 100644 --- a/README.md +++ b/README.md @@ -94,6 +94,7 @@ Default: `n`. * `m`: mtime. * `n`: file name. * `s`: file size. +* `t`: file type. This sorts all directories before other files. ## Filter expressions diff --git a/lr.c b/lr.c index 27adca5..e1a13df 100644 --- a/lr.c +++ b/lr.c @@ -734,6 +734,10 @@ order(const void *a, const void *b) case 'I': CMP(fb->sb.st_ino, fa->sb.st_ino); case 'd': CMP(fa->depth, fb->depth); case 'D': CMP(fb->depth, fa->depth); + case 't': CMP("ZZZZAZZZZZZZZZZZ"[(fa->sb.st_mode >> 12) & 0x0f], + "ZZZZAZZZZZZZZZZZ"[(fb->sb.st_mode >> 12) & 0x0f]); + case 'T': CMP("ZZZZAZZZZZZZZZZZ"[(fb->sb.st_mode >> 12) & 0x0f], + "ZZZZAZZZZZZZZZZZ"[(fa->sb.st_mode >> 12) & 0x0f]); case 'n': STRCMP(fa->fpath, fb->fpath); case 'N': STRCMP(fb->fpath, fa->fpath); default: STRCMP(fa->fpath, fb->fpath); |