110 struct recvline_state recvline_ctx; |
110 struct recvline_state recvline_ctx; |
111 struct error_info err; |
111 struct error_info err; |
112 |
112 |
113 // initialize |
113 // initialize |
114 if (sock_init(&err)) |
114 if (sock_init(&err)) |
115 errx(1, "sock_init: %s", error_name(ERROR_CODE(&err))); |
115 errx(1, "sock_init: %s", error_msg(&err)); |
116 |
116 |
117 memset(&recvline_ctx, 0, sizeof(recvline_ctx)); |
117 memset(&recvline_ctx, 0, sizeof(recvline_ctx)); |
118 |
118 |
119 // over-simplified connect |
119 // over-simplified connect |
120 if (sock_gnutls_connect(&sock, CONNECT_HOST, CONNECT_SERV, &err)) |
120 if (sock_gnutls_connect(&sock, CONNECT_HOST, CONNECT_SERV, &err)) |
121 errx(1, "sock_gnutls_connect: %s", error_name(ERROR_CODE(&err))); |
121 errx(1, "sock_gnutls_connect: %s", error_msg(&err)); |
122 |
122 |
123 // read lines and dump them out |
123 // read lines and dump them out |
124 do { |
124 do { |
125 // recv |
125 // recv |
126 recvline(sock, line_buf, sizeof(line_buf), &recvline_ctx); |
126 recvline(sock, line_buf, sizeof(line_buf), &recvline_ctx); |