cruxports/mblaze/mdeliver.patch

69 lines
1.5 KiB
Diff
Raw Normal View History

2024-09-14 15:53:07 -04:00
--- 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 @@
2022-02-05 15:39:19 -05:00
unlink(file);
}
+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[])
{
2024-09-14 15:53:07 -04:00
@@ -335,7 +351,32 @@
2022-05-12 11:16:20 -04:00
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)
2024-09-14 15:53:07 -04: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
+ }
2024-09-14 15:53:07 -04:00
+
2022-02-05 15:39:19 -05:00
int c;
while ((c = getopt(argc, argv, "cMvX:")) != -1)
2024-09-14 15:53:07 -04:00
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 @@
2022-05-12 11:16:20 -04:00
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