From: Steve Dickson <steved@redhat.com>
To: Linux NFS Mailing list <linux-nfs@vger.kernel.org>
Subject: [PATCH 1/3] Make the stat command ignore lines that it is not looking for.
Date: Thu, 27 Jan 2011 13:49:32 -0500 [thread overview]
Message-ID: <1296154174-13076-2-git-send-email-steved@redhat.com> (raw)
In-Reply-To: <1296154174-13076-1-git-send-email-steved@redhat.com>
Signed-off-by: Steve Dickson <steved@redhat.com>
---
general/stat.c | 9 +++++++--
1 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/general/stat.c b/general/stat.c
index c4e4fc0..2ce604e 100644
--- a/general/stat.c
+++ b/general/stat.c
@@ -30,7 +30,7 @@ main(argc, argv)
{
FILE *fp;
int i, n;
- char c, *fmt;
+ char c, *fmt, buf[BUFSIZ];
int attfmt = 0; /* set if using att time format */
Prog = argv[0];
@@ -45,6 +45,7 @@ main(argc, argv)
Prog, File);
exit(1);
}
+getnewch:
if ((i = fgetc(fp)) == EOF) {
fprintf(stderr, "%s: %s is empty\n",
Prog, File);
@@ -53,8 +54,12 @@ main(argc, argv)
c = i & 0x7f;
if (c == '\n' || c == '\r' || c == 'r')
attfmt = 1;
- else
+ else if (isdigit(c))
fmt = "%lf %*s %lf %*s %lf %*s"; /* BSD fmt */
+ else { /* skip the line */
+ fgets(buf, BUFSIZ, fp);
+ goto getnewch;
+ }
if (ungetc(c, fp) == EOF) {
fprintf(stderr, "%s: can't push char back to %s\n",
Prog, File);
--
1.7.3.3
next prev parent reply other threads:[~2011-01-27 18:49 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-01-27 18:49 [PATCH 0/3] Connectathon: Remove warning from general tests Steve Dickson
2011-01-27 18:49 ` Steve Dickson [this message]
2011-01-27 18:49 ` [PATCH 2/3] Make the tbl table smaller to avoid a warning about line width Steve Dickson
2011-01-27 18:49 ` [PATCH 3/3] cthon04: add "nowarn" option to nroff.in tables Steve Dickson
2011-01-28 2:11 ` Jeff Layton
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1296154174-13076-2-git-send-email-steved@redhat.com \
--to=steved@redhat.com \
--cc=linux-nfs@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).