aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--networking/nslookup.c33
-rw-r--r--util-linux/mkfs_minix.c55
2 files changed, 45 insertions, 43 deletions
diff --git a/networking/nslookup.c b/networking/nslookup.c
index 0f3102e30..329510630 100644
--- a/networking/nslookup.c
+++ b/networking/nslookup.c
@@ -5,7 +5,7 @@
5 * Copyright (C) 1999,2000 by Lineo, inc. and John Beppu 5 * Copyright (C) 1999,2000 by Lineo, inc. and John Beppu
6 * Copyright (C) 1999,2000,2001 by John Beppu <beppu@codepoet.org> 6 * Copyright (C) 1999,2000,2001 by John Beppu <beppu@codepoet.org>
7 * 7 *
8 * Correct default name server display and explicit name server option 8 * Correct default name server display and explicit name server option
9 * added by Ben Zeckel <bzeckel@hmc.edu> June 2001 9 * added by Ben Zeckel <bzeckel@hmc.edu> June 2001
10 * 10 *
11 * This program is free software; you can redistribute it and/or modify 11 * This program is free software; you can redistribute it and/or modify
@@ -30,6 +30,7 @@
30#include <string.h> 30#include <string.h>
31#include <stdlib.h> 31#include <stdlib.h>
32 32
33#include <stdint.h>
33#include <netdb.h> 34#include <netdb.h>
34#include <sys/socket.h> 35#include <sys/socket.h>
35#include <sys/types.h> 36#include <sys/types.h>
@@ -46,9 +47,9 @@
46/* only works for IPv4 */ 47/* only works for IPv4 */
47static int addr_fprint(char *addr) 48static int addr_fprint(char *addr)
48{ 49{
49 u_int8_t split[4]; 50 uint8_t split[4];
50 u_int32_t ip; 51 uint32_t ip;
51 u_int32_t *x = (u_int32_t *) addr; 52 uint32_t *x = (uint32_t *) addr;
52 53
53 ip = ntohl(*x); 54 ip = ntohl(*x);
54 split[0] = (ip & 0xff000000) >> 24; 55 split[0] = (ip & 0xff000000) >> 24;
@@ -102,12 +103,12 @@ static struct hostent *hostent_fprint(struct hostent *host, const char *server_h
102} 103}
103 104
104/* changes a c-string matching the perl regex \d+\.\d+\.\d+\.\d+ 105/* changes a c-string matching the perl regex \d+\.\d+\.\d+\.\d+
105 * into a u_int32_t 106 * into a uint32_t
106 */ 107 */
107static u_int32_t str_to_addr(const char *addr) 108static uint32_t str_to_addr(const char *addr)
108{ 109{
109 u_int32_t split[4]; 110 uint32_t split[4];
110 u_int32_t ip; 111 uint32_t ip;
111 112
112 sscanf(addr, "%d.%d.%d.%d", 113 sscanf(addr, "%d.%d.%d.%d",
113 &split[0], &split[1], &split[2], &split[3]); 114 &split[0], &split[1], &split[2], &split[3]);
@@ -144,12 +145,12 @@ static inline void set_default_dns(char *server)
144{ 145{
145 struct in_addr server_in_addr; 146 struct in_addr server_in_addr;
146 147
147 if(inet_aton(server,&server_in_addr)) 148 if(inet_aton(server,&server_in_addr))
148 { 149 {
149 _res.nscount = 1; 150 _res.nscount = 1;
150 _res.nsaddr_list[0].sin_addr = server_in_addr; 151 _res.nsaddr_list[0].sin_addr = server_in_addr;
151 } 152 }
152} 153}
153 154
154/* naive function to check whether char *s is an ip address */ 155/* naive function to check whether char *s is an ip address */
155static int is_ip_address(const char *s) 156static int is_ip_address(const char *s)
@@ -173,18 +174,18 @@ int nslookup_main(int argc, char **argv)
173 * initialize DNS structure _res used in printing the default 174 * initialize DNS structure _res used in printing the default
174 * name server and in the explicit name server option feature. 175 * name server and in the explicit name server option feature.
175 */ 176 */
176 177
177 res_init(); 178 res_init();
178 179
179 /* 180 /*
180 * We allow 1 or 2 arguments. 181 * We allow 1 or 2 arguments.
181 * The first is the name to be looked up and the second is an 182 * The first is the name to be looked up and the second is an
182 * optional DNS server with which to do the lookup. 183 * optional DNS server with which to do the lookup.
183 * More than 3 arguments is an error to follow the pattern of the 184 * More than 3 arguments is an error to follow the pattern of the
184 * standard nslookup 185 * standard nslookup
185 */ 186 */
186 187
187 if (argc < 2 || *argv[1]=='-' || argc > 3) 188 if (argc < 2 || *argv[1]=='-' || argc > 3)
188 bb_show_usage(); 189 bb_show_usage();
189 else if(argc == 3) 190 else if(argc == 3)
190 set_default_dns(argv[2]); 191 set_default_dns(argv[2]);
@@ -199,4 +200,4 @@ int nslookup_main(int argc, char **argv)
199 return EXIT_SUCCESS; 200 return EXIT_SUCCESS;
200} 201}
201 202
202/* $Id: nslookup.c,v 1.30 2003/03/19 09:12:38 mjn3 Exp $ */ 203/* $Id: nslookup.c,v 1.31 2004/01/30 22:40:05 andersen Exp $ */
diff --git a/util-linux/mkfs_minix.c b/util-linux/mkfs_minix.c
index 767f998cc..0f72b3592 100644
--- a/util-linux/mkfs_minix.c
+++ b/util-linux/mkfs_minix.c
@@ -70,6 +70,7 @@
70#include <fcntl.h> 70#include <fcntl.h>
71#include <ctype.h> 71#include <ctype.h>
72#include <stdlib.h> 72#include <stdlib.h>
73#include <stdint.h>
73#include <termios.h> 74#include <termios.h>
74#include <sys/ioctl.h> 75#include <sys/ioctl.h>
75#include <sys/param.h> 76#include <sys/param.h>
@@ -102,13 +103,13 @@
102 * Note the 8-bit gid and atime and ctime. 103 * Note the 8-bit gid and atime and ctime.
103 */ 104 */
104struct minix_inode { 105struct minix_inode {
105 u_int16_t i_mode; 106 uint16_t i_mode;
106 u_int16_t i_uid; 107 uint16_t i_uid;
107 u_int32_t i_size; 108 uint32_t i_size;
108 u_int32_t i_time; 109 uint32_t i_time;
109 u_int8_t i_gid; 110 uint8_t i_gid;
110 u_int8_t i_nlinks; 111 uint8_t i_nlinks;
111 u_int16_t i_zone[9]; 112 uint16_t i_zone[9];
112}; 113};
113 114
114/* 115/*
@@ -118,35 +119,35 @@ struct minix_inode {
118 * now 16-bit. The inode is now 64 bytes instead of 32. 119 * now 16-bit. The inode is now 64 bytes instead of 32.
119 */ 120 */
120struct minix2_inode { 121struct minix2_inode {
121 u_int16_t i_mode; 122 uint16_t i_mode;
122 u_int16_t i_nlinks; 123 uint16_t i_nlinks;
123 u_int16_t i_uid; 124 uint16_t i_uid;
124 u_int16_t i_gid; 125 uint16_t i_gid;
125 u_int32_t i_size; 126 uint32_t i_size;
126 u_int32_t i_atime; 127 uint32_t i_atime;
127 u_int32_t i_mtime; 128 uint32_t i_mtime;
128 u_int32_t i_ctime; 129 uint32_t i_ctime;
129 u_int32_t i_zone[10]; 130 uint32_t i_zone[10];
130}; 131};
131 132
132/* 133/*
133 * minix super-block data on disk 134 * minix super-block data on disk
134 */ 135 */
135struct minix_super_block { 136struct minix_super_block {
136 u_int16_t s_ninodes; 137 uint16_t s_ninodes;
137 u_int16_t s_nzones; 138 uint16_t s_nzones;
138 u_int16_t s_imap_blocks; 139 uint16_t s_imap_blocks;
139 u_int16_t s_zmap_blocks; 140 uint16_t s_zmap_blocks;
140 u_int16_t s_firstdatazone; 141 uint16_t s_firstdatazone;
141 u_int16_t s_log_zone_size; 142 uint16_t s_log_zone_size;
142 u_int32_t s_max_size; 143 uint32_t s_max_size;
143 u_int16_t s_magic; 144 uint16_t s_magic;
144 u_int16_t s_state; 145 uint16_t s_state;
145 u_int32_t s_zones; 146 uint32_t s_zones;
146}; 147};
147 148
148struct minix_dir_entry { 149struct minix_dir_entry {
149 u_int16_t inode; 150 uint16_t inode;
150 char name[0]; 151 char name[0];
151}; 152};
152 153