mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-01-09 17:38:00 +00:00
1b851758bd
My experimental build with clang-cl at -Wall did show up a few things that are safe enough to fix right now. One was this list of missing includes, which was causing a lot of -Wmissing-prototype warnings, and is a real risk because it means the declarations in headers weren't being type-checked against the actual function definitions. Happily, no actual mismatches.
22 lines
455 B
C
22 lines
455 B
C
/*
|
|
* Try to make sense of a string as an IPv4 address, for
|
|
* XDM-AUTHORIZATION-1 purposes.
|
|
*/
|
|
|
|
#include <stdio.h>
|
|
|
|
#include "putty.h"
|
|
#include "ssh.h"
|
|
|
|
bool x11_parse_ip(const char *addr_string, unsigned long *ip)
|
|
{
|
|
int i[4];
|
|
if (addr_string &&
|
|
4 == sscanf(addr_string, "%d.%d.%d.%d", i+0, i+1, i+2, i+3)) {
|
|
*ip = (i[0] << 24) | (i[1] << 16) | (i[2] << 8) | i[3];
|
|
return true;
|
|
} else {
|
|
return false;
|
|
}
|
|
}
|