implemented atime handling, rules maintain a timestamp when they where last triggered
[rxpd] / src / rxpd_file.c
index 0a78c72f296b039bd85acc68b6c5ba1f8cd38e91..75b551d0df88cdbb91d57be3774600690e9ee5f0 100644 (file)
@@ -127,7 +127,12 @@ rxpd_file_save (struct rxpd_file* self)
       LLIST_FOREACH (&self->rules, n)
         {
           struct rxpd_rule* node = (struct rxpd_rule*)n;
-          fprintf (f, "%s\n", node->string);
+          if (node->atime != (time_t)-1)
+            fprintf (f, "%ld:%s\n", node->atime, node->string);
+          else if (*node->string != '#')
+            fprintf (f, ":%s\n", node->string);
+          else
+            fprintf (f, "%s\n", node->string);
         }
 
       fclose (f);