浏览代码

Print errors to stderr

Abdullah ibn Nadjo 7 年前
父节点
当前提交
9032c14237
共有 1 个文件被更改,包括 7 次插入7 次删除
  1. 7
    7
      src/light.c

+ 7
- 7
src/light.c 查看文件

@@ -113,7 +113,7 @@ LIGHT_BOOL light_parseArguments(int argc, char** argv)
113 113
         light_Configuration.controllerMode = LIGHT_SPECIFY;
114 114
         if(optarg == NULL)
115 115
         {
116
-          printf("-s NEEDS an argument.\n\n");
116
+          fprintf(stderr, "-s NEEDS an argument.\n\n");
117 117
           light_printHelp();
118 118
         }
119 119
 
@@ -141,19 +141,19 @@ LIGHT_BOOL light_parseArguments(int argc, char** argv)
141 141
       case 'v':
142 142
         if(optarg == NULL)
143 143
         {
144
-          printf("-v NEEDS an argument.\n\n");
144
+          fprintf(stderr, "-v NEEDS an argument.\n\n");
145 145
           light_printHelp();
146 146
           return FALSE;
147 147
         }
148 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 151
           light_printHelp();
152 152
           return FALSE;
153 153
         }
154 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 157
           light_printHelp();
158 158
           return FALSE;
159 159
         }
@@ -169,7 +169,7 @@ LIGHT_BOOL light_parseArguments(int argc, char** argv)
169 169
   {
170 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 173
       light_printHelp();
174 174
       return FALSE;
175 175
     }
@@ -177,14 +177,14 @@ LIGHT_BOOL light_parseArguments(int argc, char** argv)
177 177
     if(light_Configuration.valueMode == LIGHT_PERCENT)
178 178
     {
179 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 181
         light_printHelp();
182 182
         return FALSE;
183 183
       }
184 184
       light_Configuration.specifiedValuePercent = LIGHT_CLAMP(light_Configuration.specifiedValuePercent, 0.00, 100.00);
185 185
     }else{
186 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 188
         light_printHelp();
189 189
         return FALSE;
190 190
       }