- if (sc->t != CTOK_WORD || !isdigit((unsigned char)sc->d.buf[0]))
- error(sc, "parse error, argument of `conn' must be a number");
- sso->conn = atoi(sc->d.buf);
- if (sso->conn == 0)
- error(sc, "argument of `conn' must be positive");
- token(sc);
+ if (sc->t != CTOK_WORD)
+ error(sc, "parse error, expected `unlimited', `one-shot' or number");
+ if (isdigit((unsigned char)sc->d.buf[0])) {
+ sso->conn = atoi(sc->d.buf);
+ if (sso->conn == 0)
+ error(sc, "argument of `conn' must be positive");
+ sso->opt = SOCKOPT_LIMIT;
+ token(sc);
+ } else {
+ sso->conn = 0;
+ sso->opt = 1 + (1 & conf_enum(sc,
+ "unlimited,one-shot,infinite",
+ ENUM_ABBREV, "`conn' option"));
+ }