@@ -37,8 +37,8 @@ static char *lseek_doc[] = {
37
37
"negative <REL_OFFSET> rewinds the <FD>" ,
38
38
"" ,
39
39
"SEEK_TYPE is optional and can take the value of:" ,
40
- " 'SEEK_SET' 'SEEK_CUR' 'SEEK_END'" ,
41
- " If omitted or invalid , SEEK_CUR is used." ,
40
+ " 'SEEK_SET' 'SEEK_CUR' 'SEEK_END'" ,
41
+ " If omitted, SEEK_CUR is used." ,
42
42
"----------------------------------------------" ,
43
43
"" ,
44
44
NULL
@@ -56,7 +56,6 @@ struct builtin lseek_struct = {
56
56
57
57
// main function
58
58
static int lseek_main (int argc , char * * argv ) {
59
- int whence = SEEK_CUR
60
59
61
60
// check for exactly 2 or 3 args passed to lseek
62
61
if (argc != 3 && argc != 4 ) {
@@ -86,9 +85,7 @@ static int lseek_main(int argc, char **argv) {
86
85
whence = SEEK_SET ;
87
86
} else if (strcmp (argv [3 ], "SEEK_END" ) == 0 ) {
88
87
whence = SEEK_END ;
89
- } else if (strcmp (argv [3 ], "SEEK_CUR" ) == 0 ) {
90
- whence = SEEK_CUR ;
91
- } else {
88
+ } else if (strcmp (argv [3 ], "SEEK_CUR" ) != 0 ) {
92
89
fprintf (stderr , "Error: Invalid SEEK_TYPE. Must be SEEK_SET, SEEK_CUR, or SEEK_END\n" );
93
90
return 1 ;
94
91
}
0 commit comments