From: Joshua Wise Date: Thu, 2 Oct 2008 22:49:46 +0000 (-0400) Subject: Merge nyus.joshuawise.com:/storage/git/netwatch X-Git-Url: http://git.joshuawise.com/netwatch.git/commitdiff_plain/1830630f2cc0aa3e1e44f7390614216395fdfe7a?hp=20ef12080950c328702f590b53c50e328a03b971 Merge nyus.joshuawise.com:/storage/git/netwatch --- diff --git a/include/minilib.h b/include/minilib.h index 3704bca..90abfc9 100644 --- a/include/minilib.h +++ b/include/minilib.h @@ -16,5 +16,6 @@ extern int vsprintf(char *s, const char *fmt, va_list args); extern int vsnprintf(char *s, int size, const char *fmt, va_list args); extern int sprintf(char *s, const char *fmt, ...); extern int snprintf(char *s, int size, const char *fmt, ...); +extern unsigned short htons(unsigned short in); #endif diff --git a/lib/minilib.c b/lib/minilib.c index 0407d3f..677c77a 100644 --- a/lib/minilib.c +++ b/lib/minilib.c @@ -81,3 +81,8 @@ void puthex(unsigned long l) tohex(d, l); puts(d); } + +unsigned short htons(unsigned short in) +{ + return (in >> 8) | (in << 8); +}