diff options
author | Michael Nottebrock <lofi@FreeBSD.org> | 2007-09-14 17:58:32 +0000 |
---|---|---|
committer | Michael Nottebrock <lofi@FreeBSD.org> | 2007-09-14 17:58:32 +0000 |
commit | 10814c41a59c85082fc052bf00bffd65d66ba781 (patch) | |
tree | 44d2b5dff1ea8a9d6b1449403f1f1d82b4b562f3 /x11 | |
parent | 1de88396d132810adf786db430083fb414e2f543 (diff) | |
download | ports-10814c41a59c85082fc052bf00bffd65d66ba781.tar.gz ports-10814c41a59c85082fc052bf00bffd65d66ba781.zip |
Notes
Diffstat (limited to 'x11')
-rw-r--r-- | x11/kdelibs3/Makefile | 4 | ||||
-rw-r--r-- | x11/kdelibs3/files/patch-kdeprint_cups_cupsdconf2 | 65 | ||||
-rw-r--r-- | x11/kdelibs4/Makefile | 4 | ||||
-rw-r--r-- | x11/kdelibs4/files/patch-kdeprint_cups_cupsdconf2 | 65 |
4 files changed, 138 insertions, 0 deletions
diff --git a/x11/kdelibs3/Makefile b/x11/kdelibs3/Makefile index dcc1e875c6f6..02510f68f92b 100644 --- a/x11/kdelibs3/Makefile +++ b/x11/kdelibs3/Makefile @@ -79,6 +79,10 @@ FONTENCOD= ${X11BASE}/lib/X11/fonts/encodings/encodings.dir LIB_DEPENDS+= bz2.1:${PORTSDIR}/archivers/bzip2 .endif # !exists(/usr/bin/bzip2) +.if !exists(/usr/bin/pgrep) +RUN_DEPENDS+= pgrep:${PORTSDIR}/sysutils/pkill +.endif # !exists(/usr/bin/pgrep) + .if ${X_WINDOW_SYSTEM:L} != xorg BUILD_DEPENDS+= mkfontdir:${X_CLIENTS_PORT} RUN_DEPENDS+= iceauth:${X_CLIENTS_PORT} diff --git a/x11/kdelibs3/files/patch-kdeprint_cups_cupsdconf2 b/x11/kdelibs3/files/patch-kdeprint_cups_cupsdconf2 new file mode 100644 index 000000000000..b38391e67123 --- /dev/null +++ b/x11/kdelibs3/files/patch-kdeprint_cups_cupsdconf2 @@ -0,0 +1,65 @@ +--- kdeprint/cups/cupsdconf2/cupsddialog.cpp Tue Sep 11 09:26:39 2007 ++++ kdeprint/cups/cupsdconf2/cupsddialog.cpp Tue Sep 11 14:38:28 2007 +@@ -44,6 +44,7 @@ + #include <kio/passdlg.h> + #include <kguiitem.h> + #include <kprocess.h> ++#include <qprocess.h> + + #include <signal.h> + #include <cups/cups.h> +@@ -69,24 +70,38 @@ + + int getServerPid() + { +- QDir dir("/proc",QString::null,QDir::Name,QDir::Dirs); +- for (uint i=0;i<dir.count();i++) +- { +- if (dir[i] == "." || dir[i] == ".." || dir[i] == "self") continue; +- QFile f("/proc/" + dir[i] + "/cmdline"); +- if (f.exists() && f.open(IO_ReadOnly)) ++ // /proc doesn't work the same in FreeBSD. The simplest way to get cupsd's pid is via pgrep. ++ #if defined(__FreeBSD__) ++ QProcess *proc = new QProcess(); ++ proc->addArgument("pgrep"); ++ proc->addArgument("cupsd"); ++ proc->start(); ++ while (proc->isRunning()); //Wait for process to exit ++ QString pidString = proc->readLineStdout(); ++ bool ok; ++ int pid = pidString.toInt(&ok); ++ if (ok) return pid; ++ return (-1); ++ #else ++ QDir dir("/proc",QString::null,QDir::Name,QDir::Dirs); ++ for (uint i=0;i<dir.count();i++) + { +- QTextStream t(&f); +- QString line; +- t >> line; +- f.close(); +- if (line.right(5) == "cupsd" || +- line.right(6).left(5) == "cupsd") // second condition for 2.4.x kernels +- // which add a null byte at the end +- return dir[i].toInt(); ++ if (dir[i] == "." || dir[i] == ".." || dir[i] == "self") continue; ++ QFile f("/proc/" + dir[i] + "/cmdline"); ++ if (f.exists() && f.open(IO_ReadOnly)) ++ { ++ QTextStream t(&f); ++ QString line; ++ t >> line; ++ f.close(); ++ if (line.right(5) == "cupsd" || ++ line.right(6).left(5) == "cupsd") // second condition for 2.4.x kernels ++ // which add a null byte at the end ++ return dir[i].toInt(); ++ } + } +- } +- return (-1); ++ return (-1); ++ #endif + } + + const char* getPassword(const char*) diff --git a/x11/kdelibs4/Makefile b/x11/kdelibs4/Makefile index dcc1e875c6f6..02510f68f92b 100644 --- a/x11/kdelibs4/Makefile +++ b/x11/kdelibs4/Makefile @@ -79,6 +79,10 @@ FONTENCOD= ${X11BASE}/lib/X11/fonts/encodings/encodings.dir LIB_DEPENDS+= bz2.1:${PORTSDIR}/archivers/bzip2 .endif # !exists(/usr/bin/bzip2) +.if !exists(/usr/bin/pgrep) +RUN_DEPENDS+= pgrep:${PORTSDIR}/sysutils/pkill +.endif # !exists(/usr/bin/pgrep) + .if ${X_WINDOW_SYSTEM:L} != xorg BUILD_DEPENDS+= mkfontdir:${X_CLIENTS_PORT} RUN_DEPENDS+= iceauth:${X_CLIENTS_PORT} diff --git a/x11/kdelibs4/files/patch-kdeprint_cups_cupsdconf2 b/x11/kdelibs4/files/patch-kdeprint_cups_cupsdconf2 new file mode 100644 index 000000000000..b38391e67123 --- /dev/null +++ b/x11/kdelibs4/files/patch-kdeprint_cups_cupsdconf2 @@ -0,0 +1,65 @@ +--- kdeprint/cups/cupsdconf2/cupsddialog.cpp Tue Sep 11 09:26:39 2007 ++++ kdeprint/cups/cupsdconf2/cupsddialog.cpp Tue Sep 11 14:38:28 2007 +@@ -44,6 +44,7 @@ + #include <kio/passdlg.h> + #include <kguiitem.h> + #include <kprocess.h> ++#include <qprocess.h> + + #include <signal.h> + #include <cups/cups.h> +@@ -69,24 +70,38 @@ + + int getServerPid() + { +- QDir dir("/proc",QString::null,QDir::Name,QDir::Dirs); +- for (uint i=0;i<dir.count();i++) +- { +- if (dir[i] == "." || dir[i] == ".." || dir[i] == "self") continue; +- QFile f("/proc/" + dir[i] + "/cmdline"); +- if (f.exists() && f.open(IO_ReadOnly)) ++ // /proc doesn't work the same in FreeBSD. The simplest way to get cupsd's pid is via pgrep. ++ #if defined(__FreeBSD__) ++ QProcess *proc = new QProcess(); ++ proc->addArgument("pgrep"); ++ proc->addArgument("cupsd"); ++ proc->start(); ++ while (proc->isRunning()); //Wait for process to exit ++ QString pidString = proc->readLineStdout(); ++ bool ok; ++ int pid = pidString.toInt(&ok); ++ if (ok) return pid; ++ return (-1); ++ #else ++ QDir dir("/proc",QString::null,QDir::Name,QDir::Dirs); ++ for (uint i=0;i<dir.count();i++) + { +- QTextStream t(&f); +- QString line; +- t >> line; +- f.close(); +- if (line.right(5) == "cupsd" || +- line.right(6).left(5) == "cupsd") // second condition for 2.4.x kernels +- // which add a null byte at the end +- return dir[i].toInt(); ++ if (dir[i] == "." || dir[i] == ".." || dir[i] == "self") continue; ++ QFile f("/proc/" + dir[i] + "/cmdline"); ++ if (f.exists() && f.open(IO_ReadOnly)) ++ { ++ QTextStream t(&f); ++ QString line; ++ t >> line; ++ f.close(); ++ if (line.right(5) == "cupsd" || ++ line.right(6).left(5) == "cupsd") // second condition for 2.4.x kernels ++ // which add a null byte at the end ++ return dir[i].toInt(); ++ } + } +- } +- return (-1); ++ return (-1); ++ #endif + } + + const char* getPassword(const char*) |