Skip to contentSkip to conversation

strings: new command

PATCH In review Sam Ravnborg 2 participants 3 messages Sep 17, 2016 – Sep 21, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 strings: new command

From 724382cf9aa173b6ced9fd213bbb369d9a5e3739 Mon Sep 17 00:00:00 2001
From: Sam Ravnborg <[email protected]>
Date: Sat, 17 Sep 2016 19:01:15 +0200
Subject: [PATCH 1/1] strings: new command

Implement a simple version of strings that will print printable strings from one or more files. Strings shall be at least 4 chars before thay are printed

---

I was in a situation where I missed "strings".
So here it is....
I started out with cat.c - but ended up re-writing everything.

It has seen light testing on my x86 box.
Ran it through checkpatch for good measure - fixed a few things.

The location in Makefile seems random, so I just put it next to cat.

Before applying please consider if strings is really general useful in barebox.

Sam

 commands/Kconfig   |  10 +++++
 commands/Makefile  |   1 +
 commands/strings.c | 121 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 132 insertions(+)
 create mode 100644 commands/strings.c
commands/Kconfig +10 -0
index 30bf429..2f9b5d8 100644
@@ -993,6 +993,16 @@ config CMD_SHA512SUM
 
 	  Calculate a SHA512 digest over a FILE or a memory area.
 
+config CMD_STRINGS
+	tristate
+	default y
+	prompt "strings"
+	help
+	  Display printable strings in file(s) to stdout
+
+	  Usage: strings FILE...
+
+
 config CMD_UNCOMPRESS
 	bool
 	select UNCOMPRESS
commands/Makefile +1 -0
index 601f15f..7b11d73 100644
@@ -32,6 +32,7 @@ obj-$(CONFIG_CMD_RMDIR)		+= rmdir.o
 obj-$(CONFIG_CMD_CP)		+= cp.o
 obj-$(CONFIG_CMD_RM)		+= rm.o
 obj-$(CONFIG_CMD_CAT)		+= cat.o
+obj-$(CONFIG_CMD_STRINGS)	+= strings.o
 obj-$(CONFIG_CMD_MOUNT)		+= mount.o
 obj-$(CONFIG_CMD_UMOUNT)	+= umount.o
 obj-$(CONFIG_CMD_REGINFO)	+= reginfo.o
commands/strings.c new file +121 -0

121 lines not on this page · raw message

Signature · 7 lines
1.8.3.1


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#1 lore raw
Quoted 11 lines

I was in a situation where I missed "strings".
So here it is....
I started out with cat.c - but ended up re-writing everything.

It has seen light testing on my x86 box.
Ran it through checkpatch for good measure - fixed a few things.

The location in Makefile seems random, so I just put it next to cat.

Before applying please consider if strings is really general useful in barebox.

In the end I had no use for strings in barebox, so another reason to consider if it is really needed.

Sam

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox

#2 lore raw
In reply to Sam Ravnborg
Quoted 16 lines · Sam Ravnborg

From 724382cf9aa173b6ced9fd213bbb369d9a5e3739 Mon Sep 17 00:00:00 2001
From: Sam Ravnborg <[email protected]>
Date: Sat, 17 Sep 2016 19:01:15 +0200
Subject: [PATCH 1/1] strings: new command

Implement a simple version of strings that will print printable strings from one or more files. Strings shall be at least 4 chars before thay are printed

---

I was in a situation where I missed "strings".
So here it is....
I started out with cat.c - but ended up re-writing everything.

Quoted 7 lines

It has seen light testing on my x86 box.
Ran it through checkpatch for good measure - fixed a few things.

The location in Makefile seems random, so I just put it next to cat.

Before applying please consider if strings is really general useful in barebox.

The first thing I tried is "strings /dev/ram0" Which gave me quite a long list, especially when Linux was bootet before ;)

I first thought this command might be useful for debugging, but probably it isn't because usually one wants to pipe the result through grep to limit the output. Also the next interesting thing to know is the position of a string which this command does not tell us.

I won't apply it, but it's on the list for reference if someone wants to use it. Maybe he/she can then tell us a good reason why this command should be merged.

Sascha

Signature · 9 lines
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox