~ubuntu-branches/ubuntu/saucy/nut/saucy

« back to all changes in this revision

Viewing changes to server/netinstcmd.c

  • Committer: Bazaar Package Importer
  • Author(s): Reinhard Tartler
  • Date: 2005-07-20 19:48:50 UTC
  • mto: (16.1.1 squeeze)
  • mto: This revision was merged to the branch mainline in revision 4.
  • Revision ID: james.westby@ubuntu.com-20050720194850-oo61wjr33rrx2mre
Tags: upstream-2.0.2
ImportĀ upstreamĀ versionĀ 2.0.2

Show diffs side-by-side

added added

removed removed

Lines of Context:
19
19
 
20
20
#include "common.h"
21
21
 
22
 
#include "upstype.h"
23
22
#include "upsd.h"
24
23
#include "sstate.h"
25
24
#include "state.h"
27
26
#include "user.h"                       /* for user_checkinstcmd */
28
27
#include "neterr.h"
29
28
 
 
29
#include "netinstcmd.h"
 
30
 
30
31
static void send_instcmd(ctype *client, const char *upsname, 
31
32
        const char *cmdname)
32
33
{
72
73
        }
73
74
 
74
75
        upslogx(LOG_INFO, "Instant command: %s@%s did %s on %s",
75
 
               client->username, client->addr, cmdname, 
76
 
               ups->name);
 
76
                client->username, client->addr, cmdname, 
 
77
                ups->name);
77
78
 
78
79
        snprintf(sockcmd, sizeof(sockcmd), "INSTCMD %s\n", cmdname);
79
80
 
86
87
        sendback(client, "OK\n");
87
88
}
88
89
 
89
 
int net_instcmd(ctype *client, int numarg, char **arg)
 
90
void net_instcmd(ctype *client, int numarg, const char **arg)
90
91
{
91
92
        if (numarg < 2) {
92
 
 
93
 
                /* can't do this until 2.0 - backwards compatibilty */
94
 
                /* send_err(client, NUT_ERR_INVALID_ARGUMENT); */
95
 
 
96
 
                return 0;       /* not handled - fall through */
 
93
                send_err(client, NUT_ERR_INVALID_ARGUMENT);
 
94
                return;
97
95
        }
98
 
 
99
 
        /* the old way only had one arg, so 2 args is for us */
100
 
 
 
96
        
 
97
        /* INSTCMD <ups> <cmdname> */
101
98
        send_instcmd(client, arg[0], arg[1]);
102
 
        return 1;       /* handled */
 
99
        return;
103
100
}