if (!guestfs_get_autosync (g))
strcat (cmd, " -n");
- /*printf ("%s\n", cmd);*/
+ if (verbose)
+ fprintf (stderr,
+ "guestfish -i: running virt-inspector command:\n%s\n", cmd);
r = system (cmd);
if (r == -1) {
}
void
-pod2text (const char *heading, const char *str)
+pod2text (const char *name, const char *shortdesc, const char *str)
{
FILE *fp;
/* pod2text failed, maybe not found, so let's just print the
* source instead, since that's better than doing nothing.
*/
- printf ("%s\n\n%s\n", heading, str);
+ printf ("%s - %s\n\n%s\n", name, shortdesc, str);
return;
}
- fputs ("=head1 ", fp);
- fputs (heading, fp);
- fputs ("\n\n", fp);
+ fprintf (fp, "=head1 %s - %s\n\n", name, shortdesc);
fputs (str, fp);
pclose (fp);
}
char *argv[64];
int i, len;
int global_exit_on_error = !prompt;
+ int tilde_candidate;
if (prompt)
printf (_("\n"
/* Get the parameters. */
while (*p && i < sizeof argv / sizeof argv[0]) {
+ tilde_candidate = 0;
+
/* Parameters which start with quotes or pipes are treated
* specially. Bare parameters are delimited by whitespace.
*/
*(pend-1) = '\0';
*/
} else if (*p != ' ' && *p != '\t') {
+ /* If the first character is a ~ then note that this parameter
+ * is a candidate for ~username expansion. NB this does not
+ * apply to quoted parameters.
+ */
+ tilde_candidate = *p == '~';
len = strcspn (p, " \t");
if (p[len]) {
p[len] = '\0';
abort ();
}
- argv[i++] = p;
+ if (!tilde_candidate)
+ argv[i] = p;
+ else
+ argv[i] = try_tilde_expansion (p);
+ i++;
p = pend;
if (*p)