Package: csh
Version: 20110502-2
Author: Guillem Jover <guillem@debian.org>
Status: sent
Debbug: 710209
Description: Reduce delta by using more of libbsd


diff --git a/debian/control b/debian/control
index 17a8d62..16400da 100644
--- a/debian/control
+++ b/debian/control
@@ -3,7 +3,7 @@ Section: shells
 Priority: optional
 Maintainer: Matej Vela <vela@debian.org>
 Standards-Version: 3.9.2
-Build-Depends: debhelper (>= 8), groff, libbsd-dev, pmake
+Build-Depends: debhelper (>= 8), groff, pkg-config, libbsd-dev (>= 0.4.0), pmake
 
 Package: csh
 Architecture: any
diff --git a/debian/patches/02_libbsd.diff b/debian/patches/02_libbsd.diff
index 470131f..0141289 100644
--- a/debian/patches/02_libbsd.diff
+++ b/debian/patches/02_libbsd.diff
@@ -3,11 +3,19 @@ Forwarded: not-needed
 Author: Matej Vela <vela@debian.org>
 Last-Update: 2011-07-05
 
-Index: csh-20110502/Makefile
-===================================================================
---- csh-20110502.orig/Makefile
-+++ csh-20110502/Makefile
-@@ -14,6 +14,7 @@
+---
+ Makefile |    4 +++-
+ 1 file changed, 3 insertions(+), 1 deletion(-)
+
+--- a/Makefile
++++ b/Makefile
+@@ -10,10 +10,12 @@ DFLAGS=-DBUILTIN -DFILEC -DNLS -DSHORT_S
+ DFLAGS+=-D_GNU_SOURCE
+ #CFLAGS+=-g
+ #CFLAGS+=-Wall
+-CFLAGS+=-I${.CURDIR} -I. ${DFLAGS}
++LIBBSD_CFLAGS!=pkg-config --cflags libbsd-overlay
++CFLAGS+=-I${.CURDIR} -I. ${DFLAGS} ${LIBBSD_CFLAGS}
  SRCS=	alloc.c char.c const.c csh.c dir.c dol.c error.c exec.c exp.c file.c \
  	func.c glob.c hist.c init.c lex.c misc.c parse.c proc.c \
  	sem.c set.c str.c time.c
@@ -15,68 +23,3 @@ Index: csh-20110502/Makefile
  
  CLEANFILES+=error.h const.h
  
-Index: csh-20110502/csh.c
-===================================================================
---- csh-20110502.orig/csh.c
-+++ csh-20110502/csh.c
-@@ -39,9 +39,10 @@
- #include <pwd.h>
- #include <stdlib.h>
- #include <string.h>
-+#include <bsd/string.h>
- #include <locale.h>
- #include <unistd.h>
--#include <vis.h>
-+#include <bsd/vis.h>
- #include <stdarg.h>
- 
- #include "csh.h"
-Index: csh-20110502/dir.c
-===================================================================
---- csh-20110502.orig/dir.c
-+++ csh-20110502/dir.c
-@@ -35,6 +35,7 @@
- #include <errno.h>
- #include <stdlib.h>
- #include <string.h>
-+#include <bsd/string.h>
- #include <unistd.h>
- #include <stdarg.h>
- 
-Index: csh-20110502/glob.c
-===================================================================
---- csh-20110502.orig/glob.c
-+++ csh-20110502/glob.c
-@@ -35,6 +35,7 @@
- #include <errno.h>
- #include <stdlib.h>
- #include <string.h>
-+#include <bsd/string.h>
- #include <unistd.h>
- #include <stdarg.h>
- 
-Index: csh-20110502/sem.c
-===================================================================
---- csh-20110502.orig/sem.c
-+++ csh-20110502/sem.c
-@@ -37,6 +37,7 @@
- #include <fcntl.h>
- #include <stdlib.h>
- #include <string.h>
-+#include <bsd/string.h>
- #include <unistd.h>
- #include <stdarg.h>
- 
-Index: csh-20110502/str.c
-===================================================================
---- csh-20110502.orig/str.c
-+++ csh-20110502/str.c
-@@ -39,7 +39,7 @@
- 
- #include <sys/types.h>
- #include <stdarg.h>
--#include <vis.h>
-+#include <bsd/vis.h>
- 
- #include "csh.h"
- #include "extern.h"
diff --git a/debian/patches/04_fpurge.diff b/debian/patches/04_fpurge.diff
deleted file mode 100644
index b555ba2..0000000
--- a/debian/patches/04_fpurge.diff
+++ /dev/null
@@ -1,19 +0,0 @@
-Description: Replace BSD-specific fpurge with GNU-specific __fpurge
-Forwarded: not-needed
-Author: Matej Vela <vela@debian.org>
-Last-Update: 2011-05-13
-
-Index: csh-20110313/csh.h
-===================================================================
---- csh-20110313.orig/csh.h
-+++ csh-20110313/csh.h
-@@ -96,6 +96,9 @@
- #include <stdio.h>
- FILE *cshin, *cshout, *csherr;
- 
-+#include <stdio_ext.h>
-+#define fpurge __fpurge
-+
- #define	isdir(d)	(S_ISDIR(d.st_mode))
- 
- typedef int bool;
diff --git a/debian/patches/06_time_h_for_time_t.diff b/debian/patches/06_time_h_for_time_t.diff
index e2fd5ce..862d876 100644
--- a/debian/patches/06_time_h_for_time_t.diff
+++ b/debian/patches/06_time_h_for_time_t.diff
@@ -3,13 +3,15 @@ Forwarded: not-needed
 Author: Matej Vela <vela@debian.org>
 Last-Update: 2011-07-05
 
-Index: csh-20110502/csh.c
-===================================================================
---- csh-20110502.orig/csh.c
-+++ csh-20110502/csh.c
-@@ -44,6 +44,7 @@
+---
+ csh.c |    1 +
+ 1 file changed, 1 insertion(+)
+
+--- a/csh.c
++++ b/csh.c
+@@ -43,6 +43,7 @@
  #include <unistd.h>
- #include <bsd/vis.h>
+ #include <vis.h>
  #include <stdarg.h>
 +#include <time.h>
  
diff --git a/debian/patches/07_funopen.diff b/debian/patches/07_funopen.diff
index c020339..61d92d8 100644
--- a/debian/patches/07_funopen.diff
+++ b/debian/patches/07_funopen.diff
@@ -3,11 +3,13 @@ Forwarded: not-needed
 Author: Matej Vela <vela@debian.org>
 Last-Update: 2011-05-13
 
-Index: csh-20110313/csh.c
-===================================================================
---- csh-20110313.orig/csh.c
-+++ csh-20110313/csh.c
-@@ -81,10 +81,11 @@
+---
+ csh.c |   30 ++++++++++++++----------------
+ 1 file changed, 14 insertions(+), 16 deletions(-)
+
+--- a/csh.c
++++ b/csh.c
+@@ -80,10 +80,11 @@ bool    tellwhat = 0;
  
  extern char **environ;
  
@@ -22,7 +24,7 @@ Index: csh-20110313/csh.c
  static int	srccat(Char *, Char *);
  static int	srcfile(char *, bool, bool);
  static void	phup(int);
-@@ -189,14 +190,11 @@
+@@ -188,14 +189,11 @@ main(int argc, char *argv[])
       *	    Fortunately this is not needed under the current implementation
       *	    of stdio.
       */
@@ -40,7 +42,7 @@ Index: csh-20110313/csh.c
  	exit(1);
      (void) setvbuf(cshin,  NULL, _IOLBF, 0);
      (void) setvbuf(cshout, NULL, _IOLBF, 0);
-@@ -1210,23 +1208,23 @@
+@@ -1209,23 +1207,23 @@ gethdir(Char *home, int len)
   */
  #define DESC(a) (*((int *) (a)) - (didfds && *((int *) a) >= FSHIN ? FSHIN : 0))
  
diff --git a/debian/patches/08_glob.diff b/debian/patches/08_glob.diff
index 23057bc..c8a11ef 100644
--- a/debian/patches/08_glob.diff
+++ b/debian/patches/08_glob.diff
@@ -9,11 +9,13 @@ Forwarded: not-needed
 Author: Matej Vela <vela@debian.org>
 Last-Update: 2011-05-13
 
-Index: csh-20110502/glob.c
-===================================================================
---- csh-20110502.orig/glob.c
-+++ csh-20110502/glob.c
-@@ -370,46 +370,99 @@
+---
+ glob.c |  109 ++++++++++++++++++++++++++++++++++++++++++++++++-----------------
+ 1 file changed, 81 insertions(+), 28 deletions(-)
+
+--- a/glob.c
++++ b/glob.c
+@@ -369,46 +369,99 @@ handleone(Char *str, Char **vl, int acti
  static Char **
  libglob(Char **vl)
  {
diff --git a/debian/patches/series b/debian/patches/series
index 1aae81f..c375c7b 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1,7 +1,6 @@
 01_gnu_source.diff
 02_libbsd.diff
 03_maxpathlen.diff
-04_fpurge.diff
 05_fhs_pathnames.diff
 06_time_h_for_time_t.diff
 07_funopen.diff
