Lines Matching refs:job

47 	np_bsdjob_t *job;  in create_bsd_job()  local
57 job = (np_bsdjob_t *)malloc(sizeof (np_bsdjob_t)); in create_bsd_job()
58 ASSERT(job, MALLOC_ERR); in create_bsd_job()
59 (void) memset(job, 0, sizeof (np_bsdjob_t)); in create_bsd_job()
60 job->np_printer = "auto"; /* default "queue" */ in create_bsd_job()
81 job->np_request_id = malloc(4); in create_bsd_job()
82 ASSERT(job->np_request_id, MALLOC_ERR); in create_bsd_job()
88 (void) snprintf(job->np_request_id, (size_t)4, in create_bsd_job()
94 job->np_username = strdup(injob->username); in create_bsd_job()
95 job->np_host = strdup(id); in create_bsd_job()
99 job->np_username = strdup(id); in create_bsd_job()
100 job->np_host = strdup(injob->username); in create_bsd_job()
105 job->np_username = strdup(injob->username); in create_bsd_job()
106 job->np_host = strdup("localhost"); in create_bsd_job()
109 job->np_printer = injob->printer; in create_bsd_job()
110 job->np_filename = injob->filename; in create_bsd_job()
112 job->np_df_letter = 'A'; in create_bsd_job()
115 if ((job->np_cfAfilename = create_cfname(job)) == NULL) { in create_bsd_job()
122 job->np_timeout = injob->timeout; in create_bsd_job()
123 job->np_banner = injob->banner; in create_bsd_job()
124 job->np_print_order = pr_order; in create_bsd_job()
127 job->np_title = injob->filename; in create_bsd_job()
129 job->np_title = injob->title; in create_bsd_job()
131 if ((create_cfA_file(job)) == -1) { in create_bsd_job()
140 (void) job_primitive(job, 'C', job->np_host); in create_bsd_job()
141 (void) job_primitive(job, 'J', job->np_title); in create_bsd_job()
142 (void) job_primitive(job, 'L', job->np_username); in create_bsd_job()
153 jobdata->np_path_file = malloc(strlen(job->np_filename) + 1); in create_bsd_job()
155 (void) strcpy(jobdata->np_path_file, job->np_filename); in create_bsd_job()
159 if ((jobdata->np_dfAfilename = create_dfname(job)) == NULL) { in create_bsd_job()
170 (void) job_primitive(job, data_file_type, in create_bsd_job()
172 (void) job_primitive(job, 'U', jobdata->np_dfAfilename); in create_bsd_job()
173 (void) job_primitive(job, 'N', "print-data"); in create_bsd_job()
176 syslog(LOG_DEBUG, "data file info: %s", job->np_cfAfile); in create_bsd_job()
181 job->np_data = jobdata; in create_bsd_job()
183 return (job); in create_bsd_job()
192 create_dfname(np_bsdjob_t *job) in create_dfname() argument
196 if (job == NULL) in create_dfname()
200 if (job->np_df_letter > 'z') { in create_dfname()
205 dfname = (char *)malloc(strlen(job->np_host) + 3 + 3 + 1); in create_dfname()
207 (void) memset(dfname, 0, strlen(job->np_host) + 3 + 3 + 1); in create_dfname()
208 (void) sprintf(dfname, "%s%c%s%s", "df", job->np_df_letter, in create_dfname()
209 job->np_request_id, job->np_host); in create_dfname()
212 job->np_df_letter += 1; in create_dfname()
213 if ((job->np_df_letter > 'Z') && (job->np_df_letter < 'a')) in create_dfname()
214 job->np_df_letter = 'a'; in create_dfname()
220 create_cfname(np_bsdjob_t *job) in create_cfname() argument
224 if (job == NULL) in create_cfname()
227 cfname = (char *)malloc(strlen(job->np_host) + 3 + 3 + 1); in create_cfname()
229 (void) memset(cfname, 0, strlen(job->np_host) + 3 + 3 + 1); in create_cfname()
231 job->np_request_id, job->np_host); in create_cfname()
236 create_cfA_file(np_bsdjob_t *job) in create_cfA_file() argument
242 if ((job->np_host == NULL) || (job->np_username == NULL)) { in create_cfA_file()
247 (void) job_primitive(job, 'H', job->np_host); in create_cfA_file()
248 (void) job_primitive(job, 'P', job->np_username); in create_cfA_file()
254 job_primitive(np_bsdjob_t *job, char option, char *value) in job_primitive() argument
258 if ((job == NULL) || (value == NULL)) in job_primitive()
261 job->np_cfAfilesize += strlen(value) + 2; /* (opt)(value)\n */ in job_primitive()
262 if (job->np_cfAfile == NULL) { in job_primitive()
264 job->np_cfAfile = calloc(1, job->np_cfAfilesize + 1); in job_primitive()
265 ASSERT(job->np_cfAfile, MALLOC_ERR); in job_primitive()
267 job->np_cfAfile = realloc(job->np_cfAfile, in job_primitive()
268 job->np_cfAfilesize + 1); in job_primitive()
269 ASSERT(job->np_cfAfile, REALLOC_ERR); in job_primitive()
272 (void) strcat(job->np_cfAfile, buf); in job_primitive()
273 syslog(LOG_DEBUG, "adding: %d %s", job->np_cfAfilesize, buf); in job_primitive()