BSD 4_3_Tahoe release
[unix-history] / usr / src / etc / routed / tools / query.c
index 29ca64e..44092f9 100644 (file)
@@ -1,12 +1,24 @@
 /*
  * Copyright (c) 1980 Regents of the University of California.
 /*
  * Copyright (c) 1980 Regents of the University of California.
- * All rights reserved.  The Berkeley software License Agreement
- * specifies the terms and conditions for redistribution.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms are permitted
+ * provided that this notice is preserved and that due credit is given
+ * to the University of California at Berkeley. The name of the University
+ * may not be used to endorse or promote products derived from this
+ * software without specific prior written permission. This software
+ * is provided ``as is'' without express or implied warranty.
  */
 
 #ifndef lint
  */
 
 #ifndef lint
-static char sccsid[] = "@(#)query.c    5.7 (Berkeley) 5/15/86";
-#endif not lint
+char copyright[] =
+"@(#) Copyright (c) 1980 Regents of the University of California.\n\
+ All rights reserved.\n";
+#endif /* not lint */
+
+#ifndef lint
+static char sccsid[] = "@(#)query.c    5.9 (Berkeley) 6/11/88";
+#endif /* not lint */
 
 #include <sys/param.h>
 #include <sys/protosw.h>
 
 #include <sys/param.h>
 #include <sys/protosw.h>
@@ -33,7 +45,7 @@ main(argc, argv)
 {
        int cc, count, bits;
        struct sockaddr from;
 {
        int cc, count, bits;
        struct sockaddr from;
-       int fromlen = sizeof(from);
+       int fromlen = sizeof(from), size = 32*1024;
        struct timeval shorttime;
        
        if (argc < 2) {
        struct timeval shorttime;
        
        if (argc < 2) {
@@ -46,6 +58,8 @@ usage:
                perror("socket");
                exit(2);
        }
                perror("socket");
                exit(2);
        }
+       if (setsockopt(s, SOL_SOCKET, SO_RCVBUF, &size, sizeof(size)) < 0)
+               perror("setsockopt SO_RCVBUF");
 
        argv++, argc--;
        if (*argv[0] == '-') {
 
        argv++, argc--;
        if (*argv[0] == '-') {
@@ -90,6 +104,7 @@ usage:
                rip_input(&from, cc);
                count--;
        }
                rip_input(&from, cc);
                count--;
        }
+       exit (count > 0 ? count : 0);
 }
 
 query(host)
 }
 
 query(host)
@@ -197,10 +212,10 @@ rip_input(from, size)
                                if (hp)
                                        name = hp->h_name;
                        }
                                if (hp)
                                        name = hp->h_name;
                        }
-                       printf("\t%s(%s), metric %d\n", name,
-                               inet_ntoa(sin->sin_addr), n->rip_metric);
+                       printf("\t%-17s metric %2d name %s\n",
+                               inet_ntoa(sin->sin_addr), n->rip_metric, name);
                } else
                } else
-                       printf("\t%s, metric %d\n",
+                       printf("\t%-17s metric %2d\n",
                                inet_ntoa(sin->sin_addr), n->rip_metric);
                break;
                }
                                inet_ntoa(sin->sin_addr), n->rip_metric);
                break;
                }