From 6db017a32e379bb2eb7878771dea969f77c3168c Mon Sep 17 00:00:00 2001 From: Sergey Poznyakoff Date: Sat, 2 Jan 2016 23:58:06 +0200 Subject: Switch to new control interface. Old control options (--status, --restart-components) rewritten using piesctl. SIGUSR1 and SIGUSR2 no longer handled. * lib/arraymember.c (array_index): New function. * lib/libpies.h: Likewise. * src/cmdline.opt: Fix copyright years. * src/piesctl-cl.opt: Likewise. * src/ctl.c (ctlio_do_command): Implement restart. (pies_control_url): New function. (eval_env): rename json to result. New member cond. Restore pcond_ functions. (json_to_pcond): New function. (res_programs): Conditional selection of programs to list. Implement restart. * src/pies.c (ctlfile, statfile): Remove. (pies_keywords): Mark control-file and stat-file as inactive. (default_sigv): Remove SIGUSR1 and SIGUSR2 (pies_check_status): Don't send SIGUSR2. (stop_components): Remove. (request_restart_components): Rewrite as a wrapper. Call piesctl to do the job. (list_components): New function. * src/pies.h (ACTION_COMPRELOAD) (ACTION_DUMPSTATS): Remove. All callers changed. (progman_dump_stats): Remove. * src/piesctl.c (shttp_request_send): Don't initialize conn->req; the caller is responsible for that. (parse_condition, json_to_string) (parse_condition_to_uri): New functions. (com_list): Read conditional expression from the command line. (com_restart): Implement. * src/progman.c (progman_dump_stats): Remove. --- lib/arraymember.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) (limited to 'lib/arraymember.c') diff --git a/lib/arraymember.c b/lib/arraymember.c index 14ace99..010f4a1 100644 --- a/lib/arraymember.c +++ b/lib/arraymember.c @@ -1,5 +1,5 @@ /* This file is part of GNU Pies. - Copyright (C) 2007, 2008, 2009, 2010, 2013 Sergey Poznyakoff + Copyright (C) 2015, 2016 Sergey Poznyakoff GNU Pies is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -21,7 +21,7 @@ #include "libpies.h" int -is_array_member (char * const * ar, char const *str) +is_array_member (char * const *ar, char const *str) { for (; *ar; ++ar) { @@ -31,3 +31,16 @@ is_array_member (char * const * ar, char const *str) return 0; } +int +array_index (char * const *ar, char const *str) +{ + int i; + + for (i = 0; ar[i]; i++) + { + if (strcmp (ar[i], str) == 0) + return i; + } + return -1; +} + -- cgit v1.2.1