diff options
author | Epoch Qwert <epoch@53flpnlls43fcguy.onion> | 2015-01-09 19:25:02 -0600 |
---|---|---|
committer | Epoch Qwert <epoch@53flpnlls43fcguy.onion> | 2015-01-09 19:25:02 -0600 |
commit | 3f6b64304a8a11f0505e91681384327696983928 (patch) | |
tree | 77cffccf8ad8901b844334a0c068ac951e93d6a8 /src/libexec | |
parent | e23c6287bb1124397c126c83cc73fed17fda998f (diff) | |
download | misc-3f6b64304a8a11f0505e91681384327696983928.tar.gz misc-3f6b64304a8a11f0505e91681384327696983928.zip |
XuntilY.awk is actually a shell script, but mostly written in awk to make XuntilY easier to use for people without Perl
gopherd.sh... I don't remember the change.
music.c is to practice reading music.
sockip is to get the IP of the listening socket, like if ran from inetd
Diffstat (limited to 'src/libexec')
-rw-r--r-- | src/libexec/sockip.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/libexec/sockip.c b/src/libexec/sockip.c new file mode 100644 index 0000000..542a88d --- /dev/null +++ b/src/libexec/sockip.c @@ -0,0 +1,15 @@ +#include <stdio.h> +#include <sys/socket.h> +#include <netdb.h> +#include <netinet/in.h> + +int main(int argc,char *argv[]) { + struct sockaddr_in6 sa6; + unsigned int sl=sizeof(sa6); + char h[NI_MAXHOST], s[NI_MAXSERV]; + if(getsockname(0,(struct sockaddr *)&sa6,&sl) == -1) return 1; + if(getnameinfo((struct sockaddr *)&sa6,sl,h,sizeof(h),s,sizeof(s),NI_NUMERICHOST|NI_NUMERICSERV)) return 2; + puts(h); + puts(s); + return 0; +} |