Lines Matching defs:job

49 	np_bsdjob_t *job;
59 job = (np_bsdjob_t *)malloc(sizeof (np_bsdjob_t));
60 ASSERT(job, MALLOC_ERR);
61 (void) memset(job, 0, sizeof (np_bsdjob_t));
62 job->np_printer = "auto"; /* default "queue" */
81 * Max job id for bsd is 999.
83 job->np_request_id = malloc(4);
84 ASSERT(job->np_request_id, MALLOC_ERR);
90 (void) snprintf(job->np_request_id, (size_t)4,
96 job->np_username = strdup(injob->username);
97 job->np_host = strdup(id);
101 job->np_username = strdup(id);
102 job->np_host = strdup(injob->username);
107 job->np_username = strdup(injob->username);
108 job->np_host = strdup("localhost");
111 job->np_printer = injob->printer;
112 job->np_filename = injob->filename;
114 job->np_df_letter = 'A';
117 if ((job->np_cfAfilename = create_cfname(job)) == NULL) {
124 job->np_timeout = injob->timeout;
125 job->np_banner = injob->banner;
126 job->np_print_order = pr_order;
129 job->np_title = injob->filename;
131 job->np_title = injob->title;
133 if ((create_cfA_file(job)) == -1) {
142 (void) job_primitive(job, 'C', job->np_host);
143 (void) job_primitive(job, 'J', job->np_title);
144 (void) job_primitive(job, 'L', job->np_username);
155 jobdata->np_path_file = malloc(strlen(job->np_filename) + 1);
157 (void) strcpy(jobdata->np_path_file, job->np_filename);
161 if ((jobdata->np_dfAfilename = create_dfname(job)) == NULL) {
172 (void) job_primitive(job, data_file_type,
174 (void) job_primitive(job, 'U', jobdata->np_dfAfilename);
175 (void) job_primitive(job, 'N', "print-data");
178 syslog(LOG_DEBUG, "data file info: %s", job->np_cfAfile);
183 job->np_data = jobdata;
185 return (job);
194 create_dfname(np_bsdjob_t *job)
198 if (job == NULL)
202 if (job->np_df_letter > 'z') {
207 dfname = (char *)malloc(strlen(job->np_host) + 3 + 3 + 1);
209 (void) memset(dfname, 0, strlen(job->np_host) + 3 + 3 + 1);
210 (void) sprintf(dfname, "%s%c%s%s", "df", job->np_df_letter,
211 job->np_request_id, job->np_host);
214 job->np_df_letter += 1;
215 if ((job->np_df_letter > 'Z') && (job->np_df_letter < 'a'))
216 job->np_df_letter = 'a';
222 create_cfname(np_bsdjob_t *job)
226 if (job == NULL)
229 cfname = (char *)malloc(strlen(job->np_host) + 3 + 3 + 1);
231 (void) memset(cfname, 0, strlen(job->np_host) + 3 + 3 + 1);
233 job->np_request_id, job->np_host);
238 create_cfA_file(np_bsdjob_t *job)
241 * Read through job structure, creating entries
244 if ((job->np_host == NULL) || (job->np_username == NULL)) {
249 (void) job_primitive(job, 'H', job->np_host);
250 (void) job_primitive(job, 'P', job->np_username);
256 job_primitive(np_bsdjob_t *job, char option, char *value)
260 if ((job == NULL) || (value == NULL))
263 job->np_cfAfilesize += strlen(value) + 2; /* (opt)(value)\n */
264 if (job->np_cfAfile == NULL) {
266 job->np_cfAfile = calloc(1, job->np_cfAfilesize + 1);
267 ASSERT(job->np_cfAfile, MALLOC_ERR);
269 job->np_cfAfile = realloc(job->np_cfAfile,
270 job->np_cfAfilesize + 1);
271 ASSERT(job->np_cfAfile, REALLOC_ERR);
274 (void) strcat(job->np_cfAfile, buf);
275 syslog(LOG_DEBUG, "adding: %d %s", job->np_cfAfilesize, buf);