X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=lib%2Fsh%2Fnetopen.c;h=736d4138fff56092eda077c528beb6eebae4c48c;hb=3185942a5234e26ab13fa02f9c51d340cec514f8;hp=76a389b45dd867fe9619a79efad7a26104a79034;hpb=f73dda092b33638d2d5e9c35375f687a607b5403;p=platform%2Fupstream%2Fbash.git diff --git a/lib/sh/netopen.c b/lib/sh/netopen.c index 76a389b..736d413 100644 --- a/lib/sh/netopen.c +++ b/lib/sh/netopen.c @@ -5,23 +5,23 @@ * chet@ins.CWRU.Edu */ -/* Copyright (C) 1987,1991 Free Software Foundation, Inc. +/* Copyright (C) 1987-2002 Free Software Foundation, Inc. This file is part of GNU Bash, the Bourne Again SHell. - Bash 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. + Bash 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 3 of the License, or + (at your option) any later version. - Bash 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. + Bash 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 Bash; see the file COPYING. If not, write to the Free - Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. */ + along with Bash. If not, see . +*/ #include @@ -51,6 +51,8 @@ #endif #include +#include + #include #include @@ -65,6 +67,16 @@ extern int inet_aton __P((const char *, struct in_addr *)); #endif #ifndef HAVE_GETADDRINFO +static int _getaddr __P((char *, struct in_addr *)); +static int _getserv __P((char *, int, unsigned short *)); +static int _netopen4 __P((char *, char *, int)); +#else /* HAVE_GETADDRINFO */ +static int _netopen6 __P((char *, char *, int)); +#endif + +static int _netopen __P((char *, char *, int)); + +#ifndef HAVE_GETADDRINFO /* Stuff the internet address corresponding to HOST into AP, in network byte order. Return 1 on success, 0 on failure. */ @@ -107,7 +119,7 @@ _getserv (serv, proto, pp) int proto; unsigned short *pp; { - long l; + intmax_t l; unsigned short s; if (legal_number (serv, &l)) @@ -153,19 +165,19 @@ _netopen4(host, serv, typ) if (_getaddr(host, &ina) == 0) { - internal_error ("%s: host unknown", host); + internal_error (_("%s: host unknown"), host); errno = EINVAL; return -1; } if (_getserv(serv, typ, &p) == 0) { - internal_error("%s: invalid service", serv); + internal_error(_("%s: invalid service"), serv); errno = EINVAL; return -1; } - bzero ((char *)&sin, sizeof(sin)); + memset ((char *)&sin, 0, sizeof(sin)); sin.sin_family = AF_INET; sin.sin_port = p; sin.sin_addr = ina; @@ -205,7 +217,7 @@ _netopen6 (host, serv, typ) struct addrinfo hints, *res, *res0; int gerr; - bzero ((char *)&hints, sizeof (hints)); + memset ((char *)&hints, 0, sizeof (hints)); /* XXX -- if problems with IPv6, set to PF_INET for IPv4 only */ #ifdef DEBUG /* PF_INET is the one that works for me */ hints.ai_family = PF_INET; @@ -291,7 +303,7 @@ netopen (path) t = strchr (s, '/'); if (t == 0) { - internal_error ("%s: bad network path specification", path); + internal_error (_("%s: bad network path specification"), path); return -1; } *t++ = '\0'; @@ -331,7 +343,7 @@ int netopen (path) char *path; { - internal_error ("network operations not supported"); + internal_error (_("network operations not supported")); return -1; }