fl2k file does not accept "-" as filename to read from stdin

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/osmocom-sdr@lists.osmocom.org/.

Ted Yapo ted.yapo at gmail.com
Mon May 21 05:36:34 UTC 2018


---
 src/fl2k_file.c | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/src/fl2k_file.c b/src/fl2k_file.c
index 1d3697d..a3df0f0 100644
--- a/src/fl2k_file.c
+++ b/src/fl2k_file.c
@@ -145,11 +145,15 @@ int main(int argc, char **argv)
        if (dev_index < 0)
                exit(1);

-       file = fopen(filename, "rb");
-       if (!file) {
-               fprintf(stderr, "Failed to open %s\n", filename);
-               goto out;
-       }
+  if (!strcmp(filename, "-")){
+    file = stdin;
+  } else {
+    file = fopen(filename, "rb");
+    if (!file) {
+      fprintf(stderr, "Failed to open %s\n", filename);
+      goto out;
+    }
+  }

        txbuf = malloc(FL2K_BUF_LEN);
        if (!txbuf) {
-- 
2.7.4


On Sun, May 20, 2018 at 1:27 PM, Sylvain Munaut <246tnt at gmail.com> wrote:

> Hi,
>
> > I'm perfectly willing to pitch in and fix this.  How do you prefer to
> > receive contributions?
>
> Patch posted on the mailing list, preferrably using git-send-email so
> the format is standardized.
>
> Cheers,
>
>     Sylvain
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/osmocom-sdr/attachments/20180521/aae104cd/attachment.htm>


More information about the osmocom-sdr mailing list