static int
dial(char *host, char *port) {
- static struct addrinfo hints;
- int fd;
+ struct addrinfo hints;
struct addrinfo *res, *r;
+ int fd;
memset(&hints, 0, sizeof hints);
hints.ai_family = AF_UNSPEC;
trim(char *s) {
char *e;
- e = s + strlen(s) - 1;
- while(e > s && isspace((unsigned char)*e))
- e--;
- *(e + 1) = '\0';
+ for (e = s + strlen(s); e > s && isspace((unsigned char)*(e - 1)); e--)
+ ;
+ *e = '\0';
}