#include "stdio.h"
#include "ctype.h"
#include "errno.h"
#include "sys/types.h"
#include "sys/utsname.h"
#include "string.h"
#include "lp.h"
#include "msgs.h"
#include "access.h"
#include "class.h"
#include "printers.h"
#define WHO_AM_I I_AM_LPADMIN
#include "oam.h"
#include "lpadmin.h"
#include <locale.h>
extern void chkopts(),
chkopts2(),
chkopts3(),
exit();
int system_labeled = 0;
int scheduler_active = 0;
char *label = 0;
PRINTER *printer_pointer = 0;
static CLASS *class_pointer = 0;
PWHEEL *pwheel_pointer = 0;
char *Local_System = 0;
int
main(int argc, char *argv[])
{
struct utsname un;
(void) setlocale (LC_ALL, "");
#if !defined(TEXT_DOMAIN)
#define TEXT_DOMAIN "SYS_TEST"
#endif
(void) textdomain(TEXT_DOMAIN);
if (!is_user_admin()) {
LP_ERRMSG (ERROR, E_LP_NOTADM);
done (1);
}
system_labeled = is_system_labeled();
uname(&un);
Local_System = strdup(un.nodename);
options (argc, argv);
chkopts ();
startup ();
if (d)
newdflt (d);
else if (x) {
if (STREQU(NAME_ALL, x) || STREQU(NAME_ANY, x)) {
while ((class_pointer = getclass(NAME_ALL)))
rmdest (1, class_pointer->name);
if (errno != ENOENT) {
LP_ERRMSG1 (
ERROR,
E_ADM_GETCLASSES,
PERROR
);
done (1);
}
while ((printer_pointer = getprinter(NAME_ALL)))
rmdest (0, printer_pointer->name);
if (errno != ENOENT) {
LP_ERRMSG1 (
ERROR,
E_ADM_GETPRINTERS,
PERROR
);
done (1);
}
} else
rmdest (isclass(x), x);
} else if (!p && S) {
if (STREQU(*S, NAME_ALL) || STREQU(*S, NAME_ANY)) {
while ((pwheel_pointer = getpwheel(NAME_ALL))) {
*S = pwheel_pointer->name;
chkopts3 (0);
label = *S;
do_pwheel ();
}
} else {
label = 0;
do_pwheel ();
}
#if defined(J_OPTION)
} else if (j) {
do_fault ();
#endif
} else {
if (STREQU(NAME_ALL, p) || STREQU(NAME_ANY, p)) {
int called=0;
while ((printer_pointer = getprinter(NAME_ALL)) != NULL) {
char * save_s = s;
called++;
p = printer_pointer->name;
chkopts2 (0);
if (s)
if (
A || a || e || F || H
|| h || i || l || m || M
|| o || U || v
|| Q != -1 || W != -1
)
LP_ERRMSG1 (
WARNING,
E_ADM_SIGNORE,
p
);
label = p;
do_printer ();
s = save_s;
}
if (called == 0 )
LP_ERRMSG (ERROR, E_ADM_PLONELY);
if (errno != ENOENT) {
LP_ERRMSG2 (
ERROR,
E_LP_GETPRINTER,
NAME_ALL,
PERROR
);
done (1);
}
} else {
label = 0;
do_printer ();
}
}
done (0);
return (0);
}
int putp ()
{
return (0);
}