From 8d138b83e65e71c839e3f9784ca838c98f50feb2 Mon Sep 17 00:00:00 2001 From: zacheiss Date: Mon, 20 Aug 2001 23:23:52 +0000 Subject: [PATCH] From jhawk: If we're given an IP address on the command line, do a lookup based on it. --- clients/stella/stella.c | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/clients/stella/stella.c b/clients/stella/stella.c index 2c7f3ee3..4142aae7 100644 --- a/clients/stella/stella.c +++ b/clients/stella/stella.c @@ -5,11 +5,17 @@ * * Somewhat based on blanche * - * Copyright (C) 2000 by the Massachusetts Institute of Technology. + * Copyright (C) 2000, 2001 by the Massachusetts Institute of Technology. * For copying and distribution information, please see the file * . */ +#include +#include + +#include +#include + #include #include #include @@ -62,6 +68,7 @@ char *hostname, *whoami; char *newname, *address, *network, *h_status, *vendor, *model; char *os, *location, *contact, *billing_contact, *adm_cmt, *op_cmt; +in_addr_t ipaddress; struct owner_type *owner; void usage(char **argv); @@ -321,6 +328,22 @@ int main(int argc, char **argv) if (status) exit(2); + /* Perform the lookup by IP address if that's what we've been handed */ + if ((ipaddress=inet_addr(hostname)) != -1) { + char *args[5]; + char *argv[30]; + + args[1] = strdup(hostname); + args[0] = args[2] = args[3] = "*"; + status = wrap_mr_query("get_host", 4, args, store_host_info, argv); + + if (status) { + com_err(whoami, status, "while looking up IP address."); + } else { + hostname = argv[0]; + } + } + /* create if needed */ if (create_flag) { -- 2.45.2