chiark / gitweb /
* summer has new -M (do not print mtimes) option.
[chiark-utils.git] / cprogs / summer.c
index 5e85111218c6a35567604c31edf2739c3d91adea..3970c369b58477ae6390af6be8c874999fc92c9b 100644 (file)
@@ -26,7 +26,7 @@
 #define MAXDEPTH 1024
 #define CSUMXL 32
 
-static int quiet=0, hidectime=0, hideatime=0;
+static int quiet=0, hidectime=0, hideatime=0, hidemtime=0;
 static int hidedirsize=0, hidelinkmtime=0, onefilesystem=0;
 static int filenamefieldsep=' ';
 static FILE *errfile;
@@ -238,14 +238,16 @@ static void node(const char *path, unsigned nodeflags, dev_t fs) {
       pu10();
   }
 
-  if (stab)
-    if (S_ISLNK(stab->st_mode) && hidelinkmtime)
-      printf(" %10s","link");
+  if (!hidemtime) {
+    if (stab)
+      if (S_ISLNK(stab->st_mode) && hidelinkmtime)
+       printf(" %10s","link");
+      else
+       printf(" %10lu",
+              (unsigned long)stab->st_mtime);
     else
-      printf(" %10lu",
-            (unsigned long)stab->st_mtime);
-  else
-    pu10();
+      pu10();
+  }
 
   if (!hidectime) {
     if (stab)
@@ -388,6 +390,9 @@ int main(int argc, const char *const *argv) {
       case 'A':
        hideatime= 1;
        break;
+      case 'M':
+       hidemtime= 1;
+       break;
       case 'f':
        errfile= stdout;
        break;