util.c revision 0b4d59de366b9d82e3c2657bf2c9fb3c990829e0
/*
* 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 2005 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/*
* mkproto: create a CD-ROM image files
* usage: mkproto [-f] proto cdimage effdate expdate
* mkproto [-f] path cdimage effdate expdate
*/
#pragma ident "%Z%%M% %I% %E% SMI"
#include <fcntl.h>
#include <stdio.h>
#include "iso_spec.h"
#include "iso_impl.h"
extern char *myname;
/* putdisk - write to cdrom image file */
void
char *buf; /* buffer area */
int daddr; /* disk addr */
int size; /* no. of byte */
{
}
}
}
/* readdisk - read from cdrom image file */
void
char *buf; /* buffer area */
int daddr; /* disk addr */
int size; /* no. of byte */
{
}
}
}
/* copy an integer x to location p in lsb format */
/* location p may not be in integer boundary */
void
lsb_int(p, x)
char *p;
int x;
{
#if defined(_LITTLE_ENDIAN)
(void) memcpy(p, &x, sizeof (int));
#else
*p++ = THREE(&x);
*p++ = TWO(&x);
*p++ = ONE(&x);
*p = ZERO(&x);
#endif
}
/* copy an integer x to location p in msb format */
/* location p may not be in integer boundary */
void
msb_int(p, x)
char *p;
int x;
{
#if defined(_LITTLE_ENDIAN)
*p++ = THREE(&x);
*p++ = TWO(&x);
*p++ = ONE(&x);
*p = ZERO(&x);
#else
(void) memcpy(p, &x, sizeof (int));
#endif
}
/* copy an integer x to location p in lsb then msb format */
/* location p may not be in integer boundary */
void
both_int(p, x)
char *p;
int x;
{
lsb_int(p, x);
p = p + sizeof (x);
msb_int(p, x);
}
/* copy a short integer x to location p in lsb format */
/* location p may not be in short integer boundary */
void
lsb_short(p, x)
char *p;
short x;
{
#if defined(_LITTLE_ENDIAN)
(void) memcpy(p, &x, sizeof (short));
#else
*p++ = ONE(&x);
*p = ZERO(&x);
#endif
}
/* copy a short integer x to location p in msb format */
/* location p may not be in short integer boundary */
void
msb_short(p, x)
char *p;
short x;
{
#if defined(_LITTLE_ENDIAN)
*p++ = ONE(&x);
*p = ZERO(&x);
#else
(void) memcpy(p, &x, sizeof (short));
#endif
}
/* copy a short integer x to location p in lsb then msb format */
/* location p may not be in short integer boundary */
void
both_short(p, x)
char *p;
short x;
{
lsb_short(p, x);
p = p + sizeof (x);
msb_short(p, x);
}
void
{
}
void
{
struct tm *t;
}
/* reserve and (zero out space) from start secno to end secno */
void
int start_secno, end_secno;
{
int i;
for (i = start_secno; i < end_secno; i++)
}
/* fill logical block lbn, lbn+1... to sector boundary with zero */
int
int lbn;
{
int left;
/* if lbn size is same as sector size, ok */
if (nlbn_per_sec == 1)
return (lbn);
if (left == nlbn_per_sec)
return (lbn);
}
/*
* fillblkzero - fill to end of a logical block with zero length.
* may be longer than a block. return the next lbn available
*/
int
int lbn;
int length;
{
int tofill;
int nolbn;
char *buf;
int offset;
/* nothing to fill */
if (offset == 0)
}
/* cleanup - close file and exit */
void
cleanup()
{
}
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37,
0x38, 0x39, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
0x00, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47,
0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f,
0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57,
0x58, 0x59, 0x5a, 0x00, 0x00, 0x00, 0x00, 0x5f,
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
};
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x2e, 0x0,
0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37,
0x38, 0x39, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
0x00, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47,
0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f,
0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57,
0x58, 0x59, 0x5a, 0x00, 0x00, 0x00, 0x00, 0x5f,
0x0, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47,
0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f,
0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57,
0x58, 0x59, 0x5a, 0x0, 0x0, 0x0, 0x0, 0x0,
};
void
{
int i;
char c;
while ((i = *un++) != '\0') {
if (c = mtable[i])
*in++ = c;
}
*in = '\0';
}
void
char *dirp;
{
int i;
int length;
char c;
int offset;
/* skip dot and dotdot */
return;
for (i = 0; i < length; i++)
printf("\n");
}
void
char *dirp;
{
int i;
int length;
char c;
/* skip dot and dotdot */
return;
for (i = 0; i < length; i++)
printf("\n");
}
/*VARARGS*/
void
{
}