summaryrefslogtreecommitdiff
path: root/src/expr.c
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>1993-10-12 01:52:24 +0000
committerJim Meyering <jim@meyering.net>1993-10-12 01:52:24 +0000
commit87fa23e6417d7d1938b72e872d779ae7225a5aa4 (patch)
tree0fcc68f9cdf7315d09d5836df0f261e3d6b8c13a /src/expr.c
parentf12b53b2ce8f0bb0dd28a290f9b27490ef4599a9 (diff)
downloadcoreutils-87fa23e6417d7d1938b72e872d779ae7225a5aa4.tar.xz
merge with 1.8.1b
Diffstat (limited to 'src/expr.c')
-rw-r--r--src/expr.c54
1 files changed, 8 insertions, 46 deletions
diff --git a/src/expr.c b/src/expr.c
index a9f376942..97f7b39d8 100644
--- a/src/expr.c
+++ b/src/expr.c
@@ -32,7 +32,6 @@
#include <ctype.h>
#include <sys/types.h>
#include <regex.h>
-#include <getopt.h>
#include "system.h"
#include "version.h"
@@ -81,6 +80,7 @@ void error ();
char *xstrdup ();
char *strstr ();
char *xmalloc ();
+void parse_long_options ();
static VALUE *docolon ();
static VALUE *eval ();
@@ -99,13 +99,6 @@ static void tostring ();
static void trace ();
#endif
-static struct option const long_options[] =
-{
- {"help", no_argument, 0, 'h'},
- {"version", no_argument, 0, 'v'},
- {0, 0, 0, 0}
-};
-
static void
usage ()
{
@@ -114,39 +107,6 @@ usage ()
exit (1);
}
-/* Process long options that precede all other command line arguments. */
-
-static void
-parse_long_options (argc, argv)
- int argc;
- char **argv;
-{
- int c;
-
- while ((c = getopt_long (argc, argv, "+", long_options, (int *) 0)) != EOF)
- {
- switch (c)
- {
- case 'h':
- usage ();
-
- case 'v':
- printf ("%s\n", version_string);
- exit (0);
-
- default:
- usage ();
- }
- }
-
- /* Restore optind in case it has advanced past a leading `--'. We can use a
- simple assignment here because all brances of the above switch statement
- exit. Otherwise, we'd have to be careful to decrement only when optind
- is larger than 1 and the last argument processed was `--'. */
-
- optind = 1;
-}
-
void
main (argc, argv)
int argc;
@@ -156,7 +116,7 @@ main (argc, argv)
program_name = argv[0];
- parse_long_options (argc, argv);
+ parse_long_options (argc, argv, usage);
if (argc == 1)
usage ();
@@ -465,7 +425,8 @@ eval7 ()
#endif
if (nomoreargs ())
error (2, 0, "syntax error");
- else if (nextarg ("("))
+
+ if (nextarg ("("))
{
args++;
v = eval ();
@@ -474,10 +435,11 @@ eval7 ()
args++;
return v;
}
- else if (nextarg (")"))
+
+ if (nextarg (")"))
error (2, 0, "syntax error");
- else
- return str_value (*args++);
+
+ return str_value (*args++);
}
/* Handle match, substr, index, and length keywords. */