plptools
Loading...
Searching...
No Matches
plpprintd.cc File Reference
#include "config.h"
#include <cli_utils.h>
#include <tcpsocket.h>
#include <wprt.h>
#include <psibitmap.h>
#include <iostream>
#include <string>
#include <stdlib.h>
#include <stdarg.h>
#include <stdio.h>
#include <syslog.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include "ignore-value.h"
#include <getopt.h>
Include dependency graph for plpprintd.cc:

Go to the source code of this file.

Classes

struct  fontmap_entry_s
 
struct  const_fontmap_entry_s
 

Macros

#define _GNU_SOURCE
 
#define TEMPLATE   "plpprint_XXXXXX"
 
#define PRINTCMD   "lpr -Ppsion"
 
#define SPOOLDIR   "/var/spool/plpprint"
 
#define PSDICT   "/prolog.ps"
 
#define FALLBACK_FONT   "Courier"
 

Typedefs

typedef struct fontmap_entry_s fontmap_entry
 
typedef struct const_fontmap_entry_s const_fontmap_entry
 

Functions

static void _log (int priority, const char *fmt, va_list ap)
 
void debuglog (const char *fmt,...)
 
void errorlog (const char *fmt,...)
 
void infolog (const char *fmt,...)
 
static void init_fontmap ()
 
static void ps_setfont (FILE *f, const char *fname, bool bold, bool italic, unsigned long fsize)
 
static void ps_escape (string &text)
 
static void ps_bitmap (FILE *f, unsigned long llx, unsigned long lly, unsigned long urx, unsigned long ury, const char *buf)
 
static void convertPage (FILE *f, int page, bool last, bufferStore buf)
 
static const void service_loop ()
 
static void help ()
 
static void usage ()
 
int main (int argc, char **argv)
 

Variables

const char * spooldir = SPOOLDIR
 
const char * printcmd = PRINTCMD
 
wprtwPrt
 
bool serviceLoop
 
bool debug = false
 
int verbose = 0
 
static int minx
 
static int maxx
 
static int miny
 
static int maxy
 
string usedfonts
 
static const_fontmap_entry default_fontmap []
 
static fontmap_entryfontmap = NULL
 
static unsigned char fakePage [15]
 
static struct option opts []
 

Macro Definition Documentation

◆ _GNU_SOURCE

#define _GNU_SOURCE

Definition at line 42 of file plpprintd.cc.

◆ FALLBACK_FONT

#define FALLBACK_FONT   "Courier"

Definition at line 118 of file plpprintd.cc.

◆ PRINTCMD

#define PRINTCMD   "lpr -Ppsion"

Definition at line 47 of file plpprintd.cc.

◆ PSDICT

#define PSDICT   "/prolog.ps"

Definition at line 49 of file plpprintd.cc.

◆ SPOOLDIR

#define SPOOLDIR   "/var/spool/plpprint"

Definition at line 48 of file plpprintd.cc.

◆ TEMPLATE

#define TEMPLATE   "plpprint_XXXXXX"

Definition at line 46 of file plpprintd.cc.

Typedef Documentation

◆ const_fontmap_entry

◆ fontmap_entry

Function Documentation

◆ _log()

static void _log ( int  priority,
const char *  fmt,
va_list  ap 
)
static

Definition at line 61 of file plpprintd.cc.

◆ convertPage()

static void convertPage ( FILE *  f,
int  page,
bool  last,
bufferStore  buf 
)
static

Definition at line 285 of file plpprintd.cc.

◆ debuglog()

void debuglog ( const char *  fmt,
  ... 
)

Definition at line 74 of file plpprintd.cc.

◆ errorlog()

void errorlog ( const char *  fmt,
  ... 
)

Definition at line 83 of file plpprintd.cc.

◆ help()

static void help ( )
static

Definition at line 889 of file plpprintd.cc.

◆ infolog()

void infolog ( const char *  fmt,
  ... 
)

Definition at line 92 of file plpprintd.cc.

◆ init_fontmap()

static void init_fontmap ( )
static

Definition at line 144 of file plpprintd.cc.

◆ main()

int main ( int  argc,
char **  argv 
)

Definition at line 922 of file plpprintd.cc.

◆ ps_bitmap()

static void ps_bitmap ( FILE *  f,
unsigned long  llx,
unsigned long  lly,
unsigned long  urx,
unsigned long  ury,
const char *  buf 
)
static

Definition at line 267 of file plpprintd.cc.

◆ ps_escape()

static void ps_escape ( string &  text)
static

Definition at line 257 of file plpprintd.cc.

◆ ps_setfont()

static void ps_setfont ( FILE *  f,
const char *  fname,
bool  bold,
bool  italic,
unsigned long  fsize 
)
static

Definition at line 228 of file plpprintd.cc.

◆ service_loop()

static const void service_loop ( )
static

Definition at line 767 of file plpprintd.cc.

◆ usage()

static void usage ( void  )
static

Definition at line 905 of file plpprintd.cc.

Variable Documentation

◆ debug

bool debug = false

Definition at line 57 of file plpprintd.cc.

◆ default_fontmap

const_fontmap_entry default_fontmap[]
static
Initial value:
= {
{ "Times New Roman", false, false, "Times-Roman"},
{ "Times New Roman", true, false, "Times-Bold"},
{ "Times New Roman", false, true, "Times-Italic"},
{ "Times New Roman", true, true, "Times-BoldItalic"},
{ "Arial", false, false, "Helvetica"},
{ "Arial", true, false, "Helvetica-Bold"},
{ "Arial", false, true, "Helvetica-Oblique"},
{ "Arial", true, true, "Helvetica-BoldOblique"},
{ "Courier New", false, false, "Courier"},
{ "Courier New", true, false, "Courier-Bold"},
{ "Courier New", false, true, "Courier-Oblique"},
{ "Courier New", true, true, "Courier-BoldOblique"},
{ "Swiss", false, false, "Courier"},
{ "Swiss", true, false, "Courier-Bold"},
{ "Swiss", false, true, "Courier-Oblique"},
{ "Swiss", true, true, "Courier-BoldOblique"},
{ NULL, false, false, NULL}
}

Definition at line 120 of file plpprintd.cc.

◆ fakePage

unsigned char fakePage[15]
static
Initial value:
= {
0x2a, 0x2a, 0x09, 0x00, 0x00, 0x00, 0x82, 0x2e,
0x00, 0x00, 0xc6, 0x41, 0x00, 0x00, 0x00,
}

Definition at line 760 of file plpprintd.cc.

◆ fontmap

fontmap_entry* fontmap = NULL
static

Definition at line 141 of file plpprintd.cc.

◆ maxx

int maxx
static

Definition at line 100 of file plpprintd.cc.

◆ maxy

int maxy
static

Definition at line 100 of file plpprintd.cc.

◆ minx

int minx
static

Definition at line 100 of file plpprintd.cc.

◆ miny

int miny
static

Definition at line 100 of file plpprintd.cc.

◆ opts

struct option opts[]
static
Initial value:
= {
{"debug", no_argument, nullptr, 'd'},
{"help", no_argument, nullptr, 'h'},
{"version", no_argument, nullptr, 'V'},
{"verbose", no_argument, nullptr, 'v'},
{"port", required_argument, nullptr, 'p'},
{"spooldir", required_argument, nullptr, 's'},
{"printcmd", required_argument, nullptr, 'c'},
{nullptr, 0, nullptr, 0 }
}

Definition at line 910 of file plpprintd.cc.

◆ printcmd

const char* printcmd = PRINTCMD

Definition at line 54 of file plpprintd.cc.

◆ serviceLoop

bool serviceLoop

Definition at line 56 of file plpprintd.cc.

◆ spooldir

const char* spooldir = SPOOLDIR

Definition at line 53 of file plpprintd.cc.

◆ usedfonts

string usedfonts

Definition at line 101 of file plpprintd.cc.

◆ verbose

int verbose = 0

Definition at line 58 of file plpprintd.cc.

◆ wPrt

wprt* wPrt

Definition at line 55 of file plpprintd.cc.