From df189925e4a0e6f80b0aebbd78201db09a63daf3 Mon Sep 17 00:00:00 2001 From: Richard Jones Date: Thu, 30 Apr 2009 19:53:52 +0100 Subject: [PATCH] Added a comment syntax to guestfish (# ...). --- fish/fish.c | 5 +++++ guestfish.pod | 12 ++++++++++++ 2 files changed, 17 insertions(+) diff --git a/fish/fish.c b/fish/fish.c index a5fc337..894e351 100644 --- a/fish/fish.c +++ b/fish/fish.c @@ -354,6 +354,11 @@ script (int prompt) while (*buf && isspace (*buf)) buf++; + if (!*buf) continue; + + /* If the next character is '#' then this is a comment. */ + if (*buf == '#') continue; + /* Get the command (cannot be quoted). */ len = strcspn (buf, " \t"); diff --git a/guestfish.pod b/guestfish.pod index 45a2854..0e9967f 100644 --- a/guestfish.pod +++ b/guestfish.pod @@ -177,6 +177,18 @@ a space-separated list, enclosed in quotes. For example: vgcreate VG "/dev/sda1 /dev/sdb1" +=head1 COMMENTS + +Any line which starts with a I<#> character is treated as a comment +and ignored. The I<#> can optionally be preceeded by whitespace, +but B by a command. For example: + + # this is a comment + # this is a comment + foo # NOT a comment + +Blank lines are also ignored. + =head1 COMMANDS =head2 help -- 1.8.3.1