summaryrefslogtreecommitdiffstats
path: root/misc-utils/look.c
diff options
context:
space:
mode:
authorKarel Zak2006-12-07 00:25:41 +0100
committerKarel Zak2006-12-07 00:25:41 +0100
commiteb63b9b8f4cecb34c2478282567862bc48ef256d (patch)
tree99243f8eecb44c2bb6a559982b99c680fcb649e7 /misc-utils/look.c
parentImported from util-linux-2.9v tarball. (diff)
downloadkernel-qcow2-util-linux-eb63b9b8f4cecb34c2478282567862bc48ef256d.tar.gz
kernel-qcow2-util-linux-eb63b9b8f4cecb34c2478282567862bc48ef256d.tar.xz
kernel-qcow2-util-linux-eb63b9b8f4cecb34c2478282567862bc48ef256d.zip
Imported from util-linux-2.10f tarball.
Diffstat (limited to 'misc-utils/look.c')
-rw-r--r--misc-utils/look.c18
1 files changed, 7 insertions, 11 deletions
diff --git a/misc-utils/look.c b/misc-utils/look.c
index 9e6c15bf8..a8e826fa4 100644
--- a/misc-utils/look.c
+++ b/misc-utils/look.c
@@ -74,7 +74,7 @@ char *string;
char *comparbuf;
static char *binary_search (char *, char *);
-static int compare (char *, char *, int);
+static int compare (char *, char *);
static void err (const char *fmt, ...);
static char *linear_search (char *, char *);
static int look (char *, char *);
@@ -192,10 +192,6 @@ look(char *front, char *back)
* back points to the beginning of a line at or after the first
* matching line.
*
- * Base of the Invariants.
- * front = NULL;
- * back = EOF;
- *
* Advancing the Invariants:
*
* p = first newline after halfway point from front to back.
@@ -232,7 +228,7 @@ binary_search(char *front, char *back)
* infinitely loop.
*/
while (p < back && back > front) {
- if (compare(p, back, 1) == GREATER)
+ if (compare(p, back) == GREATER)
front = p;
else
back = p;
@@ -257,7 +253,7 @@ char *
linear_search(char *front, char *back)
{
while (front < back) {
- switch (compare(front, back, 1)) {
+ switch (compare(front, back)) {
case EQUAL: /* Found it. */
return (front);
break;
@@ -280,8 +276,8 @@ print_from(char *front, char *back)
{
int eol;
- while (front < back && compare(front, back, 1) == EQUAL) {
- if (compare(front, back, fflag) == EQUAL) {
+ while (front < back && compare(front, back) == EQUAL) {
+ if (compare(front, back) == EQUAL) {
eol = 0;
while (front < back && !eol) {
if (putchar(*front) == EOF)
@@ -311,7 +307,7 @@ print_from(char *front, char *back)
* in other locales.
*/
int
-compare(char *s2, char *s2end, int nocase) {
+compare(char *s2, char *s2end) {
int i;
char *p;
@@ -326,7 +322,7 @@ compare(char *s2, char *s2end, int nocase) {
*p = 0;
/* and compare */
- if (nocase)
+ if (fflag)
i = strncasecmp(comparbuf, string, stringlen);
else
i = strncmp(comparbuf, string, stringlen);