TIP: Click on subject to list as thread! ANSI
echo: c_echo
to: Jasen Betts
from: Auke Reitsma
date: 1998-08-15 00:14:00
subject: Urisplit

Hi Jasen,

On 12 Aug 98, 18:01, you wrote to AUKE REITSMA

 AR>> The module is not really complete (etc) because I do not have
 AR>> good standards and other reference material. It is nearly
 AR>> untested, but     seems to work. Nor is it optimized other
 AR>> than minimizing the time I    spent on it ;-)

 JB> Telnet URLs can have a port number, your code doesn't seem to
 JB> deal with this. Unfortunately I can't recall the correct syntax

You are completely right! Thanks for spotting this! It also caused me to
spot a few other problems ;-) Just look for TRICKY in the original ...

/// Comment change in the UriProtocol[] array: middle line changed

    { "mailto", MAILTOhandler },     /*    m                            */
    { "telnet", TELNEThandler },     /*    t                            */
    { "gopher", GOPHERhandler },     /* //    g                         */

/// that erroneous comment caused an error elsewhere. Fixed by change
/// in the following third line and addition of the fourth

        if( ! ( 'm' == *Uri->protocol ||   /* Warning: TRICKY !!!       */
                'n' == *Uri->protocol ||   /* m = mailto and mid, n =   */
                'c' == *Uri->protocol ||   /* news and nntp, c = cid    */
                't' == *Uri->protocol ))   /* t=telnet                  */

/// and the complete (modified but not optimized) TELNEThandler:

static int TELNEThandler( struct Uri_t * Uri, char * Info )
{
    char * Next;
    char * Next2;

    Next = strchr( Info, '{at}' );
    if( NULL == Next )
    {
        /* No user:password parts */
        Next = strchr( Info, ':' );
        if( NULL != Next )
        {
            Uri->port = STRDUP( Next+1 ); /* NULL check */
           *Next = '\0';
        }
        Uri->host = STRDUP( Info ); /* NULL check */
        return NO_PROBLEMS;
    }
    Next2 = strchr( Next+1, ':' );
    if( NULL != Next2 )
    {
        Uri->port = STRDUP( Next2+1 ); /* NULL check */
        *Next2 = '\0';
    }
    Uri->host = STRDUP( Next+1 ); /* NULL check */
    *Next = '\0';

    Next = strchr( Info, ':' );
    if( NULL != Next )
    {
        Uri->password = STRDUP( Next+1 ); /* NULL check */
        *Next = '\0';
    }
    Uri->user = STRDUP( Info ); /* NULL check */

    return NO_PROBLEMS;
}

/// that's it. Complete source available on request ;-)

Greetings from
 _____
 /_|__|  Auke Reitsma, Delft, The Netherlands.
/  | \  --------------------------------------

--- GEcho 1.00
* Origin: Home by the C (Auke.Reitsma{at}net.hcc.nl) (2:281/400.20)
SEEN-BY: 396/1 622/419 632/371 633/260 267 270 371 634/397 635/506 728 810
SEEN-BY: 639/252 670/213 218
@PATH: 281/400 1 280/801 270/101 396/1 633/260 635/506 728 633/267

SOURCE: echomail via fidonet.ozzmosis.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.