関数 | |
static int | print_run_command (int snum, const char *printername, BOOL do_sub, const char *command, int *outfd,...) |
static int | generic_job_delete (const char *sharename, const char *lprm_command, struct printjob *pjob) |
static int | generic_job_pause (int snum, struct printjob *pjob) |
static int | generic_job_resume (int snum, struct printjob *pjob) |
static int | generic_job_submit (int snum, struct printjob *pjob) |
static int | generic_queue_get (const char *printer_name, enum printing_types printing_type, char *lpq_command, print_queue_struct **q, print_status_struct *status) |
static int | generic_queue_pause (int snum) |
static int | generic_queue_resume (int snum) |
変数 | |
current_user | current_user |
userdom_struct | current_user_info |
printif | generic_printif |
static int print_run_command | ( | int | snum, | |
const char * | printername, | |||
BOOL | do_sub, | |||
const char * | command, | |||
int * | outfd, | |||
... | ||||
) | [static] |
print_generic.c の 32 行で定義されています。
参照先 current_user・current_user_info・userdom_struct::domain・get_current_username()・_unix_token::gid・pstring_sub()・smbrun_no_sanitize()・standard_sub_advanced()・userdom_struct::unix_name・current_user::ut.
参照元 generic_job_delete()・generic_job_pause()・generic_job_resume()・generic_job_submit()・generic_queue_get()・generic_queue_pause()・generic_queue_resume().
00034 { 00035 pstring syscmd; 00036 char *arg; 00037 int ret; 00038 va_list ap; 00039 va_start(ap, outfd); 00040 00041 /* check for a valid system printername and valid command to run */ 00042 00043 if ( !printername || !*printername ) 00044 return -1; 00045 00046 if (!command || !*command) 00047 return -1; 00048 00049 pstrcpy(syscmd, command); 00050 00051 while ((arg = va_arg(ap, char *))) { 00052 char *value = va_arg(ap,char *); 00053 pstring_sub(syscmd, arg, value); 00054 } 00055 va_end(ap); 00056 00057 pstring_sub( syscmd, "%p", printername ); 00058 00059 if ( do_sub && snum != -1 ) 00060 standard_sub_advanced(lp_servicename(snum), 00061 current_user_info.unix_name, "", 00062 current_user.ut.gid, 00063 get_current_username(), 00064 current_user_info.domain, 00065 syscmd, sizeof(syscmd)); 00066 00067 ret = smbrun_no_sanitize(syscmd,outfd); 00068 00069 DEBUG(3,("Running the command `%s' gave %d\n",syscmd,ret)); 00070 00071 return ret; 00072 }
static int generic_job_delete | ( | const char * | sharename, | |
const char * | lprm_command, | |||
struct printjob * | pjob | |||
) | [static] |
print_generic.c の 78 行で定義されています。
参照先 http_timestring()・print_run_command()・printjob::starttime・printjob::sysjob.
00079 { 00080 fstring jobstr; 00081 00082 /* need to delete the spooled entry */ 00083 slprintf(jobstr, sizeof(jobstr)-1, "%d", pjob->sysjob); 00084 return print_run_command( -1, sharename, False, lprm_command, NULL, 00085 "%j", jobstr, 00086 "%T", http_timestring(pjob->starttime), 00087 NULL); 00088 }
static int generic_job_pause | ( | int | snum, | |
struct printjob * | pjob | |||
) | [static] |
print_generic.c の 93 行で定義されています。
参照先 print_run_command()・printjob::sysjob.
00094 { 00095 fstring jobstr; 00096 00097 /* need to pause the spooled entry */ 00098 slprintf(jobstr, sizeof(jobstr)-1, "%d", pjob->sysjob); 00099 return print_run_command(snum, PRINTERNAME(snum), True, 00100 lp_lppausecommand(snum), NULL, 00101 "%j", jobstr, 00102 NULL); 00103 }
static int generic_job_resume | ( | int | snum, | |
struct printjob * | pjob | |||
) | [static] |
print_generic.c の 108 行で定義されています。
参照先 print_run_command()・printjob::sysjob.
00109 { 00110 fstring jobstr; 00111 00112 /* need to pause the spooled entry */ 00113 slprintf(jobstr, sizeof(jobstr)-1, "%d", pjob->sysjob); 00114 return print_run_command(snum, PRINTERNAME(snum), True, 00115 lp_lpresumecommand(snum), NULL, 00116 "%j", jobstr, 00117 NULL); 00118 }
static int generic_job_submit | ( | int | snum, | |
struct printjob * | pjob | |||
) | [static] |
print_generic.c の 124 行で定義されています。
参照先 printjob::filename・printjob::jobname・printjob::page_count・print_run_command()・pstring_sub()・printjob::size・strrchr_m()・sys_getwd().
00125 { 00126 int ret; 00127 pstring current_directory; 00128 pstring print_directory; 00129 char *wd, *p; 00130 pstring jobname; 00131 fstring job_page_count, job_size; 00132 00133 /* we print from the directory path to give the best chance of 00134 parsing the lpq output */ 00135 wd = sys_getwd(current_directory); 00136 if (!wd) 00137 return 0; 00138 00139 pstrcpy(print_directory, pjob->filename); 00140 p = strrchr_m(print_directory,'/'); 00141 if (!p) 00142 return 0; 00143 *p++ = 0; 00144 00145 if (chdir(print_directory) != 0) 00146 return 0; 00147 00148 pstrcpy(jobname, pjob->jobname); 00149 pstring_sub(jobname, "'", "_"); 00150 slprintf(job_page_count, sizeof(job_page_count)-1, "%d", pjob->page_count); 00151 slprintf(job_size, sizeof(job_size)-1, "%lu", (unsigned long)pjob->size); 00152 00153 /* send it to the system spooler */ 00154 ret = print_run_command(snum, PRINTERNAME(snum), True, 00155 lp_printcommand(snum), NULL, 00156 "%s", p, 00157 "%J", jobname, 00158 "%f", p, 00159 "%z", job_size, 00160 "%c", job_page_count, 00161 NULL); 00162 00163 chdir(wd); 00164 00165 return ret; 00166 }
static int generic_queue_get | ( | const char * | printer_name, | |
enum printing_types | printing_type, | |||
char * | lpq_command, | |||
print_queue_struct ** | q, | |||
print_status_struct * | status | |||
) | [static] |
print_generic.c の 172 行で定義されています。
参照先 fd・fd_lines_load()・file_lines_free()・parse_lpq_entry()・print_run_command()・status.
00177 { 00178 char **qlines; 00179 int fd; 00180 int numlines, i, qcount; 00181 print_queue_struct *queue = NULL; 00182 00183 /* never do substitution when running the 'lpq command' since we can't 00184 get it rigt when using the background update daemon. Make the caller 00185 do it before passing off the command string to us here. */ 00186 00187 print_run_command(-1, printer_name, False, lpq_command, &fd, NULL); 00188 00189 if (fd == -1) { 00190 DEBUG(5,("generic_queue_get: Can't read print queue status for printer %s\n", 00191 printer_name )); 00192 return 0; 00193 } 00194 00195 numlines = 0; 00196 qlines = fd_lines_load(fd, &numlines,0); 00197 close(fd); 00198 00199 /* turn the lpq output into a series of job structures */ 00200 qcount = 0; 00201 ZERO_STRUCTP(status); 00202 if (numlines && qlines) { 00203 queue = SMB_MALLOC_ARRAY(print_queue_struct, numlines+1); 00204 if (!queue) { 00205 file_lines_free(qlines); 00206 *q = NULL; 00207 return 0; 00208 } 00209 memset(queue, '\0', sizeof(print_queue_struct)*(numlines+1)); 00210 00211 for (i=0; i<numlines; i++) { 00212 /* parse the line */ 00213 if (parse_lpq_entry(printing_type,qlines[i], 00214 &queue[qcount],status,qcount==0)) { 00215 qcount++; 00216 } 00217 } 00218 } 00219 00220 file_lines_free(qlines); 00221 *q = queue; 00222 return qcount; 00223 }
static int generic_queue_pause | ( | int | snum | ) | [static] |
print_generic.c の 228 行で定義されています。
参照先 print_run_command().
00229 { 00230 return print_run_command(snum, PRINTERNAME(snum), True, lp_queuepausecommand(snum), NULL, NULL); 00231 }
static int generic_queue_resume | ( | int | snum | ) | [static] |
print_generic.c の 236 行で定義されています。
参照先 print_run_command().
00237 { 00238 return print_run_command(snum, PRINTERNAME(snum), True, lp_queueresumecommand(snum), NULL, NULL); 00239 }
struct current_user current_user |
substitute.c の 29 行で定義されています。
struct printif generic_printif |
初期値:
{ DEFAULT_PRINTING, generic_queue_get, generic_queue_pause, generic_queue_resume, generic_job_delete, generic_job_pause, generic_job_resume, generic_job_submit, }
print_generic.c の 245 行で定義されています。