Discontinue HPUX support
This commit is contained in:
@@ -49,25 +49,6 @@ nl_catd dtprintinfo_cat = NULL;
|
||||
extern "C" { extern int seteuid(uid_t); }
|
||||
#endif
|
||||
|
||||
#ifdef hpux
|
||||
static char **msg_strings = NULL;
|
||||
|
||||
// Cannot use multiple catgets parameter calls in functions because the
|
||||
// previous catgets returned value is overwritten by later catgets calls
|
||||
// Example: this would fail on HP systems
|
||||
// sprintf(buf, "%s %s" catgets(...), catgets(...))
|
||||
|
||||
char *Catgets(nl_catd catd, int set_num, int msg_num, char *s)
|
||||
{
|
||||
if (!msg_strings)
|
||||
return s;
|
||||
|
||||
if (!msg_strings[msg_num])
|
||||
msg_strings[msg_num] = strdup(CATGETS(catd, set_num, msg_num, s));
|
||||
return msg_strings[msg_num];
|
||||
}
|
||||
#endif
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
#ifndef NO_CDE
|
||||
@@ -75,11 +56,7 @@ int main(int argc, char **argv)
|
||||
#endif
|
||||
|
||||
// run as user's UID
|
||||
#ifdef hpux
|
||||
setresuid(getuid(), getuid(), (uid_t)0);
|
||||
#else
|
||||
seteuid(getuid());
|
||||
#endif
|
||||
|
||||
setlocale(LC_ALL, "");
|
||||
|
||||
@@ -96,10 +73,6 @@ int main(int argc, char **argv)
|
||||
|
||||
if ((nl_catd) errno)
|
||||
dtprintinfo_cat = (nl_catd) -1;
|
||||
#ifdef hpux
|
||||
else
|
||||
msg_strings = (char **)calloc(LAST_MSG_NO, sizeof(char *));
|
||||
#endif
|
||||
}
|
||||
|
||||
if (dtprintinfo_cat == NULL) {
|
||||
|
||||
@@ -42,13 +42,11 @@
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#ifdef hpux
|
||||
#include <time.h>
|
||||
#elif defined(__linux__)
|
||||
#if defined(__linux__)
|
||||
#include <sys/time.h>
|
||||
#else
|
||||
#include <sys/select.h>
|
||||
#endif /* hpux */
|
||||
#endif /* linux */
|
||||
#ifdef _AIX
|
||||
#include <strings.h> /* need to get bzero defined */
|
||||
#endif /* _AIX */
|
||||
|
||||
@@ -276,7 +276,6 @@ void DtDND::GetDragPixmaps()
|
||||
XSetForeground(icon->display, gc_mask, 1);
|
||||
if (icon_size == LARGE_ICON)
|
||||
{
|
||||
#ifndef hpux
|
||||
if (tmp_mask && tmp_mask != XmUNSPECIFIED_PIXMAP)
|
||||
{
|
||||
XSetClipOrigin(icon->display, gc_mask, p_x, p_y);
|
||||
@@ -286,7 +285,6 @@ void DtDND::GetDragPixmaps()
|
||||
XSetClipOrigin(icon->display, gc_mask, 0, 0);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
XFillRectangle(icon->display, mask, gc_mask, p_x, p_y, p_w, p_h);
|
||||
}
|
||||
else
|
||||
|
||||
@@ -70,14 +70,10 @@ extern "C" in_addr_t inet_addr(const char *);
|
||||
extern "C" { int rresvport(int *); }
|
||||
#endif
|
||||
|
||||
#ifdef hpux
|
||||
#define SETEUID(id) setresuid(getuid(), (uid_t)id, (uid_t)0);
|
||||
#else
|
||||
#if defined(aix)
|
||||
extern "C" { extern int seteuid(uid_t); }
|
||||
#endif
|
||||
#define SETEUID(id) seteuid((uid_t)id)
|
||||
#if defined(aix)
|
||||
extern "C" { extern int seteuid(uid_t); }
|
||||
#endif
|
||||
#define SETEUID(id) seteuid((uid_t)id)
|
||||
|
||||
#include "ParseJobs.h"
|
||||
#include "Invoke.h"
|
||||
@@ -693,106 +689,6 @@ static int SortJobs(const void *_first, const void *_second)
|
||||
|
||||
#endif // SUN LOCAL PARSER
|
||||
|
||||
#ifdef hpux
|
||||
|
||||
/* HP LOCAL PARSER - have to parse the following
|
||||
|
||||
Need to parse the following 2 forms of output:
|
||||
|
||||
coseps-28 guest priority 0 Aug 9 12:54 on coseps
|
||||
test.ps 31160 bytes
|
||||
|
||||
OR
|
||||
|
||||
coseps-29 guest priority 0 Aug 9 12:56 on hostname
|
||||
(standard input) 31160 bytes
|
||||
*/
|
||||
|
||||
void LocalPrintJobs(char *printer, char **return_job_list, int *return_n_jobs)
|
||||
{
|
||||
char *buf = new char[300];
|
||||
char *s, *s1, *c;
|
||||
char *qname;
|
||||
char *jname;
|
||||
char *jnumber;
|
||||
char *owner;
|
||||
char *month;
|
||||
char *day;
|
||||
char *stime;
|
||||
char *jsize;
|
||||
char *hostname;
|
||||
int current_size;
|
||||
int len;
|
||||
char *output;
|
||||
|
||||
static char *job_list = NULL;
|
||||
static int prev_buf_size = 0;
|
||||
|
||||
sprintf(buf, "LANG=C lpstat -i -o%s", printer);
|
||||
Invoke *_thread = new Invoke(buf, &output);
|
||||
|
||||
if (prev_buf_size == 0)
|
||||
{
|
||||
prev_buf_size = BUFSIZ;
|
||||
job_list = (char *)malloc(prev_buf_size);
|
||||
}
|
||||
|
||||
current_size = 0;
|
||||
*job_list = '\0';
|
||||
*return_n_jobs = 0;
|
||||
s = output;
|
||||
if (s1 = strchr(s, '\n'))
|
||||
*s1++ = '\0';
|
||||
while (s && *s)
|
||||
{
|
||||
qname = strtok(s, "-");
|
||||
jnumber = strtok(NULL, " ");
|
||||
owner = strtok(NULL, " ");
|
||||
strtok(NULL, " ");
|
||||
strtok(NULL, " ");
|
||||
month = strtok(NULL, " ");
|
||||
day = strtok(NULL, " ");
|
||||
stime = strtok(NULL, " \n");
|
||||
strtok(NULL, " ");
|
||||
hostname = strtok(NULL, " \n");
|
||||
s = s1;
|
||||
if (s1 = strchr(s, '\n'))
|
||||
*s1++ = '\0';
|
||||
for (jname = s; *jname == '\t' || *jname == ' '; jname++)
|
||||
;
|
||||
jsize = strrchr(s, ' ');
|
||||
*jsize = '\0';
|
||||
jsize = strrchr(s, ' ') + 1;
|
||||
for (c = jsize - 1; *c == ' '; c--)
|
||||
;
|
||||
*(c + 1) = '\0';
|
||||
if (hostname && strcmp(qname, hostname))
|
||||
sprintf(buf, "%s|%s|%s|%s@%s|%s %s|%s|%s\n", qname, jname, jnumber,
|
||||
owner, hostname, month, day, stime, jsize);
|
||||
else
|
||||
sprintf(buf, "%s|%s|%s|%s|%s %s|%s|%s\n", qname, jname, jnumber,
|
||||
owner, month, day, stime, jsize);
|
||||
|
||||
len = strlen(buf);
|
||||
if (prev_buf_size < (current_size + len + 1))
|
||||
job_list = (char *) realloc(job_list, (current_size + len + 1) *
|
||||
sizeof(char *));
|
||||
memcpy(job_list + current_size, buf, len);
|
||||
current_size += len;
|
||||
(*return_n_jobs)++;
|
||||
s = s1;
|
||||
if (s1 = strchr(s, '\n'))
|
||||
*s1++ = '\0';
|
||||
}
|
||||
*(job_list + current_size) = '\0';
|
||||
prev_buf_size = prev_buf_size > current_size ? prev_buf_size : current_size;
|
||||
*return_job_list = job_list;
|
||||
delete [] buf;
|
||||
delete output;
|
||||
delete _thread;
|
||||
}
|
||||
#endif // HP LOCAL PARSER
|
||||
|
||||
#if defined(__linux__) || defined(CSRG_BASED)
|
||||
|
||||
//Linux local parser
|
||||
|
||||
@@ -36,15 +36,6 @@
|
||||
#ifdef aix
|
||||
const char *LIST_QUEUES = "lsallq | grep -v '^bsh$' | sort";
|
||||
#else
|
||||
#ifdef hpux
|
||||
const char *LIST_QUEUES = "LANG=C lpstat -v | "
|
||||
"awk '"
|
||||
" $2 == \"for\" "
|
||||
" { "
|
||||
" x = match($3, /:/); "
|
||||
" print substr($3, 1, x-1)"
|
||||
" }' | sort";
|
||||
#else
|
||||
const char *LIST_QUEUES = "LANG=C lpstat -v | "
|
||||
"nawk '"
|
||||
" $2 == \"for\" "
|
||||
@@ -53,7 +44,6 @@ const char *LIST_QUEUES = "LANG=C lpstat -v | "
|
||||
" print substr($3, 1, x-1)"
|
||||
" }' | sort";
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// Object Class Name
|
||||
const char *PRINTSUBSYSTEM = "PrintSubSystem";
|
||||
|
||||
@@ -46,21 +46,6 @@ const char *GET_DEVICE_STATUS = "LANG=C enq -As -P%s | "
|
||||
const char *START_QUEUE_CMD = "enq -U -P%s";
|
||||
const char *STOP_QUEUE_CMD = "enq -D -P%s";
|
||||
#else
|
||||
#ifdef hpux
|
||||
const char *GET_ATTRS = "LANG=C lpstat -v%s 2>&1 | awk '"
|
||||
"BEGIN { device=\"\"; rhost=\"\"; rp=\"\" } "
|
||||
"/device for/ { device = $4 } "
|
||||
"/remote to/ { rhost = $5; rp = $3 } "
|
||||
"END { print device,rhost,rp }' OFS=:";
|
||||
const char *GET_QUEUE_STATUS = "LANG=C lpstat -i -a%s | awk '"
|
||||
"{if ($2 == \"not\") {exit 1} else {exit 0}}'";
|
||||
const char *GET_DEVICE_STATUS = "LANG=C lpstat -i -p%s | "
|
||||
"awk '/disabled/ {exit 1}'";
|
||||
const char *START_QUEUE_CMD = "/usr/lib/accept %s";
|
||||
const char *STOP_QUEUE_CMD = "/usr/lib/reject %s";
|
||||
const char *START_PRINTING_CMD = "enable %s";
|
||||
const char *STOP_PRINTING_CMD = "disable %s";
|
||||
#else
|
||||
const char *GET_ATTRS = "LANG=C lpstat -v %s 2>&1 | nawk '"
|
||||
"BEGIN { device=\"\"; rhost=\"\"; rp=\"\" } "
|
||||
"/device for/ { device = $4 } "
|
||||
@@ -79,7 +64,6 @@ const char *STOP_QUEUE_CMD = "/usr/sbin/reject %s";
|
||||
const char *START_PRINTING_CMD = "enable %s";
|
||||
const char *STOP_PRINTING_CMD = "disable %s";
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// Object Class Name
|
||||
const char *QUEUE = "Queue";
|
||||
|
||||
Reference in New Issue
Block a user