diff options
Diffstat (limited to 'nsprpub/pr/tests/ipv6.c')
-rw-r--r-- | nsprpub/pr/tests/ipv6.c | 48 |
1 files changed, 30 insertions, 18 deletions
diff --git a/nsprpub/pr/tests/ipv6.c b/nsprpub/pr/tests/ipv6.c index af27d03cd..cc323e1e6 100644 --- a/nsprpub/pr/tests/ipv6.c +++ b/nsprpub/pr/tests/ipv6.c @@ -55,13 +55,17 @@ static PRStatus PrintAddress(const PRNetAddr* address) PRNetAddr translation; char buffer[ADDR_BUFFER]; PRStatus rv = PR_NetAddrToString(address, buffer, sizeof(buffer)); - if (PR_FAILURE == rv) PL_FPrintError(err, "PR_NetAddrToString"); + if (PR_FAILURE == rv) { + PL_FPrintError(err, "PR_NetAddrToString"); + } else { PR_fprintf(err, "\t%s\n", buffer); memset(&translation, 0, sizeof(translation)); rv = PR_StringToNetAddr(buffer, &translation); - if (PR_FAILURE == rv) PL_FPrintError(err, "PR_StringToNetAddr"); + if (PR_FAILURE == rv) { + PL_FPrintError(err, "PR_StringToNetAddr"); + } else { PRSize addr_len = NETADDR_SIZE(address); @@ -91,19 +95,21 @@ int main(int argc, char **argv) while (PL_OPT_EOL != (os = PL_GetNextOpt(opt))) { - if (PL_OPT_BAD == os) continue; + if (PL_OPT_BAD == os) { + continue; + } switch (opt->option) { - case 0: /* Name of host to lookup */ - name = opt->value; - break; - case 'V': /* Do version discovery */ - version = PR_TRUE; - break; - case 'h': /* user wants some guidance */ - default: - Help(); /* so give him an earful */ - return 2; /* but not a lot else */ + case 0: /* Name of host to lookup */ + name = opt->value; + break; + case 'V': /* Do version discovery */ + version = PR_TRUE; + break; + case 'h': /* user wants some guidance */ + default: + Help(); /* so give him an earful */ + return 2; /* but not a lot else */ } } PL_DestroyOptState(opt); @@ -119,14 +125,16 @@ int main(int argc, char **argv) char *nspr_path = PR_GetEnv("LD_LIBRARY_PATH"); char *nspr_name = PR_GetLibraryName(nspr_path, NSPR_LIB); PRLibrary *runtime = PR_LoadLibrary(nspr_name); - if (NULL == runtime) + if (NULL == runtime) { PL_FPrintError(err, "PR_LoadLibrary"); + } else { versionEntryPointType versionPoint = (versionEntryPointType) - PR_FindSymbol(runtime, "libVersionPoint"); - if (NULL == versionPoint) + PR_FindSymbol(runtime, "libVersionPoint"); + if (NULL == versionPoint) { PL_FPrintError(err, "PR_FindSymbol"); + } else { char buffer[100]; @@ -155,7 +163,9 @@ int main(int argc, char **argv) (void)PR_fprintf(err, " comment: %s\n", version_info->comment); } } - if (NULL != nspr_name) PR_FreeLibraryName(nspr_name); + if (NULL != nspr_name) { + PR_FreeLibraryName(nspr_name); + } } { @@ -192,7 +202,9 @@ int main(int argc, char **argv) do { index = PR_EnumerateHostEnt(index, &host, 0, &address); - if (index > 0) PrintAddress(&address); + if (index > 0) { + PrintAddress(&address); + } else if (-1 == index) { failed = PR_TRUE; |