@@ -207,7 +207,8 @@ void fill_output()
207
207
208
208
static const struct option longopts [] =
209
209
{
210
- { "help" , no_argument , NULL , 'h' }
210
+ { "farenheit" , no_argument , NULL , 'f' }
211
+ , { "help" , no_argument , NULL , 'h' }
211
212
, { "nocolor" , no_argument , NULL , 'n' }
212
213
, { "reverse" , no_argument , NULL , 'r' }
213
214
, { "sort" , required_argument , NULL , 's' }
@@ -246,6 +247,7 @@ static void print_help(const char* argv0)
246
247
printf ("Usage: %s [OPTION]...\n\n" , progname );
247
248
printf (
248
249
"Mandatory arguments to long options are also mandatory for short options.\n"
250
+ " -f --farenheit Use Farenheit temperatur unit\n"
249
251
" -h --help Display this help message.\n"
250
252
" -n --nocolor Do not display color codes.\n"
251
253
" -r --reverse Reverse sort order.\n"
@@ -265,10 +267,13 @@ int main(int argc, char* argv[])
265
267
int sort_dir = 1 ;
266
268
int opt ;
267
269
268
- while (-1 != (opt = getopt_long (argc , argv , "hnrs :" , longopts , NULL )))
270
+ while (-1 != (opt = getopt_long (argc , argv , "fhnrs :" , longopts , NULL )))
269
271
{
270
272
switch (opt )
271
273
{
274
+ case 'f' :
275
+ output_fmt_temp_unit = TEMP_UNIT_FARENHEIT ;
276
+ break ;
272
277
case 'r' :
273
278
sort_dir = -1 ;
274
279
break ;
0 commit comments