home *** CD-ROM | disk | FTP | other *** search
- // CLIENTNAME.SCP Functions to process Client Name tokens
- // Copyright (c) 1999, Vector Networks Limited
- // All Rights Reserved
- //
- // Revision History:
- // 0.0 13-Jan-00 DB - Created to test $INCLUDE functions
-
- $INCLUDE "RINSTR.SCP"
-
- // Convert_Client_Params is used to convert a Control $CLIENTNAME$ token
- // format Client name and address ("NAME(ADDRESS_TRANSPORT) into the
- // format returned by Lookup ("NAME|ADDRESS<TRANSPORT>").
-
- Function Convert_Client_Params (ClientName) as String
- Dim Name, Address, Transport
- Dim LeftIndex, MidIndex, RightIndex
-
- // Look for the delimiters
-
- LeftIndex = InStr (ClientName, "(")
- MidIndex = InStr (ClientName, "_")
-
- // We can't use ")" as a parameter without provoking
- // a compiler error, so we use Chr (41) instead...
-
- RightIndex = RInStr (ClientName, Chr (41))
-
- // If all of the *Index variables are greater than 0, we might have
- // a valid ClientName to parse. Strictly speaking, we should also
- // check that they are in ascending order...
-
- If (MidIndex > LeftIndex) AND (RightIndex > MidIndex) then
- Name = Left (ClientName, LeftIndex - 1)
- Address = Mid (ClientName, LeftIndex + 1, MidIndex - LeftIndex + 1)
- Transport = Mid (ClientName, MidIndex + 1, RightIndex - MidIndex + 1)
-
- Print " Name: ", Name
- Print " Transport: ", Transport
- Print " Address: ", Address
-
- // The transport format needs a little tweaking
-
- If Transport = "TCP/IP" Then
- Transport = "TCP"
- Else
-
- // I suspect NetBIOS adapters need a bit of fiddling too...
-
- Endif
-
- Convert_Client_Params = Name + "|>" + Address + "<" + Transport + ">")
- Else
- Print "Parsing failed for: ", ClientName
- Print " LeftIndex: ", LeftIndex
- Print " MidIndex: ", MidIndex
- Print " RightIndex: ", RightIndex
- Convert_Client_Params = ClientName
- Endif
- End Function
-