parse_line(): add stricter checks, return errors, process quotes

It all started with commit e2cb23b which added a comment after
a parameter, like this:

	CONFIGFILE="basic" # Use vswap-256m on RHEL6 kernel

Apparently current parser thinks that the value of CONFIGFILE is
everything that is to the left of = sign (except for " if it's at
the end of the line). Here is an amusing error message that I got
because of this:

File /etc/vz/conf/ve-basic" # Use vswap-256m on RHEL6 kernel.conf-sample not found: No such file or directory

While working on the fix I found out that everything that can't be
parsed by parse_line() is silently skipped. Not a good thing to do,
can be a source of confusion.

End result:
- if value is quoted, parse_line()
  - checks for the closing quote
  - only gets what's withing the quotes (and ignore the rest)
- the following errors are reported
  - line too long
  - unmatched quotes
  - no '=' sign

NOTE that the checks and the quote parsing code is still pretty basic
so not all errors are being caught. This is done this way because
the rest of the errors will be caught by parameters parsing code
or elsewhere in program logic (like the above 'file not found' message).

Signed-off-by: Kir Kolyshkin <kir@openvz.org>
4 files changed