Browse Source

light: remove whitespace between if and left parenthesis

Marco Wang 4 years ago
parent
commit
520d221ccd
1 changed files with 14 additions and 14 deletions
  1. 14
    14
      src/light.c

+ 14
- 14
src/light.c View File

@@ -248,14 +248,14 @@ static bool _light_parse_arguments(light_context_t *ctx, int argc, char** argv)
248 248
             // Options
249 249
             
250 250
             case 'v':
251
-                if (sscanf(optarg, "%i", &log_level) != 1)
251
+                if(sscanf(optarg, "%i", &log_level) != 1)
252 252
                 {
253 253
                     fprintf(stderr, "-v argument is not an integer.\n\n");
254 254
                     _light_print_usage();
255 255
                     return false;
256 256
                 }
257 257
                 
258
-                if (log_level < 0 || log_level > 3)
258
+                if(log_level < 0 || log_level > 3)
259 259
                 {
260 260
                     fprintf(stderr, "-v argument must be between 0 and 3.\n\n");
261 261
                     _light_print_usage();
@@ -358,7 +358,7 @@ static bool _light_parse_arguments(light_context_t *ctx, int argc, char** argv)
358 358
 
359 359
     if(need_value || need_float_value)
360 360
     {
361
-        if ( (argc - optind) != 1)
361
+        if( (argc - optind) != 1)
362 362
         {
363 363
             fprintf(stderr, "please specify a <value> for this command.\n\n");
364 364
             _light_print_usage();
@@ -366,11 +366,11 @@ static bool _light_parse_arguments(light_context_t *ctx, int argc, char** argv)
366 366
         }
367 367
     }
368 368
 
369
-    if (need_value)
369
+    if(need_value)
370 370
     {
371
-        if (ctx->run_params.raw_mode)
371
+        if(ctx->run_params.raw_mode)
372 372
         {
373
-            if (sscanf(argv[optind], "%lu", &ctx->run_params.value) != 1)
373
+            if(sscanf(argv[optind], "%lu", &ctx->run_params.value) != 1)
374 374
             {
375 375
                 fprintf(stderr, "<value> is not an integer.\n\n");
376 376
                 _light_print_usage();
@@ -380,7 +380,7 @@ static bool _light_parse_arguments(light_context_t *ctx, int argc, char** argv)
380 380
         else
381 381
         {
382 382
             double percent_value = 0.0;
383
-            if (sscanf(argv[optind], "%lf", &percent_value) != 1)
383
+            if(sscanf(argv[optind], "%lf", &percent_value) != 1)
384 384
             {
385 385
                 fprintf(stderr, "<value> is not a decimal.\n\n");
386 386
                 _light_print_usage();
@@ -400,9 +400,9 @@ static bool _light_parse_arguments(light_context_t *ctx, int argc, char** argv)
400 400
         }
401 401
     }
402 402
 
403
-    if (need_float_value)
403
+    if(need_float_value)
404 404
     {
405
-        if (sscanf(argv[optind], "%f", &ctx->run_params.float_value) != 1)
405
+        if(sscanf(argv[optind], "%f", &ctx->run_params.float_value) != 1)
406 406
         {
407 407
             fprintf(stderr, "<value> is not a float.\n\n");
408 408
             _light_print_usage();
@@ -433,7 +433,7 @@ light_context_t* light_initialize(int argc, char **argv)
433 433
 
434 434
     // Setup the configuration folder
435 435
     // If we are root, use the system-wide configuration folder, otherwise try to find a user-specific folder, or fall back to ~/.config
436
-    if (geteuid() == 0)
436
+    if(geteuid() == 0)
437 437
     {
438 438
         snprintf(new_ctx->sys_params.conf_dir, sizeof(new_ctx->sys_params.conf_dir), "%s", "/etc/light");
439 439
     }
@@ -441,7 +441,7 @@ light_context_t* light_initialize(int argc, char **argv)
441 441
     {
442 442
         char *xdg_conf = getenv("XDG_CONFIG_HOME");
443 443
         
444
-        if (xdg_conf != NULL)
444
+        if(xdg_conf != NULL)
445 445
         {
446 446
             snprintf(new_ctx->sys_params.conf_dir, sizeof(new_ctx->sys_params.conf_dir), "%s/light", xdg_conf);
447 447
         }
@@ -453,7 +453,7 @@ light_context_t* light_initialize(int argc, char **argv)
453 453
     
454 454
     // Make sure the configuration folder exists, otherwise attempt to create it
455 455
     int32_t rc = light_mkpath(new_ctx->sys_params.conf_dir, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH);
456
-    if (rc && errno != EEXIST)
456
+    if(rc && errno != EEXIST)
457 457
     {
458 458
         LIGHT_WARN("couldn't create configuration directory");
459 459
         return false;
@@ -789,7 +789,7 @@ bool light_cmd_set_min_brightness(light_context_t *ctx)
789 789
     
790 790
     // Make sure the target folder exists, otherwise attempt to create it
791 791
     int32_t rc = light_mkpath(target_path, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH);
792
-    if (rc && errno != EEXIST)
792
+    if(rc && errno != EEXIST)
793 793
     {
794 794
         LIGHT_ERR("couldn't create target directory for minimum brightness");
795 795
         return false;
@@ -994,7 +994,7 @@ bool light_cmd_save_brightness(light_context_t *ctx)
994 994
     
995 995
     // Make sure the target folder exists, otherwise attempt to create it
996 996
     int32_t rc = light_mkpath(target_path, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH);
997
-    if (rc && errno != EEXIST)
997
+    if(rc && errno != EEXIST)
998 998
     {
999 999
         LIGHT_ERR("couldn't create target directory for save brightness");
1000 1000
         return false;