/* ************************************************************* RWhois Software Copyright (c) 1994 Scott Williamson and Mark Kosters Copyright (c) 1996-2000 Network Solutions, Inc. See the file LICENSE for conditions of use and distribution. **************************************************************** */ #include "rwhois.h" int rwhois_extract_error_number(char *str) { int err_num; char *p; char *ch; char tmp_ch; assert(STR_EXISTS(str)); /* advance past %error */ p = strchr(str, ' '); p++; /* advance past the error number */ ch = strchr(p, ' '); tmp_ch = *ch; *ch = '\0'; if (STR_EQ(p, "No")) { return -1; } err_num = atoi(p); *ch = tmp_ch; return -err_num; } char * rwhois_extract_error_msg(char *str) { char *ch; assert(STR_EXISTS(str)); /* advance past '%error ' */ ch = strchr(str, ' '); ch++; /* advance past error number */ ch = strchr(ch, ' '); while (isspace((int) *ch)) ch++; return ch ; }