Browse Source

light: remove whitespace between if and left parenthesis

Marco Wang 5 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
             // Options
248
             // Options
249
             
249
             
250
             case 'v':
250
             case 'v':
251
-                if (sscanf(optarg, "%i", &log_level) != 1)
251
+                if(sscanf(optarg, "%i", &log_level) != 1)
252
                 {
252
                 {
253
                     fprintf(stderr, "-v argument is not an integer.\n\n");
253
                     fprintf(stderr, "-v argument is not an integer.\n\n");
254
                     _light_print_usage();
254
                     _light_print_usage();
255
                     return false;
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
                     fprintf(stderr, "-v argument must be between 0 and 3.\n\n");
260
                     fprintf(stderr, "-v argument must be between 0 and 3.\n\n");
261
                     _light_print_usage();
261
                     _light_print_usage();
358
 
358
 
359
     if(need_value || need_float_value)
359
     if(need_value || need_float_value)
360
     {
360
     {
361
-        if ( (argc - optind) != 1)
361
+        if( (argc - optind) != 1)
362
         {
362
         {
363
             fprintf(stderr, "please specify a <value> for this command.\n\n");
363
             fprintf(stderr, "please specify a <value> for this command.\n\n");
364
             _light_print_usage();
364
             _light_print_usage();
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
                 fprintf(stderr, "<value> is not an integer.\n\n");
375
                 fprintf(stderr, "<value> is not an integer.\n\n");
376
                 _light_print_usage();
376
                 _light_print_usage();
380
         else
380
         else
381
         {
381
         {
382
             double percent_value = 0.0;
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
                 fprintf(stderr, "<value> is not a decimal.\n\n");
385
                 fprintf(stderr, "<value> is not a decimal.\n\n");
386
                 _light_print_usage();
386
                 _light_print_usage();
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
             fprintf(stderr, "<value> is not a float.\n\n");
407
             fprintf(stderr, "<value> is not a float.\n\n");
408
             _light_print_usage();
408
             _light_print_usage();
433
 
433
 
434
     // Setup the configuration folder
434
     // Setup the configuration folder
435
     // If we are root, use the system-wide configuration folder, otherwise try to find a user-specific folder, or fall back to ~/.config
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
         snprintf(new_ctx->sys_params.conf_dir, sizeof(new_ctx->sys_params.conf_dir), "%s", "/etc/light");
438
         snprintf(new_ctx->sys_params.conf_dir, sizeof(new_ctx->sys_params.conf_dir), "%s", "/etc/light");
439
     }
439
     }
441
     {
441
     {
442
         char *xdg_conf = getenv("XDG_CONFIG_HOME");
442
         char *xdg_conf = getenv("XDG_CONFIG_HOME");
443
         
443
         
444
-        if (xdg_conf != NULL)
444
+        if(xdg_conf != NULL)
445
         {
445
         {
446
             snprintf(new_ctx->sys_params.conf_dir, sizeof(new_ctx->sys_params.conf_dir), "%s/light", xdg_conf);
446
             snprintf(new_ctx->sys_params.conf_dir, sizeof(new_ctx->sys_params.conf_dir), "%s/light", xdg_conf);
447
         }
447
         }
453
     
453
     
454
     // Make sure the configuration folder exists, otherwise attempt to create it
454
     // Make sure the configuration folder exists, otherwise attempt to create it
455
     int32_t rc = light_mkpath(new_ctx->sys_params.conf_dir, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH);
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
         LIGHT_WARN("couldn't create configuration directory");
458
         LIGHT_WARN("couldn't create configuration directory");
459
         return false;
459
         return false;
789
     
789
     
790
     // Make sure the target folder exists, otherwise attempt to create it
790
     // Make sure the target folder exists, otherwise attempt to create it
791
     int32_t rc = light_mkpath(target_path, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH);
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
         LIGHT_ERR("couldn't create target directory for minimum brightness");
794
         LIGHT_ERR("couldn't create target directory for minimum brightness");
795
         return false;
795
         return false;
994
     
994
     
995
     // Make sure the target folder exists, otherwise attempt to create it
995
     // Make sure the target folder exists, otherwise attempt to create it
996
     int32_t rc = light_mkpath(target_path, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH);
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
         LIGHT_ERR("couldn't create target directory for save brightness");
999
         LIGHT_ERR("couldn't create target directory for save brightness");
1000
         return false;
1000
         return false;