_open.c revision d4188195113bc7f546b026033c66ea3e12de0e02
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (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 2006 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
#include <stdio.h>
#include <fcntl.h>
#include <string.h>
#include <mntent.h>
#include <sys/sysmacros.h>
#include <dirent.h>
#include "s5sysmacros.h"
#include "compat.h"
#define PRINTER_DIR "/etc/lp/printers/"
#define PRINTER_CONFIG_FILE "/configuration"
#define MNT_LINE_MAX 1024
return (-1); \
char *mktemp();
static void getPrinterInfo(char *, FILE *);
static char sepstr[] = " \t\n";
static char dash[] = "-";
static int open_printcap(void);
#define N_O_NDELAY 0x04
#define N_O_SYNC 0x10
#define N_O_NONBLOCK 0x80
#define N_O_CREAT 0x100
#define N_O_TRUNC 0x200
#define N_O_EXCL 0x400
/* Mask corresponding to the bits above in SunOS 4.x */
int
{
if (flags & FLAGS_MASK) {
nflags |= N_O_NONBLOCK;
}
nflags |= N_O_NDELAY;
}
}
return (fd);
return (open_printcap());
}
if (fd >= 0)
return (fd);
}
if (fd >= 0)
return (fd);
}
}
int
{
char tmp_name[64];
char line[MNT_LINE_MAX];
int fd;
return (-1);
return (-1);
}
return (-1);
}
} else { /* processing vfstab */
return (-1);
}
}
}
return (-1);
return (fd);
} else {
return (-1);
}
}
int
{
int ret;
char *cp;
return (-1);
;
return (0);
}
return (-1);
}
int
{
char *buf;
char *devnumstr = 0; /* the device number, in (hex) ascii */
char *remainder; /* remainder of mnt_opts string, after devnum */
unsigned long devnum;
mnt.mnt_passno = 0;
return (-1);
}
/*
* the device number, if present, follows the '='
* in the mnt_opts string.
*/
if (!devnumstr) {
/* no device number on this line */
} else {
/* found the device number, convert it to 4.x format */
}
return (0);
}
int
{
char *buf;
mnt.mnt_passno = 0;
return (-1);
}
return (0);
}
FILE *
{
return (NULL);
switch (mode[0]) {
case 'w':
break;
case 'a':
break;
case 'r':
break;
default:
return (NULL);
}
return (NULL);
if (mode[0] == 'a') {
return (NULL);
}
}
return (iop);
}
static int
open_printcap(void)
{
char tmp_name[] = "/tmp/printcap.XXXXXX";
int tmp_file;
return (-1);
}
return (-1);
return (tmp_file);
}
static void
{
char *fullPath;
char *str;
char *p;
char *c;
int config_fd;
return;
}
return;
}
return;
}
p[0] = '\n';
p[1] = '\0';
/* remote printer */
c = (char *)strchr(p, '\n');
*c = '\0';
/* local printer */
c = (char *)strchr(p, '\n');
*c = '\0';
}
}