diff --git a/strbuf.c b/strbuf.c index 8212b444..d90a425e 100644 --- a/strbuf.c +++ b/strbuf.c @@ -1,6 +1,6 @@ /* Serval string buffer primitives -Copyright (C) 2012 The Serval Project +Copyright (C) 2012 Serval Project Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License diff --git a/strbuf.h b/strbuf.h index d1601a7c..cb9f1bb0 100644 --- a/strbuf.h +++ b/strbuf.h @@ -1,6 +1,6 @@ /* Serval string buffer primitives -Copyright (C) 2012 The Serval Project +Copyright (C) 2012 Serval Project Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License diff --git a/strbuf_helpers.c b/strbuf_helpers.c index 5b51d357..f775ccbc 100644 --- a/strbuf_helpers.c +++ b/strbuf_helpers.c @@ -1,6 +1,6 @@ /* Serval string buffer helper functions. -Copyright (C) 2012 The Serval Project +Copyright (C) 2012 Serval Project Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License diff --git a/strbuf_helpers.h b/strbuf_helpers.h index 21eb351e..59e5f6b6 100644 --- a/strbuf_helpers.h +++ b/strbuf_helpers.h @@ -1,6 +1,6 @@ /* Serval string buffer helper functions. -Copyright (C) 2012 The Serval Project +Copyright (C) 2012 Serval Project Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License @@ -51,13 +51,25 @@ strbuf strbuf_toprint_quoted(strbuf sb, char quote, const char *str); */ strbuf strbuf_append_poll_events(strbuf sb, short events); -/* Append a string as a quoted shell word. +/* Append a nul-terminated string as a single-quoted shell word which, if + * expanded in a shell command line, would evaluate to the original string. + * Eg: + * "abc" -> "'abc'" + * "" -> "''" + * "O'Toole" -> "'O'\''Toole'" + * * @author Andrew Bettison */ strbuf strbuf_append_shell_quote(strbuf sb, const char *word); -/* Append a string as a shell word, quoted if it contains shell metacharacters - * or spaces. +/* Append a nul-terminated string as a shell word, quoted if it contains shell + * metacharacters or spaces. In other words, is acts like + * str_append_shell_quote() but only if needed. Eg: + * "abc" -> "abc" + * "a b c " -> "'a b c '" + * "$abc" -> "'$abc'" + * "" -> "''" + * * @author Andrew Bettison */ strbuf strbuf_append_shell_quotemeta(strbuf sb, const char *word);