bsd_misc.c revision 7c478bd95313f5f23a4c958a745db2134aa03244
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (the "License"). You may not use this file except in compliance
* with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright (c) 1996 by Sun Microsystems, Inc.
* All rights reserved.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
#include <stdio.h>
#include <stdlib.h>
#include <libintl.h>
#include <signal.h>
#include <errno.h>
#include <string.h>
#include <syslog.h>
#include "netpr.h"
#include "netdebug.h"
static int job_primitive(np_bsdjob_t *, char, char *);
static int create_cfA_file(np_bsdjob_t *);
static char * create_cfname(np_bsdjob_t *);
static char * create_dfname(np_bsdjob_t *);
extern char data_file_type;
{
char *id;
int x;
return (NULL);
}
/*
* request-id comes in as printer-number
* pull apart to create number
*/
gettext("Netpr: request_id in unknown format:<%s>\n"),
injob->request_id);
injob->request_id);
return (NULL);
}
id++;
/*
* 4261563 - A ID collides with an existing one, it plus
* 1,000 with the ID causes breaking
* Max job id for bsd is 999.
*/
errno = 0;
if ((errno != 0) || (x < 0)) {
x = 0;
}
"%.3d", x % 1000);
*id++ = '\0';
*--id = '@';
*id++ = '\0';
*--id = '!';
} else {
gettext("Netpr: username in unknown format:<%s>\n"),
return (NULL);
}
/* build cfAfilename: (cfA)(np_request_id)(np_host) */
gettext("Netpr: System error creating cfAfilename\n"));
return (NULL);
}
else
gettext("Netpr: Cannot create bsd control file\n"));
return (NULL);
}
/* Now we have a title, add to the control file */
}
/* create dfname for this file */
/* allocate the jobdata and initialize what we have so far */
return (NULL);
}
/*
* data_file_type should contain the RFC-1179 control file message
* type for the control file. The is is set via the "-f" option
* to netpr, which get it from the "destination-full-control-file-type"
* option passed in. Normally this will be either 'l' or 'f'.
*/
if (data_file_type != 0) {
}
/*
* attach np_data to bsdjob
*/
return (job);
}
/*
* Create df<x>name for this file
* df<X><nnn><hostname>
*/
static char *
{
char * dfname;
return (NULL);
/* Trying to print too many files */
return (NULL);
}
/* udate np_df_letter for the next caller */
return (dfname);
}
static char *
{
char * cfname;
return (NULL);
return (cfname);
}
static int
{
/*
* Read through job structure, creating entries
* in control file as appropriate
*/
"Netpr: Missing required data, cannot build control file\n"));
return (-1);
}
return (0);
}
static int
{
return (-1);
/* Always allocate one greater than cfAfilesize for the \0 */
} else {
}
return (0);
}