Imported Upstream version 2.6.1
This commit is contained in:
parent
459aaf9392
commit
a367d9bc54
178 changed files with 4651 additions and 3279 deletions
|
@ -47,7 +47,6 @@ subdir = server
|
|||
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
|
||||
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
|
||||
am__aclocal_m4_deps = $(top_srcdir)/m4/ax_compare_version.m4 \
|
||||
$(top_srcdir)/m4/ax_create_stdint_h.m4 \
|
||||
$(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
|
||||
$(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
|
||||
$(top_srcdir)/m4/lt~obsolete.m4 \
|
||||
|
|
|
@ -29,12 +29,12 @@
|
|||
#include "netinstcmd.h"
|
||||
|
||||
static void send_instcmd(ctype_t *client, const char *upsname,
|
||||
const char *cmdname)
|
||||
const char *cmdname, const char *value)
|
||||
{
|
||||
int found;
|
||||
upstype_t *ups;
|
||||
const cmdlist_t *ctmp;
|
||||
char sockcmd[SMALLBUF];
|
||||
char sockcmd[SMALLBUF], esc[SMALLBUF];
|
||||
|
||||
ups = get_ups_ptr(upsname);
|
||||
|
||||
|
@ -70,11 +70,20 @@ static void send_instcmd(ctype_t *client, const char *upsname,
|
|||
return;
|
||||
}
|
||||
|
||||
upslogx(LOG_INFO, "Instant command: %s@%s did %s on %s",
|
||||
client->username, client->addr, cmdname,
|
||||
ups->name);
|
||||
/* see if the user has also passed a value for this command */
|
||||
if (value != NULL) {
|
||||
upslogx(LOG_INFO, "Instant command: %s@%s did %s with value \"%s\" on %s",
|
||||
client->username, client->addr, cmdname, value, ups->name);
|
||||
|
||||
snprintf(sockcmd, sizeof(sockcmd), "INSTCMD %s\n", cmdname);
|
||||
snprintf(sockcmd, sizeof(sockcmd), "INSTCMD %s %s\n",
|
||||
cmdname, pconf_encode(value, esc, sizeof(esc)));
|
||||
}
|
||||
else {
|
||||
upslogx(LOG_INFO, "Instant command: %s@%s did %s on %s",
|
||||
client->username, client->addr, cmdname, ups->name);
|
||||
|
||||
snprintf(sockcmd, sizeof(sockcmd), "INSTCMD %s\n", cmdname);
|
||||
}
|
||||
|
||||
if (!sstate_sendline(ups, sockcmd)) {
|
||||
upslogx(LOG_INFO, "Set command send failed");
|
||||
|
@ -82,6 +91,7 @@ static void send_instcmd(ctype_t *client, const char *upsname,
|
|||
return;
|
||||
}
|
||||
|
||||
/* FIXME: need to retrieve the cookie number */
|
||||
sendback(client, "OK\n");
|
||||
}
|
||||
|
||||
|
@ -92,7 +102,7 @@ void net_instcmd(ctype_t *client, int numarg, const char **arg)
|
|||
return;
|
||||
}
|
||||
|
||||
/* INSTCMD <ups> <cmdname> */
|
||||
send_instcmd(client, arg[0], arg[1]);
|
||||
/* INSTCMD <ups> <cmdname> [<extra>]*/
|
||||
send_instcmd(client, arg[0], arg[1], (numarg == 3)?arg[2]:NULL);
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -204,7 +204,7 @@ static void list_ups(ctype_t *client)
|
|||
utmp->name, esc);
|
||||
|
||||
} else {
|
||||
ret = sendback(client, "UPS %s \"Unavailable\"\n",
|
||||
ret = sendback(client, "UPS %s \"Description unavailable\"\n",
|
||||
utmp->name);
|
||||
}
|
||||
|
||||
|
|
|
@ -452,7 +452,11 @@ static void parse_net(ctype_t *client)
|
|||
static void client_connect(stype_t *server)
|
||||
{
|
||||
struct sockaddr_storage csock;
|
||||
#if defined(__hpux) && !defined(_XOPEN_SOURCE_EXTENDED)
|
||||
int clen;
|
||||
#else
|
||||
socklen_t clen;
|
||||
#endif
|
||||
int fd;
|
||||
ctype_t *client;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue