OK - Perl code:

#!/usr/bin/perl
use strict;
use warnings;

        if (scalar (@ARGV) < 3) {
                print "use: $0  init_delay  delay_incr  num_retries\n";
                exit 1;
                }

        my ($t, $i, $n) = @ARGV;
        my $tot = 0;

        for (my $c = 1; $c <= $n; $c++) {
                printf ("%02d\tsend-time = %-6d\tnext-try = %d\n", $c, $tot, $t);
                $tot += $t;
                $t += int ($t / $i);
                }

        exit 0;

Tested OK; Does not check for numeric arguments - can do if you
want.

Aloha => Beau.

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:xmail-bounce@;xmailserver.org]On Behalf Of Davide Libenzi
Sent: Sunday, November 10, 2002 11:41 AM
To: '[EMAIL PROTECTED]'
Subject: [xmail] Re: how often does xmailserver resend when recievingMTA
isdown?



On Sun, 10 Nov 2002, Bill Healy wrote:

>
> Davide,
>
> I think you posted a table of retry values in the paste, can't that be
> put into the docs and the link fixed to go to it?

Can someone convert this *very complex* C source to Perl :

------------------------------------------------------------

#include <stdio.h>
#include <stdlib.h>

int main(int argc, char * argv[]) {

        unsigned t, i, n, tot, c;

        if (argc < 4) {
                printf("use: %s  init_delay  delay_incr  num_retries\n", argv[0]);
                return 1;
        }

        t = atoi(argv[1]);
        i = atoi(argv[2]);
        n = atoi(argv[3]);
        tot = 0;

        for (c = 1; c <= n; c++) {
                printf("%02u\tsend-time = %-6u\tnext-try = %u\n", c, tot, t);

                tot += t;
                t += t / i;
        }
        return 0;
}

------------------------------------------------------------



- Davide


-
To unsubscribe from this list: send the line "unsubscribe xmail" in
the body of a message to [EMAIL PROTECTED]
For general help: send the line "help" in the body of a message to
[EMAIL PROTECTED]



-
To unsubscribe from this list: send the line "unsubscribe xmail" in
the body of a message to [EMAIL PROTECTED]
For general help: send the line "help" in the body of a message to
[EMAIL PROTECTED]

Reply via email to