Logo Search packages:      
Sourcecode: fence-agents version File versions  Download package

static int get_options_stdin ( char *  ip,
size_t  iplen,
char *  authtype,
size_t  atlen,
char *  passwd,
size_t  pwlen,
char *  pwd_script,
size_t  pwd_script_len,
char *  user,
size_t  userlen,
char *  op,
size_t  oplen,
int *  lanplus,
int *  verbose,
int *  timeout,
int *  power_wait,
int *  cipher,
char *  method,
int  methodlen,
char *  delay,
size_t  delaylen 
) [static]

Parse args from stdin. Dev + devlen + op + oplen must be valid.

Definition at line 704 of file ipmilan.c.

References cleanup().

Referenced by main().

{
      char in[256];
      int line = 0;
      char *name, *val;

      op[0] = 0;
      method[0] = 0;

      while (fgets(in, sizeof(in), stdin)) {
            ++line;

            if (in[0] == '#')
                  continue;

            if (cleanup(in, sizeof(in)) == -1)
                  continue;

            name = in;
            if ((val = strchr(in, '='))) {
                  *val = 0;
                  ++val;
            }

            if (!strcasecmp(name, "agent")) {
                  /* Used by fenced? */
            } else if (!strcasecmp(name, "verbose")) {
                  *verbose = 1;
            } else if (!strcasecmp(name, "ipaddr")) {
                  /* IP address to use.  E.g. 10.1.1.2 */
                  if (val)
                        strncpy(ip, val, iplen);
                  else
                        ip[0] = 0;

            } else if (!strcasecmp(name, "auth")) {
                  /* Authtype to use */
                  if (val)
                        strncpy(authtype, val, atlen);
                  else
                        authtype[0] = 0;

            } else if (!strcasecmp(name, "passwd")) {
                  /* password */
                  if (val)
                        strncpy(passwd, val, pwlen);
                  else
                        passwd[0] = 0;

            } else if (!strcasecmp(name, "passwd_script")) {
                  if (val) {
                        strncpy(pwd_script, val, pwd_script_len);
                        pwd_script[pwd_script_len - 1] = '\0';
                  } else
                        pwd_script[0] = '\0';
            } else if (!strcasecmp(name, "user") || !strcasecmp(name, "login")) {
                  /* username */
                  if (val)
                        strncpy(user, val, userlen);
                  else
                        user[0] = 0;
            } else if (!strcasecmp(name, "lanplus")) {
                  (*lanplus) = 1;
            } else if (!strcasecmp(name,"timeout")) {
                  if ((sscanf(val,"%d",timeout)!=1) || *timeout<1) {
                      *timeout=DEFAULT_TIMEOUT;
                  }
            } else if (!strcasecmp(name,"power_wait")) {
                  if ((sscanf(val,"%d",power_wait)!=1) || *power_wait<1) {
                      *power_wait=DEFAULT_POWER_WAIT;
                  }
            } else if (!strcasecmp(name,"cipher")) {
                  if ((sscanf(val,"%d",cipher)!=1) || *cipher<0) {
                      *cipher=-1;
                  }
            } else if (!strcasecmp(name,"method")) {
                  strncpy (method, val, methodlen);
            } else if (!strcasecmp(name, "option") ||
                     !strcasecmp(name, "operation") ||
                     !strcasecmp(name, "action")) {
                  if (val)
                        strncpy(op, val, oplen);
                  else
                        op[0] = 0;
            } else if (!strcasecmp(name,"delay")) {
                  if (val)
                        strncpy(delay, val, delaylen);
                  else
                        delay[0] = 0;
            }
      }

      return 0;
}

Here is the call graph for this function:

Here is the caller graph for this function:


Generated by  Doxygen 1.6.0   Back to index