Your tool works great! and Joliet fs is no problem either. Thanks Fred
:)

--
Dawid Michalczyk


fred smith wrote:
> 
> On Sat, Dec 04, 1999 at 12:19:04AM +0100, Dawid Michalczyk wrote:
> >
> > I'm writing a script, in which I need to get the name
> > of the cdrom media. This is easy in Windows as the
> > name of the cd is always listed in the "My computer"
> > window. In Linux, there is only the mount point dir which
> > is always the same, but each cd has its own
> > name. How do I solve this?
> 
> If you mean the "volume label", I'll append below a short C program
> (a real ugly hack, but it works) which will do the job.
> 
> It just gropes the CD drive, looking in a known place. If the format
> ever changes you're hosed. I have no idea if it works on Joliet file
> systems or not.
> 
> I call it "getvn.c" and compile it like this:
> 
>         cc getvn.c -o getvn
> 
> and invoke it as:
> 
>         getvn /dev/hdd
> 
> or wherver your CD drive is attached, if not /dev/hdd.
> 
> Fred
> 
> ------------------------------
> #include <stdio.h>
> #include <fcntl.h>
> #include <unistd.h>
> 
> int main (int argc, char ** argv)
>         {
>         int fd;
>         char buf[12];
> 
>         if (argc != 2)
>                 {
>                 printf ("Usage: %s <cdrom devicename>\n", argv[0]);
>                 exit (0);
>                 }
> 
>         fd = open (argv[1], O_RDONLY);
>         if (fd < 0)
>                 {
>                 printf ("oops! Error opening device %s\n", argv[1]);
>                 exit (1);
>                 }
>         if (lseek (fd, (long) 0x8028, SEEK_SET) != (long) 0x8028)
>                 {
>                 printf ("oops! Error seeking device %s\n", argv[1]);
>                 exit (1);
>                 }
>         if (read (fd, buf, 11) != 11)
>                 {
>                 printf ("oops! Error reading device %s\n", argv[1]);
>                 exit (1);
>                 }
>         close (fd);
>         printf ("Volume name in device %s: %s\n", argv[1], buf);
>         return (0);
>         }
> --
> ---- Fred Smith -- [EMAIL PROTECTED] ----------------------------
>                        I can do all things through Christ
>                               who strengthens me.
> ------------------------------ Philippians 4:13 -------------------------------
> 
> --
> To unsubscribe: mail [EMAIL PROTECTED] with "unsubscribe"
> as the Subject.


-- 
To unsubscribe: mail [EMAIL PROTECTED] with "unsubscribe"
as the Subject.

Reply via email to