cruxports/mblaze/mblaze-delete.patch

70 lines
1.6 KiB
Diff
Raw Normal View History

2022-05-12 11:16:20 -04:00
--- mblaze-1.2/mdeliver.c 2021-12-12 11:39:30.000000000 -0500
+++ mblaze-1.2f/mdeliver.c 2022-05-12 09:01:42.858863260 -0400
@@ -300,6 +300,23 @@ refile(char *file)
2022-02-05 15:39:19 -05:00
unlink(file);
}
2022-05-12 11:16:20 -04:00
+
2022-02-05 15:39:19 -05:00
+void
+mdelete(char *file)
2022-05-12 11:16:20 -04:00
+{
+ while (*file == ' ' || *file == '\t')
+ file++;
2022-02-05 15:39:19 -05:00
+
2022-05-12 11:16:20 -04:00
+ if (!kflag) {
+ unlink(file);
+ if (vflag)
+ fprintf(stderr, "Messages deleted.\n");
+ }
+
+ if (kflag)
+ fprintf(stderr, "Deletion command overridden.\n");
+}
2022-02-05 15:39:19 -05:00
+
int
main(int argc, char *argv[])
{
2022-05-12 11:16:20 -04:00
@@ -335,6 +352,32 @@ usage:
2022-02-05 15:39:19 -05:00
return 0;
}
2022-05-12 11:16:20 -04:00
+
+
2022-02-05 15:39:19 -05:00
+ if (strchr(argv[0], 't')) {
2022-05-12 11:16:20 -04:00
+ // mdelete(1)
2022-02-05 15:39:19 -05:00
+
2022-05-12 11:16:20 -04:00
+ int c;
+ while ((c = getopt(argc, argv, "kv")) != -1)
+ switch (c) {
+ case 'k': kflag = 1; break;
+ case 'v': vflag = 1; break;
+ default:
2022-02-05 15:39:19 -05:00
+usage3:
2022-05-12 11:16:20 -04:00
+ fprintf(stderr, "Usage: mdelete [-kv] [msgs]... \n");
+ exit(1);
+ }
2022-02-05 15:39:19 -05:00
+
2022-05-12 11:16:20 -04:00
+ if (argc == optind - 1)
+ goto usage3;
2022-02-05 15:39:19 -05:00
+
2022-05-12 11:16:20 -04:00
+ if (argc == optind && isatty(0))
+ goto usage3;
+ else
+ blaze822_loop(argc - optind, argv + optind, mdelete);
2022-02-05 15:39:19 -05:00
+
2022-05-12 11:16:20 -04:00
+ return 0;
2022-02-05 15:39:19 -05:00
+ }
2022-05-12 11:16:20 -04:00
2022-02-05 15:39:19 -05:00
int c;
while ((c = getopt(argc, argv, "cMvX:")) != -1)
2022-05-12 11:16:20 -04:00
--- mblaze-1.2/GNUmakefile 2021-12-12 11:39:30.000000000 -0500
+++ mblaze-1.2f/GNUmakefile 2022-05-12 09:02:48.345479146 -0400
@@ -62,6 +62,7 @@ install: FRC all
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