55
55
-T {bfdname}
56
56
Specify a non-default object file format.
57
57
58
+ --output-separator=sep_string
59
+ -s sep_string String used to separate parsed strings in output.
60
+ Default is newline.
61
+
58
62
--help
59
63
-h Print the usage message on the standard output.
60
64
@@ -114,6 +118,9 @@ static char *target;
114
118
static char encoding ;
115
119
static int encoding_bytes ;
116
120
121
+ /* Output string used to separate parsed strings */
122
+ static char * output_separator ;
123
+
117
124
static struct option long_options [] =
118
125
{
119
126
{"all" , no_argument , NULL , 'a' },
@@ -124,6 +131,7 @@ static struct option long_options[] =
124
131
{"include-all-whitespace" , required_argument , NULL , 'w' },
125
132
{"encoding" , required_argument , NULL , 'e' },
126
133
{"target" , required_argument , NULL , 'T' },
134
+ {"output-separator" , required_argument , NULL , 's' },
127
135
{"help" , no_argument , NULL , 'h' },
128
136
{"version" , no_argument , NULL , 'v' },
129
137
{NULL , 0 , NULL , 0 }
@@ -178,8 +186,9 @@ main (int argc, char **argv)
178
186
datasection_only = TRUE;
179
187
target = NULL ;
180
188
encoding = 's' ;
189
+ output_separator = NULL ;
181
190
182
- while ((optc = getopt_long (argc , argv , "adfhHn:wot:e:T:Vv0123456789" ,
191
+ while ((optc = getopt_long (argc , argv , "adfhHn:wot:e:T:s: Vv0123456789" ,
183
192
long_options , (int * ) 0 )) != EOF )
184
193
{
185
194
switch (optc )
@@ -248,6 +257,10 @@ main (int argc, char **argv)
248
257
encoding = optarg [0 ];
249
258
break ;
250
259
260
+ case 's' :
261
+ output_separator = optarg ;
262
+ break ;
263
+
251
264
case 'V' :
252
265
case 'v' :
253
266
print_version ("strings" );
@@ -650,7 +663,10 @@ print_strings (const char *filename, FILE *stream, file_ptr address,
650
663
putchar (c );
651
664
}
652
665
653
- putchar ('\n' );
666
+ if (output_separator )
667
+ fputs (output_separator , stdout );
668
+ else
669
+ putchar ('\n' );
654
670
}
655
671
free (buf );
656
672
}
@@ -681,6 +697,7 @@ usage (FILE *stream, int status)
681
697
-T --target=<BFDNAME> Specify the binary file format\n\
682
698
-e --encoding={s,S,b,l,B,L} Select character size and endianness:\n\
683
699
s = 7-bit, S = 8-bit, {b,l} = 16-bit, {B,L} = 32-bit\n\
700
+ -s --output-separator=<string> String used to separate strings in output.\n\
684
701
@<file> Read options from <file>\n\
685
702
-h --help Display this information\n\
686
703
-v -V --version Print the program's version number\n" ));
0 commit comments