Fix printer spool path attribut name in the message we handle to transport add-on(s).

git-svn-id: file:///srv/svn/repos/haiku/trunk/current@5562 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Philippe Houdoin 2003-12-04 13:57:46 +00:00
parent 1dbb61270b
commit 3ae86e799a
2 changed files with 23 additions and 14 deletions

View File

@ -21,4 +21,5 @@ StaticLibrary
# printerdriveraddon
# :
# PrinterDriverAddOn.cpp
# ;
# ;

View File

@ -1,24 +1,32 @@
#include "PrintTransportAddOn.h"
// We don't support multiple instances of the same transport add-on
static BDataIO* gTransport = NULL;
extern "C" _EXPORT BDataIO *init_transport(BMessage *msg) {
if (msg != NULL && gTransport == NULL) {
const char* printer_name = msg->FindString("printer_name");
if (printer_name && *printer_name != '\0') {
BDirectory printer(printer_name);
if (printer.InitCheck() == B_OK) {
gTransport = instanciate_transport(&printer, msg);
return gTransport;
}
}
}
extern "C" _EXPORT BDataIO *init_transport(BMessage *msg)
{
if (msg == NULL || gTransport != NULL)
return NULL;
const char *spool_path = msg->FindString("printer_file");
if (spool_path && *spool_path != '\0') {
BDirectory printer(spool_path);
if (printer.InitCheck() == B_OK) {
gTransport = instanciate_transport(&printer, msg);
return gTransport;
};
};
return NULL;
}
extern "C" _EXPORT void exit_transport() {
extern "C" _EXPORT void exit_transport()
{
if (gTransport) {
delete gTransport; gTransport = NULL;
delete gTransport;
gTransport = NULL;
}
}