shithub: sox

Download patch

ref: f476d28859dcd301a45ea5dd8c7954df5a00714d
parent: 6b6a766c20d01ef57072def21d52ad26bc5f620b
author: robs <robs>
date: Tue Sep 2 02:59:21 EDT 2008

make this macro available elsewhere

--- a/src/sox_i.h
+++ b/src/sox_i.h
@@ -213,4 +213,15 @@
   } \
 }
 
+#define GETOPT_NUMERIC(ch, name, min, max) case ch:{ \
+  char * end_ptr; \
+  double d = strtod(optarg, &end_ptr); \
+  if (end_ptr == optarg || d < min || d > max || *end_ptr != '\0') {\
+    sox_fail("parameter `%s' must be between %g and %g", #name, (double)min, (double)max); \
+    return lsx_usage(effp); \
+  } \
+  p->name = d; \
+  break; \
+}
+
 #endif
--- a/src/spectrogram.c
+++ b/src/spectrogram.c
@@ -115,17 +115,6 @@
 #define secs(cols) \
   ((double)(cols) * p->step_size * p->block_steps / effp->in_signal.rate)
 
-#define GETOPT_NUMERIC(ch, name, min, max) case ch:{ \
-  char * end_ptr; \
-  double d = strtod(optarg, &end_ptr); \
-  if (end_ptr == optarg || d < min || d > max || *end_ptr != '\0') {\
-    sox_fail("parameter `%s' must be between %g and %g", #name, (double)min, (double)max); \
-    return lsx_usage(effp); \
-  } \
-  p->name = d; \
-  break; \
-}
-
 static int enum_option(int c, enum_item const * items)
 {
   enum_item const * p = find_enum_text(optarg, items);
@@ -578,7 +567,7 @@
       "\t-p num\tPermute colours\n"
       "\t-t text\tTitle text\n"
       "\t-c text\tComment text\n"
-      "\t-o text\tOutput file name, default `spectrogram.png'\n",
+      "\t-o text\tOutput file name, default `spectrogram.png'",
     0, getopts, start, flow, drain, stop, NULL, sizeof(priv_t)};
   return &handler;
 }