Antonis Kanavouras wrote:

>   for (v=argc-1; ( ((argv[v][0])!='-') && (v>0) ) ; v--) { /*CLOSES BEFORE MAIN*/

The check if v is valid is after it is used.. 

v initialized to 1-1==0
then you jump into this loop
when loop-block finished v-- is executed. v is now -1
then the argv expression above is evaluated, which should cause a
segfault.

>   if(filecount==0) {
>      goto nofiles ;
>      file=stdin ;
>      }

Next problem: assignment done after the goto. You get by this since you
always assign file=stdin at program startup.

You compiler should have warned you here. Did you remember to use -Wall
when compiling your program?

---
Henrik Nordstr�m

Reply via email to