1 #ident "$Id: resolv.c,v 1.1 2004/12/28 23:49:43 hpa Exp $"
2 /* ----------------------------------------------------------------------- *
4 * Copyright 2004 H. Peter Anvin - All Rights Reserved
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation, Inc., 53 Temple Place Ste 330,
9 * Boston MA 02111-1307, USA; either version 2 of the License, or
10 * (at your option) any later version; incorporated herein by reference.
12 * ----------------------------------------------------------------------- */
17 * Resolve an IP address
26 uint32_t resolv(const char *name)
30 strcpy((char *)__com32.cs_bounce, name);
32 memset(®, 0, sizeof reg);
33 reg.eax.w[0] = 0x0010;
34 reg.ebx.w[0] = OFFS(__com32.cs_bounce);
35 reg.es = SEG(__com32.cs_bounce);
37 __intcall(0x22, ®, ®);
39 if ( reg.eflags.l & EFLAGS_CF )
45 int main(int argc, char *argv[])
49 openconsole(&dev_null_r, &dev_stdcon_w);
52 fputs("Usage: resolv hostname\n", stderr);
59 printf("%s = %u.%u.%u.%u\n", argv[1],
60 (ip & 0xff), (ip >> 8) & 0xff,
61 (ip >> 16) & 0xff, (ip >> 24) & 0xff);
63 printf("%s not found\n", argv[1]);