X-Git-Url: http://git.hungrycats.org/cgi-bin/gitweb.cgi?p=xscreensaver;a=blobdiff_plain;f=hacks%2Fsonar.c;h=b7ff0a5a8629eb8f02b0e73a3fc9759a8b80d4b4;hp=a5005a7b860bbb61e9c3c86fd39f7adf31212ff0;hb=bc7b7a8eb122206d239ec0e693676bcce31be1aa;hpb=ffd8c0873576a9e3065696a624dce6b766b77062 diff --git a/hacks/sonar.c b/hacks/sonar.c index a5005a7b..b7ff0a5a 100644 --- a/hacks/sonar.c +++ b/hacks/sonar.c @@ -38,7 +38,7 @@ * software for any purpose. It is provided "as is" without express or * implied warranty. * - * $Revision: 1.32 $ + * $Revision: 1.33 $ * * Version 1.0 April 27, 1998. * - Initial version @@ -215,6 +215,7 @@ typedef struct { } sonar_info; static Bool debug_p = False; +static Bool resolve_p = True; /* @@ -314,6 +315,7 @@ char *defaults [] = { "*teamBCount: 4", "*ping: default", + "*resolve: true", ".debug: false", 0 }; @@ -337,6 +339,7 @@ XrmOptionDescRec options [] = { {"-team-b-count", ".teamBCount", XrmoptionSepArg, 0 }, {"-ping", ".ping", XrmoptionSepArg, 0 }, + {"-no-dns", ".resolve", XrmoptionNoArg, "False" }, {"-debug", ".debug", XrmoptionNoArg, "True" }, { 0, 0, 0, 0 } }; @@ -497,9 +500,12 @@ lookupHost(ping_target *target) } iaddr->sin_addr.s_addr = pack_addr (ip[0], ip[1], ip[2], ip[3]); - hent = gethostbyaddr ((const char *) &iaddr->sin_addr.s_addr, - sizeof(iaddr->sin_addr.s_addr), - AF_INET); + if (resolve_p) + hent = gethostbyaddr ((const char *) &iaddr->sin_addr.s_addr, + sizeof(iaddr->sin_addr.s_addr), + AF_INET); + else + hent = 0; if (debug_p > 1) fprintf (stderr, "%s: %s => %s\n", @@ -1250,9 +1256,12 @@ getping(sonar_info *si, ping_info *pi) struct sockaddr_in iaddr; struct hostent *h; iaddr.sin_addr.s_addr = pack_addr (iip[0],iip[1],iip[2],iip[3]); - h = gethostbyaddr ((const char *) &iaddr.sin_addr.s_addr, - sizeof(iaddr.sin_addr.s_addr), - AF_INET); + if (resolve_p) + h = gethostbyaddr ((const char *) &iaddr.sin_addr.s_addr, + sizeof(iaddr.sin_addr.s_addr), + AF_INET); + else + h = 0; if (h && h->h_name && *h->h_name) { @@ -2046,6 +2055,7 @@ screenhack(Display *dpy, Window win) long sleeptime; debug_p = get_boolean_resource ("debug", "Debug"); + resolve_p = get_boolean_resource ("resolve", "Resolve"); sensor = 0; # ifdef HAVE_PING