| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: quip_client.c,v 1.14 2020/02/07 21:53:20 fox Exp $ */ | | 1 | /* $NetBSD: quip_client.c,v 1.15 2023/05/07 11:41:49 andvar Exp $ */ |
2 | /* $KAME: quip_client.c,v 1.9 2003/05/17 05:59:00 itojun Exp $ */ | | 2 | /* $KAME: quip_client.c,v 1.9 2003/05/17 05:59:00 itojun Exp $ */ |
3 | /* | | 3 | /* |
4 | * Copyright (C) 1999-2000 | | 4 | * Copyright (C) 1999-2000 |
5 | * Sony Computer Science Laboratories, Inc. All rights reserved. | | 5 | * Sony Computer Science Laboratories, Inc. All rights reserved. |
6 | * | | 6 | * |
7 | * Redistribution and use in source and binary forms, with or without | | 7 | * Redistribution and use in source and binary forms, with or without |
8 | * modification, are permitted provided that the following conditions | | 8 | * modification, are permitted provided that the following conditions |
9 | * are met: | | 9 | * are met: |
10 | * 1. Redistributions of source code must retain the above copyright | | 10 | * 1. Redistributions of source code must retain the above copyright |
11 | * notice, this list of conditions and the following disclaimer. | | 11 | * notice, this list of conditions and the following disclaimer. |
12 | * 2. Redistributions in binary form must reproduce the above copyright | | 12 | * 2. Redistributions in binary form must reproduce the above copyright |
13 | * notice, this list of conditions and the following disclaimer in the | | 13 | * notice, this list of conditions and the following disclaimer in the |
14 | * documentation and/or other materials provided with the distribution. | | 14 | * documentation and/or other materials provided with the distribution. |
| @@ -300,27 +300,27 @@ quip_rawmode(void) | | | @@ -300,27 +300,27 @@ quip_rawmode(void) |
300 | } | | 300 | } |
301 | | | 301 | |
302 | char * | | 302 | char * |
303 | quip_selectinterface(char *ifname) | | 303 | quip_selectinterface(char *ifname) |
304 | { | | 304 | { |
305 | char buf[BODY_MAXSIZE], *cp; | | 305 | char buf[BODY_MAXSIZE], *cp; |
306 | int result_code, len; | | 306 | int result_code, len; |
307 | u_int if_index; | | 307 | u_int if_index; |
308 | static char interface[64]; | | 308 | static char interface[64]; |
309 | | | 309 | |
310 | if (server == NULL) | | 310 | if (server == NULL) |
311 | return (ifname); | | 311 | return (ifname); |
312 | | | 312 | |
313 | /* get an inferface list from the server */ | | 313 | /* get an interface list from the server */ |
314 | quip_sendrequest(server, "GET list?*\n"); | | 314 | quip_sendrequest(server, "GET list?*\n"); |
315 | | | 315 | |
316 | result_code = quip_recvresponse(server, NULL, buf, &len); | | 316 | result_code = quip_recvresponse(server, NULL, buf, &len); |
317 | if (result_code != 200) | | 317 | if (result_code != 200) |
318 | errx(1, "can't get interface list"); | | 318 | errx(1, "can't get interface list"); |
319 | | | 319 | |
320 | cp = buf; | | 320 | cp = buf; |
321 | while (1) { | | 321 | while (1) { |
322 | if (sscanf(cp, "%x %63s", &if_index, interface) != 2) | | 322 | if (sscanf(cp, "%x %63s", &if_index, interface) != 2) |
323 | break; | | 323 | break; |
324 | if (ifname == NULL) { | | 324 | if (ifname == NULL) { |
325 | /* if name isn't specified, return the 1st entry */ | | 325 | /* if name isn't specified, return the 1st entry */ |
326 | return (interface); | | 326 | return (interface); |