Menu

#4 Can't do wildcard hosts... (FIX)

open
nobody
None
5
2002-05-22
2002-05-22
Anonymous
No

I noticed that the AddHost option did not allow for using
wildcard hosts... I have updated the IsTextDashorDot
function to fix this... Here is the new function:

Private Function IsTextOrDashOrDot(StrPar) As
Boolean
On Error Resume Next
Dim i, vCh
If StrPar <> "" Then
IsTextOrDashOrDot = True
For i = 1 To Len(StrPar)
vCh = Asc(Mid(StrPar, i, 1))
Select Case vCh
Case 48 To 57, 65 To 90, 97 To 122, 45,
46 '48 - 57 is 0..9, 65 - 90 is A..Z, 97 - 122 is a..z and
45 is -

Case 42 ' if *, can only be len = 1 [This allows for
the addition of wildcard hosts]
If Not Len(StrPar) = 1 Then
IsTextOrDashOrDot = False
Exit For
End If
Case Else
IsTextOrDashOrDot = False
Exit For
End Select
Next i
If Mid(StrPar, 1, 1) = "-" Or Mid(StrPar, i - 1, 1) = "-"
Then IsTextOrDashOrDot = False
Else
IsTextOrDashOrDot = False
End If
End Function

Not that I check for case 42 and if so, and the len is only
one, then this is a valid host name as well.

Thanks,

Hal

Discussion


Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.