]>
Commit | Line | Data |
---|---|---|
c441a31a | 1 | /* $Id$ |
7ac48069 | 2 | * |
3 | * This is the file printer.c for the Moira Client, which allows users | |
59ec8dae | 4 | * to quickly and easily maintain most parts of the Moira database. |
cc5b487a | 5 | * It Contains: Functions for handling the printers. |
5eaef520 | 6 | * |
cc5b487a | 7 | * Created: 8/16/88 |
8 | * By: Theodore Y. Ts'o | |
9 | * | |
7ac48069 | 10 | * Copyright (C) 1988-1998 by the Massachusetts Institute of Technology. |
11 | * For copying and distribution information, please see the file | |
12 | * <mit-copyright.h>. | |
cc5b487a | 13 | */ |
14 | ||
7ac48069 | 15 | #include <mit-copyright.h> |
8defc06b | 16 | #include <moira.h> |
17 | #include <moira_site.h> | |
cc5b487a | 18 | #include "defs.h" |
19 | #include "f_defs.h" | |
20 | #include "globals.h" | |
cc5b487a | 21 | |
7ac48069 | 22 | #include <stdio.h> |
23 | #include <stdlib.h> | |
24 | #include <string.h> | |
25 | ||
26 | RCSID("$Header$"); | |
27 | ||
28 | void RealDeletePcap(char **info, Bool one_item); | |
29 | void ChangePcap(char **info, Bool one_item); | |
30 | void ChangePalladium(char **info, Bool one_item); | |
31 | void RealDeletePalladium(char **info, Bool one_item); | |
32 | ||
cc5b487a | 33 | #define DEFAULT_MACHINE "E40-PRINT-SERVER-1.MIT.EDU" |
34 | ||
35 | /* Function Name: SetDefaults | |
36 | * Description: sets the default values for filesystem additions. | |
5eaef520 | 37 | * Arguments: info - an array of char pointers to recieve defaults. |
cc5b487a | 38 | * Returns: char ** (this array, now filled). |
39 | */ | |
40 | ||
5eaef520 | 41 | static char **SetDefaults(char **info, char *name) |
cc5b487a | 42 | { |
5eaef520 | 43 | char spool_dir[256]; |
44 | ||
45 | strcpy(spool_dir, "/usr/spool/printer/"); | |
46 | strcat(spool_dir, name); | |
47 | ||
7ac48069 | 48 | info[PCAP_NAME] = strdup(name); |
49 | info[PCAP_SPOOL_HOST] = strdup(DEFAULT_MACHINE); | |
50 | info[PCAP_SPOOL_DIR] = strdup(spool_dir); | |
51 | info[PCAP_RPRINTER] = strdup(name); | |
52 | info[PCAP_QSERVER] = strdup("[NONE]"); | |
53 | info[PCAP_AUTH] = strdup("1"); | |
54 | info[PCAP_PRICE] = strdup("10"); | |
55 | info[PCAP_COMMENTS] = strdup(""); | |
5eaef520 | 56 | info[PCAP_MODTIME] = info[PCAP_MODBY] = info[PCAP_MODWITH] = NULL; |
57 | ||
58 | info[PCAP_END] = NULL; | |
59 | return info; | |
cc5b487a | 60 | } |
61 | ||
62 | /* Function Name: GetPcapInfo | |
63 | * Description: Stores the info in a queue. | |
64 | * Arguments: name - name of the item to get information on. | |
65 | * Returns: a pointer to the first element in the queue or null | |
66 | * if printer not found. | |
67 | */ | |
68 | ||
600b459e | 69 | static struct mqelem *GetPcapInfo(char *name) |
cc5b487a | 70 | { |
5eaef520 | 71 | int stat; |
600b459e | 72 | struct mqelem *elem = NULL; |
5eaef520 | 73 | |
7ac48069 | 74 | if ((stat = do_mr_query("get_printcap_entry", 1, &name, StoreInfo, &elem))) |
5eaef520 | 75 | { |
76 | com_err(program_name, stat, " in GetPcapInfo"); | |
77 | return NULL; | |
cc5b487a | 78 | } |
5eaef520 | 79 | return QueueTop(elem); |
cc5b487a | 80 | } |
81 | ||
82 | /* Function Name: PrintPcapInfo | |
83 | * Description: Yet another specialized print function. | |
84 | * Arguments: info - all info about this Printer. | |
7ac48069 | 85 | * Returns: printer name |
cc5b487a | 86 | */ |
87 | ||
7ac48069 | 88 | static char *PrintPcapInfo(char **info) |
cc5b487a | 89 | { |
5eaef520 | 90 | char buf[BUFSIZ]; |
91 | ||
92 | if (!info) /* If no informaion */ | |
93 | { | |
94 | Put_message("PrintPcapInfo called with null info!"); | |
7ac48069 | 95 | return NULL; |
cc5b487a | 96 | } |
5eaef520 | 97 | sprintf(buf, "Printer: %-35s Spool host: %s", info[PCAP_NAME], |
98 | info[PCAP_SPOOL_HOST]); | |
99 | Put_message(buf); | |
100 | sprintf(buf, "Spool directory: %-27s Remote Printer Name: %s", | |
101 | info[PCAP_SPOOL_DIR], info[PCAP_RPRINTER]); | |
102 | Put_message(buf); | |
103 | sprintf(buf, "Authentication: %-3s Price/page: %-3s Quota Server: %s", | |
104 | atoi(info[PCAP_AUTH]) ? "yes" : "no", | |
105 | info[PCAP_PRICE], info[PCAP_QSERVER]); | |
106 | Put_message(buf); | |
107 | sprintf(buf, "Comments: %s", info[PCAP_COMMENTS]); | |
108 | Put_message(buf); | |
109 | sprintf(buf, MOD_FORMAT, info[PCAP_MODBY], info[PCAP_MODTIME], | |
110 | info[PCAP_MODWITH]); | |
111 | Put_message(buf); | |
7ac48069 | 112 | |
113 | return info[PCAP_NAME]; | |
cc5b487a | 114 | } |
115 | ||
116 | /* Function Name: AskPcapInfo. | |
5eaef520 | 117 | * Description: This function askes the user for information about a |
cc5b487a | 118 | * printer and saves it into a structure. |
119 | * Arguments: info - a pointer the the structure to put the | |
120 | * info into. | |
121 | * Returns: none. | |
122 | */ | |
123 | ||
5eaef520 | 124 | static char **AskPcapInfo(char **info) |
cc5b487a | 125 | { |
5eaef520 | 126 | char temp_buf[BUFSIZ]; |
127 | ||
128 | Put_message(""); | |
129 | sprintf(temp_buf, "Printcap entry for %s.", info[PCAP_NAME]); | |
130 | Put_message(temp_buf); | |
131 | Put_message(""); | |
132 | ||
133 | if (GetValueFromUser("Printer Server", &info[PCAP_SPOOL_HOST]) == SUB_ERROR) | |
134 | return NULL; | |
135 | info[PCAP_SPOOL_HOST] = canonicalize_hostname(info[PCAP_SPOOL_HOST]); | |
136 | if (GetValueFromUser("Spool Directory", &info[PCAP_SPOOL_DIR]) == | |
137 | SUB_ERROR) | |
138 | return NULL; | |
139 | if (GetValueFromUser("Remote Printer Name", &info[PCAP_RPRINTER]) == | |
140 | SUB_ERROR) | |
141 | return NULL; | |
142 | if (GetValueFromUser("Quotaserver for this printer", &info[PCAP_QSERVER]) == | |
143 | SUB_ERROR) | |
144 | return NULL; | |
145 | info[PCAP_QSERVER] = canonicalize_hostname(info[PCAP_QSERVER]); | |
146 | if (GetYesNoValueFromUser("Authentication required", &info[PCAP_AUTH]) == | |
147 | SUB_ERROR) | |
148 | return NULL; | |
149 | if (GetValueFromUser("Price/page", &info[PCAP_PRICE]) == SUB_ERROR) | |
150 | return NULL; | |
151 | if (GetValueFromUser("Comments", &info[PCAP_COMMENTS]) == SUB_ERROR) | |
152 | return NULL; | |
153 | ||
154 | FreeAndClear(&info[PCAP_MODTIME], TRUE); | |
155 | FreeAndClear(&info[PCAP_MODBY], TRUE); | |
156 | FreeAndClear(&info[PCAP_MODWITH], TRUE); | |
157 | ||
158 | return info; | |
cc5b487a | 159 | } |
160 | ||
161 | /* ---------------- Printer Menu ------------------ */ | |
162 | ||
163 | /* Function Name: GetPcap | |
164 | * Description: Get Printcap information | |
165 | * Arguments: argc, argv - name of filsys in argv[1]. | |
166 | * Returns: DM_NORMAL. | |
167 | */ | |
168 | ||
5eaef520 | 169 | int GetPcap(int argc, char **argv) |
cc5b487a | 170 | { |
600b459e | 171 | struct mqelem *top; |
cc5b487a | 172 | |
5eaef520 | 173 | top = GetPcapInfo(argv[1]); /* get info. */ |
174 | Loop(top, (void *) PrintPcapInfo); | |
175 | FreeQueue(top); /* clean the queue. */ | |
176 | return DM_NORMAL; | |
cc5b487a | 177 | } |
178 | ||
179 | /* Function Name: RealDeletePcap | |
180 | * Description: Does the real deletion work. | |
181 | * Arguments: info - array of char *'s containing all useful info. | |
5eaef520 | 182 | * one_item - a Boolean that is true if only one item |
cc5b487a | 183 | * in queue that dumped us here. |
184 | * Returns: none. | |
185 | */ | |
186 | ||
5eaef520 | 187 | void RealDeletePcap(char **info, Bool one_item) |
cc5b487a | 188 | { |
5eaef520 | 189 | int stat; |
cc5b487a | 190 | |
5eaef520 | 191 | if ((stat = do_mr_query("delete_printcap_entry", 1, |
7ac48069 | 192 | &info[PCAP_NAME], NULL, NULL))) |
5eaef520 | 193 | com_err(program_name, stat, " printcap entry not deleted."); |
194 | else | |
195 | Put_message("Printcap entry deleted."); | |
cc5b487a | 196 | } |
197 | ||
198 | /* Function Name: DeletePcap | |
199 | * Description: Delete a printcap entry given its name. | |
200 | * Arguments: argc, argv - argv[1] is the name of the printer. | |
201 | * Returns: none. | |
202 | */ | |
203 | ||
5eaef520 | 204 | int DeletePcap(int argc, char **argv) |
cc5b487a | 205 | { |
600b459e | 206 | struct mqelem *elem = GetPcapInfo(argv[1]); |
5eaef520 | 207 | QueryLoop(elem, PrintPcapInfo, RealDeletePcap, "Delete Printer"); |
cc5b487a | 208 | |
5eaef520 | 209 | FreeQueue(elem); |
210 | return DM_NORMAL; | |
cc5b487a | 211 | } |
212 | ||
213 | /* Function Name: AddPcap | |
214 | * Description: Add a printcap entry | |
215 | * Arguments: arc, argv - name of printer in argv[1]. | |
216 | * Returns: DM_NORMAL. | |
217 | */ | |
218 | ||
5eaef520 | 219 | int AddPcap(int argc, char **argv) |
cc5b487a | 220 | { |
5eaef520 | 221 | char *info[MAX_ARGS_SIZE], **args; |
222 | int stat; | |
223 | ||
224 | if (!ValidName(argv[1])) | |
225 | return DM_NORMAL; | |
226 | ||
227 | if (!(stat = do_mr_query("get_printcap_entry", 1, argv + 1, | |
7ac48069 | 228 | NULL, NULL))) |
5eaef520 | 229 | { |
230 | Put_message ("A Printer by that name already exists."); | |
231 | return DM_NORMAL; | |
232 | } | |
233 | else if (stat != MR_NO_MATCH) | |
234 | { | |
235 | com_err(program_name, stat, " in AddPcap"); | |
236 | return DM_NORMAL; | |
b7fbb301 | 237 | } |
cc5b487a | 238 | |
5eaef520 | 239 | args = AskPcapInfo(SetDefaults(info, argv[1])); |
240 | if (!args) | |
241 | { | |
242 | Put_message("Aborted."); | |
243 | return DM_NORMAL; | |
244 | } | |
245 | ||
246 | if ((stat = do_mr_query("add_printcap_entry", CountArgs(args), args, | |
7ac48069 | 247 | NULL, NULL))) |
5eaef520 | 248 | com_err(program_name, stat, " in AddPcap"); |
cc5b487a | 249 | |
5eaef520 | 250 | FreeInfo(info); |
251 | return DM_NORMAL; | |
cc5b487a | 252 | } |
253 | ||
254 | ||
f03f1f1b | 255 | /* Function Name: ChangePcap |
256 | * Description: Do the work of changing a pcap | |
257 | * Arguments: argc, argv - printcap info | |
5eaef520 | 258 | * Returns: |
f03f1f1b | 259 | */ |
260 | ||
7ac48069 | 261 | void ChangePcap(char **info, Bool one_item) |
f03f1f1b | 262 | { |
5eaef520 | 263 | int stat; |
264 | char **oldinfo; | |
265 | ||
266 | oldinfo = CopyInfo(info); | |
267 | if (!AskPcapInfo(info)) | |
7ac48069 | 268 | return; |
5eaef520 | 269 | if ((stat = do_mr_query("delete_printcap_entry", 1, &info[PCAP_NAME], |
7ac48069 | 270 | NULL, NULL))) |
5eaef520 | 271 | { |
272 | com_err(program_name, stat, " printcap entry not deleted."); | |
7ac48069 | 273 | return; |
f03f1f1b | 274 | } |
5eaef520 | 275 | if ((stat = do_mr_query("add_printcap_entry", CountArgs(info), info, |
7ac48069 | 276 | NULL, NULL))) |
5eaef520 | 277 | { |
278 | com_err(program_name, stat, " in ChngPcap"); | |
279 | if ((stat = do_mr_query("add_printcap_entry", CountArgs(oldinfo) - 3, | |
7ac48069 | 280 | oldinfo, NULL, NULL))) |
5eaef520 | 281 | com_err(program_name, stat, " while attempting to put old info back"); |
b98304a9 | 282 | } |
5eaef520 | 283 | FreeInfo(oldinfo); |
7ac48069 | 284 | return; |
f03f1f1b | 285 | } |
286 | ||
287 | ||
288 | /* Function Name: ChngPcap | |
289 | * Description: Update the printcap information | |
290 | * Arguments: argc, argv - name of printer in argv[1]. | |
291 | * Returns: DM_NORMAL. | |
292 | */ | |
293 | ||
5eaef520 | 294 | int ChngPcap(int argc, char **argv) |
f03f1f1b | 295 | { |
600b459e | 296 | struct mqelem *elem = GetPcapInfo(argv[1]); |
5eaef520 | 297 | QueryLoop(elem, NullPrint, ChangePcap, "Change the printer"); |
298 | FreeQueue(elem); | |
299 | return DM_NORMAL; | |
f03f1f1b | 300 | } |
1b2e1580 | 301 | |
302 | ||
303 | /* Function Name: SetPdDefaults | |
304 | * Description: sets the default values for palladium additions. | |
5eaef520 | 305 | * Arguments: info - an array of char pointers to recieve defaults. |
1b2e1580 | 306 | * Returns: char ** (this array, now filled). |
307 | */ | |
308 | ||
5eaef520 | 309 | static char **SetPdDefaults(char **info, char *name) |
1b2e1580 | 310 | { |
7ac48069 | 311 | info[PD_NAME] = strdup(name); |
312 | info[PD_IDENT] = strdup("10000"); | |
313 | info[PD_HOST] = strdup(DEFAULT_MACHINE); | |
5eaef520 | 314 | info[PD_MODTIME] = info[PD_MODBY] = info[PD_MODWITH] = NULL; |
1b2e1580 | 315 | |
5eaef520 | 316 | info[PD_END] = NULL; |
317 | return info; | |
1b2e1580 | 318 | } |
319 | ||
320 | /* Function Name: AskPalladiumInfo. | |
5eaef520 | 321 | * Description: This function askes the user for information about a |
1b2e1580 | 322 | * printer and saves it into a structure. |
323 | * Arguments: info - a pointer the the structure to put the | |
324 | * info into. | |
325 | * Returns: none. | |
326 | */ | |
327 | ||
5eaef520 | 328 | static char **AskPalladiumInfo(char **info) |
1b2e1580 | 329 | { |
5eaef520 | 330 | char temp_buf[BUFSIZ]; |
331 | ||
332 | Put_message(""); | |
333 | sprintf(temp_buf, "Palladium Server/Supervisor entry for %s.", | |
334 | info[PD_NAME]); | |
335 | Put_message(temp_buf); | |
336 | Put_message(""); | |
337 | ||
338 | if (GetValueFromUser("RPC Program Number", &info[PD_IDENT]) == SUB_ERROR) | |
339 | return NULL; | |
340 | if (GetValueFromUser("Print Server/Supervisor Host", &info[PD_HOST]) == | |
341 | SUB_ERROR) | |
342 | return NULL; | |
343 | info[PD_HOST] = canonicalize_hostname(info[PD_HOST]); | |
344 | ||
345 | FreeAndClear(&info[PD_MODTIME], TRUE); | |
346 | FreeAndClear(&info[PD_MODBY], TRUE); | |
347 | FreeAndClear(&info[PD_MODWITH], TRUE); | |
348 | ||
349 | return info; | |
1b2e1580 | 350 | } |
351 | ||
352 | ||
353 | /* Function Name: PrintPalladiumInfo | |
354 | * Description: Yet another specialized print function. | |
355 | * Arguments: info - all info about this Printer. | |
7ac48069 | 356 | * Returns: printer name |
1b2e1580 | 357 | */ |
358 | ||
7ac48069 | 359 | static char *PrintPalladiumInfo(char **info) |
1b2e1580 | 360 | { |
5eaef520 | 361 | char buf[BUFSIZ]; |
362 | ||
363 | if (!info) /* If no informaion */ | |
364 | { | |
365 | Put_message("PrintPalladiumInfo called with null info!"); | |
7ac48069 | 366 | return NULL; |
1b2e1580 | 367 | } |
368 | ||
5eaef520 | 369 | sprintf(buf, "Name: %-24s Program #: %s Host: %s", |
370 | info[PD_NAME], info[PD_IDENT], info[PD_HOST]); | |
371 | Put_message(buf); | |
372 | sprintf(buf, MOD_FORMAT, info[PD_MODBY], info[PD_MODTIME], | |
373 | info[PD_MODWITH]); | |
374 | Put_message(buf); | |
7ac48069 | 375 | return info[PD_NAME]; |
1b2e1580 | 376 | } |
377 | ||
378 | ||
600b459e | 379 | static struct mqelem *GetPalladiumInfo(char *name) |
1b2e1580 | 380 | { |
5eaef520 | 381 | int status; |
600b459e | 382 | struct mqelem *elem = NULL; |
1b2e1580 | 383 | |
5eaef520 | 384 | if ((status = do_mr_query("get_palladium", 1, &name, StoreInfo, &elem))) |
385 | { | |
386 | com_err(program_name, status, " in GetPalladiumInfo"); | |
387 | return NULL; | |
1b2e1580 | 388 | } |
5eaef520 | 389 | return QueueTop(elem); |
1b2e1580 | 390 | } |
391 | ||
392 | ||
7ac48069 | 393 | void ChangePalladium(char **info, Bool one_item) |
1b2e1580 | 394 | { |
5eaef520 | 395 | int status; |
396 | ||
397 | if (!AskPalladiumInfo(info)) | |
7ac48069 | 398 | return; |
5eaef520 | 399 | if ((status = do_mr_query("delete_palladium", 1, &info[PD_NAME], |
7ac48069 | 400 | NULL, NULL))) |
5eaef520 | 401 | { |
402 | com_err(program_name, status, " palladium entry not deleted."); | |
7ac48069 | 403 | return; |
1b2e1580 | 404 | } |
5eaef520 | 405 | if ((status = do_mr_query("add_palladium", CountArgs(info), info, |
7ac48069 | 406 | NULL, NULL))) |
5eaef520 | 407 | com_err(program_name, status, " in ChngPalladium"); |
7ac48069 | 408 | return; |
1b2e1580 | 409 | } |
410 | ||
411 | ||
412 | /* Function Name: RealDeletePalladium | |
413 | * Description: Does the real deletion work. | |
414 | * Arguments: info - array of char *'s containing all useful info. | |
5eaef520 | 415 | * one_item - a Boolean that is true if only one item |
1b2e1580 | 416 | * in queue that dumped us here. |
417 | * Returns: none. | |
418 | */ | |
419 | ||
5eaef520 | 420 | void RealDeletePalladium(char **info, Bool one_item) |
1b2e1580 | 421 | { |
5eaef520 | 422 | int stat; |
1b2e1580 | 423 | |
5eaef520 | 424 | if ((stat = do_mr_query("delete_palladium", 1, |
7ac48069 | 425 | &info[PD_NAME], NULL, NULL))) |
5eaef520 | 426 | com_err(program_name, stat, " palladium entry not deleted."); |
427 | else | |
428 | Put_message("Palladium entry deleted."); | |
1b2e1580 | 429 | } |
430 | ||
431 | ||
5eaef520 | 432 | int GetPalladium(int argc, char **argv) |
1b2e1580 | 433 | { |
600b459e | 434 | struct mqelem *top; |
1b2e1580 | 435 | |
5eaef520 | 436 | top = GetPalladiumInfo(argv[1]); |
7ac48069 | 437 | Loop(top, (void (*)(char **))PrintPalladiumInfo); |
5eaef520 | 438 | FreeQueue(top); |
439 | return DM_NORMAL; | |
1b2e1580 | 440 | } |
441 | ||
442 | ||
5eaef520 | 443 | int AddPalladium(int argc, char **argv) |
1b2e1580 | 444 | { |
5eaef520 | 445 | char *info[MAX_ARGS_SIZE], **args; |
446 | int status; | |
447 | ||
448 | if (!ValidName(argv[1])) | |
449 | return DM_NORMAL; | |
450 | ||
7ac48069 | 451 | if (!(status = do_mr_query("get_palladium", 1, &argv[1], NULL, NULL))) |
5eaef520 | 452 | { |
453 | Put_message("A server or supervisor by that name already exists."); | |
454 | return DM_NORMAL; | |
455 | } | |
456 | else if (status != MR_NO_MATCH) | |
457 | { | |
458 | com_err(program_name, status, " in AddPalladium"); | |
459 | return DM_NORMAL; | |
1b2e1580 | 460 | } |
461 | ||
5eaef520 | 462 | args = AskPalladiumInfo(SetPdDefaults(info, argv[1])); |
463 | if (!args) | |
464 | { | |
465 | Put_message("Aborted."); | |
466 | return DM_NORMAL; | |
b7fbb301 | 467 | } |
1b2e1580 | 468 | |
5eaef520 | 469 | if ((status = do_mr_query("add_palladium", CountArgs(args), args, |
7ac48069 | 470 | NULL, NULL))) |
5eaef520 | 471 | com_err(program_name, status, " in AddPalladium"); |
1b2e1580 | 472 | |
5eaef520 | 473 | FreeInfo(info); |
474 | return DM_NORMAL; | |
1b2e1580 | 475 | } |
476 | ||
477 | ||
5eaef520 | 478 | int ChngPalladium(int argc, char **argv) |
1b2e1580 | 479 | { |
600b459e | 480 | struct mqelem *elem = GetPalladiumInfo(argv[1]); |
5eaef520 | 481 | QueryLoop(elem, NullPrint, ChangePalladium, "Change the server/supervisor"); |
482 | FreeQueue(elem); | |
483 | return DM_NORMAL; | |
1b2e1580 | 484 | } |
485 | ||
486 | ||
5eaef520 | 487 | int DeletePalladium(int argc, char **argv) |
1b2e1580 | 488 | { |
600b459e | 489 | struct mqelem *elem = GetPalladiumInfo(argv[1]); |
5eaef520 | 490 | QueryLoop(elem, PrintPalladiumInfo, RealDeletePalladium, |
491 | "Delete server/supervisor"); | |
492 | FreeQueue(elem); | |
493 | return DM_NORMAL; | |
1b2e1580 | 494 | } |
495 | ||
5eaef520 | 496 | int ShowPalladiumAlias(int argc, char **argv) |
1b2e1580 | 497 | { |
600b459e | 498 | struct mqelem *elem = NULL; |
5eaef520 | 499 | char *qargv[3], buf[BUFSIZ]; |
500 | int status; | |
501 | ||
502 | qargv[0] = argv[1]; | |
503 | qargv[1] = "PALLADIUM"; | |
504 | qargv[2] = argv[2]; | |
505 | if ((status = do_mr_query("get_alias", 3, qargv, StoreInfo, &elem))) | |
506 | { | |
507 | com_err(program_name, status, " in ShowPalladiumAlias"); | |
508 | return DM_NORMAL; | |
1b2e1580 | 509 | } |
5eaef520 | 510 | elem = QueueTop(elem); |
511 | Put_message(""); | |
512 | while (elem) | |
513 | { | |
7ac48069 | 514 | char **info = elem->q_data; |
5eaef520 | 515 | sprintf(buf, "Printer: %-16s Server/Supervisor: %s", info[0], info[2]); |
516 | Put_message(buf); | |
517 | elem = elem->q_forw; | |
1b2e1580 | 518 | } |
519 | ||
5eaef520 | 520 | FreeQueue(QueueTop(elem)); |
521 | return DM_NORMAL; | |
1b2e1580 | 522 | } |
523 | ||
5eaef520 | 524 | int AddPalladiumAlias(int argc, char **argv) |
1b2e1580 | 525 | { |
5eaef520 | 526 | int status; |
527 | char *qargv[3]; | |
528 | ||
529 | qargv[0] = argv[1]; | |
530 | qargv[1] = "PALLADIUM"; | |
531 | qargv[2] = argv[2]; | |
7ac48069 | 532 | if ((status = do_mr_query("add_alias", 3, qargv, NULL, NULL))) |
5eaef520 | 533 | com_err(program_name, status, " in AddPalladiumAlias"); |
534 | return DM_NORMAL; | |
1b2e1580 | 535 | } |
536 | ||
5eaef520 | 537 | int DeletePalladiumAlias(int argc, char **argv) |
1b2e1580 | 538 | { |
5eaef520 | 539 | int status; |
540 | char *qargv[3]; | |
541 | ||
542 | qargv[0] = argv[1]; | |
543 | qargv[1] = "PALLADIUM"; | |
544 | qargv[2] = argv[2]; | |
7ac48069 | 545 | if ((status = do_mr_query("delete_alias", 3, qargv, NULL, NULL))) |
5eaef520 | 546 | com_err(program_name, status, " in DeletePalladiumAlias"); |
547 | return DM_NORMAL; | |
1b2e1580 | 548 | } |