[vorbis-dev] Trying to get cmdline going...

Eric Brombaugh emeb at goodnet.com
Sun Apr 16 13:35:47 PDT 2000



Hello all,

Another johnny-come-lately courtesy of the Slashdot effect...  I have
taken a moment to browse the archives, so I'm not asking "Why doesn't
the cmdline utility compile?" yet again.  I have been doing some
fiddling with it and found a few thinkos to fix, but some of the more
esoteric getopt() things are stumping me.

Ferinstance, it seems that
<  device=strdup(optarg);
ought to be
>  device=optarg;

and
<       if((ret=CheckWav(infile,bufferfill,&intype))){
probably should be
>       if((ret=CheckWav(inbuffer,bufferfill,&intype))){

and I've faked up a fill_buffer routine:
> int fill_buffer(FILE *infile, char *inbuffer, int bufferfill, int
insize)
> {
>   return fread(inbuffer, sizeof(char), insize, infile);
> }

but, the logic for getting the filenames seems broke:
    if(optind>=argc)
      if(strcmp(argv[optind],"-")){
 infile=fopen(argv[optind],"rb");
 if(infile==NULL)
   reporterror("Unable to open input file %s: %s\n",argv[optind],
        strerror(errno));
      }

if optind >=argc aren't you searching past the end of the arg array?
strcmp() is segv'ing here.

That's all...

Eric

P.S.  I've been a big fan of cdparanoia for several years now.  Awesome
stuff.

--- >8 ----
List archives:  http://www.xiph.org/archives/
Ogg project homepage: http://www.xiph.org/ogg/



More information about the Vorbis-dev mailing list