Esempio n. 1
0
void
Cputisopvd(Cdimg *cd, Cdinfo info)
{
	char buf[130];

	Cputc(cd, 1);				/* primary volume descriptor */
	Cputs(cd, "CD001", 5);			/* standard identifier */
	Cputc(cd, 1);				/* volume descriptor version */
	Cputc(cd, 0);				/* unused */

	assert(~info.flags & (CDplan9|CDrockridge));

	/* system identifier */
	strcpy(buf, "");
	if(info.flags & CDplan9)
		strcat(buf, "plan 9 ");
	if(info.flags & CDrockridge)
		strcat(buf, "rrip ");
	if(info.flags & CDbootable)
		strcat(buf, "boot ");
	if(info.flags & CDconform)
		strcat(buf, "iso9660");
	else
		strcat(buf, "utf8");
	
	struprcpy(buf, buf);
	Cputs(cd, buf, 32);

	Cputs(cd, mkisostring(buf, 32, info.volumename), 32);			/* volume identifier */

	Crepeat(cd, 0, 8);				/* unused */
	Cputn(cd, 0, 4);				/* volume space size */
	Crepeat(cd, 0, 32);				/* unused */
	Cputn(cd, 1, 2);				/* volume set size */
	Cputn(cd, 1, 2);				/* volume sequence number */
	Cputn(cd, Blocksize, 2);			/* logical block size */
	Cputn(cd, 0, 4);				/* path table size */
	Cputnl(cd, 0, 4);				/* location of Lpath */
	Cputnl(cd, 0, 4);				/* location of optional Lpath */
	Cputnm(cd, 0, 4);				/* location of Mpath */
	Cputnm(cd, 0, 4);				/* location of optional Mpath */
	Cputisodir(cd, nil, DTroot, 1, Cwoffset(cd));			/* root directory */

	Cputs(cd, mkisostring(buf, 128, info.volumeset), 128);		/* volume set identifier */
	Cputs(cd, mkisostring(buf, 128, info.publisher), 128);			/* publisher identifier */
	Cputs(cd, mkisostring(buf, 128, info.preparer), 128);			/* data preparer identifier */
	Cputs(cd, mkisostring(buf, 128, info.application), 128);		/* application identifier */

	Cputs(cd, "", 37);			/* copyright notice */
	Cputs(cd, "", 37);			/* abstract */
	Cputs(cd, "", 37);			/* bibliographic file */
	Cputdate1(cd, now);				/* volume creation date */
	Cputdate1(cd, now);				/* volume modification date */
	Cputdate1(cd, 0);				/* volume expiration date */
	Cputdate1(cd, 0);				/* volume effective date */
	Cputc(cd, 1);				/* file structure version */
	Cpadblock(cd);
}
Esempio n. 2
0
void
Cputbootvol(Cdimg *cd)
{
	Cputc(cd, 0x00);
	Cputs(cd, "CD001", 5);
	Cputc(cd, 0x01);
	Cputs(cd, "EL TORITO SPECIFICATION", 2+1+6+1+13);
	Crepeat(cd, 0, 2+16+16+7);
	cd->bootcatptr = Cwoffset(cd);
	Cpadblock(cd);
}
Esempio n. 3
0
int Cvprintf (int attr, const char *format, va_list args)
{
  int  len;
  char buf[3000];

  vsnprintf (buf, sizeof(buf), format, args);
  len = Cputs (attr, buf);
  return (len);
}
Esempio n. 4
0
static int
CputsuspER(Cdimg *cd, int dowrite)
{
	assert(cd != nil);

	if(dowrite) {
		chat("writing SUSP ER record\n");
		Cputc(cd, 'E');           /* ER field marker */
		Cputc(cd, 'R');
		Cputc(cd, 26);            /* Length          */
		Cputc(cd, 1);             /* Version         */
		Cputc(cd, 10);            /* LEN_ID          */
		Cputc(cd, 4);             /* LEN_DESC        */
		Cputc(cd, 4);             /* LEN_SRC         */
		Cputc(cd, 1);             /* EXT_VER         */
		Cputs(cd, SUSPrrip, 10);  /* EXT_ID          */
		Cputs(cd, SUSPdesc, 4);   /* EXT_DESC        */
		Cputs(cd, SUSPsrc, 4);    /* EXT_SRC         */
	}
	return 8+10+4+4;
}
Esempio n. 5
0
int Cprintf (int attr, const char *format, ...)
{
  int     len;
  char    buf[3000];
  va_list args;

  va_start (args, format);
  vsnprintf (buf, sizeof(buf), format, args);
  len = Cputs (attr, buf);
  va_end (args);
  return (len);
}
Esempio n. 6
0
static int
Cputrripname(Cdimg *cd, char *nm, int flags, char *name, int dowrite)
{
	int l;

	l = strlen(name);
	if(dowrite) {
		Cputc(cd, nm[0]);                   /* NM field marker */
		Cputc(cd, nm[1]);
		Cputc(cd, l+5);        /* Length          */
		Cputc(cd, 1);                     /* Version         */
		Cputc(cd, flags);                 /* Flags           */
		Cputs(cd, name, l);    /* Alternate name  */
	}
	return 5+l;
}
Esempio n. 7
0
static int
CputrripSL(Cdimg *cd, int contin, int flags, char *name, int dowrite)
{
	int l;

	l = strlen(name);
	if(dowrite) {
		Cputc(cd, 'S');
		Cputc(cd, 'L');
		Cputc(cd, l+7);
		Cputc(cd, 1);
		Cputc(cd, contin ? 1 : 0);
		Cputc(cd, flags);
		Cputc(cd, l);
		Cputs(cd, name, l);
	}
	return 7+l;
}
Esempio n. 8
0
/*
 * Write a Joliet secondary volume descriptor.
 */
void
Cputjolietsvd(Cdimg *cd, Cdinfo info)
{
	Cputc(cd, 2);				/* secondary volume descriptor */
	Cputs(cd, "CD001", 5);			/* standard identifier */
	Cputc(cd, 1);				/* volume descriptor version */
	Cputc(cd, 0);				/* unused */

	Cputrscvt(cd, "Joliet Plan 9", 32);			/* system identifier */
	Cputrscvt(cd, info.volumename, 32);			/* volume identifier */

	Crepeat(cd, 0, 8);				/* unused */
	Cputn(cd, 0, 4);				/* volume space size */
	Cputc(cd, 0x25);				/* escape sequences: UCS-2 Level 2 */
	Cputc(cd, 0x2F);
	Cputc(cd, 0x43);

	Crepeat(cd, 0, 29);
	Cputn(cd, 1, 2);				/* volume set size */
	Cputn(cd, 1, 2);				/* volume sequence number */
	Cputn(cd, Blocksize, 2);			/* logical block size */
	Cputn(cd, 0, 4);				/* path table size */
	Cputnl(cd, 0, 4);				/* location of Lpath */
	Cputnl(cd, 0, 4);				/* location of optional Lpath */
	Cputnm(cd, 0, 4);				/* location of Mpath */
	Cputnm(cd, 0, 4);				/* location of optional Mpath */
	Cputjolietdir(cd, nil, DTroot, 1, Cwoffset(cd));			/* root directory */
	Cputrscvt(cd, info.volumeset, 128);		/* volume set identifier */
	Cputrscvt(cd, info.publisher, 128);			/* publisher identifier */
	Cputrscvt(cd, info.preparer, 128);			/* data preparer identifier */
	Cputrscvt(cd, info.application, 128);		/* application identifier */
	Cputrscvt(cd, "", 37);			/* copyright notice */
	Cputrscvt(cd, "", 37);			/* abstract */
	Cputrscvt(cd, "", 37);			/* bibliographic file */
	Cputdate1(cd, now);				/* volume creation date */
	Cputdate1(cd, now);				/* volume modification date */
	Cputdate1(cd, 0);				/* volume expiration date */
	Cputdate1(cd, 0);				/* volume effective date */
	Cputc(cd, 1);				/* file structure version */
	Cpadblock(cd);
}