aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org.ua>2012-01-02 12:59:33 +0200
committerSergey Poznyakoff <gray@gnu.org.ua>2012-01-02 12:59:33 +0200
commit533a8901874d6fb54ed25e02620b132212215821 (patch)
tree989fc3aefccd175dc9e6f8b0f757eaea2d53a340
parent5683868c5bbbc8b811319ff177fd9f9eec2258bf (diff)
downloadswis-533a8901874d6fb54ed25e02620b132212215821.tar.gz
swis-533a8901874d6fb54ed25e02620b132212215821.tar.bz2
Use Grecs to build command-line interface.
* src/.gitignore: Update. * src/Makefile.am (html_strip_SOURCES): Add html-strip-cli.h (word_split_SOURCES): Add word-split-cli.h (mysql_backend_SOURCES): Add mysql-backend-cli.h (EXTRA_DIST,BUILT_SOURCES): Update accordingly (.opt.h): New implicit rule. * src/html-strip-cli.opt: New file. * src/mysql-backend-cli.opt: New file. * src/word-split-cli.opt: New file. * src/html-strip.l: Use Grecs CLI. * src/mysql-backend.c: Likewise. * src/word-split.c: Likewise. * src/swis.h: Include sysexits.h
-rw-r--r--src/.gitignore1
-rw-r--r--src/Makefile.am29
-rw-r--r--src/html-strip-cli.opt71
-rw-r--r--src/html-strip.l80
-rw-r--r--src/mysql-backend-cli.opt131
-rw-r--r--src/mysql-backend.c152
-rw-r--r--src/swis.h1
-rw-r--r--src/word-split-cli.opt103
-rw-r--r--src/word-split.c121
9 files changed, 347 insertions, 342 deletions
diff --git a/src/.gitignore b/src/.gitignore
index 7b761d9..9401265 100644
--- a/src/.gitignore
+++ b/src/.gitignore
@@ -1,5 +1,6 @@
html-strip.c
html-strip
mysql-backend
+*-cli.h
swis
word-split
diff --git a/src/Makefile.am b/src/Makefile.am
index 1d7c472..12eee24 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -20,11 +20,29 @@ libexec_PROGRAMS=html-strip word-split @BUILD_BACKENDS@
EXTRA_PROGRAMS=mysql-backend
bin_PROGRAMS=swis
-html_strip_SOURCES=html-strip.l
+BUILT_SOURCES=
+EXTRA_DIST=swis.h swis.in db.mysql swis.conf
+
+html_strip_SOURCES=\
+ html-strip.l\
+ html-strip-cli.h
+BUILT_SOURCES += html-strip-cli.h
+EXTRA_DIST += html-strip-cli.opt
+
+word_split_SOURCES=\
+ word-split.c\
+ word-split-cli.h\
+ badword.c\
+ exclude.c
+BUILT_SOURCES += word-split-cli.h
+EXTRA_DIST += word-split-cli.opt
-word_split_SOURCES=word-split.c badword.c exclude.c
+mysql_backend_SOURCES=\
+ mysql-backend.c\
+ mysql-backend-cli.h
+BUILT_SOURCES += mysql-backend-cli.h
+EXTRA_DIST += mysql-backend-cli.opt
-mysql_backend_SOURCES=mysql-backend.c
mysql_backend_LDADD=$(LDADD) @BACKEND_LIBS@
libswis_a_SOURCES=\
@@ -35,7 +53,6 @@ libswis_a_SOURCES=\
INCLUDES=-I${top_srcdir}/gnu -I../gnu @GRECS_INCLUDES@
LDADD=./libswis.a ../gnu/libgnu.a $(LIBICONV) @GRECS_LDADD@
-EXTRA_DIST=swis.h swis.in db.mysql swis.conf
AM_LFLAGS=-d
swis: ${top_srcdir}/src/swis.in
@@ -44,3 +61,7 @@ swis: ${top_srcdir}/src/swis.in
${top_srcdir}/src/swis.in > $@-t && \
cmp $@-t swis >/dev/null 2>&1 || mv $@-t swis && chmod +x swis
+SUFFIXES=.opt .c .h
+
+.opt.h:
+ $(AM_V_GEN)m4 -s $(top_srcdir)/@GRECS_SUBDIR@/build-aux/getopt.m4 $< > $@
diff --git a/src/html-strip-cli.opt b/src/html-strip-cli.opt
new file mode 100644
index 0000000..bfada72
--- /dev/null
+++ b/src/html-strip-cli.opt
@@ -0,0 +1,71 @@
+/* This file is part of SWIS
+ Copyright (C) 2007, 2012 Sergey Poznyakoff
+
+ SWIS is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3, or (at your option)
+ any later version.
+
+ SWIS is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with SWIS. If not, see <http://www.gnu.org/licenses/>. */
+
+OPTIONS_BEGIN("html-strip",
+ [<Strip off HTML tags from input files and convert them to UTF-8>],
+ [<FILE [FILE...]>],
+ [<gnu>],
+ [<copyright_year=2012>],
+ [<copyright_holder=Sergey Poznyakoff>])
+
+OPTION(debug,d,,
+ [<output debugging info>])
+BEGIN
+ yy_flex_debug = 1;
+END
+
+OPTION(output,o,FILE,
+ [<direct output to FILE instead of stdout>])
+BEGIN
+ yyout = fopen (optarg, "w");
+ if (!yyout)
+ error (1, errno, "cannot open output file %s", optarg);
+END
+
+OPTION(tag,t,,
+ [<tag each output block with the source file name>])
+BEGIN
+ tag_option = 1;
+END
+
+OPTION(null,0,,
+ [<-T reads null-terminated names>])
+BEGIN
+ filename_terminator = 0;
+END
+
+OPTION(progname,,NAME,
+ [<use NAME as program name>])
+BEGIN
+ program_name = optarg;
+END
+
+OPTION(from-file,T,FILE,
+ [<read input file names from FILE>])
+BEGIN
+ read_names_from_file (optarg);
+END
+
+OPTIONS_END
+
+int
+parse_options (int argc, char *argv[])
+{
+ int index;
+ GETOPT(argc, argv, index);
+ return index;
+}
+
diff --git a/src/html-strip.l b/src/html-strip.l
index 0c0ccd6..b793a2d 100644
--- a/src/html-strip.l
+++ b/src/html-strip.l
@@ -230,91 +230,17 @@ yywrap()
return open_input ();
}
-enum {
- PROGNAME_OPTION,
-};
-
-struct option options[] = {
- { "progname", required_argument, NULL, PROGNAME_OPTION },
- { "debug", no_argument, NULL, 'd' },
- { "help", no_argument, NULL, 'h' },
- { "version", no_argument, NULL, 'v' },
- { "output", required_argument, NULL, 'o' },
- { "tag", no_argument, NULL, 't' },
- { "files-from", required_argument, NULL, 'T' },
- { "null", no_argument, NULL, '0' },
- { NULL }
-};
-
-void
-usage ()
-{
- printf ("Usage: html-strip [OPTIONS] [FILES...]\n");
- printf ("Strip off HTML tags from input files and convert them to UTF-8\n");
- printf ("\nOptions are:\n");
- printf (" -d, --debug output debugging info\n");
- printf (" -o, --output=FILE direct output to FILE instead of stdout\n");
- printf (" -t, --tag tag each output block with the source file name");
- printf (" -T, --from-file=FILE read input file names from FILE\n");
- printf (" -0, --null -T reads null-terminated names\n");
- printf ("\n");
- printf (" -h, --help print this help list\n");
- printf (" -v, --version print program version and exit\n");
- printf ("\n");
- printf ("Report bugs to <%s>\n", PACKAGE_BUGREPORT);
-}
+#include "html-strip-cli.h"
int
main (int argc, char **argv)
{
- int c;
+ int index;
program_name = argv[0];
yy_flex_debug = 0;
- while ((c = getopt_long (argc, argv, "0dho:T:tv", options, NULL)) != EOF)
- {
- switch (c)
- {
- case '0':
- filename_terminator = 0;
- break;
-
- case 'd':
- yy_flex_debug = 1;
- break;
-
- case PROGNAME_OPTION:
- program_name = optarg;
- break;
-
- case 'h':
- usage ();
- exit (0);
-
- case 'o':
- yyout = fopen (optarg, "w");
- if (!yyout)
- error (1, errno, "cannot open output file %s", optarg);
- break;
-
- case 'T':
- read_names_from_file (optarg);
- break;
-
- case 't':
- tag_option = 1;
- break;
-
- case 'v':
- swis_version (stdout, "html-strip");
- exit (0);
-
- default:
- exit (1);
- }
- }
-
+ index = parse_options (argc, argv);
argc -= optind;
argv += optind;
diff --git a/src/mysql-backend-cli.opt b/src/mysql-backend-cli.opt
new file mode 100644
index 0000000..5424bf4
--- /dev/null
+++ b/src/mysql-backend-cli.opt
@@ -0,0 +1,131 @@
+/* This file is part of SWIS
+ Copyright (C) 2007, 2012 Sergey Poznyakoff
+
+ SWIS is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3, or (at your option)
+ any later version.
+
+ SWIS is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with SWIS. If not, see <http://www.gnu.org/licenses/>. */
+
+OPTIONS_BEGIN("mysql-backend",
+ [<Strip off HTML tags from input files and convert them to UTF-8>],
+ [<[DBNAME]>],
+ [<gnu>],
+ [<copyright_year=2012>],
+ [<copyright_holder=Sergey Poznyakoff>])
+
+OPTION(progname,,NAME,
+ [<use NAME as program name>])
+BEGIN
+ program_name = optarg;
+END
+
+OPTION(file,f,FILE,
+ [<read from FILE instead of stdin>])
+BEGIN
+ input = fopen (optarg, "r");
+ if (!input)
+ error (1, errno, "cannot open file %s", optarg);
+END
+
+OPTION(debug,d,,
+ [<output debugging info>])
+BEGIN
+ debug_level++;
+END
+
+OPTION(cleanup,,,
+ [<clean the database up before proceeding>])
+BEGIN
+ cleanup_option = 1;
+END
+
+OPTION(user,u,NAME,
+ [<MySQL user name>])
+BEGIN
+ user = optarg;
+END
+
+OPTION(password,p,[PASS],
+ [<MySQL password>])
+BEGIN
+ if (optarg)
+ pass = optarg;
+ else
+ pass = xstrdup (getpass ("Password:"));
+END
+
+OPTION(pass-from-file,,FILE,
+ [<read MySQL password from the given FILE>])
+BEGIN
+ read_password_from_file (optarg);
+END
+
+OPTION(pass-from-fd,,NUMBER,
+ [<read MySQL password from the file descriptor>])
+BEGIN
+ char *p;
+ int fd = strtoul (optarg, &p, 10);
+ if (*p)
+ error (1, 0, "not a number: %s", optarg);
+ read_password_from_fd (fd);
+END
+
+OPTION(port,P,PORT-NAME-OR-NUMBER,
+ [<MySQL port number>])
+BEGIN
+ char *p;
+ port = strtoul (optarg, &p, 10);
+ if (*p)
+ error (1, 0, "not a number: %s", optarg);
+END
+
+OPTION(socket,S,PATH,
+ [<MySQL socket name>])
+BEGIN
+ socket_name = optarg;
+END
+
+OPTION(host,H,NAME,
+ [<MySQL host name>])
+BEGIN
+ host = optarg;
+END
+
+OPTION(url-table,,DESCR,
+ [<describe URL table>])
+BEGIN
+ read_table_info (&url_tab, optarg);
+END
+
+OPTION(word-table,,DESCR,
+ [<describe word table>])
+BEGIN
+ read_table_info (&word_tab, optarg);
+END
+
+OPTION(text-table,,DESCR,
+ [<describe text table>])
+BEGIN
+ read_table_info (&text_tab, optarg);
+END
+
+OPTIONS_END
+
+int
+parse_options (int argc, char *argv[])
+{
+ int index;
+ GETOPT(argc, argv, index);
+ return index;
+}
+
+
+
diff --git a/src/mysql-backend.c b/src/mysql-backend.c
index b31cf9c..f0f2acc 100644
--- a/src/mysql-backend.c
+++ b/src/mysql-backend.c
@@ -20,65 +20,6 @@
#include <mysql/mysql.h>
#include "getpass.h"
-enum {
- PROGNAME_OPTION,
- CLEANUP_OPTION,
- PASS_FROM_FILE_OPTION,
- PASS_FROM_FD_OPTION,
- URL_TABLE_OPTION,
- WORD_TABLE_OPTION,
- TEXT_TABLE_OPTION
-};
-
-struct option options[] = {
- { "progname", required_argument, NULL, PROGNAME_OPTION },
- { "file", required_argument, NULL, 'f' },
- { "debug", no_argument, NULL, 'd' },
- { "cleanup", no_argument, NULL, CLEANUP_OPTION },
- { "user", required_argument, NULL, 'u' },
- { "password", optional_argument, NULL, 'p' },
- { "pass-from-file", required_argument, NULL, PASS_FROM_FILE_OPTION },
- { "pass-from-fd", required_argument, NULL, PASS_FROM_FD_OPTION },
- { "port", required_argument, NULL, 'P' },
- { "socket", required_argument, NULL, 'S' },
- { "host", required_argument, NULL, 'H' },
- { "help", no_argument, NULL, 'h' },
- { "version", no_argument, NULL, 'v' },
- { NULL }
-};
-
-void
-usage ()
-{
- printf ("Usage: word-split [OPTIONS] [DBNAME]\n");
- printf ("Read input and store it in a MySQL database\n");
- printf ("\n");
- printf ("DBNAME is the name of the MySQL database to use\n");
- printf ("\nOptions are:\n");
- printf (" -d, --debug output debugging info\n");
- printf (" --cleanup clean the database up before proceeding\n");
- printf (" -f, --file=FILE read from FILE instead of stdin\n");
- printf (" -H, --host=HOST MySQL host name\n");
- printf (" -u, --user=USER MySQL user name\n");
- printf (" -p, --password[=PASS] MySQL password\n");
- printf (" --url-table=DESCR describe url table\n");
- printf (" --word-table=DESCR describe word table\n");
- printf (" --text-table=DESCR describe text table\n");
- printf (" --pass-from-file=FILE read MySQL password from the given FILE\n");
- printf (" --pass-from-fd=NUMBER read MySQL password from the file descriptor\n");
- printf (" NUMBER\n");
- printf (" -P, --port=NUMBER MySQL port number\n");
- printf (" -S, --socket=FILE MySQL socket name\n");
-
- printf (" -h, --help print this help list\n");
- printf (" -v, --version print program version and exit\n");
- printf ("\n");
- printf ("Table description argumend (DESCR) syntax is:\n");
- printf ("[name:]column=name[,column=name...].\n");
- printf ("\n");
- printf ("Report bugs to <%s>\n", PACKAGE_BUGREPORT);
-}
-
FILE *input;
int debug_level;
@@ -519,7 +460,6 @@ parse_record (char *buf, char **pword, unsigned long *pnum)
*pword = p + 1;
return 0;
}
-
/* Main loop */
void
@@ -560,100 +500,20 @@ read_loop ()
}
+#include "mysql-backend-cli.h"
+
int
main (int argc, char **argv)
{
- int c;
+ int index;
int fd;
char *p;
program_name = argv[0];
- while ((c = getopt_long (argc, argv, "df:H:hP:p::S:u:v", options, NULL))
- != EOF)
- {
- switch (c)
- {
- case CLEANUP_OPTION:
- cleanup_option = 1;
- break;
-
- case 'd':
- debug_level++;
- break;
-
- case 'f':
- input = fopen (optarg, "r");
- if (!input)
- error (1, errno, "cannot open file %s", optarg);
- break;
-
- case 'H':
- host = optarg;
- break;
-
- case 'h':
- usage ();
- exit (0);
-
- case PASS_FROM_FD_OPTION:
- fd = strtoul (optarg, &p, 10);
- if (*p)
- error (1, 0, "not a number: %s", optarg);
- read_password_from_fd (fd);
- break;
-
- case PASS_FROM_FILE_OPTION:
- read_password_from_file (optarg);
- break;
-
- case PROGNAME_OPTION:
- program_name = optarg;
- break;
-
- case 'P':
- port = strtoul (optarg, &p, 10);
- if (*p)
- error (1, 0, "not a number: %s", optarg);
- break;
-
- case 'p':
- if (optarg)
- pass = optarg;
- else
- pass = xstrdup (getpass ("Password:"));
- break;
-
- case 'S':
- socket_name = optarg;
- break;
-
- case 'u':
- user = optarg;
- break;
-
- case 'v':
- swis_version (stdout, "mysql-backend");
- exit (0);
-
- case URL_TABLE_OPTION:
- read_table_info (&url_tab, optarg);
- break;
-
- case WORD_TABLE_OPTION:
- read_table_info (&word_tab, optarg);
- break;
-
- case TEXT_TABLE_OPTION:
- read_table_info (&text_tab, optarg);
- break;
-
- default:
- exit (1);
- }
- }
+ parse_options (argc, argv);
- argc -= optind;
- argv += optind;
+ argc -= index;
+ argv += index;
if (argc >= 1)
{
diff --git a/src/swis.h b/src/swis.h
index c33d5ef..b3753de 100644
--- a/src/swis.h
+++ b/src/swis.h
@@ -23,6 +23,7 @@
#include <ctype.h>
#include <errno.h>
#include <locale.h>
+#include <sysexits.h>
#include "error.h"
#include "progname.h"
#include "xalloc.h"
diff --git a/src/word-split-cli.opt b/src/word-split-cli.opt
new file mode 100644
index 0000000..3281299
--- /dev/null
+++ b/src/word-split-cli.opt
@@ -0,0 +1,103 @@
+/* This file is part of SWIS
+ Copyright (C) 2007, 2012 Sergey Poznyakoff
+
+ SWIS is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3, or (at your option)
+ any later version.
+
+ SWIS is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with SWIS. If not, see <http://www.gnu.org/licenses/>. */
+
+OPTIONS_BEGIN("word-split",
+ [<Split UTF-8 input into words>],
+ [<FILE [FILE...]>],
+ [<gnu>],
+ [<copyright_year=2012>],
+ [<copyright_holder=Sergey Poznyakoff>])
+
+OPTION(debug,d,,
+ [<output debugging info>])
+BEGIN
+ error (0, 0, "warning: the --debug option is not yet supported");
+END
+
+OPTION(output,o,FILE,
+ [<direct output to FILE instead of stdout>])
+BEGIN
+ output = fopen (optarg, "w");
+ if (!output)
+ error (1, errno, "cannot open output file %s", optarg);
+END
+
+OPTION(tag,t,,
+ [<tag each output block with the source file name>])
+BEGIN
+ tag_option = 1;
+END
+
+OPTION(null,0,,
+ [<-T reads null-terminated names>])
+BEGIN
+ filename_terminator = 0;
+END
+
+OPTION(progname,,NAME,
+ [<use NAME as program name>])
+BEGIN
+ program_name = optarg;
+END
+
+OPTION(from-file,T,FILE,
+ [<read input file names from FILE>])
+BEGIN
+ read_names_from_file (optarg);
+END
+
+OPTION(min-length,m,NUMBER,
+ [<set minimal word length>])
+BEGIN
+ char *p;
+ min_length = strtoul (optarg, &p, 10);
+ if (*p)
+ error (1, 0, "invalid number (near %s)", p);
+END
+
+OPTION(badwords,b,FILE,
+ [<read list of `bad words' from FILE>])
+BEGIN
+ read_badwords (optarg);
+END
+
+OPTION(full-text,f,,
+ [<print full text before the word list>])
+BEGIN
+ full_text_option = 1;
+END
+
+OPTION(exclude-from,,FILE,
+ [<read list of regexps to exclude from FILE>])
+BEGIN
+ read_exclude_regexps (optarg);
+END
+
+OPTION(exclude,,REGEX,
+ [<exclude words matching REGEX>])
+BEGIN
+ register_exclude_regexp (optarg);
+END
+
+OPTIONS_END
+
+int
+parse_options (int argc, char *argv[])
+{
+ int index;
+ GETOPT(argc, argv, index);
+ return index;
+}
diff --git a/src/word-split.c b/src/word-split.c
index 40a4745..586c5b8 100644
--- a/src/word-split.c
+++ b/src/word-split.c
@@ -16,52 +16,6 @@
#include "swis.h"
-enum {
- PROGNAME_OPTION,
- EXCLUDE_OPTION,
- EXCLUDE_FROM_OPTION
-};
-
-struct option options[] = {
- { "progname", required_argument, NULL, PROGNAME_OPTION },
- { "debug", no_argument, NULL, 'd' },
- { "help", no_argument, NULL, 'h' },
- { "version", no_argument, NULL, 'v' },
- { "output", required_argument, NULL, 'o' },
- { "tag", no_argument, NULL, 't' },
- { "files-from", required_argument, NULL, 'T' },
- { "null", no_argument, NULL, '0' },
- { "min-length", required_argument, NULL, 'm' },
- { "badwords", required_argument, NULL, 'b' },
- { "full-text", no_argument, NULL, 'f' },
- { "exclude", required_argument, NULL, EXCLUDE_OPTION },
- { "exclude-from", required_argument, NULL, EXCLUDE_FROM_OPTION },
- { NULL }
-};
-
-void
-usage ()
-{
- printf ("Usage: word-split [OPTIONS] [FILES...]\n");
- printf ("Split UTF-8 input into words\n");
- printf ("\nOptions are:\n");
- printf (" -b, --badword=FILE read list of `bad words' from FILE\n");
- /* printf (" -d, --debug output debugging info\n"); */
- printf (" -o, --output=FILE direct output to FILE instead of stdout\n");
- printf (" --exclude=REGEX exclude words matching REGEX\n");
- printf (" --exclude-from=FILE read list of regexps to exclude from FILE\n");
- printf (" -m, --min-length=NUMBER set minimal word length\n");
- printf (" -t, --tag preserve file name tags\n");
- printf (" -T, --from-file=FILE read input file names from FILE\n");
- printf (" -0, --null -T reads null-terminated names\n");
- printf (" -f, --full-text print full text before the word list\n");
- printf ("\n");
- printf (" -h, --help print this help list\n");
- printf (" -v, --version print program version and exit\n");
- printf ("\n");
- printf ("Report bugs to <%s>\n", PACKAGE_BUGREPORT);
-}
-
char **input_file;
FILE *input;
FILE *output;
@@ -220,82 +174,19 @@ word_split ()
return !open_input ();
}
+#include "word-split-cli.h"
+
int
main (int argc, char **argv)
{
- int c;
+ int c, index;
char *p;
program_name = argv[0];
+ index = parse_options (argc, argv);
- while ((c = getopt_long (argc, argv, "0b:dfm:ho:T:tuv", options, NULL)) != EOF)
- {
- switch (c)
- {
- case '0':
- filename_terminator = 0;
- break;
-
- case 'b':
- read_badwords (optarg);
- break;
-
- case 'd':
- error (0, 0, "warning: the --debug option is not yet supported");
- /* FIXME */
- break;
-
- case EXCLUDE_OPTION:
- register_exclude_regexp (optarg);
- break;
-
- case EXCLUDE_FROM_OPTION:
- read_exclude_regexps (optarg);
- break;
-
- case 'f':
- full_text_option = 1;
- break;
-
- case 'm':
- min_length = strtoul (optarg, &p, 10);
- if (*p)
- error (1, 0, "invalid number (near %s)", p);
- break;
-
- case 'h':
- usage ();
- exit (0);
-
- case 'o':
- output = fopen (optarg, "w");
- if (!output)
- error (1, errno, "cannot open output file %s", optarg);
- break;
-
- case PROGNAME_OPTION:
- program_name = optarg;
- break;
-
- case 'T':
- read_names_from_file (optarg);
- break;
-
- case 't':
- tag_option = 1;
- break;
-
- case 'v':
- swis_version (stdout, "word-split");
- exit (0);
-
- default:
- exit (1);
- }
- }
-
- argc -= optind;
- argv += optind;
+ argc -= index;
+ argv += index;
update_argcv (&argc, &argv);

Return to:

Send suggestions and report system problems to the System administrator.