Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 1 Jun 2002 13:12:00 -0700 (PDT)
From:      Mikko Tyolajarvi <mikko@dynas.se>
To:        abc@anchorageinternet.org
Cc:        questions@freebsd.org
Subject:   Re: burncd parsing
Message-ID:  <200206012012.g51KC0TB086206@mikko.na.rsa.net>
References:  <200206011323.g51DNsD42542@groggy.anc.acsalaska.net>

next in thread | previous in thread | raw e-mail | index | archive | help
In local.freebsd.questions you write:

>FBSD 4.5

>question: why does this work ...

>      burncd      -f /dev/cdrom -s 4 data /tmp/cd9660.iso

>and this crash?

>x=""; burncd "$x" -f /dev/cdrom -s 4 data /tmp/cd9660.iso
>burncd: no data format selected: Undefined error: 0

>i can't tell if it's sh parsing problem, or a burncd problem.
>(i wanted to use "$x" to hold the possible "dummy write" option)

Remove the quotes around $x, and it will work as you expect.  Without
quotes, the shell will expand it to nothing.  With the quotes it
expands to a zero-length argument, which is not what you want.

>i am guessing the sh is passing a null argument to burncd
>(i am not sure if sh should do that ...), and burncd is
>crashing on it cuz it doesn't use getopt()
>and isn't parsing well?

burncd does use getopt(), and the result is as expected.  The first
argument is a string that does not begin with a "-", so getopt()
parsing stops.  Everything else should be commands and file names, As
"" is not a known command, it has to be a file name, but there has
been no previous command to select data type (data, audio etc).  Hence
the error message.

You'll get similar results from almost any other program, e.g.:

  atlas% x=""; ls "$x" -l
  ls: No such file or directory

True: I don't have a file with a zero-length name in that directory.

>i notice burncd is very specific about
>the order of it's options.

Indeed.  But it works exactly as documented.  I always triple-check,
to make sure I haven't mis-spelled "fixate" or something... :)

  $.02,
  /Mikko
-- 
 Mikko Työläjärvi_______________________________________mikko@rsasecurity.com
 RSA Security

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200206012012.g51KC0TB086206>