diff options
| author | Glenn L McGrath <bug1@ihug.co.nz> | 2004-02-18 13:19:58 +0000 |
|---|---|---|
| committer | Glenn L McGrath <bug1@ihug.co.nz> | 2004-02-18 13:19:58 +0000 |
| commit | 03a0643fbc5ae3e1ab2e7e29bb64617a4b94a5c9 (patch) | |
| tree | d7818492581f8e2046c7bfcc06106259696145e6 | |
| parent | 82d42dbb57d45c077c2d8c933e0c745d989e4d97 (diff) | |
| download | busybox-w32-03a0643fbc5ae3e1ab2e7e29bb64617a4b94a5c9.tar.gz busybox-w32-03a0643fbc5ae3e1ab2e7e29bb64617a4b94a5c9.tar.bz2 busybox-w32-03a0643fbc5ae3e1ab2e7e29bb64617a4b94a5c9.zip | |
Dont use same variable and struct name
| -rw-r--r-- | networking/inetd.c | 72 |
1 files changed, 37 insertions, 35 deletions
diff --git a/networking/inetd.c b/networking/inetd.c index 6980a9003..896a9978f 100644 --- a/networking/inetd.c +++ b/networking/inetd.c | |||
| @@ -159,7 +159,7 @@ | |||
| 159 | # define INETD_FEATURE_ENABLED | 159 | # define INETD_FEATURE_ENABLED |
| 160 | #endif | 160 | #endif |
| 161 | 161 | ||
| 162 | static struct servtab { | 162 | typedef struct servtab_s { |
| 163 | char *se_service; /* name of service */ | 163 | char *se_service; /* name of service */ |
| 164 | int se_socktype; /* type of socket to use */ | 164 | int se_socktype; /* type of socket to use */ |
| 165 | int se_family; /* address family */ | 165 | int se_family; /* address family */ |
| @@ -183,8 +183,10 @@ static struct servtab { | |||
| 183 | int se_max; /* max # of instances of this service */ | 183 | int se_max; /* max # of instances of this service */ |
| 184 | int se_count; /* number started since se_time */ | 184 | int se_count; /* number started since se_time */ |
| 185 | struct timeval se_time; /* start of se_count */ | 185 | struct timeval se_time; /* start of se_count */ |
| 186 | struct servtab *se_next; | 186 | struct servtab_s *se_next; |
| 187 | } *servtab; | 187 | } servtab_t; |
| 188 | |||
| 189 | static servtab_t *servtab; | ||
| 188 | 190 | ||
| 189 | #ifdef INETD_FEATURE_ENABLED | 191 | #ifdef INETD_FEATURE_ENABLED |
| 190 | struct biltin { | 192 | struct biltin { |
| @@ -192,33 +194,33 @@ struct biltin { | |||
| 192 | int bi_socktype; /* type of socket supported */ | 194 | int bi_socktype; /* type of socket supported */ |
| 193 | short bi_fork; /* 1 if should fork before call */ | 195 | short bi_fork; /* 1 if should fork before call */ |
| 194 | short bi_wait; /* 1 if should wait for child */ | 196 | short bi_wait; /* 1 if should wait for child */ |
| 195 | void (*bi_fn)(int, struct servtab *); /* fn which performs it */ | 197 | void (*bi_fn)(int, servtab_t *); /* fn which performs it */ |
| 196 | }; | 198 | }; |
| 197 | 199 | ||
| 198 | /* Echo received data */ | 200 | /* Echo received data */ |
| 199 | #ifdef CONFIG_FEATURE_INETD_SUPPORT_BILTIN_ECHO | 201 | #ifdef CONFIG_FEATURE_INETD_SUPPORT_BILTIN_ECHO |
| 200 | static void echo_stream(int, struct servtab *); | 202 | static void echo_stream(int, servtab_t *); |
| 201 | static void echo_dg(int, struct servtab *); | 203 | static void echo_dg(int, servtab_t *); |
| 202 | #endif | 204 | #endif |
| 203 | /* Internet /dev/null */ | 205 | /* Internet /dev/null */ |
| 204 | #ifdef CONFIG_FEATURE_INETD_SUPPORT_BILTIN_DISCARD | 206 | #ifdef CONFIG_FEATURE_INETD_SUPPORT_BILTIN_DISCARD |
| 205 | static void discard_stream(int, struct servtab *); | 207 | static void discard_stream(int, servtab_t *); |
| 206 | static void discard_dg(int, struct servtab *); | 208 | static void discard_dg(int, servtab_t *); |
| 207 | #endif | 209 | #endif |
| 208 | /* Return 32 bit time since 1900 */ | 210 | /* Return 32 bit time since 1900 */ |
| 209 | #ifdef CONFIG_FEATURE_INETD_SUPPORT_BILTIN_TIME | 211 | #ifdef CONFIG_FEATURE_INETD_SUPPORT_BILTIN_TIME |
| 210 | static void machtime_stream(int, struct servtab *); | 212 | static void machtime_stream(int, servtab_t *); |
| 211 | static void machtime_dg(int, struct servtab *); | 213 | static void machtime_dg(int, servtab_t *); |
| 212 | #endif | 214 | #endif |
| 213 | /* Return human-readable time */ | 215 | /* Return human-readable time */ |
| 214 | #ifdef CONFIG_FEATURE_INETD_SUPPORT_BILTIN_DAYTIME | 216 | #ifdef CONFIG_FEATURE_INETD_SUPPORT_BILTIN_DAYTIME |
| 215 | static void daytime_stream(int, struct servtab *); | 217 | static void daytime_stream(int, servtab_t *); |
| 216 | static void daytime_dg(int, struct servtab *); | 218 | static void daytime_dg(int, servtab_t *); |
| 217 | #endif | 219 | #endif |
| 218 | /* Familiar character generator */ | 220 | /* Familiar character generator */ |
| 219 | #ifdef CONFIG_FEATURE_INETD_SUPPORT_BILTIN_CHARGEN | 221 | #ifdef CONFIG_FEATURE_INETD_SUPPORT_BILTIN_CHARGEN |
| 220 | static void chargen_stream(int, struct servtab *); | 222 | static void chargen_stream(int, servtab_t *); |
| 221 | static void chargen_dg(int, struct servtab *); | 223 | static void chargen_dg(int, servtab_t *); |
| 222 | #endif | 224 | #endif |
| 223 | 225 | ||
| 224 | static const struct biltin biltins[] = { | 226 | static const struct biltin biltins[] = { |
| @@ -285,10 +287,10 @@ syslog_err_and_discard_dg(int se_socktype, const char *msg, ...) | |||
| 285 | _exit(1); | 287 | _exit(1); |
| 286 | } | 288 | } |
| 287 | 289 | ||
| 288 | static struct servtab *getconfigent(void) | 290 | static servtab_t *getconfigent(void) |
| 289 | { | 291 | { |
| 290 | static struct servtab serv; | 292 | static servtab_t serv; |
| 291 | struct servtab *sep = &serv; | 293 | servtab_t *sep = &serv; |
| 292 | int argc; | 294 | int argc; |
| 293 | char *cp = NULL; | 295 | char *cp = NULL; |
| 294 | char *cp_ptr; | 296 | char *cp_ptr; |
| @@ -423,7 +425,7 @@ more: | |||
| 423 | return (sep); | 425 | return (sep); |
| 424 | } | 426 | } |
| 425 | 427 | ||
| 426 | static void freeconfig(struct servtab *cp) | 428 | static void freeconfig(servtab_t *cp) |
| 427 | { | 429 | { |
| 428 | int i; | 430 | int i; |
| 429 | 431 | ||
| @@ -461,7 +463,7 @@ static void setproctitle(char *a, int s) | |||
| 461 | #endif /* INETD_FEATURE_ENABLED */ | 463 | #endif /* INETD_FEATURE_ENABLED */ |
| 462 | 464 | ||
| 463 | 465 | ||
| 464 | static void setup(struct servtab *sep) | 466 | static void setup(servtab_t *sep) |
| 465 | { | 467 | { |
| 466 | int on = 1; | 468 | int on = 1; |
| 467 | 469 | ||
| @@ -529,7 +531,7 @@ static void setup(struct servtab *sep) | |||
| 529 | 531 | ||
| 530 | static void config(int signum) | 532 | static void config(int signum) |
| 531 | { | 533 | { |
| 532 | struct servtab *sep, *cp, **sepp; | 534 | servtab_t *sep, *cp, **sepp; |
| 533 | sigset_t oldmask; | 535 | sigset_t oldmask; |
| 534 | unsigned n; | 536 | unsigned n; |
| 535 | 537 | ||
| @@ -587,7 +589,7 @@ static void config(int signum) | |||
| 587 | // into the middle of a single line buffer for the config file. | 589 | // into the middle of a single line buffer for the config file. |
| 588 | //freeconfig(cp); // BUG? | 590 | //freeconfig(cp); // BUG? |
| 589 | } else { | 591 | } else { |
| 590 | sep = (struct servtab *)xmalloc(sizeof (*sep)); | 592 | sep = (servtab_t *)xmalloc(sizeof (*sep)); |
| 591 | *sep = *cp; | 593 | *sep = *cp; |
| 592 | sep->se_fd = -1; | 594 | sep->se_fd = -1; |
| 593 | sigprocmask(SIG_BLOCK, &blockmask, &oldmask); | 595 | sigprocmask(SIG_BLOCK, &blockmask, &oldmask); |
| @@ -671,7 +673,7 @@ static void reapchild(int signum) | |||
| 671 | { | 673 | { |
| 672 | int status; | 674 | int status; |
| 673 | int pid; | 675 | int pid; |
| 674 | struct servtab *sep; | 676 | servtab_t *sep; |
| 675 | 677 | ||
| 676 | (void)signum; | 678 | (void)signum; |
| 677 | for (;;) { | 679 | for (;;) { |
| @@ -697,7 +699,7 @@ static void reapchild(int signum) | |||
| 697 | 699 | ||
| 698 | static void retry(int signum) | 700 | static void retry(int signum) |
| 699 | { | 701 | { |
| 700 | struct servtab *sep; | 702 | servtab_t *sep; |
| 701 | 703 | ||
| 702 | (void)signum; | 704 | (void)signum; |
| 703 | timingout = 0; | 705 | timingout = 0; |
| @@ -715,7 +717,7 @@ static void retry(int signum) | |||
| 715 | 717 | ||
| 716 | static void goaway(int signum) | 718 | static void goaway(int signum) |
| 717 | { | 719 | { |
| 718 | struct servtab *sep; | 720 | servtab_t *sep; |
| 719 | 721 | ||
| 720 | (void)signum; | 722 | (void)signum; |
| 721 | for (sep = servtab; sep; sep = sep->se_next) | 723 | for (sep = servtab; sep; sep = sep->se_next) |
| @@ -729,7 +731,7 @@ static void goaway(int signum) | |||
| 729 | 731 | ||
| 730 | extern int inetd_main(int argc, char *argv[]) | 732 | extern int inetd_main(int argc, char *argv[]) |
| 731 | { | 733 | { |
| 732 | struct servtab *sep; | 734 | servtab_t *sep; |
| 733 | struct group *grp = NULL; | 735 | struct group *grp = NULL; |
| 734 | struct sigaction sa; | 736 | struct sigaction sa; |
| 735 | int pid; | 737 | int pid; |
| @@ -999,7 +1001,7 @@ extern int inetd_main(int argc, char *argv[]) | |||
| 999 | 1001 | ||
| 1000 | #ifdef CONFIG_FEATURE_INETD_SUPPORT_BILTIN_ECHO | 1002 | #ifdef CONFIG_FEATURE_INETD_SUPPORT_BILTIN_ECHO |
| 1001 | /* Echo service -- echo data back */ | 1003 | /* Echo service -- echo data back */ |
| 1002 | static void echo_stream(int s, struct servtab *sep) | 1004 | static void echo_stream(int s, servtab_t *sep) |
| 1003 | { | 1005 | { |
| 1004 | char buffer[BUFSIZE]; | 1006 | char buffer[BUFSIZE]; |
| 1005 | int i; | 1007 | int i; |
| @@ -1012,7 +1014,7 @@ static void echo_stream(int s, struct servtab *sep) | |||
| 1012 | } | 1014 | } |
| 1013 | 1015 | ||
| 1014 | /* Echo service -- echo data back */ | 1016 | /* Echo service -- echo data back */ |
| 1015 | static void echo_dg(int s, struct servtab *sep) | 1017 | static void echo_dg(int s, servtab_t *sep) |
| 1016 | { | 1018 | { |
| 1017 | char buffer[BUFSIZE]; | 1019 | char buffer[BUFSIZE]; |
| 1018 | int i; | 1020 | int i; |
| @@ -1031,7 +1033,7 @@ static void echo_dg(int s, struct servtab *sep) | |||
| 1031 | 1033 | ||
| 1032 | #ifdef CONFIG_FEATURE_INETD_SUPPORT_BILTIN_DISCARD | 1034 | #ifdef CONFIG_FEATURE_INETD_SUPPORT_BILTIN_DISCARD |
| 1033 | /* Discard service -- ignore data */ | 1035 | /* Discard service -- ignore data */ |
| 1034 | static void discard_stream(int s, struct servtab *sep) | 1036 | static void discard_stream(int s, servtab_t *sep) |
| 1035 | { | 1037 | { |
| 1036 | char buffer[BUFSIZE]; | 1038 | char buffer[BUFSIZE]; |
| 1037 | 1039 | ||
| @@ -1043,7 +1045,7 @@ static void discard_stream(int s, struct servtab *sep) | |||
| 1043 | } | 1045 | } |
| 1044 | 1046 | ||
| 1045 | /* Discard service -- ignore data */ | 1047 | /* Discard service -- ignore data */ |
| 1046 | static void discard_dg(int s, struct servtab *sep) | 1048 | static void discard_dg(int s, servtab_t *sep) |
| 1047 | { | 1049 | { |
| 1048 | char buffer[BUFSIZE]; | 1050 | char buffer[BUFSIZE]; |
| 1049 | (void)sep; | 1051 | (void)sep; |
| @@ -1070,7 +1072,7 @@ static void initring(void) | |||
| 1070 | } | 1072 | } |
| 1071 | 1073 | ||
| 1072 | /* Character generator */ | 1074 | /* Character generator */ |
| 1073 | static void chargen_stream(int s, struct servtab *sep) | 1075 | static void chargen_stream(int s, servtab_t *sep) |
| 1074 | { | 1076 | { |
| 1075 | char *rs; | 1077 | char *rs; |
| 1076 | int len; | 1078 | int len; |
| @@ -1101,7 +1103,7 @@ static void chargen_stream(int s, struct servtab *sep) | |||
| 1101 | } | 1103 | } |
| 1102 | 1104 | ||
| 1103 | /* Character generator */ | 1105 | /* Character generator */ |
| 1104 | static void chargen_dg(int s, struct servtab *sep) | 1106 | static void chargen_dg(int s, servtab_t *sep) |
| 1105 | { | 1107 | { |
| 1106 | struct sockaddr sa; | 1108 | struct sockaddr sa; |
| 1107 | static char *rs; | 1109 | static char *rs; |
| @@ -1154,7 +1156,7 @@ static long machtime(void) | |||
| 1154 | return (htonl((long)tv.tv_sec + 2208988800UL)); | 1156 | return (htonl((long)tv.tv_sec + 2208988800UL)); |
| 1155 | } | 1157 | } |
| 1156 | 1158 | ||
| 1157 | static void machtime_stream(int s, struct servtab *sep) | 1159 | static void machtime_stream(int s, servtab_t *sep) |
| 1158 | { | 1160 | { |
| 1159 | long result; | 1161 | long result; |
| 1160 | (void)sep; | 1162 | (void)sep; |
| @@ -1163,7 +1165,7 @@ static void machtime_stream(int s, struct servtab *sep) | |||
| 1163 | write(s, (char *) &result, sizeof(result)); | 1165 | write(s, (char *) &result, sizeof(result)); |
| 1164 | } | 1166 | } |
| 1165 | 1167 | ||
| 1166 | static void machtime_dg(int s, struct servtab *sep) | 1168 | static void machtime_dg(int s, servtab_t *sep) |
| 1167 | { | 1169 | { |
| 1168 | long result; | 1170 | long result; |
| 1169 | struct sockaddr sa; | 1171 | struct sockaddr sa; |
| @@ -1188,7 +1190,7 @@ static int human_readable_time_sprintf(char *buffer) | |||
| 1188 | return sprintf(buffer, "%.24s\r\n", ctime(&clocc)); | 1190 | return sprintf(buffer, "%.24s\r\n", ctime(&clocc)); |
| 1189 | } | 1191 | } |
| 1190 | 1192 | ||
| 1191 | static void daytime_stream(int s, struct servtab *sep) | 1193 | static void daytime_stream(int s, servtab_t *sep) |
| 1192 | { | 1194 | { |
| 1193 | char buffer[256]; | 1195 | char buffer[256]; |
| 1194 | size_t st = human_readable_time_sprintf(buffer); | 1196 | size_t st = human_readable_time_sprintf(buffer); |
| @@ -1199,7 +1201,7 @@ static void daytime_stream(int s, struct servtab *sep) | |||
| 1199 | } | 1201 | } |
| 1200 | 1202 | ||
| 1201 | /* Return human-readable time of day */ | 1203 | /* Return human-readable time of day */ |
| 1202 | static void daytime_dg(int s, struct servtab *sep) | 1204 | static void daytime_dg(int s, servtab_t *sep) |
| 1203 | { | 1205 | { |
| 1204 | char buffer[256]; | 1206 | char buffer[256]; |
| 1205 | struct sockaddr sa; | 1207 | struct sockaddr sa; |
