diff options
-rw-r--r-- | sm.c | 16 |
1 files changed, 16 insertions, 0 deletions
@@ -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")) { |