Date:2011-06-07 00:38:42 (9 years 2 months ago)
Author:Werner Almesberger
Commit:533dc588242833d3e3df927d34855ec8b92da8e6
Message:atrf-gpio.c: rename anything "reg_op" to "command"

- atrf-gpio.c (bad_reg_op, reg_op): renamed "bad_reg_op" to
"bad_command"
- atrf-gpio.c (bad_command): error message is now "invalid command"
- atrf-gpio.c (reg_op, main): renamed "reg_op" to "command"
Files: tools/atrf-gpio/atrf-gpio.c (5 diffs)

Change Details

tools/atrf-gpio/atrf-gpio.c
5656/* ----- Commands ---------------------------------------------------------- */
5757
5858
59static void bad_reg_op(const char *arg)
59static void bad_command(const char *arg)
6060{
61    fprintf(stderr, "invalid operation \"%s\"\n", arg);
61    fprintf(stderr, "invalid command \"%s\"\n", arg);
6262    exit(1);
6363}
6464
6565
66static int reg_op(struct atrf_dsc *dsc, const char *arg, int doit)
66static int command(struct atrf_dsc *dsc, const char *arg, int doit)
6767{
6868    const char *p;
6969    char *end;
...... 
7878    if (!strncmp(arg, "delay=", 6)) {
7979        value = strtoul(arg+6, &end, 0);
8080        if (!value || *end)
81            bad_reg_op(arg);
81            bad_command(arg);
8282        if (doit)
8383            usleep(value*1000);
8484        return 1;
...... 
110110        return 0;
111111    reg = strtoul(arg, &end, 0);
112112    if (end != p || reg > 0xff)
113        bad_reg_op(arg);
113        bad_command(arg);
114114    value = strtoul(p+1, &end, 0);
115115    if (value > 0xff)
116        bad_reg_op(arg);
116        bad_command(arg);
117117    if (*end) {
118118        if (*p != ':')
119            bad_reg_op(arg);
119            bad_command(arg);
120120        if (*end != '/')
121            bad_reg_op(arg);
121            bad_command(arg);
122122        mask = strtoul(end+1, &end, 0);
123123        if (*end || mask > 0xff)
124            bad_reg_op(arg);
124            bad_command(arg);
125125    }
126126
127127    if (!doit)
...... 
293293    for (i = optind; i != argc; i++) {
294294        if (*argv[i] == '#')
295295            continue;
296        if (reg_op(NULL, argv[i], 0))
296        if (command(NULL, argv[i], 0))
297297            continue;
298298        for (s = argv[i]; *s; s++)
299299            if (!strchr("01HLhloZzx.", *s))
...... 
322322        for (i = optind; i != argc; i++) {
323323            if (*argv[i] == '#')
324324                continue;
325            if (reg_op(dsc, argv[i], 1))
325            if (command(dsc, argv[i], 1))
326326                continue;
327327            if (atrf_usb_handle(dsc))
328328                atusb(dsc, argv[i], argv[i+1]);

Archive Download the corresponding diff file



interactive