mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-11-05 19:44:57 +00:00
* filter.c: (access_list_remark_cmd) buffer_putstr doesnt need cast
to u_char. (ipv6_access_list_remark_cmd) ditto.
if.c: ditto
* network.c: (readn/writen) pointer arg should be type u_char.
* plist.c: needs to include stream.h, not declare stream functions
internally.
(various) Add static qualifier to internal functions.
(prefix_list_type_str) extraneous breaks in switch statement.
(ip_prefix_list_description_cmd) buffer_putstr doesnt need cast
* stream.h: depends on plist.h and export stream_put_prefix
* vty.c: (vty_<telnet option build functions>) should use
unsigned char, telnet options are 0 -> 255.
* zclient.c: various u_char<->char type cleanups.
* zebra.h: Having to define CMSG_* can apply to more than just
BSDI_NRL.
* ripd.c: (rip_distribute_update_all) distribute list hook
function pointer prototype requires struct prefix_list * arg.
(rip_distribute_update_all_wrapper) update to pass required arg,
NULL.
72 lines
1.5 KiB
C
72 lines
1.5 KiB
C
/*
|
|
* Network library.
|
|
* Copyright (C) 1997 Kunihiro Ishiguro
|
|
*
|
|
* This file is part of GNU Zebra.
|
|
*
|
|
* GNU Zebra is free software; you can redistribute it and/or modify it
|
|
* under the terms of the GNU General Public License as published by the
|
|
* Free Software Foundation; either version 2, or (at your option) any
|
|
* later version.
|
|
*
|
|
* GNU Zebra is distributed in the hope that it will be useful, but
|
|
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
* General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU General Public License
|
|
* along with GNU Zebra; see the file COPYING. If not, write to the Free
|
|
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
|
* 02111-1307, USA.
|
|
*/
|
|
|
|
#include <zebra.h>
|
|
|
|
/* Read nbytes from fd and store into ptr. */
|
|
int
|
|
readn (int fd, u_char *ptr, int nbytes)
|
|
{
|
|
int nleft;
|
|
int nread;
|
|
|
|
nleft = nbytes;
|
|
|
|
while (nleft > 0)
|
|
{
|
|
nread = read (fd, ptr, nleft);
|
|
|
|
if (nread < 0)
|
|
return (nread);
|
|
else
|
|
if (nread == 0)
|
|
break;
|
|
|
|
nleft -= nread;
|
|
ptr += nread;
|
|
}
|
|
|
|
return nbytes - nleft;
|
|
}
|
|
|
|
/* Write nbytes from ptr to fd. */
|
|
int
|
|
writen(int fd, u_char *ptr, int nbytes)
|
|
{
|
|
int nleft;
|
|
int nwritten;
|
|
|
|
nleft = nbytes;
|
|
|
|
while (nleft > 0)
|
|
{
|
|
nwritten = write(fd, ptr, nleft);
|
|
|
|
if (nwritten <= 0)
|
|
return (nwritten);
|
|
|
|
nleft -= nwritten;
|
|
ptr += nwritten;
|
|
}
|
|
return nbytes - nleft;
|
|
}
|