aboutsummaryrefslogtreecommitdiff
path: root/toys/example/test_human_readable.c
blob: ae8e788853ffaaf05fadbe211e6352516cd859bd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
/* test_human_readable.c - Expose lib/lib.c human_readable() for testing.
 *
 * Copyright 2015 Rob Landley <rob@landley.net>

USE_TEST_HUMAN_READABLE(NEWTOY(test_human_readable, "<1>1ibs", 0))

config TEST_HUMAN_READABLE
  bool "test_human_readable"
  default n
  help
    usage: test_human_readable [-sbi] NUMBER
*/

#define FOR_test_human_readable
#include "toys.h"

void test_human_readable_main(void)
{
  char *c;

  human_readable(toybuf, strtoll(*toys.optargs, &c, 0), toys.optflags);
  printf("%s\n", toybuf);
}