Coding Guidelines/Quoting

From The Open Source Backup Wiki (Amanda, MySQL Backup, BackupPC)

Jump to: navigation, search

Amanda's approach to quoting is to quote strings only when they need to be quoted (e.g., they contain spaces or funny characters). This has the effect of being backward-compatible with versions of Amanda where nothing was quoted, as long as there are no spaces or funny characters in the strings. The particular syntax of the quoted strings is described in Quoting.

The two main interfaces to this algorithm are quote_string and unquote_string, defined in common-src/util.h and Amanda::Util. These do just what they say, returning a newly allocated string quoting added and removed, respectively.

The function split_quoted_strings takes a single string and splits it into words, similar to the way a shell would. That is, unquoted space-delimited words are split, but quoted spaces to not form word breaks. The lesser-used function skip_quoted_string splits the first quoted string off of the beginning of its input.

Personal tools