summaryrefslogtreecommitdiff
path: root/networking/inetd.c
diff options
context:
space:
mode:
authorGlenn L McGrath <bug1@ihug.co.nz>2004-02-18 13:19:58 +0000
committerGlenn L McGrath <bug1@ihug.co.nz>2004-02-18 13:19:58 +0000
commit03a0643fbc5ae3e1ab2e7e29bb64617a4b94a5c9 (patch)
treed7818492581f8e2046c7bfcc06106259696145e6 /networking/inetd.c
parent82d42dbb57d45c077c2d8c933e0c745d989e4d97 (diff)
downloadbusybox-w32-03a0643fbc5ae3e1ab2e7e29bb64617a4b94a5c9.tar.gz
busybox-w32-03a0643fbc5ae3e1ab2e7e29bb64617a4b94a5c9.tar.bz2
busybox-w32-03a0643fbc5ae3e1ab2e7e29bb64617a4b94a5c9.zip
Dont use same variable and struct name
Diffstat (limited to 'networking/inetd.c')
-rw-r--r--networking/inetd.c72
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
162static struct servtab { 162typedef 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
189static servtab_t *servtab;
188 190
189#ifdef INETD_FEATURE_ENABLED 191#ifdef INETD_FEATURE_ENABLED
190struct biltin { 192struct 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
200static void echo_stream(int, struct servtab *); 202static void echo_stream(int, servtab_t *);
201static void echo_dg(int, struct servtab *); 203static 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
205static void discard_stream(int, struct servtab *); 207static void discard_stream(int, servtab_t *);
206static void discard_dg(int, struct servtab *); 208static 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
210static void machtime_stream(int, struct servtab *); 212static void machtime_stream(int, servtab_t *);
211static void machtime_dg(int, struct servtab *); 213static 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
215static void daytime_stream(int, struct servtab *); 217static void daytime_stream(int, servtab_t *);
216static void daytime_dg(int, struct servtab *); 218static 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
220static void chargen_stream(int, struct servtab *); 222static void chargen_stream(int, servtab_t *);
221static void chargen_dg(int, struct servtab *); 223static void chargen_dg(int, servtab_t *);
222#endif 224#endif
223 225
224static const struct biltin biltins[] = { 226static 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
288static struct servtab *getconfigent(void) 290static 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
426static void freeconfig(struct servtab *cp) 428static 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
464static void setup(struct servtab *sep) 466static 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
530static void config(int signum) 532static 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
698static void retry(int signum) 700static 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
716static void goaway(int signum) 718static 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
730extern int inetd_main(int argc, char *argv[]) 732extern 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 */
1002static void echo_stream(int s, struct servtab *sep) 1004static 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 */
1015static void echo_dg(int s, struct servtab *sep) 1017static 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 */
1034static void discard_stream(int s, struct servtab *sep) 1036static 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 */
1046static void discard_dg(int s, struct servtab *sep) 1048static 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 */
1073static void chargen_stream(int s, struct servtab *sep) 1075static 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 */
1104static void chargen_dg(int s, struct servtab *sep) 1106static 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
1157static void machtime_stream(int s, struct servtab *sep) 1159static 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
1166static void machtime_dg(int s, struct servtab *sep) 1168static 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
1191static void daytime_stream(int s, struct servtab *sep) 1193static 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 */
1202static void daytime_dg(int s, struct servtab *sep) 1204static 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;