Talk About Network



Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Awk > Question about ...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 7 Topic 2167 of 2241
Post > Topic >>

Question about a programme

by Spiros Bousbouras <spibou@[EMAIL PROTECTED] > Feb 18, 2008 at 04:57 AM

On page 194 of "Effective AWK programming" we see the
following programme:

# rewind.awk --- rewind the current file and start over
function rewind(    i)
{
    # shift remaining arguments up
    for (i = ARGC; i > ARGIND; i--)
        ARGV[i] = ARGV[i-1]
    # make sure gawk knows to keep going
    ARGC++
    # make current file next to get done
    ARGV[ARGIND+1] = FILENAME
    # do it
    nextfile
}

Isn't the statement ARGV[ARGIND+1] = FILENAME
superfluous ? In the loop when i gets the
value ARGIND + 1 then the assignment
ARGV[ARGIND + 1] = ARGV[ARGIND] will be executed
and ARGV[ARGIND] always has the same value as
FILENAME




 7 Posts in Topic:
Question about a programme
Spiros Bousbouras <spi  2008-02-18 04:57:46 
Re: Question about a programme
Ed Morton <morton@[EMA  2008-02-18 08:14:15 
Re: Question about a programme
Janis <janis_papanagno  2008-02-18 07:38:59 
Re: Question about a programme
Ed Morton <morton@[EMA  2008-02-18 19:23:58 
Re: Question about a programme
Spiros Bousbouras <spi  2008-02-19 11:46:57 
Re: Question about a programme
Ed Morton <morton@[EMA  2008-02-19 14:05:50 
Re: Question about a programme
Spiros Bousbouras <spi  2008-02-19 11:49:55 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Sat May 17 13:36:42 CDT 2008.