aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTobias Kortkamp <tobik@FreeBSD.org>2018-08-09 12:25:08 +0000
committerTobias Kortkamp <tobik@FreeBSD.org>2018-08-09 12:25:08 +0000
commitf0f35ca44f95bfb48032f7495144d3514f7b33ec (patch)
treef55124bed3b8f0fbb87b82e17a2337c31ab89f14
parent1cc62922229afd7c16879b1aa7fd21410569fce9 (diff)
downloadports-f0f35ca44f95bfb48032f7495144d3514f7b33ec.tar.gz
ports-f0f35ca44f95bfb48032f7495144d3514f7b33ec.zip
net/omnitty: Add abililty to "toggle" tagged machines
We often need to do "something" to about half the machines, then do "something else" to the other half. So add a hack to toggle the "tagged" status of the machines. This is implemented by means of the F1 menu; the command characters "o" and "O" can toggle the "tagged" status of the machines. PR: 211682 Submitted by: maintainer
Notes
Notes: svn path=/head/; revision=476742
-rw-r--r--net/omnitty/Makefile5
-rw-r--r--net/omnitty/files/patch-machmgr.c25
-rw-r--r--net/omnitty/files/patch-machmgr.h13
-rw-r--r--net/omnitty/files/patch-main.c10
-rw-r--r--net/omnitty/files/patch-menu.c26
5 files changed, 70 insertions, 9 deletions
diff --git a/net/omnitty/Makefile b/net/omnitty/Makefile
index fd2ed1909f5e..26e4090c4fa1 100644
--- a/net/omnitty/Makefile
+++ b/net/omnitty/Makefile
@@ -3,7 +3,7 @@
PORTNAME= omnitty
PORTVERSION= 0.3.0
-PORTREVISION= 3
+PORTREVISION= 4
CATEGORIES= net
MASTER_SITES= SF/omnitty/omnitty/omnitty-${PORTVERSION}
@@ -19,9 +19,6 @@ LIBS+= -lncurses
ALL_TARGET= omnitty
PLIST_FILES= bin/omnitty man/man1/omnitty.1.gz
-post-patch:
- ${REINPLACE_CMD} 's|<alloca.h>|<stdlib.h>|' ${WRKSRC}/machmgr.c
-
do-install:
${INSTALL_PROGRAM} ${WRKSRC}/omnitty ${STAGEDIR}${PREFIX}/bin
${INSTALL_MAN} ${WRKSRC}/omnitty.1 ${STAGEDIR}${MANPREFIX}/man/man1
diff --git a/net/omnitty/files/patch-machmgr.c b/net/omnitty/files/patch-machmgr.c
new file mode 100644
index 000000000000..7700dfa97f08
--- /dev/null
+++ b/net/omnitty/files/patch-machmgr.c
@@ -0,0 +1,25 @@
+--- machmgr.c.orig 2005-10-25 22:04:01 UTC
++++ machmgr.c
+@@ -26,7 +26,7 @@
+ #include "machine.h"
+ #include "minibuf.h"
+ #include <string.h>
+-#include <alloca.h>
++#include <stdlib.h>
+
+ #define MACHINE_MAX 256
+
+@@ -261,5 +261,13 @@ void machmgr_delete_dead() {
+ int i;
+ for (i = machcount - 1; i >= 0; i--)
+ if (!machs[i]->alive) machmgr_delete(i);
++}
++
++void machmgr_toggle_tag_all(bool ignore_dead) {
++ int i;
++ for (i = 0; i < machcount; i++) {
++ if (!ignore_dead || machs[i]->alive)
++ machs[i]->tag = !machs[i]->tag;
++ }
+ }
+
diff --git a/net/omnitty/files/patch-machmgr.h b/net/omnitty/files/patch-machmgr.h
new file mode 100644
index 000000000000..f12a7ffc88fe
--- /dev/null
+++ b/net/omnitty/files/patch-machmgr.h
@@ -0,0 +1,13 @@
+--- machmgr.h.orig 2005-10-25 22:04:01 UTC
++++ machmgr.h
+@@ -106,6 +106,10 @@ void machmgr_delete_dead();
+ /* Deletes all tagged machines */
+ void machmgr_delete_tagged();
+
++/* Toggles tagged status of all machines. If ignore_dead, does not
++ * tag dead machines (i.e. machines whose alive flag is down). */
++void machmgr_toggle_tag_all(bool ignore_dead);
++
+ /* Tags all machines. If ignore_dead, does not tag dead machines (i.e. machines
+ * whose alive flag is down). */
+ void machmgr_tag_all(bool ignore_dead);
diff --git a/net/omnitty/files/patch-main.c b/net/omnitty/files/patch-main.c
index eb93bfa2ccb7..a55a77757d4d 100644
--- a/net/omnitty/files/patch-main.c
+++ b/net/omnitty/files/patch-main.c
@@ -1,5 +1,5 @@
---- main.c.orig 2005-10-26 06:08:25.000000000 +0800
-+++ main.c 2011-04-22 23:14:33.000000000 +0800
+--- main.c.orig 2005-10-25 22:08:25 UTC
++++ main.c
@@ -36,6 +36,7 @@
/* minimum terminal dimensions to run program */
#define MIN_REQUIRED_WIDTH 80
@@ -8,7 +8,7 @@
#define REMINDER_LINE "OmNiTTY-R v" OMNITTY_VERSION \
" \007F1\007:menu \006F2/3\007:sel \003F4\007:tag" \
-@@ -88,6 +88,12 @@
+@@ -88,6 +89,12 @@ void curses_init() {
define_key("\e[15~", KEY_F(5)); define_key("\e[17~", KEY_F(6));
define_key("\e[18~", KEY_F(7)); define_key("\e[19~", KEY_F(8));
define_key("\e[20~", KEY_F(9)); define_key("\e[21~", KEY_F(10));
@@ -21,7 +21,7 @@
getmaxyx(stdscr, h, w);
if (h < MIN_REQUIRED_HEIGHT || w < MIN_REQUIRED_WIDTH) {
-@@ -288,10 +289,10 @@
+@@ -288,10 +295,10 @@ static void add_machines_from_file(const char *file) {
}
static void add_machine() {
@@ -34,7 +34,7 @@
if (*buf == '@') add_machines_from_file(buf+1);
else machmgr_add(buf);
}
-@@ -335,9 +341,10 @@
+@@ -335,9 +342,10 @@ int main(int argc, char **argv) {
while (!quit) {
if (zombie_count) {
diff --git a/net/omnitty/files/patch-menu.c b/net/omnitty/files/patch-menu.c
new file mode 100644
index 000000000000..d008dfbcd4e6
--- /dev/null
+++ b/net/omnitty/files/patch-menu.c
@@ -0,0 +1,26 @@
+--- menu.c.orig 2005-10-25 22:04:01 UTC
++++ menu.c
+@@ -29,11 +29,13 @@
+ #include "help.h"
+
+ #define MENU_LINES 12
+-#define MENU_COLS 38
++#define MENU_COLS 45
+
+ #define MENU_CONTENTS \
+ "{[h]} online help\n" \
+ "{[r]} rename machine\n" \
++ "{[o]} toggle tag all machines (live only)\n" \
++ "{[O]} toggle tag all machines (live & dead)\n" \
+ "{[t]} tag all machines (live only)\n" \
+ "{[T]} tag all machines (live & dead)\n" \
+ "{[u]} untag all machines\n" \
+@@ -100,6 +102,8 @@ void menu_show() {
+ }
+
+ break;
++ case 'o': machmgr_toggle_tag_all(true); break;
++ case 'O': machmgr_toggle_tag_all(false); break;
+ case 't': machmgr_tag_all(true); break;
+ case 'T': machmgr_tag_all(false); break;
+ case 'u': machmgr_untag_all(); break;