/*
   Serge E. Pick (QuickPick), 19.08.1997
   Setblk set block size on CD-ROM device
   on Sparc Station/Server under Solaris 2.4/2.5
   Usage: setblk [<blksize>]
   Default: 512 bytes
*/
#include <stdio.h>
#include <sys/types.h>
#include <sys/uio.h>
#include <sys/stat.h>
#include <sys/cdio.h>
#include <fcntl.h>
#include <unistd.h>

main( int argc, char **argv )
{
  int scd,st,size;

  scd = open("/vol/dev/aliases/cdrom0",O_RDONLY);
  if( scd==-1 ) perror("Cannto open cdrom device");

  if( argc<2 ) size = 512;
  else sscanf(argv[1],"%d",&size);

  /* main part */
  st = ioctl(scd,CDROMSBLKMODE,size);
  if( st==-1 ) perror("Unable to change blk size");
  else printf("Blk size changed to %d\n",size);

  exit(0);
}
