69 lines
1.5 KiB
Diff
69 lines
1.5 KiB
Diff
--- a/mdeliver.c 2024-09-13 15:45:12.000000000 +0000
|
|
+++ b/mdeliver.c 2024-09-14 19:31:37.687633223 +0000
|
|
@@ -300,6 +300,22 @@
|
|
unlink(file);
|
|
}
|
|
|
|
+void
|
|
+mdelete(char *file)
|
|
+{
|
|
+ while (*file == ' ' || *file == '\t')
|
|
+ file++;
|
|
+
|
|
+ if (!kflag) {
|
|
+ unlink(file);
|
|
+ if (vflag)
|
|
+ fprintf(stderr, "Messages deleted.\n");
|
|
+ }
|
|
+
|
|
+ if (kflag)
|
|
+ fprintf(stderr, "Deletion command overridden.\n");
|
|
+}
|
|
+
|
|
int
|
|
main(int argc, char *argv[])
|
|
{
|
|
@@ -335,7 +351,32 @@
|
|
|
|
return 0;
|
|
}
|
|
+
|
|
+ if (strchr(argv[0], 't')) {
|
|
+ // mdelete(1)
|
|
|
|
+ int c;
|
|
+ while ((c = getopt(argc, argv, "kv")) != -1)
|
|
+ switch (c) {
|
|
+ case 'k': kflag = 1; break;
|
|
+ case 'v': vflag = 1; break;
|
|
+ default:
|
|
+usage3:
|
|
+ fprintf(stderr, "Usage: mdelete [-kv] [msgs]... \n");
|
|
+ exit(1);
|
|
+ }
|
|
+
|
|
+ if (argc == optind - 1)
|
|
+ goto usage3;
|
|
+
|
|
+ if (argc == optind && isatty(0))
|
|
+ goto usage3;
|
|
+ else
|
|
+ blaze822_loop(argc - optind, argv + optind, mdelete);
|
|
+
|
|
+ return 0;
|
|
+ }
|
|
+
|
|
int c;
|
|
while ((c = getopt(argc, argv, "cMvX:")) != -1)
|
|
switch (c) {
|
|
--- a/GNUmakefile 2024-09-13 15:45:12.000000000 +0000
|
|
+++ b/GNUmakefile 2024-09-14 19:32:32.333637833 +0000
|
|
@@ -63,6 +63,7 @@
|
|
ln -sf mcom $(DESTDIR)$(BINDIR)/mfwd
|
|
ln -sf mcom $(DESTDIR)$(BINDIR)/mrep
|
|
ln -sf mdeliver $(DESTDIR)$(BINDIR)/mrefile
|
|
+ ln -sf mdeliver $(DESTDIR)$(BINDIR)/mdelete
|
|
install -m0644 man/*.1 $(DESTDIR)$(MANDIR)/man1
|
|
install -m0644 man/*.5 $(DESTDIR)$(MANDIR)/man5
|
|
install -m0644 man/*.7 $(DESTDIR)$(MANDIR)/man7
|