Date: Tue, 16 Nov 2010 18:10:33 +0200 (EET) From: "ports@c0decafe.net" <ports@c0decafe.net> To: FreeBSD-gnats-submit@FreeBSD.org Cc: gnome@FreeBSD.org Subject: ports/152302: [PATCH] devel/libnotify: optional stdin patch Message-ID: <201011161610.oAGGAXp5097822@absolut.c0decafe.net> Resent-Message-ID: <201011161620.oAGGK98t043109@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
>Number: 152302 >Category: ports >Synopsis: [PATCH] devel/libnotify: optional stdin patch >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-ports-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: change-request >Submitter-Id: current-users >Arrival-Date: Tue Nov 16 16:20:08 UTC 2010 >Closed-Date: >Last-Modified: >Originator: ports@c0decafe.net >Release: FreeBSD 8.1-RELEASE-p1 amd64 >Organization: c0decafe networks >Environment: System: FreeBSD absolut.c0decafe.net 8.1-RELEASE-p1 FreeBSD 8.1-RELEASE-p1 #1: Tue Sep 21 14:11:34 EEST 2010 >Description: optional stdin patch from: - http://www.floodgap.com/software/ttytter/libnotifypatch.txt Added file(s): - files/extra-patch-stdin Port maintainer (gnome@FreeBSD.org) is cc'd. Generated with FreeBSD Port Tools 0.99 >How-To-Repeat: >Fix: --- libnotify-0.4.5_4.patch begins here --- diff -ruN --exclude=CVS /usr/ports/devel/libnotify.orig/Makefile /usr/ports/devel/libnotify/Makefile --- /usr/ports/devel/libnotify.orig/Makefile 2010-06-01 01:52:34.000000000 +0300 +++ /usr/ports/devel/libnotify/Makefile 2010-11-16 17:55:59.000000000 +0200 @@ -22,8 +22,15 @@ USE_GMAKE= yes USE_LDCONFIG= yes USE_AUTOTOOLS= libtool:22 -CONFIGURE_ARGS= --without-gtk-doc +CONFIGURE_ARGS= --without-gtk-doc CONFIGURE_ENV= CPPFLAGS="-I${LOCALBASE}/include" \ LDFLAGS="-L${LOCALBASE}/lib" +OPTIONS= STDIN "With stdin patch" off + +post-patch: +.if !defined(WITHOUT_STDIN) + @${PATCH} ${PATCH_ARGS} < ${PATCHDIR}/extra-patch-stdin +.endif + .include <bsd.port.mk> diff -ruN --exclude=CVS /usr/ports/devel/libnotify.orig/distinfo /usr/ports/devel/libnotify/distinfo --- /usr/ports/devel/libnotify.orig/distinfo 2009-01-10 07:21:26.000000000 +0200 +++ /usr/ports/devel/libnotify/distinfo 2010-11-16 17:56:10.000000000 +0200 @@ -1,3 +1,2 @@ -MD5 (libnotify-0.4.5.tar.gz) = 472e2c1f808848365572a9b024d9e8f5 SHA256 (libnotify-0.4.5.tar.gz) = 0799db8ea1500b65a477421a8c930cc8c8b0bbc0596e55ea1601e2542f3fb0d9 SIZE (libnotify-0.4.5.tar.gz) = 364142 diff -ruN --exclude=CVS /usr/ports/devel/libnotify.orig/files/extra-patch-stdin /usr/ports/devel/libnotify/files/extra-patch-stdin --- /usr/ports/devel/libnotify.orig/files/extra-patch-stdin 1970-01-01 02:00:00.000000000 +0200 +++ /usr/ports/devel/libnotify/files/extra-patch-stdin 2010-11-16 17:48:25.000000000 +0200 @@ -0,0 +1,120 @@ +--- tools/notify-send.c.old 2007-10-15 20:19:20.000000000 -0400 ++++ tools/notify-send.c 2007-10-15 21:44:19.000000000 -0400 +@@ -124,12 +124,70 @@ + return TRUE; + } + ++static gchar * ++get_file_contents(const gchar *filename) ++{ ++ GError *error = NULL; ++ gchar *contents = NULL; ++ gsize length = 0; ++ ++ if (!strcmp(filename, "-")) ++ { ++ GIOChannel *channel = NULL; ++ GIOStatus status = G_IO_STATUS_NORMAL; ++ ++#if G_OS_WIN32 ++ channel = g_io_channel_win32_new_fd(0); ++#else ++ channel = g_io_channel_unix_new(0); ++#endif ++ if (!channel) ++ { ++ fprintf(stderr, "%s\n", error->message); ++ g_error_free(error); ++ exit(1); ++ } ++ ++ do { ++ status = g_io_channel_read_to_end(channel, ++ &contents, &length, &error); ++ } while (status == G_IO_STATUS_AGAIN); ++ if (status != G_IO_STATUS_NORMAL) ++ { ++ fprintf(stderr, "%s\n", error->message); ++ g_error_free(error); ++ exit(1); ++ } ++ ++ g_io_channel_unref(channel); ++ } ++ else if (!g_file_get_contents(filename, &contents, &length, &error)) ++ { ++ fprintf(stderr, "%s\n", error->message); ++ g_error_free(error); ++ exit(1); ++ } ++ ++ /* Remove the end-of-file newline */ ++ /* Not using g_chomp() to allow users to end with newlines if they like */ ++ if (contents[length-2] == '\r' && contents[length-1] == '\n') ++ contents[length-2] = '\0'; ++ else if (contents[length-1] == '\n') ++ contents[length-1] = '\0'; ++ else if (contents[length-1] == '\r') ++ contents[length-1] = '\0'; ++ ++ return contents; ++} ++ + int + main(int argc, char *argv[]) + { + static const gchar *summary = NULL; +- static const gchar *body = ""; + static const gchar *type = NULL; ++ static gchar *body = ""; ++ static gchar *body_file = NULL; ++ static gboolean body_allocated = FALSE; + static gchar *icon_str = NULL; + static gchar *icons = NULL; + static gchar **n_text = NULL; +@@ -147,6 +205,9 @@ + { "urgency", 'u', 0, G_OPTION_ARG_CALLBACK, g_option_arg_urgency_cb, + N_("Specifies the urgency level (low, normal, critical)."), + N_("LEVEL") }, ++ { "file", 'f', 0, G_OPTION_ARG_FILENAME, &body_file, ++ N_("Specifies a file whose contents will form the body of the " ++ "notification."), N_("FILENAME") }, + { "expire-time", 't', 0,G_OPTION_ARG_INT, &expire_timeout, + N_("Specifies the timeout in milliseconds at which to expire the " + "notification."), N_("TIME") }, +@@ -199,7 +260,12 @@ + exit(1); + } + +- if (n_text[1] != NULL) ++ if (n_text[1] != NULL && body_file != NULL) ++ { ++ fprintf(stderr, "%s\n", N_("Only one notification body may be given.")); ++ exit(1); ++ } ++ else if (n_text[1] != NULL) + { + body = n_text[1]; + +@@ -209,6 +275,11 @@ + exit(1); + } + } ++ else if (body_file != NULL) ++ { ++ body = get_file_contents(body_file); ++ body_allocated = TRUE; ++ } + + if (icons != NULL) + { +@@ -273,6 +344,9 @@ + + g_object_unref(G_OBJECT(notify)); + ++ if (body_allocated) ++ g_free(body); ++ + notify_uninit(); + + exit(hint_error); \ No newline at end of file --- libnotify-0.4.5_4.patch ends here --- >Release-Note: >Audit-Trail: >Unformatted:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201011161610.oAGGAXp5097822>