MCPcopy Create free account
hub / github.com/assaultcube/AC / atoipr

Function atoipr

source/src/tools.cpp:496–515  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

494}
495
496const char *atoipr(const char *s, iprange *ir)
497{
498 if((s = atoip(s, &ir->lr)) == NULL) return NULL;
499 ir->ur = ir->lr;
500 s += strspn(s, " \t");
501 if(*s == '-')
502 {
503 if(!(s = atoip(s + 1, &ir->ur)) || ir->lr > ir->ur) return NULL;
504 }
505 else if(*s == '/')
506 {
507 int m, n;
508 if(sscanf(s + 1, "%d%n", &m, &n) != 1 || m < 0 || m > 32) return NULL;
509 unsigned long bm = (1 << (32 - m)) - 1;
510 ir->lr &= ~bm;
511 ir->ur |= bm;
512 s += 1 + n;
513 }
514 return s;
515}
516
517const char *iptoa(const enet_uint32 ip, char *b)
518{

Callers 3

readMethod · 0.85
readMethod · 0.85
readFunction · 0.85

Calls 1

atoipFunction · 0.85

Tested by

no test coverage detected