#! /bin/sh /usr/share/dpatch/dpatch-run
## 05upgrade-check-binary.dpatch by David Pashley <david@davidpashley.com>
##
## All lines beginning with `## DP:' are a description of the patch.
## DP: No description.

@DPATCH@
diff -urNad --exclude=CVS --exclude=.svn ./src/core/commands.h /tmp/dpep-work.Ftr28C/irssi/src/core/commands.h
--- ./src/core/commands.h	2005-07-16 13:12:12.000000000 +0300
+++ /tmp/dpep-work.Ftr28C/irssi/src/core/commands.h	2005-07-16 13:17:06.000000000 +0300
@@ -40,6 +40,7 @@
 	CMDERR_NOT_GOOD_IDEA, /* not good idea to do, -yes overrides this */
 	CMDERR_INVALID_TIME, /* invalid time specification */
 	CMDERR_INVALID_CHARSET, /* invalid charset specification */
+	CMDERR_PROGRAM_NOT_FOUND, /* program not found */
 	CMDERR_EVAL_MAX_RECURSE /* eval hit recursion limit */
 };
 
diff -urNad --exclude=CVS --exclude=.svn ./src/core/session.c /tmp/dpep-work.Ftr28C/irssi/src/core/session.c
--- ./src/core/session.c	2005-07-16 00:48:59.000000000 +0300
+++ /tmp/dpep-work.Ftr28C/irssi/src/core/session.c	2005-07-16 13:16:10.000000000 +0300
@@ -95,6 +95,8 @@
 		data = irssi_binary;
 	if (data == NULL)
                 cmd_return_error(CMDERR_NOT_ENOUGH_PARAMS);
+	if (!(data = g_find_program_in_path(data)))
+                cmd_return_error(CMDERR_PROGRAM_NOT_FOUND);
 
 	/* save the session */
         session_file = g_strdup_printf("%s/session", get_irssi_dir());
diff -urNad --exclude=CVS --exclude=.svn ./src/fe-common/core/fe-core-commands.c /tmp/dpep-work.Ftr28C/irssi/src/fe-common/core/fe-core-commands.c
--- ./src/fe-common/core/fe-core-commands.c	2005-07-16 13:12:12.000000000 +0300
+++ /tmp/dpep-work.Ftr28C/irssi/src/fe-common/core/fe-core-commands.c	2005-07-16 13:17:44.000000000 +0300
@@ -50,6 +50,7 @@
 	TXT_NOT_GOOD_IDEA,
         TXT_INVALID_TIME,
         TXT_INVALID_CHARSET,
+        TXT_PROGRAM_NOT_FOUND,
         TXT_EVAL_MAX_RECURSE
 };
 
diff -urNad --exclude=CVS --exclude=.svn ./src/fe-common/core/module-formats.c /tmp/dpep-work.Ftr28C/irssi/src/fe-common/core/module-formats.c
--- ./src/fe-common/core/module-formats.c	2005-07-16 13:12:12.000000000 +0300
+++ /tmp/dpep-work.Ftr28C/irssi/src/fe-common/core/module-formats.c	2005-07-16 13:18:27.000000000 +0300
@@ -219,6 +219,7 @@
 	{ "invalid_level", "Invalid message level", 0 },
 	{ "invalid_size", "Invalid size", 0 },
 	{ "invalid_charset", "Invalid charset: $0", 1, { 0 } },
+	{ "program_not_found", "Could not find file or file was not executable", 0 },
 	{ "eval_max_recurse", "/eval hit maximum recursion limit", 0 },
 
 	/* ---- */
diff -urNad --exclude=CVS --exclude=.svn ./src/fe-common/core/module-formats.h /tmp/dpep-work.Ftr28C/irssi/src/fe-common/core/module-formats.h
--- ./src/fe-common/core/module-formats.h	2005-07-16 13:12:12.000000000 +0300
+++ /tmp/dpep-work.Ftr28C/irssi/src/fe-common/core/module-formats.h	2005-07-16 13:18:48.000000000 +0300
@@ -188,6 +188,7 @@
 	TXT_INVALID_LEVEL,
 	TXT_INVALID_SIZE,
 	TXT_INVALID_CHARSET,
+	TXT_PROGRAM_NOT_FOUND,
 	TXT_EVAL_MAX_RECURSE,
 
 	TXT_FILL_11,
