diff options
Diffstat (limited to 'lib/json.c')
| -rw-r--r-- | lib/json.c | 27 |
1 files changed, 21 insertions, 6 deletions
diff --git a/lib/json.c b/lib/json.c index c49a4f9074..186efc9f48 100644 --- a/lib/json.c +++ b/lib/json.c @@ -13,14 +13,14 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * - * You should have received a copy of the GNU General Public License - * along with GNU Zebra; see the file COPYING. If not, write to the Free - * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. + * You should have received a copy of the GNU General Public License along + * with this program; see the file COPYING; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #include <zebra.h> +#include "command.h" #include "lib/json.h" /* @@ -29,12 +29,12 @@ * what. */ int -use_json (const int argc, const char *argv[]) +use_json (const int argc, struct cmd_token *argv[]) { if (argc == 0) return 0; - if (argv[argc-1] && strcmp(argv[argc-1], "json") == 0) + if (argv[argc-1]->arg && strcmp(argv[argc-1]->arg, "json") == 0) return 1; return 0; @@ -86,3 +86,18 @@ json_object_free(struct json_object *obj) { json_object_put(obj); } + +#if !defined(HAVE_JSON_C_JSON_H) +int +json_object_object_get_ex(struct json_object *obj, + const char *key, + struct json_object **value) +{ + *value = json_object_object_get(obj, key); + + if (*value) + return 1; + + return 0; +} +#endif |
