apcsmart: remove unused field 'def' from cchar

In apc_ser_diff() reporting differences between tcgetattr/tcsetattr,
'def' field was unused (along with related defines).

Fossil-ID: SVN r3804
apcsmart: minor tidying up

comments, trivial changes, code shuffling ...

Fossil-ID: SVN r3805
apcsmart: add functions informing about [un]supported cmds/vars

In unified fashion, instead of each protocol-verification related
function doing it on its own.

Fossil-ID: SVN r3806
apcsmart: simplify query_ups()

This commit changes query_ups() function and makes it rely
on the same deprecate_vars() logic that protocol_verify() requires.

We can shorten the code a bit now, and it allows us to do more
simplifications in subsequent commits.

Fossil-ID: SVN r3807
apcsmart: shuffle two functions

query_ups() and oldapcsetup()

Fossil-ID: SVN r3808
apcsmart: add var_verify()

The function will be used in subsequent commit for common verification.

Fossil-ID: SVN r3809
apcsmart: simplify query_ups() / proto_verification()

Both functions rely now on common variable verificaion
function.

Fossil-ID: SVN r3810
apcsmart: cosmetics

- code shuffling, comments, flow
- rename query_ups() -> legacy_verify()
- add few lines of help directing to man page

Fossil-ID: SVN r3811
apcsmart: add var_string_setup()

In theory deprecate_vars() should also consider APC_STRING variables.
In practice - we don't have any variables that are both APC_MULTI and
APC_STRING - but it's more correct this way, so let's do it.

Fossil-ID: SVN r3812
apcsmart: adjust regex logic

A bit simpler / tighter now.

Fossil-ID: SVN r3813
apcsmart: getbaseinfo() fixup

In extremely unlikely case of failing write, report it up and act
accordingly.

Fossil-ID: SVN r3814
apcsmart: cleanup dstate ok/stale calls

Fossil-ID: SVN r3815
apcsmart: setup port after variable sanitization in upsdrv_initups()

Fossil-ID: SVN r3816
apcsmart: sdlist/sdtype/advorder changes

- verify 'advorder' with regex
- remove unused defines
- as the user is directed towards man page either way (and without it
  numbers are kind of meaningless), drop SDMAX

Fossil-ID: SVN r3817
apcsmart: serial related stuff a bit more strict

Also:

- apc_flush() now loops with >0 condition (otherwise errored apc_read()
  might cause inf loop)
- ser_comm_good/fail() were kind of missing in write wrappers

Fossil-ID: SVN r3818
apcsmart: apc_cmdtab[] fixup

Earlier commit that adjusted regex checks, also changed cmd fields for
all instant commands handled by custom functions. We cannot do that, as
they are not detected as supported this way.

Fossil-ID: SVN r3824
apcsmart: add prtchr() helper

Add prtchr() helper and simplify reporting when we check whether some
APC cmd/var character is or isn't printable.

Fossil-ID: SVN r3825
apcsmart: two fixups

In poll_data(): we are not supposed to set variable after its (formally
impossible) removal

In upsdrv_shutdown(): wrong comparison

Fossil-ID: SVN r3830
apcsmart: add update_info()

No need for almost identical update_info_normal() and update_info_all()

Fossil-ID: SVN r3831
apcsmart: allow timeout on read in smartmode()

As this function is used to "nudge" ups, we should expect it to
timeout.

Also avoids extra log spam.

Fossil-ID: SVN r3850