util.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 1994 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/* @(#)util.c 1.1 90/01/22 SMI */
/*
* 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 */
char *buf; /* buffer area */
int daddr; /* disk addr */
int size; /* no. of byte */
{
/*****
if ((daddr < 1) || (daddr > 10000000) ) {
printf("bad address %d\n", daddr);
}
*****/
}
}
}
/*readdisk - read from cdrom image file */
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 */
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 */
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 */
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 */
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 */
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 */
both_short(p, x)
char *p;
short x;
{
lsb_short(p, x);
p = p + sizeof(x);
msb_short(p, x);
}
{
}
{
struct tm *t;
}
/* reserve and (zero out space) from start secno to end secno */
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 lbn;
{
int left;
/* if lbn size is same as sector size, ok */
}
/* 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 */
}
/* cleanup - close file and exit */
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,
};
{
int i;
char c;
while ((i = *un++) != '\0') {
}
*in='\0';
}
char *dirp;
{
int i;
int length;
char c;
int offset;
/* skip dot and dotdot */
for (i=0;i<length;i++)
printf("\n");
}
char *dirp;
{
int i;
int length;
char c;
/* skip dot and dotdot */
for (i=0;i<length;i++)
printf("\n");
}
/*VARARGS*/
char *fmt;
{
}