diff options
author | Simon Rettberg | 2015-10-09 16:41:40 +0200 |
---|---|---|
committer | Simon Rettberg | 2015-10-09 16:41:40 +0200 |
commit | 5c89ced85217787dc0530d6cb4c3b0a74c6fbf87 (patch) | |
tree | cbe4fe3ce57c8e4544c0bae58999a3922812cb7c | |
parent | Merge branch 'master' of dnbd3:openslx-ng/printergui (diff) | |
download | printergui-onegui.tar.gz printergui-onegui.tar.xz printergui-onegui.zip |
WIP: Try move all GUI interaction to the first binaryonegui
This is broken, incomplete code
-rw-r--r-- | CMakeLists.txt | 54 | ||||
-rw-r--r-- | src/maingui/backdrop.cpp | 93 | ||||
-rw-r--r-- | src/maingui/backdrop.h | 13 | ||||
-rw-r--r-- | src/maingui/main.cpp | 1 | ||||
-rw-r--r-- | src/maingui/printergui.cpp | 5 | ||||
-rw-r--r-- | src/maingui/pwgui.cpp (renamed from src/pwgui/pwgui.cpp) | 64 | ||||
-rw-r--r-- | src/maingui/pwgui.h | 40 | ||||
-rw-r--r-- | src/maingui/pwgui.ui | 135 | ||||
-rw-r--r-- | src/pwgui/pwgui.h | 32 | ||||
-rw-r--r-- | src/pwgui/pwgui.ui | 145 | ||||
-rw-r--r-- | src/util.c | 38 | ||||
-rw-r--r-- | src/util.h | 10 |
12 files changed, 379 insertions, 251 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 0745441..c120736 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -21,6 +21,11 @@ SET(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake) FIND_PACKAGE(Qt4 REQUIRED) FIND_PACKAGE(Cups REQUIRED) +# include Qt modules +#SET(QT_USE_QTDBUS TRUE) +SET(QT_USE_QTNETWORK TRUE) +#SET(QT_USE_QTWEBKIT TRUE) + # some includes INCLUDE_DIRECTORIES( ${CMAKE_SOURCE_DIR} @@ -34,11 +39,13 @@ INCLUDE_DIRECTORIES( # printergui (maingui) FILE(GLOB MAINGUI_SRCS src/maingui/*.cpp + src/*.c ) # password gui (printpwgui FILE(GLOB PWGUI_SRCS src/pwgui/*.cpp + src/*.c ) ################################################################################ @@ -50,59 +57,23 @@ FILE(GLOB MAINGUI_UIS src/maingui/*.ui ) -FILE(GLOB PWGUI_UIS - src/pwgui/*.ui -) - -# .qrc files -#SET(MAINGUI_RCS pvsmgr.qrc) -#SET(PWGUI_RCS pvsclient.qrc) - # includes all header files that should be treated with moc SET(MAINGUI_MOC_HDRS src/maingui/printergui.h src/maingui/backdrop.h + src/maingui/pwgui.h ) -SET(PWGUI_MOC_HDRS - src/pwgui/pwgui.h -) - -# i18n -#FILE(GLOB MAINGUI_TSS -# i18n/server/*.ts -#) - -#FILE(GLOB PWGUI_TSS -# i18n/client/*.ts -#) - - -# include Qt modules -#SET(QT_USE_QTDBUS TRUE) -#SET(QT_USE_QTNETWORK TRUE) -#SET(QT_USE_QTWEBKIT TRUE) - # add some useful macros and variables # (QT_USE_FILE is a variable defined by FIND_PACKAGE( Qt4 ) that contains # a path to CMake script) INCLUDE(${QT_USE_FILE}) -# this will run rcc on .qrc files -#QT4_ADD_RESOURCES(MAINGUI_RC_SRCS ${MAINGUI_RCS}) -#QT4_ADD_RESOURCES(PWGUI_RC_SRCS ${PWGUI_RCS}) - # this will run uic on .ui files QT4_WRAP_UI(MAINGUI_UI_HDRS ${MAINGUI_UIS}) -QT4_WRAP_UI(PWGUI_UI_HDRS ${PWGUI_UIS}) # this will run moc QT4_WRAP_CPP(MAINGUI_MOC_SRCS ${MAINGUI_MOC_HDRS}) -QT4_WRAP_CPP(PWGUI_MOC_SRCS ${PWGUI_MOC_HDRS}) - -# i18n, run lupdate and lrelease) -#QT4_CREATE_TRANSLATION(MAINGUI_QMS ${MAINGUI_SRCS} ${MAINGUI_UI_HDRS} ${MAINGUI_TSS}) -#QT4_CREATE_TRANSLATION(PWGUI_QMS ${PWGUI_SRCS} ${PWGUI_UI_HDRS} ${PWGUI_TSS}) ################################################################################ # Build @@ -113,15 +84,10 @@ ADD_EXECUTABLE(printergui ${MAINGUI_MOC_SRCS} ${MAINGUI_UI_HDRS} ${MAINGUI_RC_SRCS} - ${MAINGUI_QMS} ) ADD_EXECUTABLE(printpwgui ${PWGUI_SRCS} - ${PWGUI_MOC_SRCS} - ${PWGUI_UI_HDRS} - ${PWGUI_RC_SRCS} - ${PWGUI_QMS} ) # link @@ -130,10 +96,6 @@ TARGET_LINK_LIBRARIES(printergui ${CUPS_LIBRARIES} ) -TARGET_LINK_LIBRARIES(printpwgui - ${QT_LIBRARIES} -) - # install INSTALL(TARGETS printergui printpwgui RUNTIME DESTINATION bin) diff --git a/src/maingui/backdrop.cpp b/src/maingui/backdrop.cpp index 4a907e8..db16b01 100644 --- a/src/maingui/backdrop.cpp +++ b/src/maingui/backdrop.cpp @@ -1,4 +1,6 @@ #include "backdrop.h" +#include "../util.h" +#include "pwgui.h" #include <QApplication> #include <QDesktopWidget> @@ -6,11 +8,18 @@ #include <QPaintEvent> #include <QPixmap> #include <QRgb> +#include <QLocalServer> +#include <QLocalSocket> +#include <sys/stat.h> + +static const QString strTest("test"); Backdrop::Backdrop() : QWidget(NULL), screenshot(NULL), - mainWindow(NULL) + mainWindow(NULL), + server(NULL), + pwgui(NULL) { QPixmap shot = QPixmap::grabWindow(QApplication::desktop()->winId()); if (!shot.isNull() && shot.height() > 0) { @@ -34,6 +43,75 @@ Backdrop::Backdrop() : screenshot = new QPixmap(shot); this->resize(screenshot->width(), screenshot->height()); this->setWindowFlags(Qt::Tool | Qt::CustomizeWindowHint | Qt::FramelessWindowHint); + + char sockPath[500]; + if (NULL != util_sockPath(-1, -1, sockPath, sizeof sockPath)) { + QString path = QString::fromUtf8(sockPath); + QFile::remove(path); + server = new QLocalServer(this); + if (server->listen(sockPath)) { + chmod(sockPath, 0600); + QObject::connect(server, SIGNAL(newConnection()), this, SLOT(newConnection())); + } + } + QObject::connect(QApplication::instance(), SIGNAL(aboutToQuit()), this, SLOT(aboutToQuit())); +} + +QLocalSocket* Backdrop::getClient() +{ + QObject *sender = QObject::sender(); + if (sender == NULL || sender->property("test").toString() != strTest) + return NULL; + return (QLocalSocket*)sender; +} + +void Backdrop::newConnection() +{ + QLocalSocket *client; + while ((client = server->nextPendingConnection())) { + client->setProperty("test", strTest); + QObject::connect(client, SIGNAL(readyRead()), this, SLOT(incomingData())); + QObject::connect(client, SIGNAL(error(QLocalSocket::LocalSocketError)), this, SLOT(closeConnection())); + QObject::connect(client, SIGNAL(disconnected()), this, SLOT(closeConnection())); + } +} + +void Backdrop::closeConnection() +{ + QLocalSocket *client = getClient(); + client->close(); + client->waitForDisconnected(50); + client->deleteLater(); +} + +void Backdrop::incomingData() +{ + QLocalSocket *client = getClient(); + char buffer[100]; + while (client->canReadLine()) { + if (client->readLine(buffer, sizeof buffer) > 0) { + if (strcmp(buffer, "open") == 0) { + if (pwgui == NULL) { + pwgui = new PwGui(this); + } + if (pwgui->isVisible()) { + client->write("busy\n"); + } else { + pwgui->exec(); + if (pwgui->isCancelled()) { + server->blockSignals(true); + client->write("cancel\n"); + client->waitForBytesWritten(1000); + client->close(); + client->waitForDisconnected(50); + QApplication::exit(0); + } + // Got some credentials, send to back end + client->write(pwgui->getUser().toUtf8() += '\0' += pwgui->getPassword() += '\0'); + } + } + } + } } Backdrop::~Backdrop() @@ -49,8 +127,19 @@ void Backdrop::paintEvent(QPaintEvent * event) void Backdrop::mouseReleaseEvent(QMouseEvent * event) { - if (mainWindow != NULL) { + if (pwgui != NULL && pwgui->isVisible()) { + pwgui->raise(); + pwgui->activateWindow(); + } else if (mainWindow != NULL && mainWindow->isVisible()) { mainWindow->raise(); mainWindow->activateWindow(); } } + +void Backdrop::aboutToQuit() +{ + if (server != NULL) { + QFile::remove(server->serverName()); + server->close(); + } +} diff --git a/src/maingui/backdrop.h b/src/maingui/backdrop.h index b798a89..7df6d40 100644 --- a/src/maingui/backdrop.h +++ b/src/maingui/backdrop.h @@ -4,6 +4,9 @@ #include <QWidget> class QPixmap; +class QLocalServer; +class QLocalSocket; +class PwGui; class Backdrop : public QWidget { @@ -12,6 +15,16 @@ class Backdrop : public QWidget private: const QPixmap * screenshot; QWidget * mainWindow; + QLocalServer * server; + PwGui * pwgui; + + QLocalSocket* getClient(); + +private slots: + void newConnection(); + void closeConnection(); + void incomingData(); + void aboutToQuit(); protected: virtual void paintEvent(QPaintEvent * event); diff --git a/src/maingui/main.cpp b/src/maingui/main.cpp index 25f81a0..be4099b 100644 --- a/src/maingui/main.cpp +++ b/src/maingui/main.cpp @@ -38,7 +38,6 @@ int main(int argc, char *argv[]) return a.exec(); } - static Backdrop* showGrayBackground() { Backdrop *bg = new Backdrop; diff --git a/src/maingui/printergui.cpp b/src/maingui/printergui.cpp index 21e03f4..2506fd6 100644 --- a/src/maingui/printergui.cpp +++ b/src/maingui/printergui.cpp @@ -212,7 +212,7 @@ void PrinterGui::closeEvent(QCloseEvent * e) cupsCancelJob(ui->printerList->currentItem()->text(0).toUtf8().constData(), jobId); jobId = 0; } - QCoreApplication::instance()->exit(0); + QApplication::exit(0); } QDialog::closeEvent(e); } @@ -313,7 +313,6 @@ void PrinterGui::on_buttonPrint_clicked() ui->lineEditCopies->setEnabled(false); ui->printerList->setEnabled(false); } - } void PrinterGui::bgTimer_timeout() @@ -324,7 +323,7 @@ void PrinterGui::bgTimer_timeout() } if (++this->bgTimeout > 120) { // Job was sent, GUI is invisible, quit after a few seconds - QCoreApplication::instance()->exit(0); + QApplication::exit(0); } } diff --git a/src/pwgui/pwgui.cpp b/src/maingui/pwgui.cpp index 193341b..635ca42 100644 --- a/src/pwgui/pwgui.cpp +++ b/src/maingui/pwgui.cpp @@ -2,16 +2,16 @@ #include "ui_pwgui.h" #include <QMessageBox> #include <QTimer> -#include <QDesktopWidget> +#include <QDialog> #include <unistd.h> #define BUFLEN 400 // ____________________________________________________________________________ -PwGui::PwGui(int pfd, char *user, QWidget *parent) : - QMainWindow(parent), +PwGui::PwGui(QWidget *parent) : + QDialog(parent), ui(new Ui::PwGui), - pipefd(pfd) + cancelled(true) { // Initialize UI initializeUI(user); @@ -25,10 +25,23 @@ PwGui::~PwGui() delete ui; } +const QString PwGui::getUser() const +{ + return ui->lineEditUser->text(); +} + +const QString PwGui::getPassword() const +{ + return ui->lineEditPass->text(); +} + // ____________________________________________________________________________ void PwGui::initializeUI(char *user) { ui->setupUi(this); + this->setWindowModality(Qt::ApplicationModal); + // Put always on top + this->setWindowFlags(Qt::Dialog | Qt::WindowStaysOnTopHint); // Prefill username if (user != NULL) { @@ -41,37 +54,44 @@ void PwGui::initializeUI(char *user) /* Main Window properties */ - // Disable close button - this->setWindowFlags((this->windowFlags() & ~Qt::WindowCloseButtonHint) | Qt::WindowStaysOnTopHint); // center dialog on screen center QRect desktopRect = QApplication::desktop()->screenGeometry(this); this->move( desktopRect.width()/2-this->width()/2, desktopRect.height()/2-this->height()/2 ); - this->show(); - this->showNormal(); - this->raise(); - this->activateWindow(); } // ____________________________________________________________________________ void PwGui::on_accept() { - char buffer[BUFLEN + 1]; - int len = snprintf(buffer, BUFLEN, "%s%c%s%c", ui->lineEditUser->text().toUtf8().constData(), 0, ui->lineEditPass->text().toUtf8().constData(), 0); - if (len > BUFLEN) { - len = BUFLEN; - } - buffer[len] = '\0'; - ::write(pipefd, buffer, len); - ::close(pipefd); - // Quit with code 0 - QCoreApplication::instance()->exit(0); + cancelled = false; + this->close(); } // ____________________________________________________________________________ void PwGui::on_reject() { - // Quit with code 1 - QCoreApplication::instance()->exit(1); + this->close(); } +void PwGui::keyPressEvent(QKeyEvent * e) +{ + if(e->key() != Qt::Key_Escape) { + QMainWindow::keyPressEvent(e); + return; + } + this->close(); +} + +void PwGui::hideEvent(QHideEvent * e) +{ + this->close(); +} + +int PwGui::exec() { + cancelled = true; + this->show(); + this->showNormal(); + this->raise(); + this->activateWindow(); + return QDialog::exec(); +} diff --git a/src/maingui/pwgui.h b/src/maingui/pwgui.h new file mode 100644 index 0000000..fa3f465 --- /dev/null +++ b/src/maingui/pwgui.h @@ -0,0 +1,40 @@ +#ifndef AUTHENTICATION_H +#define AUTHENTICATION_H + +#include <QDialog> +#include <QDebug> + +namespace Ui +{ +class PwGui; +} + +class QTimer; + +class PwGui : public QDialog +{ + Q_OBJECT + +public: + explicit PwGui(QWidget *parent = 0); + ~PwGui(); + const QString getUser() const; + const QString getPassword() const; + const bool isCancelled() const { return cancelled; }; + int exec(); + +protected: + void hideEvent(QHideEvent * e); + void keyPressEvent(QKeyEvent * e); + +private slots: + void on_accept(); + void on_reject(); + +private: + Ui::PwGui *ui; + void initializeUI(char *username); + bool cancelled; +}; + +#endif // AUTHENTICATION_H diff --git a/src/maingui/pwgui.ui b/src/maingui/pwgui.ui new file mode 100644 index 0000000..32678a8 --- /dev/null +++ b/src/maingui/pwgui.ui @@ -0,0 +1,135 @@ +<?xml version="1.0" encoding="UTF-8"?> +<ui version="4.0"> + <class>PwGui</class> + <widget class="QDialog" name="PwGui"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>310</width> + <height>160</height> + </rect> + </property> + <property name="sizePolicy"> + <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="windowTitle"> + <string>Drucken - Authentifizierung</string> + </property> + <layout class="QVBoxLayout" name="verticalLayout_2"> + <item> + <layout class="QHBoxLayout" name="horizontalLayout"> + <item> + <widget class="QLabel" name="label"> + <property name="text"> + <string>Benutzername</string> + </property> + </widget> + </item> + <item> + <spacer name="horizontalSpacer"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>40</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + <item> + <widget class="QLineEdit" name="lineEditUser"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + </widget> + </item> + </layout> + </item> + <item> + <layout class="QHBoxLayout" name="horizontalLayout_3"> + <item> + <widget class="QLabel" name="label_2"> + <property name="text"> + <string>Passwort</string> + </property> + </widget> + </item> + <item> + <spacer name="horizontalSpacer_2"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>40</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + <item> + <widget class="QLineEdit" name="lineEditPass"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + </widget> + </item> + </layout> + </item> + <item> + <widget class="QLabel" name="labelStatus"> + <property name="layoutDirection"> + <enum>Qt::LeftToRight</enum> + </property> + <property name="frameShape"> + <enum>QFrame::Panel</enum> + </property> + <property name="frameShadow"> + <enum>QFrame::Sunken</enum> + </property> + <property name="text"> + <string>Bitte Anmelden</string> + </property> + </widget> + </item> + <item> + <spacer name="verticalSpacer"> + <property name="orientation"> + <enum>Qt::Vertical</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>20</width> + <height>40</height> + </size> + </property> + </spacer> + </item> + <item> + <layout class="QHBoxLayout" name="horizontalLayout_2"> + <item> + <widget class="QDialogButtonBox" name="buttonBox"> + <property name="standardButtons"> + <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set> + </property> + </widget> + </item> + </layout> + </item> + </layout> + </widget> + <resources/> + <connections/> +</ui> diff --git a/src/pwgui/pwgui.h b/src/pwgui/pwgui.h deleted file mode 100644 index 348c5a1..0000000 --- a/src/pwgui/pwgui.h +++ /dev/null @@ -1,32 +0,0 @@ -#ifndef AUTHENTICATION_H -#define AUTHENTICATION_H - -#include <QMainWindow> -#include <QDebug> - -namespace Ui -{ -class PwGui; -} - -class QTimer; - -class PwGui : public QMainWindow -{ - Q_OBJECT - -public: - explicit PwGui(int pfd, char *user, QWidget *parent = 0); - ~PwGui(); - -private slots: - void on_accept(); - void on_reject(); - -private: - Ui::PwGui *ui; - void initializeUI(char *username); - int pipefd; -}; - -#endif // AUTHENTICATION_H diff --git a/src/pwgui/pwgui.ui b/src/pwgui/pwgui.ui deleted file mode 100644 index 236df30..0000000 --- a/src/pwgui/pwgui.ui +++ /dev/null @@ -1,145 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<ui version="4.0"> - <class>PwGui</class> - <widget class="QMainWindow" name="PwGui"> - <property name="geometry"> - <rect> - <x>0</x> - <y>0</y> - <width>310</width> - <height>160</height> - </rect> - </property> - <property name="sizePolicy"> - <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="windowTitle"> - <string>Drucken - Authentifizierung</string> - </property> - <widget class="QWidget" name="verticalLayoutWidget"> - <property name="geometry"> - <rect> - <x>9</x> - <y>9</y> - <width>291</width> - <height>141</height> - </rect> - </property> - <layout class="QVBoxLayout" name="verticalLayout"> - <item> - <layout class="QHBoxLayout" name="horizontalLayout"> - <item> - <widget class="QLabel" name="label"> - <property name="text"> - <string>Benutzername</string> - </property> - </widget> - </item> - <item> - <spacer name="horizontalSpacer"> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>40</width> - <height>20</height> - </size> - </property> - </spacer> - </item> - <item> - <widget class="QLineEdit" name="lineEditUser"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - </widget> - </item> - </layout> - </item> - <item> - <layout class="QHBoxLayout" name="horizontalLayout_3"> - <item> - <widget class="QLabel" name="label_2"> - <property name="text"> - <string>Passwort</string> - </property> - </widget> - </item> - <item> - <spacer name="horizontalSpacer_2"> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>40</width> - <height>20</height> - </size> - </property> - </spacer> - </item> - <item> - <widget class="QLineEdit" name="lineEditPass"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - </widget> - </item> - </layout> - </item> - <item> - <widget class="QLabel" name="labelStatus"> - <property name="layoutDirection"> - <enum>Qt::LeftToRight</enum> - </property> - <property name="frameShape"> - <enum>QFrame::Panel</enum> - </property> - <property name="frameShadow"> - <enum>QFrame::Sunken</enum> - </property> - <property name="text"> - <string>Bitte Anmelden</string> - </property> - </widget> - </item> - <item> - <spacer name="verticalSpacer"> - <property name="orientation"> - <enum>Qt::Vertical</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>20</width> - <height>40</height> - </size> - </property> - </spacer> - </item> - <item> - <layout class="QHBoxLayout" name="horizontalLayout_2"> - <item> - <widget class="QDialogButtonBox" name="buttonBox"> - <property name="standardButtons"> - <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set> - </property> - </widget> - </item> - </layout> - </item> - </layout> - </widget> - </widget> - <resources/> - <connections/> -</ui> diff --git a/src/util.c b/src/util.c new file mode 100644 index 0000000..9e7c892 --- /dev/null +++ b/src/util.c @@ -0,0 +1,38 @@ +#include "util.h" +#include <sys/types.h> +#include <unistd.h> +#include <string.h> +#include <pwd.h> +#include <stdio.h> + +char *util_userHome(int uid, char *buffer, size_t len) +{ + struct passwd pwd; + struct passwd *res; + char b[1000]; + getpwuid_r(uid, &pwd, b, sizeof b, &res); + if (res == NULL || res->pw_dir == NULL) + return NULL; + int printret = snprintf(buffer, len, "%s", res->pw_dir); + if (printret < 0 || printret >= (int)len) + return NULL; + buffer[len-1] = '\0'; + return buffer; +} + +char *util_sockPath(int uid, int pid, char *buffer, size_t len) +{ + char home[120]; + if (uid == -1) { + uid = (int)getuid(); + } + if (pid == -1) { + pid = (int)getpid(); + } + if (util_userHome(uid, home, sizeof home) == NULL) + return NULL; + int printret = snprintf(buffer, len, "%s/.printergui.%d", pid); + if (printret < 0 || printret >= (int)len) + return NULL; + return buffer; +} diff --git a/src/util.h b/src/util.h new file mode 100644 index 0000000..cc7d4b7 --- /dev/null +++ b/src/util.h @@ -0,0 +1,10 @@ +#ifndef UTIL_H_ +#define UTIL_H_ + +#include <stdlib.h> + +char *util_userHome(int uid, char *buffer, size_t len); + +char *util_sockPath(int uid, int pid, char *buffer, size_t len); + +#endif /* UTIL_H_ */ |