FreeBSD Bugzilla – Attachment 57310 Details for
Bug 86485
[patch] hexdump(1): hexdump -s speedup on /dev
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
hexdump.diff
hexdump.diff (text/plain; charset=us-ascii), 1.83 KB, created by
Alexander Best
on 2011-11-21 21:17:45 UTC
(
hide
)
Description:
hexdump.diff
Filename:
MIME Type:
Creator:
Alexander Best
Created:
2011-11-21 21:17:45 UTC
Size:
1.83 KB
patch
obsolete
>diff --git a/usr.bin/hexdump/display.c b/usr.bin/hexdump/display.c >index 991509d..8c8b065 100644 >--- a/usr.bin/hexdump/display.c >+++ b/usr.bin/hexdump/display.c >@@ -35,8 +35,10 @@ static char sccsid[] = "@(#)display.c 8.1 (Berkeley) 6/6/93"; > #include <sys/cdefs.h> > __FBSDID("$FreeBSD$"); > >+#include <sys/ioctl.h> > #include <sys/param.h> > #include <sys/stat.h> >+#include <sys/conf.h> > > #include <ctype.h> > #include <err.h> >@@ -368,7 +370,7 @@ next(char **argv) > void > doskip(const char *fname, int statok) > { >- int cnt; >+ int type; > struct stat sb; > > if (statok) { >@@ -380,16 +382,38 @@ doskip(const char *fname, int statok) > return; > } > } >- if (S_ISREG(sb.st_mode)) { >- if (fseeko(stdin, skip, SEEK_SET)) >+ if (S_ISFIFO(sb.st_mode) || S_ISSOCK(sb.st_mode)) { >+ noseek(); >+ return; >+ } >+ if (S_ISCHR(sb.st_mode) || S_ISBLK(sb.st_mode)) { >+ if (ioctl(fileno(stdin), FIODTYPE, &type)) > err(1, "%s", fname); >- address += skip; >- skip = 0; >- } else { >- for (cnt = 0; cnt < skip; ++cnt) >- if (getchar() == EOF) >- break; >- address += cnt; >- skip -= cnt; >+ /* >+ * Most tape drives don't support seeking, >+ * yet fseeko() would succeed. >+ */ >+ if (type & D_TAPE) { >+ noseek(); >+ return; >+ } >+ } >+ if (fseeko(stdin, skip, SEEK_SET)) { >+ noseek(); >+ return; > } >+ address += skip; >+ skip = 0; >+} >+ >+void >+noseek(void) >+{ >+ int count; >+ >+ for (count = 0; count < skip; ++count) >+ if (getchar() == EOF) >+ break; >+ address += count; >+ skip -= count; > } >diff --git a/usr.bin/hexdump/hexdump.h b/usr.bin/hexdump/hexdump.h >index be85bd9..1d4bb85 100644 >--- a/usr.bin/hexdump/hexdump.h >+++ b/usr.bin/hexdump/hexdump.h >@@ -97,6 +97,7 @@ u_char *get(void); > void newsyntax(int, char ***); > int next(char **); > void nomem(void); >+void noseek(void); > void oldsyntax(int, char ***); > size_t peek(u_char *, size_t); > void rewrite(FS *);
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 86485
:
57307
|
57308
|
57309
| 57310