aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorDavid M. Syzdek <david@syzdek.net>2022-09-10 12:04:46 -0800
committerDavid M. Syzdek <david@syzdek.net>2022-09-10 12:04:46 -0800
commitf82256db0dcade5a4ce646b173926962fc06618c (patch)
treef00ca377b8937e371fdd8d32c31dc4818163a9ca
parent7d256253b9d4448f5a34117f1d829a14ff908ce1 (diff)
downloadbindletools-f82256db0dcade5a4ce646b173926962fc06618c.tar.gz
bindletools-f82256db0dcade5a4ce646b173926962fc06618c.tar.bz2
bindletools-f82256db0dcade5a4ce646b173926962fc06618c.tar.xz
bindletools-f82256db0dcade5a4ce646b173926962fc06618c.zip
bindletools: refactoring -n option in encoding widgets
-rw-r--r--src/widget-encodings.c23
1 files changed, 9 insertions, 14 deletions
diff --git a/src/widget-encodings.c b/src/widget-encodings.c
index f4600f2..c06a694 100644
--- a/src/widget-encodings.c
+++ b/src/widget-encodings.c
@@ -180,6 +180,7 @@ bindle_widget_encodings(
180 int method ) 180 int method )
181{ 181{
182 int c; 182 int c;
183 int rc;
183 int opt_index; 184 int opt_index;
184 const char * str; 185 const char * str;
185 186
@@ -288,8 +289,14 @@ bindle_widget_encodings(
288 fflush(stdout); 289 fflush(stdout);
289 290
290 if ((str)) 291 if ((str))
291 return(bindle_widget_encodings_string(cnf, method, str)); 292 rc = bindle_widget_encodings_string(cnf, method, str);
292 return(bindle_widget_encodings_stdin(cnf, method)); 293 else
294 rc = bindle_widget_encodings_stdin(cnf, method);
295
296 if ((cnf->widget_flags & BINDLE_FLG_NEWLINE))
297 write(bindle_fdout, "\n", strlen("\n"));
298
299 return(rc);
293} 300}
294 301
295 302
@@ -319,12 +326,6 @@ bindle_widget_encodings_stdin(
319 return(1); 326 return(1);
320 }; 327 };
321 328
322 if ((cnf->widget_flags & BINDLE_FLG_NEWLINE))
323 {
324 bindle_strlcpy(res, "\n", sizeof(res));
325 write(bindle_fdout, res, strlen(res));
326 };
327
328 return(0); 329 return(0);
329} 330}
330 331
@@ -365,12 +366,6 @@ bindle_widget_encodings_string(
365 }; 366 };
366 }; 367 };
367 368
368 if ((cnf->widget_flags & BINDLE_FLG_NEWLINE))
369 {
370 bindle_strlcpy(res, "\n", sizeof(res));
371 write(bindle_fdout, res, strlen(res));
372 };
373
374 return(0); 369 return(0);
375} 370}
376 371