git.annexia.org
/
libguestfs.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Add DeprecatedBy flag to mark functions which are deprecated.
[libguestfs.git]
/
fish
/
fish.c
diff --git
a/fish/fish.c
b/fish/fish.c
index
4042bbc
..
fdb2ba2
100644
(file)
--- a/
fish/fish.c
+++ b/
fish/fish.c
@@
-340,7
+340,9
@@
main (int argc, char *argv[])
if (!guestfs_get_autosync (g))
strcat (cmd, " -n");
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) {
r = system (cmd);
if (r == -1) {
@@
-514,6
+516,7
@@
script (int prompt)
char *argv[64];
int i, len;
int global_exit_on_error = !prompt;
char *argv[64];
int i, len;
int global_exit_on_error = !prompt;
+ int tilde_candidate;
if (prompt)
printf (_("\n"
if (prompt)
printf (_("\n"
@@
-587,6
+590,8
@@
script (int prompt)
/* Get the parameters. */
while (*p && i < sizeof argv / sizeof argv[0]) {
/* 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.
*/
/* Parameters which start with quotes or pipes are treated
* specially. Bare parameters are delimited by whitespace.
*/
@@
-647,6
+652,11
@@
script (int prompt)
*(pend-1) = '\0';
*/
} else if (*p != ' ' && *p != '\t') {
*(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';
len = strcspn (p, " \t");
if (p[len]) {
p[len] = '\0';
@@
-659,7
+669,11
@@
script (int prompt)
abort ();
}
abort ();
}
- argv[i++] = p;
+ if (!tilde_candidate)
+ argv[i] = p;
+ else
+ argv[i] = try_tilde_expansion (p);
+ i++;
p = pend;
if (*p)
p = pend;
if (*p)