summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sm.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/sm.c b/sm.c
index 3ab7726..59e286e 100644
--- a/sm.c
+++ b/sm.c
@@ -380,6 +380,19 @@ list(const char *filename)
}
static int
+touch(const char *filename)
+{
+ Document *d;
+
+ if ((d = dbfind(filename)) == NULL) {
+ fprintf(stderr, "%s: no such file\n", filename);
+ return 0;
+ }
+ d->creat = d->mod = time(NULL);
+ return 1;
+}
+
+static int
unset(const char *filename, const char *plname)
{
Document *d;
@@ -469,6 +482,9 @@ editcmd:
} else if (!strcmp(cmd.argv[0], "rm")) {
if (dbdel(cmd.argv[1]))
dbwrite(kdbloc);
+ } else if (!strcmp(cmd.argv[0], "touch")) {
+ if (touch(cmd.argv[1]))
+ dbwrite(kdbloc);
} else if (cmd.argc < 3) {
fprintf(stderr, "invalid command/needs more parameters\n");
} else if (!strcmp(cmd.argv[0], "set")) {