commit f90685e92a8731dd56c5c4215114821ce61522ad
Author: Jakub Bogusz <[email protected]>
Date:   Sun Aug 23 09:56:28 2020 +0200

    - enhanced misc patch to fix build with libbsd installed
    - some fixes to allow compilation in current environment 
(getline,gcc,format,wait patches)
    - verbose man files

 lpr-format.patch  |  15 ++++++
 lpr-gcc.patch     |  19 +++++++
 lpr-getline.patch | 147 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
 lpr-misc.patch    |  48 +++++++++++++++---
 lpr-wait.patch    |  60 ++++++++++++++++++++++
 lpr.spec          |  29 ++++++++---
 6 files changed, 305 insertions(+), 13 deletions(-)
---
diff --git a/lpr.spec b/lpr.spec
index a3a2c46..cc58d55 100644
--- a/lpr.spec
+++ b/lpr.spec
@@ -6,9 +6,9 @@ Summary(tr.UTF-8):      Yerel ve uzak yazıcılara erişim için 
sunucu ve istemci
 Name:          lpr
 Version:       0.72
 Release:       2.2
-License:       distributable
+License:       BSD
 Group:         Applications/System
-Source0:       http://dl.sourceforge.net/lpr/%{name}-%{version}.tar.gz
+Source0:       http://downloads.sourceforge.net/lpr/%{name}-%{version}.tar.gz
 # Source0-md5: f2a46147427f20863f98b87cd9a0d772
 Source1:       lpd.init
 Source2:       lpd.sysconfig
@@ -16,6 +16,10 @@ Source3:     
http://www.mif.pg.gda.pl/homepages/ankry/man-PLD/%{name}-non-english-ma
 # Source3-md5: aaa4f77e36d8778eda8f88587f7f7c4e
 Patch0:                %{name}-misc.patch
 Patch1:                %{name}-rmjobfix.patch
+Patch2:                %{name}-getline.patch
+Patch3:                %{name}-gcc.patch
+Patch4:                %{name}-format.patch
+Patch5:                %{name}-wait.patch
 URL:           http://lpr.sourceforge.net/
 Requires(post,preun):  /sbin/chkconfig
 Requires:      rc-scripts
@@ -54,14 +58,18 @@ kabul eder.
 %setup -q
 %patch0 -p1
 %patch1 -p0
+%patch2 -p1
+%patch3 -p1
+%patch4 -p1
+%patch5 -p1
 
 %build
 %{__make} \
+       CC="%{__cc}" \
        OPT_FLAGS="%{rpmcflags}"
 
 %install
 rm -rf $RPM_BUILD_ROOT
-
 install -d $RPM_BUILD_ROOT{/etc/{rc.d/init.d,sysconfig},/var/lock} \
        $RPM_BUILD_ROOT{%{_bindir},%{_sbindir},%{_mandir}/man{1,5,8}} \
        $RPM_BUILD_ROOT%{_fontsdir}/vfont/{B,I,R,S} \
@@ -90,25 +98,32 @@ fi
 %files
 %defattr(644,root,root,755)
 %attr(754,root,root) /etc/rc.d/init.d/lpd
-%attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) 
/etc/sysconfig/*
+%attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) 
/etc/sysconfig/lpd
 
 %attr(4710,root,lp) %{_bindir}/lpq
 %attr(4710,root,lp) %{_bindir}/lpr
 %attr(4710,root,lp) %{_bindir}/lprm
 %attr(755,root,lp) %{_bindir}/lptest
 
-%attr(2710,root,lp)   %{_sbindir}/lpc
+%attr(2710,root,lp) %{_sbindir}/lpc
 %attr(755,root,root) %{_sbindir}/lpd
 %attr(755,root,root) %{_sbindir}/lpf
 %attr(755,root,root) %{_sbindir}/pac
 
-%{_mandir}/man[158]/*
+%{_mandir}/man1/lpq.1*
+%{_mandir}/man1/lpr.1*
+%{_mandir}/man1/lprm.1*
+%{_mandir}/man1/lptest.1*
+%{_mandir}/man5/printcap.5*
+%{_mandir}/man8/lpc.8*
+%{_mandir}/man8/lpd.8*
+%{_mandir}/man8/pac.8*
 %lang(fi) %{_mandir}/fi/man[158]/*
 %lang(fr) %{_mandir}/fr/man[158]/*
 %lang(it) %{_mandir}/it/man[158]/*
 %lang(pl) %{_mandir}/pl/man[158]/*
 %{_fontsdir}/vfont
 
-%ghost /var/lock/*
+%ghost /var/lock/lpd.lock
 %dir %attr(770,root,lp) %{_var}/spool/lpd
 %dir %attr(770,root,lp) %{_var}/spool/lpd/lp
diff --git a/lpr-format.patch b/lpr-format.patch
new file mode 100644
index 0000000..0e08555
--- /dev/null
+++ b/lpr-format.patch
@@ -0,0 +1,15 @@
+--- lpr-0.72/common_source/displayq.c.orig     2001-05-23 23:51:04.000000000 
+0200
++++ lpr-0.72/common_source/displayq.c  2020-08-22 22:20:23.300468056 +0200
+@@ -273,10 +273,10 @@
+ void
+ header()
+ {
+-      printf(head0);
++      fputs(head0, stdout);
+       col = strlen(head0)+1;
+       blankfill(SIZCOL);
+-      printf(head1);
++      fputs(head1, stdout);
+ }
+ 
+ void
diff --git a/lpr-gcc.patch b/lpr-gcc.patch
new file mode 100644
index 0000000..3559d4b
--- /dev/null
+++ b/lpr-gcc.patch
@@ -0,0 +1,19 @@
+--- lpr-0.72/common_source/common.c.orig       2020-08-22 21:25:29.854976847 
+0200
++++ lpr-0.72/common_source/common.c    2020-08-22 21:27:42.610924313 +0200
+@@ -188,6 +188,8 @@
+       return(linel);
+ }
+ 
++static int compar(register struct queue **p1, register struct queue **p2);
++
+ /*
+  * Scan the current directory and make a list of daemon files sorted by
+  * creation time.
+@@ -203,7 +205,6 @@
+       struct stat stbuf;
+       DIR *dirp;
+       int arraysz;
+-      static int compar();
+ 
+       if ((dirp = opendir(SD)) == NULL)
+               return(-1);
diff --git a/lpr-getline.patch b/lpr-getline.patch
new file mode 100644
index 0000000..670f7f7
--- /dev/null
+++ b/lpr-getline.patch
@@ -0,0 +1,147 @@
+--- lpr-0.72/common_source/protos.h.orig       2001-05-23 23:51:04.000000000 
+0200
++++ lpr-0.72/common_source/protos.h    2020-08-22 21:22:04.236090780 +0200
+@@ -44,7 +44,7 @@
+ 
+ void fatal(const char *msg, ...);
+ int getport(char *rhost, int rport);
+-int getline(FILE *cfp);
++int lpr_getline(FILE *cfp);
+ int getq(struct queue *(*namelist[]));
+ char *checkremote(void);
+ int checkfromremote(char *fromhost);
+--- lpr-0.72/common_source/common.c.orig       2001-05-23 23:51:04.000000000 
+0200
++++ lpr-0.72/common_source/common.c    2020-08-22 21:25:29.854976847 +0200
+@@ -164,7 +164,7 @@
+  * Returns 0 at EOF or the number of characters read.
+  */
+ int
+-getline(cfp)
++lpr_getline(cfp)
+       FILE *cfp;
+ {
+       register int linel = 0;
+--- lpr-0.72/common_source/displayq.c.orig     2020-08-22 22:20:23.300468056 
+0200
++++ lpr-0.72/common_source/displayq.c  2020-08-22 22:20:34.857072115 +0200
+@@ -300,7 +300,7 @@
+       if (sendtorem || garbage || strcmp(cf, current))
+               rank++;
+       j = 0;
+-      while (getline(cfp)) {
++      while (lpr_getline(cfp)) {
+               switch (line[0]) {
+               case 'P': /* Was this file specified in the user's list? */
+                       if (!inlist(line+1, cf)) {
+--- lpr-0.72/common_source/rmjob.c.orig        2020-08-22 22:21:05.806904445 
+0200
++++ lpr-0.72/common_source/rmjob.c     2020-08-22 22:24:15.799208502 +0200
+@@ -156,7 +156,7 @@
+                       return(0);
+       }
+       seteuid(uid);
+-      if (!getline(fp)) {
++      if (!lpr_getline(fp)) {
+               (void) fclose(fp);
+               return(0);              /* no daemon present */
+       }
+@@ -194,7 +194,7 @@
+       if ((cfp = fopen(file, "r")) == NULL)
+               fatal("cannot open %s", file);
+       seteuid(uid);
+-      while (getline(cfp)) {
++      while (lpr_getline(cfp)) {
+               switch (line[0]) {
+               case 'P':
+                       strncpy(logname, line+1, sizeof(logname)-1);
+@@ -250,7 +250,7 @@
+       if ((cfp = fopen(file, "r")) == NULL)
+               return(0);
+       seteuid(uid);
+-      while (getline(cfp)) {
++      while (lpr_getline(cfp)) {
+               if (line[0] == 'P') {
+                       strncpy(p, line+1, sizeof(p)-1);
+                       p[sizeof(p)-1] = '\0';
+--- lpr-0.72/lpc/cmds.c.orig   2001-05-17 23:53:46.000000000 +0200
++++ lpr-0.72/lpc/cmds.c        2020-08-22 22:33:56.136064547 +0200
+@@ -148,7 +148,7 @@
+               seteuid(uid);
+               return;
+       }
+-      if (!getline(fp) || flock(fileno(fp), LOCK_SH|LOCK_NB) == 0) {
++      if (!lpr_getline(fp) || flock(fileno(fp), LOCK_SH|LOCK_NB) == 0) {
+               (void) fclose(fp);      /* unlocks as well */
+               printf("\tno daemon to abort\n");
+               seteuid(uid);
+@@ -1047,7 +1047,7 @@
+               seteuid(uid);
+               if (fp == NULL)
+                       continue;
+-              while (getline(fp) > 0)
++              while (lpr_getline(fp) > 0)
+                       if (line[0] == 'P')
+                               break;
+               (void) fclose(fp);
+--- lpr-0.72/lpd/printjob.c.orig       2001-05-17 23:53:46.000000000 +0200
++++ lpr-0.72/lpd/printjob.c    2020-08-22 22:38:40.111192789 +0200
+@@ -366,7 +366,7 @@
+       /* pass 0 */
+       /* Henri Gomez <[email protected]> 19991104 */
+       /* Pre scan to get the Z flags (RFC Filter Extension) */
+-      while (getline(cfp))
++      while (lpr_getline(cfp))
+               switch (line[0]) {
+         case 'Z':
+             if (line[1] != '\0') {
+@@ -388,7 +388,7 @@
+ 
+       /* pass 1 */
+ 
+-      while (getline(cfp))
++      while (lpr_getline(cfp))
+               switch (line[0]) {
+               case 'H':
+                       strncpy(fromhost, line+1, sizeof(fromhost) - 1);
+@@ -535,7 +535,7 @@
+ 
+ pass2:
+       fseek(cfp, 0L, 0);
+-      while (getline(cfp))
++      while (lpr_getline(cfp))
+               switch (line[0]) {
+               case 'L':       /* identification line */
+                       if (!SH && HL)
+@@ -920,7 +920,7 @@
+       /* pass 0 */
+       /* Henri Gomez <[email protected]> 19991104 */
+       /* Pre scan to get the Z flags (RFC Filter Extension) */
+-      while (getline(cfp))
++      while (lpr_getline(cfp))
+         switch (line[0]) {
+         case 'E':
+           /* ignore too many options */
+@@ -935,7 +935,7 @@
+       /*
+        * pass 1
+        */
+-      while (getline(cfp)) {
++      while (lpr_getline(cfp)) {
+       again:
+                if (line[0] == 'S') {
+                       if (dup_cfp)
+@@ -999,7 +999,7 @@
+ 
+                       strcpy(last, line);
+                       /* handle multiple copies */
+-                       while ((i = getline(cfp))) {
++                       while ((i = lpr_getline(cfp))) {
+                          if (dup_cfp)
+                            fprintf(dup_cfp, "%s\n", line);
+                               if (strcmp(last, line))
+@@ -1172,7 +1172,7 @@
+               return(OK);
+       }
+ 
+-      while (getline(cfp))
++      while (lpr_getline(cfp))
+               if (line[0] == 'U' && strchr(line+1, '/') == NULL)
+                       (void) unlinkfile(line+1, from, logname);
+       /*
diff --git a/lpr-misc.patch b/lpr-misc.patch
index a946b89..94b9d5a 100644
--- a/lpr-misc.patch
+++ b/lpr-misc.patch
@@ -26,7 +26,7 @@ diff -Nur lpr-0.33/common_source/pathnames.h 
lpr-0.33.pld/common_source/pathname
  
 -CFLAGS        = -Wall $(RPM_OPT_FLAGS) -I../common_source -I/usr/include/bsd
 -LDFLAGS       = 
-+CFLAGS        = -Wall $(OPT_FLAGS) -I../common_source -I/usr/include/bsd
++CFLAGS        = -Wall $(OPT_FLAGS) -I../common_source
 +LDFLAGS       = -s
  LDLIBS = -lcommon -L ../common_source # -lbsd
  
@@ -37,7 +37,7 @@ diff -Nur lpr-0.33/common_source/pathnames.h 
lpr-0.33.pld/common_source/pathname
  
 -CFLAGS        = -Wall $(RPM_OPT_FLAGS) -I../common_source -I/usr/include/bsd
 -LDFLAGS       = 
-+CFLAGS        = -Wall $(OPT_FLAGS) -I../common_source -I/usr/include/bsd
++CFLAGS        = -Wall $(OPT_FLAGS) -I../common_source
 +LDFLAGS       = -s
  LDLIBS = -lcommon -L ../common_source # -lbsd
  
@@ -48,7 +48,7 @@ diff -Nur lpr-0.33/common_source/pathnames.h 
lpr-0.33.pld/common_source/pathname
  
 -CFLAGS        = -Wall $(RPM_OPT_FLAGS) -I../common_source -I/usr/include/bsd
 -LDFLAGS       = 
-+CFLAGS        = -Wall $(OPT_FLAGS) -I../common_source -I/usr/include/bsd
++CFLAGS        = -Wall $(OPT_FLAGS) -I../common_source
 +LDFLAGS       = -s
  LDLIBS = -lcommon -L ../common_source # -lbsd
  
@@ -59,7 +59,7 @@ diff -Nur lpr-0.33/common_source/pathnames.h 
lpr-0.33.pld/common_source/pathname
  
 -CFLAGS        = -Wall $(RPM_OPT_FLAGS) -I../common_source -I/usr/include/bsd
 -LDFLAGS       = 
-+CFLAGS        = -Wall $(OPT_FLAGS) -I../common_source -I/usr/include/bsd
++CFLAGS        = -Wall $(OPT_FLAGS) -I../common_source
 +LDFLAGS       = -s
  LDLIBS = -lcommon -L ../common_source # -lbsd
  
@@ -70,7 +70,7 @@ diff -Nur lpr-0.33/common_source/pathnames.h 
lpr-0.33.pld/common_source/pathname
  
 -CFLAGS        = -Wall $(RPM_OPT_FLAGS) -I../common_source -I/usr/include/bsd
 -LDFLAGS       = 
-+CFLAGS        = -Wall $(OPT_FLAGS) -I../common_source -I/usr/include/bsd
++CFLAGS        = -Wall $(OPT_FLAGS) -I../common_source
 +LDFLAGS       = -s
  LDLIBS = -lcommon -L ../common_source # -lbsd
  
@@ -83,9 +83,45 @@ diff -Nur lpr-0.33/common_source/pathnames.h 
lpr-0.33.pld/common_source/pathname
  
 -CFLAGS        = -Wall $(RPM_OPT_FLAGS) -I../common_source -I/usr/include/bsd
 -LDFLAGS       = 
-+CFLAGS        = -Wall $(OPT_FLAGS) -I../common_source -I/usr/include/bsd
++CFLAGS        = -Wall $(OPT_FLAGS) -I../common_source
 +LDFLAGS       = -s
 +MANDIR = /usr/share/man
  LDLIBS = -lcommon -L ../common_source # -lbsd
  
  SUBDIRS       = common_source filters lpc lpd lpq lpr lprm lptest pac
+--- lpr-0.72/common_source/Makefile.orig       2001-05-23 23:51:04.000000000 
+0200
++++ lpr-0.72/common_source/Makefile    2020-08-22 21:18:13.220675632 +0200
+@@ -1,5 +1,5 @@
+ 
+-CFLAGS        = -Wall $(RPM_OPT_FLAGS) -I../common_source -I/usr/include/bsd
++CFLAGS        = -Wall $(OPT_FLAGS) -I../common_source
+ LDFLAGS       = 
+ LDLIBS = -lcommon -L ../common_source # -lbsd
+ 
+--- lpr-0.72/filters/Makefile.orig     2001-05-17 23:53:46.000000000 +0200
++++ lpr-0.72/filters/Makefile  2020-08-22 22:27:43.974747385 +0200
+@@ -1,5 +1,5 @@
+ 
+-CFLAGS        = -Wall $(RPM_OPT_FLAGS) -I../common_source -I/usr/include/bsd
++CFLAGS        = -Wall $(OPT_FLAGS) -I../common_source
+ LDFLAGS       = 
+ LDLIBS = -lcommon -L ../common_source # -lbsd
+ 
+--- lpr-0.72/lpc/Makefile.orig 2001-05-17 23:53:46.000000000 +0200
++++ lpr-0.72/lpc/Makefile      2020-08-22 22:31:19.033582311 +0200
+@@ -1,5 +1,5 @@
+ 
+-CFLAGS= -Wall $(RPM_OPT_FLAGS) -I../common_source -I/usr/include/bsd
++CFLAGS= -Wall $(OPT_FLAGS) -I../common_source
+ LDFLAGS= 
+ LDLIBS= -lcommon -L ../common_source # -lbsd
+ 
+--- lpr-0.72/lpd/Makefile.orig 2001-05-17 23:53:46.000000000 +0200
++++ lpr-0.72/lpd/Makefile      2020-08-22 22:37:46.854814637 +0200
+@@ -1,5 +1,5 @@
+ 
+-CFLAGS        = -Wall $(RPM_OPT_FLAGS) -I../common_source -I/usr/include/bsd
++CFLAGS        = -Wall $(OPT_FLAGS) -I../common_source
+ LDFLAGS       = 
+ LDLIBS = -L ../common_source -lcommon 
+ 
diff --git a/lpr-wait.patch b/lpr-wait.patch
new file mode 100644
index 0000000..bb939c6
--- /dev/null
+++ b/lpr-wait.patch
@@ -0,0 +1,60 @@
+--- lpr-0.72/lpd/printjob.c.orig       2020-08-22 22:38:56.591103509 +0200
++++ lpr-0.72/lpd/printjob.c    2020-08-22 23:34:38.119667564 +0200
+@@ -582,7 +582,7 @@
+       FILE *fp;
+       char *av[15], buf[BUFSIZ];
+       int pid, p[2], stopped = 0;
+-      union wait status;
++      int status;
+       struct stat stb;
+         char *optspace;
+         int optlen;
+@@ -751,12 +751,12 @@
+       fo = pfd;
+       if (ofilter > 0) {              /* stop output filter */
+               write(ofd, "\031\1", 2);
+-              while ((pid=wait3((int *)&status, WUNTRACED, 0)) > 0 && pid != 
ofilter);
++              while ((pid=wait3(status, WUNTRACED, 0)) > 0 && pid != ofilter);
+               if (!WIFSTOPPED(status)) {
+                       (void) close(fi);
+                       syslog(LOG_WARNING,
+                               "%s: output filter died (retcode=%d 
termsig=%d)",
+-                              printer, status.w_retcode, status.w_termsig);
++                              printer, WEXITSTATUS(status), WTERMSIG(status));
+                       return(REPRINT);
+               }
+               stopped++;
+@@ -809,9 +809,9 @@
+       }
+       (void) close(fi);
+       if (child < 0)
+-              status.w_retcode = 100;
++              status = W_EXITCODE(100, WTERMSIG(status));
+       else
+-              while ((pid = wait((int *)&status)) > 0 && pid != child)
++              while ((pid = wait(status)) > 0 && pid != child)
+                       ;
+       child = 0;
+       prchild = 0;
+@@ -832,10 +832,10 @@
+ 
+       if (!WIFEXITED(status)) {
+               syslog(LOG_WARNING, "%s: filter '%c' terminated (termsig=%d)",
+-                      printer, format, status.w_termsig);
++                      printer, format, WTERMSIG(status));
+               return(ERROR);
+       }
+-      switch (status.w_retcode) {
++      switch (WEXITSTATUS(status)) {
+       case 0:
+               tof = 1;
+               return(OK);
+@@ -845,7 +845,7 @@
+               return(ERROR);
+       default:
+               syslog(LOG_WARNING, "%s: filter '%c' exited (retcode=%d)",
+-                      printer, format, status.w_retcode);
++                      printer, format, WEXITSTATUS(status));
+               return(FILTERERR);
+       }
+ }
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/lpr.git/commitdiff/f90685e92a8731dd56c5c4215114821ce61522ad

_______________________________________________
pld-cvs-commit mailing list
[email protected]
http://lists.pld-linux.org/mailman/listinfo/pld-cvs-commit

Reply via email to