Browse Source

Print errors to stderr

Abdullah ibn Nadjo 7 years ago
parent
commit
9032c14237
1 changed files with 7 additions and 7 deletions
  1. 7
    7
      src/light.c

+ 7
- 7
src/light.c View File

113
         light_Configuration.controllerMode = LIGHT_SPECIFY;
113
         light_Configuration.controllerMode = LIGHT_SPECIFY;
114
         if(optarg == NULL)
114
         if(optarg == NULL)
115
         {
115
         {
116
-          printf("-s NEEDS an argument.\n\n");
116
+          fprintf(stderr, "-s NEEDS an argument.\n\n");
117
           light_printHelp();
117
           light_printHelp();
118
         }
118
         }
119
 
119
 
141
       case 'v':
141
       case 'v':
142
         if(optarg == NULL)
142
         if(optarg == NULL)
143
         {
143
         {
144
-          printf("-v NEEDS an argument.\n\n");
144
+          fprintf(stderr, "-v NEEDS an argument.\n\n");
145
           light_printHelp();
145
           light_printHelp();
146
           return FALSE;
146
           return FALSE;
147
         }
147
         }
148
         if(sscanf(optarg, "%i", &verbosity) != 1)
148
         if(sscanf(optarg, "%i", &verbosity) != 1)
149
         {
149
         {
150
-          printf("-v Verbosity is not specified in a recognizable format.\n\n");
150
+          fprintf(stderr, "-v Verbosity is not specified in a recognizable format.\n\n");
151
           light_printHelp();
151
           light_printHelp();
152
           return FALSE;
152
           return FALSE;
153
         }
153
         }
154
         if(verbosity < 0 || verbosity > 3)
154
         if(verbosity < 0 || verbosity > 3)
155
         {
155
         {
156
-          printf("-v Verbosity has to be between 0 and 3.\n\n");
156
+          fprintf(stderr, "-v Verbosity has to be between 0 and 3.\n\n");
157
           light_printHelp();
157
           light_printHelp();
158
           return FALSE;
158
           return FALSE;
159
         }
159
         }
169
   {
169
   {
170
     if(argc - optind != 1)
170
     if(argc - optind != 1)
171
     {
171
     {
172
-      printf("Light needs an argument for <value>.\n\n");
172
+      fprintf(stderr, "Light needs an argument for <value>.\n\n");
173
       light_printHelp();
173
       light_printHelp();
174
       return FALSE;
174
       return FALSE;
175
     }
175
     }
177
     if(light_Configuration.valueMode == LIGHT_PERCENT)
177
     if(light_Configuration.valueMode == LIGHT_PERCENT)
178
     {
178
     {
179
       if(sscanf(argv[optind], "%lf", &light_Configuration.specifiedValuePercent) != 1){
179
       if(sscanf(argv[optind], "%lf", &light_Configuration.specifiedValuePercent) != 1){
180
-        printf("<value> is not specified in a recognizable format.\n\n");
180
+        fprintf(stderr, "<value> is not specified in a recognizable format.\n\n");
181
         light_printHelp();
181
         light_printHelp();
182
         return FALSE;
182
         return FALSE;
183
       }
183
       }
184
       light_Configuration.specifiedValuePercent = LIGHT_CLAMP(light_Configuration.specifiedValuePercent, 0.00, 100.00);
184
       light_Configuration.specifiedValuePercent = LIGHT_CLAMP(light_Configuration.specifiedValuePercent, 0.00, 100.00);
185
     }else{
185
     }else{
186
       if(sscanf(argv[optind], "%lu", &light_Configuration.specifiedValueRaw) != 1){
186
       if(sscanf(argv[optind], "%lu", &light_Configuration.specifiedValueRaw) != 1){
187
-        printf("<value> is not specified in a recognizable format.\n\n");
187
+        fprintf(stderr, "<value> is not specified in a recognizable format.\n\n");
188
         light_printHelp();
188
         light_printHelp();
189
         return FALSE;
189
         return FALSE;
190
       }
190
       }