cruxports/mblaze/mblaze-delete.patch
2022-02-05 15:39:19 -05:00

80 lines
2.0 KiB
Diff

--- mblaze-1.1/GNUmakefile 2021-01-14 10:45:22.000000000 -0500
+++ mblaze-1.1f/GNUmakefile 2021-05-31 19:11:33.146804008 -0400
@@ -15,7 +15,7 @@
endif
DESTDIR=
-PREFIX=/usr/local
+PREFIX=/usr
BINDIR=$(PREFIX)/bin
MANDIR=$(PREFIX)/share/man
@@ -62,6 +62,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
--- mblaze-1.1/mdeliver.c 2021-01-14 10:45:22.000000000 -0500
+++ mblaze-1.1f/mdeliver.c 2021-05-31 19:01:02.500148004 -0400
@@ -287,6 +287,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[])
{
@@ -323,6 +339,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) {