Date: Thu, 9 Aug 2018 12:25:08 +0000 (UTC) From: Tobias Kortkamp <tobik@FreeBSD.org> To: ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org Subject: svn commit: r476742 - in head/net/omnitty: . files Message-ID: <201808091225.w79CP8vc001890@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: tobik Date: Thu Aug 9 12:25:08 2018 New Revision: 476742 URL: https://svnweb.freebsd.org/changeset/ports/476742 Log: 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 Added: head/net/omnitty/files/patch-machmgr.c (contents, props changed) head/net/omnitty/files/patch-machmgr.h (contents, props changed) head/net/omnitty/files/patch-menu.c (contents, props changed) Modified: head/net/omnitty/Makefile head/net/omnitty/files/patch-main.c Modified: head/net/omnitty/Makefile ============================================================================== --- head/net/omnitty/Makefile Thu Aug 9 12:22:41 2018 (r476741) +++ head/net/omnitty/Makefile Thu Aug 9 12:25:08 2018 (r476742) @@ -3,7 +3,7 @@ PORTNAME= omnitty PORTVERSION= 0.3.0 -PORTREVISION= 3 +PORTREVISION= 4 CATEGORIES= net MASTER_SITES= SF/omnitty/omnitty/omnitty-${PORTVERSION} @@ -18,9 +18,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 Added: head/net/omnitty/files/patch-machmgr.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/net/omnitty/files/patch-machmgr.c Thu Aug 9 12:25:08 2018 (r476742) @@ -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; ++ } + } + Added: head/net/omnitty/files/patch-machmgr.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/net/omnitty/files/patch-machmgr.h Thu Aug 9 12:25:08 2018 (r476742) @@ -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); Modified: head/net/omnitty/files/patch-main.c ============================================================================== --- head/net/omnitty/files/patch-main.c Thu Aug 9 12:22:41 2018 (r476741) +++ head/net/omnitty/files/patch-main.c Thu Aug 9 12:25:08 2018 (r476742) @@ -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) { Added: head/net/omnitty/files/patch-menu.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/net/omnitty/files/patch-menu.c Thu Aug 9 12:25:08 2018 (r476742) @@ -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;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201808091225.w79CP8vc001890>