Patch from Felipe Kellermann, remove some unnecessary dups, i declared a few extra const's also.

This commit is contained in:
Glenn L McGrath 2004-09-14 17:24:59 +00:00
parent ab1955c236
commit d4004ee6a9
5 changed files with 18 additions and 19 deletions

View File

@ -699,7 +699,7 @@ static const llist_t *find_list_string(const llist_t *list, const char *string)
return(NULL); return(NULL);
} }
static struct interfaces_file_t *read_interfaces(char *filename) static struct interfaces_file_t *read_interfaces(const char *filename)
{ {
#ifdef CONFIG_FEATURE_IFUPDOWN_MAPPING #ifdef CONFIG_FEATURE_IFUPDOWN_MAPPING
struct mapping_defn_t *currmap = NULL; struct mapping_defn_t *currmap = NULL;
@ -1192,7 +1192,7 @@ extern int ifupdown_main(int argc, char **argv)
FILE *state_fp = NULL; FILE *state_fp = NULL;
llist_t *state_list = NULL; llist_t *state_list = NULL;
llist_t *target_list = NULL; llist_t *target_list = NULL;
char *interfaces = "/etc/network/interfaces"; const char *interfaces = "/etc/network/interfaces";
const char *statefile = "/var/run/ifstate"; const char *statefile = "/var/run/ifstate";
#ifdef CONFIG_FEATURE_IFUPDOWN_MAPPING #ifdef CONFIG_FEATURE_IFUPDOWN_MAPPING
@ -1219,7 +1219,7 @@ extern int ifupdown_main(int argc, char **argv)
{ {
switch (i) { switch (i) {
case 'i': /* interfaces */ case 'i': /* interfaces */
interfaces = bb_xstrdup(optarg); interfaces = optarg;
break; break;
case 'v': /* verbose */ case 'v': /* verbose */
verbose = 1; verbose = 1;

View File

@ -132,7 +132,7 @@ static char *ttype;
#endif #endif
#ifdef CONFIG_FEATURE_TELNET_AUTOLOGIN #ifdef CONFIG_FEATURE_TELNET_AUTOLOGIN
static char *autologin; static const char *autologin;
#endif #endif
#ifdef CONFIG_FEATURE_AUTOWIDTH #ifdef CONFIG_FEATURE_AUTOWIDTH
@ -663,7 +663,7 @@ extern int telnet_main(int argc, char** argv)
while ((opt = getopt(argc, argv, "al:")) != EOF) { while ((opt = getopt(argc, argv, "al:")) != EOF) {
switch (opt) { switch (opt) {
case 'l': case 'l':
autologin = bb_xstrdup(optarg); autologin = optarg;
break; break;
case 'a': case 'a':
autologin = getenv("USER"); autologin = getenv("USER");

View File

@ -1,4 +1,4 @@
/* $Id: telnetd.c,v 1.12 2004/06/22 10:07:17 andersen Exp $ /* $Id: telnetd.c,v 1.13 2004/09/14 17:24:58 bug1 Exp $
* *
* Simple telnet server * Simple telnet server
* Bjorn Wesen, Axis Communications AB (bjornw@axis.com) * Bjorn Wesen, Axis Communications AB (bjornw@axis.com)
@ -49,11 +49,10 @@
#define BUFSIZE 4000 #define BUFSIZE 4000
static const char *loginpath
#ifdef CONFIG_LOGIN #ifdef CONFIG_LOGIN
= "/bin/login"; static const char *loginpath = "/bin/login";
#else #else
; static const char *loginpath;
#endif #endif
static const char *issuefile = "/etc/issue.net"; static const char *issuefile = "/etc/issue.net";
@ -401,10 +400,10 @@ telnetd_main(int argc, char **argv)
if (c == EOF) break; if (c == EOF) break;
switch (c) { switch (c) {
case 'f': case 'f':
issuefile = strdup (optarg); issuefile = optarg;
break; break;
case 'l': case 'l':
loginpath = strdup (optarg); loginpath = optarg;
break; break;
#ifndef CONFIG_FEATURE_TELNETD_INETD #ifndef CONFIG_FEATURE_TELNETD_INETD
case 'p': case 'p':

View File

@ -485,8 +485,8 @@ static inline int tftp(const int cmd, const struct hostent *host,
int tftp_main(int argc, char **argv) int tftp_main(int argc, char **argv)
{ {
struct hostent *host = NULL; struct hostent *host = NULL;
char *localfile = NULL; const char *localfile = NULL;
char *remotefile = NULL; const char *remotefile = NULL;
int port; int port;
int cmd = 0; int cmd = 0;
int fd = -1; int fd = -1;
@ -538,10 +538,10 @@ int tftp_main(int argc, char **argv)
break; break;
#endif #endif
case 'l': case 'l':
localfile = bb_xstrdup(optarg); localfile = optarg;
break; break;
case 'r': case 'r':
remotefile = bb_xstrdup(optarg); remotefile = optarg;
break; break;
} }
} }

View File

@ -305,8 +305,8 @@ static const char *shortopts="+ao:l:n:qQs:Tu";
int getopt_main(int argc, char *argv[]) int getopt_main(int argc, char *argv[])
{ {
char *optstr=NULL; const char *optstr = NULL;
char *name=NULL; const char *name = NULL;
int opt; int opt;
int compatible=0; int compatible=0;
@ -340,14 +340,14 @@ int getopt_main(int argc, char *argv[])
break; break;
case 'o': case 'o':
free(optstr); free(optstr);
optstr=bb_xstrdup(optarg); optstr = optarg;
break; break;
case 'l': case 'l':
add_long_options(optarg); add_long_options(optarg);
break; break;
case 'n': case 'n':
free(name); free(name);
name=bb_xstrdup(optarg); name = optarg;
break; break;
case 'q': case 'q':
quiet_errors=1; quiet_errors=1;