Blob Blame History Raw
commit 07a33095b0c057373bce5f5bf66eb8c4d1c45c91
Author: Hans Ulrich Niedermann <hun@n-dimensional.de>
Date:   Sat Jun 4 04:17:57 2016 +0200

    Fix indentation/if brace error
    
    As beep.c is not Python, the code blocks must be defined by
    using braces instead of just indenting them differently.
    
    Once we do that, the outcome of multiple -f parameters will
    actually match what the warning message documents beep does:
    Only the last -f value will be used.
    
    Many projects proscribe using braces everywhere, but this
    change keeps the beep.c coding style of using braces only
    when absolutely necessary.
    
    This issue was discovered by compiling with gcc 6.

diff --git a/beep.c b/beep.c
index 7da2e70..250be56 100644
--- a/beep.c
+++ b/beep.c
@@ -194,11 +194,12 @@ void parse_command_line(int argc, char **argv, beep_parms_t *result) {
       if(!sscanf(optarg, "%f", &argfreq) || (argfreq >= 20000 /* ack! */) || 
 	 (argfreq <= 0))
 	usage_bail(argv[0]);
-      else
+      else {
 	if (result->freq != 0)
 	  fprintf(stderr, "WARNING: multiple -f values given, only last "
 	    "one is used.\n");
-	result->freq = argfreq;    
+	result->freq = argfreq;
+      }
       break;
     case 'l' : /* length */
       if(!sscanf(optarg, "%d", &argval) || (argval < 0))