summaryrefslogtreecommitdiffstats
path: root/commands
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2008-04-04 11:46:55 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2008-04-04 14:45:04 +0200
commit50cc8c5412e804480a10ecdd9546c7b6ad21760e (patch)
tree86d3a04fd004996fc91839b9a7cad705090bcdc0 /commands
parenta9912f68c65850d2bed12111aabe8b779c95e365 (diff)
downloadbarebox-50cc8c5412e804480a10ecdd9546c7b6ad21760e.tar.gz
barebox-50cc8c5412e804480a10ecdd9546c7b6ad21760e.tar.xz
Subject: [PATCH] [general] Fixed constant strings in data section issue
For practical reasons I changed all string literals assumed to be constant to reside in .rodata subsection at end of .text section. Signed-off-by: Carsten Schlote <schlote@vahanus.net> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'commands')
-rw-r--r--commands/bootm.c14
-rw-r--r--commands/cat.c2
-rw-r--r--commands/cd.c2
-rw-r--r--commands/cp.c2
-rw-r--r--commands/crc.c2
-rw-r--r--commands/edit.c10
-rw-r--r--commands/export.c2
-rw-r--r--commands/flash.c4
-rw-r--r--commands/go.c8
-rw-r--r--commands/loadenv.c2
-rw-r--r--commands/ls.c2
-rw-r--r--commands/mem.c8
-rw-r--r--commands/memtest.c3
-rw-r--r--commands/mkdir.c2
-rw-r--r--commands/mount.c2
-rw-r--r--commands/net.c4
-rwxr-xr-xcommands/partition.c4
-rw-r--r--commands/printenv.c11
-rw-r--r--commands/readline.c2
-rw-r--r--commands/rm.c2
-rw-r--r--commands/rmdir.c2
-rw-r--r--commands/saveenv.c2
-rw-r--r--commands/setenv.c13
-rw-r--r--commands/test.c8
-rw-r--r--commands/timeout.c2
-rw-r--r--commands/umount.c2
26 files changed, 65 insertions, 52 deletions
diff --git a/commands/bootm.c b/commands/bootm.c
index a7ab6b5407..e210059aa2 100644
--- a/commands/bootm.c
+++ b/commands/bootm.c
@@ -460,16 +460,18 @@ err_out:
return 1;
}
+static const __maybe_unused char cmd_bootm_help[] =
+"Usage: bootm [OPTION] image\n"
+"Boot application image\n"
+" -n do not verify the images (speeds up boot process)\n"
+" -h show advanced options\n";
+
+
U_BOOT_CMD_START(bootm)
.maxargs = CONFIG_MAXARGS,
.cmd = do_bootm,
.usage = "boot application image",
- U_BOOT_CMD_HELP(
- "Usage: bootm [OPTION] image\n"
- "Boot application image\n"
- " -n do not verify the images (speeds up boot process)\n"
- " -h show advanced options\n"
- )
+ U_BOOT_CMD_HELP(cmd_bootm_help)
U_BOOT_CMD_END
#ifdef CONFIG_CMD_IMI
diff --git a/commands/cat.c b/commands/cat.c
index 0840fdfeae..d6f9b7a6f9 100644
--- a/commands/cat.c
+++ b/commands/cat.c
@@ -84,7 +84,7 @@ out:
return err;
}
-static __maybe_unused char cmd_cat_help[] =
+static const __maybe_unused char cmd_cat_help[] =
"Usage: cat [FILES]\n"
"Concatenate files on stdout. Currently only printable characters\n"
"and \\n and \\t are printed, but this should be optional\n";
diff --git a/commands/cd.c b/commands/cd.c
index 5d5cacbf87..57141e3133 100644
--- a/commands/cd.c
+++ b/commands/cd.c
@@ -47,7 +47,7 @@ static int do_cd (cmd_tbl_t *cmdtp, int argc, char *argv[])
return 0;
}
-static __maybe_unused char cmd_cd_help[] =
+static const __maybe_unused char cmd_cd_help[] =
"Usage: cd [directory]\n"
"change to directory. If called without argument, change to /\n";
diff --git a/commands/cp.c b/commands/cp.c
index a9c10d4053..f2b8841121 100644
--- a/commands/cp.c
+++ b/commands/cp.c
@@ -134,7 +134,7 @@ out:
return ret;
}
-static __maybe_unused char cmd_cp_help[] =
+static const __maybe_unused char cmd_cp_help[] =
"Usage: cp <source> <destination>\n"
"cp copies file <source> to <destination>.\n"
"Currently only this form is supported and you have to specify the exact target\n"
diff --git a/commands/crc.c b/commands/crc.c
index f5a8e3bf3d..979d3b28a4 100644
--- a/commands/crc.c
+++ b/commands/crc.c
@@ -106,7 +106,7 @@ out:
return err;
}
-static __maybe_unused char cmd_crc_help[] =
+static const __maybe_unused char cmd_crc_help[] =
"Usage: crc32 [OPTION] [AREA]\n"
"Calculate a crc32 checksum of a memory area\n"
"Options:\n"
diff --git a/commands/edit.c b/commands/edit.c
index 3a685ebeef..6fb4a61efd 100644
--- a/commands/edit.c
+++ b/commands/edit.c
@@ -237,7 +237,7 @@ static int edit_read_file(const char *path)
if (!lineend)
break;
- linestr = lineend + 1;
+ linestr = lineend + 1;
}
free(filebuffer);
}
@@ -550,9 +550,9 @@ out:
return 0;
}
-static char *edit_aliases[] = { "sedit", NULL};
+static const char *edit_aliases[] = { "sedit", NULL};
-static __maybe_unused char cmd_edit_help[] =
+static const __maybe_unused char cmd_edit_help[] =
"Usage: (s)edit <file>\n"
"This is a very small editor. Its only features are moving the cursor with\n"
"the usual keys and typing characters.\n"
@@ -561,11 +561,13 @@ static __maybe_unused char cmd_edit_help[] =
"\n"
"If called as sedit the editor uses ansi codes to scroll the screen.\n";
+static const __maybe_unused char cmd_edit_usage[] = "edit a file";
+
U_BOOT_CMD_START(edit)
.maxargs = 2,
.cmd = do_edit,
.aliases = edit_aliases,
- .usage = "edit a file",
+ .usage = cmd_edit_usage,
U_BOOT_CMD_HELP(cmd_edit_help)
U_BOOT_CMD_END
diff --git a/commands/export.c b/commands/export.c
index b5eb5cf483..9ab75e454c 100644
--- a/commands/export.c
+++ b/commands/export.c
@@ -53,7 +53,7 @@ static int do_export ( cmd_tbl_t *cmdtp, int argc, char *argv[])
return 0;
}
-static __maybe_unused char cmd_export_help[] =
+static const __maybe_unused char cmd_export_help[] =
"Usage: export <var>[=value]...\n"
"export an environment variable to subsequently executed scripts\n";
diff --git a/commands/flash.c b/commands/flash.c
index cfbf903087..8dbfeeb8c4 100644
--- a/commands/flash.c
+++ b/commands/flash.c
@@ -85,7 +85,7 @@ static int do_flerase (cmd_tbl_t *cmdtp, int argc, char *argv[])
return 0;
}
-static __maybe_unused char cmd_erase_help[] =
+static const __maybe_unused char cmd_erase_help[] =
"Usage: Erase <device> [area]\n"
"Erase a flash device or parts of a device if an area specification\n"
"is given\n";
@@ -161,7 +161,7 @@ static int do_protect (cmd_tbl_t *cmdtp, int argc, char *argv[])
return 0;
}
-static __maybe_unused char cmd_protect_help[] =
+static const __maybe_unused char cmd_protect_help[] =
"Usage: (un)protect <device> [area]\n"
"(un)protect a flash device or parts of a device if an area specification\n"
"is given\n";
diff --git a/commands/go.c b/commands/go.c
index a1fd2f087f..7ba6b37be7 100644
--- a/commands/go.c
+++ b/commands/go.c
@@ -50,13 +50,13 @@ static int do_go (cmd_tbl_t *cmdtp, int argc, char *argv[])
return rcode;
}
-/* -------------------------------------------------------------------- */
+static const __maybe_unused char cmd_go_help[] =
+"addr [arg ...]\n - start application at address 'addr'\n"
+" passing 'arg' as arguments\n";
U_BOOT_CMD_START(go)
.maxargs = CONFIG_MAXARGS,
.cmd = do_go,
.usage = "start application at address 'addr'",
- U_BOOT_CMD_HELP(
- "addr [arg ...]\n - start application at address 'addr'\n"
- " passing 'arg' as arguments\n")
+ U_BOOT_CMD_HELP(cmd_go_help)
U_BOOT_CMD_END
diff --git a/commands/loadenv.c b/commands/loadenv.c
index 5db132cc37..ee76699415 100644
--- a/commands/loadenv.c
+++ b/commands/loadenv.c
@@ -43,7 +43,7 @@ static int do_loadenv(cmd_tbl_t *cmdtp, int argc, char *argv[])
return envfs_load(filename, dirname);
}
-static __maybe_unused char cmd_loadenv_help[] =
+static const __maybe_unused char cmd_loadenv_help[] =
"Usage: loadenv [ENVFS] [DIRECTORY]\n"
"Load the persistent storage contained in <envfs> to the directory\n"
"<directory>.\n"
diff --git a/commands/ls.c b/commands/ls.c
index b9263e645a..b0d6808390 100644
--- a/commands/ls.c
+++ b/commands/ls.c
@@ -152,7 +152,7 @@ static int do_ls (cmd_tbl_t *cmdtp, int argc, char *argv[])
return 0;
}
-static __maybe_unused char cmd_ls_help[] =
+static const __maybe_unused char cmd_ls_help[] =
"Usage: ls [OPTION]... [FILE]...\n"
"List information about the FILEs (the current directory by default).\n"
" -R list subdirectories recursively\n";
diff --git a/commands/mem.c b/commands/mem.c
index 8563b2d4d5..be71ee4cec 100644
--- a/commands/mem.c
+++ b/commands/mem.c
@@ -211,7 +211,7 @@ out:
return errno;
}
-static __maybe_unused char cmd_md_help[] =
+static const __maybe_unused char cmd_md_help[] =
"Usage md [OPTIONS] <region>\n"
"display (hexdump) a memory region.\n"
"options:\n"
@@ -292,7 +292,7 @@ static int do_mem_mw ( cmd_tbl_t *cmdtp, int argc, char *argv[])
return errno;
}
-static __maybe_unused char cmd_mw_help[] =
+static const __maybe_unused char cmd_mw_help[] =
"Usage: mw [OPTIONS] <region> <value(s)>\n"
"Write value(s) to the specifies region.\n"
"see 'help md' for supported options.\n";
@@ -396,7 +396,7 @@ out:
return ret;
}
-static __maybe_unused char cmd_memcmp_help[] =
+static const __maybe_unused char cmd_memcmp_help[] =
"Usage: memcmp [OPTIONS] <addr1> <addr2> <count>\n"
"\n"
"options:\n"
@@ -498,7 +498,7 @@ out:
return ret;
}
-static __maybe_unused char cmd_memcpy_help[] =
+static const __maybe_unused char cmd_memcpy_help[] =
"Usage: memcpy [OPTIONS] <src> <dst> <count>\n"
"\n"
"options:\n"
diff --git a/commands/memtest.c b/commands/memtest.c
index a1d2df03eb..16cc7ccb94 100644
--- a/commands/memtest.c
+++ b/commands/memtest.c
@@ -342,7 +342,7 @@ static int do_mem_mtest (cmd_tbl_t *cmdtp, int argc, char *argv[])
return mem_test(start, end, pattern);
}
-static __maybe_unused char cmd_mtest_help[] =
+static const __maybe_unused char cmd_mtest_help[] =
"Usage: <start> <end> "
#ifdef CONFIG_CMD_MTEST_ALTERNATIVE
"[pattern]"
@@ -353,5 +353,6 @@ U_BOOT_CMD_START(mtest)
.maxargs = 4,
.cmd = do_mem_mtest,
.usage = "simple RAM test",
+ U_BOOT_CMD_HELP(cmd_mtest_help)
U_BOOT_CMD_END
diff --git a/commands/mkdir.c b/commands/mkdir.c
index d6464e11c8..a2c298240a 100644
--- a/commands/mkdir.c
+++ b/commands/mkdir.c
@@ -63,7 +63,7 @@ static int do_mkdir (cmd_tbl_t *cmdtp, int argc, char *argv[])
return 0;
}
-static __maybe_unused char cmd_mkdir_help[] =
+static const __maybe_unused char cmd_mkdir_help[] =
"Usage: mkdir [directories]\n"
"Create new directories\n";
diff --git a/commands/mount.c b/commands/mount.c
index 03b63f04d1..eefcdfa86a 100644
--- a/commands/mount.c
+++ b/commands/mount.c
@@ -60,7 +60,7 @@ static int do_mount (cmd_tbl_t *cmdtp, int argc, char *argv[])
return 0;
}
-static __maybe_unused char cmd_mount_help[] =
+static const __maybe_unused char cmd_mount_help[] =
"Usage: mount: list mounted filesystems\n"
"or: mount <device> <fstype> <mountpoint>\n"
"\n"
diff --git a/commands/net.c b/commands/net.c
index 93c6365ef6..629f690096 100644
--- a/commands/net.c
+++ b/commands/net.c
@@ -94,7 +94,7 @@ static int do_tftpb (cmd_tbl_t *cmdtp, int argc, char *argv[])
return netboot_common (TFTP, cmdtp, argc, argv);
}
-static __maybe_unused char cmd_tftp_help[] =
+static const __maybe_unused char cmd_tftp_help[] =
"Usage: tftp <file> [localfile]\n"
"Load a file via network using BootP/TFTP protocol.\n";
@@ -173,7 +173,7 @@ static int do_nfs (cmd_tbl_t *cmdtp, int argc, char *argv[])
return netboot_common(NFS, cmdtp, argc, argv);
}
-static __maybe_unused char cmd_nfs_help[] =
+static const __maybe_unused char cmd_nfs_help[] =
"Usage: nfs <file> [localfile]\n"
"Load a file via network using nfs protocol.\n";
diff --git a/commands/partition.c b/commands/partition.c
index 164d4f0b5e..dfc4e0d1aa 100755
--- a/commands/partition.c
+++ b/commands/partition.c
@@ -226,7 +226,7 @@ err_out:
return 1;
}
-static __maybe_unused char cmd_addpart_help[] =
+static const __maybe_unused char cmd_addpart_help[] =
"Usage: addpart <device> <partition description>\n"
"\n"
"addpart adds a partition description to a device. The partition description\n"
@@ -286,7 +286,7 @@ static int do_delpart(cmd_tbl_t * cmdtp, int argc, char *argv[])
return 0;
}
-static __maybe_unused char cmd_delpart_help[] =
+static const __maybe_unused char cmd_delpart_help[] =
"Usage: delpart <device>\n"
"Delete partitions previously added to a device with addpart.\n";
diff --git a/commands/printenv.c b/commands/printenv.c
index 385596c2a3..8766a127d3 100644
--- a/commands/printenv.c
+++ b/commands/printenv.c
@@ -65,14 +65,17 @@ static int do_printenv (cmd_tbl_t *cmdtp, int argc, char *argv[])
return 0;
}
+static const __maybe_unused char cmd_printenv_help[] =
+"\n - print values of all environment variables\n"
+"printenv name ...\n"
+" - print value of environment variable 'name'\n";
+
+
U_BOOT_CMD_START(printenv)
.maxargs = CONFIG_MAXARGS,
.cmd = do_printenv,
.usage = "print environment variables",
- U_BOOT_CMD_HELP(
- "\n - print values of all environment variables\n"
- "printenv name ...\n"
- " - print value of environment variable 'name'\n")
+ U_BOOT_CMD_HELP(cmd_printenv_help)
U_BOOT_CMD_END
/**
diff --git a/commands/readline.c b/commands/readline.c
index 921b72aeb8..cd24f3508a 100644
--- a/commands/readline.c
+++ b/commands/readline.c
@@ -47,7 +47,7 @@ static int do_readline (cmd_tbl_t *cmdtp, int argc, char *argv[])
return 0;
}
-static __maybe_unused char cmd_readline_help[] =
+static const __maybe_unused char cmd_readline_help[] =
"Usage: readline <prompt> VAR\n"
"readline reads a line of user input into variable VAR.\n";
diff --git a/commands/rm.c b/commands/rm.c
index e8bc777eae..f8a84f3eab 100644
--- a/commands/rm.c
+++ b/commands/rm.c
@@ -44,7 +44,7 @@ static int do_rm (cmd_tbl_t *cmdtp, int argc, char *argv[])
return 0;
}
-static __maybe_unused char cmd_rm_help[] =
+static const __maybe_unused char cmd_rm_help[] =
"Usage: rm [FILES]\n"
"Remove files\n";
diff --git a/commands/rmdir.c b/commands/rmdir.c
index 182fa3760c..aaa7f80a72 100644
--- a/commands/rmdir.c
+++ b/commands/rmdir.c
@@ -23,7 +23,7 @@ static int do_rmdir (cmd_tbl_t *cmdtp, int argc, char *argv[])
return 0;
}
-static __maybe_unused char cmd_rmdir_help[] =
+static const __maybe_unused char cmd_rmdir_help[] =
"Usage: rmdir [directories]\n"
"Remove directories. The directories have to be empty.\n";
diff --git a/commands/saveenv.c b/commands/saveenv.c
index ef195bc13e..e0aef54ae1 100644
--- a/commands/saveenv.c
+++ b/commands/saveenv.c
@@ -90,7 +90,7 @@ out:
return ret;
}
-static __maybe_unused char cmd_saveenv_help[] =
+static const __maybe_unused char cmd_saveenv_help[] =
"Usage: saveenv [<envfs>] [<directory>]\n"
"Save the files in <directory> to the persistent storage device <envfs>.\n"
"<envfs> is normally a block in flash, but could be any other file.\n"
diff --git a/commands/setenv.c b/commands/setenv.c
index 2127da3a8f..b6fd81ad4b 100644
--- a/commands/setenv.c
+++ b/commands/setenv.c
@@ -40,15 +40,18 @@ static int do_setenv ( cmd_tbl_t *cmdtp, int argc, char *argv[])
return 0;
}
+static const __maybe_unused char cmd_setenv_help[] =
+"name value ...\n"
+" - set environment variable 'name' to 'value ...'\n"
+"setenv name\n"
+" - delete environment variable 'name'\n";
+
+
U_BOOT_CMD_START(setenv)
.maxargs = CONFIG_MAXARGS,
.cmd = do_setenv,
.usage = "set environment variables",
- U_BOOT_CMD_HELP(
- "name value ...\n"
- " - set environment variable 'name' to 'value ...'\n"
- "setenv name\n"
- " - delete environment variable 'name'\n")
+ U_BOOT_CMD_HELP(cmd_setenv_help)
U_BOOT_CMD_END
/**
diff --git a/commands/test.c b/commands/test.c
index fb986d47d2..67807c073f 100644
--- a/commands/test.c
+++ b/commands/test.c
@@ -220,17 +220,19 @@ out:
return expr;
}
-char *test_aliases[] = { "[", NULL};
+static const char *test_aliases[] = { "[", NULL};
-static __maybe_unused char cmd_test_help[] =
+static const __maybe_unused char cmd_test_help[] =
"Usage: test [OPTIONS]\n"
"options: !, =, !=, -eq, -ne, -ge, -gt, -le, -lt, -o, -a, -z, -n, -d, -e, -f\n"
"see 'man test' on your PC for more information.\n";
+static const __maybe_unused char cmd_test_usage[] = "minimal test like /bin/sh";
+
U_BOOT_CMD_START(test)
.aliases = test_aliases,
.maxargs = CONFIG_MAXARGS,
.cmd = do_test,
- .usage = "minimal test like /bin/sh",
+ .usage = cmd_test_usage,
U_BOOT_CMD_HELP(cmd_test_help)
U_BOOT_CMD_END
diff --git a/commands/timeout.c b/commands/timeout.c
index 639f361da1..3fa687c393 100644
--- a/commands/timeout.c
+++ b/commands/timeout.c
@@ -97,7 +97,7 @@ out:
return ret;
}
-static __maybe_unused char cmd_timeout_help[] =
+static const __maybe_unused char cmd_timeout_help[] =
"Usage: timeout [OPTION]... <timeout>\n"
"Wait <timeout> seconds for a timeout. Return 1 if the user intervented\n"
"or 0 if a timeout occured\n"
diff --git a/commands/umount.c b/commands/umount.c
index 3db3527aac..1314473cdd 100644
--- a/commands/umount.c
+++ b/commands/umount.c
@@ -40,7 +40,7 @@ static int do_umount (cmd_tbl_t *cmdtp, int argc, char *argv[])
return 0;
}
-static __maybe_unused char cmd_umount_help[] =
+static const __maybe_unused char cmd_umount_help[] =
"Usage: umount <mountpoint>\n"
"umount a filesystem mounted on a specific mountpoint\n";