xpp: astribank_hexload: allow empty span specs v2.10.0 v2.10.0-rc1
authorTzafrir Cohen <tzafrir.cohen@xorcom.com>
Thu, 31 Jul 2014 14:57:32 +0000 (17:57 +0300)
committerTzafrir Cohen <tzafrir.cohen@xorcom.com>
Mon, 4 Aug 2014 06:35:52 +0000 (09:35 +0300)
DAHDI 2.9.2 added support for -S (span specs). However if this option
was not specified, it fails to run.

Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>

xpp/astribank_hexload.c

index 582dd40..643fe57 100644 (file)
@@ -39,6 +39,7 @@
 #define        DBG_MASK        0x80
 #define        MAX_HEX_LINES   64000
 #define HAVE_OCTASIC   1
+#define DEF_SPAN_SPEC_FORMAT   "*:%c1" /* %c: 'E' or 'T' */
 
 static char    *progname;
 
@@ -166,6 +167,7 @@ int main(int argc, char *argv[])
 #if HAVE_OCTASIC
        int                     opt_alaw = 0;
        const char              *span_spec = NULL;
+       char                    def_span_spec[sizeof(DEF_SPAN_SPEC_FORMAT)];
 #endif
        int                     opt_dest = 0;
        int                     opt_sum = 0;
@@ -252,6 +254,13 @@ int main(int argc, char *argv[])
                ERR("Missing device path.\n");
                usage();
        }
+# ifdef HAVE_OCTASIC
+       if (!span_spec) {
+               snprintf(def_span_spec, sizeof(def_span_spec),
+                               DEF_SPAN_SPEC_FORMAT, opt_alaw? 'E' : 'T');
+               span_spec = def_span_spec;
+       }
+#endif
        if(opt_dest) {
                /*
                 * MPP Interface