Hex Artifact Content
Not logged in

Artifact a12aadd18c9568ced71edae8e064a847fd3fd264:

Ticket change [a12aadd18c] - Ticket [a09798ba9e] Bug in ipPrefix (Check-in [86cbb69af2])? status still Open with 2 other changes by rwilson 2009-12-29 18:16:42.
0000: 44 20 32 30 30 39 2d 31 32 2d 32 39 54 31 38 3a  D 2009-12-29T18:
0010: 31 36 3a 34 32 0a 4a 20 2b 63 6f 6d 6d 65 6e 74  16:42.J +comment
0020: 20 5c 6e 5c 6e 3c 68 72 3e 3c 69 3e 72 77 69 6c   \n\n<hr><i>rwil
0030: 73 6f 6e 5c 73 61 64 64 65 64 5c 73 6f 6e 5c 73  son\sadded\son\s
0040: 32 30 30 39 2d 31 32 2d 32 39 5c 73 31 38 3a 31  2009-12-29\s18:1
0050: 36 3a 34 32 3a 3c 2f 69 3e 3c 62 72 3e 5c 6e 69  6:42:</i><br>\ni
0060: 5c 73 74 68 69 6e 6b 5c 73 79 6f 75 5c 73 61 72  \sthink\syou\sar
0070: 65 5c 73 63 6f 72 72 65 63 74 2e 5c 73 5c 73 69  e\scorrect.\s\si
0080: 74 5c 73 73 68 6f 75 6c 64 5c 73 62 65 5c 73 69  t\sshould\sbe\si
0090: 2e 5c 73 5c 73 61 73 5c 73 69 73 2c 5c 73 74 68  .\s\sas\sis,\sth
00a0: 69 73 5c 73 63 6f 64 65 5c 73 77 69 6c 6c 5c 73  is\scode\swill\s
00b0: 61 6c 77 61 79 73 5c 73 72 65 74 75 72 6e 5c 73  always\sreturn\s
00c0: 74 68 65 5c 73 66 69 72 73 74 5c 73 74 77 6f 5c  the\sfirst\stwo\
00d0: 73 63 68 61 72 73 5c 73 6f 66 5c 73 74 68 65 5c  schars\sof\sthe\
00e0: 73 69 70 5c 73 61 64 64 72 65 73 73 2e 5c 72 5c  sip\saddress.\r\
00f0: 6e 5c 72 5c 6e 3c 70 72 65 3e 5c 72 5c 6e 73 74  n\r\n<pre>\r\nst
0100: 61 74 69 63 5c 73 63 68 61 72 5c 73 2a 69 70 50  atic\schar\s*ipP
0110: 72 65 66 69 78 28 63 6f 6e 73 74 5c 73 63 68 61  refix(const\scha
0120: 72 5c 73 2a 7a 49 50 29 7b 5c 72 5c 6e 5c 73 5c  r\s*zIP){\r\n\s\
0130: 73 69 6e 74 5c 73 69 2c 5c 73 6a 3b 5c 72 5c 6e  sint\si,\sj;\r\n
0140: 5c 73 5c 73 66 6f 72 28 69 3d 6a 3d 30 3b 5c 73  \s\sfor(i=j=0;\s
0150: 7a 49 50 5b 69 5d 3b 5c 73 69 2b 2b 29 7b 5c 72  zIP[i];\si++){\r
0160: 5c 6e 5c 73 5c 73 5c 73 5c 73 69 66 28 5c 73 7a  \n\s\s\s\sif(\sz
0170: 49 50 5b 69 5d 3d 3d 27 2e 27 5c 73 29 7b 5c 72  IP[i]=='.'\s){\r
0180: 5c 6e 5c 73 5c 73 5c 73 5c 73 5c 73 5c 73 6a 2b  \n\s\s\s\s\s\sj+
0190: 2b 3b 5c 72 5c 6e 5c 73 5c 73 5c 73 5c 73 5c 73  +;\r\n\s\s\s\s\s
01a0: 5c 73 69 66 28 5c 73 6a 3d 3d 32 5c 73 29 5c 73  \sif(\sj==2\s)\s
01b0: 62 72 65 61 6b 3b 5c 72 5c 6e 5c 73 5c 73 5c 73  break;\r\n\s\s\s
01c0: 5c 73 7d 5c 72 5c 6e 5c 73 5c 73 7d 5c 72 5c 6e  \s}\r\n\s\s}\r\n
01d0: 5c 73 5c 73 72 65 74 75 72 6e 5c 73 6d 70 72 69  \s\sreturn\smpri
01e0: 6e 74 66 28 22 25 2e 2a 73 22 2c 5c 73 6a 2c 5c  ntf("%.*s",\sj,\
01f0: 73 7a 49 50 29 3b 5c 72 5c 6e 7d 5c 72 5c 6e 3c  szIP);\r\n}\r\n<
0200: 2f 70 72 65 3e 0a 4a 20 72 65 73 6f 6c 75 74 69  /pre>.J resoluti
0210: 6f 6e 20 4f 70 65 6e 0a 4b 20 61 30 39 37 39 38  on Open.K a09798
0220: 62 61 39 65 32 38 35 64 66 36 36 35 34 33 66 36  ba9e285df66543f6
0230: 30 33 34 34 65 37 31 30 39 66 65 36 61 63 31 32  0344e7109fe6ac12
0240: 35 63 0a 55 20 72 77 69 6c 73 6f 6e 0a 5a 20 39  5c.U rwilson.Z 9
0250: 39 30 33 32 34 32 34 39 63 65 63 37 35 39 39 38  90324249cec75998
0260: 36 65 31 66 66 36 36 61 38 37 62 33 38 34 33 0a  6e1ff66a87b3843.