plan9port/src/cmd
David du Colombier 3409bc9ae1 lib9/dial: add support for IPv6
The function p9dialparse() returns the host as a sockaddr_storage
structure instead of a u32int, to be able to handle both IPv4
and IPv6 addresses. Because the sockaddr_storage structure also
handle port numbers and Unix path names, there is no longer
need to set them in the calling functions. However, these values
are still returned for convenience.

The sockaddr_in and sockaddr_un structures have been replaced
by sockaddr_storage to handle Unix, IPv4 and IPv6 sockets.

Names and addresses are resolved using either gethostbyname()
or getaddrinfo() functions.

The getaddrinfo() function is documented in RFC2553 and standardized
since POSIX.1-2001. It supports both IPv4 and IPv6 addresses.
The gethostbyname() function is deprecated since POSIX.1-2008.
However, some libc implementations don't handle getaddrinfo()
properly, thus we preferred to try gethostbyname() first.

I've tried to preserve most of the old code logic to prevent
from surprising or unwanted behavior.

R=rsc
http://codereview.appspot.com/6255068
2012-06-02 21:50:59 +02:00
..
9pfuse semicolons! 2011-10-07 11:41:04 -04:00
9term 9term: fix hold mode delay 2011-10-13 09:38:24 -04:00
9660 Use gcc -ansi -pedantic in 9c. Fix many non-C89-isms. 2006-04-01 19:24:03 +00:00
9660srv 9660srv: dynamically init fcalls 2008-12-01 19:22:35 -05:00
acid fix INSTALL warnings 2012-05-29 15:11:14 -04:00
acidtypes Use gcc -ansi -pedantic in 9c. Fix many non-C89-isms. 2006-04-01 19:24:03 +00:00
acme acme: claim input focus earlier 2012-01-16 17:05:39 -05:00
astro Use va_args in cosadd/sinadd (Michael Teichgräber) 2006-05-27 18:35:26 +00:00
auth aescbc: fix segfault on backspace 2011-12-07 12:27:07 -05:00
auxstats stats: make more stats work in Linux 2009-08-08 16:45:27 -04:00
awk awk: sync with Plan 9 2009-08-11 20:16:30 -04:00
bzip2 Use gcc -ansi -pedantic in 9c. Fix many non-C89-isms. 2006-04-01 19:24:03 +00:00
cb try to handle Beof in the macros (Michael Teichgräber) 2007-03-25 18:32:51 +00:00
db libmach, acid, db: 64-bit support 2012-02-19 18:11:39 -05:00
devdraw devdraw: fix mouse warping with multi-monitor on OS X 2012-03-05 21:14:34 -05:00
dict merge 2007-08-22 09:00:26 -04:00
diff diff: continue after i/o errors when diffing many files 2007-11-05 11:09:39 -05:00
draw crop: fix 64-bit 2011-05-01 14:42:58 -04:00
eqn eqn: add working mbtowc and wctomb 2011-02-04 15:41:39 -05:00
faces Use gcc -ansi -pedantic in 9c. Fix many non-C89-isms. 2006-04-01 19:24:03 +00:00
fontsrv fix INSTALL warnings 2012-05-29 15:11:14 -04:00
grap INSTALL: fix build on Snow Leopard 2009-09-11 13:51:50 -04:00
graph no c99 isms 2006-05-31 04:55:43 +00:00
grep grep: import $ fix from plan 9 2011-07-10 20:01:15 -04:00
gzip various: crctab now u32int 2010-02-22 16:54:58 -08:00
hoc hoc: print exact floating point output 2007-12-07 15:29:19 -05:00
htmlfmt Use gcc -ansi -pedantic in 9c. Fix many non-C89-isms. 2006-04-01 19:24:03 +00:00
htmlroff htmlroff: ignore \X... text; allow delims besides quote 2008-11-11 10:59:48 -08:00
index More troff bits; if you want them elsewhere, feel free to repo copy them. 2004-05-17 03:22:35 +00:00
ip dhcpd: fix build on OS X, silence non-log prints 2009-09-13 17:48:44 -04:00
jpg gif: fix setting of transparency channels when writing gifs. 2011-05-17 17:46:45 -04:00
lex lex: 64-bit bug 2011-08-02 14:16:30 -04:00
lp Changes. 2005-08-31 02:20:12 +00:00
map system tan() is probably good enough 2006-04-21 04:00:56 +00:00
mk mk: pass environment to P command 2011-08-27 23:06:15 -04:00
mnihongo Goodbye SHORTLIB 2005-01-04 22:10:29 +00:00
mpm make compile 2006-02-17 18:21:29 +00:00
ndb post9pservice: add extra arg to unmodified calls 2008-04-17 16:13:04 -04:00
netfiles Use gcc -ansi -pedantic in 9c. Fix many non-C89-isms. 2006-04-01 19:24:03 +00:00
page page: check for gs failure 2011-10-25 12:55:09 -04:00
pic INSTALL: fix build on Snow Leopard 2009-09-11 13:51:50 -04:00
plot Use gcc -ansi -pedantic in 9c. Fix many non-C89-isms. 2006-04-01 19:24:03 +00:00
plumb plumb: remove debugging print 2012-05-15 10:55:53 -04:00
postscript postscript: update for 32-bit Rune 2009-09-13 17:42:33 -04:00
proof darwin 2006-04-21 04:26:02 +00:00
rc rc: silence lion roar 2011-08-02 16:21:33 -04:00
rio rio: quiet nm on Lion 2011-10-14 00:08:50 -04:00
sam sam: use ulong as type of dev consistently 2010-08-04 17:35:44 -07:00
samterm This should resolve the crash indicated in issue 44: 2010-02-18 22:32:37 -08:00
scat SunOS fixes (thanks Aram Hăvărneanu) 2011-05-17 18:48:42 -04:00
smugfs smugfs: delete debugging prints 2009-07-29 11:28:00 -04:00
snarfer use cocoa on snow leopard 2011-09-26 09:27:55 -07:00
spell Use gcc -ansi -pedantic in 9c. Fix many non-C89-isms. 2006-04-01 19:24:03 +00:00
tapefs various: crctab now u32int 2010-02-22 16:54:58 -08:00
tbl cast 2006-04-20 22:56:08 +00:00
tcs This patch fixes unicode, unicode-be and unicode-le 2010-06-28 14:43:28 -07:00
tpic INSTALL: fix build on Snow Leopard 2009-09-11 13:51:50 -04:00
troff troff: avoid crash if home == NULL 2009-12-27 09:22:43 -08:00
troff2html fix again 2007-03-25 17:28:01 +00:00
upas mailfs: add -u user argument 2011-11-28 09:21:01 -05:00
vac vacfs: remove 9P2000.u relic 2012-04-04 16:51:27 +02:00
vbackup lib9/dial: add support for IPv6 2012-06-02 21:50:59 +02:00
venti fix INSTALL warnings 2012-05-29 15:11:14 -04:00
.cvsignore Ignore more. 2005-09-13 00:42:27 +00:00
9p.c 9p: tflag sorts by mtime 2010-06-28 14:33:30 -07:00
9pserve.c delete 9P2000.u 2010-12-07 13:34:11 -05:00
acmeevent.c in with the new 2005-01-04 22:30:59 +00:00
ascii.c new utilities. 2003-11-23 18:04:47 +00:00
auxclog.c libc conflict on os x 2007-03-15 17:35:43 +00:00
basename.c new utilities. 2003-11-23 18:04:47 +00:00
bc.y bc: cleanup, make sure to run 9 dc 2008-12-06 16:45:22 -08:00
cal.c new utilities. 2003-11-23 18:04:47 +00:00
calendar.c I just hate to be pushed around by some @#$%^& machine. 2005-07-19 18:00:07 +00:00
cat.c new utilities. 2003-11-23 18:04:47 +00:00
cleanname.c new utilities. 2003-11-23 18:04:47 +00:00
cmp.c new utilities. 2003-11-23 18:04:47 +00:00
comm.c no /fd/0 2005-01-14 20:08:31 +00:00
core.c do not readdir files - from zoltan jarai 2005-01-30 19:45:08 +00:00
date.c new utilities. 2003-11-23 18:04:47 +00:00
dc.c dc: cleanup, fix off-by-one memory error 2008-12-06 16:45:40 -08:00
dd.c dd: fix apple gcc return warning (even Go can handle this one, Apple!) 2011-09-19 09:10:05 -04:00
delatex.lx merge 2008-01-30 10:30:45 -05:00
deroff.c no wide character constants; sigh 2005-05-07 22:42:06 +00:00
dformat bwk's dformat. 2004-05-16 07:58:31 +00:00
dial.c send output to fd instead of 0 2005-02-11 16:42:48 +00:00
du.C du: build by default; fix bug gcc discovered 2009-02-05 09:17:54 -08:00
echo.c new utilities. 2003-11-23 18:04:47 +00:00
ed.c ed: new append from rob, avoids overflow in pointer arithmetic 2010-01-12 11:16:14 -08:00
factor.c new utilities. 2003-11-23 18:04:47 +00:00
file.c x3f support 2008-10-08 21:16:13 -05:00
fmt.c fmt: delete 2-space code 2012-01-05 01:02:44 -05:00
fortune.c have lrand now 2005-01-04 21:25:26 +00:00
freq.c Use gcc -ansi -pedantic in 9c. Fix many non-C89-isms. 2006-04-01 19:24:03 +00:00
fsize.c new utilities. 2003-11-23 18:04:47 +00:00
getflags.c getflags: use shell quoting 2010-10-07 03:35:43 -04:00
hget.c hget: use absolute url for POST through a proxy 2010-06-28 14:37:26 -07:00
hist.c apple 2005-07-13 21:34:11 +00:00
idiff.c lib9: add mode parameter to opentemp 2008-07-10 11:10:10 -04:00
import.c import: clean up correctly 2010-11-03 15:49:22 -04:00
join.c I just hate to be pushed around by some @#$%^& machine. 2005-07-19 18:00:07 +00:00
listen1.c Use gcc -ansi -pedantic in 9c. Fix many non-C89-isms. 2006-04-01 19:24:03 +00:00
look.c no wide character constants; sigh 2005-05-07 22:42:06 +00:00
ls.C Make ls -lF work. 2007-01-29 15:12:42 +00:00
md5sum.C new utilities. 2003-11-23 18:04:47 +00:00
mkdir.C add -m flag 2004-04-21 22:37:29 +00:00
mkfile scat: add to build 2009-04-30 11:09:52 -07:00
mtime.c add new guys 2004-04-21 23:22:06 +00:00
namespace.c Add namespace.c 2004-03-21 14:07:19 +00:00
netkey.c changes 2005-02-11 19:51:21 +00:00
news.c Many small edits. 2005-01-13 04:49:19 +00:00
p.c use tty 2004-04-24 05:22:42 +00:00
pbd.c Add tcs; it compiles in my world, but I haven't tried it in Russ's yet. 2004-04-21 01:15:41 +00:00
pr.c os x changes 2005-01-11 17:43:53 +00:00
primes.c primes: faster output 2011-06-28 18:58:44 -04:00
ramfs.c misc: more post9pservice callers 2008-05-07 12:55:48 -04:00
read.c in with the new 2005-01-04 22:30:59 +00:00
readcons.c new program readcons 2005-02-13 18:03:41 +00:00
resample.c Use gcc -ansi -pedantic in 9c. Fix many non-C89-isms. 2006-04-01 19:24:03 +00:00
rm.c Many small edits. 2005-01-13 04:49:19 +00:00
sed.c convert to 4-byte UTF-8 and 32-bit Rune 2009-09-11 17:03:06 -04:00
seq.c new seq from plan 9 (Anthony Martin) 2006-10-12 01:42:11 +00:00
sftpcache.c Use gcc -ansi -pedantic in 9c. Fix many non-C89-isms. 2006-04-01 19:24:03 +00:00
sha1sum.c new utilities. 2003-11-23 18:04:47 +00:00
sleep.c new utilities. 2003-11-23 18:04:47 +00:00
sort.c sort: use noted(NDFLT) in note handler 2008-06-01 08:26:10 -04:00
split.c I just hate to be pushed around by some @#$%^& machine. 2005-07-19 18:00:07 +00:00
srv.c misc: more post9pservice callers 2008-05-07 12:55:48 -04:00
strings.c no /fd/ 2005-11-12 16:43:07 +00:00
sum.c new utilities. 2003-11-23 18:04:47 +00:00
tail.c I just hate to be pushed around by some @#$%^& machine. 2005-07-19 18:00:07 +00:00
tar.c tar: rename sstrnlen to avoid OpenBSD compile error 2010-07-11 09:48:51 -07:00
tee.c new utilities. 2003-11-23 18:04:47 +00:00
test.c test: update from Plan 9 2011-08-16 16:11:48 -04:00
time.c Fix small bugs. 2004-05-11 17:51:27 +00:00
touch.c print error if changing time fails 2007-05-20 14:37:29 +00:00
tr.c tr: 32-bit rune fixes 2011-01-02 18:42:25 -05:00
unicode.c convert to 4-byte UTF-8 and 32-bit Rune 2009-09-11 17:03:06 -04:00
uniq.c I just hate to be pushed around by some @#$%^& machine. 2005-07-19 18:00:07 +00:00
units.y Use gcc -ansi -pedantic in 9c. Fix many non-C89-isms. 2006-04-01 19:24:03 +00:00
unutf.c Add the #goo to allow use in C++. 2003-11-25 01:40:27 +00:00
usage.c move files that codebot put in the wrong place 2009-08-14 20:38:22 -07:00
wc.c wc: 4-byte utf-8 capable (Erik Quanstrom) 2010-12-07 23:15:22 -05:00
xd.c merge 2009-02-04 20:12:48 -08:00
yacc.c write YYARG def to ftable (fdefine might be null, and is not the right place anyway) 2007-01-29 16:46:16 +00:00
zerotrunc.c zerotrunc: from Plan 9 2011-08-16 16:11:56 -04:00