2 * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
3 * Use is subject to license terms.
6 /* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
7 /* All Rights Reserved */
10 * Copyright (c) 1980 Regents of the University of California.
11 * All rights reserved. The Berkeley software License Agreement
12 * specifies the terms and conditions for redistribution.
15 #pragma ident "%Z%%M% %I% %E% SMI"
22 extern void clfgrep();
24 extern void dumpold();
34 main(int argc
, char *argv
[]) /* process command-line arguments */
36 char line
[BUFSIZ
], *s
;
39 (void) setlocale(LC_ALL
, "");
40 #if !defined(TEXT_DOMAIN)
41 #define TEXT_DOMAIN "SYS_TEST"
43 (void) textdomain(TEXT_DOMAIN
);
46 while (argc
> 1 && argv
[1][0] == '-') {
67 keywant
= (argv
[1][2] ? argv
[1][2] : 'L');
77 if (search
-rdata
> NSERCH
)
79 "too many -p options (%d)"), NSERCH
);
82 authrev
= atoi(argv
[1]+2);
87 bare
= (argv
[1][2] == '1') ? 1 : 2;
90 smallcaps
= argv
[1]+2;
93 refnum
= atoi(argv
[1]+2) - 1;
112 if (getenv("REFER") != NULL
)
113 *search
++ = getenv("REFER");
114 else if (nodeflt
== 0)
115 *search
++ = "/usr/lib/refer/papers/Ind";
116 if (sort
&& !labels
) {
117 sprintf(ofile
, "/tmp/rj%db", getpid());
118 ftemp
= fopen(ofile
, "w");
120 fprintf(stderr
, gettext("Can't open scratch file\n"));
125 sprintf(tfile
, "/tmp/rj%da", getpid());
126 fo
= fopen(tfile
, "w");
129 fprintf(stderr
, gettext("Can't open scratch file"));
131 sep
= 002; /* separate records without confusing sort.. */
138 in
= fopen(Ifile
= argv
[1], "r");
142 err(gettext("Can't read %s"), Ifile
);
146 while (input(line
)) {
148 if (biblio
&& *line
== '\n')
150 else if (biblio
&& Iline
== 1 && *line
== '%')
152 else if (!prefix(".[", line
))
159 if (endpush
&& fo
!= NULL
)
174 if (signal(SIGINT
, SIG_IGN
) != SIG_IGN
)
175 signal(SIGINT
, intr
);
176 signal(SIGHUP
, intr
);
177 signal(SIGPIPE
, intr
);
178 signal(SIGTERM
, intr
);
184 signal(SIGINT
, SIG_IGN
);