/src/frr/ospfd/ospf_gr_clippy.c
Line | Count | Source (jump to first uncovered line) |
1 | | /* graceful_restart_prepare => "graceful-restart prepare ip ospf" */ |
2 | | DEFUN_CMD_FUNC_DECL(graceful_restart_prepare) |
3 | | #define funcdecl_graceful_restart_prepare static int graceful_restart_prepare_magic(\ |
4 | | const struct cmd_element *self __attribute__ ((unused)),\ |
5 | | struct vty *vty __attribute__ ((unused)),\ |
6 | | int argc __attribute__ ((unused)),\ |
7 | | struct cmd_token *argv[] __attribute__ ((unused))) |
8 | | funcdecl_graceful_restart_prepare; |
9 | | DEFUN_CMD_FUNC_TEXT(graceful_restart_prepare) |
10 | 0 | { |
11 | | #if 0 /* anything to parse? */ |
12 | | int _i; |
13 | | #if 0 /* anything that can fail? */ |
14 | | unsigned _fail = 0, _failcnt = 0; |
15 | | #endif |
16 | | |
17 | | for (_i = 0; _i < argc; _i++) { |
18 | | if (!argv[_i]->varname) |
19 | | continue; |
20 | | #if 0 /* anything that can fail? */ |
21 | | _fail = 0; |
22 | | #endif |
23 | | |
24 | | #if 0 /* anything that can fail? */ |
25 | | if (_fail) |
26 | | vty_out (vty, "%% invalid input for %s: %s\n", |
27 | | argv[_i]->varname, argv[_i]->arg); |
28 | | _failcnt += _fail; |
29 | | #endif |
30 | | } |
31 | | #if 0 /* anything that can fail? */ |
32 | | if (_failcnt) |
33 | | return CMD_WARNING; |
34 | | #endif |
35 | | #endif |
36 | |
|
37 | 0 | return graceful_restart_prepare_magic(self, vty, argc, argv); |
38 | 0 | } |
39 | | |
40 | | /* graceful_restart => "graceful-restart [grace-period (1-1800)$grace_period]" */ |
41 | | DEFUN_CMD_FUNC_DECL(graceful_restart) |
42 | | #define funcdecl_graceful_restart static int graceful_restart_magic(\ |
43 | | const struct cmd_element *self __attribute__ ((unused)),\ |
44 | | struct vty *vty __attribute__ ((unused)),\ |
45 | | int argc __attribute__ ((unused)),\ |
46 | | struct cmd_token *argv[] __attribute__ ((unused)),\ |
47 | | long grace_period,\ |
48 | | const char * grace_period_str __attribute__ ((unused))) |
49 | | funcdecl_graceful_restart; |
50 | | DEFUN_CMD_FUNC_TEXT(graceful_restart) |
51 | 0 | { |
52 | 0 | #if 1 /* anything to parse? */ |
53 | 0 | int _i; |
54 | 0 | #if 1 /* anything that can fail? */ |
55 | 0 | unsigned _fail = 0, _failcnt = 0; |
56 | 0 | #endif |
57 | 0 | long grace_period = 0; |
58 | 0 | const char *grace_period_str = NULL; |
59 | |
|
60 | 0 | for (_i = 0; _i < argc; _i++) { |
61 | 0 | if (!argv[_i]->varname) |
62 | 0 | continue; |
63 | 0 | #if 1 /* anything that can fail? */ |
64 | 0 | _fail = 0; |
65 | 0 | #endif |
66 | |
|
67 | 0 | if (!strcmp(argv[_i]->varname, "grace_period")) { |
68 | 0 | grace_period_str = argv[_i]->arg; |
69 | 0 | char *_end; |
70 | 0 | grace_period = strtol(argv[_i]->arg, &_end, 10); |
71 | 0 | _fail = (_end == argv[_i]->arg) || (*_end != '\0'); |
72 | 0 | } |
73 | 0 | #if 1 /* anything that can fail? */ |
74 | 0 | if (_fail) |
75 | 0 | vty_out (vty, "%% invalid input for %s: %s\n", |
76 | 0 | argv[_i]->varname, argv[_i]->arg); |
77 | 0 | _failcnt += _fail; |
78 | 0 | #endif |
79 | 0 | } |
80 | 0 | #if 1 /* anything that can fail? */ |
81 | 0 | if (_failcnt) |
82 | 0 | return CMD_WARNING; |
83 | 0 | #endif |
84 | 0 | #endif |
85 | | |
86 | 0 | return graceful_restart_magic(self, vty, argc, argv, grace_period, grace_period_str); |
87 | 0 | } |
88 | | |
89 | | /* no_graceful_restart => "no graceful-restart [grace-period (1-1800)]" */ |
90 | | DEFUN_CMD_FUNC_DECL(no_graceful_restart) |
91 | | #define funcdecl_no_graceful_restart static int no_graceful_restart_magic(\ |
92 | | const struct cmd_element *self __attribute__ ((unused)),\ |
93 | | struct vty *vty __attribute__ ((unused)),\ |
94 | | int argc __attribute__ ((unused)),\ |
95 | | struct cmd_token *argv[] __attribute__ ((unused)),\ |
96 | | long grace_period,\ |
97 | | const char * grace_period_str __attribute__ ((unused))) |
98 | | funcdecl_no_graceful_restart; |
99 | | DEFUN_CMD_FUNC_TEXT(no_graceful_restart) |
100 | 0 | { |
101 | 0 | #if 1 /* anything to parse? */ |
102 | 0 | int _i; |
103 | 0 | #if 1 /* anything that can fail? */ |
104 | 0 | unsigned _fail = 0, _failcnt = 0; |
105 | 0 | #endif |
106 | 0 | long grace_period = 0; |
107 | 0 | const char *grace_period_str = NULL; |
108 | |
|
109 | 0 | for (_i = 0; _i < argc; _i++) { |
110 | 0 | if (!argv[_i]->varname) |
111 | 0 | continue; |
112 | 0 | #if 1 /* anything that can fail? */ |
113 | 0 | _fail = 0; |
114 | 0 | #endif |
115 | |
|
116 | 0 | if (!strcmp(argv[_i]->varname, "grace_period")) { |
117 | 0 | grace_period_str = argv[_i]->arg; |
118 | 0 | char *_end; |
119 | 0 | grace_period = strtol(argv[_i]->arg, &_end, 10); |
120 | 0 | _fail = (_end == argv[_i]->arg) || (*_end != '\0'); |
121 | 0 | } |
122 | 0 | #if 1 /* anything that can fail? */ |
123 | 0 | if (_fail) |
124 | 0 | vty_out (vty, "%% invalid input for %s: %s\n", |
125 | 0 | argv[_i]->varname, argv[_i]->arg); |
126 | 0 | _failcnt += _fail; |
127 | 0 | #endif |
128 | 0 | } |
129 | 0 | #if 1 /* anything that can fail? */ |
130 | 0 | if (_failcnt) |
131 | 0 | return CMD_WARNING; |
132 | 0 | #endif |
133 | 0 | #endif |
134 | | |
135 | 0 | return no_graceful_restart_magic(self, vty, argc, argv, grace_period, grace_period_str); |
136 | 0 | } |
137 | | |