From d71d4461044134fb56fb09694aec1fc8eae779d4 Mon Sep 17 00:00:00 2001 From: Mario Fetka Date: Mon, 27 May 2024 16:13:40 +0200 Subject: [PATCH] Intial commit --- archie/.gitignore | 1 + archie/Makefile.in | 89 + archie/Makefile.multi | 48 + archie/Makefile.post | 61 + archie/Makefile.pre | 161 + archie/access/ar_search.c | 943 ++ archie/access/casesrch.c | 345 + archie/access/list_site.c | 392 + archie/access/match.c | 158 + archie/access/prarch.c | 231 + archie/access/prarch_match.c | 593 + archie/access/prlist.c | 86 + archie/access/sys/370.c | 23 + archie/access/sys/386.c | 23 + archie/access/sys/68k.c | 23 + archie/access/sys/cray.c | 23 + archie/access/sys/mips.c | 23 + archie/access/sys/sparc.c | 25 + archie/access/sys/sparc2.c | 23 + archie/access/sys/vax.c | 22 + archie/anonftp/.gitignore | 1 + archie/anonftp/Makefile.in | 15 + archie/anonftp/lib/.gitignore | 1 + archie/anonftp/lib/AIX-2/.gitignore | 1 + archie/anonftp/lib/AIX-2/Makefile.in | 11 + archie/anonftp/lib/Makefile.post | 16 + archie/anonftp/lib/Makefile.pre | 26 + archie/anonftp/lib/SunOS-4.1.4/.gitignore | 1 + archie/anonftp/lib/SunOS-4.1.4/Makefile.in | 10 + archie/anonftp/lib/SunOS-5.4/.gitignore | 1 + archie/anonftp/lib/SunOS-5.4/Makefile.in | 12 + archie/anonftp/lib/SunOS-5.6 | 1 + archie/anonftp/lib/db_ops.c | 284 + archie/anonftp/lib/lang_libanonftp.c | 6 + archie/anonftp/lib/lang_libanonftp.h | 10 + archie/anonftp/parse/.gitignore | 1 + archie/anonftp/parse/AIX-2/.gitignore | 1 + archie/anonftp/parse/AIX-2/Makefile.in | 12 + archie/anonftp/parse/Makefile.post | 50 + archie/anonftp/parse/Makefile.pre | 99 + archie/anonftp/parse/SunOS-4.1.4/.gitignore | 1 + archie/anonftp/parse/SunOS-4.1.4/Makefile.in | 11 + archie/anonftp/parse/SunOS-5.4/.gitignore | 1 + archie/anonftp/parse/SunOS-5.4/Makefile.in | 11 + archie/anonftp/parse/SunOS-5.6 | 1 + archie/anonftp/parse/db2v.c | 150 + archie/anonftp/parse/db2v.h | 27 + archie/anonftp/parse/info_cell.c | 61 + archie/anonftp/parse/info_cell.h | 25 + archie/anonftp/parse/input.c | 70 + archie/anonftp/parse/input.h | 17 + archie/anonftp/parse/lang_anonftp.c | 283 + archie/anonftp/parse/lang_anonftp.h | 290 + archie/anonftp/parse/lang_parsers.c | 127 + archie/anonftp/parse/lang_parsers.h | 123 + archie/anonftp/parse/line_type.h | 41 + archie/anonftp/parse/mem_debug.c | 96 + archie/anonftp/parse/mem_debug.h | 37 + archie/anonftp/parse/novell.c | 373 + archie/anonftp/parse/novell2.c | 331 + archie/anonftp/parse/output.c | 62 + archie/anonftp/parse/output.h | 12 + archie/anonftp/parse/pars_ent_holder.h | 13 + archie/anonftp/parse/parse.c | 1029 ++ archie/anonftp/parse/parse.h | 73 + archie/anonftp/parse/parse_anonftp.c | 723 + archie/anonftp/parse/parser.man | 95 + archie/anonftp/parse/queue.c | 145 + archie/anonftp/parse/queue.h | 28 + archie/anonftp/parse/queue_def.h | 22 + archie/anonftp/parse/stack.c | 296 + archie/anonftp/parse/stack.h | 38 + archie/anonftp/parse/storage.c | 228 + archie/anonftp/parse/storage.h | 25 + archie/anonftp/parse/str.c | 55 + archie/anonftp/parse/str.h | 10 + archie/anonftp/parse/test-queue.c | 80 + archie/anonftp/parse/test-vms_parser.c | 187 + archie/anonftp/parse/unix.c | 413 + archie/anonftp/parse/unix2.c | 325 + archie/anonftp/parse/unix2.h | 25 + archie/anonftp/parse/unix_filter | 26 + archie/anonftp/parse/utils.c | 147 + archie/anonftp/parse/utils.h | 21 + archie/anonftp/parse/vms.c | 318 + archie/anonftp/parse/vms2.c | 309 + archie/anonftp/parse/vms2.h | 27 + archie/anonftp/retrieve/.gitignore | 1 + archie/anonftp/retrieve/AIX-2/.gitignore | 1 + archie/anonftp/retrieve/AIX-2/Makefile.in | 12 + archie/anonftp/retrieve/Makefile.post | 18 + archie/anonftp/retrieve/Makefile.pre | 33 + .../anonftp/retrieve/SunOS-4.1.4/.gitignore | 1 + .../anonftp/retrieve/SunOS-4.1.4/Makefile.in | 11 + archie/anonftp/retrieve/SunOS-5.4/.gitignore | 1 + archie/anonftp/retrieve/SunOS-5.4/Makefile.in | 11 + archie/anonftp/retrieve/SunOS-5.6 | 1 + archie/anonftp/retrieve/ftp.c | 492 + archie/anonftp/retrieve/ftp.h | 55 + archie/anonftp/retrieve/ftp_getfile.c | 2400 +++ archie/anonftp/retrieve/ftp_getfile.h | 65 + archie/anonftp/retrieve/glob.c | 662 + archie/anonftp/retrieve/lang_retrieve.c | 90 + archie/anonftp/retrieve/lang_retrieve.h | 90 + archie/anonftp/update/.gitignore | 1 + archie/anonftp/update/AIX-2/.gitignore | 1 + archie/anonftp/update/AIX-2/Makefile.in | 9 + archie/anonftp/update/Makefile.post | 95 + archie/anonftp/update/Makefile.pre | 65 + archie/anonftp/update/SunOS-4.1.4/.gitignore | 1 + archie/anonftp/update/SunOS-4.1.4/Makefile.in | 11 + archie/anonftp/update/SunOS-5.4/.gitignore | 1 + archie/anonftp/update/SunOS-5.4/Makefile.in | 11 + archie/anonftp/update/SunOS-5.6 | 1 + archie/anonftp/update/check_anonftp.c | 526 + archie/anonftp/update/check_anonftp.h | 21 + archie/anonftp/update/delete_anonftp.c | 424 + archie/anonftp/update/delete_anonftp.h | 13 + archie/anonftp/update/insert_anonftp.c | 1224 ++ archie/anonftp/update/insert_anonftp.h | 40 + archie/anonftp/update/interact_anonftp.c | 559 + archie/anonftp/update/interact_anonftp.h | 22 + archie/anonftp/update/lang_anonftp.c | 284 + archie/anonftp/update/lang_anonftp.h | 291 + archie/anonftp/update/net_anonftp.c | 1427 ++ archie/anonftp/update/net_anonftp.h | 13 + archie/anonftp/update/setup_delete.c | 171 + archie/anonftp/update/setup_insert.c | 344 + archie/anonftp/update/update_anonftp.c | 787 + archie/anonftp/update/update_anonftp.h | 9 + archie/cgi/bin/archie.cgi | 455 + archie/cgi/html/archie-adv.html | 47 + archie/cgi/html/archie-help.html | 138 + archie/cgi/html/archie.html | 30 + archie/cgi/html/query.gif | Bin 0 -> 6845 bytes archie/cgi/html/results.gif | Bin 0 -> 10382 bytes archie/clients/.gitignore | 1 + archie/clients/Makefile.in | 15 + archie/clients/Makefile.pre | 8 + archie/clients/cgi/.gitignore | 1 + archie/clients/cgi/AIX-2/.gitignore | 1 + archie/clients/cgi/AIX-2/Makefile.in | 9 + archie/clients/cgi/Makefile.post | 24 + archie/clients/cgi/Makefile.pre | 39 + archie/clients/cgi/SunOS-4.1.4/.gitignore | 1 + archie/clients/cgi/SunOS-4.1.4/Makefile.in | 11 + archie/clients/cgi/SunOS-5.4/.gitignore | 1 + archie/clients/cgi/SunOS-5.4/Makefile.in | 12 + archie/clients/cgi/SunOS-5.6 | 1 + archie/clients/cgi/cgi-client.c | 408 + archie/clients/email/.gitignore | 1 + archie/clients/email/AIX-2/.gitignore | 1 + archie/clients/email/AIX-2/Makefile.in | 11 + archie/clients/email/Makefile.post | 17 + archie/clients/email/Makefile.pre | 30 + archie/clients/email/SunOS-4.1.4/.gitignore | 1 + archie/clients/email/SunOS-4.1.4/Makefile.in | 10 + archie/clients/email/SunOS-5.4/.gitignore | 1 + archie/clients/email/SunOS-5.4/Makefile.in | 11 + archie/clients/email/SunOS-5.6 | 1 + archie/clients/email/batch-email | 48 + archie/clients/email/email.c | 793 + archie/clients/email/email.h | 20 + archie/clients/email/lang_email.c | 36 + archie/clients/email/lang_email.h | 33 + archie/clients/email/process-email | 56 + archie/clients/mail_back_end/.gitignore | 1 + archie/clients/mail_back_end/AIX-2/.gitignore | 1 + .../clients/mail_back_end/AIX-2/Makefile.in | 11 + archie/clients/mail_back_end/Makefile.post | 16 + archie/clients/mail_back_end/Makefile.pre | 31 + archie/clients/mail_back_end/README | 18 + .../mail_back_end/SunOS-4.1.4/.gitignore | 1 + .../mail_back_end/SunOS-4.1.4/Makefile.in | 10 + .../mail_back_end/SunOS-5.4/.gitignore | 1 + .../mail_back_end/SunOS-5.4/Makefile.in | 11 + archie/clients/mail_back_end/SunOS-5.6 | 1 + archie/clients/mail_back_end/archiemail | 70 + archie/clients/mail_back_end/archiemail.curr | 59 + archie/clients/mail_back_end/mail_handler | 7 + archie/clients/mail_back_end/mail_receiver | 107 + .../clients/mail_back_end/mail_receiver.curr | 101 + archie/clients/mail_back_end/split_file.c | 248 + archie/clients/telnet/.gitignore | 1 + archie/clients/telnet/AIX-2/.gitignore | 1 + archie/clients/telnet/AIX-2/Makefile.in | 15 + archie/clients/telnet/Makefile.post | 47 + archie/clients/telnet/Makefile.pre | 162 + archie/clients/telnet/SunOS-4.1.4/.gitignore | 1 + archie/clients/telnet/SunOS-4.1.4/Makefile.in | 14 + archie/clients/telnet/SunOS-5.4/.gitignore | 1 + archie/clients/telnet/SunOS-5.4/Makefile.in | 11 + archie/clients/telnet/SunOS-5.6 | 1 + archie/clients/telnet/afe.c | 37 + archie/clients/telnet/alarm.c | 53 + archie/clients/telnet/alarm.h | 9 + archie/clients/telnet/ansi_compat.h | 12 + archie/clients/telnet/arch_query.c | 706 + archie/clients/telnet/arch_query.h | 14 + archie/clients/telnet/archie.c | 990 ++ archie/clients/telnet/archie.h | 21 + archie/clients/telnet/argv.c | 369 + archie/clients/telnet/argv.h | 14 + archie/clients/telnet/aslip | 12 + archie/clients/telnet/client_defs.h | 17 + archie/clients/telnet/client_structs.h | 58 + archie/clients/telnet/commands.c | 138 + archie/clients/telnet/commands.h | 67 + archie/clients/telnet/commands_lang.h | 261 + archie/clients/telnet/debug.c | 40 + archie/clients/telnet/debug.h | 33 + archie/clients/telnet/domains.c | 180 + archie/clients/telnet/domains.h | 10 + .../clients/telnet/english-language-strings.c | 412 + archie/clients/telnet/extern.h | 7 + archie/clients/telnet/find.c | 198 + archie/clients/telnet/find.h | 11 + archie/clients/telnet/fork_wait.c | 126 + archie/clients/telnet/fork_wait.h | 30 + .../clients/telnet/french-language-strings.c | 410 + archie/clients/telnet/generic_find.c | 178 + archie/clients/telnet/generic_find.h | 7 + archie/clients/telnet/get_types.c | 38 + archie/clients/telnet/get_types.h | 26 + archie/clients/telnet/get_types_lang.h | 42 + archie/clients/telnet/help.c | 546 + archie/clients/telnet/help.h | 8 + archie/clients/telnet/input.c | 103 + archie/clients/telnet/input.h | 12 + archie/clients/telnet/input.test | 61 + archie/clients/telnet/input2.test | 19 + archie/clients/telnet/input3.test | 14 + archie/clients/telnet/lang.c | 3 + archie/clients/telnet/lang.h | 8 + archie/clients/telnet/list.c | 204 + archie/clients/telnet/list.h | 9 + archie/clients/telnet/macros.h | 22 + archie/clients/telnet/mail.c | 263 + archie/clients/telnet/mail.h | 6 + archie/clients/telnet/mail_lang.h | 4 + archie/clients/telnet/make_strings | 28 + archie/clients/telnet/misc.c | 800 + archie/clients/telnet/misc.h | 56 + archie/clients/telnet/misc_ansi_defs.h | 12 + archie/clients/telnet/mode.c | 62 + archie/clients/telnet/mode.h | 22 + archie/clients/telnet/mode_lang.h | 16 + archie/clients/telnet/pager.c | 155 + archie/clients/telnet/pager.h | 10 + archie/clients/telnet/parchie.h | 167 + archie/clients/telnet/prosp.h | 15 + archie/clients/telnet/prospquery.c | 553 + archie/clients/telnet/rmem.c | 127 + archie/clients/telnet/rmem.h | 51 + archie/clients/telnet/signals.c | 218 + archie/clients/telnet/signals.h | 14 + archie/clients/telnet/sock.c | 25 + archie/clients/telnet/solaris-sig-fix.h | 88 + archie/clients/telnet/strmap.c | 240 + archie/clients/telnet/strmap.h | 29 + archie/clients/telnet/style_lang.h | 29 + archie/clients/telnet/tellwait.c | 173 + archie/clients/telnet/tellwait.h | 15 + archie/clients/telnet/terminal.c | 424 + archie/clients/telnet/terminal.h | 13 + archie/clients/telnet/terminal_lang.h | 8 + archie/clients/telnet/unixcompat.c | 57 + archie/clients/telnet/unixcompat.h | 11 + archie/clients/telnet/vars.c | 511 + archie/clients/telnet/vars.h | 83 + archie/clients/telnet/vars_lang.h | 556 + archie/clients/telnet/version.c | 2 + archie/clients/telnet/version.h | 6 + archie/clients/telnet/version_lang.h | 1 + archie/clients/telnet/whatis.c | 204 + archie/clients/telnet/whatis.h | 9 + archie/control/.gitignore | 1 + archie/control/AIX-2/.gitignore | 1 + archie/control/AIX-2/Makefile.in | 12 + archie/control/Makefile.post | 20 + archie/control/Makefile.pre | 36 + archie/control/SunOS-4.1.4/.gitignore | 1 + archie/control/SunOS-4.1.4/Makefile.in | 11 + archie/control/SunOS-5.4/.gitignore | 1 + archie/control/SunOS-5.4/Makefile.in | 11 + archie/control/SunOS-5.6 | 1 + archie/control/control.h | 45 + archie/control/lang_control.c | 70 + archie/control/lang_control.h | 73 + archie/control/main.c | 1668 +++ archie/doc/.gitignore | 1 + archie/doc/Makefile.in | 7 + archie/doc/TODO | 86 + archie/doc/beta | 86 + archie/doc/install | 121 + archie/doc/mail | 130 + archie/doc/man/anonftp_parser_output.5 | 85 + archie/doc/man/archie.n | 1172 ++ archie/doc/man/archie_clients.n | 454 + archie/doc/man/archie_headers.5 | 184 + archie/doc/man/archie_protocol.5 | 197 + archie/doc/man/arcontrol.n | 352 + archie/doc/man/ardomains.n | 211 + archie/doc/man/arexchange.n | 353 + archie/doc/man/arretrieve.n | 216 + archie/doc/man/arserver.n | 335 + archie/doc/man/convert_hostdb.n | 53 + archie/doc/man/db_build.n | 125 + archie/doc/man/db_check.n | 117 + archie/doc/man/db_dump.n | 99 + archie/doc/man/db_reorder.n | 116 + archie/doc/man/db_siteidx.n | 101 + archie/doc/man/db_stats.n | 108 + archie/doc/man/delete_anonftp.n | 118 + archie/doc/man/delete_webindex.n | 121 + archie/doc/man/handle_header.n | 179 + archie/doc/man/host_manage.n | 552 + archie/doc/man/insert_anonftp.n | 173 + archie/doc/man/insert_webindex.n | 171 + archie/doc/man/mail_stats.n | 57 + archie/doc/man/net_anonftp.n | 151 + archie/doc/man/parse_anonftp.n | 138 + archie/doc/man/parse_anonftp_unix_bsd.n | 96 + archie/doc/man/parse_anonftp_vms_std.n | 1 + archie/doc/man/retrieve_anonftp.n | 298 + archie/doc/man/update_anonftp.n | 133 + archie/doc/man/weaseld.n | 120 + archie/doc/manual/anonftp.tex | 200 + archie/doc/manual/appendix.tex | 118 + archie/doc/manual/archie.tex | 193 + archie/doc/manual/clients.tex | 626 + archie/doc/manual/configure.tex | 989 ++ archie/doc/manual/db.tex | 169 + archie/doc/manual/dirsrv.tex | 376 + archie/doc/manual/faq.tex | 390 + archie/doc/manual/figs/catalogs.eps | 2507 ++++ archie/doc/manual/figs/cycle.eps | 2247 +++ archie/doc/manual/figs/exchange.eps | 2133 +++ archie/doc/manual/figs/new.eps | 1978 +++ archie/doc/manual/figs/note.eps | 1528 ++ archie/doc/manual/figs/overview.eps | 2064 +++ archie/doc/manual/figs/parse.eps | 2327 +++ archie/doc/manual/figs/process.eps | 3328 +++++ archie/doc/manual/figs/telnet.eps | 2476 ++++ archie/doc/manual/host-manage.tex | 247 + archie/doc/manual/install.tex | 300 + archie/doc/manual/intro.tex | 113 + archie/doc/manual/manual.tex | 114 + archie/doc/manual/overview.tex | 513 + archie/doc/manual/readme | 21 + archie/doc/manual/title.tex | 67 + archie/doc/manual/webindex.tex | 126 + archie/doc/memo | 8 + archie/exchange/.gitignore | 1 + archie/exchange/AIX-2/.gitignore | 1 + archie/exchange/AIX-2/Makefile.in | 12 + archie/exchange/Makefile.post | 21 + archie/exchange/Makefile.pre | 46 + archie/exchange/PROTOCOL | 95 + archie/exchange/README | 29 + archie/exchange/SunOS-4.1.4/.gitignore | 1 + archie/exchange/SunOS-4.1.4/Makefile.in | 11 + archie/exchange/SunOS-5.4/.gitignore | 1 + archie/exchange/SunOS-5.4/Makefile.in | 14 + archie/exchange/SunOS-5.6 | 1 + archie/exchange/client.c | 1181 ++ archie/exchange/command.c | 20 + archie/exchange/configfile.c | 505 + archie/exchange/db_functs.c | 887 ++ archie/exchange/lang_exchange.c | 170 + archie/exchange/lang_exchange.h | 162 + archie/exchange/listd.h | 78 + archie/exchange/main.c | 438 + archie/exchange/net.c | 500 + archie/exchange/server.c | 342 + archie/exchange/socktools.c | 114 + archie/exchange/tuple.h | 11 + archie/include/.gitignore | 1 + archie/include/Makefile.in | 7 + archie/include/ansi_compat.h | 14 + archie/include/ar_attrib.h | 179 + archie/include/ar_search.h | 111 + archie/include/archie_catalogs.h | 112 + archie/include/archie_dbm.h | 19 + archie/include/archie_dns.h | 37 + archie/include/archie_inet.h | 47 + archie/include/archie_mail.h | 34 + archie/include/archie_strings.h | 30 + archie/include/archie_xdr.h | 17 + archie/include/copyright.h | 7 + archie/include/core_entry.h | 61 + archie/include/databases.h | 26 + archie/include/db_files.h | 140 + archie/include/db_ops.h | 64 + archie/include/debug.h | 19 + archie/include/defines.h | 124 + archie/include/domain.h | 57 + archie/include/error.h | 54 + archie/include/excerpt.h | 12 + archie/include/files.h | 41 + archie/include/freq.h | 98 + archie/include/gcore_entry.h | 27 + archie/include/gindexdb_ops.h | 50 + archie/include/gparser_file.h | 36 + archie/include/gsite_file.h | 104 + archie/include/gstrings_index.h | 20 + archie/include/header.h | 242 + archie/include/header_def.h | 37 + archie/include/hinfo.h | 114 + archie/include/host_db.h | 1 + archie/include/host_db.h.0 | 183 + archie/include/host_db.h.1 | 183 + archie/include/lang.h | 15 + archie/include/log.h | 16 + archie/include/master.h | 19 + archie/include/misc.h | 64 + archie/include/missing-protos.h | 14 + archie/include/mystdio.h | 45 + archie/include/new_site_file.h | 107 + archie/include/old-host_db.h | 180 + archie/include/old-site_file.h | 107 + archie/include/options.h | 17 + archie/include/outstruct.h | 50 + archie/include/parchie_host_dir.h | 6 + archie/include/parchie_list_host.h | 6 + archie/include/parchie_wais_cache.h | 42 + archie/include/parser_file.h | 34 + archie/include/protonet.h | 62 + archie/include/protos-aix.h | 61 + archie/include/protos-solaris.h | 58 + archie/include/protos-sunos.h | 64 + archie/include/protos.h | 13 + archie/include/prwais_do_search.h | 77 + archie/include/sd.h | 41 + archie/include/site_file.h | 121 + archie/include/solaris-sig-fix.h | 88 + archie/include/srch.h | 29 + archie/include/strings_index.h | 24 + archie/include/times.h | 23 + archie/include/typedef.h | 101 + archie/include/wais_attrib.h | 83 + archie/less/.gitignore | 1 + archie/less/AIX-2/.gitignore | 1 + archie/less/AIX-2/Makefile.in | 11 + archie/less/Makefile.b4 | 162 + archie/less/Makefile.in.b4 | 162 + archie/less/Makefile.post | 21 + archie/less/Makefile.pre | 61 + archie/less/SunOS-4.1.4/.gitignore | 1 + archie/less/SunOS-4.1.4/Makefile.in | 11 + archie/less/SunOS-5.4/.gitignore | 1 + archie/less/SunOS-5.4/Makefile.in | 8 + archie/less/SunOS-5.6 | 1 + archie/less/archie_help.c | 97 + archie/less/brac.c | 90 + archie/less/ch.c | 567 + archie/less/charset.c | 205 + archie/less/cmd.h | 59 + archie/less/cmdbuf.c | 141 + archie/less/command.c | 1197 ++ archie/less/decode.c | 368 + archie/less/defines.h | 152 + archie/less/edit.c | 451 + archie/less/filename.c | 361 + archie/less/forwback.c | 372 + archie/less/funcs.h | 178 + archie/less/help.c | 54 + archie/less/ifile.c | 192 + archie/less/input.c | 261 + archie/less/jump.c | 261 + archie/less/less.h | 115 + archie/less/lesskey.c | 360 + archie/less/line.c | 526 + archie/less/linenum.c | 444 + archie/less/lsystem.c | 305 + archie/less/main.c | 275 + archie/less/mark.c | 237 + archie/less/optfunc.c | 376 + archie/less/option.c | 500 + archie/less/option.h | 38 + archie/less/opttbl.c | 258 + archie/less/os.c | 138 + archie/less/output.c | 337 + archie/less/position.c | 208 + archie/less/position.h | 8 + archie/less/prompt.c | 427 + archie/less/screen.c | 704 + archie/less/search.c | 352 + archie/less/signal.c | 228 + archie/less/tags.c | 175 + archie/less/ttyin.c | 79 + archie/less/vecho.c | 41 + archie/less/version.c | 319 + archie/lib/archsearch/.gitignore | 1 + archie/lib/archsearch/AIX-2/.gitignore | 1 + archie/lib/archsearch/AIX-2/Makefile.in | 11 + archie/lib/archsearch/Makefile.post | 14 + archie/lib/archsearch/Makefile.pre | 88 + archie/lib/archsearch/SunOS-4.1.4/.gitignore | 1 + archie/lib/archsearch/SunOS-4.1.4/Makefile.in | 10 + archie/lib/archsearch/SunOS-5.4/.gitignore | 1 + archie/lib/archsearch/SunOS-5.4/Makefile.in | 12 + archie/lib/archsearch/SunOS-5.6 | 1 + archie/lib/archsearch/boolean-ops.c | 662 + archie/lib/archsearch/boolean-ops.h | 58 + archie/lib/archsearch/boolean-search.c | 2086 +++ archie/lib/archsearch/get-info.c | 1131 ++ archie/lib/archsearch/get-info.h | 184 + archie/lib/archsearch/search.c | 2040 +++ archie/lib/archsearch/search.h | 178 + archie/lib/archsearch/util.c | 397 + archie/lib/archstridx/.gitignore | 1 + archie/lib/archstridx/AIX-2/.gitignore | 1 + archie/lib/archstridx/AIX-2/Makefile.in | 23 + archie/lib/archstridx/API.txt | 180 + archie/lib/archstridx/Makefile.post | 68 + archie/lib/archstridx/Makefile.pre | 69 + archie/lib/archstridx/SunOS-4.1.4/.gitignore | 1 + archie/lib/archstridx/SunOS-4.1.4/Makefile.in | 16 + archie/lib/archstridx/SunOS-5.4/.gitignore | 1 + archie/lib/archstridx/SunOS-5.4/Makefile.in | 15 + archie/lib/archstridx/SunOS-5.6 | 1 + archie/lib/archstridx/Test.h | 20 + archie/lib/archstridx/Test_archstridx.c | 430 + archie/lib/archstridx/Test_exists.c | 25 + archie/lib/archstridx/Test_exists.sh | 52 + archie/lib/archstridx/Test_lock.c | 125 + archie/lib/archstridx/Test_regex.c | 223 + archie/lib/archstridx/Test_regexp.c | 208 + archie/lib/archstridx/Test_state.c | 143 + archie/lib/archstridx/Test_strsrch.c | 163 + archie/lib/archstridx/all.h | 95 + archie/lib/archstridx/api.c | 1946 +++ archie/lib/archstridx/archstridx.h | 51 + archie/lib/archstridx/lock.c | 114 + archie/lib/archstridx/lock.h | 5 + archie/lib/archstridx/newstr.c | 697 + archie/lib/archstridx/newstr.h | 14 + archie/lib/archstridx/re.c | 250 + archie/lib/archstridx/re.h | 6 + archie/lib/archstridx/strsrch.c | 230 + archie/lib/archstridx/strsrch.h | 47 + archie/lib/archstridx/utils.c | 208 + archie/lib/archstridx/utils.h | 15 + archie/lib/hostdb/.gitignore | 1 + archie/lib/hostdb/AIX-2/.gitignore | 1 + archie/lib/hostdb/AIX-2/Makefile.in | 11 + archie/lib/hostdb/Makefile.post | 20 + archie/lib/hostdb/Makefile.pre | 38 + archie/lib/hostdb/SunOS-4.1.4/.gitignore | 1 + archie/lib/hostdb/SunOS-4.1.4/Makefile.in | 10 + archie/lib/hostdb/SunOS-5.4/.gitignore | 1 + archie/lib/hostdb/SunOS-5.4/Makefile.in | 14 + archie/lib/hostdb/SunOS-5.6 | 1 + archie/lib/hostdb/databases.c | 73 + archie/lib/hostdb/domain.c | 267 + archie/lib/hostdb/holder.c | 420 + archie/lib/hostdb/host_db.c | 763 + archie/lib/hostdb/host_info.c | 536 + archie/lib/hostdb/host_inter.c | 1 + archie/lib/hostdb/host_inter.c.0 | 668 + archie/lib/hostdb/host_inter.c.1 | 726 + archie/lib/hostdb/lang_hostdb.c | 84 + archie/lib/hostdb/lang_hostdb.h | 95 + archie/lib/hostdb/ops.c | 374 + archie/lib/libarchie/.gitignore | 1 + archie/lib/libarchie/AIX-2/.gitignore | 1 + archie/lib/libarchie/AIX-2/Makefile.in | 11 + archie/lib/libarchie/Makefile.post | 20 + archie/lib/libarchie/Makefile.pre | 50 + archie/lib/libarchie/SunOS-4.1.4/.gitignore | 1 + archie/lib/libarchie/SunOS-4.1.4/Makefile.in | 10 + archie/lib/libarchie/SunOS-5.4/.gitignore | 1 + archie/lib/libarchie/SunOS-5.4/Makefile.in | 12 + archie/lib/libarchie/SunOS-5.6 | 1 + archie/lib/libarchie/archie_dbm.c | 145 + archie/lib/libarchie/archie_dns.c | 615 + archie/lib/libarchie/archie_inet.c | 266 + archie/lib/libarchie/archie_mail.c | 153 + archie/lib/libarchie/archie_prospero.c | 58 + archie/lib/libarchie/archie_strings.c | 792 + archie/lib/libarchie/archie_xdr.c | 195 + archie/lib/libarchie/error.c | 314 + archie/lib/libarchie/files.c | 1133 ++ archie/lib/libarchie/header.c | 827 ++ archie/lib/libarchie/lang_libarchie.c | 160 + archie/lib/libarchie/lang_libarchie.h | 152 + archie/lib/libarchie/log.h | 21 + archie/lib/libarchie/master.c | 239 + archie/lib/libarchie/misc.c | 154 + archie/lib/libarchie/options.c | 179 + archie/lib/libarchie/site_index.c | 132 + archie/lib/libarchie/stubs.c | 37 + archie/lib/libarchie/timelocal.c | 191 + archie/lib/libarchie/times.c | 193 + archie/lib/libarchie/version.c | 24 + archie/lib/libgopherindex/.gitignore | 1 + .../libgopherindex/DRAFT_Gopher_FYI_RFC.txt | 699 + archie/lib/libgopherindex/Makefile.in | 71 + archie/lib/libgopherindex/gindexdb_ops.c | 300 + archie/lib/libgopherindex/host_hash.c | 78 + .../lib/libgopherindex/lang_libgopherindex.c | 6 + .../lib/libgopherindex/lang_libgopherindex.h | 10 + archie/lib/libparchie/.gitignore | 1 + archie/lib/libparchie/AIX-2/.gitignore | 1 + archie/lib/libparchie/AIX-2/Makefile.in | 11 + archie/lib/libparchie/MakeLinks | 36 + archie/lib/libparchie/Makefile.post | 20 + archie/lib/libparchie/Makefile.pre | 89 + archie/lib/libparchie/SunOS-4.1.4/.gitignore | 1 + archie/lib/libparchie/SunOS-4.1.4/Makefile.in | 10 + archie/lib/libparchie/SunOS-5.4/.gitignore | 1 + archie/lib/libparchie/SunOS-5.4/Makefile.in | 14 + archie/lib/libparchie/SunOS-5.6 | 1 + archie/lib/libparchie/ar_search.c | 1 + archie/lib/libparchie/archie_catalogs.c | 677 + archie/lib/libparchie/archie_dbm.c | 1 + archie/lib/libparchie/archie_dns.c | 1 + archie/lib/libparchie/archie_inet.c | 1 + archie/lib/libparchie/archie_prospero.c | 1 + archie/lib/libparchie/archie_strings.c | 1 + archie/lib/libparchie/argv.c | 365 + archie/lib/libparchie/casesrch.c | 1 + archie/lib/libparchie/databases.c | 1 + archie/lib/libparchie/db_ops.c | 1 + archie/lib/libparchie/domain.c | 1 + archie/lib/libparchie/error.c | 1 + archie/lib/libparchie/files.c | 1 + archie/lib/libparchie/find_str.c | 169 + archie/lib/libparchie/gindexdb_ops.c | 1 + archie/lib/libparchie/header.c | 1 + archie/lib/libparchie/holder.c | 1 + archie/lib/libparchie/host_db.c | 1 + archie/lib/libparchie/host_info.c | 1 + archie/lib/libparchie/host_inter.c | 1 + archie/lib/libparchie/lang_anonftp.c | 1 + archie/lib/libparchie/lang_hostdb.c | 1 + archie/lib/libparchie/lang_hostdb.h | 1 + archie/lib/libparchie/lang_libanonftp.c | 1 + archie/lib/libparchie/lang_libanonftp.h | 1 + archie/lib/libparchie/lang_libarchie.c | 1 + archie/lib/libparchie/lang_libarchie.h | 1 + archie/lib/libparchie/lang_libgopherindex.c | 1 + archie/lib/libparchie/lang_libgopherindex.h | 1 + archie/lib/libparchie/list_site.c | 1 + archie/lib/libparchie/master.c | 1 + archie/lib/libparchie/match.c | 1 + archie/lib/libparchie/ops.c | 1 + archie/lib/libparchie/parchie_cache.c | 506 + archie/lib/libparchie/parchie_cache.h | 26 + archie/lib/libparchie/parchie_host_dir.c | 429 + archie/lib/libparchie/parchie_lib.c | 123 + archie/lib/libparchie/parchie_lib.h | 5 + archie/lib/libparchie/parchie_list_host.c | 362 + .../lib/libparchie/parchie_search_files_db.c | 1037 ++ .../lib/libparchie/parchie_search_files_db.h | 16 + .../lib/libparchie/parchie_search_gindex_db.c | 810 + .../lib/libparchie/parchie_search_gindex_db.h | 24 + archie/lib/libparchie/prarch.c | 1 + archie/lib/libparchie/prarch_match.c | 1 + archie/lib/libparchie/prlist.c | 1 + archie/lib/libparchie/restrict.c | 321 + archie/lib/libparchie/times.c | 1 + archie/lib/libparchie/version.c | 1 + archie/lib/libpsarchie/.gitignore | 1 + archie/lib/libpsarchie/AIX-2/.gitignore | 0 archie/lib/libpsarchie/AIX-2/Makefile.in | 11 + archie/lib/libpsarchie/Makefile.post | 17 + archie/lib/libpsarchie/Makefile.pre | 24 + archie/lib/libpsarchie/README | 55 + archie/lib/libpsarchie/SunOS-4.1.4/.gitignore | 1 + .../lib/libpsarchie/SunOS-4.1.4/Makefile.in | 10 + archie/lib/libpsarchie/SunOS-5.4/.gitignore | 1 + archie/lib/libpsarchie/SunOS-5.4/Makefile.in | 14 + archie/lib/libpsarchie/SunOS-5.6 | 1 + archie/lib/libpsarchie/arch_dsdb.c | 1492 ++ archie/lib/libpsarchie/arch_prioritize.c | 80 + archie/lib/libpsarchie/arch_time.c | 260 + archie/lib/patrie/.gitignore | 1 + archie/lib/patrie/AIX-2/.gitignore | 1 + archie/lib/patrie/AIX-2/Makefile.in | 11 + archie/lib/patrie/CheckPaged.c | 62 + archie/lib/patrie/DiffSort.c | 70 + archie/lib/patrie/ExSort.c | 206 + archie/lib/patrie/LevelDump.c | 66 + archie/lib/patrie/Levels.c | 54 + archie/lib/patrie/Makefile.post | 110 + archie/lib/patrie/Makefile.pre | 141 + archie/lib/patrie/RandSearch.c | 232 + archie/lib/patrie/RandText.c | 101 + archie/lib/patrie/Sort2Infix.c | 182 + archie/lib/patrie/SunOS-4.1.4/.gitignore | 1 + archie/lib/patrie/SunOS-4.1.4/Makefile.in | 20 + archie/lib/patrie/SunOS-5.4/.gitignore | 1 + archie/lib/patrie/SunOS-5.4/Makefile.in | 15 + archie/lib/patrie/SunOS-5.6 | 1 + archie/lib/patrie/TODO | 27 + archie/lib/patrie/Test.c | 197 + archie/lib/patrie/Test.h | 16 + archie/lib/patrie/Test_GetSubstring.c | 72 + archie/lib/patrie/Test_bits.c | 149 + archie/lib/patrie/Test_bs.c | 322 + archie/lib/patrie/Test_check_paged.c | 62 + archie/lib/patrie/Test_complete_build | 26 + archie/lib/patrie/Test_copybits.c | 159 + archie/lib/patrie/Test_fast_ustrcmp.c | 230 + archie/lib/patrie/Test_fast_ustrncmp.c | 318 + archie/lib/patrie/Test_nsearch.c | 101 + archie/lib/patrie/Test_page.c | 154 + archie/lib/patrie/Test_page2.c | 132 + archie/lib/patrie/Test_ptr_stack.c | 163 + archie/lib/patrie/Test_random | 36 + archie/lib/patrie/Test_search.c | 135 + archie/lib/patrie/Test_sort.c | 85 + archie/lib/patrie/Test_sort2infix.c | 182 + archie/lib/patrie/Test_state.c | 170 + archie/lib/patrie/Test_stats_infix.c | 70 + archie/lib/patrie/Test_strcmp.c | 21 + archie/lib/patrie/Test_tolower.c | 44 + archie/lib/patrie/Time_page | 19 + archie/lib/patrie/bits.c | 69 + archie/lib/patrie/bits.h | 2 + archie/lib/patrie/build.c | 97 + archie/lib/patrie/case.c | 365 + archie/lib/patrie/case.h | 33 + archie/lib/patrie/defs.h | 201 + archie/lib/patrie/init.c | 382 + archie/lib/patrie/init.h | 1 + archie/lib/patrie/int_stack.c | 61 + archie/lib/patrie/int_stack.h | 12 + archie/lib/patrie/lenhist | 12 + archie/lib/patrie/levels.c | 546 + archie/lib/patrie/levels.h | 4 + archie/lib/patrie/node.c | 14 + archie/lib/patrie/page.c | 1115 ++ archie/lib/patrie/page.h | 1 + archie/lib/patrie/patrie.h | 67 + archie/lib/patrie/ptr_stack.c | 164 + archie/lib/patrie/ptr_stack.h | 13 + archie/lib/patrie/search.c | 1009 ++ archie/lib/patrie/search.h | 16 + archie/lib/patrie/sort.c | 679 + archie/lib/patrie/sort.h | 4 + archie/lib/patrie/state.c | 646 + archie/lib/patrie/state.h | 19 + archie/lib/patrie/text.c | 65 + archie/lib/patrie/timing.c | 33 + archie/lib/patrie/timing.h | 14 + archie/lib/patrie/trailer.c | 89 + archie/lib/patrie/trailer.h | 2 + archie/lib/patrie/utils.c | 260 + archie/lib/patrie/utils.h | 10 + archie/lib/regex/.gitignore | 1 + archie/lib/regex/AIX-2/.gitignore | 1 + archie/lib/regex/AIX-2/Makefile.in | 11 + archie/lib/regex/Makefile.post | 15 + archie/lib/regex/Makefile.pre | 31 + archie/lib/regex/README | 84 + archie/lib/regex/SunOS-4.1.4/.gitignore | 1 + archie/lib/regex/SunOS-4.1.4/Makefile.in | 10 + archie/lib/regex/regerror.c | 14 + archie/lib/regex/regexp.3 | 179 + archie/lib/regex/regexp.c | 1215 ++ archie/lib/regex/regexp.h | 21 + archie/lib/regex/regmagic.h | 5 + archie/lib/regex/regsub.c | 82 + archie/lib/regex/tests | 127 + archie/lib/regex/timer.c | 182 + archie/lib/regex/timer.t.h | 127 + archie/lib/regex/try.c | 238 + archie/lib/reposix/.gitignore | 1 + archie/lib/reposix/AIX-2/.gitignore | 1 + archie/lib/reposix/AIX-2/Makefile.in | 11 + archie/lib/reposix/COPYRIGHT | 58 + archie/lib/reposix/Makefile.inc | 14 + archie/lib/reposix/Makefile.post | 16 + archie/lib/reposix/Makefile.pre | 43 + archie/lib/reposix/SunOS-4.1.4/.gitignore | 1 + archie/lib/reposix/SunOS-4.1.4/Makefile.in | 11 + archie/lib/reposix/SunOS-5.4/.gitignore | 1 + archie/lib/reposix/SunOS-5.4/Makefile.in | 12 + archie/lib/reposix/SunOS-5.6 | 1 + archie/lib/reposix/WHATSNEW | 95 + archie/lib/reposix/cclass.h | 72 + archie/lib/reposix/cname.h | 143 + archie/lib/reposix/engine.c | 1093 ++ archie/lib/reposix/re_format.7 | 271 + archie/lib/reposix/regcomp.c | 1704 +++ archie/lib/reposix/regerror.c | 186 + archie/lib/reposix/regex.3 | 540 + archie/lib/reposix/regex.h | 109 + archie/lib/reposix/regex2.h | 175 + archie/lib/reposix/regexec.c | 187 + archie/lib/reposix/regfree.c | 86 + archie/lib/reposix/sys/cdefs.h | 14 + archie/lib/reposix/utils.h | 59 + archie/lib/startdb/.gitignore | 1 + archie/lib/startdb/AIX-2/.gitignore | 1 + archie/lib/startdb/AIX-2/Makefile.in | 11 + archie/lib/startdb/Makefile.post | 21 + archie/lib/startdb/Makefile.pre | 39 + archie/lib/startdb/SunOS-4.1.4/.gitignore | 1 + archie/lib/startdb/SunOS-4.1.4/Makefile.in | 10 + archie/lib/startdb/SunOS-5.4/.gitignore | 1 + archie/lib/startdb/SunOS-5.4/Makefile.in | 14 + archie/lib/startdb/SunOS-5.6 | 1 + archie/lib/startdb/domain.c | 219 + archie/lib/startdb/host_table.c | 336 + archie/lib/startdb/lang_startdb.c | 15 + archie/lib/startdb/lang_startdb.h | 94 + archie/lib/startdb/new/domain.c | 130 + archie/lib/startdb/new/host_table.c | 267 + archie/lib/startdb/new/lang_startdb.c | 15 + archie/lib/startdb/new/lang_startdb.h | 94 + archie/lib/startdb/new/start_db.c | 316 + archie/lib/startdb/new/start_db.h | 63 + archie/lib/startdb/reorder.c | 87 + archie/lib/startdb/start_db.c | 409 + archie/lib/startdb/start_db.h | 70 + archie/ppc/.gitignore | 1 + archie/ppc/Makefile.in | 18 + archie/ppc/ferretd/.gitignore | 1 + archie/ppc/ferretd/AIX-2/.gitignore | 1 + archie/ppc/ferretd/AIX-2/Makefile.in | 11 + archie/ppc/ferretd/Makefile.post | 63 + archie/ppc/ferretd/Makefile.pre | 69 + archie/ppc/ferretd/SunOS-4.1.4/.gitignore | 1 + archie/ppc/ferretd/SunOS-4.1.4/Makefile.in | 13 + archie/ppc/ferretd/SunOS-5.4/.gitignore | 1 + archie/ppc/ferretd/SunOS-5.4/Makefile.in | 13 + archie/ppc/ferretd/SunOS-5.6 | 1 + archie/ppc/ferretd/_prog.c | 159 + archie/ppc/ferretd/aprint.h | 22 + archie/ppc/ferretd/authorization.c | 448 + archie/ppc/ferretd/authorization.h | 9 + archie/ppc/ferretd/chartab.c | 190 + archie/ppc/ferretd/contents.c | 450 + archie/ppc/ferretd/contents.h | 10 + archie/ppc/ferretd/file_type.c | 322 + archie/ppc/ferretd/file_type.h | 12 + archie/ppc/ferretd/http.c | 374 + archie/ppc/ferretd/http.h | 13 + archie/ppc/ferretd/image_map.c | 211 + archie/ppc/ferretd/image_map.h | 12 + archie/ppc/ferretd/polygon.c | 139 + archie/ppc/ferretd/polygon.h | 9 + archie/ppc/ferretd/print_anon.c | 268 + archie/ppc/ferretd/print_gopher.c | 77 + archie/ppc/ferretd/print_results.c | 585 + archie/ppc/ferretd/print_results.h | 12 + archie/ppc/ferretd/print_sites.c | 14 + archie/ppc/ferretd/print_wais.c | 166 + archie/ppc/ferretd/request.c | 436 + archie/ppc/ferretd/request.h | 119 + archie/ppc/ferretd/search.c | 170 + archie/ppc/ferretd/search.h | 11 + archie/ppc/ferretd/url.c | 136 + archie/ppc/ferretd/url.h | 20 + archie/ppc/lib/.gitignore | 1 + archie/ppc/lib/AIX-2/.gitignore | 1 + archie/ppc/lib/AIX-2/Makefile.in | 11 + archie/ppc/lib/Makefile.in | 71 + archie/ppc/lib/Makefile.libmenu | 12 + archie/ppc/lib/Makefile.post | 19 + archie/ppc/lib/Makefile.pre | 128 + archie/ppc/lib/SunOS-4.1.4/.gitignore | 1 + archie/ppc/lib/SunOS-4.1.4/Makefile.in | 11 + archie/ppc/lib/SunOS-5.4/.gitignore | 1 + archie/ppc/lib/SunOS-5.4/Makefile.in | 14 + archie/ppc/lib/SunOS-5.6 | 1 + archie/ppc/lib/_prog.h | 16 + archie/ppc/lib/all.h | 9 + archie/ppc/lib/ansi.h | 1 + archie/ppc/lib/class.c | 239 + archie/ppc/lib/class.h | 30 + archie/ppc/lib/debug.c | 147 + archie/ppc/lib/debug.h | 13 + archie/ppc/lib/defs.h | 40 + archie/ppc/lib/epath.c | 453 + archie/ppc/lib/epath.h | 11 + archie/ppc/lib/error.c | 197 + archie/ppc/lib/error.h | 13 + archie/ppc/lib/gopher.c | 112 + archie/ppc/lib/gopher.h | 26 + archie/ppc/lib/host_access.c | 128 + archie/ppc/lib/host_access.h | 15 + archie/ppc/lib/io.c | 481 + archie/ppc/lib/io.h | 22 + archie/ppc/lib/local_attrs.h | 14 + archie/ppc/lib/main.c | 517 + archie/ppc/lib/misc.c | 169 + archie/ppc/lib/misc.h | 19 + archie/ppc/lib/my_rd_vlink.c | 137 + archie/ppc/lib/my_rd_vlink.h | 10 + archie/ppc/lib/net.c | 259 + archie/ppc/lib/net.h | 18 + archie/ppc/lib/os_indep.c | 64 + archie/ppc/lib/os_indep.h | 13 + archie/ppc/lib/output.c | 97 + archie/ppc/lib/output.h | 10 + archie/ppc/lib/parchie.h | 164 + archie/ppc/lib/pattrib.c | 217 + archie/ppc/lib/pattrib.h | 18 + archie/ppc/lib/pencode.h | 10 + archie/ppc/lib/ppc.h | 41 + archie/ppc/lib/ppc.man | 108 + archie/ppc/lib/ppc_front_end.c | 125 + archie/ppc/lib/ppc_front_end.h | 32 + archie/ppc/lib/ppc_tcl.c | 542 + archie/ppc/lib/ppc_tcl.h | 13 + archie/ppc/lib/ppc_time.c | 115 + archie/ppc/lib/ppc_time.h | 9 + archie/ppc/lib/prosp.h | 9 + archie/ppc/lib/prospquery.c | 463 + archie/ppc/lib/psearch.c | 379 + archie/ppc/lib/psearch.h | 29 + archie/ppc/lib/ptrval.c | 29 + archie/ppc/lib/ptrval.h | 20 + archie/ppc/lib/quoting.c | 204 + archie/ppc/lib/quoting.h | 13 + archie/ppc/lib/redirect.c | 133 + archie/ppc/lib/redirect.h | 12 + archie/ppc/lib/results.c | 131 + archie/ppc/lib/results.h | 41 + archie/ppc/lib/srch.c | 51 + archie/ppc/lib/srch.h | 21 + archie/ppc/lib/str.c | 729 + archie/ppc/lib/str.h | 36 + archie/ppc/lib/strhash.c | 239 + archie/ppc/lib/strhash.h | 32 + archie/ppc/lib/strval.c | 20 + archie/ppc/lib/strval.h | 15 + archie/ppc/lib/stubs.c | 32 + archie/ppc/lib/sub.c | 57 + archie/ppc/lib/sub.h | 9 + archie/ppc/lib/token.c | 65 + archie/ppc/lib/token.h | 11 + archie/ppc/lib/vlink.c | 66 + archie/ppc/lib/vlink.h | 15 + archie/ppc/lib/waisattrib.c | 149 + archie/ppc/lib/waisattrib.h | 12 + archie/ppc/tcl/.gitignore | 1 + archie/ppc/tcl/AIX-2/.gitignore | 1 + archie/ppc/tcl/AIX-2/Makefile.in | 11 + archie/ppc/tcl/Makefile.in | 104 + archie/ppc/tcl/Makefile.post | 29 + archie/ppc/tcl/Makefile.pre | 65 + archie/ppc/tcl/SunOS-4.1.4/.gitignore | 1 + archie/ppc/tcl/SunOS-4.1.4/Makefile.in | 10 + archie/ppc/tcl/SunOS-5.4/.gitignore | 1 + archie/ppc/tcl/SunOS-5.4/Makefile.in | 9 + archie/ppc/tcl/SunOS-5.6 | 1 + archie/ppc/tcl/dpInt.h | 115 + archie/ppc/tcl/prsp.c | 789 + archie/ppc/tcl/prsp.h | 9 + archie/ppc/tcl/prsp_vlink.c | 302 + archie/ppc/tcl/prsp_vlink.h | 13 + archie/ppc/tcl/tclAppInit.c | 122 + archie/ppc/tcl/tkAppInit.c | 108 + archie/ppc/tcl/tkMain.c | 473 + archie/ppc/tcl/vls.tcl | 21 + archie/ppc/tcl/wais_search.tcl | 226 + archie/ppc/test/.gitignore | 1 + archie/ppc/test/AIX-2/.gitignore | 1 + archie/ppc/test/AIX-2/Makefile.in | 11 + archie/ppc/test/Makefile.in | 107 + archie/ppc/test/SunOS-4.1.4/.gitignore | 1 + archie/ppc/test/SunOS-4.1.4/Makefile.in | 10 + archie/ppc/test/SunOS-5.4/.gitignore | 1 + archie/ppc/test/SunOS-5.4/Makefile.in | 9 + archie/ppc/test/SunOS-5.6 | 1 + archie/ppc/test/ppctest.c | 248 + archie/ppc/test/test-Accept.txt | 12 + archie/ppc/test/test-access.c | 63 + archie/ppc/test/test-io.c | 33 + archie/ppc/test/test-link_to.c | 41 + archie/ppc/test/test-poly.c | 144 + archie/ppc/test/test-qwstrnsplit.c | 42 + archie/ppc/test/test-results.c | 69 + archie/ppc/test/test-splitwhite.c | 84 + archie/ppc/test/test-str.c | 90 + archie/ppc/test/test-strrspn.c | 62 + archie/ppc/test/test-token.c | 88 + archie/ppc/test/test-varsub.c | 35 + archie/ppc/test/varsub.dat | 17 + archie/ppc/weaseld/.gitignore | 1 + archie/ppc/weaseld/AIX-2/.gitignore | 1 + archie/ppc/weaseld/AIX-2/Makefile.in | 11 + archie/ppc/weaseld/Makefile.in | 86 + archie/ppc/weaseld/Makefile.post | 63 + archie/ppc/weaseld/Makefile.pre | 47 + archie/ppc/weaseld/SunOS-4.1.4/.gitignore | 1 + archie/ppc/weaseld/SunOS-4.1.4/Makefile.in | 17 + archie/ppc/weaseld/SunOS-5.4/.gitignore | 1 + archie/ppc/weaseld/SunOS-5.4/Makefile.in | 17 + archie/ppc/weaseld/SunOS-5.6 | 1 + archie/ppc/weaseld/_prog.c | 726 + archie/ppc/weaseld/aprint.h | 22 + archie/ppc/weaseld/contents.c | 528 + archie/ppc/weaseld/contents.h | 12 + archie/ppc/weaseld/gs.tcl | 39 + archie/ppc/weaseld/print_anon.c | 208 + archie/ppc/weaseld/print_gopher.c | 68 + archie/ppc/weaseld/print_sites.c | 31 + archie/ppc/weaseld/print_wais.c | 209 + archie/ppc/weaseld/url.c | 99 + archie/ppc/weaseld/url.h | 13 + archie/tools/.gitignore | 1 + archie/tools/AIX-2/.gitignore | 1 + archie/tools/AIX-2/Makefile.in | 10 + archie/tools/Makefile.post | 180 + archie/tools/Makefile.pre | 74 + archie/tools/SunOS-4.1.4/.gitignore | 1 + archie/tools/SunOS-4.1.4/Makefile.in | 11 + archie/tools/SunOS-5.4/.gitignore | 1 + archie/tools/SunOS-5.4/Makefile.in | 15 + archie/tools/SunOS-5.6 | 1 + archie/tools/ardomain.c | 346 + archie/tools/convert_hostdb.c | 455 + archie/tools/db_build.c | 324 + archie/tools/db_check.c | 672 + archie/tools/db_dump.c | 315 + archie/tools/db_reorder.c | 349 + archie/tools/db_siteidx.c | 447 + archie/tools/db_stats.c | 804 + archie/tools/dbspecs.c | 215 + archie/tools/dump_hostdb.c | 345 + archie/tools/fix_start_db.c | 616 + archie/tools/host_manage.c | 1757 +++ archie/tools/host_manage.h | 80 + archie/tools/lang_tools.c | 233 + archie/tools/lang_tools.h | 229 + archie/tools/listd.h | 42 + archie/tools/old_host_db.h | 8 + archie/tools/old_hostdb.c | 487 + archie/tools/old_hostdb.h | 53 + archie/tools/restore_hostdb.c | 648 + archie/tools/screen.c | 2295 +++ archie/tools/screen.h | 184 + archie/tools/utils.c | 330 + archie/tools/utils.h | 42 + archie/webindex/.gitignore | 1 + archie/webindex/Makefile.in | 12 + archie/webindex/client/AIX-2/.gitignore | 1 + archie/webindex/client/AIX-2/Makefile.in | 11 + archie/webindex/client/SunOS-4.1.4/.gitignore | 1 + archie/webindex/client/SunOS-5.4/.gitignore | 1 + archie/webindex/client/SunOS-5.6 | 1 + archie/webindex/lib/.gitignore | 1 + archie/webindex/lib/AIX-2/.gitignore | 1 + archie/webindex/lib/AIX-2/Makefile.in | 11 + archie/webindex/lib/Makefile.post | 16 + archie/webindex/lib/Makefile.pre | 48 + archie/webindex/lib/SunOS-4.1.4/.gitignore | 1 + archie/webindex/lib/SunOS-4.1.4/Makefile.in | 10 + archie/webindex/lib/SunOS-5.4/.gitignore | 1 + archie/webindex/lib/SunOS-5.4/Makefile.in | 14 + archie/webindex/lib/SunOS-5.6 | 1 + archie/webindex/lib/excerpt.c | 95 + archie/webindex/lib/excerpt.h | 12 + archie/webindex/lib/lang_libwebindex.c | 6 + archie/webindex/lib/lang_libwebindex.h | 10 + archie/webindex/lib/lang_weblib.h | 6 + archie/webindex/lib/sub_header.c | 363 + archie/webindex/lib/sub_header.h | 120 + archie/webindex/lib/sub_header_def.h | 26 + archie/webindex/lib/web.h | 17 + archie/webindex/lib/webindexdb_ops.c | 211 + archie/webindex/lib/webindexdb_ops.h | 37 + archie/webindex/parse/.gitignore | 1 + archie/webindex/parse/AIX-2/.gitignore | 1 + archie/webindex/parse/AIX-2/Makefile.in | 9 + archie/webindex/parse/Makefile.post | 26 + archie/webindex/parse/Makefile.pre | 56 + archie/webindex/parse/SunOS-4.1.4/.gitignore | 1 + archie/webindex/parse/SunOS-4.1.4/Makefile.in | 11 + archie/webindex/parse/SunOS-5.4/.gitignore | 1 + archie/webindex/parse/SunOS-5.4/Makefile.in | 11 + archie/webindex/parse/SunOS-5.6 | 1 + archie/webindex/parse/charset.c | 164 + archie/webindex/parse/charset.h | 7 + archie/webindex/parse/do_parse.c | 216 + archie/webindex/parse/excerpt.c | 244 + archie/webindex/parse/keywords.c | 489 + archie/webindex/parse/lang_parsers.c | 40 + archie/webindex/parse/lang_parsers.h | 29 + archie/webindex/parse/parse.c | 566 + archie/webindex/parse/parse.h | 20 + archie/webindex/parse/recurse.c | 666 + archie/webindex/parse/stem.c | 310 + archie/webindex/parse/stoplist | 389 + archie/webindex/parse/stoplist.c | 95 + archie/webindex/partial/.gitignore | 1 + archie/webindex/partial/AIX-2/.gitignore | 1 + archie/webindex/partial/AIX-2/Makefile.in | 8 + archie/webindex/partial/Makefile.post | 24 + archie/webindex/partial/Makefile.pre | 32 + .../webindex/partial/SunOS-4.1.4/.gitignore | 1 + .../webindex/partial/SunOS-4.1.4/Makefile.in | 11 + archie/webindex/partial/SunOS-5.4/.gitignore | 1 + archie/webindex/partial/SunOS-5.4/Makefile.in | 11 + archie/webindex/partial/SunOS-5.6 | 1 + archie/webindex/partial/do_partial.c | 550 + archie/webindex/partial/partial_web.c | 708 + archie/webindex/retrieve/.gitignore | 1 + archie/webindex/retrieve/AIX-2/.gitignore | 1 + archie/webindex/retrieve/AIX-2/Makefile.in | 9 + archie/webindex/retrieve/Makefile.post | 24 + archie/webindex/retrieve/Makefile.pre | 60 + .../webindex/retrieve/SunOS-4.1.4/.gitignore | 1 + .../webindex/retrieve/SunOS-4.1.4/Makefile.in | 11 + archie/webindex/retrieve/SunOS-5.4/.gitignore | 1 + .../webindex/retrieve/SunOS-5.4/Makefile.in | 11 + archie/webindex/retrieve/SunOS-5.6 | 1 + archie/webindex/retrieve/date.c | 81 + archie/webindex/retrieve/do_retrieve.c | 1464 ++ archie/webindex/retrieve/fileUrl.c | 157 + archie/webindex/retrieve/fileUrl.h | 8 + archie/webindex/retrieve/html.h | 7 + archie/webindex/retrieve/http.c | 200 + archie/webindex/retrieve/http.h | 16 + archie/webindex/retrieve/lang_retrieve.c | 53 + archie/webindex/retrieve/lang_retrieve.h | 43 + archie/webindex/retrieve/menu.c | 65 + archie/webindex/retrieve/menu.h | 26 + archie/webindex/retrieve/parse.c | 688 + archie/webindex/retrieve/retrieve_web.c | 344 + archie/webindex/retrieve/retrieve_web.h | 49 + archie/webindex/retrieve/robot.c | 309 + archie/webindex/retrieve/robot.h | 2 + archie/webindex/retrieve/str.c | 25 + archie/webindex/retrieve/str.h | 2 + archie/webindex/retrieve/tcp.c | 227 + archie/webindex/retrieve/tt.c | 76 + archie/webindex/retrieve/url.c | 296 + archie/webindex/retrieve/url.h | 29 + archie/webindex/retrieve/urldb.c | 637 + archie/webindex/retrieve/urldb.h | 22 + archie/webindex/tools/.gitignore | 1 + archie/webindex/tools/AIX-2/.gitignore | 1 + archie/webindex/tools/AIX-2/Makefile.in | 9 + archie/webindex/tools/Makefile.post | 29 + archie/webindex/tools/Makefile.pre | 33 + archie/webindex/tools/SunOS-4.1.4/.gitignore | 1 + archie/webindex/tools/SunOS-4.1.4/Makefile.in | 11 + archie/webindex/tools/SunOS-5.4/.gitignore | 1 + archie/webindex/tools/SunOS-5.4/Makefile.in | 13 + archie/webindex/tools/SunOS-5.6 | 1 + archie/webindex/tools/extern_urls.c | 538 + archie/webindex/tools/extern_urls.h | 8 + archie/webindex/tools/lang_tools.c | 16 + archie/webindex/tools/lang_tools.h | 14 + archie/webindex/update/.gitignore | 1 + archie/webindex/update/AIX-2/.gitignore | 1 + archie/webindex/update/AIX-2/Makefile.in | 9 + archie/webindex/update/Makefile.post | 55 + archie/webindex/update/Makefile.pre | 60 + archie/webindex/update/SunOS-4.1.4/.gitignore | 1 + .../webindex/update/SunOS-4.1.4/Makefile.in | 11 + archie/webindex/update/SunOS-5.4/.gitignore | 1 + archie/webindex/update/SunOS-5.4/Makefile.in | 11 + archie/webindex/update/SunOS-5.6 | 1 + archie/webindex/update/check_webindex.c | 582 + archie/webindex/update/check_webindex.h | 21 + archie/webindex/update/delete_webindex.c | 432 + archie/webindex/update/delete_webindex.h | 13 + archie/webindex/update/insert_webindex.c | 1280 ++ archie/webindex/update/insert_webindex.h | 45 + archie/webindex/update/interact_webindex.c | 539 + archie/webindex/update/interact_webindex.h | 22 + archie/webindex/update/lang_webindex.c | 284 + archie/webindex/update/lang_webindex.h | 291 + archie/webindex/update/net_webindex.c | 2003 +++ archie/webindex/update/net_webindex.h | 15 + archie/webindex/update/setup_delete.c | 132 + archie/webindex/update/setup_insert.c | 317 + berkdb/Makefile.inc | 10 + berkdb/PORT/Makefile | 102 + berkdb/PORT/README | 131 + berkdb/PORT/SunOS-5.6 | 1 + berkdb/PORT/aix.3.2/Makefile | 102 + berkdb/PORT/aix.3.2/clib | 1 + berkdb/PORT/aix.3.2/include/cdefs.h | 1 + berkdb/PORT/aix.3.2/include/compat.h | 231 + berkdb/PORT/aix.3.2/include/db.h | 1 + berkdb/PORT/aix.3.2/include/mpool.h | 1 + berkdb/PORT/aix.3.2/include/ndbm.h | 1 + berkdb/PORT/aix.3.2/include/queue.h | 1 + berkdb/PORT/aix.3.2/sys | 1 + berkdb/PORT/bsd.4.4/Makefile | 1 + berkdb/PORT/bsd.4.4/clib | 1 + berkdb/PORT/bsd.4.4/include/cdefs.h | 1 + berkdb/PORT/bsd.4.4/include/compat.h | 1 + berkdb/PORT/bsd.4.4/include/db.h | 222 + berkdb/PORT/bsd.4.4/include/mpool.h | 1 + berkdb/PORT/bsd.4.4/include/ndbm.h | 1 + berkdb/PORT/bsd.4.4/include/queue.h | 1 + berkdb/PORT/bsd.4.4/sys | 1 + berkdb/PORT/bsdi.1.0/Makefile | 1 + berkdb/PORT/bsdi.1.0/OTHER_PATCHES | 19 + berkdb/PORT/bsdi.1.0/clib | 1 + berkdb/PORT/bsdi.1.0/include/assert.h | 54 + berkdb/PORT/bsdi.1.0/include/cdefs.h | 1 + berkdb/PORT/bsdi.1.0/include/compat.h | 231 + berkdb/PORT/bsdi.1.0/include/db.h | 1 + berkdb/PORT/bsdi.1.0/include/mpool.h | 1 + berkdb/PORT/bsdi.1.0/include/ndbm.h | 1 + berkdb/PORT/bsdi.1.0/include/queue.h | 1 + berkdb/PORT/bsdi.1.0/local/local.h | 87 + berkdb/PORT/bsdi.1.0/local/makebuf.c | 118 + berkdb/PORT/bsdi.1.0/local/setvbuf.c | 148 + berkdb/PORT/bsdi.1.0/sys | 1 + berkdb/PORT/clib/memmove.c | 139 + berkdb/PORT/clib/mktemp.c | 126 + berkdb/PORT/clib/snprintf.c | 54 + berkdb/PORT/clib/strerror.c | 67 + berkdb/PORT/dgux.5.4/Makefile | 103 + berkdb/PORT/dgux.5.4/clib | 1 + berkdb/PORT/dgux.5.4/include/cdefs.h | 1 + berkdb/PORT/dgux.5.4/include/compat.h | 231 + berkdb/PORT/dgux.5.4/include/db.h | 1 + berkdb/PORT/dgux.5.4/include/mpool.h | 1 + berkdb/PORT/dgux.5.4/include/ndbm.h | 1 + berkdb/PORT/dgux.5.4/include/queue.h | 1 + berkdb/PORT/dgux.5.4/sys | 1 + berkdb/PORT/hpux.8.07 | 1 + berkdb/PORT/hpux.9.01/Makefile | 102 + berkdb/PORT/hpux.9.01/clib | 1 + berkdb/PORT/hpux.9.01/include/cdefs.h | 1 + berkdb/PORT/hpux.9.01/include/compat.h | 231 + berkdb/PORT/hpux.9.01/include/db.h | 1 + berkdb/PORT/hpux.9.01/include/mpool.h | 1 + berkdb/PORT/hpux.9.01/include/ndbm.h | 1 + berkdb/PORT/hpux.9.01/include/queue.h | 1 + berkdb/PORT/hpux.9.01/local/hp_siglist.c | 75 + berkdb/PORT/hpux.9.01/sys | 1 + berkdb/PORT/include/cdefs.h | 122 + berkdb/PORT/include/compat.h | 231 + berkdb/PORT/include/db.h | 1 + berkdb/PORT/include/mpool.h | 1 + berkdb/PORT/include/ndbm.h | 77 + berkdb/PORT/include/queue.h | 245 + berkdb/PORT/irix.4.05F/Makefile | 103 + berkdb/PORT/irix.4.05F/OTHER_PATCHES | 32 + berkdb/PORT/irix.4.05F/clib | 1 + berkdb/PORT/irix.4.05F/include/cdefs.h | 1 + berkdb/PORT/irix.4.05F/include/compat.h | 231 + berkdb/PORT/irix.4.05F/include/db.h | 1 + berkdb/PORT/irix.4.05F/include/mpool.h | 1 + berkdb/PORT/irix.4.05F/include/ndbm.h | 1 + berkdb/PORT/irix.4.05F/include/queue.h | 1 + berkdb/PORT/irix.4.05F/sys | 1 + berkdb/PORT/linux/Makefile | 102 + berkdb/PORT/linux/OTHER_PATCHES | 29 + berkdb/PORT/linux/clib | 1 + berkdb/PORT/linux/include/compat.h | 231 + berkdb/PORT/linux/include/db.h | 1 + berkdb/PORT/linux/include/mpool.h | 1 + berkdb/PORT/linux/include/ndbm.h | 1 + berkdb/PORT/linux/sys | 1 + berkdb/PORT/osf.1.0.2/Makefile | 102 + berkdb/PORT/osf.1.0.2/clib | 1 + berkdb/PORT/osf.1.0.2/include/cdefs.h | 1 + berkdb/PORT/osf.1.0.2/include/compat.h | 231 + berkdb/PORT/osf.1.0.2/include/db.h | 1 + berkdb/PORT/osf.1.0.2/include/mpool.h | 1 + berkdb/PORT/osf.1.0.2/include/ndbm.h | 1 + berkdb/PORT/osf.1.0.2/include/queue.h | 1 + berkdb/PORT/osf.1.0.2/sys | 1 + berkdb/PORT/osf.1.3 | 1 + berkdb/PORT/osf.2.0 | 1 + berkdb/PORT/ptx.2.0/Makefile | 104 + berkdb/PORT/ptx.2.0/OTHER_PATCHES | 95 + berkdb/PORT/ptx.2.0/clib | 1 + berkdb/PORT/ptx.2.0/include/cdefs.h | 1 + berkdb/PORT/ptx.2.0/include/compat.h | 232 + berkdb/PORT/ptx.2.0/include/db.h | 1 + berkdb/PORT/ptx.2.0/include/mpool.h | 1 + berkdb/PORT/ptx.2.0/include/ndbm.h | 1 + berkdb/PORT/ptx.2.0/include/pathnames.h | 45 + berkdb/PORT/ptx.2.0/include/queue.h | 1 + berkdb/PORT/ptx.2.0/sys | 1 + berkdb/PORT/sinix.5.41/Makefile | 102 + berkdb/PORT/sinix.5.41/clib | 1 + berkdb/PORT/sinix.5.41/include/cdefs.h | 1 + berkdb/PORT/sinix.5.41/include/compat.h | 231 + berkdb/PORT/sinix.5.41/include/db.h | 1 + berkdb/PORT/sinix.5.41/include/mpool.h | 1 + berkdb/PORT/sinix.5.41/include/ndbm.h | 1 + berkdb/PORT/sinix.5.41/include/queue.h | 1 + berkdb/PORT/sinix.5.41/sys | 1 + berkdb/PORT/solaris.2.2 | 1 + berkdb/PORT/sunos.4.1.1/Makefile | 102 + berkdb/PORT/sunos.4.1.1/clib | 1 + berkdb/PORT/sunos.4.1.1/include/cdefs.h | 1 + berkdb/PORT/sunos.4.1.1/include/compat.h | 231 + berkdb/PORT/sunos.4.1.1/include/db.h | 1 + berkdb/PORT/sunos.4.1.1/include/mpool.h | 1 + berkdb/PORT/sunos.4.1.1/include/ndbm.h | 1 + berkdb/PORT/sunos.4.1.1/include/pathnames.h | 45 + berkdb/PORT/sunos.4.1.1/include/queue.h | 1 + berkdb/PORT/sunos.4.1.1/sys | 1 + berkdb/PORT/sunos.4.1.2 | 1 + berkdb/PORT/sunos.4.1.3 | 1 + berkdb/PORT/sunos.5.2/Makefile | 101 + berkdb/PORT/sunos.5.2/clib | 1 + berkdb/PORT/sunos.5.2/include/cdefs.h | 1 + berkdb/PORT/sunos.5.2/include/compat.h | 236 + berkdb/PORT/sunos.5.2/include/db.h | 1 + berkdb/PORT/sunos.5.2/include/mpool.h | 1 + berkdb/PORT/sunos.5.2/include/ndbm.h | 1 + berkdb/PORT/sunos.5.2/include/queue.h | 1 + berkdb/PORT/sunos.5.2/sys | 1 + berkdb/PORT/ultrix.4.2/Makefile | 102 + berkdb/PORT/ultrix.4.2/clib | 1 + berkdb/PORT/ultrix.4.2/include/cdefs.h | 1 + berkdb/PORT/ultrix.4.2/include/compat.h | 231 + berkdb/PORT/ultrix.4.2/include/db.h | 230 + berkdb/PORT/ultrix.4.2/include/mpool.h | 1 + berkdb/PORT/ultrix.4.2/include/ndbm.h | 1 + berkdb/PORT/ultrix.4.2/include/queue.h | 1 + berkdb/PORT/ultrix.4.2/sys | 1 + berkdb/PORT/ultrix.4.3 | 1 + berkdb/README | 40 + berkdb/btree/Makefile.inc | 7 + berkdb/btree/bt_close.c | 182 + berkdb/btree/bt_conv.c | 221 + berkdb/btree/bt_debug.c | 329 + berkdb/btree/bt_delete.c | 657 + berkdb/btree/bt_get.c | 105 + berkdb/btree/bt_open.c | 444 + berkdb/btree/bt_overflow.c | 228 + berkdb/btree/bt_page.c | 100 + berkdb/btree/bt_put.c | 320 + berkdb/btree/bt_search.c | 213 + berkdb/btree/bt_seq.c | 460 + berkdb/btree/bt_split.c | 828 ++ berkdb/btree/bt_utils.c | 260 + berkdb/btree/btree.h | 383 + berkdb/btree/extern.h | 70 + berkdb/btree/tags | 1 + berkdb/changelog | 103 + berkdb/db/Makefile.inc | 5 + berkdb/db/db.c | 99 + berkdb/db/tags | 205 + berkdb/docs/btree.3.ps | 366 + berkdb/docs/dbopen.3.ps | 508 + berkdb/docs/hash.3.ps | 292 + berkdb/docs/hash.usenix.ps | 12209 +++++++++++++++ berkdb/docs/libtp.usenix.ps | 12340 ++++++++++++++++ berkdb/docs/mpool.3.ps | 320 + berkdb/docs/recno.3.ps | 341 + berkdb/hash/Makefile.inc | 6 + berkdb/hash/README | 72 + berkdb/hash/extern.h | 65 + berkdb/hash/hash.c | 994 ++ berkdb/hash/hash.h | 293 + berkdb/hash/hash_bigkey.c | 667 + berkdb/hash/hash_buf.c | 355 + berkdb/hash/hash_func.c | 212 + berkdb/hash/hash_log2.c | 54 + berkdb/hash/hash_page.c | 944 ++ berkdb/hash/hsearch.c | 107 + berkdb/hash/ndbm.c | 202 + berkdb/hash/page.h | 92 + berkdb/hash/search.h | 51 + berkdb/hash/tags | 1 + berkdb/include/db.h | 236 + berkdb/include/mpool.h | 99 + berkdb/include/tags | 1 + berkdb/irix.mbox | 619 + berkdb/man/Makefile.inc | 7 + berkdb/man/btree.3 | 233 + berkdb/man/dbopen.3 | 476 + berkdb/man/hash.3 | 159 + berkdb/man/mpool.3 | 219 + berkdb/man/recno.3 | 216 + berkdb/mpool/Makefile.inc | 5 + berkdb/mpool/README | 7 + berkdb/mpool/mpool.c | 463 + berkdb/mpool/mpool.libtp | 746 + berkdb/mpool/tags | 1 + berkdb/patch.1.1 | 20 + berkdb/patch.1.2 | 19 + berkdb/patch.1.3 | 37 + berkdb/patch.1.4 | 22 + berkdb/recno/Makefile.inc | 6 + berkdb/recno/extern.h | 54 + berkdb/recno/rec_close.c | 182 + berkdb/recno/rec_delete.c | 197 + berkdb/recno/rec_get.c | 311 + berkdb/recno/rec_open.c | 241 + berkdb/recno/rec_put.c | 280 + berkdb/recno/rec_search.c | 126 + berkdb/recno/rec_seq.c | 131 + berkdb/recno/rec_utils.c | 122 + berkdb/recno/recno.h | 39 + berkdb/recno/tags | 1 + berkdb/test/Makefile | 23 + berkdb/test/README | 74 + berkdb/test/btree.tests/main.c | 765 + berkdb/test/dbtest.c | 753 + berkdb/test/hash.tests/driver2.c | 114 + berkdb/test/hash.tests/makedb.sh | 13 + berkdb/test/hash.tests/tcreat3.c | 105 + berkdb/test/hash.tests/tdel.c | 122 + berkdb/test/hash.tests/testit | 147 + berkdb/test/hash.tests/thash4.c | 132 + berkdb/test/hash.tests/tread2.c | 105 + berkdb/test/hash.tests/tseq.c | 88 + berkdb/test/hash.tests/tverify.c | 107 + berkdb/test/run.test | 705 + build.sh | 40 + prospero/ACKNOWLEDGEMENTS | 27 + prospero/CHANGES | 268 + prospero/FILES | 21 + prospero/INSTALLATION | 6 + prospero/INSTALLATION_s | 156 + prospero/INSTALLATION_u | 96 + prospero/Makefile | 66 + prospero/Makefile.boilerplate | 453 + prospero/Makefile.config.SunOS-5.6 | 1 + prospero/Makefile.config.aix-2 | 440 + prospero/Makefile.config.dist | 440 + prospero/Makefile.config.sunos-4.1.3 | 440 + prospero/Makefile.config.sunos-4.1.3_u1 | 440 + prospero/Makefile.config.sunos-5.3 | 440 + prospero/Makefile.in | 66 + prospero/README | 77 + prospero/SUPPORTED | 32 + prospero/announcement | 72 + prospero/app/.gitignore | 1 + prospero/app/FILES | 4 + prospero/app/Makefile.backup.backup | 84 + prospero/app/Makefile.in | 90 + prospero/app/cat.c | 247 + prospero/app/ls.c | 898 ++ prospero/doc/.virt-sys | 1 + prospero/doc/ARCHIE.README | 47 + prospero/doc/FILES | 29 + prospero/doc/README | 43 + prospero/doc/README-prospero-documents | 280 + prospero/doc/customize.insts | 34 + prospero/doc/dangerous | 70 + prospero/doc/fullpage.sty | 10 + prospero/doc/getting-started.txt | 58 + prospero/doc/include-native.txt | 194 + prospero/doc/library.PS | 2212 +++ prospero/doc/library.tex | 737 + prospero/doc/man/FILES | 2 + prospero/doc/man/archie.man | 194 + prospero/doc/manual.PS | 3346 +++++ prospero/doc/manual.tex | 1607 ++ prospero/doc/menu-api.PS | 1482 ++ prospero/doc/menu-api.tex | 334 + prospero/doc/more-getting-started.PS | 765 + prospero/doc/more-getting-started.tex | 49 + prospero/doc/names.txt | 277 + prospero/doc/nir.status.report | 8264 +++++++++++ prospero/doc/protocol.PS | 5043 +++++++ prospero/doc/protocol.tex | 2447 +++ prospero/doc/rationales/FILES | 2 + prospero/doc/rationales/pthreads | 11 + prospero/doc/system_calls | 142 + prospero/doc/v.beta51.announcement | 34 + prospero/doc/v5.announcement | 94 + prospero/doc/v52.gopher.ann | 105 + prospero/doc/working-notes/FILES | 9 + prospero/doc/working-notes/README | 4 + .../doc/working-notes/collation-order.txt | 141 + .../doc/working-notes/gopher-hsonames.txt | 192 + prospero/doc/working-notes/new-acl-rights | 41 + .../working-notes/object-interpretation.txt | 256 + prospero/doc/working-notes/pdap.txt | 89 + prospero/doc/working-notes/pfs-udp-ports.txt | 35 + .../doc/working-notes/wais-link-format.txt | 71 + prospero/include/FILES | 28 + prospero/include/archie.h | 174 + prospero/include/ardp.h | 537 + prospero/include/implicit_fixes.h | 61 + prospero/include/list_macros.h | 247 + prospero/include/mitra_macros.h | 153 + prospero/include/pcompat.h | 158 + prospero/include/perrno.h | 157 + prospero/include/pfs.h | 1126 ++ prospero/include/pfs_threads.h | 453 + prospero/include/pfs_utils.h | 48 + prospero/include/plog.h | 215 + prospero/include/pmachine-conf.h | 52 + prospero/include/pmachine.h | 573 + prospero/include/pmachine.h.dist | 536 + prospero/include/posix_signal.h | 17 + prospero/include/pparse.h | 208 + prospero/include/ppasswd.h | 41 + prospero/include/pprot.h | 72 + prospero/include/pserver.h | 604 + prospero/include/pserver.h.dist | 581 + prospero/include/psite.h | 332 + prospero/include/psite.h.dist | 328 + prospero/include/psrv.h | 360 + prospero/include/sockettime.h | 43 + prospero/include/solaris_stdlib.h | 17 + prospero/include/string_with_strcasecmp.h | 26 + prospero/include/test_pth.c | 1 + prospero/include/usc-copyr.h | 33 + prospero/include/usc-license.h | 125 + prospero/include/uw-copyright.h | 20 + prospero/include/vcache.h | 10 + prospero/include/wais-source.h | 2 + prospero/lib/FILES | 7 + prospero/lib/FILES.ftp-only | 4 + prospero/lib/ardp/.gitignore | 1 + prospero/lib/ardp/FILES | 32 + prospero/lib/ardp/Makefile.in | 246 + prospero/lib/ardp/Makefile.tmp | 85 + prospero/lib/ardp/ardp.doc | 262 + prospero/lib/ardp/ardp_abort.c | 109 + prospero/lib/ardp/ardp_accept.c | 752 + prospero/lib/ardp/ardp_add2req.c | 163 + prospero/lib/ardp/ardp_breply.c | 68 + prospero/lib/ardp/ardp_error.c | 34 + prospero/lib/ardp/ardp_get_nxt.c | 88 + prospero/lib/ardp/ardp_headers.c | 124 + prospero/lib/ardp/ardp_int_err.c | 17 + prospero/lib/ardp/ardp_mutexes.c | 85 + prospero/lib/ardp/ardp_perrno.c | 19 + prospero/lib/ardp/ardp_pr_actv.c | 420 + prospero/lib/ardp/ardp_ptalloc.c | 73 + prospero/lib/ardp/ardp_reply.c | 38 + prospero/lib/ardp/ardp_respond.c | 471 + prospero/lib/ardp/ardp_retriev.c | 114 + prospero/lib/ardp/ardp_rqalloc.c | 240 + prospero/lib/ardp/ardp_send.c | 305 + prospero/lib/ardp/ardp_showbuf.c | 61 + prospero/lib/ardp/ardp_snd_pkt.c | 47 + prospero/lib/ardp/ardp_srv_ini.c | 107 + prospero/lib/ardp/ardp_xmit.c | 103 + prospero/lib/ardp/dependency.list | 0 prospero/lib/ardp/dnscache_alloc.c | 72 + prospero/lib/ardp/dnscache_alloc.h | 33 + prospero/lib/ardp/flocks.c | 221 + prospero/lib/ardp/flocks.h | 28 + prospero/lib/ardp/hostname2adr.c | 204 + prospero/lib/ardp/p__th_self_num.c | 141 + prospero/lib/ardp/restrict.c | 324 + prospero/lib/ardp/unixerrstr.c | 41 + prospero/lib/ardp/usc_lic_str.c | 15 + prospero/lib/filters/.gitignore | 1 + prospero/lib/filters/FILES | 7 + prospero/lib/filters/Makefile.in | 35 + prospero/lib/filters/apply_fil.c | 138 + prospero/lib/filters/flist2string.c | 61 + prospero/lib/filters/helpers.c | 134 + prospero/lib/filters/nl_apply_fil.c | 88 + prospero/lib/filters/reorder_dir.c | 47 + prospero/lib/pcompat/.gitignore | 1 + prospero/lib/pcompat/FILES | 17 + prospero/lib/pcompat/Makefile.in | 129 + prospero/lib/pcompat/closedir.c | 74 + prospero/lib/pcompat/creat.c | 48 + prospero/lib/pcompat/execve.c | 39 + prospero/lib/pcompat/getvdirent.c | 186 + prospero/lib/pcompat/open.c | 87 + prospero/lib/pcompat/opendir.c | 105 + prospero/lib/pcompat/pcompat_init.c | 29 + prospero/lib/pcompat/pfs_access.c | 110 + prospero/lib/pcompat/pfs_default.c | 39 + prospero/lib/pcompat/pfs_quiet.c | 28 + prospero/lib/pcompat/readdir.c | 77 + prospero/lib/pcompat/scandir.c | 142 + prospero/lib/pcompat/seekdir.c | 42 + prospero/lib/pcompat/stat.c | 136 + prospero/lib/pcompat/telldir.c | 129 + prospero/lib/pfs/.gitignore | 1 + prospero/lib/pfs/FILES | 117 + prospero/lib/pfs/Makefile.in | 933 ++ prospero/lib/pfs/acalloc.c | 149 + prospero/lib/pfs/acltypes.c | 32 + prospero/lib/pfs/add_vlink.c | 163 + prospero/lib/pfs/asntotime.c | 47 + prospero/lib/pfs/atalloc.c | 207 + prospero/lib/pfs/atr_build.c | 45 + prospero/lib/pfs/atr_lookup.c | 125 + prospero/lib/pfs/bindecode.c | 81 + prospero/lib/pfs/binencode.c | 91 + prospero/lib/pfs/charset.h | 28 + prospero/lib/pfs/cl_qoprintf.c | 31 + prospero/lib/pfs/copyfile.c | 79 + prospero/lib/pfs/del_vlink.c | 143 + prospero/lib/pfs/elt.c | 28 + prospero/lib/pfs/equal_atrs.c | 55 + prospero/lib/pfs/equal_seq.c | 30 + prospero/lib/pfs/filetoin.c | 26 + prospero/lib/pfs/fl_insert.c | 59 + prospero/lib/pfs/flalloc.c | 182 + prospero/lib/pfs/fputbst.c | 25 + prospero/lib/pfs/get_acl.c | 192 + prospero/lib/pfs/in_acl.c | 129 + prospero/lib/pfs/in_atrs.c | 242 + prospero/lib/pfs/in_filter.c | 107 + prospero/lib/pfs/in_forwarded.c | 52 + prospero/lib/pfs/in_id.c | 57 + prospero/lib/pfs/in_line.c | 130 + prospero/lib/pfs/in_link.c | 127 + prospero/lib/pfs/in_nextline.c | 55 + prospero/lib/pfs/in_readc.c | 141 + prospero/lib/pfs/in_select.c | 51 + prospero/lib/pfs/in_sequence.c | 23 + prospero/lib/pfs/internal_err.c | 45 + prospero/lib/pfs/is_file.c | 26 + prospero/lib/pfs/length.c | 20 + prospero/lib/pfs/mapname.c | 98 + prospero/lib/pfs/mk_vdir.c | 148 + prospero/lib/pfs/mkdirs.c | 121 + prospero/lib/pfs/modify_acl.c | 164 + prospero/lib/pfs/month_sname.c | 30 + prospero/lib/pfs/myhost.c | 117 + prospero/lib/pfs/oballoc.c | 139 + prospero/lib/pfs/obother.c | 21 + prospero/lib/pfs/opentcp.c | 203 + prospero/lib/pfs/out_acl.c | 45 + prospero/lib/pfs/out_atr.c | 71 + prospero/lib/pfs/out_atrs.c | 20 + prospero/lib/pfs/out_filter.c | 67 + prospero/lib/pfs/out_link.c | 64 + prospero/lib/pfs/out_sequence.c | 20 + prospero/lib/pfs/p__qbstokenize.c | 52 + prospero/lib/pfs/p__qbstscanf.c | 50 + prospero/lib/pfs/p__req.c | 718 + prospero/lib/pfs/p_get_dir.c | 654 + prospero/lib/pfs/p_initialize.c | 69 + prospero/lib/pfs/p_uln_index.c | 64 + prospero/lib/pfs/paalloc.c | 120 + prospero/lib/pfs/penviron.c | 486 + prospero/lib/pfs/perrmesg.c | 383 + prospero/lib/pfs/pfalloc.c | 108 + prospero/lib/pfs/pfs_debug.c | 16 + prospero/lib/pfs/pfs_enable.c | 26 + prospero/lib/pfs/pfs_fopen.c | 45 + prospero/lib/pfs/pfs_mutexes.c | 71 + prospero/lib/pfs/pfs_open.c | 57 + prospero/lib/pfs/pget_am.c | 262 + prospero/lib/pfs/pget_at.c | 130 + prospero/lib/pfs/pmap_cache.c | 293 + prospero/lib/pfs/pmap_nfs.c | 133 + prospero/lib/pfs/pset_at.c | 116 + prospero/lib/pfs/pset_linkat.c | 89 + prospero/lib/pfs/qbstp_stcopyr.c | 40 + prospero/lib/pfs/qfprintf.c | 22 + prospero/lib/pfs/qindex.c | 55 + prospero/lib/pfs/qoprintf.c | 23 + prospero/lib/pfs/qrindex.c | 23 + prospero/lib/pfs/qscanf.c | 18 + prospero/lib/pfs/qsp_stcopyr.c | 40 + prospero/lib/pfs/qsprintf.c | 30 + prospero/lib/pfs/qsscanf.c | 43 + prospero/lib/pfs/qtokenize.c | 64 + prospero/lib/pfs/rd_vdir.c | 640 + prospero/lib/pfs/rd_vlink.c | 129 + prospero/lib/pfs/re_comp_exec.c | 51 + prospero/lib/pfs/readheader.c | 52 + prospero/lib/pfs/scan_error.c | 137 + prospero/lib/pfs/sindex.c | 45 + prospero/lib/pfs/slashpath.c | 72 + prospero/lib/pfs/slashpath2.c | 28 + prospero/lib/pfs/socket.c | 223 + prospero/lib/pfs/stat.c | 49 + prospero/lib/pfs/stcopy.c | 211 + prospero/lib/pfs/stequal.c | 23 + prospero/lib/pfs/strccmp.c | 75 + prospero/lib/pfs/strpbrk.c | 39 + prospero/lib/pfs/strspn.c | 44 + prospero/lib/pfs/timetoasn.c | 38 + prospero/lib/pfs/tkalloc.c | 144 + prospero/lib/pfs/tklistcmp.c | 0 prospero/lib/pfs/tokeniz_mcmp.c | 73 + prospero/lib/pfs/ucase.c | 34 + prospero/lib/pfs/ul_insert.c | 165 + prospero/lib/pfs/unquote.c | 80 + prospero/lib/pfs/update_link.c | 111 + prospero/lib/pfs/vfsetenv.c | 139 + prospero/lib/pfs/vl_add_atrs.c | 182 + prospero/lib/pfs/vl_comp.c | 75 + prospero/lib/pfs/vl_delete.c | 53 + prospero/lib/pfs/vl_insert.c | 160 + prospero/lib/pfs/vlalloc.c | 200 + prospero/lib/pfs/vqfprintf.c | 21 + prospero/lib/pfs/vqscanf.c | 1288 ++ prospero/lib/pfs/vqscanf.c.in-progress | 1298 ++ prospero/lib/pfs/vqsprintf.c | 633 + prospero/lib/pfs/wcmatch.c | 79 + prospero/lib/pfs/wholefiltoin.c | 56 + prospero/lib/psrv/.gitignore | 1 + prospero/lib/psrv/FILES | 29 + prospero/lib/psrv/Makefile.in | 243 + prospero/lib/psrv/ad2l_atr.c | 101 + prospero/lib/psrv/archie2/.gitignore | 1 + prospero/lib/psrv/archie2/FILES | 10 + prospero/lib/psrv/archie2/Makefile.backup | 95 + prospero/lib/psrv/archie2/README | 45 + prospero/lib/psrv/archie2/arch_dsdb.c | 376 + prospero/lib/psrv/archie2/arch_prioritize.c | 77 + .../archie2/archie_src/include/ar_attrib.h | 0 .../archie2/archie_src/include/ar_search.h | 0 .../archie2/archie_src/include/archie_defs.h | 0 .../archie2/archie_src/include/database.h | 0 .../psrv/archie2/archie_src/include/db_ops.h | 0 .../psrv/archie2/archie_src/include/defines.h | 0 .../psrv/archie2/archie_src/include/error.h | 0 .../psrv/archie2/archie_src/include/files.h | 0 .../psrv/archie2/archie_src/include/host_db.h | 0 .../psrv/archie2/archie_src/include/master.h | 0 .../psrv/archie2/archie_src/include/structs.h | 0 .../psrv/archie2/archie_src/include/typedef.h | 0 prospero/lib/psrv/archie2/atopdate.c | 31 + prospero/lib/psrv/archie2/atoplink.c | 147 + prospero/lib/psrv/archie2/prarch.h | 42 + prospero/lib/psrv/archie2/prarch_host.c | 293 + prospero/lib/psrv/archie2/prarch_match.c | 637 + prospero/lib/psrv/at_delete.c | 48 + prospero/lib/psrv/change_acl.c | 468 + prospero/lib/psrv/check_acl.c | 879 ++ prospero/lib/psrv/check_nfs.c | 85 + prospero/lib/psrv/chk_krb_auth.c | 112 + prospero/lib/psrv/chk_localpth.c | 306 + prospero/lib/psrv/dsdir.c | 845 ++ prospero/lib/psrv/dsrfinfo.c | 481 + prospero/lib/psrv/dsrobject.c | 555 + prospero/lib/psrv/dsrobject_v6.c | 292 + prospero/lib/psrv/dswfinfo.c | 124 + prospero/lib/psrv/dswobject.c | 311 + prospero/lib/psrv/error_reply.c | 39 + prospero/lib/psrv/gopher_gw/.gitignore | 1 + prospero/lib/psrv/gopher_gw/FILES | 6 + prospero/lib/psrv/gopher_gw/Makefile.in | 47 + prospero/lib/psrv/gopher_gw/glalloc.c | 58 + prospero/lib/psrv/gopher_gw/goph_gw_dsdb.c | 867 ++ prospero/lib/psrv/gopher_gw/goph_gw_mutex.c | 39 + prospero/lib/psrv/gopher_gw/gopher.h | 34 + prospero/lib/psrv/magic.c | 39 + prospero/lib/psrv/named_acl.c | 111 + prospero/lib/psrv/optparse.c | 133 + prospero/lib/psrv/plog.c | 350 + prospero/lib/psrv/ppasswd.c | 261 + prospero/lib/psrv/psrv_mutexes.c | 37 + prospero/lib/psrv/replyf.c | 74 + prospero/lib/psrv/retrieve_fp.c | 94 + prospero/lib/psrv/srv_qoprintf.c | 48 + prospero/lib/psrv/stat_object.c | 8 + prospero/lib/psrv/wais_gw/.gitignore | 1 + prospero/lib/psrv/wais_gw/FILES | 49 + prospero/lib/psrv/wais_gw/Makefile.in | 234 + prospero/lib/psrv/wais_gw/buffalloc.c | 137 + prospero/lib/psrv/wais_gw/buffalloc.h | 27 + prospero/lib/psrv/wais_gw/cdialect.h | 117 + prospero/lib/psrv/wais_gw/cutil.c | 777 + prospero/lib/psrv/wais_gw/cutil.h | 151 + prospero/lib/psrv/wais_gw/docid.h | 41 + prospero/lib/psrv/wais_gw/futil.c | 564 + prospero/lib/psrv/wais_gw/futil.h | 97 + prospero/lib/psrv/wais_gw/ietftype.c | 101 + prospero/lib/psrv/wais_gw/ietftype.h | 32 + prospero/lib/psrv/wais_gw/ietftype_parse.c | 90 + prospero/lib/psrv/wais_gw/ietftype_parse.h | 6 + prospero/lib/psrv/wais_gw/ietftypes | 127 + prospero/lib/psrv/wais_gw/inface.c | 896 ++ prospero/lib/psrv/wais_gw/inface.h | 35 + prospero/lib/psrv/wais_gw/irfileio.c | 772 + prospero/lib/psrv/wais_gw/irfileio.h | 46 + prospero/lib/psrv/wais_gw/list.c | 217 + prospero/lib/psrv/wais_gw/list.h | 57 + prospero/lib/psrv/wais_gw/main.c | 4 + prospero/lib/psrv/wais_gw/panic.c | 53 + prospero/lib/psrv/wais_gw/panic.h | 15 + prospero/lib/psrv/wais_gw/sockets.c | 184 + prospero/lib/psrv/wais_gw/sockets.h | 37 + prospero/lib/psrv/wais_gw/source.c | 835 ++ prospero/lib/psrv/wais_gw/source.h | 104 + prospero/lib/psrv/wais_gw/sourcealloc.c | 138 + prospero/lib/psrv/wais_gw/sourceparse | Bin 0 -> 488584 bytes prospero/lib/psrv/wais_gw/sourceparse.c | 20 + prospero/lib/psrv/wais_gw/ustubs.c | 186 + prospero/lib/psrv/wais_gw/ustubs.h | 94 + prospero/lib/psrv/wais_gw/wais_gw_dsdb.c | 331 + prospero/lib/psrv/wais_gw/wais_gw_dsdb.h | 8 + prospero/lib/psrv/wais_gw/wais_gw_mutex.c | 41 + prospero/lib/psrv/wais_gw/waislog.c | 84 + prospero/lib/psrv/wais_gw/waislog.h | 58 + prospero/lib/psrv/wais_gw/wmessage.c | 109 + prospero/lib/psrv/wais_gw/wmessage.h | 58 + prospero/lib/psrv/wais_gw/wprot.c | 2368 +++ prospero/lib/psrv/wais_gw/wprot.h | 298 + prospero/lib/psrv/wais_gw/wutil.c | 1837 +++ prospero/lib/psrv/wais_gw/wutil.h | 42 + prospero/lib/psrv/wais_gw/zprot.c | 1124 ++ prospero/lib/psrv/wais_gw/zprot.h | 178 + prospero/lib/psrv/wais_gw/ztype1.c | 319 + prospero/lib/psrv/wais_gw/ztype1.h | 138 + prospero/lib/psrv/wais_gw/zutil.c | 891 ++ prospero/lib/psrv/wais_gw/zutil.h | 293 + prospero/misc/FILES | 4 + prospero/misc/empty.c | 1 + prospero/misc/install.sh | 69 + prospero/misc/osetenv.c | 29 + prospero/misc/regex.c | 720 + prospero/patches/LOG | 492 + prospero/patches/apply.patches | 50 + prospero/patches/done/10Mar94.dircache.patch | 130 + prospero/patches/done/10Mar94.dnscache.patch | 392 + prospero/patches/done/10Mar94.dnscache1.patch | 31 + prospero/patches/done/10Mar94.doc1.patch | 46 + prospero/patches/done/10Mar94.memleaks.patch | 63 + prospero/patches/done/10Mar94.purify2.patch | 7 + prospero/patches/done/10Mar94.thread.patch | 1784 +++ prospero/patches/done/10Mar94.thread2.patch | 1457 ++ prospero/patches/done/10Mar94.thread3.patch | 121 + prospero/patches/done/10Mar94.thread4.patch | 979 ++ prospero/patches/done/pfs_threads.h | 424 + .../patches/half-done/10Mar94.solaris.patch | 224 + prospero/patches/ignored/10Mar94.ackall.patch | 45 + .../patches/ignored/10Mar94.aolwait.patch | 246 + .../patches/ignored/10Mar94.solaris1.patch | 108 + .../patches/ignored/10Mar94.solaris2.patch | 75 + prospero/pfs_threads.doc | 232 + prospero/server/.gitignore | 1 + prospero/server/COMPATABILITY | 39 + prospero/server/FILES | 25 + prospero/server/Makefile.in | 243 + prospero/server/create_link.c | 124 + prospero/server/create_obj.c | 218 + prospero/server/cvt_v1_ltype.c | 58 + prospero/server/delete_link.c | 143 + prospero/server/dirsrv.c | 1797 +++ prospero/server/dirsrv.h | 190 + prospero/server/dirsrv_v1.c | 1135 ++ prospero/server/ed_link_info.c | 273 + prospero/server/ed_obj_info.c | 255 + prospero/server/edit_acl.c | 277 + prospero/server/forwarded.c | 149 + prospero/server/get_obj_info.c | 363 + prospero/server/list.c | 642 + prospero/server/list_acl.c | 261 + prospero/server/next | 0 prospero/server/parameter.c | 234 + prospero/server/pstart.c | 160 + prospero/server/pw_edit.c | 294 + prospero/server/restart_srv.c | 175 + prospero/server/shadowcvt.c | 388 + prospero/server/shadowcvt.doc | 71 + prospero/server/update.c | 157 + prospero/server/version.c | 91 + prospero/server/xyz | 386 + prospero/user/.gitignore | 1 + prospero/user/FILES | 23 + prospero/user/Makefile.in | 254 + prospero/user/als.c | 588 + prospero/user/aq_query.c | 422 + prospero/user/archie.c | 686 + prospero/user/gen_vfsetup.c | 52 + prospero/user/gmon.out | Bin 0 -> 35080 bytes prospero/user/list_acl.c | 168 + prospero/user/menu/.gitignore | 1 + prospero/user/menu/FILES | 16 + prospero/user/menu/Makefile.in | 87 + prospero/user/menu/api.c | 253 + prospero/user/menu/bub.c | 75 + prospero/user/menu/comp.c | 231 + prospero/user/menu/config.h | 40 + prospero/user/menu/io_util.c | 144 + prospero/user/menu/item_desc.c | 57 + prospero/user/menu/line.c | 52 + prospero/user/menu/main.c | 104 + prospero/user/menu/menu.c | 327 + prospero/user/menu/menu.h | 50 + prospero/user/menu/objects.c | 443 + prospero/user/menu/objects.h | 19 + prospero/user/menu/p_menu.h | 32 + prospero/user/menu/search.c | 320 + prospero/user/newvs.c | 624 + prospero/user/p__vcd.c | 204 + prospero/user/p__vfsetup.c | 150 + prospero/user/padmin.c | 300 + prospero/user/pfs.c | 62 + prospero/user/psession.c | 1459 ++ prospero/user/pstatus.c | 108 + prospero/user/set_acl.c | 231 + prospero/user/set_atr.c | 345 + prospero/user/vcache/.gitignore | 1 + prospero/user/vcache/FILES | 15 + prospero/user/vcache/Makefile.in | 151 + prospero/user/vcache/aftpget.c | 170 + prospero/user/vcache/cmds.c | 180 + prospero/user/vcache/ftp.c | 1436 ++ prospero/user/vcache/ftp.h | 93 + prospero/user/vcache/ftp_var.h | 114 + prospero/user/vcache/gopherget.c | 470 + prospero/user/vcache/main.c | 156 + prospero/user/vcache/pclose.c | 130 + prospero/user/vcache/ruserpass.c | 284 + prospero/user/vcache/telnet.h | 205 + prospero/user/vcache/vcache.c | 300 + prospero/user/vcache/vcache.h | 11 + prospero/user/vcache/vcache_macros.h | 33 + prospero/user/vget.c | 299 + prospero/user/vln.c | 539 + prospero/user/vls.c | 395 + prospero/user/vmkdir.c | 72 + prospero/user/vrm.c | 73 + tcl-dp/CHANGES | 39 + tcl-dp/FAQ | 51 + tcl-dp/LICENSE | 61 + tcl-dp/README | 148 + tcl-dp/TODO | 13 + tcl-dp/api/dpApi.c | 433 + tcl-dp/api/dpApi.h | 29 + tcl-dp/api/dpExample.c | 104 + tcl-dp/api/makefile.win | 204 + tcl-dp/api/readme.api | 56 + tcl-dp/doc/dp_accept.html | 39 + tcl-dp/doc/dp_admin.html | 47 + tcl-dp/doc/dp_connect.html | 57 + tcl-dp/doc/dp_copy.html | 48 + tcl-dp/doc/dp_netinfo.html | 56 + tcl-dp/doc/dp_rdo.html | 53 + tcl-dp/doc/dp_recv.html | 34 + tcl-dp/doc/dp_rpc.html | 68 + tcl-dp/doc/dp_send.html | 33 + tcl-dp/doc/email.html | 88 + tcl-dp/doc/filter.html | 395 + tcl-dp/doc/index.html | 105 + tcl-dp/doc/ipm.html | 64 + tcl-dp/doc/makerpcclient.html | 44 + tcl-dp/doc/makerpcserver.html | 50 + tcl-dp/doc/sample.html | 33 + tcl-dp/doc/serial.html | 54 + tcl-dp/doc/tcp.html | 61 + tcl-dp/doc/udp.html | 57 + tcl-dp/dp.tek | 59 + tcl-dp/dunix_patch/dp.tek | 60 + tcl-dp/dunix_patch/dpSerial.c | 743 + tcl-dp/examples/conference/README | 39 + tcl-dp/examples/conference/enter.tcl | 85 + tcl-dp/examples/conference/room.tcl | 81 + tcl-dp/examples/ftp/client.tcl | 200 + tcl-dp/examples/ftp/server.tcl | 23 + tcl-dp/examples/tictactoe/README | 43 + tcl-dp/examples/tictactoe/board.tcl | 107 + tcl-dp/examples/tictactoe/interface.tcl | 88 + tcl-dp/examples/tictactoe/playerO.tcl | 47 + tcl-dp/examples/tictactoe/playerX.tcl | 43 + tcl-dp/examples/whiteboard/readme | 6 + tcl-dp/examples/whiteboard/wbClient.tcl | 65 + tcl-dp/examples/whiteboard/wbServer.tcl | 30 + tcl-dp/generic/dp.h | 101 + tcl-dp/generic/dpChan.c | 515 + tcl-dp/generic/dpCmds.c | 527 + tcl-dp/generic/dpFilters.c | 1620 ++ tcl-dp/generic/dpIPM.c | 1043 ++ tcl-dp/generic/dpIdentity.c | 632 + tcl-dp/generic/dpInit.c | 99 + tcl-dp/generic/dpInt.h | 248 + tcl-dp/generic/dpPackOff.c | 686 + tcl-dp/generic/dpPatch.h | 31 + tcl-dp/generic/dpPlugF.c | 987 ++ tcl-dp/generic/dpPort.h | 56 + tcl-dp/generic/dpRPC.c | 1588 ++ tcl-dp/generic/dpSerial.c | 578 + tcl-dp/generic/dpSock.c | 124 + tcl-dp/generic/dpTcp.c | 1349 ++ tcl-dp/generic/dpUdp.c | 885 ++ tcl-dp/library/acl.tcl | 58 + tcl-dp/library/distribObj.tcl | 282 + tcl-dp/library/dp_atclose.tcl | 164 + tcl-dp/library/dp_atexit.tcl | 202 + tcl-dp/library/ldelete.tcl | 22 + tcl-dp/library/oo.tcl | 200 + tcl-dp/library/rpc.tcl | 327 + tcl-dp/teki.tcl | 2240 +++ tcl-dp/tekilib/debug.tcl | 99 + tcl-dp/tekilib/http.tcl | 377 + tcl-dp/tekilib/logo.gif | Bin 0 -> 2573 bytes tcl-dp/tekilib/pkgIndex.tcl | 17 + tcl-dp/tekilib/progress-tcl.tcl | 27 + tcl-dp/tekilib/progress-tk.tcl | 76 + tcl-dp/tekilib/undo.tcl | 68 + tcl-dp/tekilib/wise.tcl | 288 + tcl-dp/tests/00-first.test | Bin 0 -> 371 bytes tcl-dp/tests/all | 28 + tcl-dp/tests/connect.test | 39 + tcl-dp/tests/copy.test | 114 + tcl-dp/tests/defs | 208 + tcl-dp/tests/email.test | 358 + tcl-dp/tests/identity.test | 164 + tcl-dp/tests/ipm.test | 254 + tcl-dp/tests/make-server | 49 + tcl-dp/tests/netinfo.test | 95 + tcl-dp/tests/plugin.test | 249 + tcl-dp/tests/plugin2.test | 262 + tcl-dp/tests/rpc.test | 329 + tcl-dp/tests/ser_xmit.test | 49 + tcl-dp/tests/serial.test | 220 + tcl-dp/tests/server | 39 + tcl-dp/tests/tcp.test | 266 + tcl-dp/tests/udp.test | 354 + tcl-dp/tests/xmit.test | 100 + tcl-dp/unix/Makefile.in | 204 + tcl-dp/unix/compat/in.h | 56 + tcl-dp/unix/compat/malloc.h | 43 + tcl-dp/unix/compat/stdlib.h | 60 + tcl-dp/unix/compat/string.h | 80 + tcl-dp/unix/compat/unistd.h | 85 + tcl-dp/unix/configure | 1196 ++ tcl-dp/unix/configure.in | 196 + tcl-dp/unix/dpAppInit.c | 100 + tcl-dp/unix/dpEFilter.c | 326 + tcl-dp/unix/dpEmail.c | 2051 +++ tcl-dp/unix/dpInit.c | 51 + tcl-dp/unix/dpLocks.c | 99 + tcl-dp/unix/dpPort.h | 79 + tcl-dp/unix/dpSerial.c | 735 + tcl-dp/unix/dpSock.c | 280 + tcl-dp/unix/dpUnixIpm.c | 810 + tcl-dp/unix/dpUnixTcp.c | 1196 ++ tcl-dp/unix/dpUnixUdp.c | 669 + tcl-dp/win/dpAppInit.c | 177 + tcl-dp/win/dpInit.c | 134 + tcl-dp/win/dpPort.h | 157 + tcl-dp/win/dpSerial.c | 722 + tcl-dp/win/dpSock.c | 910 ++ tcl-dp/win/dpWinIPM.c | 848 ++ tcl-dp/win/dpWinTcp.c | 1289 ++ tcl-dp/win/dpWinUDP.c | 716 + tcl-dp/win/makefile.76 | 199 + tcl-dp/win/makefile.80 | 200 + tcl7.3/Makefile.in | 255 + tcl7.3/README | 346 + tcl7.3/changes | 958 ++ tcl7.3/compat/README | 6 + tcl7.3/compat/dirent.h | 37 + tcl7.3/compat/dirent2.h | 73 + tcl7.3/compat/float.h | 30 + tcl7.3/compat/getcwd.c | 63 + tcl7.3/compat/limits.h | 34 + tcl7.3/compat/opendir.c | 106 + tcl7.3/compat/stdlib.h | 59 + tcl7.3/compat/strerror.c | 484 + tcl7.3/compat/string.h | 78 + tcl7.3/compat/strstr.c | 84 + tcl7.3/compat/strtod.c | 273 + tcl7.3/compat/strtol.c | 99 + tcl7.3/compat/strtoul.c | 199 + tcl7.3/compat/tmpnam.c | 41 + tcl7.3/compat/unistd.h | 83 + tcl7.3/compat/waitpid.c | 186 + tcl7.3/configure | 1015 ++ tcl7.3/configure.in | 182 + tcl7.3/configure.info | 81 + tcl7.3/doc/AddErrInfo.3 | 143 + tcl7.3/doc/AppInit.3 | 68 + tcl7.3/doc/Async.3 | 172 + tcl7.3/doc/Backslash.3 | 58 + tcl7.3/doc/CallDel.3 | 82 + tcl7.3/doc/CmdCmplt.3 | 49 + tcl7.3/doc/Concat.3 | 64 + tcl7.3/doc/CrtCommand.3 | 172 + tcl7.3/doc/CrtInterp.3 | 61 + tcl7.3/doc/CrtMathFnc.3 | 114 + tcl7.3/doc/CrtPipelin.3 | 114 + tcl7.3/doc/CrtTrace.3 | 125 + tcl7.3/doc/DString.3 | 141 + tcl7.3/doc/DetachPids.3 | 79 + tcl7.3/doc/EnterFile.3 | 98 + tcl7.3/doc/Eval.3 | 119 + tcl7.3/doc/ExprLong.3 | 119 + tcl7.3/doc/GetInt.3 | 94 + tcl7.3/doc/Hash.3 | 222 + tcl7.3/doc/Interp.3 | 132 + tcl7.3/doc/LinkVar.3 | 113 + tcl7.3/doc/PrintDbl.3 | 58 + tcl7.3/doc/RecordEval.3 | 60 + tcl7.3/doc/RegExp.3 | 57 + tcl7.3/doc/SetRecLmt.3 | 60 + tcl7.3/doc/SetResult.3 | 162 + tcl7.3/doc/SetVar.3 | 166 + tcl7.3/doc/SplitList.3 | 164 + tcl7.3/doc/StrMatch.3 | 52 + tcl7.3/doc/Tcl.n | 205 + tcl7.3/doc/TildeSubst.3 | 85 + tcl7.3/doc/TraceVar.3 | 361 + tcl7.3/doc/append.n | 45 + tcl7.3/doc/array.n | 95 + tcl7.3/doc/break.n | 41 + tcl7.3/doc/case.n | 72 + tcl7.3/doc/catch.n | 50 + tcl7.3/doc/cd.n | 43 + tcl7.3/doc/close.n | 46 + tcl7.3/doc/concat.n | 57 + tcl7.3/doc/continue.n | 43 + tcl7.3/doc/eof.n | 43 + tcl7.3/doc/error.n | 71 + tcl7.3/doc/eval.n | 43 + tcl7.3/doc/exec.n | 198 + tcl7.3/doc/exit.n | 41 + tcl7.3/doc/expr.n | 302 + tcl7.3/doc/file.n | 146 + tcl7.3/doc/flush.n | 43 + tcl7.3/doc/for.n | 57 + tcl7.3/doc/foreach.n | 47 + tcl7.3/doc/format.n | 233 + tcl7.3/doc/gets.n | 61 + tcl7.3/doc/glob.n | 92 + tcl7.3/doc/global.n | 43 + tcl7.3/doc/history.n | 181 + tcl7.3/doc/if.n | 58 + tcl7.3/doc/incr.n | 44 + tcl7.3/doc/info.n | 162 + tcl7.3/doc/join.n | 42 + tcl7.3/doc/lappend.n | 48 + tcl7.3/doc/library.n | 239 + tcl7.3/doc/lindex.n | 46 + tcl7.3/doc/linsert.n | 45 + tcl7.3/doc/list.n | 62 + tcl7.3/doc/llength.n | 39 + tcl7.3/doc/lrange.n | 51 + tcl7.3/doc/lreplace.n | 55 + tcl7.3/doc/lsearch.n | 60 + tcl7.3/doc/lsort.n | 72 + tcl7.3/doc/man.macros | 182 + tcl7.3/doc/open.n | 138 + tcl7.3/doc/pid.n | 47 + tcl7.3/doc/proc.n | 80 + tcl7.3/doc/puts.n | 50 + tcl7.3/doc/pwd.n | 38 + tcl7.3/doc/read.n | 54 + tcl7.3/doc/regexp.n | 160 + tcl7.3/doc/regsub.n | 88 + tcl7.3/doc/rename.n | 41 + tcl7.3/doc/return.n | 104 + tcl7.3/doc/scan.n | 149 + tcl7.3/doc/seek.n | 64 + tcl7.3/doc/set.n | 51 + tcl7.3/doc/source.n | 47 + tcl7.3/doc/split.n | 57 + tcl7.3/doc/string.n | 131 + tcl7.3/doc/switch.n | 122 + tcl7.3/doc/tclsh.1 | 103 + tcl7.3/doc/tclvars.n | 156 + tcl7.3/doc/tell.n | 43 + tcl7.3/doc/time.n | 46 + tcl7.3/doc/trace.n | 175 + tcl7.3/doc/unknown.n | 55 + tcl7.3/doc/unset.n | 47 + tcl7.3/doc/uplevel.n | 79 + tcl7.3/doc/upvar.n | 83 + tcl7.3/doc/while.n | 50 + tcl7.3/library/init.tcl | 259 + tcl7.3/library/parray.tcl | 43 + tcl7.3/library/tclIndex | 14 + tcl7.3/panic.c | 69 + tcl7.3/patchlevel.h | 11 + tcl7.3/porting.notes | 214 + tcl7.3/regexp.c | 1233 ++ tcl7.3/tcl.h | 631 + tcl7.3/tclAppInit.c | 95 + tcl7.3/tclAsync.c | 256 + tcl7.3/tclBasic.c | 1369 ++ tcl7.3/tclCkalloc.c | 607 + tcl7.3/tclCmdAH.c | 952 ++ tcl7.3/tclCmdIL.c | 1403 ++ tcl7.3/tclCmdMZ.c | 1730 +++ tcl7.3/tclEnv.c | 531 + tcl7.3/tclExpr.c | 2005 +++ tcl7.3/tclGet.c | 210 + tcl7.3/tclGlob.c | 455 + tcl7.3/tclHash.c | 937 ++ tcl7.3/tclHistory.c | 1109 ++ tcl7.3/tclInt.h | 927 ++ tcl7.3/tclLink.c | 361 + tcl7.3/tclMain.c | 296 + tcl7.3/tclMtherr.c | 89 + tcl7.3/tclParse.c | 1277 ++ tcl7.3/tclProc.c | 625 + tcl7.3/tclRegexp.h | 30 + tcl7.3/tclTest.c | 786 + tcl7.3/tclUnix.h | 285 + tcl7.3/tclUnixAZ.c | 1998 +++ tcl7.3/tclUnixStr.c | 735 + tcl7.3/tclUnixUtil.c | 1385 ++ tcl7.3/tclUtil.c | 1978 +++ tcl7.3/tclVar.c | 2363 +++ tcl7.3/tests/README | 93 + tcl7.3/tests/all | 10 + tcl7.3/tests/append.test | 122 + tcl7.3/tests/async.test | 145 + tcl7.3/tests/case.test | 126 + tcl7.3/tests/cd.test | 121 + tcl7.3/tests/cmdinfo.test | 79 + tcl7.3/tests/concat.test | 53 + tcl7.3/tests/dcall.test | 54 + tcl7.3/tests/defs | 94 + tcl7.3/tests/dstring.test | 192 + tcl7.3/tests/env.test | 122 + tcl7.3/tests/error.test | 185 + tcl7.3/tests/eval.test | 69 + tcl7.3/tests/exec.test | 435 + tcl7.3/tests/expr.test | 822 + tcl7.3/tests/file.test | 326 + tcl7.3/tests/for.test | 169 + tcl7.3/tests/format.test | 379 + tcl7.3/tests/glob.test | 153 + tcl7.3/tests/history.test | 400 + tcl7.3/tests/if.test | 162 + tcl7.3/tests/incr.test | 86 + tcl7.3/tests/info.test | 524 + tcl7.3/tests/join.test | 52 + tcl7.3/tests/lindex.test | 73 + tcl7.3/tests/link.test | 148 + tcl7.3/tests/linsert.test | 91 + tcl7.3/tests/list.test | 87 + tcl7.3/tests/llength.test | 49 + tcl7.3/tests/lrange.test | 79 + tcl7.3/tests/lreplace.test | 106 + tcl7.3/tests/lsearch.test | 81 + tcl7.3/tests/lsort.test | 136 + tcl7.3/tests/misc.test | 84 + tcl7.3/tests/open.test | 662 + tcl7.3/tests/parse.test | 429 + tcl7.3/tests/pid.test | 58 + tcl7.3/tests/proc.test | 450 + tcl7.3/tests/regexp.test | 324 + tcl7.3/tests/rename.test | 78 + tcl7.3/tests/scan.test | 276 + tcl7.3/tests/set.test | 584 + tcl7.3/tests/source.test | 95 + tcl7.3/tests/split.test | 58 + tcl7.3/tests/string.test | 333 + tcl7.3/tests/switch.test | 184 + tcl7.3/tests/trace.test | 914 ++ tcl7.3/tests/unknown.test | 73 + tcl7.3/tests/uplevel.test | 123 + tcl7.3/tests/upvar.test | 303 + tcl7.3/tests/while.test | 113 + tk3.6/Makefile.in | 284 + tk3.6/README | 248 + tk3.6/ToDo | 167 + tk3.6/bitmaps/RCS/error,v | 56 + tk3.6/bitmaps/RCS/gray25,v | 31 + tk3.6/bitmaps/RCS/gray50,v | 31 + tk3.6/bitmaps/RCS/hourglass,v | 58 + tk3.6/bitmaps/RCS/info,v | 54 + tk3.6/bitmaps/RCS/questhead,v | 58 + tk3.6/bitmaps/RCS/question,v | 35 + tk3.6/bitmaps/RCS/warning,v | 54 + tk3.6/bitmaps/error | 8 + tk3.6/bitmaps/gray25 | 6 + tk3.6/bitmaps/gray50 | 6 + tk3.6/bitmaps/hourglass | 9 + tk3.6/bitmaps/info | 5 + tk3.6/bitmaps/questhead | 9 + tk3.6/bitmaps/question | 10 + tk3.6/bitmaps/warning | 5 + tk3.6/changes | 1226 ++ tk3.6/configure | 688 + tk3.6/configure.in | 125 + tk3.6/configure.info | 85 + tk3.6/default.h | 354 + tk3.6/doc/3DBorder.3 | 218 + tk3.6/doc/BackgdErr.3 | 57 + tk3.6/doc/ClrSelect.3 | 53 + tk3.6/doc/ConfigWidg.3 | 652 + tk3.6/doc/ConfigWind.3 | 172 + tk3.6/doc/CoordToWin.3 | 66 + tk3.6/doc/CrtErrHdlr.3 | 162 + tk3.6/doc/CrtGenHdlr.3 | 101 + tk3.6/doc/CrtMainWin.3 | 213 + tk3.6/doc/CrtSelHdlr.3 | 135 + tk3.6/doc/DoOneEvent.3 | 143 + tk3.6/doc/DoWhenIdle.3 | 98 + tk3.6/doc/EventHndlr.3 | 96 + tk3.6/doc/FileHndlr.3 | 110 + tk3.6/doc/GeomReq.3 | 82 + tk3.6/doc/GetAnchor.3 | 77 + tk3.6/doc/GetBitmap.3 | 239 + tk3.6/doc/GetCapStyl.3 | 76 + tk3.6/doc/GetColor.3 | 144 + tk3.6/doc/GetCursor.3 | 192 + tk3.6/doc/GetFontStr.3 | 92 + tk3.6/doc/GetGC.3 | 91 + tk3.6/doc/GetJoinStl.3 | 75 + tk3.6/doc/GetJustify.3 | 87 + tk3.6/doc/GetOption.3 | 59 + tk3.6/doc/GetPixels.3 | 91 + tk3.6/doc/GetRelief.3 | 78 + tk3.6/doc/GetRootCrd.3 | 56 + tk3.6/doc/GetSelect.3 | 93 + tk3.6/doc/GetUid.3 | 63 + tk3.6/doc/GetVRoot.3 | 62 + tk3.6/doc/InternAtom.3 | 71 + tk3.6/doc/MainWin.3 | 49 + tk3.6/doc/ManageGeom.3 | 93 + tk3.6/doc/MapWindow.3 | 66 + tk3.6/doc/MoveToplev.3 | 68 + tk3.6/doc/Name.3 | 98 + tk3.6/doc/OwnSelect.3 | 69 + tk3.6/doc/ParseArgv.3 | 364 + tk3.6/doc/Preserve.3 | 114 + tk3.6/doc/RegInterp.3 | 72 + tk3.6/doc/Restack.3 | 62 + tk3.6/doc/RestrictEv.3 | 90 + tk3.6/doc/SetCModel.3 | 61 + tk3.6/doc/SetClass.3 | 74 + tk3.6/doc/SetGrid.3 | 68 + tk3.6/doc/SetVisual.3 | 69 + tk3.6/doc/Sleep.3 | 50 + tk3.6/doc/TimerHndlr.3 | 89 + tk3.6/doc/WindowId.3 | 177 + tk3.6/doc/after.n | 63 + tk3.6/doc/bind.n | 453 + tk3.6/doc/button.n | 216 + tk3.6/doc/canvas.n | 1471 ++ tk3.6/doc/checkbutton.n | 298 + tk3.6/doc/destroy.n | 48 + tk3.6/doc/dialog.n | 76 + tk3.6/doc/entry.n | 299 + tk3.6/doc/exit.n | 47 + tk3.6/doc/focus.n | 138 + tk3.6/doc/frame.n | 139 + tk3.6/doc/grab.n | 141 + tk3.6/doc/label.n | 127 + tk3.6/doc/lbSingSel.n | 47 + tk3.6/doc/listbox.n | 248 + tk3.6/doc/lower.n | 48 + tk3.6/doc/man.macros | 182 + tk3.6/doc/menu.n | 510 + tk3.6/doc/menubar.n | 152 + tk3.6/doc/menubutton.n | 235 + tk3.6/doc/message.n | 185 + tk3.6/doc/option.n | 104 + tk3.6/doc/options.n | 583 + tk3.6/doc/pack-old.n | 224 + tk3.6/doc/pack.n | 280 + tk3.6/doc/place.n | 242 + tk3.6/doc/radiobutton.n | 285 + tk3.6/doc/raise.n | 48 + tk3.6/doc/scale.n | 259 + tk3.6/doc/scrollbar.n | 202 + tk3.6/doc/selection.n | 139 + tk3.6/doc/send.n | 69 + tk3.6/doc/text.n | 816 + tk3.6/doc/tk.n | 70 + tk3.6/doc/tkerror.n | 70 + tk3.6/doc/tkvars.n | 84 + tk3.6/doc/tkwait.n | 66 + tk3.6/doc/toplevel.n | 117 + tk3.6/doc/update.n | 65 + tk3.6/doc/winfo.n | 267 + tk3.6/doc/wish.1 | 131 + tk3.6/doc/wm.n | 535 + tk3.6/ks_names.h | 917 ++ tk3.6/library/button.tcl | 85 + tk3.6/library/demos/README | 61 + tk3.6/library/demos/bitmaps/face | 171 + tk3.6/library/demos/bitmaps/flagdown | 27 + tk3.6/library/demos/bitmaps/flagup | 27 + tk3.6/library/demos/bitmaps/grey.25 | 6 + tk3.6/library/demos/bitmaps/grey.5 | 6 + tk3.6/library/demos/bitmaps/letters | 27 + tk3.6/library/demos/bitmaps/noletters | 27 + tk3.6/library/demos/bitmaps/pattern | 6 + tk3.6/library/demos/browse | 53 + tk3.6/library/demos/color | 32 + tk3.6/library/demos/dialog | 53 + tk3.6/library/demos/hello | 12 + tk3.6/library/demos/ixset | 314 + tk3.6/library/demos/mkArrow.tcl | 203 + tk3.6/library/demos/mkBasic.tcl | 61 + tk3.6/library/demos/mkBitmaps.tcl | 46 + tk3.6/library/demos/mkButton.tcl | 33 + tk3.6/library/demos/mkCanvText.tcl | 110 + tk3.6/library/demos/mkCheck.tcl | 33 + tk3.6/library/demos/mkDialog.tcl | 63 + tk3.6/library/demos/mkEntry.tcl | 29 + tk3.6/library/demos/mkEntry2.tcl | 39 + tk3.6/library/demos/mkFloor.tcl | 1276 ++ tk3.6/library/demos/mkForm.tcl | 52 + tk3.6/library/demos/mkHScale.tcl | 35 + tk3.6/library/demos/mkIcon.tcl | 43 + tk3.6/library/demos/mkItems.tcl | 271 + tk3.6/library/demos/mkLabel.tcl | 34 + tk3.6/library/demos/mkListbox.tcl | 41 + tk3.6/library/demos/mkListbox2.tcl | 95 + tk3.6/library/demos/mkListbox3.tcl | 34 + tk3.6/library/demos/mkPlot.tcl | 75 + tk3.6/library/demos/mkPuzzle.tcl | 59 + tk3.6/library/demos/mkRadio.tcl | 58 + tk3.6/library/demos/mkRuler.tcl | 125 + tk3.6/library/demos/mkScroll.tcl | 84 + tk3.6/library/demos/mkSearch.tcl | 140 + tk3.6/library/demos/mkStyles.tcl | 128 + tk3.6/library/demos/mkTear.tcl | 19 + tk3.6/library/demos/mkTextBind.tcl | 100 + tk3.6/library/demos/mkVScale.tcl | 35 + tk3.6/library/demos/rmt | 164 + tk3.6/library/demos/rolodex | 263 + tk3.6/library/demos/showVars.tcl | 26 + tk3.6/library/demos/size | 16 + tk3.6/library/demos/square | 50 + tk3.6/library/demos/tclIndex | 83 + tk3.6/library/demos/tcolor | 366 + tk3.6/library/demos/timer | 35 + tk3.6/library/demos/tkSquare.c | 543 + tk3.6/library/demos/widget | 188 + tk3.6/library/dialog.tcl | 115 + tk3.6/library/entry.tcl | 74 + tk3.6/library/listbox.tcl | 40 + tk3.6/library/menu.tcl | 352 + tk3.6/library/prolog.ps | 203 + tk3.6/library/tclIndex | 35 + tk3.6/library/text.tcl | 126 + tk3.6/library/tk.tcl | 315 + tk3.6/library/tkerror.tcl | 39 + tk3.6/patchlevel.h | 13 + tk3.6/porting.notes | 232 + tk3.6/tests/README | 22 + tk3.6/tests/all | 10 + tk3.6/tests/btree.test | 626 + tk3.6/tests/defs | 90 + tk3.6/tests/listbox.test | 426 + tk3.6/tests/oldpack.test | 519 + tk3.6/tests/option.file1 | 17 + tk3.6/tests/option.file2 | 2 + tk3.6/tests/option.test | 225 + tk3.6/tests/pack.test | 828 ++ tk3.6/tests/raise.test | 315 + tk3.6/tests/select.test | 212 + tk3.6/tests/text.test | 1149 ++ tk3.6/tests/wm.test | 288 + tk3.6/tk.h | 765 + tk3.6/tk3.6p1.patch | 110 + tk3.6/tk3d.c | 1049 ++ tk3.6/tkAppInit.c | 103 + tk3.6/tkArgv.c | 444 + tk3.6/tkAtom.c | 181 + tk3.6/tkBind.c | 2393 +++ tk3.6/tkBitmap.c | 557 + tk3.6/tkButton.c | 1437 ++ tk3.6/tkCanvArc.c | 1705 +++ tk3.6/tkCanvBmap.c | 730 + tk3.6/tkCanvLine.c | 1691 +++ tk3.6/tkCanvPoly.c | 868 ++ tk3.6/tkCanvPs.c | 1188 ++ tk3.6/tkCanvText.c | 1555 ++ tk3.6/tkCanvWind.c | 804 + tk3.6/tkCanvas.c | 3423 +++++ tk3.6/tkCanvas.h | 429 + tk3.6/tkCmds.c | 1157 ++ tk3.6/tkColor.c | 500 + tk3.6/tkConfig.c | 910 ++ tk3.6/tkConfig.h | 165 + tk3.6/tkCursor.c | 669 + tk3.6/tkEntry.c | 1823 +++ tk3.6/tkError.c | 301 + tk3.6/tkEvent.c | 1701 +++ tk3.6/tkFocus.c | 501 + tk3.6/tkFont.c | 784 + tk3.6/tkFrame.c | 552 + tk3.6/tkGC.c | 377 + tk3.6/tkGeometry.c | 170 + tk3.6/tkGet.c | 604 + tk3.6/tkGrab.c | 1469 ++ tk3.6/tkInt.h | 626 + tk3.6/tkListbox.c | 1819 +++ tk3.6/tkMain.c | 449 + tk3.6/tkMenu.c | 2123 +++ tk3.6/tkMenubutton.c | 966 ++ tk3.6/tkMessage.c | 798 + tk3.6/tkOption.c | 1341 ++ tk3.6/tkPack.c | 1711 +++ tk3.6/tkPlace.c | 956 ++ tk3.6/tkPreserve.c | 246 + tk3.6/tkRectOval.c | 998 ++ tk3.6/tkScale.c | 1481 ++ tk3.6/tkScrollbar.c | 1223 ++ tk3.6/tkSelect.c | 2117 +++ tk3.6/tkSend.c | 1177 ++ tk3.6/tkTest.c | 159 + tk3.6/tkText.c | 1491 ++ tk3.6/tkText.h | 431 + tk3.6/tkTextBTree.c | 2383 +++ tk3.6/tkTextDisp.c | 2103 +++ tk3.6/tkTextIndex.c | 651 + tk3.6/tkTextTag.c | 1079 ++ tk3.6/tkTrig.c | 1314 ++ tk3.6/tkWindow.c | 2001 +++ tk3.6/tkWm.c | 3257 ++++ 2495 files changed, 539746 insertions(+) create mode 100644 archie/.gitignore create mode 100755 archie/Makefile.in create mode 100755 archie/Makefile.multi create mode 100755 archie/Makefile.post create mode 100755 archie/Makefile.pre create mode 100644 archie/access/ar_search.c create mode 100644 archie/access/casesrch.c create mode 100644 archie/access/list_site.c create mode 100644 archie/access/match.c create mode 100644 archie/access/prarch.c create mode 100644 archie/access/prarch_match.c create mode 100644 archie/access/prlist.c create mode 100644 archie/access/sys/370.c create mode 100644 archie/access/sys/386.c create mode 100644 archie/access/sys/68k.c create mode 100644 archie/access/sys/cray.c create mode 100644 archie/access/sys/mips.c create mode 100644 archie/access/sys/sparc.c create mode 100644 archie/access/sys/sparc2.c create mode 100644 archie/access/sys/vax.c create mode 100644 archie/anonftp/.gitignore create mode 100755 archie/anonftp/Makefile.in create mode 100644 archie/anonftp/lib/.gitignore create mode 100644 archie/anonftp/lib/AIX-2/.gitignore create mode 100755 archie/anonftp/lib/AIX-2/Makefile.in create mode 100755 archie/anonftp/lib/Makefile.post create mode 100755 archie/anonftp/lib/Makefile.pre create mode 100644 archie/anonftp/lib/SunOS-4.1.4/.gitignore create mode 100755 archie/anonftp/lib/SunOS-4.1.4/Makefile.in create mode 100644 archie/anonftp/lib/SunOS-5.4/.gitignore create mode 100755 archie/anonftp/lib/SunOS-5.4/Makefile.in create mode 120000 archie/anonftp/lib/SunOS-5.6 create mode 100644 archie/anonftp/lib/db_ops.c create mode 100644 archie/anonftp/lib/lang_libanonftp.c create mode 100644 archie/anonftp/lib/lang_libanonftp.h create mode 100644 archie/anonftp/parse/.gitignore create mode 100644 archie/anonftp/parse/AIX-2/.gitignore create mode 100755 archie/anonftp/parse/AIX-2/Makefile.in create mode 100755 archie/anonftp/parse/Makefile.post create mode 100755 archie/anonftp/parse/Makefile.pre create mode 100644 archie/anonftp/parse/SunOS-4.1.4/.gitignore create mode 100755 archie/anonftp/parse/SunOS-4.1.4/Makefile.in create mode 100644 archie/anonftp/parse/SunOS-5.4/.gitignore create mode 100755 archie/anonftp/parse/SunOS-5.4/Makefile.in create mode 120000 archie/anonftp/parse/SunOS-5.6 create mode 100644 archie/anonftp/parse/db2v.c create mode 100644 archie/anonftp/parse/db2v.h create mode 100644 archie/anonftp/parse/info_cell.c create mode 100644 archie/anonftp/parse/info_cell.h create mode 100644 archie/anonftp/parse/input.c create mode 100644 archie/anonftp/parse/input.h create mode 100644 archie/anonftp/parse/lang_anonftp.c create mode 100644 archie/anonftp/parse/lang_anonftp.h create mode 100644 archie/anonftp/parse/lang_parsers.c create mode 100644 archie/anonftp/parse/lang_parsers.h create mode 100644 archie/anonftp/parse/line_type.h create mode 100644 archie/anonftp/parse/mem_debug.c create mode 100644 archie/anonftp/parse/mem_debug.h create mode 100644 archie/anonftp/parse/novell.c create mode 100644 archie/anonftp/parse/novell2.c create mode 100644 archie/anonftp/parse/output.c create mode 100644 archie/anonftp/parse/output.h create mode 100644 archie/anonftp/parse/pars_ent_holder.h create mode 100644 archie/anonftp/parse/parse.c create mode 100644 archie/anonftp/parse/parse.h create mode 100644 archie/anonftp/parse/parse_anonftp.c create mode 100644 archie/anonftp/parse/parser.man create mode 100644 archie/anonftp/parse/queue.c create mode 100644 archie/anonftp/parse/queue.h create mode 100644 archie/anonftp/parse/queue_def.h create mode 100644 archie/anonftp/parse/stack.c create mode 100644 archie/anonftp/parse/stack.h create mode 100644 archie/anonftp/parse/storage.c create mode 100644 archie/anonftp/parse/storage.h create mode 100644 archie/anonftp/parse/str.c create mode 100644 archie/anonftp/parse/str.h create mode 100644 archie/anonftp/parse/test-queue.c create mode 100644 archie/anonftp/parse/test-vms_parser.c create mode 100644 archie/anonftp/parse/unix.c create mode 100644 archie/anonftp/parse/unix2.c create mode 100644 archie/anonftp/parse/unix2.h create mode 100644 archie/anonftp/parse/unix_filter create mode 100644 archie/anonftp/parse/utils.c create mode 100644 archie/anonftp/parse/utils.h create mode 100644 archie/anonftp/parse/vms.c create mode 100644 archie/anonftp/parse/vms2.c create mode 100644 archie/anonftp/parse/vms2.h create mode 100644 archie/anonftp/retrieve/.gitignore create mode 100644 archie/anonftp/retrieve/AIX-2/.gitignore create mode 100755 archie/anonftp/retrieve/AIX-2/Makefile.in create mode 100755 archie/anonftp/retrieve/Makefile.post create mode 100755 archie/anonftp/retrieve/Makefile.pre create mode 100644 archie/anonftp/retrieve/SunOS-4.1.4/.gitignore create mode 100755 archie/anonftp/retrieve/SunOS-4.1.4/Makefile.in create mode 100644 archie/anonftp/retrieve/SunOS-5.4/.gitignore create mode 100755 archie/anonftp/retrieve/SunOS-5.4/Makefile.in create mode 120000 archie/anonftp/retrieve/SunOS-5.6 create mode 100644 archie/anonftp/retrieve/ftp.c create mode 100644 archie/anonftp/retrieve/ftp.h create mode 100644 archie/anonftp/retrieve/ftp_getfile.c create mode 100644 archie/anonftp/retrieve/ftp_getfile.h create mode 100644 archie/anonftp/retrieve/glob.c create mode 100644 archie/anonftp/retrieve/lang_retrieve.c create mode 100644 archie/anonftp/retrieve/lang_retrieve.h create mode 100644 archie/anonftp/update/.gitignore create mode 100644 archie/anonftp/update/AIX-2/.gitignore create mode 100755 archie/anonftp/update/AIX-2/Makefile.in create mode 100755 archie/anonftp/update/Makefile.post create mode 100755 archie/anonftp/update/Makefile.pre create mode 100644 archie/anonftp/update/SunOS-4.1.4/.gitignore create mode 100755 archie/anonftp/update/SunOS-4.1.4/Makefile.in create mode 100644 archie/anonftp/update/SunOS-5.4/.gitignore create mode 100755 archie/anonftp/update/SunOS-5.4/Makefile.in create mode 120000 archie/anonftp/update/SunOS-5.6 create mode 100644 archie/anonftp/update/check_anonftp.c create mode 100644 archie/anonftp/update/check_anonftp.h create mode 100644 archie/anonftp/update/delete_anonftp.c create mode 100644 archie/anonftp/update/delete_anonftp.h create mode 100644 archie/anonftp/update/insert_anonftp.c create mode 100644 archie/anonftp/update/insert_anonftp.h create mode 100644 archie/anonftp/update/interact_anonftp.c create mode 100644 archie/anonftp/update/interact_anonftp.h create mode 100644 archie/anonftp/update/lang_anonftp.c create mode 100644 archie/anonftp/update/lang_anonftp.h create mode 100644 archie/anonftp/update/net_anonftp.c create mode 100644 archie/anonftp/update/net_anonftp.h create mode 100644 archie/anonftp/update/setup_delete.c create mode 100644 archie/anonftp/update/setup_insert.c create mode 100644 archie/anonftp/update/update_anonftp.c create mode 100644 archie/anonftp/update/update_anonftp.h create mode 100644 archie/cgi/bin/archie.cgi create mode 100644 archie/cgi/html/archie-adv.html create mode 100644 archie/cgi/html/archie-help.html create mode 100644 archie/cgi/html/archie.html create mode 100644 archie/cgi/html/query.gif create mode 100644 archie/cgi/html/results.gif create mode 100644 archie/clients/.gitignore create mode 100755 archie/clients/Makefile.in create mode 100755 archie/clients/Makefile.pre create mode 100644 archie/clients/cgi/.gitignore create mode 100644 archie/clients/cgi/AIX-2/.gitignore create mode 100755 archie/clients/cgi/AIX-2/Makefile.in create mode 100755 archie/clients/cgi/Makefile.post create mode 100755 archie/clients/cgi/Makefile.pre create mode 100644 archie/clients/cgi/SunOS-4.1.4/.gitignore create mode 100755 archie/clients/cgi/SunOS-4.1.4/Makefile.in create mode 100644 archie/clients/cgi/SunOS-5.4/.gitignore create mode 100755 archie/clients/cgi/SunOS-5.4/Makefile.in create mode 120000 archie/clients/cgi/SunOS-5.6 create mode 100644 archie/clients/cgi/cgi-client.c create mode 100644 archie/clients/email/.gitignore create mode 100644 archie/clients/email/AIX-2/.gitignore create mode 100755 archie/clients/email/AIX-2/Makefile.in create mode 100755 archie/clients/email/Makefile.post create mode 100755 archie/clients/email/Makefile.pre create mode 100644 archie/clients/email/SunOS-4.1.4/.gitignore create mode 100755 archie/clients/email/SunOS-4.1.4/Makefile.in create mode 100644 archie/clients/email/SunOS-5.4/.gitignore create mode 100755 archie/clients/email/SunOS-5.4/Makefile.in create mode 120000 archie/clients/email/SunOS-5.6 create mode 100755 archie/clients/email/batch-email create mode 100644 archie/clients/email/email.c create mode 100644 archie/clients/email/email.h create mode 100644 archie/clients/email/lang_email.c create mode 100644 archie/clients/email/lang_email.h create mode 100755 archie/clients/email/process-email create mode 100644 archie/clients/mail_back_end/.gitignore create mode 100644 archie/clients/mail_back_end/AIX-2/.gitignore create mode 100755 archie/clients/mail_back_end/AIX-2/Makefile.in create mode 100755 archie/clients/mail_back_end/Makefile.post create mode 100755 archie/clients/mail_back_end/Makefile.pre create mode 100644 archie/clients/mail_back_end/README create mode 100644 archie/clients/mail_back_end/SunOS-4.1.4/.gitignore create mode 100755 archie/clients/mail_back_end/SunOS-4.1.4/Makefile.in create mode 100644 archie/clients/mail_back_end/SunOS-5.4/.gitignore create mode 100755 archie/clients/mail_back_end/SunOS-5.4/Makefile.in create mode 120000 archie/clients/mail_back_end/SunOS-5.6 create mode 100755 archie/clients/mail_back_end/archiemail create mode 100755 archie/clients/mail_back_end/archiemail.curr create mode 100755 archie/clients/mail_back_end/mail_handler create mode 100755 archie/clients/mail_back_end/mail_receiver create mode 100755 archie/clients/mail_back_end/mail_receiver.curr create mode 100644 archie/clients/mail_back_end/split_file.c create mode 100644 archie/clients/telnet/.gitignore create mode 100644 archie/clients/telnet/AIX-2/.gitignore create mode 100644 archie/clients/telnet/AIX-2/Makefile.in create mode 100755 archie/clients/telnet/Makefile.post create mode 100755 archie/clients/telnet/Makefile.pre create mode 100644 archie/clients/telnet/SunOS-4.1.4/.gitignore create mode 100644 archie/clients/telnet/SunOS-4.1.4/Makefile.in create mode 100644 archie/clients/telnet/SunOS-5.4/.gitignore create mode 100644 archie/clients/telnet/SunOS-5.4/Makefile.in create mode 120000 archie/clients/telnet/SunOS-5.6 create mode 100644 archie/clients/telnet/afe.c create mode 100644 archie/clients/telnet/alarm.c create mode 100644 archie/clients/telnet/alarm.h create mode 100644 archie/clients/telnet/ansi_compat.h create mode 100644 archie/clients/telnet/arch_query.c create mode 100644 archie/clients/telnet/arch_query.h create mode 100644 archie/clients/telnet/archie.c create mode 100644 archie/clients/telnet/archie.h create mode 100644 archie/clients/telnet/argv.c create mode 100644 archie/clients/telnet/argv.h create mode 100755 archie/clients/telnet/aslip create mode 100644 archie/clients/telnet/client_defs.h create mode 100644 archie/clients/telnet/client_structs.h create mode 100644 archie/clients/telnet/commands.c create mode 100644 archie/clients/telnet/commands.h create mode 100644 archie/clients/telnet/commands_lang.h create mode 100644 archie/clients/telnet/debug.c create mode 100644 archie/clients/telnet/debug.h create mode 100644 archie/clients/telnet/domains.c create mode 100644 archie/clients/telnet/domains.h create mode 100644 archie/clients/telnet/english-language-strings.c create mode 100644 archie/clients/telnet/extern.h create mode 100644 archie/clients/telnet/find.c create mode 100644 archie/clients/telnet/find.h create mode 100644 archie/clients/telnet/fork_wait.c create mode 100644 archie/clients/telnet/fork_wait.h create mode 100644 archie/clients/telnet/french-language-strings.c create mode 100644 archie/clients/telnet/generic_find.c create mode 100644 archie/clients/telnet/generic_find.h create mode 100644 archie/clients/telnet/get_types.c create mode 100644 archie/clients/telnet/get_types.h create mode 100644 archie/clients/telnet/get_types_lang.h create mode 100644 archie/clients/telnet/help.c create mode 100644 archie/clients/telnet/help.h create mode 100644 archie/clients/telnet/input.c create mode 100644 archie/clients/telnet/input.h create mode 100644 archie/clients/telnet/input.test create mode 100644 archie/clients/telnet/input2.test create mode 100644 archie/clients/telnet/input3.test create mode 100644 archie/clients/telnet/lang.c create mode 100644 archie/clients/telnet/lang.h create mode 100644 archie/clients/telnet/list.c create mode 100644 archie/clients/telnet/list.h create mode 100644 archie/clients/telnet/macros.h create mode 100644 archie/clients/telnet/mail.c create mode 100644 archie/clients/telnet/mail.h create mode 100644 archie/clients/telnet/mail_lang.h create mode 100755 archie/clients/telnet/make_strings create mode 100644 archie/clients/telnet/misc.c create mode 100644 archie/clients/telnet/misc.h create mode 100644 archie/clients/telnet/misc_ansi_defs.h create mode 100644 archie/clients/telnet/mode.c create mode 100644 archie/clients/telnet/mode.h create mode 100644 archie/clients/telnet/mode_lang.h create mode 100644 archie/clients/telnet/pager.c create mode 100644 archie/clients/telnet/pager.h create mode 100644 archie/clients/telnet/parchie.h create mode 100644 archie/clients/telnet/prosp.h create mode 100644 archie/clients/telnet/prospquery.c create mode 100644 archie/clients/telnet/rmem.c create mode 100644 archie/clients/telnet/rmem.h create mode 100644 archie/clients/telnet/signals.c create mode 100644 archie/clients/telnet/signals.h create mode 100644 archie/clients/telnet/sock.c create mode 100644 archie/clients/telnet/solaris-sig-fix.h create mode 100644 archie/clients/telnet/strmap.c create mode 100644 archie/clients/telnet/strmap.h create mode 100644 archie/clients/telnet/style_lang.h create mode 100644 archie/clients/telnet/tellwait.c create mode 100644 archie/clients/telnet/tellwait.h create mode 100644 archie/clients/telnet/terminal.c create mode 100644 archie/clients/telnet/terminal.h create mode 100644 archie/clients/telnet/terminal_lang.h create mode 100644 archie/clients/telnet/unixcompat.c create mode 100644 archie/clients/telnet/unixcompat.h create mode 100644 archie/clients/telnet/vars.c create mode 100644 archie/clients/telnet/vars.h create mode 100644 archie/clients/telnet/vars_lang.h create mode 100644 archie/clients/telnet/version.c create mode 100644 archie/clients/telnet/version.h create mode 100644 archie/clients/telnet/version_lang.h create mode 100644 archie/clients/telnet/whatis.c create mode 100644 archie/clients/telnet/whatis.h create mode 100644 archie/control/.gitignore create mode 100644 archie/control/AIX-2/.gitignore create mode 100755 archie/control/AIX-2/Makefile.in create mode 100755 archie/control/Makefile.post create mode 100755 archie/control/Makefile.pre create mode 100644 archie/control/SunOS-4.1.4/.gitignore create mode 100755 archie/control/SunOS-4.1.4/Makefile.in create mode 100644 archie/control/SunOS-5.4/.gitignore create mode 100755 archie/control/SunOS-5.4/Makefile.in create mode 120000 archie/control/SunOS-5.6 create mode 100644 archie/control/control.h create mode 100644 archie/control/lang_control.c create mode 100644 archie/control/lang_control.h create mode 100644 archie/control/main.c create mode 100644 archie/doc/.gitignore create mode 100755 archie/doc/Makefile.in create mode 100644 archie/doc/TODO create mode 100644 archie/doc/beta create mode 100644 archie/doc/install create mode 100644 archie/doc/mail create mode 100644 archie/doc/man/anonftp_parser_output.5 create mode 100644 archie/doc/man/archie.n create mode 100644 archie/doc/man/archie_clients.n create mode 100644 archie/doc/man/archie_headers.5 create mode 100644 archie/doc/man/archie_protocol.5 create mode 100644 archie/doc/man/arcontrol.n create mode 100644 archie/doc/man/ardomains.n create mode 100644 archie/doc/man/arexchange.n create mode 100644 archie/doc/man/arretrieve.n create mode 100644 archie/doc/man/arserver.n create mode 100644 archie/doc/man/convert_hostdb.n create mode 100644 archie/doc/man/db_build.n create mode 100644 archie/doc/man/db_check.n create mode 100644 archie/doc/man/db_dump.n create mode 100644 archie/doc/man/db_reorder.n create mode 100644 archie/doc/man/db_siteidx.n create mode 100644 archie/doc/man/db_stats.n create mode 100644 archie/doc/man/delete_anonftp.n create mode 100644 archie/doc/man/delete_webindex.n create mode 100644 archie/doc/man/handle_header.n create mode 100644 archie/doc/man/host_manage.n create mode 100644 archie/doc/man/insert_anonftp.n create mode 100644 archie/doc/man/insert_webindex.n create mode 100644 archie/doc/man/mail_stats.n create mode 100644 archie/doc/man/net_anonftp.n create mode 100644 archie/doc/man/parse_anonftp.n create mode 100644 archie/doc/man/parse_anonftp_unix_bsd.n create mode 100644 archie/doc/man/parse_anonftp_vms_std.n create mode 100644 archie/doc/man/retrieve_anonftp.n create mode 100644 archie/doc/man/update_anonftp.n create mode 100644 archie/doc/man/weaseld.n create mode 100644 archie/doc/manual/anonftp.tex create mode 100644 archie/doc/manual/appendix.tex create mode 100644 archie/doc/manual/archie.tex create mode 100644 archie/doc/manual/clients.tex create mode 100644 archie/doc/manual/configure.tex create mode 100644 archie/doc/manual/db.tex create mode 100644 archie/doc/manual/dirsrv.tex create mode 100644 archie/doc/manual/faq.tex create mode 100644 archie/doc/manual/figs/catalogs.eps create mode 100644 archie/doc/manual/figs/cycle.eps create mode 100644 archie/doc/manual/figs/exchange.eps create mode 100644 archie/doc/manual/figs/new.eps create mode 100644 archie/doc/manual/figs/note.eps create mode 100644 archie/doc/manual/figs/overview.eps create mode 100644 archie/doc/manual/figs/parse.eps create mode 100644 archie/doc/manual/figs/process.eps create mode 100644 archie/doc/manual/figs/telnet.eps create mode 100644 archie/doc/manual/host-manage.tex create mode 100644 archie/doc/manual/install.tex create mode 100644 archie/doc/manual/intro.tex create mode 100644 archie/doc/manual/manual.tex create mode 100644 archie/doc/manual/overview.tex create mode 100644 archie/doc/manual/readme create mode 100644 archie/doc/manual/title.tex create mode 100644 archie/doc/manual/webindex.tex create mode 100644 archie/doc/memo create mode 100644 archie/exchange/.gitignore create mode 100644 archie/exchange/AIX-2/.gitignore create mode 100755 archie/exchange/AIX-2/Makefile.in create mode 100755 archie/exchange/Makefile.post create mode 100755 archie/exchange/Makefile.pre create mode 100644 archie/exchange/PROTOCOL create mode 100644 archie/exchange/README create mode 100644 archie/exchange/SunOS-4.1.4/.gitignore create mode 100755 archie/exchange/SunOS-4.1.4/Makefile.in create mode 100644 archie/exchange/SunOS-5.4/.gitignore create mode 100755 archie/exchange/SunOS-5.4/Makefile.in create mode 120000 archie/exchange/SunOS-5.6 create mode 100644 archie/exchange/client.c create mode 100644 archie/exchange/command.c create mode 100644 archie/exchange/configfile.c create mode 100644 archie/exchange/db_functs.c create mode 100644 archie/exchange/lang_exchange.c create mode 100644 archie/exchange/lang_exchange.h create mode 100644 archie/exchange/listd.h create mode 100644 archie/exchange/main.c create mode 100644 archie/exchange/net.c create mode 100644 archie/exchange/server.c create mode 100644 archie/exchange/socktools.c create mode 100644 archie/exchange/tuple.h create mode 100644 archie/include/.gitignore create mode 100755 archie/include/Makefile.in create mode 100644 archie/include/ansi_compat.h create mode 100644 archie/include/ar_attrib.h create mode 100644 archie/include/ar_search.h create mode 100644 archie/include/archie_catalogs.h create mode 100644 archie/include/archie_dbm.h create mode 100644 archie/include/archie_dns.h create mode 100644 archie/include/archie_inet.h create mode 100644 archie/include/archie_mail.h create mode 100644 archie/include/archie_strings.h create mode 100644 archie/include/archie_xdr.h create mode 100644 archie/include/copyright.h create mode 100644 archie/include/core_entry.h create mode 100644 archie/include/databases.h create mode 100644 archie/include/db_files.h create mode 100644 archie/include/db_ops.h create mode 100644 archie/include/debug.h create mode 100644 archie/include/defines.h create mode 100644 archie/include/domain.h create mode 100644 archie/include/error.h create mode 100644 archie/include/excerpt.h create mode 100644 archie/include/files.h create mode 100644 archie/include/freq.h create mode 100644 archie/include/gcore_entry.h create mode 100644 archie/include/gindexdb_ops.h create mode 100644 archie/include/gparser_file.h create mode 100644 archie/include/gsite_file.h create mode 100644 archie/include/gstrings_index.h create mode 100644 archie/include/header.h create mode 100644 archie/include/header_def.h create mode 100644 archie/include/hinfo.h create mode 120000 archie/include/host_db.h create mode 100644 archie/include/host_db.h.0 create mode 100644 archie/include/host_db.h.1 create mode 100644 archie/include/lang.h create mode 100644 archie/include/log.h create mode 100644 archie/include/master.h create mode 100644 archie/include/misc.h create mode 100644 archie/include/missing-protos.h create mode 100644 archie/include/mystdio.h create mode 100644 archie/include/new_site_file.h create mode 100644 archie/include/old-host_db.h create mode 100644 archie/include/old-site_file.h create mode 100644 archie/include/options.h create mode 100644 archie/include/outstruct.h create mode 100644 archie/include/parchie_host_dir.h create mode 100644 archie/include/parchie_list_host.h create mode 100644 archie/include/parchie_wais_cache.h create mode 100644 archie/include/parser_file.h create mode 100644 archie/include/protonet.h create mode 100644 archie/include/protos-aix.h create mode 100644 archie/include/protos-solaris.h create mode 100644 archie/include/protos-sunos.h create mode 100644 archie/include/protos.h create mode 100644 archie/include/prwais_do_search.h create mode 100644 archie/include/sd.h create mode 100644 archie/include/site_file.h create mode 100644 archie/include/solaris-sig-fix.h create mode 100644 archie/include/srch.h create mode 100644 archie/include/strings_index.h create mode 100644 archie/include/times.h create mode 100644 archie/include/typedef.h create mode 100644 archie/include/wais_attrib.h create mode 100644 archie/less/.gitignore create mode 100644 archie/less/AIX-2/.gitignore create mode 100755 archie/less/AIX-2/Makefile.in create mode 100755 archie/less/Makefile.b4 create mode 100755 archie/less/Makefile.in.b4 create mode 100755 archie/less/Makefile.post create mode 100755 archie/less/Makefile.pre create mode 100644 archie/less/SunOS-4.1.4/.gitignore create mode 100755 archie/less/SunOS-4.1.4/Makefile.in create mode 100644 archie/less/SunOS-5.4/.gitignore create mode 100755 archie/less/SunOS-5.4/Makefile.in create mode 120000 archie/less/SunOS-5.6 create mode 100644 archie/less/archie_help.c create mode 100644 archie/less/brac.c create mode 100644 archie/less/ch.c create mode 100644 archie/less/charset.c create mode 100644 archie/less/cmd.h create mode 100644 archie/less/cmdbuf.c create mode 100644 archie/less/command.c create mode 100644 archie/less/decode.c create mode 100644 archie/less/defines.h create mode 100644 archie/less/edit.c create mode 100644 archie/less/filename.c create mode 100644 archie/less/forwback.c create mode 100644 archie/less/funcs.h create mode 100644 archie/less/help.c create mode 100644 archie/less/ifile.c create mode 100644 archie/less/input.c create mode 100644 archie/less/jump.c create mode 100644 archie/less/less.h create mode 100644 archie/less/lesskey.c create mode 100644 archie/less/line.c create mode 100644 archie/less/linenum.c create mode 100644 archie/less/lsystem.c create mode 100644 archie/less/main.c create mode 100644 archie/less/mark.c create mode 100644 archie/less/optfunc.c create mode 100644 archie/less/option.c create mode 100644 archie/less/option.h create mode 100644 archie/less/opttbl.c create mode 100644 archie/less/os.c create mode 100644 archie/less/output.c create mode 100644 archie/less/position.c create mode 100644 archie/less/position.h create mode 100644 archie/less/prompt.c create mode 100644 archie/less/screen.c create mode 100644 archie/less/search.c create mode 100644 archie/less/signal.c create mode 100644 archie/less/tags.c create mode 100644 archie/less/ttyin.c create mode 100644 archie/less/vecho.c create mode 100644 archie/less/version.c create mode 100644 archie/lib/archsearch/.gitignore create mode 100644 archie/lib/archsearch/AIX-2/.gitignore create mode 100755 archie/lib/archsearch/AIX-2/Makefile.in create mode 100755 archie/lib/archsearch/Makefile.post create mode 100755 archie/lib/archsearch/Makefile.pre create mode 100644 archie/lib/archsearch/SunOS-4.1.4/.gitignore create mode 100755 archie/lib/archsearch/SunOS-4.1.4/Makefile.in create mode 100644 archie/lib/archsearch/SunOS-5.4/.gitignore create mode 100755 archie/lib/archsearch/SunOS-5.4/Makefile.in create mode 120000 archie/lib/archsearch/SunOS-5.6 create mode 100644 archie/lib/archsearch/boolean-ops.c create mode 100644 archie/lib/archsearch/boolean-ops.h create mode 100644 archie/lib/archsearch/boolean-search.c create mode 100644 archie/lib/archsearch/get-info.c create mode 100644 archie/lib/archsearch/get-info.h create mode 100644 archie/lib/archsearch/search.c create mode 100644 archie/lib/archsearch/search.h create mode 100644 archie/lib/archsearch/util.c create mode 100644 archie/lib/archstridx/.gitignore create mode 100644 archie/lib/archstridx/AIX-2/.gitignore create mode 100755 archie/lib/archstridx/AIX-2/Makefile.in create mode 100644 archie/lib/archstridx/API.txt create mode 100755 archie/lib/archstridx/Makefile.post create mode 100755 archie/lib/archstridx/Makefile.pre create mode 100644 archie/lib/archstridx/SunOS-4.1.4/.gitignore create mode 100755 archie/lib/archstridx/SunOS-4.1.4/Makefile.in create mode 100644 archie/lib/archstridx/SunOS-5.4/.gitignore create mode 100755 archie/lib/archstridx/SunOS-5.4/Makefile.in create mode 120000 archie/lib/archstridx/SunOS-5.6 create mode 100644 archie/lib/archstridx/Test.h create mode 100644 archie/lib/archstridx/Test_archstridx.c create mode 100644 archie/lib/archstridx/Test_exists.c create mode 100644 archie/lib/archstridx/Test_exists.sh create mode 100644 archie/lib/archstridx/Test_lock.c create mode 100644 archie/lib/archstridx/Test_regex.c create mode 100644 archie/lib/archstridx/Test_regexp.c create mode 100644 archie/lib/archstridx/Test_state.c create mode 100644 archie/lib/archstridx/Test_strsrch.c create mode 100644 archie/lib/archstridx/all.h create mode 100644 archie/lib/archstridx/api.c create mode 100644 archie/lib/archstridx/archstridx.h create mode 100644 archie/lib/archstridx/lock.c create mode 100644 archie/lib/archstridx/lock.h create mode 100644 archie/lib/archstridx/newstr.c create mode 100644 archie/lib/archstridx/newstr.h create mode 100644 archie/lib/archstridx/re.c create mode 100644 archie/lib/archstridx/re.h create mode 100644 archie/lib/archstridx/strsrch.c create mode 100644 archie/lib/archstridx/strsrch.h create mode 100644 archie/lib/archstridx/utils.c create mode 100644 archie/lib/archstridx/utils.h create mode 100644 archie/lib/hostdb/.gitignore create mode 100644 archie/lib/hostdb/AIX-2/.gitignore create mode 100755 archie/lib/hostdb/AIX-2/Makefile.in create mode 100755 archie/lib/hostdb/Makefile.post create mode 100755 archie/lib/hostdb/Makefile.pre create mode 100644 archie/lib/hostdb/SunOS-4.1.4/.gitignore create mode 100755 archie/lib/hostdb/SunOS-4.1.4/Makefile.in create mode 100644 archie/lib/hostdb/SunOS-5.4/.gitignore create mode 100755 archie/lib/hostdb/SunOS-5.4/Makefile.in create mode 120000 archie/lib/hostdb/SunOS-5.6 create mode 100644 archie/lib/hostdb/databases.c create mode 100644 archie/lib/hostdb/domain.c create mode 100644 archie/lib/hostdb/holder.c create mode 100644 archie/lib/hostdb/host_db.c create mode 100644 archie/lib/hostdb/host_info.c create mode 120000 archie/lib/hostdb/host_inter.c create mode 100644 archie/lib/hostdb/host_inter.c.0 create mode 100644 archie/lib/hostdb/host_inter.c.1 create mode 100644 archie/lib/hostdb/lang_hostdb.c create mode 100644 archie/lib/hostdb/lang_hostdb.h create mode 100644 archie/lib/hostdb/ops.c create mode 100644 archie/lib/libarchie/.gitignore create mode 100644 archie/lib/libarchie/AIX-2/.gitignore create mode 100755 archie/lib/libarchie/AIX-2/Makefile.in create mode 100755 archie/lib/libarchie/Makefile.post create mode 100755 archie/lib/libarchie/Makefile.pre create mode 100644 archie/lib/libarchie/SunOS-4.1.4/.gitignore create mode 100755 archie/lib/libarchie/SunOS-4.1.4/Makefile.in create mode 100644 archie/lib/libarchie/SunOS-5.4/.gitignore create mode 100755 archie/lib/libarchie/SunOS-5.4/Makefile.in create mode 120000 archie/lib/libarchie/SunOS-5.6 create mode 100644 archie/lib/libarchie/archie_dbm.c create mode 100644 archie/lib/libarchie/archie_dns.c create mode 100644 archie/lib/libarchie/archie_inet.c create mode 100644 archie/lib/libarchie/archie_mail.c create mode 100644 archie/lib/libarchie/archie_prospero.c create mode 100644 archie/lib/libarchie/archie_strings.c create mode 100644 archie/lib/libarchie/archie_xdr.c create mode 100644 archie/lib/libarchie/error.c create mode 100644 archie/lib/libarchie/files.c create mode 100644 archie/lib/libarchie/header.c create mode 100644 archie/lib/libarchie/lang_libarchie.c create mode 100644 archie/lib/libarchie/lang_libarchie.h create mode 100644 archie/lib/libarchie/log.h create mode 100644 archie/lib/libarchie/master.c create mode 100644 archie/lib/libarchie/misc.c create mode 100644 archie/lib/libarchie/options.c create mode 100644 archie/lib/libarchie/site_index.c create mode 100644 archie/lib/libarchie/stubs.c create mode 100644 archie/lib/libarchie/timelocal.c create mode 100644 archie/lib/libarchie/times.c create mode 100644 archie/lib/libarchie/version.c create mode 100644 archie/lib/libgopherindex/.gitignore create mode 100644 archie/lib/libgopherindex/DRAFT_Gopher_FYI_RFC.txt create mode 100755 archie/lib/libgopherindex/Makefile.in create mode 100644 archie/lib/libgopherindex/gindexdb_ops.c create mode 100644 archie/lib/libgopherindex/host_hash.c create mode 100644 archie/lib/libgopherindex/lang_libgopherindex.c create mode 100644 archie/lib/libgopherindex/lang_libgopherindex.h create mode 100644 archie/lib/libparchie/.gitignore create mode 100644 archie/lib/libparchie/AIX-2/.gitignore create mode 100755 archie/lib/libparchie/AIX-2/Makefile.in create mode 100755 archie/lib/libparchie/MakeLinks create mode 100755 archie/lib/libparchie/Makefile.post create mode 100755 archie/lib/libparchie/Makefile.pre create mode 100644 archie/lib/libparchie/SunOS-4.1.4/.gitignore create mode 100755 archie/lib/libparchie/SunOS-4.1.4/Makefile.in create mode 100644 archie/lib/libparchie/SunOS-5.4/.gitignore create mode 100755 archie/lib/libparchie/SunOS-5.4/Makefile.in create mode 120000 archie/lib/libparchie/SunOS-5.6 create mode 120000 archie/lib/libparchie/ar_search.c create mode 100644 archie/lib/libparchie/archie_catalogs.c create mode 120000 archie/lib/libparchie/archie_dbm.c create mode 120000 archie/lib/libparchie/archie_dns.c create mode 120000 archie/lib/libparchie/archie_inet.c create mode 120000 archie/lib/libparchie/archie_prospero.c create mode 120000 archie/lib/libparchie/archie_strings.c create mode 100644 archie/lib/libparchie/argv.c create mode 120000 archie/lib/libparchie/casesrch.c create mode 120000 archie/lib/libparchie/databases.c create mode 120000 archie/lib/libparchie/db_ops.c create mode 120000 archie/lib/libparchie/domain.c create mode 120000 archie/lib/libparchie/error.c create mode 120000 archie/lib/libparchie/files.c create mode 100644 archie/lib/libparchie/find_str.c create mode 120000 archie/lib/libparchie/gindexdb_ops.c create mode 120000 archie/lib/libparchie/header.c create mode 120000 archie/lib/libparchie/holder.c create mode 120000 archie/lib/libparchie/host_db.c create mode 120000 archie/lib/libparchie/host_info.c create mode 120000 archie/lib/libparchie/host_inter.c create mode 120000 archie/lib/libparchie/lang_anonftp.c create mode 120000 archie/lib/libparchie/lang_hostdb.c create mode 120000 archie/lib/libparchie/lang_hostdb.h create mode 120000 archie/lib/libparchie/lang_libanonftp.c create mode 120000 archie/lib/libparchie/lang_libanonftp.h create mode 120000 archie/lib/libparchie/lang_libarchie.c create mode 120000 archie/lib/libparchie/lang_libarchie.h create mode 120000 archie/lib/libparchie/lang_libgopherindex.c create mode 120000 archie/lib/libparchie/lang_libgopherindex.h create mode 120000 archie/lib/libparchie/list_site.c create mode 120000 archie/lib/libparchie/master.c create mode 120000 archie/lib/libparchie/match.c create mode 120000 archie/lib/libparchie/ops.c create mode 100644 archie/lib/libparchie/parchie_cache.c create mode 100644 archie/lib/libparchie/parchie_cache.h create mode 100644 archie/lib/libparchie/parchie_host_dir.c create mode 100644 archie/lib/libparchie/parchie_lib.c create mode 100644 archie/lib/libparchie/parchie_lib.h create mode 100644 archie/lib/libparchie/parchie_list_host.c create mode 100644 archie/lib/libparchie/parchie_search_files_db.c create mode 100644 archie/lib/libparchie/parchie_search_files_db.h create mode 100644 archie/lib/libparchie/parchie_search_gindex_db.c create mode 100644 archie/lib/libparchie/parchie_search_gindex_db.h create mode 120000 archie/lib/libparchie/prarch.c create mode 120000 archie/lib/libparchie/prarch_match.c create mode 120000 archie/lib/libparchie/prlist.c create mode 100644 archie/lib/libparchie/restrict.c create mode 120000 archie/lib/libparchie/times.c create mode 120000 archie/lib/libparchie/version.c create mode 100644 archie/lib/libpsarchie/.gitignore create mode 100644 archie/lib/libpsarchie/AIX-2/.gitignore create mode 100755 archie/lib/libpsarchie/AIX-2/Makefile.in create mode 100755 archie/lib/libpsarchie/Makefile.post create mode 100755 archie/lib/libpsarchie/Makefile.pre create mode 100644 archie/lib/libpsarchie/README create mode 100644 archie/lib/libpsarchie/SunOS-4.1.4/.gitignore create mode 100755 archie/lib/libpsarchie/SunOS-4.1.4/Makefile.in create mode 100644 archie/lib/libpsarchie/SunOS-5.4/.gitignore create mode 100755 archie/lib/libpsarchie/SunOS-5.4/Makefile.in create mode 120000 archie/lib/libpsarchie/SunOS-5.6 create mode 100644 archie/lib/libpsarchie/arch_dsdb.c create mode 100644 archie/lib/libpsarchie/arch_prioritize.c create mode 100644 archie/lib/libpsarchie/arch_time.c create mode 100644 archie/lib/patrie/.gitignore create mode 100644 archie/lib/patrie/AIX-2/.gitignore create mode 100755 archie/lib/patrie/AIX-2/Makefile.in create mode 100644 archie/lib/patrie/CheckPaged.c create mode 100644 archie/lib/patrie/DiffSort.c create mode 100644 archie/lib/patrie/ExSort.c create mode 100644 archie/lib/patrie/LevelDump.c create mode 100644 archie/lib/patrie/Levels.c create mode 100755 archie/lib/patrie/Makefile.post create mode 100755 archie/lib/patrie/Makefile.pre create mode 100644 archie/lib/patrie/RandSearch.c create mode 100644 archie/lib/patrie/RandText.c create mode 100644 archie/lib/patrie/Sort2Infix.c create mode 100644 archie/lib/patrie/SunOS-4.1.4/.gitignore create mode 100755 archie/lib/patrie/SunOS-4.1.4/Makefile.in create mode 100644 archie/lib/patrie/SunOS-5.4/.gitignore create mode 100755 archie/lib/patrie/SunOS-5.4/Makefile.in create mode 120000 archie/lib/patrie/SunOS-5.6 create mode 100644 archie/lib/patrie/TODO create mode 100644 archie/lib/patrie/Test.c create mode 100644 archie/lib/patrie/Test.h create mode 100644 archie/lib/patrie/Test_GetSubstring.c create mode 100644 archie/lib/patrie/Test_bits.c create mode 100644 archie/lib/patrie/Test_bs.c create mode 100644 archie/lib/patrie/Test_check_paged.c create mode 100755 archie/lib/patrie/Test_complete_build create mode 100644 archie/lib/patrie/Test_copybits.c create mode 100644 archie/lib/patrie/Test_fast_ustrcmp.c create mode 100644 archie/lib/patrie/Test_fast_ustrncmp.c create mode 100644 archie/lib/patrie/Test_nsearch.c create mode 100644 archie/lib/patrie/Test_page.c create mode 100644 archie/lib/patrie/Test_page2.c create mode 100644 archie/lib/patrie/Test_ptr_stack.c create mode 100755 archie/lib/patrie/Test_random create mode 100644 archie/lib/patrie/Test_search.c create mode 100644 archie/lib/patrie/Test_sort.c create mode 100644 archie/lib/patrie/Test_sort2infix.c create mode 100644 archie/lib/patrie/Test_state.c create mode 100644 archie/lib/patrie/Test_stats_infix.c create mode 100644 archie/lib/patrie/Test_strcmp.c create mode 100644 archie/lib/patrie/Test_tolower.c create mode 100755 archie/lib/patrie/Time_page create mode 100644 archie/lib/patrie/bits.c create mode 100644 archie/lib/patrie/bits.h create mode 100644 archie/lib/patrie/build.c create mode 100644 archie/lib/patrie/case.c create mode 100644 archie/lib/patrie/case.h create mode 100644 archie/lib/patrie/defs.h create mode 100644 archie/lib/patrie/init.c create mode 100644 archie/lib/patrie/init.h create mode 100644 archie/lib/patrie/int_stack.c create mode 100644 archie/lib/patrie/int_stack.h create mode 100755 archie/lib/patrie/lenhist create mode 100644 archie/lib/patrie/levels.c create mode 100644 archie/lib/patrie/levels.h create mode 100644 archie/lib/patrie/node.c create mode 100644 archie/lib/patrie/page.c create mode 100644 archie/lib/patrie/page.h create mode 100644 archie/lib/patrie/patrie.h create mode 100644 archie/lib/patrie/ptr_stack.c create mode 100644 archie/lib/patrie/ptr_stack.h create mode 100644 archie/lib/patrie/search.c create mode 100644 archie/lib/patrie/search.h create mode 100644 archie/lib/patrie/sort.c create mode 100644 archie/lib/patrie/sort.h create mode 100644 archie/lib/patrie/state.c create mode 100644 archie/lib/patrie/state.h create mode 100644 archie/lib/patrie/text.c create mode 100644 archie/lib/patrie/timing.c create mode 100644 archie/lib/patrie/timing.h create mode 100644 archie/lib/patrie/trailer.c create mode 100644 archie/lib/patrie/trailer.h create mode 100644 archie/lib/patrie/utils.c create mode 100644 archie/lib/patrie/utils.h create mode 100644 archie/lib/regex/.gitignore create mode 100644 archie/lib/regex/AIX-2/.gitignore create mode 100755 archie/lib/regex/AIX-2/Makefile.in create mode 100755 archie/lib/regex/Makefile.post create mode 100755 archie/lib/regex/Makefile.pre create mode 100644 archie/lib/regex/README create mode 100644 archie/lib/regex/SunOS-4.1.4/.gitignore create mode 100755 archie/lib/regex/SunOS-4.1.4/Makefile.in create mode 100644 archie/lib/regex/regerror.c create mode 100644 archie/lib/regex/regexp.3 create mode 100644 archie/lib/regex/regexp.c create mode 100644 archie/lib/regex/regexp.h create mode 100644 archie/lib/regex/regmagic.h create mode 100644 archie/lib/regex/regsub.c create mode 100644 archie/lib/regex/tests create mode 100644 archie/lib/regex/timer.c create mode 100644 archie/lib/regex/timer.t.h create mode 100644 archie/lib/regex/try.c create mode 100644 archie/lib/reposix/.gitignore create mode 100644 archie/lib/reposix/AIX-2/.gitignore create mode 100755 archie/lib/reposix/AIX-2/Makefile.in create mode 100644 archie/lib/reposix/COPYRIGHT create mode 100755 archie/lib/reposix/Makefile.inc create mode 100755 archie/lib/reposix/Makefile.post create mode 100755 archie/lib/reposix/Makefile.pre create mode 100644 archie/lib/reposix/SunOS-4.1.4/.gitignore create mode 100755 archie/lib/reposix/SunOS-4.1.4/Makefile.in create mode 100644 archie/lib/reposix/SunOS-5.4/.gitignore create mode 100755 archie/lib/reposix/SunOS-5.4/Makefile.in create mode 120000 archie/lib/reposix/SunOS-5.6 create mode 100644 archie/lib/reposix/WHATSNEW create mode 100644 archie/lib/reposix/cclass.h create mode 100644 archie/lib/reposix/cname.h create mode 100644 archie/lib/reposix/engine.c create mode 100644 archie/lib/reposix/re_format.7 create mode 100644 archie/lib/reposix/regcomp.c create mode 100644 archie/lib/reposix/regerror.c create mode 100644 archie/lib/reposix/regex.3 create mode 100644 archie/lib/reposix/regex.h create mode 100644 archie/lib/reposix/regex2.h create mode 100644 archie/lib/reposix/regexec.c create mode 100644 archie/lib/reposix/regfree.c create mode 100644 archie/lib/reposix/sys/cdefs.h create mode 100644 archie/lib/reposix/utils.h create mode 100644 archie/lib/startdb/.gitignore create mode 100644 archie/lib/startdb/AIX-2/.gitignore create mode 100755 archie/lib/startdb/AIX-2/Makefile.in create mode 100755 archie/lib/startdb/Makefile.post create mode 100755 archie/lib/startdb/Makefile.pre create mode 100644 archie/lib/startdb/SunOS-4.1.4/.gitignore create mode 100755 archie/lib/startdb/SunOS-4.1.4/Makefile.in create mode 100644 archie/lib/startdb/SunOS-5.4/.gitignore create mode 100755 archie/lib/startdb/SunOS-5.4/Makefile.in create mode 120000 archie/lib/startdb/SunOS-5.6 create mode 100644 archie/lib/startdb/domain.c create mode 100644 archie/lib/startdb/host_table.c create mode 100644 archie/lib/startdb/lang_startdb.c create mode 100644 archie/lib/startdb/lang_startdb.h create mode 100644 archie/lib/startdb/new/domain.c create mode 100644 archie/lib/startdb/new/host_table.c create mode 100644 archie/lib/startdb/new/lang_startdb.c create mode 100644 archie/lib/startdb/new/lang_startdb.h create mode 100644 archie/lib/startdb/new/start_db.c create mode 100644 archie/lib/startdb/new/start_db.h create mode 100644 archie/lib/startdb/reorder.c create mode 100644 archie/lib/startdb/start_db.c create mode 100644 archie/lib/startdb/start_db.h create mode 100644 archie/ppc/.gitignore create mode 100755 archie/ppc/Makefile.in create mode 100644 archie/ppc/ferretd/.gitignore create mode 100644 archie/ppc/ferretd/AIX-2/.gitignore create mode 100755 archie/ppc/ferretd/AIX-2/Makefile.in create mode 100755 archie/ppc/ferretd/Makefile.post create mode 100755 archie/ppc/ferretd/Makefile.pre create mode 100644 archie/ppc/ferretd/SunOS-4.1.4/.gitignore create mode 100755 archie/ppc/ferretd/SunOS-4.1.4/Makefile.in create mode 100644 archie/ppc/ferretd/SunOS-5.4/.gitignore create mode 100755 archie/ppc/ferretd/SunOS-5.4/Makefile.in create mode 120000 archie/ppc/ferretd/SunOS-5.6 create mode 100644 archie/ppc/ferretd/_prog.c create mode 100644 archie/ppc/ferretd/aprint.h create mode 100644 archie/ppc/ferretd/authorization.c create mode 100644 archie/ppc/ferretd/authorization.h create mode 100644 archie/ppc/ferretd/chartab.c create mode 100644 archie/ppc/ferretd/contents.c create mode 100644 archie/ppc/ferretd/contents.h create mode 100644 archie/ppc/ferretd/file_type.c create mode 100644 archie/ppc/ferretd/file_type.h create mode 100644 archie/ppc/ferretd/http.c create mode 100644 archie/ppc/ferretd/http.h create mode 100644 archie/ppc/ferretd/image_map.c create mode 100644 archie/ppc/ferretd/image_map.h create mode 100644 archie/ppc/ferretd/polygon.c create mode 100644 archie/ppc/ferretd/polygon.h create mode 100644 archie/ppc/ferretd/print_anon.c create mode 100644 archie/ppc/ferretd/print_gopher.c create mode 100644 archie/ppc/ferretd/print_results.c create mode 100644 archie/ppc/ferretd/print_results.h create mode 100644 archie/ppc/ferretd/print_sites.c create mode 100644 archie/ppc/ferretd/print_wais.c create mode 100644 archie/ppc/ferretd/request.c create mode 100644 archie/ppc/ferretd/request.h create mode 100644 archie/ppc/ferretd/search.c create mode 100644 archie/ppc/ferretd/search.h create mode 100644 archie/ppc/ferretd/url.c create mode 100644 archie/ppc/ferretd/url.h create mode 100644 archie/ppc/lib/.gitignore create mode 100644 archie/ppc/lib/AIX-2/.gitignore create mode 100755 archie/ppc/lib/AIX-2/Makefile.in create mode 100755 archie/ppc/lib/Makefile.in create mode 100755 archie/ppc/lib/Makefile.libmenu create mode 100755 archie/ppc/lib/Makefile.post create mode 100755 archie/ppc/lib/Makefile.pre create mode 100644 archie/ppc/lib/SunOS-4.1.4/.gitignore create mode 100755 archie/ppc/lib/SunOS-4.1.4/Makefile.in create mode 100644 archie/ppc/lib/SunOS-5.4/.gitignore create mode 100755 archie/ppc/lib/SunOS-5.4/Makefile.in create mode 120000 archie/ppc/lib/SunOS-5.6 create mode 100644 archie/ppc/lib/_prog.h create mode 100644 archie/ppc/lib/all.h create mode 100644 archie/ppc/lib/ansi.h create mode 100644 archie/ppc/lib/class.c create mode 100644 archie/ppc/lib/class.h create mode 100644 archie/ppc/lib/debug.c create mode 100644 archie/ppc/lib/debug.h create mode 100644 archie/ppc/lib/defs.h create mode 100644 archie/ppc/lib/epath.c create mode 100644 archie/ppc/lib/epath.h create mode 100644 archie/ppc/lib/error.c create mode 100644 archie/ppc/lib/error.h create mode 100644 archie/ppc/lib/gopher.c create mode 100644 archie/ppc/lib/gopher.h create mode 100644 archie/ppc/lib/host_access.c create mode 100644 archie/ppc/lib/host_access.h create mode 100644 archie/ppc/lib/io.c create mode 100644 archie/ppc/lib/io.h create mode 100644 archie/ppc/lib/local_attrs.h create mode 100644 archie/ppc/lib/main.c create mode 100644 archie/ppc/lib/misc.c create mode 100644 archie/ppc/lib/misc.h create mode 100644 archie/ppc/lib/my_rd_vlink.c create mode 100644 archie/ppc/lib/my_rd_vlink.h create mode 100644 archie/ppc/lib/net.c create mode 100644 archie/ppc/lib/net.h create mode 100644 archie/ppc/lib/os_indep.c create mode 100644 archie/ppc/lib/os_indep.h create mode 100644 archie/ppc/lib/output.c create mode 100644 archie/ppc/lib/output.h create mode 100644 archie/ppc/lib/parchie.h create mode 100644 archie/ppc/lib/pattrib.c create mode 100644 archie/ppc/lib/pattrib.h create mode 100644 archie/ppc/lib/pencode.h create mode 100644 archie/ppc/lib/ppc.h create mode 100644 archie/ppc/lib/ppc.man create mode 100644 archie/ppc/lib/ppc_front_end.c create mode 100644 archie/ppc/lib/ppc_front_end.h create mode 100644 archie/ppc/lib/ppc_tcl.c create mode 100644 archie/ppc/lib/ppc_tcl.h create mode 100644 archie/ppc/lib/ppc_time.c create mode 100644 archie/ppc/lib/ppc_time.h create mode 100644 archie/ppc/lib/prosp.h create mode 100644 archie/ppc/lib/prospquery.c create mode 100644 archie/ppc/lib/psearch.c create mode 100644 archie/ppc/lib/psearch.h create mode 100644 archie/ppc/lib/ptrval.c create mode 100644 archie/ppc/lib/ptrval.h create mode 100644 archie/ppc/lib/quoting.c create mode 100644 archie/ppc/lib/quoting.h create mode 100644 archie/ppc/lib/redirect.c create mode 100644 archie/ppc/lib/redirect.h create mode 100644 archie/ppc/lib/results.c create mode 100644 archie/ppc/lib/results.h create mode 100644 archie/ppc/lib/srch.c create mode 100644 archie/ppc/lib/srch.h create mode 100644 archie/ppc/lib/str.c create mode 100644 archie/ppc/lib/str.h create mode 100644 archie/ppc/lib/strhash.c create mode 100644 archie/ppc/lib/strhash.h create mode 100644 archie/ppc/lib/strval.c create mode 100644 archie/ppc/lib/strval.h create mode 100644 archie/ppc/lib/stubs.c create mode 100644 archie/ppc/lib/sub.c create mode 100644 archie/ppc/lib/sub.h create mode 100644 archie/ppc/lib/token.c create mode 100644 archie/ppc/lib/token.h create mode 100644 archie/ppc/lib/vlink.c create mode 100644 archie/ppc/lib/vlink.h create mode 100644 archie/ppc/lib/waisattrib.c create mode 100644 archie/ppc/lib/waisattrib.h create mode 100644 archie/ppc/tcl/.gitignore create mode 100644 archie/ppc/tcl/AIX-2/.gitignore create mode 100755 archie/ppc/tcl/AIX-2/Makefile.in create mode 100755 archie/ppc/tcl/Makefile.in create mode 100755 archie/ppc/tcl/Makefile.post create mode 100755 archie/ppc/tcl/Makefile.pre create mode 100644 archie/ppc/tcl/SunOS-4.1.4/.gitignore create mode 100755 archie/ppc/tcl/SunOS-4.1.4/Makefile.in create mode 100644 archie/ppc/tcl/SunOS-5.4/.gitignore create mode 100755 archie/ppc/tcl/SunOS-5.4/Makefile.in create mode 120000 archie/ppc/tcl/SunOS-5.6 create mode 100644 archie/ppc/tcl/dpInt.h create mode 100644 archie/ppc/tcl/prsp.c create mode 100644 archie/ppc/tcl/prsp.h create mode 100644 archie/ppc/tcl/prsp_vlink.c create mode 100644 archie/ppc/tcl/prsp_vlink.h create mode 100644 archie/ppc/tcl/tclAppInit.c create mode 100644 archie/ppc/tcl/tkAppInit.c create mode 100644 archie/ppc/tcl/tkMain.c create mode 100644 archie/ppc/tcl/vls.tcl create mode 100644 archie/ppc/tcl/wais_search.tcl create mode 100644 archie/ppc/test/.gitignore create mode 100644 archie/ppc/test/AIX-2/.gitignore create mode 100755 archie/ppc/test/AIX-2/Makefile.in create mode 100755 archie/ppc/test/Makefile.in create mode 100644 archie/ppc/test/SunOS-4.1.4/.gitignore create mode 100755 archie/ppc/test/SunOS-4.1.4/Makefile.in create mode 100644 archie/ppc/test/SunOS-5.4/.gitignore create mode 100755 archie/ppc/test/SunOS-5.4/Makefile.in create mode 120000 archie/ppc/test/SunOS-5.6 create mode 100644 archie/ppc/test/ppctest.c create mode 100644 archie/ppc/test/test-Accept.txt create mode 100644 archie/ppc/test/test-access.c create mode 100644 archie/ppc/test/test-io.c create mode 100644 archie/ppc/test/test-link_to.c create mode 100644 archie/ppc/test/test-poly.c create mode 100644 archie/ppc/test/test-qwstrnsplit.c create mode 100644 archie/ppc/test/test-results.c create mode 100644 archie/ppc/test/test-splitwhite.c create mode 100644 archie/ppc/test/test-str.c create mode 100644 archie/ppc/test/test-strrspn.c create mode 100644 archie/ppc/test/test-token.c create mode 100644 archie/ppc/test/test-varsub.c create mode 100644 archie/ppc/test/varsub.dat create mode 100644 archie/ppc/weaseld/.gitignore create mode 100644 archie/ppc/weaseld/AIX-2/.gitignore create mode 100755 archie/ppc/weaseld/AIX-2/Makefile.in create mode 100755 archie/ppc/weaseld/Makefile.in create mode 100755 archie/ppc/weaseld/Makefile.post create mode 100755 archie/ppc/weaseld/Makefile.pre create mode 100644 archie/ppc/weaseld/SunOS-4.1.4/.gitignore create mode 100755 archie/ppc/weaseld/SunOS-4.1.4/Makefile.in create mode 100644 archie/ppc/weaseld/SunOS-5.4/.gitignore create mode 100755 archie/ppc/weaseld/SunOS-5.4/Makefile.in create mode 120000 archie/ppc/weaseld/SunOS-5.6 create mode 100644 archie/ppc/weaseld/_prog.c create mode 100644 archie/ppc/weaseld/aprint.h create mode 100644 archie/ppc/weaseld/contents.c create mode 100644 archie/ppc/weaseld/contents.h create mode 100644 archie/ppc/weaseld/gs.tcl create mode 100644 archie/ppc/weaseld/print_anon.c create mode 100644 archie/ppc/weaseld/print_gopher.c create mode 100644 archie/ppc/weaseld/print_sites.c create mode 100644 archie/ppc/weaseld/print_wais.c create mode 100644 archie/ppc/weaseld/url.c create mode 100644 archie/ppc/weaseld/url.h create mode 100644 archie/tools/.gitignore create mode 100644 archie/tools/AIX-2/.gitignore create mode 100755 archie/tools/AIX-2/Makefile.in create mode 100755 archie/tools/Makefile.post create mode 100755 archie/tools/Makefile.pre create mode 100644 archie/tools/SunOS-4.1.4/.gitignore create mode 100755 archie/tools/SunOS-4.1.4/Makefile.in create mode 100644 archie/tools/SunOS-5.4/.gitignore create mode 100755 archie/tools/SunOS-5.4/Makefile.in create mode 120000 archie/tools/SunOS-5.6 create mode 100644 archie/tools/ardomain.c create mode 100644 archie/tools/convert_hostdb.c create mode 100644 archie/tools/db_build.c create mode 100644 archie/tools/db_check.c create mode 100644 archie/tools/db_dump.c create mode 100644 archie/tools/db_reorder.c create mode 100644 archie/tools/db_siteidx.c create mode 100644 archie/tools/db_stats.c create mode 100644 archie/tools/dbspecs.c create mode 100644 archie/tools/dump_hostdb.c create mode 100644 archie/tools/fix_start_db.c create mode 100644 archie/tools/host_manage.c create mode 100644 archie/tools/host_manage.h create mode 100644 archie/tools/lang_tools.c create mode 100644 archie/tools/lang_tools.h create mode 100644 archie/tools/listd.h create mode 100644 archie/tools/old_host_db.h create mode 100644 archie/tools/old_hostdb.c create mode 100644 archie/tools/old_hostdb.h create mode 100644 archie/tools/restore_hostdb.c create mode 100644 archie/tools/screen.c create mode 100644 archie/tools/screen.h create mode 100644 archie/tools/utils.c create mode 100644 archie/tools/utils.h create mode 100644 archie/webindex/.gitignore create mode 100755 archie/webindex/Makefile.in create mode 100644 archie/webindex/client/AIX-2/.gitignore create mode 100755 archie/webindex/client/AIX-2/Makefile.in create mode 100644 archie/webindex/client/SunOS-4.1.4/.gitignore create mode 100644 archie/webindex/client/SunOS-5.4/.gitignore create mode 120000 archie/webindex/client/SunOS-5.6 create mode 100644 archie/webindex/lib/.gitignore create mode 100644 archie/webindex/lib/AIX-2/.gitignore create mode 100755 archie/webindex/lib/AIX-2/Makefile.in create mode 100755 archie/webindex/lib/Makefile.post create mode 100755 archie/webindex/lib/Makefile.pre create mode 100644 archie/webindex/lib/SunOS-4.1.4/.gitignore create mode 100755 archie/webindex/lib/SunOS-4.1.4/Makefile.in create mode 100644 archie/webindex/lib/SunOS-5.4/.gitignore create mode 100755 archie/webindex/lib/SunOS-5.4/Makefile.in create mode 120000 archie/webindex/lib/SunOS-5.6 create mode 100644 archie/webindex/lib/excerpt.c create mode 100644 archie/webindex/lib/excerpt.h create mode 100644 archie/webindex/lib/lang_libwebindex.c create mode 100644 archie/webindex/lib/lang_libwebindex.h create mode 100644 archie/webindex/lib/lang_weblib.h create mode 100644 archie/webindex/lib/sub_header.c create mode 100644 archie/webindex/lib/sub_header.h create mode 100644 archie/webindex/lib/sub_header_def.h create mode 100644 archie/webindex/lib/web.h create mode 100644 archie/webindex/lib/webindexdb_ops.c create mode 100644 archie/webindex/lib/webindexdb_ops.h create mode 100644 archie/webindex/parse/.gitignore create mode 100644 archie/webindex/parse/AIX-2/.gitignore create mode 100755 archie/webindex/parse/AIX-2/Makefile.in create mode 100755 archie/webindex/parse/Makefile.post create mode 100755 archie/webindex/parse/Makefile.pre create mode 100644 archie/webindex/parse/SunOS-4.1.4/.gitignore create mode 100755 archie/webindex/parse/SunOS-4.1.4/Makefile.in create mode 100644 archie/webindex/parse/SunOS-5.4/.gitignore create mode 100755 archie/webindex/parse/SunOS-5.4/Makefile.in create mode 120000 archie/webindex/parse/SunOS-5.6 create mode 100644 archie/webindex/parse/charset.c create mode 100644 archie/webindex/parse/charset.h create mode 100644 archie/webindex/parse/do_parse.c create mode 100644 archie/webindex/parse/excerpt.c create mode 100644 archie/webindex/parse/keywords.c create mode 100644 archie/webindex/parse/lang_parsers.c create mode 100644 archie/webindex/parse/lang_parsers.h create mode 100644 archie/webindex/parse/parse.c create mode 100644 archie/webindex/parse/parse.h create mode 100644 archie/webindex/parse/recurse.c create mode 100644 archie/webindex/parse/stem.c create mode 100644 archie/webindex/parse/stoplist create mode 100644 archie/webindex/parse/stoplist.c create mode 100644 archie/webindex/partial/.gitignore create mode 100644 archie/webindex/partial/AIX-2/.gitignore create mode 100755 archie/webindex/partial/AIX-2/Makefile.in create mode 100755 archie/webindex/partial/Makefile.post create mode 100755 archie/webindex/partial/Makefile.pre create mode 100644 archie/webindex/partial/SunOS-4.1.4/.gitignore create mode 100755 archie/webindex/partial/SunOS-4.1.4/Makefile.in create mode 100644 archie/webindex/partial/SunOS-5.4/.gitignore create mode 100755 archie/webindex/partial/SunOS-5.4/Makefile.in create mode 120000 archie/webindex/partial/SunOS-5.6 create mode 100644 archie/webindex/partial/do_partial.c create mode 100644 archie/webindex/partial/partial_web.c create mode 100644 archie/webindex/retrieve/.gitignore create mode 100644 archie/webindex/retrieve/AIX-2/.gitignore create mode 100755 archie/webindex/retrieve/AIX-2/Makefile.in create mode 100755 archie/webindex/retrieve/Makefile.post create mode 100755 archie/webindex/retrieve/Makefile.pre create mode 100644 archie/webindex/retrieve/SunOS-4.1.4/.gitignore create mode 100755 archie/webindex/retrieve/SunOS-4.1.4/Makefile.in create mode 100644 archie/webindex/retrieve/SunOS-5.4/.gitignore create mode 100755 archie/webindex/retrieve/SunOS-5.4/Makefile.in create mode 120000 archie/webindex/retrieve/SunOS-5.6 create mode 100644 archie/webindex/retrieve/date.c create mode 100644 archie/webindex/retrieve/do_retrieve.c create mode 100644 archie/webindex/retrieve/fileUrl.c create mode 100644 archie/webindex/retrieve/fileUrl.h create mode 100644 archie/webindex/retrieve/html.h create mode 100644 archie/webindex/retrieve/http.c create mode 100644 archie/webindex/retrieve/http.h create mode 100644 archie/webindex/retrieve/lang_retrieve.c create mode 100644 archie/webindex/retrieve/lang_retrieve.h create mode 100644 archie/webindex/retrieve/menu.c create mode 100644 archie/webindex/retrieve/menu.h create mode 100644 archie/webindex/retrieve/parse.c create mode 100644 archie/webindex/retrieve/retrieve_web.c create mode 100644 archie/webindex/retrieve/retrieve_web.h create mode 100644 archie/webindex/retrieve/robot.c create mode 100644 archie/webindex/retrieve/robot.h create mode 100644 archie/webindex/retrieve/str.c create mode 100644 archie/webindex/retrieve/str.h create mode 100644 archie/webindex/retrieve/tcp.c create mode 100644 archie/webindex/retrieve/tt.c create mode 100644 archie/webindex/retrieve/url.c create mode 100644 archie/webindex/retrieve/url.h create mode 100644 archie/webindex/retrieve/urldb.c create mode 100644 archie/webindex/retrieve/urldb.h create mode 100644 archie/webindex/tools/.gitignore create mode 100644 archie/webindex/tools/AIX-2/.gitignore create mode 100755 archie/webindex/tools/AIX-2/Makefile.in create mode 100755 archie/webindex/tools/Makefile.post create mode 100755 archie/webindex/tools/Makefile.pre create mode 100644 archie/webindex/tools/SunOS-4.1.4/.gitignore create mode 100755 archie/webindex/tools/SunOS-4.1.4/Makefile.in create mode 100644 archie/webindex/tools/SunOS-5.4/.gitignore create mode 100755 archie/webindex/tools/SunOS-5.4/Makefile.in create mode 120000 archie/webindex/tools/SunOS-5.6 create mode 100644 archie/webindex/tools/extern_urls.c create mode 100644 archie/webindex/tools/extern_urls.h create mode 100644 archie/webindex/tools/lang_tools.c create mode 100644 archie/webindex/tools/lang_tools.h create mode 100644 archie/webindex/update/.gitignore create mode 100644 archie/webindex/update/AIX-2/.gitignore create mode 100755 archie/webindex/update/AIX-2/Makefile.in create mode 100755 archie/webindex/update/Makefile.post create mode 100755 archie/webindex/update/Makefile.pre create mode 100644 archie/webindex/update/SunOS-4.1.4/.gitignore create mode 100755 archie/webindex/update/SunOS-4.1.4/Makefile.in create mode 100644 archie/webindex/update/SunOS-5.4/.gitignore create mode 100755 archie/webindex/update/SunOS-5.4/Makefile.in create mode 120000 archie/webindex/update/SunOS-5.6 create mode 100644 archie/webindex/update/check_webindex.c create mode 100644 archie/webindex/update/check_webindex.h create mode 100644 archie/webindex/update/delete_webindex.c create mode 100644 archie/webindex/update/delete_webindex.h create mode 100644 archie/webindex/update/insert_webindex.c create mode 100644 archie/webindex/update/insert_webindex.h create mode 100644 archie/webindex/update/interact_webindex.c create mode 100644 archie/webindex/update/interact_webindex.h create mode 100644 archie/webindex/update/lang_webindex.c create mode 100644 archie/webindex/update/lang_webindex.h create mode 100644 archie/webindex/update/net_webindex.c create mode 100644 archie/webindex/update/net_webindex.h create mode 100644 archie/webindex/update/setup_delete.c create mode 100644 archie/webindex/update/setup_insert.c create mode 100755 berkdb/Makefile.inc create mode 100644 berkdb/PORT/Makefile create mode 100644 berkdb/PORT/README create mode 120000 berkdb/PORT/SunOS-5.6 create mode 100644 berkdb/PORT/aix.3.2/Makefile create mode 120000 berkdb/PORT/aix.3.2/clib create mode 120000 berkdb/PORT/aix.3.2/include/cdefs.h create mode 100644 berkdb/PORT/aix.3.2/include/compat.h create mode 120000 berkdb/PORT/aix.3.2/include/db.h create mode 120000 berkdb/PORT/aix.3.2/include/mpool.h create mode 120000 berkdb/PORT/aix.3.2/include/ndbm.h create mode 120000 berkdb/PORT/aix.3.2/include/queue.h create mode 120000 berkdb/PORT/aix.3.2/sys create mode 120000 berkdb/PORT/bsd.4.4/Makefile create mode 120000 berkdb/PORT/bsd.4.4/clib create mode 120000 berkdb/PORT/bsd.4.4/include/cdefs.h create mode 120000 berkdb/PORT/bsd.4.4/include/compat.h create mode 100644 berkdb/PORT/bsd.4.4/include/db.h create mode 120000 berkdb/PORT/bsd.4.4/include/mpool.h create mode 120000 berkdb/PORT/bsd.4.4/include/ndbm.h create mode 120000 berkdb/PORT/bsd.4.4/include/queue.h create mode 120000 berkdb/PORT/bsd.4.4/sys create mode 120000 berkdb/PORT/bsdi.1.0/Makefile create mode 100644 berkdb/PORT/bsdi.1.0/OTHER_PATCHES create mode 120000 berkdb/PORT/bsdi.1.0/clib create mode 100644 berkdb/PORT/bsdi.1.0/include/assert.h create mode 120000 berkdb/PORT/bsdi.1.0/include/cdefs.h create mode 100644 berkdb/PORT/bsdi.1.0/include/compat.h create mode 120000 berkdb/PORT/bsdi.1.0/include/db.h create mode 120000 berkdb/PORT/bsdi.1.0/include/mpool.h create mode 120000 berkdb/PORT/bsdi.1.0/include/ndbm.h create mode 120000 berkdb/PORT/bsdi.1.0/include/queue.h create mode 100644 berkdb/PORT/bsdi.1.0/local/local.h create mode 100644 berkdb/PORT/bsdi.1.0/local/makebuf.c create mode 100644 berkdb/PORT/bsdi.1.0/local/setvbuf.c create mode 120000 berkdb/PORT/bsdi.1.0/sys create mode 100644 berkdb/PORT/clib/memmove.c create mode 100644 berkdb/PORT/clib/mktemp.c create mode 100644 berkdb/PORT/clib/snprintf.c create mode 100644 berkdb/PORT/clib/strerror.c create mode 100644 berkdb/PORT/dgux.5.4/Makefile create mode 120000 berkdb/PORT/dgux.5.4/clib create mode 120000 berkdb/PORT/dgux.5.4/include/cdefs.h create mode 100644 berkdb/PORT/dgux.5.4/include/compat.h create mode 120000 berkdb/PORT/dgux.5.4/include/db.h create mode 120000 berkdb/PORT/dgux.5.4/include/mpool.h create mode 120000 berkdb/PORT/dgux.5.4/include/ndbm.h create mode 120000 berkdb/PORT/dgux.5.4/include/queue.h create mode 120000 berkdb/PORT/dgux.5.4/sys create mode 120000 berkdb/PORT/hpux.8.07 create mode 100644 berkdb/PORT/hpux.9.01/Makefile create mode 120000 berkdb/PORT/hpux.9.01/clib create mode 120000 berkdb/PORT/hpux.9.01/include/cdefs.h create mode 100644 berkdb/PORT/hpux.9.01/include/compat.h create mode 120000 berkdb/PORT/hpux.9.01/include/db.h create mode 120000 berkdb/PORT/hpux.9.01/include/mpool.h create mode 120000 berkdb/PORT/hpux.9.01/include/ndbm.h create mode 120000 berkdb/PORT/hpux.9.01/include/queue.h create mode 100644 berkdb/PORT/hpux.9.01/local/hp_siglist.c create mode 120000 berkdb/PORT/hpux.9.01/sys create mode 100644 berkdb/PORT/include/cdefs.h create mode 100644 berkdb/PORT/include/compat.h create mode 120000 berkdb/PORT/include/db.h create mode 120000 berkdb/PORT/include/mpool.h create mode 100644 berkdb/PORT/include/ndbm.h create mode 100644 berkdb/PORT/include/queue.h create mode 100644 berkdb/PORT/irix.4.05F/Makefile create mode 100644 berkdb/PORT/irix.4.05F/OTHER_PATCHES create mode 120000 berkdb/PORT/irix.4.05F/clib create mode 120000 berkdb/PORT/irix.4.05F/include/cdefs.h create mode 100644 berkdb/PORT/irix.4.05F/include/compat.h create mode 120000 berkdb/PORT/irix.4.05F/include/db.h create mode 120000 berkdb/PORT/irix.4.05F/include/mpool.h create mode 120000 berkdb/PORT/irix.4.05F/include/ndbm.h create mode 120000 berkdb/PORT/irix.4.05F/include/queue.h create mode 120000 berkdb/PORT/irix.4.05F/sys create mode 100644 berkdb/PORT/linux/Makefile create mode 100644 berkdb/PORT/linux/OTHER_PATCHES create mode 120000 berkdb/PORT/linux/clib create mode 100644 berkdb/PORT/linux/include/compat.h create mode 120000 berkdb/PORT/linux/include/db.h create mode 120000 berkdb/PORT/linux/include/mpool.h create mode 120000 berkdb/PORT/linux/include/ndbm.h create mode 120000 berkdb/PORT/linux/sys create mode 100644 berkdb/PORT/osf.1.0.2/Makefile create mode 120000 berkdb/PORT/osf.1.0.2/clib create mode 120000 berkdb/PORT/osf.1.0.2/include/cdefs.h create mode 100644 berkdb/PORT/osf.1.0.2/include/compat.h create mode 120000 berkdb/PORT/osf.1.0.2/include/db.h create mode 120000 berkdb/PORT/osf.1.0.2/include/mpool.h create mode 120000 berkdb/PORT/osf.1.0.2/include/ndbm.h create mode 120000 berkdb/PORT/osf.1.0.2/include/queue.h create mode 120000 berkdb/PORT/osf.1.0.2/sys create mode 120000 berkdb/PORT/osf.1.3 create mode 120000 berkdb/PORT/osf.2.0 create mode 100644 berkdb/PORT/ptx.2.0/Makefile create mode 100644 berkdb/PORT/ptx.2.0/OTHER_PATCHES create mode 120000 berkdb/PORT/ptx.2.0/clib create mode 120000 berkdb/PORT/ptx.2.0/include/cdefs.h create mode 100644 berkdb/PORT/ptx.2.0/include/compat.h create mode 120000 berkdb/PORT/ptx.2.0/include/db.h create mode 120000 berkdb/PORT/ptx.2.0/include/mpool.h create mode 120000 berkdb/PORT/ptx.2.0/include/ndbm.h create mode 100644 berkdb/PORT/ptx.2.0/include/pathnames.h create mode 120000 berkdb/PORT/ptx.2.0/include/queue.h create mode 120000 berkdb/PORT/ptx.2.0/sys create mode 100644 berkdb/PORT/sinix.5.41/Makefile create mode 120000 berkdb/PORT/sinix.5.41/clib create mode 120000 berkdb/PORT/sinix.5.41/include/cdefs.h create mode 100644 berkdb/PORT/sinix.5.41/include/compat.h create mode 120000 berkdb/PORT/sinix.5.41/include/db.h create mode 120000 berkdb/PORT/sinix.5.41/include/mpool.h create mode 120000 berkdb/PORT/sinix.5.41/include/ndbm.h create mode 120000 berkdb/PORT/sinix.5.41/include/queue.h create mode 120000 berkdb/PORT/sinix.5.41/sys create mode 120000 berkdb/PORT/solaris.2.2 create mode 100644 berkdb/PORT/sunos.4.1.1/Makefile create mode 120000 berkdb/PORT/sunos.4.1.1/clib create mode 120000 berkdb/PORT/sunos.4.1.1/include/cdefs.h create mode 100644 berkdb/PORT/sunos.4.1.1/include/compat.h create mode 120000 berkdb/PORT/sunos.4.1.1/include/db.h create mode 120000 berkdb/PORT/sunos.4.1.1/include/mpool.h create mode 120000 berkdb/PORT/sunos.4.1.1/include/ndbm.h create mode 100644 berkdb/PORT/sunos.4.1.1/include/pathnames.h create mode 120000 berkdb/PORT/sunos.4.1.1/include/queue.h create mode 120000 berkdb/PORT/sunos.4.1.1/sys create mode 120000 berkdb/PORT/sunos.4.1.2 create mode 120000 berkdb/PORT/sunos.4.1.3 create mode 100755 berkdb/PORT/sunos.5.2/Makefile create mode 120000 berkdb/PORT/sunos.5.2/clib create mode 120000 berkdb/PORT/sunos.5.2/include/cdefs.h create mode 100644 berkdb/PORT/sunos.5.2/include/compat.h create mode 120000 berkdb/PORT/sunos.5.2/include/db.h create mode 120000 berkdb/PORT/sunos.5.2/include/mpool.h create mode 120000 berkdb/PORT/sunos.5.2/include/ndbm.h create mode 120000 berkdb/PORT/sunos.5.2/include/queue.h create mode 120000 berkdb/PORT/sunos.5.2/sys create mode 100644 berkdb/PORT/ultrix.4.2/Makefile create mode 120000 berkdb/PORT/ultrix.4.2/clib create mode 120000 berkdb/PORT/ultrix.4.2/include/cdefs.h create mode 100644 berkdb/PORT/ultrix.4.2/include/compat.h create mode 100644 berkdb/PORT/ultrix.4.2/include/db.h create mode 120000 berkdb/PORT/ultrix.4.2/include/mpool.h create mode 120000 berkdb/PORT/ultrix.4.2/include/ndbm.h create mode 120000 berkdb/PORT/ultrix.4.2/include/queue.h create mode 120000 berkdb/PORT/ultrix.4.2/sys create mode 120000 berkdb/PORT/ultrix.4.3 create mode 100644 berkdb/README create mode 100644 berkdb/btree/Makefile.inc create mode 100644 berkdb/btree/bt_close.c create mode 100644 berkdb/btree/bt_conv.c create mode 100644 berkdb/btree/bt_debug.c create mode 100644 berkdb/btree/bt_delete.c create mode 100644 berkdb/btree/bt_get.c create mode 100644 berkdb/btree/bt_open.c create mode 100644 berkdb/btree/bt_overflow.c create mode 100644 berkdb/btree/bt_page.c create mode 100644 berkdb/btree/bt_put.c create mode 100644 berkdb/btree/bt_search.c create mode 100644 berkdb/btree/bt_seq.c create mode 100644 berkdb/btree/bt_split.c create mode 100644 berkdb/btree/bt_utils.c create mode 100644 berkdb/btree/btree.h create mode 100644 berkdb/btree/extern.h create mode 120000 berkdb/btree/tags create mode 100644 berkdb/changelog create mode 100644 berkdb/db/Makefile.inc create mode 100644 berkdb/db/db.c create mode 100644 berkdb/db/tags create mode 100644 berkdb/docs/btree.3.ps create mode 100644 berkdb/docs/dbopen.3.ps create mode 100644 berkdb/docs/hash.3.ps create mode 100644 berkdb/docs/hash.usenix.ps create mode 100644 berkdb/docs/libtp.usenix.ps create mode 100644 berkdb/docs/mpool.3.ps create mode 100644 berkdb/docs/recno.3.ps create mode 100644 berkdb/hash/Makefile.inc create mode 100644 berkdb/hash/README create mode 100644 berkdb/hash/extern.h create mode 100644 berkdb/hash/hash.c create mode 100644 berkdb/hash/hash.h create mode 100644 berkdb/hash/hash_bigkey.c create mode 100644 berkdb/hash/hash_buf.c create mode 100644 berkdb/hash/hash_func.c create mode 100644 berkdb/hash/hash_log2.c create mode 100644 berkdb/hash/hash_page.c create mode 100644 berkdb/hash/hsearch.c create mode 100644 berkdb/hash/ndbm.c create mode 100644 berkdb/hash/page.h create mode 100644 berkdb/hash/search.h create mode 120000 berkdb/hash/tags create mode 100644 berkdb/include/db.h create mode 100644 berkdb/include/mpool.h create mode 120000 berkdb/include/tags create mode 100644 berkdb/irix.mbox create mode 100644 berkdb/man/Makefile.inc create mode 100644 berkdb/man/btree.3 create mode 100644 berkdb/man/dbopen.3 create mode 100644 berkdb/man/hash.3 create mode 100644 berkdb/man/mpool.3 create mode 100644 berkdb/man/recno.3 create mode 100644 berkdb/mpool/Makefile.inc create mode 100644 berkdb/mpool/README create mode 100644 berkdb/mpool/mpool.c create mode 100644 berkdb/mpool/mpool.libtp create mode 120000 berkdb/mpool/tags create mode 100644 berkdb/patch.1.1 create mode 100644 berkdb/patch.1.2 create mode 100644 berkdb/patch.1.3 create mode 100644 berkdb/patch.1.4 create mode 100644 berkdb/recno/Makefile.inc create mode 100644 berkdb/recno/extern.h create mode 100644 berkdb/recno/rec_close.c create mode 100644 berkdb/recno/rec_delete.c create mode 100644 berkdb/recno/rec_get.c create mode 100644 berkdb/recno/rec_open.c create mode 100644 berkdb/recno/rec_put.c create mode 100644 berkdb/recno/rec_search.c create mode 100644 berkdb/recno/rec_seq.c create mode 100644 berkdb/recno/rec_utils.c create mode 100644 berkdb/recno/recno.h create mode 120000 berkdb/recno/tags create mode 100644 berkdb/test/Makefile create mode 100644 berkdb/test/README create mode 100644 berkdb/test/btree.tests/main.c create mode 100644 berkdb/test/dbtest.c create mode 100644 berkdb/test/hash.tests/driver2.c create mode 100644 berkdb/test/hash.tests/makedb.sh create mode 100644 berkdb/test/hash.tests/tcreat3.c create mode 100644 berkdb/test/hash.tests/tdel.c create mode 100644 berkdb/test/hash.tests/testit create mode 100644 berkdb/test/hash.tests/thash4.c create mode 100644 berkdb/test/hash.tests/tread2.c create mode 100644 berkdb/test/hash.tests/tseq.c create mode 100644 berkdb/test/hash.tests/tverify.c create mode 100644 berkdb/test/run.test create mode 100755 build.sh create mode 100644 prospero/ACKNOWLEDGEMENTS create mode 100644 prospero/CHANGES create mode 100644 prospero/FILES create mode 100644 prospero/INSTALLATION create mode 100644 prospero/INSTALLATION_s create mode 100644 prospero/INSTALLATION_u create mode 100755 prospero/Makefile create mode 100755 prospero/Makefile.boilerplate create mode 120000 prospero/Makefile.config.SunOS-5.6 create mode 100755 prospero/Makefile.config.aix-2 create mode 100755 prospero/Makefile.config.dist create mode 100755 prospero/Makefile.config.sunos-4.1.3 create mode 100755 prospero/Makefile.config.sunos-4.1.3_u1 create mode 100755 prospero/Makefile.config.sunos-5.3 create mode 100755 prospero/Makefile.in create mode 100644 prospero/README create mode 100644 prospero/SUPPORTED create mode 100644 prospero/announcement create mode 100644 prospero/app/.gitignore create mode 100644 prospero/app/FILES create mode 100755 prospero/app/Makefile.backup.backup create mode 100755 prospero/app/Makefile.in create mode 100644 prospero/app/cat.c create mode 100644 prospero/app/ls.c create mode 100644 prospero/doc/.virt-sys create mode 100644 prospero/doc/ARCHIE.README create mode 100644 prospero/doc/FILES create mode 100644 prospero/doc/README create mode 100644 prospero/doc/README-prospero-documents create mode 100644 prospero/doc/customize.insts create mode 100644 prospero/doc/dangerous create mode 100644 prospero/doc/fullpage.sty create mode 100644 prospero/doc/getting-started.txt create mode 100644 prospero/doc/include-native.txt create mode 100644 prospero/doc/library.PS create mode 100644 prospero/doc/library.tex create mode 100644 prospero/doc/man/FILES create mode 100644 prospero/doc/man/archie.man create mode 100644 prospero/doc/manual.PS create mode 100644 prospero/doc/manual.tex create mode 100644 prospero/doc/menu-api.PS create mode 100644 prospero/doc/menu-api.tex create mode 100644 prospero/doc/more-getting-started.PS create mode 100644 prospero/doc/more-getting-started.tex create mode 100644 prospero/doc/names.txt create mode 100644 prospero/doc/nir.status.report create mode 100644 prospero/doc/protocol.PS create mode 100644 prospero/doc/protocol.tex create mode 100644 prospero/doc/rationales/FILES create mode 100644 prospero/doc/rationales/pthreads create mode 100644 prospero/doc/system_calls create mode 100644 prospero/doc/v.beta51.announcement create mode 100644 prospero/doc/v5.announcement create mode 100644 prospero/doc/v52.gopher.ann create mode 100644 prospero/doc/working-notes/FILES create mode 100644 prospero/doc/working-notes/README create mode 100644 prospero/doc/working-notes/collation-order.txt create mode 100644 prospero/doc/working-notes/gopher-hsonames.txt create mode 100644 prospero/doc/working-notes/new-acl-rights create mode 100644 prospero/doc/working-notes/object-interpretation.txt create mode 100644 prospero/doc/working-notes/pdap.txt create mode 100644 prospero/doc/working-notes/pfs-udp-ports.txt create mode 100644 prospero/doc/working-notes/wais-link-format.txt create mode 100644 prospero/include/FILES create mode 100644 prospero/include/archie.h create mode 100644 prospero/include/ardp.h create mode 100644 prospero/include/implicit_fixes.h create mode 100644 prospero/include/list_macros.h create mode 100644 prospero/include/mitra_macros.h create mode 100644 prospero/include/pcompat.h create mode 100644 prospero/include/perrno.h create mode 100644 prospero/include/pfs.h create mode 100644 prospero/include/pfs_threads.h create mode 100644 prospero/include/pfs_utils.h create mode 100644 prospero/include/plog.h create mode 100644 prospero/include/pmachine-conf.h create mode 100644 prospero/include/pmachine.h create mode 100644 prospero/include/pmachine.h.dist create mode 100644 prospero/include/posix_signal.h create mode 100644 prospero/include/pparse.h create mode 100644 prospero/include/ppasswd.h create mode 100644 prospero/include/pprot.h create mode 100644 prospero/include/pserver.h create mode 100644 prospero/include/pserver.h.dist create mode 100644 prospero/include/psite.h create mode 100644 prospero/include/psite.h.dist create mode 100644 prospero/include/psrv.h create mode 100644 prospero/include/sockettime.h create mode 100644 prospero/include/solaris_stdlib.h create mode 100644 prospero/include/string_with_strcasecmp.h create mode 100644 prospero/include/test_pth.c create mode 100644 prospero/include/usc-copyr.h create mode 100644 prospero/include/usc-license.h create mode 100644 prospero/include/uw-copyright.h create mode 100644 prospero/include/vcache.h create mode 100644 prospero/include/wais-source.h create mode 100644 prospero/lib/FILES create mode 100644 prospero/lib/FILES.ftp-only create mode 100644 prospero/lib/ardp/.gitignore create mode 100644 prospero/lib/ardp/FILES create mode 100755 prospero/lib/ardp/Makefile.in create mode 100755 prospero/lib/ardp/Makefile.tmp create mode 100644 prospero/lib/ardp/ardp.doc create mode 100644 prospero/lib/ardp/ardp_abort.c create mode 100644 prospero/lib/ardp/ardp_accept.c create mode 100644 prospero/lib/ardp/ardp_add2req.c create mode 100644 prospero/lib/ardp/ardp_breply.c create mode 100644 prospero/lib/ardp/ardp_error.c create mode 100644 prospero/lib/ardp/ardp_get_nxt.c create mode 100644 prospero/lib/ardp/ardp_headers.c create mode 100644 prospero/lib/ardp/ardp_int_err.c create mode 100644 prospero/lib/ardp/ardp_mutexes.c create mode 100644 prospero/lib/ardp/ardp_perrno.c create mode 100644 prospero/lib/ardp/ardp_pr_actv.c create mode 100644 prospero/lib/ardp/ardp_ptalloc.c create mode 100644 prospero/lib/ardp/ardp_reply.c create mode 100644 prospero/lib/ardp/ardp_respond.c create mode 100644 prospero/lib/ardp/ardp_retriev.c create mode 100644 prospero/lib/ardp/ardp_rqalloc.c create mode 100644 prospero/lib/ardp/ardp_send.c create mode 100644 prospero/lib/ardp/ardp_showbuf.c create mode 100644 prospero/lib/ardp/ardp_snd_pkt.c create mode 100644 prospero/lib/ardp/ardp_srv_ini.c create mode 100644 prospero/lib/ardp/ardp_xmit.c create mode 100644 prospero/lib/ardp/dependency.list create mode 100644 prospero/lib/ardp/dnscache_alloc.c create mode 100644 prospero/lib/ardp/dnscache_alloc.h create mode 100644 prospero/lib/ardp/flocks.c create mode 100644 prospero/lib/ardp/flocks.h create mode 100644 prospero/lib/ardp/hostname2adr.c create mode 100644 prospero/lib/ardp/p__th_self_num.c create mode 100644 prospero/lib/ardp/restrict.c create mode 100644 prospero/lib/ardp/unixerrstr.c create mode 100644 prospero/lib/ardp/usc_lic_str.c create mode 100644 prospero/lib/filters/.gitignore create mode 100644 prospero/lib/filters/FILES create mode 100755 prospero/lib/filters/Makefile.in create mode 100644 prospero/lib/filters/apply_fil.c create mode 100644 prospero/lib/filters/flist2string.c create mode 100644 prospero/lib/filters/helpers.c create mode 100644 prospero/lib/filters/nl_apply_fil.c create mode 100644 prospero/lib/filters/reorder_dir.c create mode 100644 prospero/lib/pcompat/.gitignore create mode 100644 prospero/lib/pcompat/FILES create mode 100755 prospero/lib/pcompat/Makefile.in create mode 100644 prospero/lib/pcompat/closedir.c create mode 100644 prospero/lib/pcompat/creat.c create mode 100644 prospero/lib/pcompat/execve.c create mode 100644 prospero/lib/pcompat/getvdirent.c create mode 100644 prospero/lib/pcompat/open.c create mode 100644 prospero/lib/pcompat/opendir.c create mode 100644 prospero/lib/pcompat/pcompat_init.c create mode 100644 prospero/lib/pcompat/pfs_access.c create mode 100644 prospero/lib/pcompat/pfs_default.c create mode 100644 prospero/lib/pcompat/pfs_quiet.c create mode 100644 prospero/lib/pcompat/readdir.c create mode 100644 prospero/lib/pcompat/scandir.c create mode 100644 prospero/lib/pcompat/seekdir.c create mode 100644 prospero/lib/pcompat/stat.c create mode 100644 prospero/lib/pcompat/telldir.c create mode 100644 prospero/lib/pfs/.gitignore create mode 100644 prospero/lib/pfs/FILES create mode 100755 prospero/lib/pfs/Makefile.in create mode 100644 prospero/lib/pfs/acalloc.c create mode 100644 prospero/lib/pfs/acltypes.c create mode 100644 prospero/lib/pfs/add_vlink.c create mode 100644 prospero/lib/pfs/asntotime.c create mode 100644 prospero/lib/pfs/atalloc.c create mode 100644 prospero/lib/pfs/atr_build.c create mode 100644 prospero/lib/pfs/atr_lookup.c create mode 100644 prospero/lib/pfs/bindecode.c create mode 100644 prospero/lib/pfs/binencode.c create mode 100644 prospero/lib/pfs/charset.h create mode 100644 prospero/lib/pfs/cl_qoprintf.c create mode 100644 prospero/lib/pfs/copyfile.c create mode 100644 prospero/lib/pfs/del_vlink.c create mode 100644 prospero/lib/pfs/elt.c create mode 100644 prospero/lib/pfs/equal_atrs.c create mode 100644 prospero/lib/pfs/equal_seq.c create mode 100644 prospero/lib/pfs/filetoin.c create mode 100644 prospero/lib/pfs/fl_insert.c create mode 100644 prospero/lib/pfs/flalloc.c create mode 100644 prospero/lib/pfs/fputbst.c create mode 100644 prospero/lib/pfs/get_acl.c create mode 100644 prospero/lib/pfs/in_acl.c create mode 100644 prospero/lib/pfs/in_atrs.c create mode 100644 prospero/lib/pfs/in_filter.c create mode 100644 prospero/lib/pfs/in_forwarded.c create mode 100644 prospero/lib/pfs/in_id.c create mode 100644 prospero/lib/pfs/in_line.c create mode 100644 prospero/lib/pfs/in_link.c create mode 100644 prospero/lib/pfs/in_nextline.c create mode 100644 prospero/lib/pfs/in_readc.c create mode 100644 prospero/lib/pfs/in_select.c create mode 100644 prospero/lib/pfs/in_sequence.c create mode 100644 prospero/lib/pfs/internal_err.c create mode 100644 prospero/lib/pfs/is_file.c create mode 100644 prospero/lib/pfs/length.c create mode 100644 prospero/lib/pfs/mapname.c create mode 100644 prospero/lib/pfs/mk_vdir.c create mode 100644 prospero/lib/pfs/mkdirs.c create mode 100644 prospero/lib/pfs/modify_acl.c create mode 100644 prospero/lib/pfs/month_sname.c create mode 100644 prospero/lib/pfs/myhost.c create mode 100644 prospero/lib/pfs/oballoc.c create mode 100644 prospero/lib/pfs/obother.c create mode 100644 prospero/lib/pfs/opentcp.c create mode 100644 prospero/lib/pfs/out_acl.c create mode 100644 prospero/lib/pfs/out_atr.c create mode 100644 prospero/lib/pfs/out_atrs.c create mode 100644 prospero/lib/pfs/out_filter.c create mode 100644 prospero/lib/pfs/out_link.c create mode 100644 prospero/lib/pfs/out_sequence.c create mode 100644 prospero/lib/pfs/p__qbstokenize.c create mode 100644 prospero/lib/pfs/p__qbstscanf.c create mode 100644 prospero/lib/pfs/p__req.c create mode 100644 prospero/lib/pfs/p_get_dir.c create mode 100644 prospero/lib/pfs/p_initialize.c create mode 100644 prospero/lib/pfs/p_uln_index.c create mode 100644 prospero/lib/pfs/paalloc.c create mode 100644 prospero/lib/pfs/penviron.c create mode 100644 prospero/lib/pfs/perrmesg.c create mode 100644 prospero/lib/pfs/pfalloc.c create mode 100644 prospero/lib/pfs/pfs_debug.c create mode 100644 prospero/lib/pfs/pfs_enable.c create mode 100644 prospero/lib/pfs/pfs_fopen.c create mode 100644 prospero/lib/pfs/pfs_mutexes.c create mode 100644 prospero/lib/pfs/pfs_open.c create mode 100644 prospero/lib/pfs/pget_am.c create mode 100644 prospero/lib/pfs/pget_at.c create mode 100644 prospero/lib/pfs/pmap_cache.c create mode 100644 prospero/lib/pfs/pmap_nfs.c create mode 100644 prospero/lib/pfs/pset_at.c create mode 100644 prospero/lib/pfs/pset_linkat.c create mode 100644 prospero/lib/pfs/qbstp_stcopyr.c create mode 100644 prospero/lib/pfs/qfprintf.c create mode 100644 prospero/lib/pfs/qindex.c create mode 100644 prospero/lib/pfs/qoprintf.c create mode 100644 prospero/lib/pfs/qrindex.c create mode 100644 prospero/lib/pfs/qscanf.c create mode 100644 prospero/lib/pfs/qsp_stcopyr.c create mode 100644 prospero/lib/pfs/qsprintf.c create mode 100644 prospero/lib/pfs/qsscanf.c create mode 100644 prospero/lib/pfs/qtokenize.c create mode 100644 prospero/lib/pfs/rd_vdir.c create mode 100644 prospero/lib/pfs/rd_vlink.c create mode 100644 prospero/lib/pfs/re_comp_exec.c create mode 100644 prospero/lib/pfs/readheader.c create mode 100644 prospero/lib/pfs/scan_error.c create mode 100644 prospero/lib/pfs/sindex.c create mode 100644 prospero/lib/pfs/slashpath.c create mode 100644 prospero/lib/pfs/slashpath2.c create mode 100644 prospero/lib/pfs/socket.c create mode 100644 prospero/lib/pfs/stat.c create mode 100644 prospero/lib/pfs/stcopy.c create mode 100644 prospero/lib/pfs/stequal.c create mode 100644 prospero/lib/pfs/strccmp.c create mode 100644 prospero/lib/pfs/strpbrk.c create mode 100644 prospero/lib/pfs/strspn.c create mode 100644 prospero/lib/pfs/timetoasn.c create mode 100644 prospero/lib/pfs/tkalloc.c create mode 100644 prospero/lib/pfs/tklistcmp.c create mode 100644 prospero/lib/pfs/tokeniz_mcmp.c create mode 100644 prospero/lib/pfs/ucase.c create mode 100644 prospero/lib/pfs/ul_insert.c create mode 100644 prospero/lib/pfs/unquote.c create mode 100644 prospero/lib/pfs/update_link.c create mode 100644 prospero/lib/pfs/vfsetenv.c create mode 100644 prospero/lib/pfs/vl_add_atrs.c create mode 100644 prospero/lib/pfs/vl_comp.c create mode 100644 prospero/lib/pfs/vl_delete.c create mode 100644 prospero/lib/pfs/vl_insert.c create mode 100644 prospero/lib/pfs/vlalloc.c create mode 100644 prospero/lib/pfs/vqfprintf.c create mode 100644 prospero/lib/pfs/vqscanf.c create mode 100644 prospero/lib/pfs/vqscanf.c.in-progress create mode 100644 prospero/lib/pfs/vqsprintf.c create mode 100644 prospero/lib/pfs/wcmatch.c create mode 100644 prospero/lib/pfs/wholefiltoin.c create mode 100644 prospero/lib/psrv/.gitignore create mode 100644 prospero/lib/psrv/FILES create mode 100755 prospero/lib/psrv/Makefile.in create mode 100644 prospero/lib/psrv/ad2l_atr.c create mode 100644 prospero/lib/psrv/archie2/.gitignore create mode 100644 prospero/lib/psrv/archie2/FILES create mode 100755 prospero/lib/psrv/archie2/Makefile.backup create mode 100644 prospero/lib/psrv/archie2/README create mode 100644 prospero/lib/psrv/archie2/arch_dsdb.c create mode 100644 prospero/lib/psrv/archie2/arch_prioritize.c create mode 100644 prospero/lib/psrv/archie2/archie_src/include/ar_attrib.h create mode 100644 prospero/lib/psrv/archie2/archie_src/include/ar_search.h create mode 100644 prospero/lib/psrv/archie2/archie_src/include/archie_defs.h create mode 100644 prospero/lib/psrv/archie2/archie_src/include/database.h create mode 100644 prospero/lib/psrv/archie2/archie_src/include/db_ops.h create mode 100644 prospero/lib/psrv/archie2/archie_src/include/defines.h create mode 100644 prospero/lib/psrv/archie2/archie_src/include/error.h create mode 100644 prospero/lib/psrv/archie2/archie_src/include/files.h create mode 100644 prospero/lib/psrv/archie2/archie_src/include/host_db.h create mode 100644 prospero/lib/psrv/archie2/archie_src/include/master.h create mode 100644 prospero/lib/psrv/archie2/archie_src/include/structs.h create mode 100644 prospero/lib/psrv/archie2/archie_src/include/typedef.h create mode 100644 prospero/lib/psrv/archie2/atopdate.c create mode 100644 prospero/lib/psrv/archie2/atoplink.c create mode 100644 prospero/lib/psrv/archie2/prarch.h create mode 100644 prospero/lib/psrv/archie2/prarch_host.c create mode 100644 prospero/lib/psrv/archie2/prarch_match.c create mode 100644 prospero/lib/psrv/at_delete.c create mode 100644 prospero/lib/psrv/change_acl.c create mode 100644 prospero/lib/psrv/check_acl.c create mode 100644 prospero/lib/psrv/check_nfs.c create mode 100644 prospero/lib/psrv/chk_krb_auth.c create mode 100644 prospero/lib/psrv/chk_localpth.c create mode 100644 prospero/lib/psrv/dsdir.c create mode 100644 prospero/lib/psrv/dsrfinfo.c create mode 100644 prospero/lib/psrv/dsrobject.c create mode 100644 prospero/lib/psrv/dsrobject_v6.c create mode 100644 prospero/lib/psrv/dswfinfo.c create mode 100644 prospero/lib/psrv/dswobject.c create mode 100644 prospero/lib/psrv/error_reply.c create mode 100644 prospero/lib/psrv/gopher_gw/.gitignore create mode 100644 prospero/lib/psrv/gopher_gw/FILES create mode 100755 prospero/lib/psrv/gopher_gw/Makefile.in create mode 100644 prospero/lib/psrv/gopher_gw/glalloc.c create mode 100644 prospero/lib/psrv/gopher_gw/goph_gw_dsdb.c create mode 100644 prospero/lib/psrv/gopher_gw/goph_gw_mutex.c create mode 100644 prospero/lib/psrv/gopher_gw/gopher.h create mode 100644 prospero/lib/psrv/magic.c create mode 100644 prospero/lib/psrv/named_acl.c create mode 100644 prospero/lib/psrv/optparse.c create mode 100644 prospero/lib/psrv/plog.c create mode 100644 prospero/lib/psrv/ppasswd.c create mode 100644 prospero/lib/psrv/psrv_mutexes.c create mode 100644 prospero/lib/psrv/replyf.c create mode 100644 prospero/lib/psrv/retrieve_fp.c create mode 100644 prospero/lib/psrv/srv_qoprintf.c create mode 100644 prospero/lib/psrv/stat_object.c create mode 100644 prospero/lib/psrv/wais_gw/.gitignore create mode 100644 prospero/lib/psrv/wais_gw/FILES create mode 100755 prospero/lib/psrv/wais_gw/Makefile.in create mode 100644 prospero/lib/psrv/wais_gw/buffalloc.c create mode 100644 prospero/lib/psrv/wais_gw/buffalloc.h create mode 100644 prospero/lib/psrv/wais_gw/cdialect.h create mode 100644 prospero/lib/psrv/wais_gw/cutil.c create mode 100644 prospero/lib/psrv/wais_gw/cutil.h create mode 100644 prospero/lib/psrv/wais_gw/docid.h create mode 100644 prospero/lib/psrv/wais_gw/futil.c create mode 100644 prospero/lib/psrv/wais_gw/futil.h create mode 100644 prospero/lib/psrv/wais_gw/ietftype.c create mode 100644 prospero/lib/psrv/wais_gw/ietftype.h create mode 100644 prospero/lib/psrv/wais_gw/ietftype_parse.c create mode 100644 prospero/lib/psrv/wais_gw/ietftype_parse.h create mode 100644 prospero/lib/psrv/wais_gw/ietftypes create mode 100644 prospero/lib/psrv/wais_gw/inface.c create mode 100644 prospero/lib/psrv/wais_gw/inface.h create mode 100644 prospero/lib/psrv/wais_gw/irfileio.c create mode 100644 prospero/lib/psrv/wais_gw/irfileio.h create mode 100644 prospero/lib/psrv/wais_gw/list.c create mode 100644 prospero/lib/psrv/wais_gw/list.h create mode 100644 prospero/lib/psrv/wais_gw/main.c create mode 100644 prospero/lib/psrv/wais_gw/panic.c create mode 100644 prospero/lib/psrv/wais_gw/panic.h create mode 100644 prospero/lib/psrv/wais_gw/sockets.c create mode 100644 prospero/lib/psrv/wais_gw/sockets.h create mode 100644 prospero/lib/psrv/wais_gw/source.c create mode 100644 prospero/lib/psrv/wais_gw/source.h create mode 100644 prospero/lib/psrv/wais_gw/sourcealloc.c create mode 100644 prospero/lib/psrv/wais_gw/sourceparse create mode 100644 prospero/lib/psrv/wais_gw/sourceparse.c create mode 100644 prospero/lib/psrv/wais_gw/ustubs.c create mode 100644 prospero/lib/psrv/wais_gw/ustubs.h create mode 100644 prospero/lib/psrv/wais_gw/wais_gw_dsdb.c create mode 100644 prospero/lib/psrv/wais_gw/wais_gw_dsdb.h create mode 100644 prospero/lib/psrv/wais_gw/wais_gw_mutex.c create mode 100644 prospero/lib/psrv/wais_gw/waislog.c create mode 100644 prospero/lib/psrv/wais_gw/waislog.h create mode 100644 prospero/lib/psrv/wais_gw/wmessage.c create mode 100644 prospero/lib/psrv/wais_gw/wmessage.h create mode 100644 prospero/lib/psrv/wais_gw/wprot.c create mode 100644 prospero/lib/psrv/wais_gw/wprot.h create mode 100644 prospero/lib/psrv/wais_gw/wutil.c create mode 100644 prospero/lib/psrv/wais_gw/wutil.h create mode 100644 prospero/lib/psrv/wais_gw/zprot.c create mode 100644 prospero/lib/psrv/wais_gw/zprot.h create mode 100644 prospero/lib/psrv/wais_gw/ztype1.c create mode 100644 prospero/lib/psrv/wais_gw/ztype1.h create mode 100644 prospero/lib/psrv/wais_gw/zutil.c create mode 100644 prospero/lib/psrv/wais_gw/zutil.h create mode 100644 prospero/misc/FILES create mode 100644 prospero/misc/empty.c create mode 100644 prospero/misc/install.sh create mode 100644 prospero/misc/osetenv.c create mode 100644 prospero/misc/regex.c create mode 100644 prospero/patches/LOG create mode 100644 prospero/patches/apply.patches create mode 100644 prospero/patches/done/10Mar94.dircache.patch create mode 100644 prospero/patches/done/10Mar94.dnscache.patch create mode 100644 prospero/patches/done/10Mar94.dnscache1.patch create mode 100644 prospero/patches/done/10Mar94.doc1.patch create mode 100644 prospero/patches/done/10Mar94.memleaks.patch create mode 100644 prospero/patches/done/10Mar94.purify2.patch create mode 100644 prospero/patches/done/10Mar94.thread.patch create mode 100644 prospero/patches/done/10Mar94.thread2.patch create mode 100644 prospero/patches/done/10Mar94.thread3.patch create mode 100644 prospero/patches/done/10Mar94.thread4.patch create mode 100644 prospero/patches/done/pfs_threads.h create mode 100644 prospero/patches/half-done/10Mar94.solaris.patch create mode 100644 prospero/patches/ignored/10Mar94.ackall.patch create mode 100644 prospero/patches/ignored/10Mar94.aolwait.patch create mode 100644 prospero/patches/ignored/10Mar94.solaris1.patch create mode 100644 prospero/patches/ignored/10Mar94.solaris2.patch create mode 100644 prospero/pfs_threads.doc create mode 100644 prospero/server/.gitignore create mode 100644 prospero/server/COMPATABILITY create mode 100644 prospero/server/FILES create mode 100755 prospero/server/Makefile.in create mode 100644 prospero/server/create_link.c create mode 100644 prospero/server/create_obj.c create mode 100644 prospero/server/cvt_v1_ltype.c create mode 100644 prospero/server/delete_link.c create mode 100644 prospero/server/dirsrv.c create mode 100644 prospero/server/dirsrv.h create mode 100644 prospero/server/dirsrv_v1.c create mode 100644 prospero/server/ed_link_info.c create mode 100644 prospero/server/ed_obj_info.c create mode 100644 prospero/server/edit_acl.c create mode 100644 prospero/server/forwarded.c create mode 100644 prospero/server/get_obj_info.c create mode 100644 prospero/server/list.c create mode 100644 prospero/server/list_acl.c create mode 100644 prospero/server/next create mode 100644 prospero/server/parameter.c create mode 100644 prospero/server/pstart.c create mode 100644 prospero/server/pw_edit.c create mode 100644 prospero/server/restart_srv.c create mode 100644 prospero/server/shadowcvt.c create mode 100644 prospero/server/shadowcvt.doc create mode 100644 prospero/server/update.c create mode 100644 prospero/server/version.c create mode 100644 prospero/server/xyz create mode 100644 prospero/user/.gitignore create mode 100644 prospero/user/FILES create mode 100755 prospero/user/Makefile.in create mode 100644 prospero/user/als.c create mode 100644 prospero/user/aq_query.c create mode 100644 prospero/user/archie.c create mode 100644 prospero/user/gen_vfsetup.c create mode 100644 prospero/user/gmon.out create mode 100644 prospero/user/list_acl.c create mode 100644 prospero/user/menu/.gitignore create mode 100644 prospero/user/menu/FILES create mode 100755 prospero/user/menu/Makefile.in create mode 100644 prospero/user/menu/api.c create mode 100644 prospero/user/menu/bub.c create mode 100644 prospero/user/menu/comp.c create mode 100644 prospero/user/menu/config.h create mode 100644 prospero/user/menu/io_util.c create mode 100644 prospero/user/menu/item_desc.c create mode 100644 prospero/user/menu/line.c create mode 100644 prospero/user/menu/main.c create mode 100644 prospero/user/menu/menu.c create mode 100644 prospero/user/menu/menu.h create mode 100644 prospero/user/menu/objects.c create mode 100644 prospero/user/menu/objects.h create mode 100644 prospero/user/menu/p_menu.h create mode 100644 prospero/user/menu/search.c create mode 100644 prospero/user/newvs.c create mode 100644 prospero/user/p__vcd.c create mode 100644 prospero/user/p__vfsetup.c create mode 100644 prospero/user/padmin.c create mode 100644 prospero/user/pfs.c create mode 100644 prospero/user/psession.c create mode 100644 prospero/user/pstatus.c create mode 100644 prospero/user/set_acl.c create mode 100644 prospero/user/set_atr.c create mode 100644 prospero/user/vcache/.gitignore create mode 100644 prospero/user/vcache/FILES create mode 100755 prospero/user/vcache/Makefile.in create mode 100644 prospero/user/vcache/aftpget.c create mode 100644 prospero/user/vcache/cmds.c create mode 100644 prospero/user/vcache/ftp.c create mode 100644 prospero/user/vcache/ftp.h create mode 100644 prospero/user/vcache/ftp_var.h create mode 100644 prospero/user/vcache/gopherget.c create mode 100644 prospero/user/vcache/main.c create mode 100644 prospero/user/vcache/pclose.c create mode 100644 prospero/user/vcache/ruserpass.c create mode 100644 prospero/user/vcache/telnet.h create mode 100644 prospero/user/vcache/vcache.c create mode 100644 prospero/user/vcache/vcache.h create mode 100644 prospero/user/vcache/vcache_macros.h create mode 100644 prospero/user/vget.c create mode 100644 prospero/user/vln.c create mode 100644 prospero/user/vls.c create mode 100644 prospero/user/vmkdir.c create mode 100644 prospero/user/vrm.c create mode 100644 tcl-dp/CHANGES create mode 100644 tcl-dp/FAQ create mode 100644 tcl-dp/LICENSE create mode 100644 tcl-dp/README create mode 100644 tcl-dp/TODO create mode 100644 tcl-dp/api/dpApi.c create mode 100644 tcl-dp/api/dpApi.h create mode 100644 tcl-dp/api/dpExample.c create mode 100644 tcl-dp/api/makefile.win create mode 100644 tcl-dp/api/readme.api create mode 100644 tcl-dp/doc/dp_accept.html create mode 100644 tcl-dp/doc/dp_admin.html create mode 100644 tcl-dp/doc/dp_connect.html create mode 100644 tcl-dp/doc/dp_copy.html create mode 100644 tcl-dp/doc/dp_netinfo.html create mode 100644 tcl-dp/doc/dp_rdo.html create mode 100644 tcl-dp/doc/dp_recv.html create mode 100644 tcl-dp/doc/dp_rpc.html create mode 100644 tcl-dp/doc/dp_send.html create mode 100644 tcl-dp/doc/email.html create mode 100644 tcl-dp/doc/filter.html create mode 100644 tcl-dp/doc/index.html create mode 100644 tcl-dp/doc/ipm.html create mode 100644 tcl-dp/doc/makerpcclient.html create mode 100644 tcl-dp/doc/makerpcserver.html create mode 100644 tcl-dp/doc/sample.html create mode 100644 tcl-dp/doc/serial.html create mode 100644 tcl-dp/doc/tcp.html create mode 100644 tcl-dp/doc/udp.html create mode 100644 tcl-dp/dp.tek create mode 100644 tcl-dp/dunix_patch/dp.tek create mode 100644 tcl-dp/dunix_patch/dpSerial.c create mode 100644 tcl-dp/examples/conference/README create mode 100644 tcl-dp/examples/conference/enter.tcl create mode 100644 tcl-dp/examples/conference/room.tcl create mode 100644 tcl-dp/examples/ftp/client.tcl create mode 100644 tcl-dp/examples/ftp/server.tcl create mode 100644 tcl-dp/examples/tictactoe/README create mode 100644 tcl-dp/examples/tictactoe/board.tcl create mode 100644 tcl-dp/examples/tictactoe/interface.tcl create mode 100644 tcl-dp/examples/tictactoe/playerO.tcl create mode 100644 tcl-dp/examples/tictactoe/playerX.tcl create mode 100644 tcl-dp/examples/whiteboard/readme create mode 100644 tcl-dp/examples/whiteboard/wbClient.tcl create mode 100644 tcl-dp/examples/whiteboard/wbServer.tcl create mode 100644 tcl-dp/generic/dp.h create mode 100644 tcl-dp/generic/dpChan.c create mode 100644 tcl-dp/generic/dpCmds.c create mode 100644 tcl-dp/generic/dpFilters.c create mode 100644 tcl-dp/generic/dpIPM.c create mode 100644 tcl-dp/generic/dpIdentity.c create mode 100644 tcl-dp/generic/dpInit.c create mode 100644 tcl-dp/generic/dpInt.h create mode 100644 tcl-dp/generic/dpPackOff.c create mode 100644 tcl-dp/generic/dpPatch.h create mode 100644 tcl-dp/generic/dpPlugF.c create mode 100644 tcl-dp/generic/dpPort.h create mode 100644 tcl-dp/generic/dpRPC.c create mode 100644 tcl-dp/generic/dpSerial.c create mode 100644 tcl-dp/generic/dpSock.c create mode 100644 tcl-dp/generic/dpTcp.c create mode 100644 tcl-dp/generic/dpUdp.c create mode 100644 tcl-dp/library/acl.tcl create mode 100644 tcl-dp/library/distribObj.tcl create mode 100644 tcl-dp/library/dp_atclose.tcl create mode 100644 tcl-dp/library/dp_atexit.tcl create mode 100644 tcl-dp/library/ldelete.tcl create mode 100644 tcl-dp/library/oo.tcl create mode 100644 tcl-dp/library/rpc.tcl create mode 100644 tcl-dp/teki.tcl create mode 100644 tcl-dp/tekilib/debug.tcl create mode 100644 tcl-dp/tekilib/http.tcl create mode 100644 tcl-dp/tekilib/logo.gif create mode 100644 tcl-dp/tekilib/pkgIndex.tcl create mode 100644 tcl-dp/tekilib/progress-tcl.tcl create mode 100644 tcl-dp/tekilib/progress-tk.tcl create mode 100644 tcl-dp/tekilib/undo.tcl create mode 100644 tcl-dp/tekilib/wise.tcl create mode 100644 tcl-dp/tests/00-first.test create mode 100644 tcl-dp/tests/all create mode 100644 tcl-dp/tests/connect.test create mode 100644 tcl-dp/tests/copy.test create mode 100644 tcl-dp/tests/defs create mode 100644 tcl-dp/tests/email.test create mode 100644 tcl-dp/tests/identity.test create mode 100644 tcl-dp/tests/ipm.test create mode 100644 tcl-dp/tests/make-server create mode 100644 tcl-dp/tests/netinfo.test create mode 100644 tcl-dp/tests/plugin.test create mode 100644 tcl-dp/tests/plugin2.test create mode 100644 tcl-dp/tests/rpc.test create mode 100644 tcl-dp/tests/ser_xmit.test create mode 100644 tcl-dp/tests/serial.test create mode 100644 tcl-dp/tests/server create mode 100644 tcl-dp/tests/tcp.test create mode 100644 tcl-dp/tests/udp.test create mode 100644 tcl-dp/tests/xmit.test create mode 100755 tcl-dp/unix/Makefile.in create mode 100644 tcl-dp/unix/compat/in.h create mode 100644 tcl-dp/unix/compat/malloc.h create mode 100644 tcl-dp/unix/compat/stdlib.h create mode 100644 tcl-dp/unix/compat/string.h create mode 100644 tcl-dp/unix/compat/unistd.h create mode 100755 tcl-dp/unix/configure create mode 100755 tcl-dp/unix/configure.in create mode 100644 tcl-dp/unix/dpAppInit.c create mode 100644 tcl-dp/unix/dpEFilter.c create mode 100644 tcl-dp/unix/dpEmail.c create mode 100644 tcl-dp/unix/dpInit.c create mode 100644 tcl-dp/unix/dpLocks.c create mode 100644 tcl-dp/unix/dpPort.h create mode 100644 tcl-dp/unix/dpSerial.c create mode 100644 tcl-dp/unix/dpSock.c create mode 100644 tcl-dp/unix/dpUnixIpm.c create mode 100644 tcl-dp/unix/dpUnixTcp.c create mode 100644 tcl-dp/unix/dpUnixUdp.c create mode 100644 tcl-dp/win/dpAppInit.c create mode 100644 tcl-dp/win/dpInit.c create mode 100644 tcl-dp/win/dpPort.h create mode 100644 tcl-dp/win/dpSerial.c create mode 100644 tcl-dp/win/dpSock.c create mode 100644 tcl-dp/win/dpWinIPM.c create mode 100644 tcl-dp/win/dpWinTcp.c create mode 100644 tcl-dp/win/dpWinUDP.c create mode 100644 tcl-dp/win/makefile.76 create mode 100644 tcl-dp/win/makefile.80 create mode 100755 tcl7.3/Makefile.in create mode 100644 tcl7.3/README create mode 100644 tcl7.3/changes create mode 100644 tcl7.3/compat/README create mode 100644 tcl7.3/compat/dirent.h create mode 100644 tcl7.3/compat/dirent2.h create mode 100644 tcl7.3/compat/float.h create mode 100644 tcl7.3/compat/getcwd.c create mode 100644 tcl7.3/compat/limits.h create mode 100644 tcl7.3/compat/opendir.c create mode 100644 tcl7.3/compat/stdlib.h create mode 100644 tcl7.3/compat/strerror.c create mode 100644 tcl7.3/compat/string.h create mode 100644 tcl7.3/compat/strstr.c create mode 100644 tcl7.3/compat/strtod.c create mode 100644 tcl7.3/compat/strtol.c create mode 100644 tcl7.3/compat/strtoul.c create mode 100644 tcl7.3/compat/tmpnam.c create mode 100644 tcl7.3/compat/unistd.h create mode 100644 tcl7.3/compat/waitpid.c create mode 100755 tcl7.3/configure create mode 100755 tcl7.3/configure.in create mode 100755 tcl7.3/configure.info create mode 100644 tcl7.3/doc/AddErrInfo.3 create mode 100644 tcl7.3/doc/AppInit.3 create mode 100644 tcl7.3/doc/Async.3 create mode 100644 tcl7.3/doc/Backslash.3 create mode 100644 tcl7.3/doc/CallDel.3 create mode 100644 tcl7.3/doc/CmdCmplt.3 create mode 100644 tcl7.3/doc/Concat.3 create mode 100644 tcl7.3/doc/CrtCommand.3 create mode 100644 tcl7.3/doc/CrtInterp.3 create mode 100644 tcl7.3/doc/CrtMathFnc.3 create mode 100644 tcl7.3/doc/CrtPipelin.3 create mode 100644 tcl7.3/doc/CrtTrace.3 create mode 100644 tcl7.3/doc/DString.3 create mode 100644 tcl7.3/doc/DetachPids.3 create mode 100644 tcl7.3/doc/EnterFile.3 create mode 100644 tcl7.3/doc/Eval.3 create mode 100644 tcl7.3/doc/ExprLong.3 create mode 100644 tcl7.3/doc/GetInt.3 create mode 100644 tcl7.3/doc/Hash.3 create mode 100644 tcl7.3/doc/Interp.3 create mode 100644 tcl7.3/doc/LinkVar.3 create mode 100644 tcl7.3/doc/PrintDbl.3 create mode 100644 tcl7.3/doc/RecordEval.3 create mode 100644 tcl7.3/doc/RegExp.3 create mode 100644 tcl7.3/doc/SetRecLmt.3 create mode 100644 tcl7.3/doc/SetResult.3 create mode 100644 tcl7.3/doc/SetVar.3 create mode 100644 tcl7.3/doc/SplitList.3 create mode 100644 tcl7.3/doc/StrMatch.3 create mode 100644 tcl7.3/doc/Tcl.n create mode 100644 tcl7.3/doc/TildeSubst.3 create mode 100644 tcl7.3/doc/TraceVar.3 create mode 100644 tcl7.3/doc/append.n create mode 100644 tcl7.3/doc/array.n create mode 100644 tcl7.3/doc/break.n create mode 100644 tcl7.3/doc/case.n create mode 100644 tcl7.3/doc/catch.n create mode 100644 tcl7.3/doc/cd.n create mode 100644 tcl7.3/doc/close.n create mode 100644 tcl7.3/doc/concat.n create mode 100644 tcl7.3/doc/continue.n create mode 100644 tcl7.3/doc/eof.n create mode 100644 tcl7.3/doc/error.n create mode 100644 tcl7.3/doc/eval.n create mode 100644 tcl7.3/doc/exec.n create mode 100644 tcl7.3/doc/exit.n create mode 100644 tcl7.3/doc/expr.n create mode 100644 tcl7.3/doc/file.n create mode 100644 tcl7.3/doc/flush.n create mode 100644 tcl7.3/doc/for.n create mode 100644 tcl7.3/doc/foreach.n create mode 100644 tcl7.3/doc/format.n create mode 100644 tcl7.3/doc/gets.n create mode 100644 tcl7.3/doc/glob.n create mode 100644 tcl7.3/doc/global.n create mode 100644 tcl7.3/doc/history.n create mode 100644 tcl7.3/doc/if.n create mode 100644 tcl7.3/doc/incr.n create mode 100644 tcl7.3/doc/info.n create mode 100644 tcl7.3/doc/join.n create mode 100644 tcl7.3/doc/lappend.n create mode 100644 tcl7.3/doc/library.n create mode 100644 tcl7.3/doc/lindex.n create mode 100644 tcl7.3/doc/linsert.n create mode 100644 tcl7.3/doc/list.n create mode 100644 tcl7.3/doc/llength.n create mode 100644 tcl7.3/doc/lrange.n create mode 100644 tcl7.3/doc/lreplace.n create mode 100644 tcl7.3/doc/lsearch.n create mode 100644 tcl7.3/doc/lsort.n create mode 100644 tcl7.3/doc/man.macros create mode 100644 tcl7.3/doc/open.n create mode 100644 tcl7.3/doc/pid.n create mode 100644 tcl7.3/doc/proc.n create mode 100644 tcl7.3/doc/puts.n create mode 100644 tcl7.3/doc/pwd.n create mode 100644 tcl7.3/doc/read.n create mode 100644 tcl7.3/doc/regexp.n create mode 100644 tcl7.3/doc/regsub.n create mode 100644 tcl7.3/doc/rename.n create mode 100644 tcl7.3/doc/return.n create mode 100644 tcl7.3/doc/scan.n create mode 100644 tcl7.3/doc/seek.n create mode 100644 tcl7.3/doc/set.n create mode 100644 tcl7.3/doc/source.n create mode 100644 tcl7.3/doc/split.n create mode 100644 tcl7.3/doc/string.n create mode 100644 tcl7.3/doc/switch.n create mode 100644 tcl7.3/doc/tclsh.1 create mode 100644 tcl7.3/doc/tclvars.n create mode 100644 tcl7.3/doc/tell.n create mode 100644 tcl7.3/doc/time.n create mode 100644 tcl7.3/doc/trace.n create mode 100644 tcl7.3/doc/unknown.n create mode 100644 tcl7.3/doc/unset.n create mode 100644 tcl7.3/doc/uplevel.n create mode 100644 tcl7.3/doc/upvar.n create mode 100644 tcl7.3/doc/while.n create mode 100644 tcl7.3/library/init.tcl create mode 100644 tcl7.3/library/parray.tcl create mode 100644 tcl7.3/library/tclIndex create mode 100644 tcl7.3/panic.c create mode 100644 tcl7.3/patchlevel.h create mode 100644 tcl7.3/porting.notes create mode 100644 tcl7.3/regexp.c create mode 100644 tcl7.3/tcl.h create mode 100644 tcl7.3/tclAppInit.c create mode 100644 tcl7.3/tclAsync.c create mode 100644 tcl7.3/tclBasic.c create mode 100644 tcl7.3/tclCkalloc.c create mode 100644 tcl7.3/tclCmdAH.c create mode 100644 tcl7.3/tclCmdIL.c create mode 100644 tcl7.3/tclCmdMZ.c create mode 100644 tcl7.3/tclEnv.c create mode 100644 tcl7.3/tclExpr.c create mode 100644 tcl7.3/tclGet.c create mode 100644 tcl7.3/tclGlob.c create mode 100644 tcl7.3/tclHash.c create mode 100644 tcl7.3/tclHistory.c create mode 100644 tcl7.3/tclInt.h create mode 100644 tcl7.3/tclLink.c create mode 100644 tcl7.3/tclMain.c create mode 100644 tcl7.3/tclMtherr.c create mode 100644 tcl7.3/tclParse.c create mode 100644 tcl7.3/tclProc.c create mode 100644 tcl7.3/tclRegexp.h create mode 100644 tcl7.3/tclTest.c create mode 100644 tcl7.3/tclUnix.h create mode 100644 tcl7.3/tclUnixAZ.c create mode 100644 tcl7.3/tclUnixStr.c create mode 100644 tcl7.3/tclUnixUtil.c create mode 100644 tcl7.3/tclUtil.c create mode 100644 tcl7.3/tclVar.c create mode 100644 tcl7.3/tests/README create mode 100644 tcl7.3/tests/all create mode 100644 tcl7.3/tests/append.test create mode 100644 tcl7.3/tests/async.test create mode 100644 tcl7.3/tests/case.test create mode 100644 tcl7.3/tests/cd.test create mode 100644 tcl7.3/tests/cmdinfo.test create mode 100644 tcl7.3/tests/concat.test create mode 100644 tcl7.3/tests/dcall.test create mode 100644 tcl7.3/tests/defs create mode 100644 tcl7.3/tests/dstring.test create mode 100644 tcl7.3/tests/env.test create mode 100644 tcl7.3/tests/error.test create mode 100644 tcl7.3/tests/eval.test create mode 100644 tcl7.3/tests/exec.test create mode 100644 tcl7.3/tests/expr.test create mode 100644 tcl7.3/tests/file.test create mode 100644 tcl7.3/tests/for.test create mode 100644 tcl7.3/tests/format.test create mode 100644 tcl7.3/tests/glob.test create mode 100644 tcl7.3/tests/history.test create mode 100644 tcl7.3/tests/if.test create mode 100644 tcl7.3/tests/incr.test create mode 100644 tcl7.3/tests/info.test create mode 100644 tcl7.3/tests/join.test create mode 100644 tcl7.3/tests/lindex.test create mode 100644 tcl7.3/tests/link.test create mode 100644 tcl7.3/tests/linsert.test create mode 100644 tcl7.3/tests/list.test create mode 100644 tcl7.3/tests/llength.test create mode 100644 tcl7.3/tests/lrange.test create mode 100644 tcl7.3/tests/lreplace.test create mode 100644 tcl7.3/tests/lsearch.test create mode 100644 tcl7.3/tests/lsort.test create mode 100644 tcl7.3/tests/misc.test create mode 100644 tcl7.3/tests/open.test create mode 100644 tcl7.3/tests/parse.test create mode 100644 tcl7.3/tests/pid.test create mode 100644 tcl7.3/tests/proc.test create mode 100644 tcl7.3/tests/regexp.test create mode 100644 tcl7.3/tests/rename.test create mode 100644 tcl7.3/tests/scan.test create mode 100644 tcl7.3/tests/set.test create mode 100644 tcl7.3/tests/source.test create mode 100644 tcl7.3/tests/split.test create mode 100644 tcl7.3/tests/string.test create mode 100644 tcl7.3/tests/switch.test create mode 100644 tcl7.3/tests/trace.test create mode 100644 tcl7.3/tests/unknown.test create mode 100644 tcl7.3/tests/uplevel.test create mode 100644 tcl7.3/tests/upvar.test create mode 100644 tcl7.3/tests/while.test create mode 100755 tk3.6/Makefile.in create mode 100644 tk3.6/README create mode 100644 tk3.6/ToDo create mode 100644 tk3.6/bitmaps/RCS/error,v create mode 100644 tk3.6/bitmaps/RCS/gray25,v create mode 100644 tk3.6/bitmaps/RCS/gray50,v create mode 100644 tk3.6/bitmaps/RCS/hourglass,v create mode 100644 tk3.6/bitmaps/RCS/info,v create mode 100644 tk3.6/bitmaps/RCS/questhead,v create mode 100644 tk3.6/bitmaps/RCS/question,v create mode 100644 tk3.6/bitmaps/RCS/warning,v create mode 100644 tk3.6/bitmaps/error create mode 100644 tk3.6/bitmaps/gray25 create mode 100644 tk3.6/bitmaps/gray50 create mode 100644 tk3.6/bitmaps/hourglass create mode 100644 tk3.6/bitmaps/info create mode 100644 tk3.6/bitmaps/questhead create mode 100644 tk3.6/bitmaps/question create mode 100644 tk3.6/bitmaps/warning create mode 100644 tk3.6/changes create mode 100755 tk3.6/configure create mode 100755 tk3.6/configure.in create mode 100755 tk3.6/configure.info create mode 100644 tk3.6/default.h create mode 100644 tk3.6/doc/3DBorder.3 create mode 100644 tk3.6/doc/BackgdErr.3 create mode 100644 tk3.6/doc/ClrSelect.3 create mode 100644 tk3.6/doc/ConfigWidg.3 create mode 100644 tk3.6/doc/ConfigWind.3 create mode 100644 tk3.6/doc/CoordToWin.3 create mode 100644 tk3.6/doc/CrtErrHdlr.3 create mode 100644 tk3.6/doc/CrtGenHdlr.3 create mode 100644 tk3.6/doc/CrtMainWin.3 create mode 100644 tk3.6/doc/CrtSelHdlr.3 create mode 100644 tk3.6/doc/DoOneEvent.3 create mode 100644 tk3.6/doc/DoWhenIdle.3 create mode 100644 tk3.6/doc/EventHndlr.3 create mode 100644 tk3.6/doc/FileHndlr.3 create mode 100644 tk3.6/doc/GeomReq.3 create mode 100644 tk3.6/doc/GetAnchor.3 create mode 100644 tk3.6/doc/GetBitmap.3 create mode 100644 tk3.6/doc/GetCapStyl.3 create mode 100644 tk3.6/doc/GetColor.3 create mode 100644 tk3.6/doc/GetCursor.3 create mode 100644 tk3.6/doc/GetFontStr.3 create mode 100644 tk3.6/doc/GetGC.3 create mode 100644 tk3.6/doc/GetJoinStl.3 create mode 100644 tk3.6/doc/GetJustify.3 create mode 100644 tk3.6/doc/GetOption.3 create mode 100644 tk3.6/doc/GetPixels.3 create mode 100644 tk3.6/doc/GetRelief.3 create mode 100644 tk3.6/doc/GetRootCrd.3 create mode 100644 tk3.6/doc/GetSelect.3 create mode 100644 tk3.6/doc/GetUid.3 create mode 100644 tk3.6/doc/GetVRoot.3 create mode 100644 tk3.6/doc/InternAtom.3 create mode 100644 tk3.6/doc/MainWin.3 create mode 100644 tk3.6/doc/ManageGeom.3 create mode 100644 tk3.6/doc/MapWindow.3 create mode 100644 tk3.6/doc/MoveToplev.3 create mode 100644 tk3.6/doc/Name.3 create mode 100644 tk3.6/doc/OwnSelect.3 create mode 100644 tk3.6/doc/ParseArgv.3 create mode 100644 tk3.6/doc/Preserve.3 create mode 100644 tk3.6/doc/RegInterp.3 create mode 100644 tk3.6/doc/Restack.3 create mode 100644 tk3.6/doc/RestrictEv.3 create mode 100644 tk3.6/doc/SetCModel.3 create mode 100644 tk3.6/doc/SetClass.3 create mode 100644 tk3.6/doc/SetGrid.3 create mode 100644 tk3.6/doc/SetVisual.3 create mode 100644 tk3.6/doc/Sleep.3 create mode 100644 tk3.6/doc/TimerHndlr.3 create mode 100644 tk3.6/doc/WindowId.3 create mode 100644 tk3.6/doc/after.n create mode 100644 tk3.6/doc/bind.n create mode 100644 tk3.6/doc/button.n create mode 100644 tk3.6/doc/canvas.n create mode 100644 tk3.6/doc/checkbutton.n create mode 100644 tk3.6/doc/destroy.n create mode 100644 tk3.6/doc/dialog.n create mode 100644 tk3.6/doc/entry.n create mode 100644 tk3.6/doc/exit.n create mode 100644 tk3.6/doc/focus.n create mode 100644 tk3.6/doc/frame.n create mode 100644 tk3.6/doc/grab.n create mode 100644 tk3.6/doc/label.n create mode 100644 tk3.6/doc/lbSingSel.n create mode 100644 tk3.6/doc/listbox.n create mode 100644 tk3.6/doc/lower.n create mode 100644 tk3.6/doc/man.macros create mode 100644 tk3.6/doc/menu.n create mode 100644 tk3.6/doc/menubar.n create mode 100644 tk3.6/doc/menubutton.n create mode 100644 tk3.6/doc/message.n create mode 100644 tk3.6/doc/option.n create mode 100644 tk3.6/doc/options.n create mode 100644 tk3.6/doc/pack-old.n create mode 100644 tk3.6/doc/pack.n create mode 100644 tk3.6/doc/place.n create mode 100644 tk3.6/doc/radiobutton.n create mode 100644 tk3.6/doc/raise.n create mode 100644 tk3.6/doc/scale.n create mode 100644 tk3.6/doc/scrollbar.n create mode 100644 tk3.6/doc/selection.n create mode 100644 tk3.6/doc/send.n create mode 100644 tk3.6/doc/text.n create mode 100644 tk3.6/doc/tk.n create mode 100644 tk3.6/doc/tkerror.n create mode 100644 tk3.6/doc/tkvars.n create mode 100644 tk3.6/doc/tkwait.n create mode 100644 tk3.6/doc/toplevel.n create mode 100644 tk3.6/doc/update.n create mode 100644 tk3.6/doc/winfo.n create mode 100644 tk3.6/doc/wish.1 create mode 100644 tk3.6/doc/wm.n create mode 100644 tk3.6/ks_names.h create mode 100644 tk3.6/library/button.tcl create mode 100644 tk3.6/library/demos/README create mode 100644 tk3.6/library/demos/bitmaps/face create mode 100644 tk3.6/library/demos/bitmaps/flagdown create mode 100644 tk3.6/library/demos/bitmaps/flagup create mode 100644 tk3.6/library/demos/bitmaps/grey.25 create mode 100644 tk3.6/library/demos/bitmaps/grey.5 create mode 100644 tk3.6/library/demos/bitmaps/letters create mode 100644 tk3.6/library/demos/bitmaps/noletters create mode 100644 tk3.6/library/demos/bitmaps/pattern create mode 100644 tk3.6/library/demos/browse create mode 100644 tk3.6/library/demos/color create mode 100644 tk3.6/library/demos/dialog create mode 100644 tk3.6/library/demos/hello create mode 100644 tk3.6/library/demos/ixset create mode 100644 tk3.6/library/demos/mkArrow.tcl create mode 100644 tk3.6/library/demos/mkBasic.tcl create mode 100644 tk3.6/library/demos/mkBitmaps.tcl create mode 100644 tk3.6/library/demos/mkButton.tcl create mode 100644 tk3.6/library/demos/mkCanvText.tcl create mode 100644 tk3.6/library/demos/mkCheck.tcl create mode 100644 tk3.6/library/demos/mkDialog.tcl create mode 100644 tk3.6/library/demos/mkEntry.tcl create mode 100644 tk3.6/library/demos/mkEntry2.tcl create mode 100644 tk3.6/library/demos/mkFloor.tcl create mode 100644 tk3.6/library/demos/mkForm.tcl create mode 100644 tk3.6/library/demos/mkHScale.tcl create mode 100644 tk3.6/library/demos/mkIcon.tcl create mode 100644 tk3.6/library/demos/mkItems.tcl create mode 100644 tk3.6/library/demos/mkLabel.tcl create mode 100644 tk3.6/library/demos/mkListbox.tcl create mode 100644 tk3.6/library/demos/mkListbox2.tcl create mode 100644 tk3.6/library/demos/mkListbox3.tcl create mode 100644 tk3.6/library/demos/mkPlot.tcl create mode 100644 tk3.6/library/demos/mkPuzzle.tcl create mode 100644 tk3.6/library/demos/mkRadio.tcl create mode 100644 tk3.6/library/demos/mkRuler.tcl create mode 100644 tk3.6/library/demos/mkScroll.tcl create mode 100644 tk3.6/library/demos/mkSearch.tcl create mode 100644 tk3.6/library/demos/mkStyles.tcl create mode 100644 tk3.6/library/demos/mkTear.tcl create mode 100644 tk3.6/library/demos/mkTextBind.tcl create mode 100644 tk3.6/library/demos/mkVScale.tcl create mode 100644 tk3.6/library/demos/rmt create mode 100644 tk3.6/library/demos/rolodex create mode 100644 tk3.6/library/demos/showVars.tcl create mode 100644 tk3.6/library/demos/size create mode 100644 tk3.6/library/demos/square create mode 100644 tk3.6/library/demos/tclIndex create mode 100644 tk3.6/library/demos/tcolor create mode 100644 tk3.6/library/demos/timer create mode 100644 tk3.6/library/demos/tkSquare.c create mode 100644 tk3.6/library/demos/widget create mode 100644 tk3.6/library/dialog.tcl create mode 100644 tk3.6/library/entry.tcl create mode 100644 tk3.6/library/listbox.tcl create mode 100644 tk3.6/library/menu.tcl create mode 100644 tk3.6/library/prolog.ps create mode 100644 tk3.6/library/tclIndex create mode 100644 tk3.6/library/text.tcl create mode 100644 tk3.6/library/tk.tcl create mode 100644 tk3.6/library/tkerror.tcl create mode 100644 tk3.6/patchlevel.h create mode 100644 tk3.6/porting.notes create mode 100644 tk3.6/tests/README create mode 100644 tk3.6/tests/all create mode 100644 tk3.6/tests/btree.test create mode 100644 tk3.6/tests/defs create mode 100644 tk3.6/tests/listbox.test create mode 100644 tk3.6/tests/oldpack.test create mode 100644 tk3.6/tests/option.file1 create mode 100644 tk3.6/tests/option.file2 create mode 100644 tk3.6/tests/option.test create mode 100644 tk3.6/tests/pack.test create mode 100644 tk3.6/tests/raise.test create mode 100644 tk3.6/tests/select.test create mode 100644 tk3.6/tests/text.test create mode 100644 tk3.6/tests/wm.test create mode 100644 tk3.6/tk.h create mode 100644 tk3.6/tk3.6p1.patch create mode 100644 tk3.6/tk3d.c create mode 100644 tk3.6/tkAppInit.c create mode 100644 tk3.6/tkArgv.c create mode 100644 tk3.6/tkAtom.c create mode 100644 tk3.6/tkBind.c create mode 100644 tk3.6/tkBitmap.c create mode 100644 tk3.6/tkButton.c create mode 100644 tk3.6/tkCanvArc.c create mode 100644 tk3.6/tkCanvBmap.c create mode 100644 tk3.6/tkCanvLine.c create mode 100644 tk3.6/tkCanvPoly.c create mode 100644 tk3.6/tkCanvPs.c create mode 100644 tk3.6/tkCanvText.c create mode 100644 tk3.6/tkCanvWind.c create mode 100644 tk3.6/tkCanvas.c create mode 100644 tk3.6/tkCanvas.h create mode 100644 tk3.6/tkCmds.c create mode 100644 tk3.6/tkColor.c create mode 100644 tk3.6/tkConfig.c create mode 100644 tk3.6/tkConfig.h create mode 100644 tk3.6/tkCursor.c create mode 100644 tk3.6/tkEntry.c create mode 100644 tk3.6/tkError.c create mode 100644 tk3.6/tkEvent.c create mode 100644 tk3.6/tkFocus.c create mode 100644 tk3.6/tkFont.c create mode 100644 tk3.6/tkFrame.c create mode 100644 tk3.6/tkGC.c create mode 100644 tk3.6/tkGeometry.c create mode 100644 tk3.6/tkGet.c create mode 100644 tk3.6/tkGrab.c create mode 100644 tk3.6/tkInt.h create mode 100644 tk3.6/tkListbox.c create mode 100644 tk3.6/tkMain.c create mode 100644 tk3.6/tkMenu.c create mode 100644 tk3.6/tkMenubutton.c create mode 100644 tk3.6/tkMessage.c create mode 100644 tk3.6/tkOption.c create mode 100644 tk3.6/tkPack.c create mode 100644 tk3.6/tkPlace.c create mode 100644 tk3.6/tkPreserve.c create mode 100644 tk3.6/tkRectOval.c create mode 100644 tk3.6/tkScale.c create mode 100644 tk3.6/tkScrollbar.c create mode 100644 tk3.6/tkSelect.c create mode 100644 tk3.6/tkSend.c create mode 100644 tk3.6/tkTest.c create mode 100644 tk3.6/tkText.c create mode 100644 tk3.6/tkText.h create mode 100644 tk3.6/tkTextBTree.c create mode 100644 tk3.6/tkTextDisp.c create mode 100644 tk3.6/tkTextIndex.c create mode 100644 tk3.6/tkTextTag.c create mode 100644 tk3.6/tkTrig.c create mode 100644 tk3.6/tkWindow.c create mode 100644 tk3.6/tkWm.c diff --git a/archie/.gitignore b/archie/.gitignore new file mode 100644 index 0000000..f3c7a7c --- /dev/null +++ b/archie/.gitignore @@ -0,0 +1 @@ +Makefile diff --git a/archie/Makefile.in b/archie/Makefile.in new file mode 100755 index 0000000..353cded --- /dev/null +++ b/archie/Makefile.in @@ -0,0 +1,89 @@ +# +# The makefile you're looking at contains rules that operate on the +# tree as a whole. Therefore, it doesn't need to be included in any +# other make files. +# + +help: + @echo "" + @echo "Possible targets are: all all_clean all_depend all_newsys all_dist" + @echo "" + +include $(ARCHIE_ROOT)/Makefile.pre + +# Distribution directory +DISTDIR = $(DISTDIR) + +# Redefine CC so make depend will work at this level, too. +CC = : + +# Toast VPATH to avoid confusing `make dist' under GNU make. +VPATH = + +# +# Recursively build each Archie module. +# +all: + for dir in $(SING_LEVEL_MODULES) ; do \ + (cd $$dir/$(SYSTYPE) && $(MAKE) ) ; \ + done + for dir in $(MULTI_LEVEL_MODULES) ; do \ + (cd $$dir && $(MAKE) ) ; \ + done + +# +# Recursively clean each Archie module. +# +all_clean: + for dir in $(SING_LEVEL_MODULES) ; do \ + (cd $$dir/$(SYSTYPE) && $(MAKE) clean) ; \ + done + for dir in $(MULTI_LEVEL_MODULES) ; do \ + (cd $$dir && $(MAKE) clean) ; \ + done + for dir in $(GEN_MODULES) ; do \ + (cd $$dir && $(MAKE) clean) ; \ + done + +# +# Recursively `depend' each module. +# +all_depend: + set -u ; find $(ARCHIE_ROOT) -name Makefile.in -print | sed 's/\(.*\)\.in/cp \1.in \1/' | sh + for dir in $(SING_LEVEL_MODULES) ; do \ + (cd $$dir/$(SYSTYPE) && $(MAKE) depend) ; \ + done + for dir in $(MULTI_LEVEL_MODULES) ; do \ + (cd $$dir && $(MAKE) depend) ; \ + done + for dir in $(GEN_MODULES) ; do \ + (cd $$dir && $(MAKE) depend) ; \ + done + + +all_newsys: + for dir in $(SING_LEVEL_MODULES) ; do \ + (cd $$dir && $(MAKE) -f $(ARCHIE_ROOT)/Makefile.in newsys) ; \ + done + for dir in $(MULTI_LEVEL_MODULES) ; do \ + (cd $$dir && $(MAKE) -f Makefile.in indirect_newsys) ; \ + done + + + +# +# Recursively create distribution for each module. +# +all_dist: + for dir in $(BIN_SING_LEVEL_MODULES) ; do \ + (cd $$dir/$(SYSTYPE) && $(MAKE) dist) ; \ + done + for dir in $(MULTI_LEVEL_MODULES) ; do \ + (cd $$dir && $(MAKE) all_dist) ; \ + done + + + +include $(ARCHIE_ROOT)/Makefile.post + +# DO NOT DELETE THIS LINE -- make depend depends on it diff --git a/archie/Makefile.multi b/archie/Makefile.multi new file mode 100755 index 0000000..9368303 --- /dev/null +++ b/archie/Makefile.multi @@ -0,0 +1,48 @@ +# +# This makefile is included by the makefiles in the directories +# listed in MULTI_LEVEL_MODULES. +# + +# +# Recursively do all the directories. The variable DIRS must +# contain the list of subdirectories in which we must do further +# work. +# + +all: + for dir in $(DIRS) ; do \ + (cd $$dir/$(SYSTYPE) && $(MAKE)) ; \ + done + +# +# Recursively clean each directory module. +# + +all_clean clean: + for dir in $(DIRS) ; do \ + (cd $$dir/$(SYSTYPE) && $(MAKE) -f Makefile.in clean) ; \ + done + +# +# Recursively `depend' each directory module. +# + +all_depend depend: + for dir in $(DIRS) ; do \ + (cd $$dir/$(SYSTYPE) && $(MAKE) -f Makefile.in depend) ; \ + done + + +all_dist: + for dir in $(BIN_DIRS) ; do \ + (cd $$dir/$(SYSTYPE) && $(MAKE) dist) ; \ + done + + +indirect_newsys: + for dir in $(DIRS) ; do \ + (cd $$dir; mkdir $(SYSTYPE); \ + cp $(ARCHIE_ROOT)/tmpl/Makefile.$(SYSTYPE) $(SYSTYPE)/Makefile.in) ; \ + done + +# DO NOT DELETE THIS LINE -- make depend depends on it diff --git a/archie/Makefile.post b/archie/Makefile.post new file mode 100755 index 0000000..67df9c4 --- /dev/null +++ b/archie/Makefile.post @@ -0,0 +1,61 @@ +# +# Top level Makefile.post. +# + +FORCE: + +# +# Supply a list of rules for libraries, so we don't have to +# put them in each Makefile.post. +# +$(ANONFTP_MODULE)/lib/$(SYSTYPE)/libanonftp.a: FORCE + cd $(ANONFTP_MODULE)/lib/$(SYSTYPE) && $(MAKE) libanonftp.a +$(ARCHSEARCH_MODULE)/$(SYSTYPE)/libarchsearch.a: FORCE + cd $(ARCHSEARCH_MODULE)/$(SYSTYPE) && $(MAKE) libarchsearch.a +$(EXCHANGE_MODULE)/$(SYSTYPE)/libexchange.a: FORCE + cd $(EXCHANGE_MODULE)/$(SYSTYPE) && $(MAKE) libexchange.a +$(HOSTDB_MODULE)/$(SYSTYPE)/libhostdb.a: FORCE + cd $(HOSTDB_MODULE)/$(SYSTYPE) && $(MAKE) libhostdb.a +$(LIBARCHIE_MODULE)/$(SYSTYPE)/libarchie.a: FORCE + cd $(LIBARCHIE_MODULE)/$(SYSTYPE) && $(MAKE) libarchie.a +$(LIBPARCHIE_MODULE)/$(SYSTYPE)/libparchie.a: FORCE + cd $(LIBPARCHIE_MODULE)/$(SYSTYPE) && $(MAKE) libparchie.a +$(LIBPSARCHIE_MODULE)/$(SYSTYPE)/libpsarchie.a: FORCE + cd $(LIBPSARCHIE_MODULE)/$(SYSTYPE) && $(MAKE) libpsarchie.a +$(PATRIE_MODULE)/$(SYSTYPE)/libpatrie.a: FORCE + cd $(PATRIE_MODULE)/$(SYSTYPE) && $(MAKE) libpatrie.a +$(REGEX_MODULE)/$(SYSTYPE)/libregex.a: FORCE + cd $(REGEX_MODULE)/$(SYSTYPE) && $(MAKE) libregex.a +$(REPOSIX_MODULE)/$(SYSTYPE)/libregex.a: FORCE + cd $(REPOSIX_MODULE)/$(SYSTYPE) && $(MAKE) libregex.a +$(STARTDB_MODULE)/$(SYSTYPE)/libstartdb.a: FORCE + cd $(STARTDB_MODULE)/$(SYSTYPE) && $(MAKE) libstartdb.a +$(STRIDX_MODULE)/$(SYSTYPE)/libarchstridx.a: FORCE + cd $(STRIDX_MODULE)/$(SYSTYPE) && $(MAKE) libarchstridx.a +$(WEBINDEX_MODULE)/lib/$(SYSTYPE)/libwebindex.a: FORCE + cd $(WEBINDEX_MODULE)/lib/$(SYSTYPE) && $(MAKE) libwebindex.a + +depend: + @echo Depending in `pwd` + @( echo '/^# DO NOT DELETE THIS LINE/,$$c' ; \ + echo '# DO NOT DELETE THIS LINE -- make depend depends on it' ; \ + echo "" ; \ + (cd .. ; $(CC) $(SYS_DEPFLAG) $(DEP_FLAGS) $(SRCS)) ; \ + echo . ; \ + echo w ; \ + echo q ) | ed -s Makefile + +newsys: + mkdir $(SYSTYPE) ;\ + cp $(ARCHIE_ROOT)/tmpl/Makefile.$(SYSTYPE) $(SYSTYPE)/Makefile.in + + +dist: + for file in $(EXES) ; do \ + if [ -f $(DISTRIBUTION_MODULE)/$(SYSTYPE)/$$file ] ; then \ + find $$file -newer $(DISTRIBUTION_MODULE)/$(SYSTYPE)/$$file -exec cp $$file $(DISTRIBUTION_MODULE)/$(SYSTYPE)/$$file \; ; \ + else \ + cp $$file $(DISTRIBUTION_MODULE)/$(SYSTYPE) ; \ + fi \ + done + diff --git a/archie/Makefile.pre b/archie/Makefile.pre new file mode 100755 index 0000000..fc0aa09 --- /dev/null +++ b/archie/Makefile.pre @@ -0,0 +1,161 @@ +# +# Top level Makefile.pre. +# + +# +# ARCHIE_ROOT is an environment variable pointing to root of the +# tree containing binaries and libraries for all platforms. +# + +ANONFTP_MODULE = $(ARCHIE_ROOT)/anonftp +ARCHSEARCH_MODULE = $(ARCHIE_ROOT)/lib/archsearch +CLIENT_MODULE = $(ARCHIE_ROOT)/clients +CONTROL_MODULE = $(ARCHIE_ROOT)/control +DOC_MODULE = $(ARCHIE_ROOT)/doc +EXCHANGE_MODULE = $(ARCHIE_ROOT)/exchange +HOSTDB_MODULE = $(ARCHIE_ROOT)/lib/hostdb +INCLUDE_MODULE = $(ARCHIE_ROOT)/include +LESS_MODULE = $(ARCHIE_ROOT)/less +LIBARCHIE_MODULE = $(ARCHIE_ROOT)/lib/libarchie +LIBPARCHIE_MODULE = $(ARCHIE_ROOT)/lib/libparchie +LIBPSARCHIE_MODULE = $(ARCHIE_ROOT)/lib/libpsarchie +PATRIE_MODULE = $(ARCHIE_ROOT)/lib/patrie +PPC_MODULE = $(ARCHIE_ROOT)/ppc +REGEX_MODULE = $(ARCHIE_ROOT)/lib/regex +REPOSIX_MODULE = $(ARCHIE_ROOT)/lib/reposix +STARTDB_MODULE = $(ARCHIE_ROOT)/lib/startdb +STRIDX_MODULE = $(ARCHIE_ROOT)/lib/archstridx +TOOLS_MODULE = $(ARCHIE_ROOT)/tools +WEBINDEX_MODULE = $(ARCHIE_ROOT)/webindex + +DOC_MODULE = $(ARCHIE_ROOT)/doc + +DISTRIBUTION_MODULE = $(ARCHIE_ROOT)/dist + + +BIN_SING_LEVEL_MODULES = \ + $(LESS_MODULE) \ + $(CONTROL_MODULE) \ + $(EXCHANGE_MODULE) \ + $(TOOLS_MODULE) + +BIN_MULTI_LEVEL_MODULES = \ + $(CLIENT_MODULE) \ + $(PPC_MODULE) + +LIB_SING_LEVEL_MODULES = \ + $(ARCHSEARCH_MODULE) \ + $(HOSTDB_MODULE) \ + $(LIBARCHIE_MODULE) \ + $(LIBPARCHIE_MODULE) \ + $(LIBPSARCHIE_MODULE) \ + $(PATRIE_MODULE) \ + $(REGEX_MODULE) \ + $(REPOSIX_MODULE) \ + $(STARTDB_MODULE) \ + $(STRIDX_MODULE) + +LIB_MULTI_LEVEL_MODULES = \ + $(ANONFTP_MODULE) \ + $(WEBINDEX_MODULE) + +# +# The modules are grouped into three classes, single level, multi-level and +# generic. Single level modules are directories, containing source code that +# compiles to object files, immediately below the top level. Multi-level +# modules are similar, but they are subdirectories of directories at the top +# level. Generic modules are directories containing files that don't produce +# object files. +# + +SING_LEVEL_MODULES = \ + $(LIB_SING_LEVEL_MODULES) \ + $(BIN_SING_LEVEL_MODULES) + +MULTI_LEVEL_MODULES = \ + $(LIB_MULTI_LEVEL_MODULES) \ + $(BIN_MULTI_LEVEL_MODULES) + +# +# GEN_MODULES is the list of modules that are system independent. +# + +GEN_MODULES = \ + $(DOC_MODULE) \ + $(INCLUDE_MODULE) + + +# +# The following variables may be used to define options common +# to a particular module. They should be used within the make +# files in the various module directories. +# +# MOD_CFLAGS -- Compiler options for a particular module. +# MOD_DEBUG -- Debugging options for a particular module. +# MOD_DEFS -- Defines for a particular module. +# MOD_INCS -- Include files depending on the particular module. +# MOD_LIBS -- Libraries required for the particular module. +# MOD_OPT -- Optimization options for a particular module. +# MOD_WARN -- Warning options for a particular module. +# +# +# The following variables may be used to define options particular +# to a specific system (machine or architecture). They should be +# used within the make files in the various system directories. +# +# SYS_CFLAGS -- Compiler options for a particular system. +# SYS_DEBUG -- Debugging options for a particular system. +# SYS_DEFS -- Defines for a particular system. +# SYS_DEPFLAG -- Compiler options used to generate dependencies. +# SYS_INCS -- Include files depending on the particular system. +# SYS_LIBS -- Libraries required for the particular system. +# SYS_OPT -- Optimization options for a particular system. +# SYS_WARN -- Warning options for a particular system. +# + +CC = gcc +# +# Note that MOD_LIBS and SYS_LIBS aren't included in the CFLAGS +# macro. Since they must appear after the .o files these two +# flags must be included in the build commands of the module +# Makefile.post file. +# +CFLAGS = $(MOD_CFLAGS) $(SYS_CFLAGS) \ + $(MOD_DEBUG) $(SYS_DEBUG) \ + $(MOD_WARN) $(SYS_WARN) \ + $(MOD_OPT) $(SYS_OPT) \ + $(MOD_DEFS) $(SYS_DEFS) \ + $(MOD_INCS) $(SYS_INCS) +# +# A special case: the flag to cause the compiler to generate +# include file dependencies. This may vary from system to +# system. Override this from within the system level make +# file. +# +SYS_DEPFLAG = -M +# +# Pass these flags to the compiler when generating +# dependencies. This macro is just for convenience. +# +DEP_FLAGS = $(MOD_CFLAGS) $(SYS_CFLAGS) \ + $(MOD_DEFS) $(SYS_DEFS) \ + $(MOD_INCS) $(SYS_INCS) + +# +# Auxilliary programs. +# +AR = gar +LD = ld +RANLIB = granlib +SENTINEL = memadvise + +# +# VPATH gives make [%] a set of directories to search for the +# dependencies of the targets. In the case of .o files this +# would tell it where to look for the corresponding source files. +# +# [%] Well, any make that understands it (e.g. GNU make). Not +# all do... +# +VPATH = .. + diff --git a/archie/access/ar_search.c b/archie/access/ar_search.c new file mode 100644 index 0000000..a360451 --- /dev/null +++ b/archie/access/ar_search.c @@ -0,0 +1,943 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "typedef.h" +#include "strings_index.h" +#ifdef OLD_FILES +# include "old-site_file.h" +# include "old-host_db.h" +#else +# include "site_file.h" +# include "host_db.h" +#endif +#include "plog.h" +#include "ar_search.h" +#include "db_ops.h" +#include "error.h" +#include "files.h" +#include "archie_strings.h" +#include "archie_dbm.h" +#include "times.h" + + +static struct match_cache *mcache = NULL; +static int cachecount = 0; +extern char hostname[]; +extern char hostwport[]; + + +#ifdef eric +char trash[10000]; + +#endif /* eric */ + +int search_files_db(strings, strings_idx, strings_hash, domaindb, hostdb, hostaux_db, hostbyaddr, search_req, vdir) + file_info_t *strings; + file_info_t *strings_idx; + file_info_t *strings_hash; + file_info_t *domaindb; + file_info_t *hostdb; + file_info_t *hostaux_db; + file_info_t *hostbyaddr; + search_req_t *search_req; + VDIR vdir; +{ + VLINK curr_link; + char **path_name=NULL; + char **restricts=NULL; + char *chostname = (char*) NULL; + hostname_t primary_hostname; + char fullpath[MAX_PATH_LEN]; + char tmp_str[MAX_PATH_LEN]; + char **tmp_ptr=NULL; + char *tmp_ptr2=NULL; + + domain_t domain_list[MAX_NO_DOMAINS]; + file_info_t *site_file = create_finfo(); + full_site_entry_t *site_ptr=NULL; + hostdb_aux_t hostaux_rec; + hostdb_t hostdb_rec; + index_t *index_list=NULL; + int count; + int domain_count; + int linkcount; + int this_host = 1; + int total; + int slen; + ip_addr_t old_addr = 0; + ip_addr_t new_addr; + site_entry_ptr_t site_entry; + strings_idx_t *s_index=NULL; + + + + + /* TESTING */ + + search_req -> max_uniq_hits = search_req -> max_filename_hits; + + search_req -> curr_type = search_req -> orig_type; + + + if(search_req -> search_str[0] == '\0') + return(PRARCH_SUCCESS); + + if(vdir->links) { + plog(L_DIR_ERR, NULL, NULL, "search_files_db handed non empty dir",0); + return(PRARCH_BAD_ARG); + } + + + if((search_req -> orig_type == S_FULL_REGEX) + || (search_req -> orig_type == S_E_FULL_REGEX) + || (search_req -> orig_type == S_X_REGEX) + || (search_req -> orig_type == S_E_X_REGEX)){ + + /* Regular expression search begins with ".*", strip it*/ + + if((slen = strlen(search_req -> search_str)) >= 2){ + + if(strncmp(search_req -> search_str, ".*", 2) == 0){ + search_string_t tmp_srch; + + strcpy(tmp_srch, search_req -> search_str + 2); + strcpy(search_req -> search_str, tmp_srch); + + if(search_req -> search_str[0] == '\0') + return(PRARCH_SUCCESS); + + } + + /* Regular expression search ends with ".*", strip it*/ + + if(strcmp(search_req -> search_str + slen - 2, ".*") == 0){ + search_string_t tmp_srch; + + strncpy(tmp_srch, search_req -> search_str, slen - 2); + tmp_srch[slen - 2] = '\0'; + strcpy(search_req -> search_str, tmp_srch); + + if(search_req -> search_str[0] == '\0') + return(PRARCH_SUCCESS); + } + } + + } + + /* See if we can use a less expensive search method */ + + + if((search_req -> orig_type == S_FULL_REGEX) && (strpbrk(search_req -> search_str,"\\^$.,[]<>*+?|(){}/") == NULL)) { + search_req -> curr_type = S_SUB_CASE_STR; + } + else { + if((search_req -> orig_type == S_E_FULL_REGEX) && (strpbrk(search_req -> search_str,"\\^$.,[]<>*+?|(){}/") == NULL)) { + search_req -> curr_type = S_E_SUB_CASE_STR; + } + + } + + if((search_req -> orig_type == S_X_REGEX) && (strpbrk(search_req -> search_str,"\\^$.,[]<>*+?|(){}/") == NULL)) { + search_req -> curr_type = S_SUB_KASE; + } + else if((search_req -> orig_type == S_E_X_REGEX) && (search_req -> orig_type == S_E_X_REGEX)) { + search_req -> curr_type = S_E_SUB_KASE; + } + + + if(check_cache(search_req,&(vdir->links)) == TRUE) { + plog(L_DB_INFO, NULL, NULL, "Responding with cached data",0); + return(PSUCCESS); + } + + SET_ARCHIE_DIR(search_req -> attrib_list); + + + /* If they have asked for 0 max_filename_hits, then make it as much + as the server internal defaults will allow */ + + if(search_req -> max_filename_hits == 0) + search_req -> max_filename_hits = DEFAULT_MAX_FILE_HITS; + + + if((index_list = (index_t *) malloc( ((search_req -> max_filename_hits) + 1) * sizeof(index_t))) == (index_t *) NULL) { + return(PRARCH_OUT_OF_MEMORY); + } + + /* If there are pathname component restrictions on the search, then + break them out here */ + + if( search_req -> comp_restrict ) + restricts = str_sep(search_req -> comp_restrict,':'); + + /* Same with the domain list */ + + if( search_req -> domains ){ + + if(compile_domains(search_req -> domains, domain_list, domaindb, &domain_count) == ERROR){ + plog(L_DB_INFO, NULL, NULL, "Loop in domain database detected. Aborting search",0); + return(PRARCH_BAD_DOMAINDB); + } + } + + + if(mmap_file(strings_idx, O_RDONLY) != A_OK) { + plog(L_DB_INFO,NULL,NULL,"Can't mmap strings_idx db??"); + return(PRARCH_BAD_MMAP); + } + + + + switch(search_req -> curr_type) { + + case S_E_FULL_REGEX: + case S_E_SUB_CASE_STR: + case S_E_SUB_NCASE_STR: + case S_EXACT: + case S_E_X_REGEX: + case S_E_ZUB_NCASE: + case S_E_SUB_KASE: + + if(mmap_file(strings, O_RDONLY) != A_OK) { + plog(L_DB_INFO,NULL,NULL,"Can't mmap strings db??"); + return(PRARCH_BAD_MMAP); + } + + if(ar_exact_match( search_req, index_list, strings_hash ) != A_OK) { + + if((search_req -> curr_type == S_E_FULL_REGEX) || + (search_req -> curr_type == S_E_X_REGEX)) + goto s_full_regex; + else + if((search_req -> curr_type == S_E_SUB_CASE_STR) || + (search_req -> curr_type == S_E_SUB_KASE)) + goto s_sub_case_str; + else + if((search_req -> curr_type == S_E_SUB_NCASE_STR) || + (search_req -> curr_type == S_E_ZUB_NCASE)) + goto s_sub_ncase_str; + else + return(PRARCH_SUCCESS); + } + + break; + + s_full_regex: + + case S_X_REGEX: + case S_FULL_REGEX: + + + if(mmap_file(strings, O_RDONLY) != A_OK) { + plog(L_DB_INFO,NULL,NULL,"Can't mmap strings db??"); + return(PRARCH_BAD_MMAP); + } + + if(ar_regex_match( search_req, index_list, strings_idx, strings ) != A_OK) { + return(PRARCH_DB_ERROR); + } + + break; + + s_sub_case_str: + s_sub_ncase_str: + + case S_ZUB_NCASE: + case S_SUB_KASE: + case S_SUB_CASE_STR: + case S_SUB_NCASE_STR: + + if(mmap_file_private(strings, O_RDWR) != A_OK) { + return(PRARCH_BAD_MMAP); + } + + if(ar_sub_match(search_req, index_list, strings_idx, strings) != A_OK){ + return PRARCH_BAD_ARG ; /* BUG: fix later */ + } + + break; + + default: + + break; + } + + + /* Have list of indices which might point to what you want */ + + for(count = 0, total = 0; index_list[count] != -1; count++){ + + s_index = ((strings_idx_t *) strings_idx -> ptr) + index_list[count]; + + if(s_index -> index.site_addr == STRING_NOT_ACTIVE) /* Inactive string */ + continue; + + switch(search_req -> curr_type){ + + case S_E_X_REGEX: + case S_X_REGEX: + case S_E_SUB_KASE: + case S_SUB_KASE: + case S_E_ZUB_NCASE: + case S_ZUB_NCASE: + + curr_link = (VLINK) vlalloc(); + if(curr_link){ + + + curr_link -> name = stcopy(strings -> ptr + s_index -> strings_offset, curr_link -> name); + curr_link -> type = stcopy("DIRECTORY"); + curr_link -> linktype = 'L'; + +#if 0 + if(gethostname(tmp_str, sizeof(tmp_str)) == -1){ + plog(L_DB_INFO, NULL, NULL, "Can't get local hostname"); + return(PRARCH_NO_HOSTNAME); + } + + curr_link -> host = stcopy(tmp_str); +#else + curr_link -> host = stcopy(hostname); +#endif + + sprintf(tmp_str,"ARCHIE/MATCH(%d,0,=)/%s",search_req -> max_uniq_hits, curr_link -> name); + curr_link -> filename = stcopy(tmp_str); + + vl_insert(curr_link, vdir, VLI_NOSORT); + + continue; + } + else{ + plog(L_DB_INFO, NULL, NULL, "Can't allocate link!",0); + return(PRARCH_OUT_OF_MEMORY); + } + + break; + + default: + break; + } + + site_entry = s_index -> index; + + new_addr = site_entry.site_addr; + + for(linkcount = 0; + (site_entry.site_addr != END_OF_CHAIN) && (linkcount != search_req -> max_uniq_hits); + linkcount++){ + + if(old_addr != new_addr) { + + chostname = (char *) NULL; + this_host = 1; + + if(site_file -> ptr != (char *) NULL) { + + munmap_file(site_file); + + close_file(site_file); + + } + + strcpy(site_file -> filename, files_db_filename( inet_ntoa( ipaddr_to_inet(site_entry.site_addr)))); + + if(open_file(site_file, O_RDONLY) != A_OK) { + plog(L_DB_INFO, NULL, NULL, "Can't open site file %s",inet_ntoa( ipaddr_to_inet(site_entry.site_addr)),0); + break; + } + + + if(mmap_file( site_file, O_RDONLY) != A_OK) { + plog(L_DB_INFO, NULL, NULL, "Can't mmap site file %s", inet_ntoa( ipaddr_to_inet(site_entry.site_addr)),0); + break; + } + + memset(&hostdb_rec, '\0', sizeof(hostdb_t)); + memset(&hostaux_rec, '\0', sizeof(hostdb_aux_t)); + + old_addr = new_addr; + + } + + /* + * For S_EXACT An orig_offset which is non zero means skip + * orig_offset links before continuing with processing + */ + + if((search_req -> curr_type == S_EXACT) && (search_req -> orig_offset != 0)) + if(linkcount != search_req -> orig_offset) + goto next_one; + + + if(search_req -> domains){ + if(!this_host) + goto next_one; + else{ + + if(!chostname) + chostname = get_preferred_name(site_entry.site_addr, primary_hostname, hostdb, hostbyaddr); + + if(find_in_domains(chostname, domain_list, domain_count) == 0){ + this_host = 0; + goto next_one; + } + } + } + + site_ptr = (full_site_entry_t *) (site_file -> ptr) + site_entry.recno; + + path_name = dyna_find_ancestors((full_site_entry_t *) site_file -> ptr, site_ptr, strings); + + if(search_req -> comp_restrict) { + + if((path_name[0] == '\0') || (check_comp_restrict(restricts, path_name) != A_OK)){ + free_opts(path_name); + goto next_one; + + } + } + + if(!chostname) + chostname = get_preferred_name(site_entry.site_addr, primary_hostname, hostdb, hostbyaddr); + + /* Now allocate and set up the link */ + + + curr_link = (VLINK) vlalloc(); + + if(!curr_link){ + plog(L_DB_INFO, NULL, NULL, "Can't allocate link"); + return(PRARCH_OUT_OF_MEMORY); + } + + if( CSE_IS_DIR(site_ptr -> core )){ + + /* + * It's a directory - we should check to see if the site is + * running prospero, and if so return a pointer to the actual + * directory. If it isn't then we return a real pointer to a + * pseudo-directory maintained by this archie server. + */ + + curr_link ->type = stcopy("DIRECTORY"); + } + else { + + /* + * It's a file - we should check to see if the site is running + * prospero, and if so return a pointer to the real file. If it + * isn't, then we generate an external link + */ + + curr_link -> type = stcopy("EXTERNAL(AFTP,BINARY)"); + UNSET_ARCHIE_DIR(search_req -> attrib_list); + + } + + if(GET_ARCHIE_DIR(search_req -> attrib_list)) + curr_link -> host = stcopy(hostwport); + else + curr_link -> host = stcopy(chostname); + + /* Get the the last component of name */ + + curr_link -> name = stcopy((strings -> ptr) + (site_ptr -> str_ind)); + + /* Set up the full path name */ + + tmp_str[0] = '\0'; + + for(tmp_ptr = path_name; *tmp_ptr != (char *) NULL; tmp_ptr++); + + for(tmp_ptr2 = tmp_str, --tmp_ptr; tmp_ptr >= path_name; tmp_ptr--){ + sprintf(tmp_ptr2,"/%s", *tmp_ptr); + tmp_ptr2 += strlen(*tmp_ptr) + 1; + } + + /* if(*tmp_ptr != (char *) NULL) + sprintf(tmp_ptr2,"%s", *tmp_ptr); */ + + if(GET_ARCHIE_DIR(search_req -> attrib_list)) { + + if(tmp_str[0] == '\0') + sprintf(fullpath,"ARCHIE/HOST/%s/%s%s", chostname, tmp_str, curr_link -> name); + else + sprintf(fullpath,"ARCHIE/HOST/%s%s/%s", chostname, tmp_str, curr_link -> name); + } + else { + sprintf(fullpath,"%s/%s",tmp_str, curr_link -> name); + } + + curr_link -> filename = stcopy(fullpath); + + /* Subcomponents look like pointers into mmapped stringsdb */ + + if(path_name) + free(path_name); + + if(hostdb_rec.primary_hostname[0] == '\0'){ + + if(get_dbm_entry(primary_hostname, strlen(primary_hostname) + 1, &hostdb_rec, hostdb) == ERROR) + continue; + } + + if(hostaux_rec.access_methods[0] == '\0'){ + + sprintf(tmp_str,"%s.%s", primary_hostname, ANONFTP_DB_NAME); + + if(get_dbm_entry(tmp_str, strlen(tmp_str) + 1, &hostaux_rec, hostaux_db) == ERROR) + continue; + + if(hostaux_rec.current_status != ACTIVE) + continue; + } + + + /* Do each attribute in turn */ + + if(GET_AR_H_IP_ADDR(search_req -> attrib_list)){ + + add_attribute(curr_link,NAME_AR_H_IP_ADDR,"ASCII", inet_ntoa(ipaddr_to_inet(new_addr))); + + } + + if(GET_AR_H_OS_TYPE(search_req -> attrib_list)){ + char *ost; + + switch(hostdb_rec.os_type){ + + + case UNIX_BSD: + ost = OS_TYPE_UNIX_BSD; + break; + + case VMS_STD: + ost = OS_TYPE_VMS_STD; + break; + + default: + ost = "Unknown"; + break; + } + + add_attribute(curr_link, NAME_AR_H_OS_TYPE, "ASCII",ost); + } + + if(GET_AR_H_TIMEZ(search_req -> attrib_list)){ + + sprintf(tmp_str,"%+d", hostdb_rec.timezone); + + add_attribute(curr_link, NAME_AR_H_TIMEZ, "ASCII", tmp_str); + + } + + + if(GET_AUTHORITY(search_req -> attrib_list)){ + + add_attribute(curr_link, NAME_AUTHORITY, "ASCII", hostaux_rec.source_archie_hostname); + } + + if(GET_LK_LAST_MOD(search_req -> attrib_list)){ + + sprintf(tmp_str,"%sZ", cvt_from_inttime(site_ptr -> core.date)); + + add_attribute(curr_link, NAME_LK_LAST_MOD, "ASCII", tmp_str); + } + + if(GET_AR_H_LAST_MOD(search_req -> attrib_list)){ + + sprintf(tmp_str,"%sZ", cvt_from_inttime(hostaux_rec.update_time)); + + add_attribute(curr_link, NAME_AR_H_LAST_MOD, "ASCII", tmp_str); + } + + if(GET_AR_RECNO(search_req -> attrib_list)){ + + sprintf(tmp_str,"%d",hostaux_rec.no_recs); + + add_attribute(curr_link, NAME_AR_RECNO, "ASCII", tmp_str); + } + + if(GET_LINK_COUNT(search_req -> attrib_list)){ + full_site_entry_t *sptr; + int no_children = 0; + + if(CSE_IS_DIR(site_ptr -> core) && (site_ptr -> core.child_idx != -1)){ + + /* no children */ + + no_children++; + + for(sptr = (full_site_entry_t *) site_file -> ptr + site_ptr -> core.child_idx; + ((char *) sptr + sizeof(full_site_entry_t) < site_file -> ptr + site_file -> size) + && (sptr -> core.parent_idx == (sptr + 1) -> core.parent_idx); + sptr++){ + + no_children++; + } + } + + sprintf(tmp_str,"%d", no_children); + + add_attribute(curr_link, NAME_LINK_COUNT, "ASCII", tmp_str); + } + + if(GET_LINK_SIZE(search_req -> attrib_list)){ + + sprintf(tmp_str,"%d", site_ptr -> core.size); + + add_attribute(curr_link, NAME_LINK_SIZE, "ASCII", tmp_str); + } + + if(GET_NATIVE_MODES(search_req -> attrib_list)){ + + sprintf(tmp_str,"%d", site_ptr -> core.perms); + + add_attribute(curr_link, NAME_NATIVE_MODES, "ASCII", tmp_str); + } + + if(GET_LK_UNIX_MODES(search_req -> attrib_list)){ + + sprintf(tmp_str,"%s", unix_perms_itoa(site_ptr -> core.perms, CSE_IS_DIR(site_ptr -> core))); + + add_attribute(curr_link, NAME_LK_UNIX_MODES, "ASCII", tmp_str); + } + + + vl_insert(curr_link, vdir, VLI_NOSORT); + + next_one: + + site_entry = ((full_site_entry_t *) site_file -> ptr + site_entry.recno) -> next; + + new_addr = site_entry.site_addr; + + } + + } /* for */ + + /* Set curr_offset to the number of the last link */ + + if(search_req -> curr_type == S_EXACT) + search_req -> curr_offset = linkcount; + + + add_to_cache(vdir -> links, search_req); + + free(index_list); + + + if(site_file -> ptr != (char *) NULL) { + + munmap_file(site_file); + + close_file(site_file); + } + + if(munmap_file(strings_idx) != A_OK) { + return(PRARCH_BAD_MMAP); + } + + if(munmap_file(strings) != A_OK) { + return(PRARCH_BAD_MMAP); + } + + if(restricts) + free_opts(restricts); + + return(PSUCCESS); +} + + +char **dyna_find_ancestors( site_begin, site_entry, strings) + void *site_begin; + full_site_entry_t *site_entry; + file_info_t *strings; + +{ + char **pathname; + int curr_path_comps; + int max_path_comps = DEF_MAX_PCOMPS; + full_site_entry_t *my_sentry; + + pathname = (char **) malloc(max_path_comps * sizeof(char *)); + + memset(pathname, '\0', max_path_comps * sizeof(char *)); + + if(site_entry -> core.parent_idx == -1){ + pathname[0] = (char *) NULL; + return(pathname); + } + + for(curr_path_comps = 0, my_sentry = (full_site_entry_t *) site_begin + site_entry -> core.parent_idx; + my_sentry -> core.parent_idx != -1;curr_path_comps++){ + + pathname[curr_path_comps] = strings -> ptr + my_sentry -> str_ind; + + if(curr_path_comps == max_path_comps){ + char **newpath; + + max_path_comps += DEF_INCR_PCOMPS; + + newpath = (char **) realloc(pathname, max_path_comps * sizeof(char *)); + + if(!newpath){ + pathname[0] = (char *) NULL; + return(pathname); + } + } + + my_sentry = (full_site_entry_t *) site_begin + my_sentry -> core.parent_idx; + + } + + if(curr_path_comps == max_path_comps){ + char **newpath; + + max_path_comps += DEF_INCR_PCOMPS; + + newpath = (char **) realloc(pathname, max_path_comps * sizeof(char *)); + + if(!newpath){ + pathname[0] = (char *) NULL; + return(pathname); + } + } + + pathname[curr_path_comps] = strings -> ptr + my_sentry -> str_ind; + + pathname[++curr_path_comps] = (char *) NULL; + + return(pathname); +} + + +status_t check_comp_restrict( restrict, pathname) + char **restrict; + char **pathname; +{ + char **chptr; + char **mypath; + int found = FALSE; + + for(chptr = restrict; (*chptr != (char *) NULL) && !found; chptr++){ + + for(mypath = pathname;(*mypath != (char *) NULL) && !found; mypath++){ + + if(strstr(*pathname, *chptr)) + found = TRUE; + } + } + + return( found ? A_OK : ERROR); +} + + + + /* + * Find the site file associated with given site name + */ + +int find_sitefile_in_db(site_name, sitefile, hostdb) + hostname_t site_name; /* site to be found in database */ + file_info_t *sitefile; /* file info structure to be filled in */ + file_info_t *hostdb; + +{ + + AR_DNS *host_entry; + ip_addr_t **addr; + int i; + int finished = 0; + + /* Get ip address of given site name, checking the local hostdb first */ + + if((host_entry = ar_open_dns_name(site_name, DNS_LOCAL_FIRST, hostdb)) == (struct hostent *) NULL ) + return(PRARCH_SITE_NOT_FOUND); + + for( addr = (ip_addr_t **) host_entry -> h_addr_list, i = 0; + addr[i] != (ip_addr_t *) NULL && !finished; + i++){ + + if( access( files_db_filename( inet_ntoa ( ipaddr_to_inet(*addr[i]))), F_OK) != -1) + finished = 1; + else{ + error(A_SYSERR, "find_sitefile_in_db", "Error accessing site file %s", files_db_filename( inet_ntoa ( ipaddr_to_inet(*addr[i])))); + return(PRARCH_CANT_OPEN_FILE); + } + } + + if( addr[i] == (ip_addr_t *) NULL ) + return(PRARCH_SITE_NOT_FOUND); + + strcpy( sitefile -> filename, files_db_filename( inet_ntoa ( ipaddr_to_inet(*addr[i])))); + + ar_dns_close(host_entry); + + return(A_OK); +} + + + + /* Check for cached results */ +int check_cache(search_req, linkpp) + search_req_t *search_req; + VLINK *linkpp; +{ + char *arg; + int offset; + search_sel_t qtype; + struct match_cache *cachep = mcache; + struct match_cache *pcachep = NULL; + VLINK cur_link; + VLINK rest = NULL; + VLINK next = NULL; + int max_hits = search_req -> max_filename_hits; + int max_uniq_hits = search_req -> max_uniq_hits; + int count = max_hits * max_uniq_hits; + int archiedir = GET_ARCHIE_DIR(search_req -> attrib_list); + + + arg = search_req -> search_str; + qtype = search_req -> curr_type; + offset = search_req -> orig_offset; + + while(cachep) { + if(((qtype == cachep->search_type)||(qtype == cachep->req_type))&& + (cachep->offset == offset) && + /* All results are in cache - or enough to satisfy request */ + ((cachep->max_hits < 0) || (max_hits <= cachep->max_hits)) && + (strcmp(cachep->arg,arg) == 0) && + (cachep->archiedir == archiedir)) { + /* We have a match. Move to front of list */ + if(pcachep) { + pcachep->next = cachep->next; + cachep->next = mcache; + mcache = cachep; + } + + /* We now have to clear the expanded bits or the links */ + /* returned in previous queries will not be returned */ + /* We also need to truncate the list of there are more */ + /* matches than requested */ + cur_link = cachep->matches; +#ifdef NOTDEF /* OLD code that is not maintained, it is unnecessary */ + /* but it does show how we used to handle two-dimensions */ + while(cur_link) { + tmp_link = cur_link; + while(tmp_link) { + tmp_link->expanded = FALSE; + if(tmp_link == cur_link) tmp_link = tmp_link->replicas; + else tmp_link = tmp_link->next; + } + cur_link = cur_link->next; + } +#else /* One dimensional */ + /* IMPORTANT: This code assumes the list is one */ + /* dimensional, which is the case because we called */ + /* vl_insert with the VLI_NOSORT option */ + while(cur_link) { + cur_link->expanded = FALSE; + next = cur_link->next; + if(--count == 0) { /* truncate list */ + rest = cur_link->next; + cur_link->next = NULL; + if(rest) rest->previous = NULL; + } + else if((next == NULL) && (rest == NULL)) { + next = cachep->more; + cur_link->next = next; + if(next) next->previous = cur_link; + cachep->more = NULL; + } + else if (next == NULL) { + cur_link->next = cachep->more; + if(cur_link->next) + cur_link->next->previous = cur_link; + cachep->more = rest; + } + cur_link = next; + } +#endif + *linkpp = cachep->matches; + return(TRUE); + } + pcachep = cachep; + cachep = cachep->next; + } + *linkpp = NULL; + return(FALSE); +} + + + /* Cache the response for later use */ + int add_to_cache(vl, search_req) + VLINK vl; + search_req_t *search_req; + { + struct match_cache *newresults = NULL; + struct match_cache *pcachep = NULL; + + if(cachecount < MATCH_CACHE_SIZE) { /* Create a new entry */ + newresults = (struct match_cache *) malloc(sizeof(struct match_cache)); + cachecount++; + newresults->next = mcache; + mcache = newresults; + newresults->arg = stcopy(search_req -> search_str); + newresults->max_hits = search_req -> max_filename_hits; + newresults->offset = search_req -> orig_offset; + newresults->search_type = search_req -> orig_type; + newresults->req_type = search_req -> curr_type; + newresults->archiedir = GET_ARCHIE_DIR(search_req -> attrib_list); + newresults->matches = NULL; + newresults->more = NULL; + } + else { /* Use last entry - Assumes list has at least two entries */ + pcachep = mcache; + while(pcachep->next) pcachep = pcachep->next; + newresults = pcachep; + + /* move to front of list */ + newresults->next = mcache; + mcache = newresults; + + /* Fix the last entry so we don't have a cycle */ + while(pcachep->next != newresults) pcachep = pcachep->next; + pcachep->next = NULL; + + /* Free the old results */ + if(newresults->matches) { + newresults->matches->dontfree = FALSE; + vllfree(newresults->matches); + newresults->matches = NULL; + } + if(newresults->more) { + newresults->more->dontfree = FALSE; + vllfree(newresults->more); + newresults->more = NULL; + } + + newresults->arg = stcopyr(search_req -> search_str,newresults->arg); + newresults->max_hits = search_req -> max_filename_hits; + newresults->offset = search_req -> orig_offset; + newresults->search_type = search_req -> orig_type; + newresults->req_type = search_req -> curr_type; + newresults->archiedir = GET_ARCHIE_DIR(search_req -> attrib_list); + } + + /* Since we are caching the data. If there are any links, */ + /* note that they should not be freed when sent back */ + if(vl) vl->dontfree = TRUE; + + newresults->matches = vl; + return(0); + } + + diff --git a/archie/access/casesrch.c b/archie/access/casesrch.c new file mode 100644 index 0000000..699ab6b --- /dev/null +++ b/archie/access/casesrch.c @@ -0,0 +1,345 @@ +/* + * This code is no longer used, but for now it's simpler to keep it around to + * avoid undefined symbols in dirsrv. + * + * - wheelan (Wed Jun 5 21:00:19 EDT 1996) + */ + +double tcmp = 0.0; /* to avoid an undefined symbol */ + + +/* + search routine generated by gen. + skip=lC, match=fwd, guard=guard, shift=md2 +*/ + +/* + * The authors of this software are Andrew Hume and Daniel Sunday. + * + * Copyright (c) 1991 by AT&T and Daniel Sunday. + * + * Permission to use, copy, modify, and distribute this software for any + * purpose without fee is hereby granted, provided that this entire notice + * is included in all copies of any software which is or includes a copy + * or modification of this software and in all copies of the supporting + * documentation for such software. + * + * THIS SOFTWARE IS BEING PROVIDED "AS IS", WITHOUT ANY EXPRESS OR IMPLIED + * WARRANTY. IN PARTICULAR, NEITHER THE AUTHORS NOR AT&T MAKE ANY + * REPRESENTATION OR WARRANTY OF ANY KIND CONCERNING THE MERCHANTABILITY + * OF THIS SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR PURPOSE. + */ + +#include +#include +#include +#ifdef DOUBLE_CHECK +#include +#endif +#include "freq.h" +#include "sd.h" +#include "srch.h" + + +#include "protos.h" + + +#ifndef NO_PROSP_CHECK +#define PROSP_CHECK_IN \ +do { static ckcnt = 0; if (ckcnt++ > 1000 /*?*/) { ckcnt = 0; ardp_accept(); } } while(0) +#endif + + +static struct +{ + int patlen; + CHARTYPE pat[MAXPAT]; + CHARTYPE upat[MAXPAT]; + Tab delta[256]; + int loopoffset; /* patlen-1 - skip loop char */ + int rarec, rareoff; + int md2; +} pat; + +#ifdef DOUBLE_CHECK +extern char *prog ; +#endif + +#ifdef __STDC__ +extern void lowercase(char *s, int n) ; +extern void ps(char *s, char *b) ; +extern void uppercase(char *s, int n) ; +#else +extern void lowercase(/* char *s, int n */) ; +extern void ps(/* char *s, char *b */) ; +extern void uppercase(/* char *s, int n */) ; +#endif + +int +prep(base, m, ignore_case) + CHARTYPE *base ; + int m ; + int ignore_case ; +{ + + CHARTYPE *skipc, *uskipc = 0; + register CHARTYPE *pe, *pb; + register int j, r = 0; + register Tab *d; + double tmax, fr; + int rrr, rr; + register CHARTYPE *pmd2; + + pat.patlen = m; + if(m > MAXPAT) + { + return 0 ; + } + memcpy(pat.pat, base, m); + if(ignore_case) + { + memcpy(pat.upat, pat.pat, m) ; + lowercase(pat.pat, m) ; + uppercase(pat.upat, m) ; + } + skipc = 0; + if(sd[m] == 0){ + for(j = m; sd[j] == 0; j--) + sd[j] = 12; + } + + /* + Find the character to check in the skip loop. + */ + tmax = 2+tcmp; + for(pb = pat.pat, pe = pb+pat.patlen-1; pb <= pe; pb++){ + fr = (1+tcmp*freq[*pb])/sd[pb-pat.pat]; + if(tmax > fr){ + tmax = fr; + r = pb-pat.pat; + } + } + pat.loopoffset = m-1-r; /* offset from _end_ of pattern */ + skipc = &pat.pat[m-1-pat.loopoffset]; /* address of this character */ + if(ignore_case) + { + uskipc = &pat.upat[m-1-pat.loopoffset]; /* address of this character */ + } + + /* + Set up the array of skip distances. + */ + d = pat.delta; + for(j = 0; j < 256; j++) + d[j] = m-pat.loopoffset; + for(pb = pat.pat, pe = pb+m-1-pat.loopoffset; pb <= pe; pb++){ + d[*pb] = pe-pb; /* case */ + if(ignore_case) + { d[toupper((int)*pb)] = pe-pb ; + } + } + + /* + Find the rarest character in the pattern and its offset. + */ + rrr = 0; + for(rr = 1; rr < m; rr++){ + if(freq[pat.pat[rr]] < freq[pat.pat[rrr]]) + rrr = rr; + } + pat.rarec = pat.pat[rrr]; + pat.rareoff = rrr; + + /* + Find the distance between the skip loop character and its first + reoccurance to its left. + */ + for(pmd2 = skipc-1; pmd2 >= pat.pat; pmd2--) + if (*pmd2 == *skipc || (ignore_case && *pmd2 == *uskipc)) break; + pat.md2 = skipc - pmd2; /* *pmd2 is first leftward reoccurance of *pe */ + + return 1 ; +} + +/* + Case sensitive match. +*/ + +int +cs_exec(base, n, hit_list, max_hits) + CHARTYPE *base ; + int n ; + index_t *hit_list ; + int max_hits ; +{ + int nmatch = 0 ; + register CHARTYPE *e, *s ; + register Tab *d0 = pat.delta ; + register k, s_offset ; + register ro, rc ; + register CHARTYPE *p, *q ; + register CHARTYPE *ep ; + register md2 = pat.md2 ; + + k = pat.patlen-1-pat.loopoffset ; /* k is index of char we loop on */ + s = base+k ; + e = base+n ; + memset(e, pat.pat[k], pat.patlen) ; + s_offset = -k ; + ro = pat.rareoff+s_offset ; /* offset into s corresponding to rarest */ + rc = pat.rarec ; /* character of pattern. */ + ep = pat.pat + pat.patlen ; + + while(s < e) + { + k = d0[*s] ; + while(k) + { + k = d0[*(s += k)] ; + k = d0[*(s += k)] ; + k = d0[*(s += k)] ; + } + if(s >= e) return nmatch ; + if(s[ro] != rc) goto mismatch ; /* case */ + + /* + compare from beginning of pattern + */ + for(p = pat.pat, q = s+s_offset; p < ep; ) /* case */ + { + if(*q++ != *p++) goto mismatch ; + } + + *hit_list++ = s + s_offset - base ; /* always first character of pattern? */ + if(++nmatch >= max_hits) + { +#ifdef DOUBLE_CHECK + if(strstr(s+s_offset, pat.pat) == (char *)0) + { + fprintf(stderr, "%s: cs_exec: double check failed on (\"%s\", \"%s\").\n", + prog, s+s_offset, pat.pat) ; + } +#endif + return nmatch ; + } + + while(*s++) ; /* move to next string */ + continue; + + mismatch: + s += md2 ; + + PROSP_CHECK_IN; + } + return nmatch ; +} + +/* + Case insensitive match. +*/ + +int +ci_exec(base, n, hit_list, max_hits) + CHARTYPE *base ; + int n ; + index_t *hit_list ; + int max_hits ; +{ + + int nmatch = 0 ; + register CHARTYPE *e, *s ; + register Tab *d0 = pat.delta ; + register k, s_offset ; + register ro, rc, urc ; + register CHARTYPE *p, *q, *up ; + register CHARTYPE *ep ; + register md2 = pat.md2 ; + + k = pat.patlen-1-pat.loopoffset ; /* k is index of char we loop on */ + s = base+k ; + e = base+n ; + memset(e, pat.pat[k], pat.patlen) ; + s_offset = -k ; + ro = pat.rareoff+s_offset ; /* offset into s corresponding to rarest */ + rc = pat.rarec ; /* character of pattern. */ + urc = toupper((int)rc) ; + ep = pat.pat + pat.patlen ; + + while(s < e) + { + k = d0[*s] ; + while(k) + { + k = d0[*(s += k)] ; + k = d0[*(s += k)] ; + k = d0[*(s += k)] ; + } + if(s >= e) return nmatch ; + if(s[ro] != rc && s[ro] != urc) goto mismatch ; /* case */ + + /* + compare from beginning of pattern + */ + for(p = pat.pat, up = pat.upat, q = s+s_offset; p < ep; ) /* case */ + { + CHARTYPE y = *q++, z = *up++ ; + if(y != *p++ && y != z) goto mismatch ; + } + + *hit_list++ = s + s_offset - base ; /* always first character of pattern? */ + if(++nmatch >= max_hits) + { + return nmatch ; + } + + while(*s++) ; /* move to next string */ + continue ; + + mismatch: + s += md2 ; + + PROSP_CHECK_IN; + } + return nmatch ; +} + + +void +lowercase(s, n) + char *s ; + int n ; +{ + + while(n--) + { + *s = tolower((int)*s) ; + s++ ; + } +} + +void +ps(s, b) + char *s ; + char *b ; +{ + char *p = s ; + + while(*p && p-- > b) ; + p++ ; +#if 0 + printf("%p %p '%s'\n", (void *)p, (void *)s, p) ; +#endif +} + +void +uppercase(s, n) + char *s ; + int n ; +{ + + while(n--) + { + *s = toupper((int)*s) ; + s++ ; + } +} diff --git a/archie/access/list_site.c b/archie/access/list_site.c new file mode 100644 index 0000000..cf41c4f --- /dev/null +++ b/archie/access/list_site.c @@ -0,0 +1,392 @@ +#include +#include +#include +#include +#include +#include +#include "typedef.h" +#include "defines.h" +#include "plog.h" +#ifdef OLD_FILES +# include "old-site_file.h" +#else +# include "site_file.h" +#endif +#include "ar_search.h" +#include "error.h" +#ifdef OLD_FILES +# include "old-host_db.h" +#else +# include "host_db.h" +#endif +#include "db_ops.h" +#include "files.h" +#include "archie_strings.h" +#include "archie_dbm.h" +#include "times.h" + + +int prarch_host_dir(site_name,dbname,attrib_list,dirname,vd,hostdb_finfo, hostaux_db, strings_finfo) + hostname_t site_name; /* Name of host to be searched */ + char *dbname; + attrib_list_t attrib_list; + char *dirname; /* Name of directory to be listed */ + VDIR vd; /* Directory to be filled in */ + file_info_t *hostdb_finfo; /* File info for host database */ + file_info_t *hostaux_db; + file_info_t *strings_finfo; /* File info for strings database */ + +{ +#ifdef __STC__ + + extern char *re_comp(char *); + extern int re_exec(char *); + +#else + + extern char *re_comp(); + extern int re_exec(); + +#endif + pathname_t basepath; + full_site_entry_t *site_rec_ptr, *site_end; + char **dirptr; + index_t parent_i; + VLINK curr_link; + int unfinished; + file_info_t *sitefile = create_finfo(); + pathname_t tmp_str; + hostdb_t hostdb_rec; + + + ptr_check(site_name, char, "prarch_host_dir", PRARCH_BAD_ARG); + ptr_check(hostdb_finfo, file_info_t, "prarch_host_dir", PRARCH_BAD_ARG); + ptr_check(strings_finfo, file_info_t, "prarch_host_dir", PRARCH_BAD_ARG); + + memset(&hostdb_rec, '\0', sizeof(hostdb_t)); + + if(dirname != (char *) NULL){ + if(dirname[0] != '/') + strcpy(basepath, dirname); + else + strcpy(basepath, dirname + 1); + } + + /* check to see if the name contains an regex character */ + + /* "LIST" command */ + + if(strpbrk(site_name,"\\^$[]<>*+?|(){}/") != NULL){ + hostname_t *hostlist; + int hostcount; + hostname_t *hostptr, *host_end; + int result; + hostdb_aux_t hostaux_rec; + + if(get_hostnames(hostdb_finfo, &hostlist, &hostcount, (domain_t *) NULL, 0)== ERROR){ + + plog(L_DB_INFO, NULL, NULL, "Can't get list of hosts in database"); + return(PRARCH_DB_ERROR); + } + + if(re_comp(site_name) != (char *) NULL) + return(PRARCH_BAD_REGEX); + + host_end = hostlist + hostcount; + + for(hostptr = hostlist; hostptr < host_end; hostptr++){ + + if((result = re_exec(hostptr)) == -1) + return(PRARCH_INTERN_ERR); + + if(result != 1) + continue; + + if(get_dbm_entry(hostptr, strlen((char *) hostptr) + 1, &hostdb_rec, hostdb_finfo) == ERROR) + continue; + + if(get_hostaux_ent(hostptr, (dbname == (char *) NULL ? ANONFTP_DB_NAME : dbname), &hostaux_rec, hostaux_db) == ERROR) + continue; + + if(!(curr_link = (VLINK) vlalloc())){ + plog(L_DB_INFO, NULL, NULL, "Can't allocate link for HOST command"); + return(PRARCH_OUT_OF_MEMORY); + } + + curr_link -> host = stcopy(hostptr); + + curr_link -> name = stcopy("/"); + + /* Do each attribute in turn */ + + if(GET_AR_H_IP_ADDR(attrib_list)){ + + add_attribute(curr_link,NAME_AR_H_IP_ADDR,"ASCII", inet_ntoa(ipaddr_to_inet(hostdb_rec.primary_ipaddr))); + + } + + if(GET_AR_DB_STAT(attrib_list)){ + char *ost; + + switch(hostaux_rec.current_status){ + + case ACTIVE: + ost = "Active"; + break; + + case NOT_SUPPORTED: + ost = "OS Not Supported"; + break; + + case DEL_BY_ADMIN: + ost = "Scheduled for deletion by Site Administrator"; + break; + + case DEL_BY_ARCHIE: + ost = "Scheduled for deletion"; + break; + + case INACTIVE: + ost = "Inactive"; + break; + + case DELETED: + ost = "Deleted from system"; + break; + + case DISABLED: + ost = "Disabled in system"; + break; + + default: + ost = "Unknown"; + break; + } + + add_attribute(curr_link, NAME_AR_DB_STAT, "ASCII", ost); + } + + if(GET_AR_H_OS_TYPE(attrib_list)){ + char *ost; + + switch(hostdb_rec.os_type){ + + + case UNIX_BSD: + ost = "BSD Unix"; + break; + + case VMS_STD: + ost = "VMS"; + break; + + default: + ost = "Unknown"; + break; + } + + add_attribute(curr_link, NAME_AR_H_OS_TYPE, "ASCII",ost); + } + + if(GET_AR_H_TIMEZ(attrib_list)){ + + sprintf(tmp_str,"%+d", hostdb_rec.timezone); + + add_attribute(curr_link, NAME_AR_H_TIMEZ, "ASCII", tmp_str); + + } + + + if(GET_AUTHORITY(attrib_list)){ + + add_attribute(curr_link, NAME_AUTHORITY, "ASCII", hostaux_rec.source_archie_hostname); + } + + if(GET_AR_H_LAST_MOD(attrib_list)){ + + sprintf(tmp_str,"%sZ", cvt_from_inttime(hostaux_rec.update_time)); + + add_attribute(curr_link, NAME_AR_H_LAST_MOD, "ASCII", tmp_str); + } + + if(GET_AR_RECNO(attrib_list)){ + + sprintf(tmp_str,"%d",hostaux_rec.no_recs); + + add_attribute(curr_link, NAME_AR_RECNO, "ASCII", tmp_str); + } + + vl_insert(curr_link, vd, VLI_NOSORT); + + } + + if(hostlist) + free(hostlist); + + return(PRARCH_SUCCESS); + } + + /* "SITE" command */ + + /* Currently only the anonftp database is supported */ + + if(dbname != (char *) NULL){ + if(strcasecmp(dbname, ANONFTP_DB_NAME) != 0) + return(PRARCH_SUCCESS); + } + + + + /* Get filename of host wanted */ + + if(get_dbm_entry(site_name, strlen(site_name) + 1, &hostdb_rec, hostdb_finfo) == ERROR) + return(PRARCH_SITE_NOT_FOUND); + + if(mmap_file(strings_finfo, O_RDONLY) == ERROR){ + plog(L_DB_INFO, NULL, NULL, "Can't mmap strings file"); + return(PRARCH_BAD_MMAP); + } + + strcpy(sitefile -> filename, files_db_filename( inet_ntoa( ipaddr_to_inet(hostdb_rec.primary_ipaddr)))); + + if(open_file(sitefile, O_RDONLY) == ERROR){ + plog(L_DB_INFO, NULL, NULL, "Can't open site file %s",inet_ntoa( ipaddr_to_inet(hostdb_rec.primary_ipaddr)),0); + return(PRARCH_SITE_NOT_FOUND); + } + + if(mmap_file( sitefile, O_RDONLY) != A_OK){ + plog(L_DB_INFO, NULL, NULL, "Can't mmap site file %s",inet_ntoa( ipaddr_to_inet(hostdb_rec.primary_ipaddr)),0); + return(ERROR); + } + + + site_rec_ptr = (full_site_entry_t *) sitefile -> ptr; + + /* Calculate address of the end of the site file */ + + site_end = site_rec_ptr + (sitefile -> size / sizeof(full_site_entry_t)); + + + /* Go through path one component at a time finding the record in the + site file corresponding to that name. Will end up with correct + record or it won't be found */ + + /* While there are still components in the directory name */ + + for(dirptr = str_sep(basepath, '/'); (*dirptr != (char *) NULL) && (*dirptr[0] != '\0'); dirptr++){ + + for(parent_i = site_rec_ptr -> core.parent_idx, unfinished = 1; + (site_rec_ptr -> core.parent_idx == parent_i) && + ((unfinished = strcmp( (strings_finfo -> ptr) + (site_rec_ptr -> str_ind), *dirptr)) != 0) && + site_rec_ptr < site_end; + site_rec_ptr++); + + /* Directory in path not found */ + + if(unfinished == 1) + return(PRARCH_DIR_NOT_FOUND); + + /* Given pathname component is a directory ? */ + + if(!CSE_IS_DIR( site_rec_ptr -> core) ) + return(PRARCH_NOT_DIRECTORY); + + /* set site file pointer to desired child of current directory */ + + site_rec_ptr = (site_rec_ptr -> core.child_idx) + (full_site_entry_t *) sitefile -> ptr; + + } + + + /* site_rec_ptr points to first child of desired directory + go through all children constructing VLINK of files */ + + + for(parent_i = site_rec_ptr -> core.parent_idx; + (site_rec_ptr -> core.parent_idx == parent_i) && + site_rec_ptr < site_end; + site_rec_ptr++){ + + /* Fill in VLINK structure */ + + +/* curr_link = atoplink( site_rec_ptr, archiedir, site_name, strings_finfo, dirname,0); */ + + if(!(curr_link = (VLINK) vlalloc())){ + plog(L_DB_INFO, NULL, NULL, "Can't allocate link"); + return(PRARCH_OUT_OF_MEMORY); + } + + + if( CSE_IS_DIR( site_rec_ptr -> core )){ + + /* It's a directory - we should check to see if the site is */ + /* running prospero, and if so return a pointer to the actual */ + /* directory. If it isn't then we return a real pointer to */ + /* a pseudo-directory maintained by this archie server. */ + + curr_link ->type = stcopy("DIRECTORY"); + } + else { + + /* It's a file - we should check to see if the site is */ + /* running prospero, and if so return a pointer to the real */ + /* file. If it isn't, then we generate an external link */ + + curr_link -> type = stcopy("EXTERNAL(AFTP,BINARY)"); + } + + + curr_link -> name = stcopy((strings_finfo -> ptr) + (site_rec_ptr -> str_ind)); + + curr_link -> host = stcopy(site_name); + + if((dirname != (char *) NULL) && (dirname[0] != '/')){ + sprintf(tmp_str,"/%s",dirname); + curr_link -> filename = stcopy(tmp_str); + } + else + curr_link -> filename = stcopy(dirname); + + if(GET_LK_LAST_MOD(attrib_list)){ + + sprintf(tmp_str,"%sZ", cvt_from_inttime(site_rec_ptr -> core.date)); + + add_attribute(curr_link, NAME_LK_LAST_MOD, "ASCII", tmp_str); + } + + + if(GET_LINK_SIZE(attrib_list)){ + + sprintf(tmp_str,"%d", site_rec_ptr -> core.size); + + add_attribute(curr_link, NAME_LINK_SIZE, "ASCII", tmp_str); + } + + + if(GET_NATIVE_MODES(attrib_list)){ + + sprintf(tmp_str,"%d", site_rec_ptr -> core.perms); + + add_attribute(curr_link, NAME_NATIVE_MODES, "ASCII", tmp_str); + } + + /* Insert link in list */ + + vl_insert(curr_link,vd,VLI_NOSORT); + + }/* for */ + + + if( munmap_file( sitefile ) != A_OK ) + return(PRARCH_DB_ERROR); + + if( close_file( sitefile ) != A_OK) + return(PRARCH_DB_ERROR); + + if(munmap_file(strings_finfo) != A_OK) + return(PRARCH_BAD_MMAP); + + + return(A_OK); +} diff --git a/archie/access/match.c b/archie/access/match.c new file mode 100644 index 0000000..21ba7cb --- /dev/null +++ b/archie/access/match.c @@ -0,0 +1,158 @@ +#include +#include +#include +#ifdef SOLARIS +#include +#endif +#include "strings_index.h" +#include "typedef.h" +#include "ar_search.h" +#include "plog.h" + +status_t ar_exact_match(s_req, index_list, strings_hash ) + search_req_t *s_req; + index_t *index_list; + file_info_t *strings_hash; + +{ + datum string_search, string_data; + + string_search.dptr = s_req -> search_str; + string_search.dsize = strlen( s_req -> search_str) + 1; + + string_data = dbm_fetch(strings_hash -> fp_or_dbm.dbm, string_search); + + if(dbm_error(strings_hash -> fp_or_dbm.dbm)) + return(ERROR); + + if(string_data.dptr == (char *) NULL) + return(ERROR); + + memcpy(&index_list[0], string_data.dptr, string_data.dsize); + + index_list[1] = -1; + + return(A_OK); +} + +status_t ar_regex_match(search_req, index_list, strings_idx, strings) + search_req_t *search_req; + index_t *index_list; + file_info_t *strings_idx; + file_info_t *strings; + +{ +#ifndef SOLARIS + extern char* re_comp PROTO((char *)); + extern int re_exec PROTO(( char *)); +#endif + + char *strings_idx_end; + strings_idx_t *strings_idx_rec; + int recno; + int count; + int checkcount = 0; +#ifdef SOLARIS + char *re; +#endif + +#ifndef SOLARIS + if((search_req -> error_string = re_comp(search_req -> search_str)) != (char *) NULL){ + return(ERROR); + } +#else + if((re = compile(search_req -> search_str, (char *) NULL, (char *) NULL)) == (char *) NULL){ + search_req -> error_string = strdup("Error in regular expression"); + goto thend; + } +#endif + + strings_idx_rec = (strings_idx_t *) strings_idx -> ptr + search_req -> orig_offset; + strings_idx_end = strings_idx -> ptr + strings_idx -> size; + + if(strings_idx_rec >= (strings_idx_t *) strings_idx_end){ + search_req -> error_string = strdup("Invalid offset given. Please try again"); + goto thend; + } + + for(recno = 0, count=0; + ((char *) strings_idx_rec < strings_idx_end) && (count != search_req -> maxmatch); + strings_idx_rec++, recno++, checkcount++){ + + if(strings_idx_rec -> strings_offset < 0){ + + plog(L_DIR_ERR, NOREQ, "Likely corrupt database. Strings index at rec %d has offset %d", recno, strings_idx_rec -> strings_offset); + continue; + } + + +#ifndef SOLARIS + switch(re_exec((strings -> ptr) + strings_idx_rec -> strings_offset)){ + + case 1: /* String matched */ + + index_list[count++] = recno; + break; + + case 0: + break; + + case -1: + search_req -> error_string = strdup("Internal error"); + index_list[++count] = -1; + return(ERROR); + break; + } +#else + switch(step(((strings -> ptr) + strings_idx_rec -> strings_offset), re)){ + + case 0: + break; + + default: /* String matched */ + index_list[count++] = recno; + break; + } +#endif + + if(checkcount > 1000){ + + ardp_accept(); + checkcount = 0; + } + } + + /* End of List */ + + index_list[count] = -1; + + /* set curr_offset to zero if we fell of the end of the file otherwise + set it to current strings_idx record number */ + + + if((char *) strings_idx_rec >= strings_idx_end) + search_req -> curr_offset = 0; + else + search_req -> curr_offset = ((char *) strings_idx_rec - strings_idx_end) / sizeof(strings_idx_t); + + +#ifdef SOLARIS + if(re) + free(re); +#endif + + return(A_OK); + +thend: + +#ifdef SOLARIS + if(re) + free(re); +#endif + + return(ERROR); + +} + + + diff --git a/archie/access/prarch.c b/archie/access/prarch.c new file mode 100644 index 0000000..55d8865 --- /dev/null +++ b/archie/access/prarch.c @@ -0,0 +1,231 @@ +#include +#include +#include +#include +#include "error.h" +#include "typedef.h" +#include "prarch.h" +#include "ar_search.h" +#include "db_ops.h" +#ifdef OLD_FILES +# include "old-host_db.h" +#else +# include "host_db.h" +#endif +#include "files.h" +#include "archie_strings.h" +#include "master.h" +#include "times.h" + +char *hostname = "THISHOST"; +char *hostwport = "THISHOST"; +char *prog ; + + +void main(argc,argv) + int argc; + char *argv[]; +{ + VLINK clink; + VLINK conflink; + VDIR_ST dir_st; + VDIR dir = &dir_st; + PATTRIB atlink; + search_req_t search_req; + file_info_t *strings_idx = create_finfo(); + file_info_t *strings = create_finfo(); + file_info_t *strings_hash = create_finfo(); + file_info_t *domaindb = create_finfo(); + file_info_t *hostdb = create_finfo(); + file_info_t *hostbyaddr = create_finfo(); + file_info_t *hostaux_db = create_finfo(); + + extern int optind; /*NOT USED*/ + extern char *optarg; + + char **cmdline_ptr; + int cmdline_args; + char option; + + prog = tail(argv[0]) ; + + + search_req.orig_type = S_EXACT; + search_req.domains = (char *) NULL; + search_req.comp_restrict = (char *) NULL; + search_req.attrib_list = (attrib_list_t) 0; + + cmdline_ptr = argv + 1; + cmdline_args = argc - 1; + + + + while((option = (int) getopt(argc, argv, "scerad:t:kzxKZX")) != EOF) { + switch(option) { + + case 's': + search_req.orig_type = S_SUB_NCASE_STR; + cmdline_ptr ++; + cmdline_args --; + break; + + case 'c': + search_req.orig_type = S_SUB_CASE_STR; + cmdline_ptr ++; + cmdline_args --; + break; + +#if 0 + case 'a': + search_req.attrib_flag = FALSE; + cmdline_ptr ++; + cmdline_args --; + break; +#endif + + case 'Z': + search_req.orig_type = S_ZUB_NCASE; + cmdline_ptr ++; + cmdline_args --; + break; + + case 'z': + search_req.orig_type = S_E_ZUB_NCASE; + cmdline_ptr ++; + cmdline_args --; + break; + + + case 'X': + search_req.orig_type = S_X_REGEX; + cmdline_ptr ++; + cmdline_args --; + break; + + case 'x': + search_req.orig_type = S_E_X_REGEX; + cmdline_ptr ++; + cmdline_args --; + break; + + case 'K': + search_req.orig_type = S_SUB_KASE; + cmdline_ptr ++; + cmdline_args --; + break; + + case 'k': + search_req.orig_type = S_E_SUB_KASE; + cmdline_ptr ++; + cmdline_args --; + break; + + case 'e': + search_req.orig_type = S_EXACT; + cmdline_ptr ++; + cmdline_args --; + break; + + case 'r': + search_req.orig_type = S_FULL_REGEX; + cmdline_ptr ++; + cmdline_args --; + break; + + case 'd': + search_req.domains = (char *) strdup(optarg); + cmdline_ptr += 2; + cmdline_args -= 2; + break; + + case 't': + search_req.comp_restrict = (char *) strdup(optarg); + cmdline_ptr += 2; + cmdline_args -= 2; + break; + } + } + + + vdir_init(dir); + + set_master_db_dir(""); + + + /* Do only once */ + set_files_db_dir(""); + if(open_files_db(strings_idx, strings, strings_hash, O_RDONLY) != A_OK) { + fprintf(stderr,"prarch: Can't open database\n"); + exit(1); + } + + set_host_db_dir(""); + + if(open_host_dbs(hostbyaddr, hostdb, domaindb, hostaux_db, O_RDONLY) != A_OK) { + fprintf(stderr,"prarch: Can't open database\n"); + exit(1); + } + + strcpy(search_req.search_str, *cmdline_ptr); + search_req.orig_offset = 0; + search_req.max_uniq_hits = 5; + search_req.max_filename_hits = 100; + + SET_LINK_SIZE(search_req.attrib_list); + SET_LK_LAST_MOD(search_req.attrib_list); + SET_LK_UNIX_MODES(search_req.attrib_list); + + +#if 0 + if(argc == 2) retval = search_files_db(&strings, &strings_idx, &strings_hash, &search_req,dir,0); + else retval = prarch_host(argv[1],argv[2],dir,1); +#endif + + + + +#if 0 + while(1){ + + search_files_db(strings, strings_idx, strings_hash, domaindb, hostdb, hostaux_db, hostbyaddr, &search_req,dir); +#else + + search_files_db(strings, strings_idx, strings_hash, domaindb, hostdb, hostaux_db, hostbyaddr, &search_req,dir); + +#endif + + clink = dir->links; + + while(clink) { + conflink = clink; + while(conflink) { + printf("\n String: %s\n",conflink->name); + printf(" ObjType: %s\n",conflink->type); + printf(" LinkType: %s\n",((conflink->linktype == 'U') ? "Union" : "Standard")); + printf(" HostType: %s\n",conflink->hosttype); + printf(" Host: %s\n",conflink->host); + printf(" NameType: %s\n",conflink->nametype); + printf(" Pathname: %s\n",conflink->filename); + if(conflink->version) printf(" Version: %d\n",conflink->version); + printf(" Magic: %d\n",conflink->f_magic_no); + atlink = conflink -> lattrib; + while(atlink){ + printf(" Name: %s\n Value: %s\n", atlink -> aname, atlink -> value.ascii); + atlink = atlink -> next; + } + conflink = conflink->replicas; + } + clink = clink->next; + } + +#if 0 + + printf("###DONE"); + vdir_init(dir); + } +#endif + + exit(0); + +} + diff --git a/archie/access/prarch_match.c b/archie/access/prarch_match.c new file mode 100644 index 0000000..408f9b7 --- /dev/null +++ b/archie/access/prarch_match.c @@ -0,0 +1,593 @@ +#include +#include +#include +#include + +#define _toupper(c) ((c)-'a'+'A') + +#ifdef MMAP +#include +#endif + +/* Archie definitions */ +#include +#include + +#include "prarch.h" + +#include +#include +#include + +VLINK atoplink(); + +char *re_comp(); +char *make_lcase(); +int get_match_list(); + +extern char *strings_begin; +extern long strings_table_size; +extern DBM *fast_strings; + +/* So we can adjust our cache policy based on queue length */ +extern int pQlen; + +static char lowertable[256] = { +'\000','\001','\002','\003','\004','\005','\006','\007', +'\010','\011','\012','\013','\014','\015','\016','\017', +'\020','\021','\022','\023','\024','\025','\026','\027', +'\030','\031','\032','\033','\034','\035','\036','\037', +' ','!','"','#','$','%','&','\'', +'(',')','*','+',',','-','.','/', +'0','1','2','3','4','5','6','7', +'8','9',':',';','<','=','>','?', +'@','a','b','c','d','e','f','g', +'h','i','j','k','l','m','n','o', +'p','q','r','s','t','u','v','w', +'x','y','z','[','\\',']','^','_', +'`','a','b','c','d','e','f','g', +'h','i','j','k','l','m','n','o', +'p','q','r','s','t','u','v','w', +'x','y','z','{','|','}','~','\177', +'\200','\201','\202','\203','\204','\205','\206','\207', +'\210','\211','\212','\213','\214','\215','\216','\217', +'\220','\221','\222','\223','\224','\225','\226','\227', +'\230','\231','\232','\233','\234','\235','\236','\237', +'\240','\241','\242','\243','\244','\245','\246','\247', +'\250','\251','\252','\253','\254','\255','\256','\257', +'\260','\261','\262','\263','\264','\265','\266','\267', +'\270','\271','\272','\273','\274','\275','\276','\277', +'\300','\301','\302','\303','\304','\305','\306','\307', +'\310','\311','\312','\313','\314','\315','\316','\317', +'\320','\321','\322','\323','\324','\325','\326','\327', +'\330','\331','\332','\333','\334','\335','\336','\337', +'\340','\341','\342','\343','\344','\345','\346','\347', +'\350','\351','\352','\353','\354','\355','\356','\357', +'\360','\361','\362','\363','\364','\365','\366','\367', +'\370','\371','\372','\373','\374','\375','\376','\377'}; + +#define MATCH_CACHE_SIZE 15 + +struct match_cache { + char *arg; /* Matched regular expression */ + int max_hits; /* Maximum matchess <0 = found all */ + int offset; /* Offset */ + search_sel search_type; /* Search method (the one used) */ + search_sel req_type; /* Requested method */ + VLINK matches; /* Matches */ + VLINK more; /* Additional matches */ + int archiedir; /* Flag: directory links are to archie */ + struct match_cache *next; /* Next entry in cache */ +}; + +static struct match_cache *mcache = NULL; + +static int cachecount = 0; + +/* + * prarch_match - Search archie database for specified file + * + * PRARCH_MATCH searches the archie database and returns + * a list of files matching the provided regular expression + * + * ARGS: program_name - regular expression for files to match + * max_hits - maximum number of entries to return (max hits) + * offset - start the search after this many hits + * search_type - search method + * vd - pointer to directory to be filled in + * archiedir - flag - directory links should be to archie + * + * Search method is one of: S_FULL_REGEX + * S_EXACT + * S_SUB_NCASE_STR + * S_SUB_CASE_STR + */ + +int prarch_match(program_name,max_hits,offset,search_type,vd,archiedir) + char *program_name; /* Regular expression to be matched */ + int max_hits; /* Maximum number of entries to return */ + int offset; /* Skip this many matches before starting */ + search_sel search_type; /* Search method */ + VDIR vd; /* Directory to be filled in */ + int archiedir; /* Flag: directory links s/b to archie */ +{ + /* + * Search the database for the string specified by 'program_name'. Use the + * fast dbm strings database if 'is_exact' is set, otherwise search through + * the strings table. Stop searching after all matches have been found, or + * 'max_hits' matches have been found, whichever comes first. + */ + char s_string[MAX_STRING_LEN]; + char *strings_ptr; + char *strings_curr_off; + strings_header str_head; + datum search_key, key_value; + search_sel new_search_type = S_EXACT; /* Alternate search method */ + search_sel or_search_type = search_type; /* Original search method */ + int nocase = 0; + int hits_exceeded = FALSE; /* should be boolean? */ + char *strings_end; + int match_number; + int patlen; + site_out **site_outptr; + site_out site_outrec; + int i; + VLINK cur_link; + int loopcount = 0; + int retval; + + if(!program_name || !(*program_name)) return(PRARCH_BAD_ARG); + + strcpy(s_string, program_name); + + /* See if we can use a less expensive search method */ + if((search_type == S_FULL_REGEX) && + (strpbrk(s_string,"\\^$.,[]<>*+?|(){}/") == NULL)) + or_search_type = search_type = S_SUB_CASE_STR; + else if((search_type == S_E_FULL_REGEX) && + (strpbrk(s_string,"\\^$.,[]<>*+?|(){}/") == NULL)) + or_search_type = search_type = S_E_SUB_CASE_STR; + + /* The caching code assumes we are handed an empty directory */ + /* if not, return an error for now. Eventually we will get */ + /* rid of that assumption */ + if(vd->links) { + plog(L_DIR_ERR, NULL, NULL, "Prarch_match handed non empty dir",0); + return(PRARCH_BAD_ARG); + } + + if(check_cache(s_string,max_hits,offset,search_type, + archiedir,&(vd->links)) == TRUE) { + plog(L_DB_INFO, NULL, NULL, "Responding with cached data",0); + return(PSUCCESS); + } + + site_outptr = (site_out **) malloc((unsigned)(sizeof(site_out) * + (max_hits + offset))); + if(!site_outptr) return(PRARCH_OUT_OF_MEMORY); + + startsearch: + + strings_ptr = strings_begin; + strings_end = strings_begin + (int) strings_table_size; + + match_number = 0; + + switch(search_type){ + + case S_E_SUB_CASE_STR: + new_search_type = S_SUB_CASE_STR; + goto exact_match; + case S_E_SUB_NCASE_STR: + new_search_type = S_SUB_NCASE_STR; + goto exact_match; + case S_E_FULL_REGEX: + new_search_type = S_FULL_REGEX; + exact_match: + case S_EXACT: + + search_key.dptr = s_string; + search_key.dsize = strlen(s_string) + 1; + + check_for_messages(); + key_value = dbm_fetch(fast_strings, search_key) ; + + if(key_value.dptr != (char *)NULL){ /* string in table */ + + int string_pos; + + bcopy(key_value.dptr,(char *)&string_pos, key_value.dsize); + + strings_ptr += string_pos; + + bcopy(strings_ptr,(char *)&str_head,sizeof(strings_header)); + + check_for_messages(); + + if(str_head.filet_index != -1) { + retval = get_match_list((int) str_head.filet_index, max_hits + + offset, &match_number, site_outptr, FALSE); + + if((retval != A_OK) && (retval != HITS_EXCEEDED)) { + plog(L_DB_ERROR,NULL,NULL,"get_match_list failed (%d)",retval,0); + goto cleanup; + } + + if( match_number >= max_hits + offset ){ + hits_exceeded = TRUE; + break; + } + } + } + else if (search_type != S_EXACT) { /* Not found - but try other method */ + search_type = new_search_type; + goto startsearch; + } + break; + + case S_FULL_REGEX: + + if(re_comp(s_string) != (char *)NULL){ + return (PRARCH_BAD_REGEX); + } + + str_head.str_len = -1; + + check_for_messages(); + + while((strings_curr_off = strings_ptr + str_head.str_len + 1) < strings_end){ + + if((loopcount++ & 0x7ff) == 0) check_for_messages(); + + strings_ptr = strings_curr_off; + + bcopy(strings_ptr,(char *)&str_head,sizeof(strings_header)); + + strings_ptr += sizeof(strings_header); + + if(re_exec( strings_ptr ) == 1 ){ /* TRUE */ + strings_curr_off = strings_ptr; + + check_for_messages(); + + if(str_head.filet_index != -1){ + retval = get_match_list((int) str_head.filet_index, max_hits + + offset, &match_number, site_outptr, FALSE); + + if((retval != A_OK) && (retval != HITS_EXCEEDED)) { + plog(L_DB_ERROR,NULL,NULL,"get_match_list failed (%d)",retval,0); + goto cleanup; + } + + if( match_number >= max_hits + offset ){ + hits_exceeded = TRUE; + break; + } + } + } + } + + break; + +#define TABLESIZE 256 + + case S_SUB_NCASE_STR: + nocase++; + case S_SUB_CASE_STR: { + char pattern[MAX_STRING_LEN]; + int skiptab[TABLESIZE]; + register int pc, tc; + register int local_loopcount = 0xfff; + char *bp1; + int skip; + int plen; + int plen_1; + int tlen; + unsigned char tchar; + + plen = strlen(s_string); + plen_1 = plen -1; + + /* Old code (replaced by inline code taken from initskip) */ + /* patlen = strlen(s_string ) ; */ + /* initskip(s_string, patlen, search_type == S_SUB_NCASE_STR) ; */ + + if(nocase) { + for(pc = 0; s_string[pc]; pc++) + pattern[pc] = lowertable[s_string[pc]]; + pattern[pc] = '\0'; + } + else strcpy(pattern,s_string); + + for( i = 0 ; i < TABLESIZE ; i++ ) + skiptab[ i ] = plen; + + /* Note that we want both ucase and lcase in this table if nocase */ + for( i = 0, tchar = *pattern; i < plen ; i++, tchar = *(pattern + i)) { + skiptab[tchar] = plen - 1 - i; + if(nocase && islower(tchar)) + skiptab[_toupper(tchar)] = plen - 1 - i; + } + + /* Begin heavily optimized and non portable code */ + + /* Note that we are depending on str_head being 8 bytes */ + tlen = -9; /* str_head.str_len */ + + strings_curr_off = strings_ptr; + + while((strings_curr_off += tlen + 9) < strings_end) { + if(--local_loopcount == 0) { + check_for_messages(); + local_loopcount = 0xfff; + } + + strings_ptr = strings_curr_off; + + /* This is a kludge, non-portable, but it eliminates a pr call */ + /* Note that the size is 8 on suns. Is there a better way? */ + /* bcopy(strings_ptr,(char *)&str_head,sizeof(strings_header)); */ + bp1 = (char *) &str_head; + /* The copying of the file index is done only on a match */ + bp1[4] = strings_ptr[4]; bp1[5] = strings_ptr[5]; + /* bp1[6] = strings_ptr[6]; bp1[7] = strings_ptr[7]; */ + + tlen = (unsigned short) str_head.str_len; + + /* To catch database corruption, this is a sanity check */ + if((tlen < 0) || (tlen > MAX_STRING_LEN)) { + plog(L_DB_ERROR,NULL,NULL,"Database corrupt: string length out of bounds",0); + break; + } + + /* Old code (replaced by inline code taken from strfind) */ + /* if(strfind(strings_ptr,str_head.str_len)) */ + + if( tlen <= plen_1 ) continue; + pc = tc = plen_1; + + strings_ptr += 8; + + /* Moved the nocase test outside the inner loop for performace */ + /* Clauses are identical except for the first if */ + if(nocase) do { + tchar = strings_ptr[tc]; + + /* improve efficiency of this test */ + if(lowertable[tchar] == pattern[pc]) {--pc; --tc;} + else { + skip = skiptab[tchar] ; + tc += (skip < plen_1 - pc) ? plen : skip ; + pc = plen_1 ; + } + } while( pc >= 0 && tc < tlen ) ; + else /* (!nocase) */ do { + tchar = strings_ptr[tc]; + + /* improve efficiency of this test */ + if(tchar == pattern[pc]) {--pc; --tc;} + else { + skip = skiptab[tchar] ; + tc += (skip < plen_1 - pc) ? plen : skip ; + pc = plen_1 ; + } + } while( pc >= 0 && tc < tlen ) ; + + if(pc >= 0) continue; + + /* We have a match */ + + /* Finish copying str_head - strings_curr_off */ + /* is old strings_ptr. */ + bp1[0] = strings_curr_off[0]; bp1[1] = strings_curr_off[1]; + bp1[2] = strings_curr_off[2]; bp1[3] = strings_curr_off[3]; + + /* End heavily optimized and non portable code */ + + check_for_messages(); + + if(str_head.filet_index != -1){ + retval = get_match_list((int) str_head.filet_index, max_hits + + offset, &match_number, site_outptr, FALSE); + + if((retval != A_OK) && (retval != HITS_EXCEEDED)) { + plog(L_DB_ERROR,NULL,NULL,"get_match_list failed (%d)",retval,0); + goto cleanup; + } + + if( match_number >= max_hits + offset){ + hits_exceeded = TRUE; + break; + } + } + } + } + break; + + default: + return(PRARCH_BAD_ARG); + + cleanup: + for(i = 0;i < match_number; i++) free((char *)site_outptr[i]); + free((char *)site_outptr); + return(PRARCH_DB_ERROR); + + } + + for(i = 0;i < match_number; i++){ + if((i & 0x7f) == 0) check_for_messages(); + site_outrec = *site_outptr[i]; + if(i >= offset) { + cur_link = atoplink(site_outrec,archiedir); + if(cur_link) vl_insert(cur_link,vd,VLI_NOSORT); + } + free((char *)site_outptr[i]); + } + free((char *)site_outptr); + + if(hits_exceeded) { + /* Insert a continuation entry */ + } + + if((search_type == S_EXACT) && (pQlen > (MATCH_CACHE_SIZE - 5))) + return(PRARCH_SUCCESS); + + add_to_cache(vd->links,s_string, (hits_exceeded ? max_hits : -max_hits), + offset,search_type,or_search_type,archiedir); + + return(PRARCH_SUCCESS); +} + + +/* Check for cached results */ +check_cache(arg,max_hits,offset,qtype,archiedir,linkpp) + char *arg; + int max_hits; + int offset; + search_sel qtype; + int archiedir; + VLINK *linkpp; + { + struct match_cache *cachep = mcache; + struct match_cache *pcachep = NULL; + VLINK tmp_link, cur_link; + VLINK rest = NULL; + VLINK next = NULL; + int count = max_hits; + + while(cachep) { + if(((qtype == cachep->search_type)||(qtype == cachep->req_type))&& + (cachep->offset == offset) && + /* All results are in cache - or enough to satisfy request */ + ((cachep->max_hits < 0) || (max_hits <= cachep->max_hits)) && + (strcmp(cachep->arg,arg) == 0) && + (cachep->archiedir == archiedir)) { + /* We have a match. Move to front of list */ + if(pcachep) { + pcachep->next = cachep->next; + cachep->next = mcache; + mcache = cachep; + } + + /* We now have to clear the expanded bits or the links */ + /* returned in previous queries will not be returned */ + /* We also need to truncate the list of there are more */ + /* matches than requested */ + cur_link = cachep->matches; +#ifdef NOTDEF /* OLD code that is not maintained, it is unnecessary */ + /* but it does show how we used to handle two-dimensions */ + while(cur_link) { + tmp_link = cur_link; + while(tmp_link) { + tmp_link->expanded = FALSE; + if(tmp_link == cur_link) tmp_link = tmp_link->replicas; + else tmp_link = tmp_link->next; + } + cur_link = cur_link->next; + } +#else /* One dimensional */ + /* IMPORTANT: This code assumes the list is one */ + /* dimensional, which is the case because we called */ + /* vl_insert with the VLI_NOSORT option */ + while(cur_link) { + cur_link->expanded = FALSE; + next = cur_link->next; + if(--count == 0) { /* truncate list */ + rest = cur_link->next; + cur_link->next = NULL; + if(rest) rest->previous = NULL; + } + else if((next == NULL) && (rest == NULL)) { + next = cachep->more; + cur_link->next = next; + if(next) next->previous = cur_link; + cachep->more = NULL; + } + else if (next == NULL) { + cur_link->next = cachep->more; + if(cur_link->next) + cur_link->next->previous = cur_link; + cachep->more = rest; + } + cur_link = next; + } +#endif + *linkpp = cachep->matches; + return(TRUE); + } + pcachep = cachep; + cachep = cachep->next; + } + *linkpp = NULL; + return(FALSE); + } + + +/* Cache the response for later use */ +add_to_cache(vl,arg,max_hits,offset,search_type,req_type,archiedir) + VLINK vl; + char *arg; + int max_hits; + int offset; + search_sel search_type; + search_sel req_type; + int archiedir; + { + struct match_cache *newresults = NULL; + struct match_cache *pcachep = NULL; + + if(cachecount < MATCH_CACHE_SIZE) { /* Create a new entry */ + newresults = (struct match_cache *) malloc(sizeof(struct match_cache)); + cachecount++; + newresults->next = mcache; + mcache = newresults; + newresults->arg = stcopy(arg); + newresults->max_hits = max_hits; + newresults->offset = offset; + newresults->search_type = search_type; + newresults->req_type = req_type; + newresults->archiedir = archiedir; + newresults->matches = NULL; + newresults->more = NULL; + } + else { /* Use last entry - Assumes list has at least two entries */ + pcachep = mcache; + while(pcachep->next) pcachep = pcachep->next; + newresults = pcachep; + + /* move to front of list */ + newresults->next = mcache; + mcache = newresults; + + /* Fix the last entry so we don't have a cycle */ + while(pcachep->next != newresults) pcachep = pcachep->next; + pcachep->next = NULL; + + /* Free the old results */ + if(newresults->matches) { + newresults->matches->dontfree = FALSE; + vllfree(newresults->matches); + newresults->matches = NULL; + } + if(newresults->more) { + newresults->more->dontfree = FALSE; + vllfree(newresults->more); + newresults->more = NULL; + } + + newresults->arg = stcopyr(arg,newresults->arg); + newresults->max_hits = max_hits; + newresults->offset = offset; + newresults->search_type = search_type; + newresults->req_type = req_type; + newresults->archiedir = archiedir; + } + + /* Since we are caching the data. If there are any links, */ + /* note that they should not be freed when sent back */ + if(vl) vl->dontfree = TRUE; + + newresults->matches = vl; + } + + diff --git a/archie/access/prlist.c b/archie/access/prlist.c new file mode 100644 index 0000000..69d5c1b --- /dev/null +++ b/archie/access/prlist.c @@ -0,0 +1,86 @@ +#include +#include +#include +#include "error.h" +#include "typedef.h" +#include "prarch.h" +#include "ar_search.h" +#include "db_ops.h" +#ifdef OLD_FILES +# include "old-host_db.h" +#else +# include "host_db.h" +#endif +#include "files.h" +#include "master.h" +#include "ar_attrib.h" + + +char *hostname = "THISHOST"; +char *hostwport = "THISHOST"; + +void main(argc,argv) + int argc; + char *argv[]; +{ + + PATTRIB atlink; + VLINK conflink; + VDIR_ST dir_st; + VLINK clink; + file_info_t *strings_idx = create_finfo(); + file_info_t *strings = create_finfo(); + file_info_t *strings_hash = create_finfo(); + file_info_t *domaindb = create_finfo(); + file_info_t *hostdb = create_finfo(); + file_info_t *hostaux_db = create_finfo(); + file_info_t *hostbyaddr = create_finfo(); + VDIR dir = &dir_st; + attrib_list_t attrib_list; + + SET_ALL_ATTRIB(attrib_list); + + set_master_db_dir(""); + + set_files_db_dir(""); + if(open_files_db(strings_idx, strings, strings_hash, O_RDONLY) != A_OK) { + fprintf(stderr,"prarch: Can't open database\n"); + exit(1); + } + + set_host_db_dir(""); + + if(open_host_dbs(hostbyaddr, hostdb, domaindb, hostaux_db, O_RDONLY) != A_OK) { + fprintf(stderr,"prarch: Can't open database\n"); + exit(1); + } + + vdir_init(dir); + + prarch_host_dir(argv[1], "anonftp", attrib_list, (argv[2] == NULL ? "" : argv[2]),dir, hostdb, hostaux_db, strings); + clink = dir->links; + + while(clink) { + conflink = clink; + while(conflink) { + printf("\n Name: %s\n",conflink->name); + printf(" ObjType: %s\n",conflink->type); + printf(" LinkType: %s\n",((conflink->linktype == 'U') ? "Union" : "Standard")); + printf(" HostType: %s\n",conflink->hosttype); + printf(" Host: %s\n",conflink->host); + printf(" NameType: %s\n",conflink->nametype); + printf(" Pathname: %s\n",conflink->filename); + if(conflink->version) printf(" Version: %d\n",conflink->version); + printf(" Magic: %d\n",conflink->f_magic_no); + atlink = conflink -> lattrib; + while(atlink){ + printf(" Name: %s\n Value: %s\n", atlink -> aname, atlink -> value.ascii); + atlink = atlink -> next; + } + conflink = conflink->replicas; + } + clink = clink->next; + } + + +} diff --git a/archie/access/sys/370.c b/archie/access/sys/370.c new file mode 100644 index 0000000..72ab9f7 --- /dev/null +++ b/archie/access/sys/370.c @@ -0,0 +1,23 @@ +#include +#include +#include + +int hz = HZ; +double tcmp = 3.0; + +#if 0 +static struct tms start; + +startclock() +{ + times(&start); +} + +stopclock() +{ + struct tms t; + + times(&t); + return(t.tms_utime - start.tms_utime); +} +#endif diff --git a/archie/access/sys/386.c b/archie/access/sys/386.c new file mode 100644 index 0000000..0088b8d --- /dev/null +++ b/archie/access/sys/386.c @@ -0,0 +1,23 @@ +#include +#include +#include + +int hz = HZ; +double tcmp = 4.91; + +#if 0 +static struct tms start; + +startclock() +{ + times(&start); +} + +stopclock() +{ + struct tms t; + + times(&t); + return(t.tms_utime - start.tms_utime); +} +#endif diff --git a/archie/access/sys/68k.c b/archie/access/sys/68k.c new file mode 100644 index 0000000..3c87fdb --- /dev/null +++ b/archie/access/sys/68k.c @@ -0,0 +1,23 @@ +#include +#include +#include + +int hz = HZ; +double tcmp = 2.97; + +#if 0 +static struct tms start; + +startclock() +{ + times(&start); +} + +stopclock() +{ + struct tms t; + + times(&t); + return(t.tms_utime - start.tms_utime); +} +#endif diff --git a/archie/access/sys/cray.c b/archie/access/sys/cray.c new file mode 100644 index 0000000..fe35c4d --- /dev/null +++ b/archie/access/sys/cray.c @@ -0,0 +1,23 @@ +#include +#include +#include + +int hz = HZ; +double tcmp = 3.34; + +#if 0 +static struct tms start; + +startclock() +{ + times(&start); +} + +stopclock() +{ + struct tms t; + + times(&t); + return(t.tms_utime - start.tms_utime); +} +#endif diff --git a/archie/access/sys/mips.c b/archie/access/sys/mips.c new file mode 100644 index 0000000..d8b266f --- /dev/null +++ b/archie/access/sys/mips.c @@ -0,0 +1,23 @@ +#include +#include +#include + +int hz = HZ; +double tcmp = 3.29; + +#if 0 +static struct tms start; + +startclock() +{ + times(&start); +} + +stopclock() +{ + struct tms t; + + times(&t); + return(t.tms_utime - start.tms_utime); +} +#endif diff --git a/archie/access/sys/sparc.c b/archie/access/sys/sparc.c new file mode 100644 index 0000000..4216a95 --- /dev/null +++ b/archie/access/sys/sparc.c @@ -0,0 +1,25 @@ +#include +#include +#include + +#if !defined(AIX) && !defined(SOLARIS) +int hz = HZ; +#endif +double tcmp = 3.04; + +#if 0 +static struct tms start; + +startclock() +{ + times(&start); +} + +stopclock() +{ + struct tms t; + + times(&t); + return(t.tms_utime - start.tms_utime); +} +#endif diff --git a/archie/access/sys/sparc2.c b/archie/access/sys/sparc2.c new file mode 100644 index 0000000..8f3b937 --- /dev/null +++ b/archie/access/sys/sparc2.c @@ -0,0 +1,23 @@ +#include +#include +#include + +int hz = HZ; +double tcmp = 3.1683; + +#if 0 +static struct tms start; + +startclock() +{ + times(&start); +} + +stopclock() +{ + struct tms t; + + times(&t); + return(t.tms_utime - start.tms_utime); +} +#endif diff --git a/archie/access/sys/vax.c b/archie/access/sys/vax.c new file mode 100644 index 0000000..f36b132 --- /dev/null +++ b/archie/access/sys/vax.c @@ -0,0 +1,22 @@ +#include +#include + +int hz = 60; +double tcmp = 3.86; + +#if 0 +static struct tms start; + +startclock() +{ + times(&start); +} + +stopclock() +{ + struct tms t; + + times(&t); + return(t.tms_utime - start.tms_utime); +} +#endif diff --git a/archie/anonftp/.gitignore b/archie/anonftp/.gitignore new file mode 100644 index 0000000..f3c7a7c --- /dev/null +++ b/archie/anonftp/.gitignore @@ -0,0 +1 @@ +Makefile diff --git a/archie/anonftp/Makefile.in b/archie/anonftp/Makefile.in new file mode 100755 index 0000000..4812f4f --- /dev/null +++ b/archie/anonftp/Makefile.in @@ -0,0 +1,15 @@ +# +# anonftp +# + +BIN_DIRS = \ + parse \ + retrieve \ + update + +DIRS = \ + lib \ + $(BIN_DIRS) + + +include $(ARCHIE_ROOT)/Makefile.multi diff --git a/archie/anonftp/lib/.gitignore b/archie/anonftp/lib/.gitignore new file mode 100644 index 0000000..f3c7a7c --- /dev/null +++ b/archie/anonftp/lib/.gitignore @@ -0,0 +1 @@ +Makefile diff --git a/archie/anonftp/lib/AIX-2/.gitignore b/archie/anonftp/lib/AIX-2/.gitignore new file mode 100644 index 0000000..f3c7a7c --- /dev/null +++ b/archie/anonftp/lib/AIX-2/.gitignore @@ -0,0 +1 @@ +Makefile diff --git a/archie/anonftp/lib/AIX-2/Makefile.in b/archie/anonftp/lib/AIX-2/Makefile.in new file mode 100755 index 0000000..21bcdbb --- /dev/null +++ b/archie/anonftp/lib/AIX-2/Makefile.in @@ -0,0 +1,11 @@ +# +# Use GNU's fixed header files. +# +SYS_DEFS = -DAIX +SENT_FLAGS = -ffixed-%g2 -ffixed-%g3 -ffixed-%g4 + +include ../Makefile.pre + +include ../Makefile.post + +# DO NOT DELETE THIS LINE -- make depend depends on it diff --git a/archie/anonftp/lib/Makefile.post b/archie/anonftp/lib/Makefile.post new file mode 100755 index 0000000..730efc6 --- /dev/null +++ b/archie/anonftp/lib/Makefile.post @@ -0,0 +1,16 @@ +# +# Patrie module. +# + +all: libanonftp.a + +include $(ARCHIE_ROOT)/Makefile.post + + +libanonftp.a: $(OBJS) + $(AR) r $@ $? + $(RANLIB) $@ + + +clean: + rm -f *.o $(EXES) libanonftp.a core diff --git a/archie/anonftp/lib/Makefile.pre b/archie/anonftp/lib/Makefile.pre new file mode 100755 index 0000000..5c36460 --- /dev/null +++ b/archie/anonftp/lib/Makefile.pre @@ -0,0 +1,26 @@ +# +# Anonftp/lib module. +# + +MOD_CFLAGS = -ansi -pedantic -pipe +#MOD_CFLAGS = -traditional -pipe +MOD_DEBUG = -g3 +MOD_WARN = -Wall -Wshadow -Wpointer-arith -Wcast-align \ + -Wnested-externs + +MOD_INCS = -I$(INCLUDE_MODULE) -I$(PROSPERO_ROOT)/include -I. + +include $(ARCHIE_ROOT)/Makefile.pre + + +INCS = \ + lang_libanonftp.h + +SRCS = \ + db_ops.c \ + lang_libanonftp.c + +OBJS = \ + db_ops.o \ + lang_libanonftp.o + diff --git a/archie/anonftp/lib/SunOS-4.1.4/.gitignore b/archie/anonftp/lib/SunOS-4.1.4/.gitignore new file mode 100644 index 0000000..f3c7a7c --- /dev/null +++ b/archie/anonftp/lib/SunOS-4.1.4/.gitignore @@ -0,0 +1 @@ +Makefile diff --git a/archie/anonftp/lib/SunOS-4.1.4/Makefile.in b/archie/anonftp/lib/SunOS-4.1.4/Makefile.in new file mode 100755 index 0000000..f4cca56 --- /dev/null +++ b/archie/anonftp/lib/SunOS-4.1.4/Makefile.in @@ -0,0 +1,10 @@ +# +# Use GNU's fixed header files. +# +SYS_DEFS = -D__USE_FIXED_PROTOTYPES__ -DSUNOS +SENT_FLAGS = -ffixed-%g2 -ffixed-%g3 -ffixed-%g4 + +include ../Makefile.pre +include ../Makefile.post + +# DO NOT DELETE THIS LINE -- make depend depends on it diff --git a/archie/anonftp/lib/SunOS-5.4/.gitignore b/archie/anonftp/lib/SunOS-5.4/.gitignore new file mode 100644 index 0000000..f3c7a7c --- /dev/null +++ b/archie/anonftp/lib/SunOS-5.4/.gitignore @@ -0,0 +1 @@ +Makefile diff --git a/archie/anonftp/lib/SunOS-5.4/Makefile.in b/archie/anonftp/lib/SunOS-5.4/Makefile.in new file mode 100755 index 0000000..31b10b5 --- /dev/null +++ b/archie/anonftp/lib/SunOS-5.4/Makefile.in @@ -0,0 +1,12 @@ +# +# Use GNU's fixed header files. +# +SYS_DEFS = -D__USE_FIXED_PROTOTYPES__ -DSOLARIS +SENT_FLAGS = -ffixed-%g2 -ffixed-%g3 -ffixed-%g4 +SYS_LIBS = -lresolv + +include ../Makefile.pre +RANLIB = : +include ../Makefile.post + +# DO NOT DELETE THIS LINE -- make depend depends on it diff --git a/archie/anonftp/lib/SunOS-5.6 b/archie/anonftp/lib/SunOS-5.6 new file mode 120000 index 0000000..7b4e044 --- /dev/null +++ b/archie/anonftp/lib/SunOS-5.6 @@ -0,0 +1 @@ +SunOS-5.4 \ No newline at end of file diff --git a/archie/anonftp/lib/db_ops.c b/archie/anonftp/lib/db_ops.c new file mode 100644 index 0000000..1fdca37 --- /dev/null +++ b/archie/anonftp/lib/db_ops.c @@ -0,0 +1,284 @@ +/* + * This file is copyright Bunyip Information Systems Inc., 1992. This file + * may not be reproduced, copied or transmitted by any means mechanical or + * electronic without the express written consent of Bunyip Information + * Systems Inc. + */ + + +#include +#include +#include +#include +#include +#include +#include +#include "typedef.h" +#include "db_ops.h" +#include "db_files.h" +#include "files.h" +#include "master.h" +#include "misc.h" +#include "error.h" +#include "lang_libanonftp.h" +#include "archie_dbm.h" + +#include "protos.h" + +/* Set up the directory name containing the files database */ +extern char *prog; + +char *set_files_db_dir(files_db_dir) + char *files_db_dir; + +{ + static pathname_t files_database_dir; + char *data_dir; + struct stat statbuf; + + if(files_db_dir == (char *) NULL){ + + if((data_dir = (char *) malloc(strlen(files_database_dir) +1)) + == (char *) NULL){ + error(A_SYSERR,"set_database_dir","trying to malloc for database directory name"); + return((char *) NULL); + } + + strcpy(data_dir, files_database_dir); + return(data_dir); + } + + if(files_db_dir[0] != '\0') + strcpy(files_database_dir, files_db_dir); + else + sprintf(files_database_dir, "%s/%s%s", get_master_db_dir(), DEFAULT_FILES_DB_DIR,DB_SUFFIX); + + + if(stat(files_database_dir, &statbuf) == -1){ + + error(A_SYSERR,"set_files_db_dir","Can't access dirctory %s", files_database_dir); + return((char *) NULL); + } + + if(!S_ISDIR(statbuf.st_mode)){ + error(A_ERR,"set_host_db_dir","%s is not a directory", files_database_dir); + return((char *) NULL); + } + + return(files_database_dir); +} + + +char *get_files_db_dir() + +{ + return(set_files_db_dir((char *) NULL)); +} + + + +char *files_db_filename(filename,port) + char *filename; + int port; +{ + static char tmp_db_filename[MAX_PATH_LEN]; + char *gfdd = get_files_db_dir(); /* Need this to free memory allocated + in set_files_db_dir() */ + + if ( port > 0 ) + sprintf(tmp_db_filename, "%s/%s:%d", gfdd , filename , port); + else + sprintf(tmp_db_filename, "%s/%s", gfdd , filename ); + free(gfdd); + return (char *)tmp_db_filename; +} + + +/* + * Open all files database files + */ + + +status_t open_files_db(strings_idx_finfo, strings_finfo, strings_hash_finfo, mode) + file_info_t *strings_idx_finfo; + file_info_t *strings_finfo; + file_info_t *strings_hash_finfo; + int mode; +{ + int tmp_fd; + int testmode = R_OK | F_OK; + + if (strings_idx_finfo != (file_info_t *)NULL) + { + strcpy(strings_idx_finfo->filename, files_db_filename(DEFAULT_STRINGS_IDX, (int)(0))); + if (access(strings_idx_finfo->filename, mode == O_RDONLY ? testmode : testmode | W_OK) == -1) + { + if (mode == O_RDONLY) + { + error(A_SYSERR, "open_files_db", "can't access %s", strings_idx_finfo->filename); + return ERROR; + } +#if 0 + else + { + error(A_SYSWARN, "open_files_db", "can't access %s. Attempting to create new file", + strings_idx_finfo->filename); + } +#endif + } + + if ((tmp_fd = open(strings_idx_finfo->filename, (mode == O_RDONLY ? O_RDONLY : mode | O_CREAT), + DEFAULT_FILE_PERMS)) == -1) + { + error(A_SYSERR, "open_files_db", "can't access %s", strings_idx_finfo->filename); + return ERROR; + } + + if ((strings_idx_finfo->fp_or_dbm.fp = fdopen(tmp_fd, mode == O_RDONLY ? "r" : "r+")) + == (FILE *)NULL) + { + error(A_ERR, "open_files_db", "opening %s file", DEFAULT_STRINGS_IDX); + return ERROR; + } + } + + if (strings_finfo != (file_info_t *)NULL) + { + int new_file = 0; + + strcpy(strings_finfo->filename, files_db_filename(DEFAULT_STRINGS_LIST,(int)(0))); + if (access(strings_finfo->filename, mode == O_RDONLY ? testmode : testmode | W_OK) == -1) + { + if (mode == O_RDONLY) + { + error(A_SYSERR, "open_files_db", "can't access %s", strings_finfo->filename); + return ERROR; + } + else + { +#if 0 + error(A_SYSWARN, "open_files_db", "can't access %s. Attempting to create new file", + strings_finfo->filename); +#endif + new_file = TRUE; + } + } + + if ((tmp_fd = open(strings_finfo->filename, (mode == O_RDONLY ? O_RDONLY : mode | O_CREAT), + DEFAULT_FILE_PERMS)) == -1) + { + error(A_SYSERR, "open_files_db", "can't access %s", strings_finfo->filename); + return ERROR; + } + + if ((strings_finfo->fp_or_dbm.fp = fdopen(tmp_fd, mode == O_RDONLY ? "r" : "r+")) + == (FILE *)NULL) + { + error(A_SYSERR, "open_files_db", "opening %s file", DEFAULT_STRINGS_LIST); + return ERROR; + } + + if (new_file && ftruncate(fileno(strings_finfo->fp_or_dbm.fp), INIT_STRING_SIZE) != 0) + { + error(A_SYSERR, "open_files_db", "extending strings file to default length"); + return ERROR; + } + } + + if (strings_hash_finfo != (file_info_t *)NULL) + { + strcpy(strings_hash_finfo->filename, files_db_filename(DEFAULT_STRINGS_HASH,(int)(0))); + strings_hash_finfo->fp_or_dbm.dbm = dbm_open(strings_hash_finfo->filename, + (mode == O_RDONLY ? O_RDONLY : mode | O_CREAT), + DEFAULT_FILE_PERMS); + if ((strings_hash_finfo->fp_or_dbm.dbm == (DBM *)NULL) || + dbm_error(strings_hash_finfo->fp_or_dbm.dbm)) + { + error(A_INTERR, "open_files_db", "error opening hashed strings database %s", + DEFAULT_STRINGS_HASH); + return ERROR; + } + } + + return A_OK; +} + + +status_t close_files_db(strings_idx_finfo, strings_finfo, strings_hash_finfo) + file_info_t *strings_idx_finfo; + file_info_t *strings_finfo; + file_info_t *strings_hash_finfo; +{ + + if(strings_idx_finfo != (file_info_t *) NULL) + if(close_file(strings_idx_finfo) == ERROR){ + + error(A_INTERR, "close_files_db", "Can't close strings idx file %s", strings_idx_finfo -> filename); + } + + if(strings_finfo != (file_info_t *) NULL) + if(close_file(strings_finfo) == ERROR){ + + error(A_INTERR, "close_files_db", "Can't close strings file %s", strings_finfo -> filename); + } + + if(strings_hash_finfo != (file_info_t *) NULL) + dbm_close(strings_hash_finfo -> fp_or_dbm.dbm); + + return(A_OK); +} + + + +char *unix_perms_itoa(perms, directory, link) + int perms; + int directory; + int link; + +{ + static char result[ 16 ] ; + + int i; + int tmp; + + if(directory) + result[0] ='d'; + else if(link) + result[0] ='l'; + else + result[0] ='-'; + + + result[1] = '\0'; + + for(i=8; i >= 0; i--){ + tmp = 0x1; + if(perms & (tmp << i)){ + switch(i){ + case 8: + case 5: + case 2: + strcat(result,"r"); + break; + + case 7: + case 4: + case 1: + strcat(result,"w"); + break; + case 6: + case 3: + case 0: + strcat(result,"x"); + break; + } + } + else + strcat(result,"-"); + } + + return result ; + +} + + diff --git a/archie/anonftp/lib/lang_libanonftp.c b/archie/anonftp/lib/lang_libanonftp.c new file mode 100644 index 0000000..b61373f --- /dev/null +++ b/archie/anonftp/lib/lang_libanonftp.c @@ -0,0 +1,6 @@ +/* db_ops.c */ + +char* GET_INPUT_FILE_001 = "Host %s unknown"; +char* GET_INPUT_FILE_002 = "Can't find host %s in primary database"; +char* GET_INPUT_FILE_003 = "Can't find database %s host %s in local databases"; + diff --git a/archie/anonftp/lib/lang_libanonftp.h b/archie/anonftp/lib/lang_libanonftp.h new file mode 100644 index 0000000..23c894e --- /dev/null +++ b/archie/anonftp/lib/lang_libanonftp.h @@ -0,0 +1,10 @@ +#ifndef _LANG_LIBANONFTP_H_ +#define _LANG_LIBANONFTP_H_ + +/* db_ops.c */ + +extern char* GET_INPUT_FILE_001 ; +extern char* GET_INPUT_FILE_002 ; +extern char* GET_INPUT_FILE_003 ; + +#endif diff --git a/archie/anonftp/parse/.gitignore b/archie/anonftp/parse/.gitignore new file mode 100644 index 0000000..f3c7a7c --- /dev/null +++ b/archie/anonftp/parse/.gitignore @@ -0,0 +1 @@ +Makefile diff --git a/archie/anonftp/parse/AIX-2/.gitignore b/archie/anonftp/parse/AIX-2/.gitignore new file mode 100644 index 0000000..f3c7a7c --- /dev/null +++ b/archie/anonftp/parse/AIX-2/.gitignore @@ -0,0 +1 @@ +Makefile diff --git a/archie/anonftp/parse/AIX-2/Makefile.in b/archie/anonftp/parse/AIX-2/Makefile.in new file mode 100755 index 0000000..221761b --- /dev/null +++ b/archie/anonftp/parse/AIX-2/Makefile.in @@ -0,0 +1,12 @@ +# +# Use GNU's fixed header files. +# +SYS_DEFS = -DAIX +SENT_FLAGS = -ffixed-%g2 -ffixed-%g3 -ffixed-%g4 +SYS_LIBS = -L${BERKDB_ROOT}/${SYSTYPE} -ldb + +include ../Makefile.pre + +include ../Makefile.post + +# DO NOT DELETE THIS LINE -- make depend depends on it diff --git a/archie/anonftp/parse/Makefile.post b/archie/anonftp/parse/Makefile.post new file mode 100755 index 0000000..417cc0b --- /dev/null +++ b/archie/anonftp/parse/Makefile.post @@ -0,0 +1,50 @@ +# +# module. +# + +all: $(EXES) + + +include $(ARCHIE_ROOT)/Makefile.post + + +parse_anonftp_unix_bsd: \ + $(LIBARCHIE_MODULE)/$(SYSTYPE)/libarchie.a \ + $(HOSTDB_MODULE)/$(SYSTYPE)/libhostdb.a \ + $(REGEX_MODULE)/$(SYSTYPE)/libregex.a \ + unix.o unix2.o ${COMMON_OBJ} + ${CC} ${CFLAGS} ${INCLUDES} -o parse_anonftp_unix_bsd unix.o unix2.o \ + ${COMMON_OBJ} ${LIBS} ${SYS_LIBS} + +parse_anonftp_vms_std: \ + $(LIBARCHIE_MODULE)/$(SYSTYPE)/libarchie.a \ + $(HOSTDB_MODULE)/$(SYSTYPE)/libhostdb.a \ + $(REGEX_MODULE)/$(SYSTYPE)/libregex.a \ + vms.o vms2.o ${COMMON_OBJ} + ${CC} ${CFLAGS} ${INCLUDES} -o parse_anonftp_vms_std vms.o vms2.o \ + ${COMMON_OBJ} ${LIBS} ${SYS_LIBS} + +parse_anonftp_novell: \ + $(LIBARCHIE_MODULE)/$(SYSTYPE)/libarchie.a \ + $(HOSTDB_MODULE)/$(SYSTYPE)/libhostdb.a \ + $(REGEX_MODULE)/$(SYSTYPE)/libregex.a \ + novell.o novell2.o ${COMMON_OBJ} + ${CC} ${CFLAGS} ${INCLUDES} -o parse_anonftp_novell novell.o novell2.o \ + ${COMMON_OBJ} ${LIBS} ${SYS_LIBS} + +parse_anonftp: \ + $(LIBARCHIE_MODULE)/$(SYSTYPE)/libarchie.a \ + $(HOSTDB_MODULE)/$(SYSTYPE)/libhostdb.a \ + $(REGEX_MODULE)/$(SYSTYPE)/libregex.a \ + parse_anonftp.o lang_anonftp.o + ${CC} ${CFLAGS} ${INCLUDES} -o parse_anonftp parse_anonftp.o lang_anonftp.o \ + ${LIBS} ${SYS_LIBS} + +test-queue: test-queue.o queue.o + ${CC} ${CFLAGS} ${INCLUDES} -o test-queue test-queue.o + +test-vms_parser: test-vms_parser.o vms_parser.o + ${CC} ${CFLAGS} ${INCLUDES} -o test-vms_parser test-vms_parser.o ${SYS_LIBS} + +clean: + rm -f *.o $(EXES) core diff --git a/archie/anonftp/parse/Makefile.pre b/archie/anonftp/parse/Makefile.pre new file mode 100755 index 0000000..025fa72 --- /dev/null +++ b/archie/anonftp/parse/Makefile.pre @@ -0,0 +1,99 @@ +# +# anonftp/parse module. +# + +LIBS = \ + -L$(LIBARCHIE_MODULE)/$(SYSTYPE) -larchie \ + -L$(HOSTDB_MODULE)/$(SYSTYPE) -lhostdb \ + -L$(REGEX_MODULE)/$(SYSTYPE) -lregex + +#MOD_CFLAGS = -ansi -pedantic -pipe +#MOD_CFLAGS = -traditional -pipe +MOD_DEBUG = -g3 +MOD_WARN = -Wall -Wshadow -Wpointer-arith -Wcast-align \ + -Wnested-externs +MOD_INCS = -I$(INCLUDE_MODULE) -I$(REGEX_MODULE) -I. +MOD_LIBS = $(LIBS) + + +include $(ARCHIE_ROOT)/Makefile.pre + + +INCS = \ + db2v.h \ + info_cell.h \ + input.h \ + lang_parsers.h \ + line_type.h \ + mem_debug.h \ + output.h \ + pars_ent_holder.h \ + parse.h \ + queue.h \ + queue_def.h \ + stack.h \ + storage.h \ + str.h \ + unix2.h \ + utils.h \ + vms2.h + +COMMON_SRC = \ + info_cell.c \ + input.c \ + lang_parsers.c \ + output.c \ + parse.c \ + queue.c \ + stack.c \ + storage.c \ + utils.c + +COMMON_OBJ = \ + info_cell.o \ + input.o \ + lang_parsers.o \ + output.o \ + parse.o \ + queue.o \ + stack.o \ + storage.o \ + utils.o + +SRCS = \ + ${COMMON_SRC} \ + db2v.c \ + lang_anonftp.c \ + mem_debug.c \ + novell.c \ + novell2.c \ + parse_anonftp.c \ + str.c \ + test-queue.c \ + test-vms_parser.c \ + unix.c \ + unix2.c \ + vms.c \ + vms2.c + +OBJS = \ + ${COMMON_OBJ} \ + db2v.o \ + lang_anonftp.o \ + mem_debug.o \ + novell.o \ + novell2.o \ + parse_anonftp.o \ + str.o \ + test-queue.o \ + test-vms_parser.o \ + unix.o \ + unix2.o \ + vms.o \ + vms2.o + +EXES = \ + parse_anonftp_unix_bsd \ + parse_anonftp_vms_std \ + parse_anonftp_novell \ + parse_anonftp diff --git a/archie/anonftp/parse/SunOS-4.1.4/.gitignore b/archie/anonftp/parse/SunOS-4.1.4/.gitignore new file mode 100644 index 0000000..f3c7a7c --- /dev/null +++ b/archie/anonftp/parse/SunOS-4.1.4/.gitignore @@ -0,0 +1 @@ +Makefile diff --git a/archie/anonftp/parse/SunOS-4.1.4/Makefile.in b/archie/anonftp/parse/SunOS-4.1.4/Makefile.in new file mode 100755 index 0000000..10d574e --- /dev/null +++ b/archie/anonftp/parse/SunOS-4.1.4/Makefile.in @@ -0,0 +1,11 @@ +# +# Use GNU's fixed header files. +# +SYS_DEFS = -D__USE_FIXED_PROTOTYPES__ -DSUNOS +SENT_FLAGS = -ffixed-%g2 -ffixed-%g3 -ffixed-%g4 +SYS_LIBS = -L${BERKDB_ROOT}/${SYSTYPE} -ldb + +include ../Makefile.pre +include ../Makefile.post + +# DO NOT DELETE THIS LINE -- make depend depends on it diff --git a/archie/anonftp/parse/SunOS-5.4/.gitignore b/archie/anonftp/parse/SunOS-5.4/.gitignore new file mode 100644 index 0000000..f3c7a7c --- /dev/null +++ b/archie/anonftp/parse/SunOS-5.4/.gitignore @@ -0,0 +1 @@ +Makefile diff --git a/archie/anonftp/parse/SunOS-5.4/Makefile.in b/archie/anonftp/parse/SunOS-5.4/Makefile.in new file mode 100755 index 0000000..b6f25cb --- /dev/null +++ b/archie/anonftp/parse/SunOS-5.4/Makefile.in @@ -0,0 +1,11 @@ +# +# Use GNU's fixed header files. +# +SYS_DEFS = -D__USE_FIXED_PROTOTYPES__ -DSOLARIS +SENT_FLAGS = -ffixed-%g2 -ffixed-%g3 -ffixed-%g4 +SYS_LIBS = -lresolv -lnsl -lsocket -L${BERKDB_ROOT}/${SYSTYPE} -ldb + +include ../Makefile.pre +include ../Makefile.post + +# DO NOT DELETE THIS LINE -- make depend depends on it diff --git a/archie/anonftp/parse/SunOS-5.6 b/archie/anonftp/parse/SunOS-5.6 new file mode 120000 index 0000000..7b4e044 --- /dev/null +++ b/archie/anonftp/parse/SunOS-5.6 @@ -0,0 +1 @@ +SunOS-5.4 \ No newline at end of file diff --git a/archie/anonftp/parse/db2v.c b/archie/anonftp/parse/db2v.c new file mode 100644 index 0000000..dd788d6 --- /dev/null +++ b/archie/anonftp/parse/db2v.c @@ -0,0 +1,150 @@ +#include +#include +#include "defines.h" +#include "parser_file.h" +#include "error.h" + +/* + These routines take as arguments a pointer to a parser_entry_t and a + pointer to a string on which to write the conversions. All routines write + a nul terminator and return a pointer to the terminator. +*/ + + +/* + 'v' points to the first character of the date string. + + E.g. "15-JUL-1991" +*/ + +char * +db2v_date(pe, s, slen) + parser_entry_t *pe ; + char *s ; + int slen ; +{ + static char *months[13] = { "JAN", "FEB", "MAR", "APR", "MAY", "JUN", "JUL", + "AUG", "SEP", "OCT", "NOV", "DEC", (char *)0 } ; + char *p = s ; + int dm ; + int m ; + int y ; + struct tm *bd_time ; + + ptr_check(pe, parser_entry_t, "db2v_date", (char *)0) ; + ptr_check(s, char, "db2v_date", (char *)0) ; + + if((bd_time = gmtime(&pe->core.date)) == (struct tm *)0) + { + error(A_ERR, "db2v_date", "error from gmtime() with [%ld]", + (long)pe->core.date) ; + return (char *)0 ; + } +#ifdef AIX + if(strftime(s, slen, "%d-%h-%Y %H:%M", bd_time) == 0) +#else + if(strftime(s, slen, "%d-%h-%Y %R", bd_time) == 0) +#endif + { + error(A_ERR, "db2v_date", "error from strftime()") ; + return (char *)0 ; + } + return s ; +} + + +char * +db2v_links(pe, s) + parser_entry_t *pe ; + char *s ; +{ + ptr_check(pe, parser_entry_t, "db2v_links", (char *)0) ; + ptr_check(s, char, "db2v_links", (char *)0) ; + + *s = '\0' ; + return s ; +} + + +char * +db2v_name(pe, s) + parser_entry_t *pe ; + char *s ; +{ + ptr_check(pe, parser_entry_t, "db2v_name", (char *)0) ; + ptr_check(s, char, "db2v_name", (char *)0) ; + + *s = '\0' ; + return s ; +} + + +char * +db2v_perms(pe, s) + parser_entry_t *pe ; + char *s ; +{ + char *p_grp ; + char *p_own ; + char *p_sys ; + char *p_wrl ; + static char *pstr[16] = + { "", + "D", + "E", "ED", + "W", "WD", "WE", "WED", + "R", "RD", "RE", "RED", "RW", "RWD", "RWE", "RWED" + } ; + + ptr_check(pe, parser_entry_t, "db2v_perms", (char *)0) ; + ptr_check(s, char, "db2v_perms", (char *)0) ; + + p_sys = pstr[(pe->core.perms >> 12) & 0x0f] ; + p_own = pstr[(pe->core.perms >> 8) & 0x0f] ; + p_grp = pstr[(pe->core.perms >> 4) & 0x0f] ; + p_wrl = pstr[(pe->core.perms >> 0) & 0x0f] ; + + sprintf(s, "(%s,%s,%s,%s)", p_sys, p_own, p_grp, p_wrl) ; + return s ; +} + + +#define OWNER "[owner,owner]" + +char * +db2v_owner(pe, s) + parser_entry_t *pe ; + char *s ; +{ + ptr_check(pe, parser_entry_t, "db2v_owner", (char *)0) ; + ptr_check(s, char, "db2v_owner", (char *)0) ; + + strcpy(s, OWNER) ; + return s ; +} + + +char * +db2v_size(pe, s) + parser_entry_t *pe ; + char *s ; +{ + ptr_check(pe, parser_entry_t, "db2v_size", (char *)0) ; + ptr_check(s, char, "db2v_size", (char *)0) ; + + sprintf(s, "%ld", (long)pe->core.size) ; + return s ; +} + + +char * +db2v_type(pe, s) + parser_entry_t *pe ; + char *s ; +{ + ptr_check(pe, parser_entry_t, "db2v_type", (char *)0) ; + ptr_check(s, char, "db2v_type", (char *)0) ; + + *s = '\0' ; + return s ; +} diff --git a/archie/anonftp/parse/db2v.h b/archie/anonftp/parse/db2v.h new file mode 100644 index 0000000..af91aa8 --- /dev/null +++ b/archie/anonftp/parse/db2v.h @@ -0,0 +1,27 @@ +#ifndef DB2V_H +#define DB2V_H + +#include "parser_file.h" + +#ifdef __STDC__ + +extern char *db2v_date(parser_entry_t *pe, char *s, int slen) ; +extern char *db2v_links(parser_entry_t *pe, char *s) ; +extern char *db2v_name(parser_entry_t *pe, char *s) ; +extern char *db2v_owner(parser_entry_t *pe, char *s) ; +extern char *db2v_perms(parser_entry_t *pe, char *s) ; +extern char *db2v_size(parser_entry_t *pe, char *s) ; +extern char *db2vype(parser_entry_t *pe, char *s) ; + +#else + +extern char *db2v_date(/* parser_entry_t *pe, char *s, int slen */) ; +extern char *db2v_links(/* parser_entry_t *pe, char *s */) ; +extern char *db2v_name(/* parser_entry_t *pe, char *s */) ; +extern char *db2v_owner(/* parser_entry_t *pe, char *s */) ; +extern char *db2v_perms(/* parser_entry_t *pe, char *s */) ; +extern char *db2v_size(/* parser_entry_t *pe, char *s */) ; +extern char *db2vype(/* parser_entry_t *pe, char *s */) ; + +#endif +#endif diff --git a/archie/anonftp/parse/info_cell.c b/archie/anonftp/parse/info_cell.c new file mode 100644 index 0000000..e799795 --- /dev/null +++ b/archie/anonftp/parse/info_cell.c @@ -0,0 +1,61 @@ +#include +#include +#include /* malloc? */ +#include "parse.h" +#include "info_cell.h" +#include "error.h" +#include "lang_parsers.h" + +/* + The 'name' field is assumed to point to malloc'ed storage. +*/ + +int +dispose_Info_cell(ic) + Info_cell *ic ; +{ + ptr_check(ic, Info_cell, "init_Info_cell", 0) ; + + if(ic->name != (char *)0) + { + free(ic->name) ; + } + free(ic) ; + return 1; + +#ifdef 0 +#ifndef __STDC__ +#ifndef AIX + return free(ic) ; +#else + free(ic) ; + return 1; +#endif +#else + free(ic) ; + return 1; +#endif +#endif +} + + +Info_cell * +new_Info_cell(str) + char *str ; +{ + Info_cell *ic ; + + ptr_check(str, char, "init_Info_cell", 0) ; + + if((ic = (Info_cell *)malloc(sizeof(Info_cell))) == (Info_cell *)0) + { + /* "Error malloc'ing %ld bytes*/ + + error(A_SYSERR, "new_Info_cell", NEW_INFO_CELL_001, (long)sizeof(Info_cell)) ; + return ic ; + } + ic->name = str ; + ic->idx = 0 ; + ic->addr = (Pars_ent_holder *)0 ; + return ic ; +} diff --git a/archie/anonftp/parse/info_cell.h b/archie/anonftp/parse/info_cell.h new file mode 100644 index 0000000..796bf6a --- /dev/null +++ b/archie/anonftp/parse/info_cell.h @@ -0,0 +1,25 @@ +#ifndef INFO_CELL_H +#define INFO_CELL_H + +#include "typedef.h" +#include "pars_ent_holder.h" + +typedef struct +{ + char *name ; + index_t idx ; + Pars_ent_holder *addr ; +} Info_cell ; + +#ifdef __STDC__ + +extern int dispose_Info_cell(Info_cell *ic) ; +extern Info_cell *new_Info_cell(char *str) ; + +#else + +extern int dispose_Info_cell(/* Info_cell *ic */) ; +extern Info_cell *new_Info_cell(/* char *str */) ; + +#endif +#endif diff --git a/archie/anonftp/parse/input.c b/archie/anonftp/parse/input.c new file mode 100644 index 0000000..3e4cf85 --- /dev/null +++ b/archie/anonftp/parse/input.c @@ -0,0 +1,70 @@ +#include +#include "defines.h" +#include "utils.h" +#include "input.h" +#include "error.h" +#include "lang_parsers.h" + +static int linenum = 0 ; /* number of input lines currently read */ +static int skipline = 0 ; /* 1 -> return without reading a line */ + +int +init_line_num() +{ +linenum = 0; +} + +int +get_line(l, len, fp) + char *l ; + int len ; + FILE *fp ; +{ + ptr_check(l, char, "get_line", 0) ; + ptr_check(fp, FILE, "get_line", 0) ; + + if(skipline) + { + skipline = 0 ; + return 1 ; + } + else + { + if(fgets(l, len, fp) == (char *)0) + { + if(feof(fp)) + { + return 0 ; + } + else + { + + /* "Error from fgets()") */ + + error(A_ERR, "get_line", INPUT_001); + return 0 ; + } + } + else + { + nuke_nl(l) ; + linenum++ ; + return 1 ; + } + } + return 1 ; /* Not reached, but keeps gcc -Wall happy */ +} + + +int +line_num() +{ + return linenum ; +} + + +void +skip_line() +{ + skipline = 1 ; +} diff --git a/archie/anonftp/parse/input.h b/archie/anonftp/parse/input.h new file mode 100644 index 0000000..6ffbbc4 --- /dev/null +++ b/archie/anonftp/parse/input.h @@ -0,0 +1,17 @@ +#ifndef INPUT_H +#define INPUT_H + +#ifdef __STDC__ + +extern int get_line(char *l, int len, FILE *fp) ; +extern int line_num(void) ; +extern void skip_line(void) ; + +#else + +extern int get_line(/* char *l, int len, FILE *fp */) ; +extern int line_num(/* void */) ; +extern void skip_line(/* void */) ; + +#endif +#endif diff --git a/archie/anonftp/parse/lang_anonftp.c b/archie/anonftp/parse/lang_anonftp.c new file mode 100644 index 0000000..8f72d93 --- /dev/null +++ b/archie/anonftp/parse/lang_anonftp.c @@ -0,0 +1,283 @@ + +char* INSERT_ANONFTP_001 = "Can't open input file %s"; +char* INSERT_ANONFTP_002 = "Can't read header record of %s"; +char* INSERT_ANONFTP_003 = "Can't mmap() input file %s"; +char* INSERT_ANONFTP_004 = "Can't open anonftp database"; +char* INSERT_ANONFTP_005 = "Can't malloc() space for outlist"; +char* INSERT_ANONFTP_006 = "Doing hostname lookup"; +char* INSERT_ANONFTP_007 = "Error updating host database: %s"; +char* INSERT_ANONFTP_008 = "File %s already exists in the database"; +char* INSERT_ANONFTP_009 = "Reading input"; +char* INSERT_ANONFTP_010 = "Error while processing input. No data has been lost"; +char* INSERT_ANONFTP_011 = "Making internal links"; +char* INSERT_ANONFTP_012 = "Error while making internal links. No data has been lost"; +char* INSERT_ANONFTP_013 = "Can't rename %s to %s. anonftp database not changed."; +char* INSERT_ANONFTP_014 = "Making external links"; +char* INSERT_ANONFTP_015 = "Can't make links into database for %s. Database may be corrupt"; +char* INSERT_ANONFTP_016 = "Can't activate host database record for %s"; +char* INSERT_ANONFTP_017 = "Can't set up output file %s"; +char* INSERT_ANONFTP_019 = "Can't open log file %s"; +char* INSERT_ANONFTP_020 = "Can't open default log file"; +char* INSERT_ANONFTP_021 = "Error while trying to set master database directory"; +char* INSERT_ANONFTP_022 = "Error while trying to set anonftp database directory"; +char* INSERT_ANONFTP_023 = "Error while trying to set host database directory"; +char* INSERT_ANONFTP_024 = "No site name or address given"; +char* INSERT_ANONFTP_025 = "Can't unlink failed output file %s"; +char* INSERT_ANONFTP_026 = "Input file %s contains no data after header"; +char* INSERT_ANONFTP_027 = "Can't open dest file %s, errno = %d"; +char* INSERT_ANONFTP_028 = "Can't open src file %s, errno = %d"; +char* INSERT_ANONFTP_029 = "While copying file %s to %s, errno = %d"; + +char* SETUP_OUTPUT_FILE_001 = "Number of records %d. Ignoring"; +char* SETUP_OUTPUT_FILE_002 = "Can't get new file info structure"; +char* SETUP_OUTPUT_FILE_003 = "Can't get temporary name for file %s."; +char* SETUP_OUTPUT_FILE_004 = "Can't open output file %s"; +char* SETUP_OUTPUT_FILE_005 = "Can't ftruncate output file %s"; +char* SETUP_OUTPUT_FILE_006 = "Can't mmap() output file %s"; + +/* setup_insert.c */ + + +char* ADD_TMP_STRING_001 = "Can't malloc space for new tmp_list element"; + +char* SETUP_HASH_TABLE_001 = "Can't allocate space for has table"; + +char* SETUP_INSERT_001 = "Can't setup hash table"; +char* SETUP_INSERT_002 = "Possible zero length strings index file\nIgnore error message if this is a new database"; +char* SETUP_INSERT_003 = "Can't malloc space for input string"; +char* SETUP_INSERT_004 = "Can't add string to hash table"; +char* SETUP_INSERT_005 = "Can't unmap strings index file"; +char* SETUP_INSERT_006 = "Error while reading '%s' from hashed strings database"; + + +char* DO_INTERNAL_001 = "Possible zero length strings index file\nIgnore error message if this is a new database"; +char* DO_INTERNAL_002 = "Cannot process new or inactive record number %u, string %s"; +char* DO_INTERNAL_003 = "Can't unmap strings index file" ; + +char* MAKE_LINKS_001 = "Error while seeking end of strings_list file"; +char* MAKE_LINKS_002 = "Error while extending strings_list file"; +char* MAKE_LINKS_003 = "Error while seeking end of strings_idx file"; +char* MAKE_LINKS_004 = "Error while seeking end of strings_idx file"; +char* MAKE_LINKS_005 = "Error while reading last record in strings index file"; +char* MAKE_LINKS_006 = "Error while seeking end of strings_idx file"; +char* MAKE_LINKS_007 = "Error while seeking last string in strings file"; +char* MAKE_LINKS_008 = "Error while reading last string in strings file"; +char* MAKE_LINKS_009 = "Error while seeking end of last string in strings_list file"; +char* MAKE_LINKS_010 = "Error while seeking beginning of strings_list file"; +char* MAKE_LINKS_011 = "Can't insert new string into hash database"; +char* MAKE_LINKS_012 = "Error writing strings_idx file"; +char* MAKE_LINKS_013 = "Error writing new string in strings_list file"; +char* MAKE_LINKS_014 = "Can't mmap() strings index file"; +char* MAKE_LINKS_015 = "Can't unmap previous site file"; +char* MAKE_LINKS_016 = "Can't close previous site file"; +char* MAKE_LINKS_017 = "Can't open site file for link insertion"; +char* MAKE_LINKS_018 = "Can't mmap() site file for link insertion"; +char* MAKE_LINKS_019 = "Can't unmap strings index file"; + + + +/* delete.c */ + +char* DELETE_ANONFTP_001 = "No site name or address given"; +char* DELETE_ANONFTP_002 = "Error while trying to set master database directory"; +char* DELETE_ANONFTP_003 = "Error while trying to set anonftp database directory"; +char* DELETE_ANONFTP_004 = "Error while trying to set host database directory"; +char* DELETE_ANONFTP_005 = "Error while trying to open anonftp database"; +char* DELETE_ANONFTP_006 = "Error while trying to open host database"; +char* DELETE_ANONFTP_007 = "Can't determine input file for site %s"; +char* DELETE_ANONFTP_008 = "Can't find input database file for %s"; +char* DELETE_ANONFTP_009 = "Error while trying to inactivate %s in host database"; +char* DELETE_ANONFTP_010 = "Error while trying to set up deletion of %s"; +char* DELETE_ANONFTP_011 = "Can't remove the site file %s"; +char* DELETE_ANONFTP_012 = "Can't close input file %s"; +char* DELETE_ANONFTP_013 = "Can't open default log file"; +char* DELETE_ANONFTP_014 = "Can't open log file %s"; + +/* setup_delete.c */ + +char* SETUP_DELETE_001 = "Can't malloc space for internal list"; +char* SETUP_DELETE_002 = "No input file %s"; +char* SETUP_DELETE_003 = "Can't mmap site file to be deleted %s"; +char* SETUP_DELETE_004 = "Can't mmap strings index file"; +char* SETUP_DELETE_005 = "Can't open site file %s"; +char* SETUP_DELETE_006 = "Can't mmap site file %s"; +char* SETUP_DELETE_007 = "Can't unmap site file %s"; +char* SETUP_DELETE_008 = "Can't close site file %s"; +char* SETUP_DELETE_009 = "Can't unmap strings index file"; +char* SETUP_DELETE_010 = "Can't free internal list"; +char* SETUP_DELETE_011 = "Can't fstat() input site file %s"; +char* SETUP_DELETE_012 = "Number of records in host auxiliary database (%d) different from implied by file size (%d)"; +char* SETUP_DELETE_013 = "Site %s record %d points to itself (previous)"; +char* SETUP_DELETE_014 = "Site %s record %d points to itself (next)"; +char* SETUP_DELETE_015 = "Site %s record %d points to already checked record"; + +/* parse_anonftp.c */ + +char* PARSE_ANONFTP_001 = "Can't open default log file"; +char* PARSE_ANONFTP_002 = "Can't open log file %s"; +char* PARSE_ANONFTP_003 = "No input file given"; +char* PARSE_ANONFTP_004 = "No output file given"; +char* PARSE_ANONFTP_005 = "Error while trying to set master database directory"; +char* PARSE_ANONFTP_006 = "Can't open input file %s"; +char* PARSE_ANONFTP_007 = "Error reading header of input file %s"; +char* PARSE_ANONFTP_008 = "Input file %s not in raw format. Cannot process"; +char* PARSE_ANONFTP_009 = "Can't get temporary name for file %s"; +char* PARSE_ANONFTP_010 = "Can't open temporary file %s"; +char* PARSE_ANONFTP_011 = "Error while writing header of output file"; +char* PARSE_ANONFTP_012 = "Can't execlp() filter program %s"; +char* PARSE_ANONFTP_013 = "Can't vfork() filter program %s"; +char* PARSE_ANONFTP_014 = "Error while in wait() for filter program %s"; +char* PARSE_ANONFTP_015 = "Filter program %s exited abnormally with exit code %d"; +char* PARSE_ANONFTP_016 = "Filter program %s terminated abnormally with signal %d"; +char* PARSE_ANONFTP_017 = "Can't close input file %s"; +char* PARSE_ANONFTP_018 = "Can't close temporary file %s"; +char* PARSE_ANONFTP_019 = "Can't execvp() parse program %s"; +char* PARSE_ANONFTP_020 = "Can't vfork() parse program %s"; +char* PARSE_ANONFTP_021 = "Error while in wait() for parse program %s"; +char* PARSE_ANONFTP_022 = "Parse program %s exited abnormally with code %d"; +char* PARSE_ANONFTP_023 = "Parse program %s terminated abnormally with signal %d"; +char* PARSE_ANONFTP_024 = "Can't rename output file %s"; +char* PARSE_ANONFTP_025 = "Can't unlink input file %s"; +char* PARSE_ANONFTP_026 = "Can't unlink temporary file %s"; +char* PARSE_ANONFTP_027 = "Can't malloc space for argument list"; +char* PARSE_ANONFTP_028 = "Can't rename failed temporary file %s to %s"; +char* PARSE_ANONFTP_029 = "Unable to parse access command in header"; + +/* net_anonftp.c */ + +char* NET_ANONFTP_001 = "Can't open default log file"; +char* NET_ANONFTP_002 = "Can't open log file %s"; +char* NET_ANONFTP_003 = "Error while trying to set master database directory"; +char* NET_ANONFTP_004 = "Error while trying to set anonftp database directory"; +char* NET_ANONFTP_005 = "Error while trying to set host database directory"; +char* NET_ANONFTP_006 = "Error while trying to open anonftp database"; +char* NET_ANONFTP_007 = "Error while trying to open host database"; +char* NET_ANONFTP_008 = "No host specified for output mode"; +char* NET_ANONFTP_009 = "Can't find requested host %s in local primary host database"; +char* NET_ANONFTP_010 = "Can't find requested host %s database %s in local auxiliary host database"; +char* NET_ANONFTP_012 = "Error sending anonftp site file"; +char* NET_ANONFTP_013 = "Error receiving anonftp site file"; +char* NET_ANONFTP_014 = "Broken pipe: remote data transfer process existed prematurely"; + + +char* GET_ANONFTP_SITE_001 = "Error reading header of remote site file"; +char* GET_ANONFTP_SITE_002 = "Error opening local site parser file %s"; +char* GET_ANONFTP_SITE_003 = "Error writing header of local site parser file %s"; +char* GET_ANONFTP_SITE_004 = "Can't open XDR stream for stdin"; +char* GET_ANONFTP_SITE_005 = "Error in translating XDR input. Deleting output file."; +char* GET_ANONFTP_SITE_006 = "Can't rename temporary file %s to %s"; +char* GET_ANONFTP_SITE_007 = "Can't unlink failed transfer file"; +char* GET_ANONFTP_SITE_008 = "Can't open pipe to uncompression program"; +char* GET_ANONFTP_SITE_009 = "Can't dup2 pipe to stdout"; +char* GET_ANONFTP_SITE_010 = "Can't execute uncompression program %s"; +char* GET_ANONFTP_SITE_011 = "Can't fork() for uncompression process"; +char* GET_ANONFTP_SITE_012 = "Can't open incoming pipe"; +char* GET_ANONFTP_SITE_013 = "Can't open XDR stream for fp"; +char* GET_ANONFTP_SITE_014 = "Can't fstat() output file %s"; +char* GET_ANONFTP_SITE_015 = "Transferred %d bytes in %d seconds (%6.2f bytes/sec)"; +char* GET_ANONFTP_SITE_016 = "Input for %s in compressed format"; +char* GET_ANONFTP_SITE_017 = "Input for %s not in compressed format"; +char* GET_ANONFTP_SITE_018 = "Can't open pipe to cat program"; +char* GET_ANONFTP_SITE_019 = "Can't execute cat program %s"; +char* GET_ANONFTP_SITE_020 = "Can't fork() for cat process %s"; + +char* SEND_ANONFTP_SITE_001= "Can't open anonftp database sitefile %s"; +char* SEND_ANONFTP_SITE_002= "Can't mmap anonftp database sitefile %s"; +char* SEND_ANONFTP_SITE_003= "Can't open XDR stream for stdout"; +char* SEND_ANONFTP_SITE_004= "Error translating site file to XDR stream"; +char* SEND_ANONFTP_SITE_005= "Can't open pipe to compression program"; +char* SEND_ANONFTP_SITE_006= "Can't dup2 pipe to stdin"; +char* SEND_ANONFTP_SITE_007= "Can't execute compression program %s"; +char* SEND_ANONFTP_SITE_008= "Can't open outgoing pipe"; +char* SEND_ANONFTP_SITE_009= "Can't open XDR stream for compression ftp"; +char* SEND_ANONFTP_SITE_010= "Can't fork() for compression process"; +char* SEND_ANONFTP_SITE_011= "Error while writing header of output file"; +char* SEND_ANONFTP_SITE_012= "Output for %s in compressed format"; + + +char* COPY_PARSER_TO_XDR_001= "Can't mmap strings file"; +char* COPY_PARSER_TO_XDR_002= "Conversion to XDR stream from raw format failed"; +char* COPY_PARSER_TO_XDR_003= "Conversion of string to XDR opaque type from raw format failed"; +char* COPY_PARSER_TO_XDR_004= "Can't umap strings file"; + +char* COPY_XDR_TO_PARSER_001= "Conversion to raw format from XDR format failed"; +char* COPY_XDR_TO_PARSER_002= "Can't write out parser record %d"; +char* COPY_XDR_TO_PARSER_003= "Conversion of string to parser from XDR format failed for record %d"; +char* COPY_XDR_TO_PARSER_004= "Can't write out parser string %s record %d"; + +/* update_anonftp.c */ + +char* UPDATE_ANONFTP_001 = "Can't open log file %s"; +char* UPDATE_ANONFTP_002 = "Can't open default log file"; +char* UPDATE_ANONFTP_003 = "No input file given"; +char* UPDATE_ANONFTP_004 = "Error while trying to set master database directory"; +char* UPDATE_ANONFTP_005 = "Error while trying to set anonftp database directory"; +char* UPDATE_ANONFTP_006 = "Can't open given input file %s"; +char* UPDATE_ANONFTP_007 = "Can't read header on %s"; +char* UPDATE_ANONFTP_008 = "Error while checking for lockfile %s"; +char* UPDATE_ANONFTP_009 = "Can't open lock file %s"; +char* UPDATE_ANONFTP_010 = "Update for %s (%s) at %s"; +char* UPDATE_ANONFTP_011 = "Giving up after %d tries to update %s"; +char* UPDATE_ANONFTP_012 = "Deleting %s"; +char* UPDATE_ANONFTP_013 = "Can't execvp() delete program %s for %s database"; +char* UPDATE_ANONFTP_014 = "Can't vfork() delete program %s"; +char* UPDATE_ANONFTP_015 = "Error while in wait() for delete program %s"; +char* UPDATE_ANONFTP_016 = "Delete program %s exited with value %u"; +char* UPDATE_ANONFTP_017 = "Delete program %s terminated abnormally with signal %u"; +char* UPDATE_ANONFTP_018 = "Inserting %s into %s with %s"; +char* UPDATE_ANONFTP_019 = "Can't execvp() insert program %s for %s database"; +char* UPDATE_ANONFTP_020 = "Can't vfork() insert program %s"; +char* UPDATE_ANONFTP_021 = "Error while in wait() for insert program %s"; +char* UPDATE_ANONFTP_022 = "Insert program %s exited with value %u"; +char* UPDATE_ANONFTP_023 = "Insert program %s terminated abnormally with signal %d"; +char* UPDATE_ANONFTP_025 = "Error while trying to open host database"; +char* UPDATE_ANONFTP_026 = "Can't get auxiliary database entry for site %s database %s for deletion"; +char* UPDATE_ANONFTP_027 = "Can't write deletion record for %s to auxiliary host database"; +char* UPDATE_ANONFTP_028 = "Waiting for lock file %s"; +char* UPDATE_ANONFTP_029 = "Can't unlink original input file %s"; +char* UPDATE_ANONFTP_030 = "Can't malloc space for argument list"; +char* UPDATE_ANONFTP_031 = "Input file %s has retrieve time older than current entry. Ignoring."; + +/* added on Aug-14-95 to accomodate the set-to-zero change in update_naonftp*/ +char* UPDATE_ANONFTP_032 = "Can't commit fail-count set to Zero for %s to auxiliary host database"; +char* UPDATE_ANONFTP_033 = "Can't get auxiliary database entry for site %s database %s for updating information"; + +/* check_anonftp.c */ + +char* CHECK_ANONFTP_001 = "Can't open default log file"; +char* CHECK_ANONFTP_002 = "Can't open log file %s"; +char* CHECK_ANONFTP_003 = "Error while trying to set master database directory"; +char* CHECK_ANONFTP_004 = "Error while trying to set anonftp database directory"; +char* CHECK_ANONFTP_005 = "Error while trying to set host database directory"; +char* CHECK_ANONFTP_006 = "Error while trying to open anonftp database"; +char* CHECK_ANONFTP_007 = "Error while trying to open host database"; +char* CHECK_ANONFTP_008 = "Can't find host %s in anonftp database"; +char* CHECK_ANONFTP_009 = "Can't malloc space for file list"; +char* CHECK_ANONFTP_010 = "Can't get list of files in directory %s" ; + +char* CHECK_INDIV_001 = "Can't get host address cache entry for %s"; +char* CHECK_INDIV_002 = "Checking site %s (%s)"; +char* CHECK_INDIV_003 = "Ignoring %s"; +char* CHECK_INDIV_004 = "Number of records in site file %s (%s) %d does not match auxiliary host database record %d"; +char* CHECK_INDIV_005 = "Can't malloc space for checklist"; +char* CHECK_INDIV_006 = "Site %s (%s) record %d points to itself!"; +char* CHECK_INDIV_007 = "Site %s (%s) record %d has string %s but is on chain for record %d with string %s"; +char* CHECK_INDIV_008 = "Site %s (%s) record %d has string index %d out of bounds"; +char* CHECK_INDIV_009 = "Site %s (%s) record %d has string %s but is on chain for record %d with string %s"; +char* CHECK_INDIV_010 = "Site %s (%s) rec %d -> rec %d -> site %s rec %d"; +char* CHECK_INDIV_011 = "Site %s (%s) record %d points to next record, out of bounds"; +char* CHECK_INDIV_012 = "Can't mmap strings file"; +char* CHECK_INDIV_013 = "Site %s (%s) record %d points to site file %s record %d"; +char* CHECK_INDIV_014 = "Site %s (%s) record %d points to site file %s record %d out of bounds (max: %d)"; +char* CHECK_INDIV_015 = "Site %s (%s) record %d (string offset: %d \"%s\") points to site file %s record %d (strings offset: %d \"%s\")"; +char* CHECK_INDIV_016 = "Site %s (%s) record %d points to site file %s record %d but not reverse (site %s record %d)"; +char* CHECK_INDIV_017 = "Can't mmap strings index file" ; +char* CHECK_INDIV_018 = "Site %s (%s) rec: %d -> strings id rec: %d out of bounds (max: %d)"; +char* CHECK_INDIV_019 = "Site %s (%s) rec: %d (off: %d \"%s\") -> strings idx rec: %d (off: %d, \"%s\") -> sitefile %s rec: %d"; +char* CHECK_INDIV_020 = "Site %s (%s) rec: %d (offset: %d \"%s\") -> strings index rec: %d -> inactive string (off: %d) \"%s\""; +char* CHECK_INDIV_021 = "Site %s (%s) rec: %d (off: %d \"%s\") -> strings idx rec: %d -> string (off: %d \"%s\")"; +char* CHECK_INDIV_022 = "Site %s (%s) rec %d -> site %s rec %d -> site %s rec %d"; + + + + diff --git a/archie/anonftp/parse/lang_anonftp.h b/archie/anonftp/parse/lang_anonftp.h new file mode 100644 index 0000000..38f743f --- /dev/null +++ b/archie/anonftp/parse/lang_anonftp.h @@ -0,0 +1,290 @@ +/* + * This file is copyright Bunyip Information Systems Inc., 1993. This file + * may not be reproduced, copied or transmitted by any means mechanical or + * electronic without the express written consent of Bunyip Information + * Systems Inc. + */ + + +#ifndef _LANG_ANONFTP_H_ +#define _LANG_ANONFTP_H_ + +extern char* INSERT_ANONFTP_001; +extern char* INSERT_ANONFTP_002; +extern char* INSERT_ANONFTP_003; +extern char* INSERT_ANONFTP_004; +extern char* INSERT_ANONFTP_005; +extern char* INSERT_ANONFTP_006; +extern char* INSERT_ANONFTP_007; +extern char* INSERT_ANONFTP_008; +extern char* INSERT_ANONFTP_009; +extern char* INSERT_ANONFTP_010; +extern char* INSERT_ANONFTP_011; +extern char* INSERT_ANONFTP_012; +extern char* INSERT_ANONFTP_013; +extern char* INSERT_ANONFTP_014; +extern char* INSERT_ANONFTP_015; +extern char* INSERT_ANONFTP_016; +extern char* INSERT_ANONFTP_017; +extern char* INSERT_ANONFTP_018; +extern char* INSERT_ANONFTP_019; +extern char* INSERT_ANONFTP_020; +extern char* INSERT_ANONFTP_021; +extern char* INSERT_ANONFTP_022; +extern char* INSERT_ANONFTP_023; +extern char* INSERT_ANONFTP_024; +extern char* INSERT_ANONFTP_025; +extern char* INSERT_ANONFTP_026; +extern char* INSERT_ANONFTP_027; +extern char* INSERT_ANONFTP_028; +extern char* INSERT_ANONFTP_029; + +extern char* SETUP_OUTPUT_FILE_001; +extern char* SETUP_OUTPUT_FILE_002; +extern char* SETUP_OUTPUT_FILE_003; +extern char* SETUP_OUTPUT_FILE_004; +extern char* SETUP_OUTPUT_FILE_005; +extern char* SETUP_OUTPUT_FILE_006; + + +/* setup_insert.c */ + + +extern char* ADD_TMP_STRING_001 ; + +extern char* SETUP_HASH_TABLE_001 ; + +extern char* SETUP_INSERT_001 ; +extern char* SETUP_INSERT_002 ; +extern char* SETUP_INSERT_003 ; +extern char* SETUP_INSERT_004 ; +extern char* SETUP_INSERT_005 ; +extern char* SETUP_INSERT_006 ; + +extern char* DO_INTERNAL_001 ; +extern char* DO_INTERNAL_002 ; +extern char* DO_INTERNAL_003 ; + +extern char* MAKE_LINKS_001 ; +extern char* MAKE_LINKS_002 ; +extern char* MAKE_LINKS_003 ; +extern char* MAKE_LINKS_004 ; +extern char* MAKE_LINKS_005 ; +extern char* MAKE_LINKS_006 ; +extern char* MAKE_LINKS_007 ; +extern char* MAKE_LINKS_008 ; +extern char* MAKE_LINKS_009 ; +extern char* MAKE_LINKS_010 ; +extern char* MAKE_LINKS_011 ; +extern char* MAKE_LINKS_012 ; +extern char* MAKE_LINKS_013 ; +extern char* MAKE_LINKS_014 ; +extern char* MAKE_LINKS_015 ; +extern char* MAKE_LINKS_016 ; +extern char* MAKE_LINKS_017 ; +extern char* MAKE_LINKS_018 ; +extern char* MAKE_LINKS_019 ; + +/* delete.c */ + +extern char* DELETE_ANONFTP_001 ; +extern char* DELETE_ANONFTP_002; +extern char* DELETE_ANONFTP_003; +extern char* DELETE_ANONFTP_004 ; +extern char* DELETE_ANONFTP_005 ; +extern char* DELETE_ANONFTP_006 ; +extern char* DELETE_ANONFTP_007 ; +extern char* DELETE_ANONFTP_008 ; +extern char* DELETE_ANONFTP_009 ; +extern char* DELETE_ANONFTP_010 ; +extern char* DELETE_ANONFTP_011 ; +extern char* DELETE_ANONFTP_012 ; +extern char* DELETE_ANONFTP_013 ; +extern char* DELETE_ANONFTP_014 ; + +/* setup_delete.c */ + +extern char* SETUP_DELETE_001 ; +extern char* SETUP_DELETE_002 ; +extern char* SETUP_DELETE_003 ; +extern char* SETUP_DELETE_004 ; +extern char* SETUP_DELETE_005 ; +extern char* SETUP_DELETE_006 ; +extern char* SETUP_DELETE_007 ; +extern char* SETUP_DELETE_008 ; +extern char* SETUP_DELETE_009 ; +extern char* SETUP_DELETE_010 ; +extern char* SETUP_DELETE_011 ; +extern char* SETUP_DELETE_012 ; +extern char* SETUP_DELETE_013 ; +extern char* SETUP_DELETE_014 ; +extern char* SETUP_DELETE_015 ; + +/* parse_anonftp.c */ + +extern char* PARSE_ANONFTP_001 ; +extern char* PARSE_ANONFTP_002 ; +extern char* PARSE_ANONFTP_003 ; +extern char* PARSE_ANONFTP_004 ; +extern char* PARSE_ANONFTP_005 ; +extern char* PARSE_ANONFTP_006 ; +extern char* PARSE_ANONFTP_007 ; +extern char* PARSE_ANONFTP_008 ; +extern char* PARSE_ANONFTP_009 ; +extern char* PARSE_ANONFTP_010 ; +extern char* PARSE_ANONFTP_011 ; +extern char* PARSE_ANONFTP_012 ; +extern char* PARSE_ANONFTP_013 ; +extern char* PARSE_ANONFTP_014 ; +extern char* PARSE_ANONFTP_015 ; +extern char* PARSE_ANONFTP_016 ; +extern char* PARSE_ANONFTP_017 ; +extern char* PARSE_ANONFTP_018 ; +extern char* PARSE_ANONFTP_019 ; +extern char* PARSE_ANONFTP_020 ; +extern char* PARSE_ANONFTP_021 ; +extern char* PARSE_ANONFTP_022 ; +extern char* PARSE_ANONFTP_023 ; +extern char* PARSE_ANONFTP_024 ; +extern char* PARSE_ANONFTP_025 ; +extern char* PARSE_ANONFTP_026 ; +extern char* PARSE_ANONFTP_027 ; +extern char* PARSE_ANONFTP_028 ; +extern char* PARSE_ANONFTP_029 ; + +/* net_anonftp.c */ + +extern char* NET_ANONFTP_001 ; +extern char* NET_ANONFTP_002 ; +extern char* NET_ANONFTP_003 ; +extern char* NET_ANONFTP_004 ; +extern char* NET_ANONFTP_005 ; +extern char* NET_ANONFTP_006 ; +extern char* NET_ANONFTP_007 ; +extern char* NET_ANONFTP_008 ; +extern char* NET_ANONFTP_009 ; +extern char* NET_ANONFTP_010 ; +extern char* NET_ANONFTP_011 ; +extern char* NET_ANONFTP_012 ; +extern char* NET_ANONFTP_013 ; +extern char* NET_ANONFTP_014 ; + +extern char* GET_ANONFTP_SITE_001 ; +extern char* GET_ANONFTP_SITE_002 ; +extern char* GET_ANONFTP_SITE_003 ; +extern char* GET_ANONFTP_SITE_004 ; +extern char* GET_ANONFTP_SITE_005 ; +extern char* GET_ANONFTP_SITE_006 ; +extern char* GET_ANONFTP_SITE_007 ; +extern char* GET_ANONFTP_SITE_008 ; +extern char* GET_ANONFTP_SITE_009 ; +extern char* GET_ANONFTP_SITE_010 ; +extern char* GET_ANONFTP_SITE_011 ; +extern char* GET_ANONFTP_SITE_012 ; +extern char* GET_ANONFTP_SITE_013 ; +extern char* GET_ANONFTP_SITE_014 ; +extern char* GET_ANONFTP_SITE_015 ; +extern char* GET_ANONFTP_SITE_016 ; +extern char* GET_ANONFTP_SITE_017 ; +extern char* GET_ANONFTP_SITE_018 ; +extern char* GET_ANONFTP_SITE_019 ; +extern char* GET_ANONFTP_SITE_020 ; + + +extern char* SEND_ANONFTP_SITE_001; +extern char* SEND_ANONFTP_SITE_002; +extern char* SEND_ANONFTP_SITE_003; +extern char* SEND_ANONFTP_SITE_004; +extern char* SEND_ANONFTP_SITE_005; +extern char* SEND_ANONFTP_SITE_006; +extern char* SEND_ANONFTP_SITE_007; +extern char* SEND_ANONFTP_SITE_008; +extern char* SEND_ANONFTP_SITE_009; +extern char* SEND_ANONFTP_SITE_010; +extern char* SEND_ANONFTP_SITE_011; +extern char* SEND_ANONFTP_SITE_012; + +extern char* COPY_PARSER_TO_XDR_001; +extern char* COPY_PARSER_TO_XDR_002; +extern char* COPY_PARSER_TO_XDR_003; +extern char* COPY_PARSER_TO_XDR_004; + +extern char* COPY_XDR_TO_PARSER_001; +extern char* COPY_XDR_TO_PARSER_002; +extern char* COPY_XDR_TO_PARSER_003; +extern char* COPY_XDR_TO_PARSER_004; + +/* update_anonftp.c */ + +extern char* UPDATE_ANONFTP_001 ; +extern char* UPDATE_ANONFTP_002 ; +extern char* UPDATE_ANONFTP_003 ; +extern char* UPDATE_ANONFTP_004 ; +extern char* UPDATE_ANONFTP_005 ; +extern char* UPDATE_ANONFTP_006 ; +extern char* UPDATE_ANONFTP_007 ; +extern char* UPDATE_ANONFTP_008 ; +extern char* UPDATE_ANONFTP_009 ; +extern char* UPDATE_ANONFTP_010 ; +extern char* UPDATE_ANONFTP_011 ; +extern char* UPDATE_ANONFTP_012 ; +extern char* UPDATE_ANONFTP_013 ; +extern char* UPDATE_ANONFTP_014 ; +extern char* UPDATE_ANONFTP_015 ; +extern char* UPDATE_ANONFTP_016 ; +extern char* UPDATE_ANONFTP_017 ; +extern char* UPDATE_ANONFTP_018 ; +extern char* UPDATE_ANONFTP_019 ; +extern char* UPDATE_ANONFTP_020 ; +extern char* UPDATE_ANONFTP_021 ; +extern char* UPDATE_ANONFTP_022 ; +extern char* UPDATE_ANONFTP_023 ; +extern char* UPDATE_ANONFTP_024 ; +extern char* UPDATE_ANONFTP_025 ; +extern char* UPDATE_ANONFTP_026 ; +extern char* UPDATE_ANONFTP_027 ; +extern char* UPDATE_ANONFTP_028 ; +extern char* UPDATE_ANONFTP_029 ; +extern char* UPDATE_ANONFTP_030 ; +extern char* UPDATE_ANONFTP_031 ; + +extern char* UPDATE_ANONFTP_032 ; +extern char* UPDATE_ANONFTP_033 ; + +/* check_anonftp.c */ + +extern char* CHECK_ANONFTP_001 ; +extern char* CHECK_ANONFTP_002 ; +extern char* CHECK_ANONFTP_003 ; +extern char* CHECK_ANONFTP_004 ; +extern char* CHECK_ANONFTP_005 ; +extern char* CHECK_ANONFTP_006 ; +extern char* CHECK_ANONFTP_007 ; +extern char* CHECK_ANONFTP_008 ; +extern char* CHECK_ANONFTP_009 ; +extern char* CHECK_ANONFTP_010 ; + +extern char* CHECK_INDIV_001 ; +extern char* CHECK_INDIV_002 ; +extern char* CHECK_INDIV_003 ; +extern char* CHECK_INDIV_004 ; +extern char* CHECK_INDIV_005 ; +extern char* CHECK_INDIV_006 ; +extern char* CHECK_INDIV_007 ; +extern char* CHECK_INDIV_008 ; +extern char* CHECK_INDIV_009 ; +extern char* CHECK_INDIV_010 ; +extern char* CHECK_INDIV_011 ; +extern char* CHECK_INDIV_012 ; +extern char* CHECK_INDIV_013 ; +extern char* CHECK_INDIV_014 ; +extern char* CHECK_INDIV_015 ; +extern char* CHECK_INDIV_016 ; +extern char* CHECK_INDIV_017 ; +extern char* CHECK_INDIV_018 ; +extern char* CHECK_INDIV_019 ; +extern char* CHECK_INDIV_020 ; +extern char* CHECK_INDIV_021 ; +extern char* CHECK_INDIV_022 ; + +#endif diff --git a/archie/anonftp/parse/lang_parsers.c b/archie/anonftp/parse/lang_parsers.c new file mode 100644 index 0000000..07cb73c --- /dev/null +++ b/archie/anonftp/parse/lang_parsers.c @@ -0,0 +1,127 @@ +/* new_Info_cell.c */ + +char* NEW_INFO_CELL_001 = "Error malloc'ing %ld bytes"; + +/* input.c */ + +char* INPUT_001 = "Error from fgets()"; + +/* output.c */ + +char* PRINT_CORE_INFO_001 = "Error fwrite'ing parser_entry_t structure" ; +char* PRINT_CORE_INFO_002 = "Error fwrite'ing file name"; +char* PRINT_CORE_INFO_003 = "Error fwrite'ing padding"; + +/* parse.c */ + +char* PARSE_ANONFTP_001 = "Can't open file %s for reading"; +char* PARSE_ANONFTP_002 = "Can't open file %s for writing"; +char* PARSE_ANONFTP_003 = "Error from read_header() file %s"; +char* PARSE_ANONFTP_004 = "Can't initialize line parser"; +char* PARSE_ANONFTP_005 = "Error from set_elt_type()"; +char* PARSE_ANONFTP_006 = "Can't initialize directory stack"; +char* PARSE_ANONFTP_007 = "Error trying to initialize root directory"; +char* PARSE_ANONFTP_008 = "Unexpected %s line #%d in listing"; +char* PARSE_ANONFTP_009 = "Error initializing directory stack with root directory"; +char* PARSE_ANONFTP_010 = "Unknown state = '%d' on line #%d"; +char* PARSE_ANONFTP_011 = "Error from S_handle_file() on line #%d: aborting"; +char* PARSE_ANONFTP_012 = "Error from handle_dir_start() on line #%d: aborting"; +char* PARSE_ANONFTP_013 = "Unknown state = '%d' on line #%d"; +char* PARSE_ANONFTP_014 = "Error at line #%d: '%s'"; +char* PARSE_ANONFTP_015 = "Error from output_header(): aborting"; +char* PARSE_ANONFTP_016 = "Error from check_stack() on line #%d: aborting"; +char* PARSE_ANONFTP_017 = "Can't open default log file"; +char* PARSE_ANONFTP_018 = "Can't open log file %s"; +char* PARSE_ANONFTP_019 = "Trying to figure out the root_dir %s"; +char* PARSE_ANONFTP_020 = "Cannot figure out root_dir due to usage of standard streams"; +char* PARSE_ANONFTP_021 = "Cannot determine the root_dir"; + +char* CHECK_STACK_001 = "Expected listing for the directory '%s' at the end"; +char* CHECK_STACK_002 = "Error removing queue element from top of stack"; + +char* HANDLE_DIR_START_001 = "Error from S_split_dir()"; +char* HANDLE_DIR_START_002 = "Error from pop() while looking for non-empty queue"; +char* HANDLE_DIR_START_003 = "directory '"; +char* HANDLE_DIR_START_004 = "' was not previously declared.\n"; +char* HANDLE_DIR_START_005 = "Error removing queue element from top of stack"; +char* HANDLE_DIR_START_006 = "Error from push()"; +char* HANDLE_DIR_START_007 = "Error expected listing for directory %s on line %d"; + + +char* HANDLE_FILE_001 = "Error allocating space for parser record"; +char* HANDLE_FILE_002 = "Error from S_file_parse(), line %d"; +char* HANDLE_FILE_003 = "Error strdup'ing directory name"; +char* HANDLE_FILE_004 = "Error adding directory to queue"; +char* HANDLE_FILE_005 = "Error strdup'ing file name"; +char* HANDLE_FILE_006 = "Error from write_header()"; + +char* PARSER_OUTPUT_001 = "Error from first_elt()"; +char* PARSER_OUTPUT_002 = "Error from print_core_info()"; + +char* USAGE_001 = "Usage: %s [-h] [-i ] [-o ] [-p ] [-r ]"; + +/* queue.c */ + +char* NEW_QUEUE_ELT_001 = "Error allocating %d bytes for new queue element"; +char* NEW_QUEUE_ELT_002 = "Error from init_Info_cell()"; + +/* stack.c */ + +char* INIT_STACK_001 = "Root directory '%s' doesn't match pattern"; +char* INIT_STACK_002 = "Error from S_split_dir()"; +char* INIT_STACK_003 = "Error strdup'ing '%s'"; +char* INIT_STACK_004 = "Error from new_Info_cell()"; +char* INIT_STACK_005 = "Error from push()"; + +char* NEW_STACK_001 = "Error allocating %d bytes for new stack element"; + +char* POP_001 = "Stack is empty"; +char* POP_002 = "Queue is not empty"; +char* POP_003 = "Error from dispose_Info_cell()"; + +char* PRINT_STACK_001 = "Stack is empty"; + +char* PUSH_001 = "Error from new_Stack()"; + +/* unix.c */ + +char* U_S_FILE_PARSE_001 = "Error looking for white space after %s"; +char* U_S_FILE_PARSE_002 = "Missing file name"; +char* U_S_FILE_PARSE_003 = "Error from "; +char* U_S_FILE_PARSE_004 = "Error extracting field"; +char* U_S_FILE_PARSE_005 = "Error from S_file_type()"; +char* U_S_FILE_PARSE_006 = "can't find ` -> ' in name field of `%s' (line #%d)"; + +char* S_SPLIT_DIR_001 = "Expected ':' at end of path, but found '%c'"; + +/* unix2.c */ + +char* U2DB_TIME_001 = "Error in date '%s'"; +char* U2DB_TIME_002 = "Error in time '%s'"; +char* U2DB_TIME_003 = "Error in year '%s'"; +char* U2DB_TIME_004 = "Day-of-month or year value error in '%s %s %s'"; +char* U2DB_TIME_005 = "Hour or minute value error in '%s'"; +char* U2DB_TIME_006 = "Error from timelocal()"; +char* U2DB_TIME_007 = "Error from timegm()"; + +char* U2DB_PERM_001 = "Unknown permission character %c, line %s"; + +/* vms.c */ + +char* S_DUP_DIR_NAME_001 = "'%S' doesn't contain a '.'"; + +char* V_S_FILE_PARSE_001 = "Error looking for white space after %s"; +char* V_S_FILE_PARSE_002 = "Error extracting field"; +char* V_S_FILE_PARSE_003 = "Error from S_file_type()"; + +char* S_FILE_TYPE_001 = "Can't find '.' in file name '%s'"; + +/* vms2.c */ + +char* V2DB_DATE_001 = "Error in date '%s'"; +char* V2DB_DATE_002 = "Error in time '%s'"; +char* V2DB_DATE_003 = "Day-of-month or year value error in '%s'"; +char* V2DB_DATE_004 = "Hour or minute value error in '%s'"; +char* V2DB_DATE_005 = "Error from timegm()"; + +char* V2DB_ONE_SET_PERM_001 = "Unexpected character ('%c') in permissions '%s'"; diff --git a/archie/anonftp/parse/lang_parsers.h b/archie/anonftp/parse/lang_parsers.h new file mode 100644 index 0000000..092c092 --- /dev/null +++ b/archie/anonftp/parse/lang_parsers.h @@ -0,0 +1,123 @@ +extern char* NEW_INFO_CELL_001 ; + +extern char* INPUT_001 ; + +/* output.c */ + +extern char* PRINT_CORE_INFO_001 ; +extern char* PRINT_CORE_INFO_002 ; +extern char* PRINT_CORE_INFO_003 ; + +/* parse.c */ + +extern char* PARSE_ANONFTP_001 ; +extern char* PARSE_ANONFTP_002 ; +extern char* PARSE_ANONFTP_003 ; +extern char* PARSE_ANONFTP_004 ; +extern char* PARSE_ANONFTP_005 ; +extern char* PARSE_ANONFTP_006 ; +extern char* PARSE_ANONFTP_007 ; +extern char* PARSE_ANONFTP_008 ; +extern char* PARSE_ANONFTP_009 ; +extern char* PARSE_ANONFTP_010 ; +extern char* PARSE_ANONFTP_011 ; +extern char* PARSE_ANONFTP_012 ; +extern char* PARSE_ANONFTP_013 ; +extern char* PARSE_ANONFTP_014 ; +extern char* PARSE_ANONFTP_015 ; +extern char* PARSE_ANONFTP_016 ; +extern char* PARSE_ANONFTP_017 ; +extern char* PARSE_ANONFTP_018 ; +extern char* PARSE_ANONFTP_019 ; +extern char* PARSE_ANONFTP_020 ; +extern char* PARSE_ANONFTP_021 ; + +extern char* CHECK_STACK_001 ; +extern char* CHECK_STACK_002 ; + +extern char* HANDLE_DIR_START_001 ; +extern char* HANDLE_DIR_START_002 ; +extern char* HANDLE_DIR_START_003 ; +extern char* HANDLE_DIR_START_004 ; +extern char* HANDLE_DIR_START_005 ; +extern char* HANDLE_DIR_START_006 ; +extern char* HANDLE_DIR_START_007 ; + + +extern char* HANDLE_FILE_001 ; +extern char* HANDLE_FILE_002 ; +extern char* HANDLE_FILE_003 ; +extern char* HANDLE_FILE_004 ; +extern char* HANDLE_FILE_005 ; +extern char* HANDLE_FILE_006 ; + +extern char* PARSER_OUTPUT_001 ; +extern char* PARSER_OUTPUT_002 ; + +extern char* USAGE_001 ; + +/* queue.c */ + +extern char* NEW_QUEUE_ELT_001 ; +extern char* NEW_QUEUE_ELT_002 ; + +/* stack.c */ + +extern char* INIT_STACK_001 ; +extern char* INIT_STACK_002 ; +extern char* INIT_STACK_003 ; +extern char* INIT_STACK_004 ; +extern char* INIT_STACK_005 ; + +extern char* NEW_STACK_001 ; + +extern char* POP_001 ; +extern char* POP_002 ; +extern char* POP_003 ; + +extern char* PRINT_STACK_001 ; + +extern char* PUSH_001 ; + +/* unix.c */ + +extern char* U_S_FILE_PARSE_001 ; +extern char* U_S_FILE_PARSE_002 ; +extern char* U_S_FILE_PARSE_003 ; +extern char* U_S_FILE_PARSE_004 ; +extern char* U_S_FILE_PARSE_005 ; +extern char* U_S_FILE_PARSE_006 ; + +extern char* S_SPLIT_DIR_001 ; + +/* unix2.c */ + +extern char* U2DB_TIME_001 ; +extern char* U2DB_TIME_002 ; +extern char* U2DB_TIME_003 ; +extern char* U2DB_TIME_004 ; +extern char* U2DB_TIME_005 ; +extern char* U2DB_TIME_006 ; +extern char* U2DB_TIME_007 ; + +extern char* U2DB_PERM_001 ; + +/* vms.c */ + +extern char* S_DUP_DIR_NAME_001 ; + +extern char* V_S_FILE_PARSE_001 ; +extern char* V_S_FILE_PARSE_002 ; +extern char* V_S_FILE_PARSE_003 ; + +extern char* S_FILE_TYPE_001 ; + +/* vms2.c */ + +extern char* V2DB_DATE_001 ; +extern char* V2DB_DATE_002 ; +extern char* V2DB_DATE_003 ; +extern char* V2DB_DATE_004 ; +extern char* V2DB_DATE_005 ; + +extern char* V2DB_ONE_SET_PERM_001 ; diff --git a/archie/anonftp/parse/line_type.h b/archie/anonftp/parse/line_type.h new file mode 100644 index 0000000..b409b78 --- /dev/null +++ b/archie/anonftp/parse/line_type.h @@ -0,0 +1,41 @@ +#ifndef LINE_TYPE_H +#define LINE_TYPE_H + +#include "site_file.h" + +#ifdef __STDC__ + +extern char *S_dup_dir_name(const char *name) ; +extern char *S_file_parse(char *in, parser_entry_t *pe, int *is_dir) ; +extern int S_file_type(const char *s, int *is_dir) ; +extern int S_handle_file(char *line, int state) ; +extern int S_init_parser(void) ; +extern int S_line_type(const char *line) ; +extern int S_split_dir(char *str, char *prep_dir, int *dev, int *n, char ***p) ; + +#else + +extern char *S_dup_dir_name(/* const char *name */) ; +extern char *S_file_parse(/* char *in, parser_entry_t *pe, int *is_dir */) ; +extern int S_file_type(/* const char *s, int *is_dir */) ; +extern int S_handle_file(/* char *line, int state */) ; +extern int S_init_parser(/* void */) ; +extern int S_line_type(/* const char *line */) ; +extern int S_split_dir(/* char *str, char *prep_dir, int *dev, int *n, char ***p */) ; + +#endif + +#define L_BLANK 0 +#define L_CONT 1 +#define L_DIR_START 2 +#define L_ERROR 3 +#define L_FILE 4 +#define L_PARTIAL 5 +#define L_TOTAL 6 +#define L_UNREAD 7 +#define L_UNKNOWN 8 /* code depends on this being the last valid value */ + +#define L_NUM_ELTS (L_UNKNOWN + 1) +#define L_INTERN_ERR L_NUM_ELTS + +#endif diff --git a/archie/anonftp/parse/mem_debug.c b/archie/anonftp/parse/mem_debug.c new file mode 100644 index 0000000..0fba369 --- /dev/null +++ b/archie/anonftp/parse/mem_debug.c @@ -0,0 +1,96 @@ +/* + Note: the debugging routines use the file /usr/lib/debug/malloc.o. +*/ + +#ifdef MEMORY_DEBUG + +#include +#include +#include +#include + +#define DEBUG_LEVEL 2 + +#ifdef __STDC__ + +extern void *memcpy(void *s1, const void *s2, size_t n) ; /* lacking real ANSI includes */ +extern int malloc_debug(int level) ; +extern int malloc_verify(void) ; + +#else + +extern void *memcpy(/* void *s1, const void *s2, size_t n */) ; /* lacking real ANSI includes */ +extern int malloc_debug(/* int level */) ; +extern int malloc_verify(/* void */) ; + +#endif + + +static int debug_level = -1 ; + + +int +Free(ptr) + void *ptr ; +{ + int rval ; + + if( ! (rval = (free)(ptr))) + { + error(A_SYSERR, "Free", "error from free(0x%lx)", (long)ptr) ; + } + else + { + error(A_SYSERR, "Free", "free(0x%lx)", (long)ptr) ; + } + return rval ; +} + + +void * +Malloc(size) + size_t size ; +{ + void *rval ; + + if(debug_level == -1) + { + error(A_SYSERR, "Malloc", "setting debug level to %d", DEBUG_LEVEL) ; + debug_level = DEBUG_LEVEL ; + malloc_debug(debug_level) ; + } + if((rval = (malloc)(size)) == (void *)0) + { + error(A_SYSERR, "Malloc", "failed to malloc %ld bytes", (long)size) ; + } + else + { + error(A_SYSERR, "Malloc", "malloc\'ed %ld bytes at location 0x%lx", (long)size, + (long)rval) ; + } + return rval ; +} + + +void * +Memcpy(dst, src, size) + void *dst ; + void *src ; + size_t size ; +{ + void *rval ; + + if((rval = (memcpy)(dst, src, size)) != dst) + { + error(A_ERR, "Memcpy", "error from memcpy(%ld, %ld, %ld)",(long)dst, (long)src, + (long)size) ; + } + else + { + error(A_ERR, "Memcpy", "memcpy(%ld, %ld, %ld) successful", (long)dst, (long)src, + (long)size) ; + } + return rval ; +} + +#endif diff --git a/archie/anonftp/parse/mem_debug.h b/archie/anonftp/parse/mem_debug.h new file mode 100644 index 0000000..b400087 --- /dev/null +++ b/archie/anonftp/parse/mem_debug.h @@ -0,0 +1,37 @@ +#ifndef MEM_DEBUG_H +#define MEM_DEBUG_H + +#ifdef __STDC__ +#include +#endif + +#ifdef MEMORY_DEBUG +#define free Free +#define malloc Malloc +#define memcpy Memcpy + +#ifdef __STDC__ + +extern int Free(void *ptr) ; +extern void *Malloc(size_t size) ; +extern void *Memcpy(void *dst, void *src, size_t size) ; + +#else + +extern int Free(/* void *ptr */) ; +extern void *Malloc(/* size_t size */) ; +extern void *Memcpy(/* void *dst, void *src, size_t size */) ; + +#endif + +#define mck \ + do { \ + fprintf(stderr, "%s: malloc_verify at line %d in file %s: ", prog, __LINE__, __FILE__) ; \ + fprintf(stderr, "%s\n", malloc_verify() ? "okay" : "failed") ; \ + } while(0) + +#else +#define mck +#endif + +#endif diff --git a/archie/anonftp/parse/novell.c b/archie/anonftp/parse/novell.c new file mode 100644 index 0000000..be5aec1 --- /dev/null +++ b/archie/anonftp/parse/novell.c @@ -0,0 +1,373 @@ +#include +#include +#include +#include "../regex/regexp.h" +#include "defines.h" +#include "parser_file.h" +#include "parse.h" +#include "utils.h" +#include "queue.h" +#include "stack.h" +#include "output.h" +#include "line_type.h" +#include "storage.h" +#include "pars_ent_holder.h" +#include "unix2.h" +#include "error.h" +#include "lang_parsers.h" +#ifdef SOLARIS +#include "protos.h" +#endif + +#define S_BLANK "^$" +#define S_CONT (regexp *)0 ; +#define S_DIR_START "^/?[^/]+(/[^/]+)*:$" +#define S_ERROR (regexp *)0 ; +#define S_FILE "^[-d][[][-R][-W][-C][-E][-M][-F][-A][]][ \t]+" +#define S_PARTIAL (regexp *)0 ; +#define S_TOTAL "^total:[ \t]+[0-9]+" +#define S_UNREAD "^[^ \t]+[ \t]+unreadable$" +#define S_UNKNOWN (regexp *)0 ; + +enum /* declared as enum to make debugging easier */ +{ + F_PERM = 0, + F_LINKS, + F_OWNER, + F_GROUP, + F_SIZE, + F_MONTH, + F_DAY, + F_T_Y, /* time (16:36) or year (1992) */ + F_NAME, + UNIX_NUM_FLDS /* this must be last */ +} ; + +static regexp *re[L_NUM_ELTS] ; + +static int leading_blanks = -1; + +char *S_dup_dir_name(name) + const char *name ; +{ + return strdup(name) ; +} + + +/* + Given a file line (see below for example) produce a core site entry + and return a pointer to the file name. Return a null pointer upon + an error. + + The input string will be overwritten. + + An input line looks something like: + + -rw------- 1 news 1630 Mar 18 16:15 #alt.music.alternative~ + + as well, a group name may be present and/or the time may be specified + differently: + + -rw-r--r-- 1 news 12 Jul 11 1991 .rhosts + or + -rw-r--r-- 1 news news 12 Jul 11 1991 .rhosts + + Then again, we may have a device with major and minor numbers in place of + the size: + + crw-rw-rw- 1 0 1 3, 12 Mar 19 17:03 zero +*/ + +char *S_file_parse(in, pe, is_dir) + char *in ; + parser_entry_t *pe ; + int *is_dir ; +{ + char *field[UNIX_NUM_FLDS] ; + char *p = in ; + int is_symlink = 0; + int num_blanks = 0; + + ptr_check(in, char, "S_file_parse", (char *)0) ; + ptr_check(pe, parser_entry_t, "S_file_parse", (char *)0) ; + +#define try_get_field(fld, instr, fldname) \ + do \ + { \ + instr += strspn(instr, WHITE_STR) ; \ + if((field[fld] = strsep(&instr, WHITE_STR)) == (char *)0) \ + { \ + /* "Error looking for white space after %s" */\ + error(A_ERR, "S_file_parse", U_S_FILE_PARSE_001, fldname) ; \ + return (char *)0 ; \ + } \ + } while(0) + + try_get_field(F_PERM, p, "permissions") ; + try_get_field(F_LINKS, p, "links") ; + try_get_field(F_OWNER, p, "owner") ; + + if(*field[F_PERM] == 'b' || *field[F_PERM] == 'c') /* devices */ + { + try_get_field(F_GROUP, p, "group or major number") ; + if(*(field[F_GROUP] + strlen(field[F_GROUP]) - 1) == ',') /* is major number */ + { + /* there is no group -- toss the major and minor numbers */ + + try_get_field(F_GROUP, p, "minor number") ; + field[F_GROUP] = (char *)0 ; + } + else /* is group */ + { + /* there is a group -- still toss the major and minor numbers */ + + try_get_field(F_NAME, p, "major number") ; + try_get_field(F_NAME, p, "minor number") ; + } + field[F_SIZE] = "0" ; + try_get_field(F_MONTH, p, "month") ; + } + else /* non-devices */ + { + is_symlink = *field[F_PERM] == 'l'; + + try_get_field(F_GROUP, p, "group or size") ; /* may be size */ + try_get_field(F_SIZE, p, "size or month") ; /* may be month */ + + if(isdigit(*field[F_SIZE])) /* there was a group field */ + { + try_get_field(F_MONTH, p, "month") ; + } + else /* no group field -- group was size, size was month */ + { + field[F_MONTH] = field[F_SIZE] ; + field[F_SIZE] = field[F_GROUP] ; + field[F_GROUP] = (char *)0 ; + } + } + + try_get_field(F_DAY, p, "day") ; + try_get_field(F_T_Y, p, "time or year") ; + + num_blanks = strspn(p, WHITE_STR); /* Assume that there is 1 separating */ + if ( leading_blanks > num_blanks ) { + leading_blanks = num_blanks; + error(A_INFO,"S_file_parse", "Confused by leading blank characters, will restart and try to be more intelligent !"); + return 0; + } + if ( leading_blanks == -1 ) + leading_blanks = num_blanks; + + p+= leading_blanks; + + + field[F_NAME] = p ; + if(*field[F_NAME] == '\0') + { + + /* "Missing file name" */ + + error(A_ERR, "S_file_parse", U_S_FILE_PARSE_002) ; + return (char *)0 ; + } + + /* + If the file is a symbolic link, put a nul at the first occurrence + of " -> ". + */ + if (is_symlink) + { + char *p; + + if ( ! (p = strstr(field[F_NAME], " -> "))) + { + error(A_WARN, "S_file_parse", U_S_FILE_PARSE_006, in, line_num()); + } + else + { + *p = '\0'; + } + } + +#ifdef __STDC__ + +#define try_cvt_str(s) if( ! (s)) do { error(A_ERR, "S_file_parse", "Error from " #s "\n") ; return (char *)0 ; } while(0) +#else + +/* "Error extracting field" */ + +#define try_cvt_str(s) if( ! (s)) do { error(A_ERR, "S_file_parse", U_S_FILE_PARSE_004) ; return (char *)0 ; } while(0) +#endif + + try_cvt_str(u2db_perm(field[F_PERM], &pe->core)) ; + try_cvt_str(u2db_owner(field[F_OWNER], field[F_GROUP], &pe->core)) ; + try_cvt_str(u2db_size(field[F_SIZE], &pe->core)) ; + try_cvt_str(u2db_time(field[F_MONTH], field[F_DAY], field[F_T_Y], &pe->core)) ; + + pe->slen = strlen(field[F_NAME]) ; /* when writing we don't include the nul terminator */ + + /* Is it an entry for a directory? */ + + if( ! S_file_type(field[F_PERM], is_dir)) + { + + /* "Error from S_file_type()" */ + + error(A_ERR, "S_file_parse", U_S_FILE_PARSE_005) ; + return (char *)0 ; + } + return field[F_NAME] ; + +#undef try_get_field +#undef try_cvt_str +} + + +int S_file_type(s, is_dir) + const char *s ; + int *is_dir ; +{ + ptr_check(s, char, "S_file_type", 0) ; + ptr_check(is_dir, int, "S_file_type", 0) ; + + *is_dir = ((*s == 'd') || (*s == 'D')); + return 1 ; +} + + +int S_init_parser() +{ + re[L_BLANK] = regcomp(S_BLANK) ; + re[L_CONT] = S_CONT ; + re[L_DIR_START] = regcomp(S_DIR_START) ; + re[L_ERROR] = S_ERROR ; + re[L_FILE] = regcomp(S_FILE) ; + re[L_PARTIAL] = S_PARTIAL ; + re[L_TOTAL] = regcomp(S_TOTAL) ; + re[L_UNREAD] = regcomp(S_UNREAD) ; + re[L_UNKNOWN] = S_UNKNOWN ; + + return 1 ; +} + + +#ifdef DEBUG +# define dbg_show(t) error(A_INFO,"(unknown)", "D: %s '%s'\n", t, line) ; +#else +# define dbg_show(t) /* nothing */ +#endif + +int S_line_type(line) + const char *line ; +{ + ptr_check(line, char, "S_line_type", L_INTERN_ERR) ; + + if(regexec(re[L_FILE], line)) + { + dbg_show("file") ; + return L_FILE ; + } + else if(regexec(re[L_BLANK], line)) + { + dbg_show("blank") ; + return L_BLANK ; + } + else if(regexec(re[L_DIR_START], line)) + { + dbg_show("dir_start") ; + return L_DIR_START ; + } + else if(regexec(re[L_TOTAL], line)) + { + dbg_show("total") ; + return L_TOTAL ; + } + else if(regexec(re[L_UNREAD], line)) + { + dbg_show("unreadable") ; + return L_UNREAD ; + } + else + { + dbg_show("unknown") ; + return L_UNKNOWN ; + } +} + + +/* + Split a directory path name into its components. + + Return a pointer to an array of pointers into 'str', where each element + points to the start of a file name in the path. The number of path elements + will be returned in 'n'. If this type of listing has device name prefixes, + then '*dev' will point to it. + + The string will be overwritten. + + If an error occurs return a null pointer. +*/ + +int S_split_dir(str, prep_dir, dev, n, p) + char *str ; + char *prep_dir ; + int *dev ; + int *n ; + char ***p ; +{ + static char *path[MAX_PATH_ELTS + 1] ; + char *s = str ; + int i = 0 ; + + ptr_check(str, char, "S_split_dir", 0) ; + ptr_check(dev, int, "S_split_dir", 0) ; + ptr_check(n, int, "S_split_dir", 0) ; + ptr_check(p, char **, "S_split_dir", 0) ; + + *dev = 0 ; /* UNIX sites don't have a device name prefix */ + if(prep_dir != (char *)0) + { + path[i++] = prep_dir ; + } + if(*s == '/') /* any leading / is meaningless to us */ + { + s++ ; + } + path[i++] = s ; + while(*s != '\0') + { + if(*s != '/') + { + *s = tolower(*s); + s++ ; + } + else + { + *s++ = '\0' ; + path[i++] = s ; + } + } + if(*--s == ':') /* knock off the trailing colon from the file name */ + { + *s = '\0' ; + } + else + { + + /* "Expected ':' at end of path, but found '%c'" */ + + error(A_ERR, "S_split_dir", S_SPLIT_DIR_001, *s) ; + return 0 ; + } + *n = i ; + *p = path ; + return 1 ; +} + + +int set_blanks(num) + int num; +{ + if (leading_blanks != -1 ) + leading_blanks -= num; +} diff --git a/archie/anonftp/parse/novell2.c b/archie/anonftp/parse/novell2.c new file mode 100644 index 0000000..ed9ab1e --- /dev/null +++ b/archie/anonftp/parse/novell2.c @@ -0,0 +1,331 @@ +#include +#include +#include +#if defined(AIX) || defined(SOLARIS) +#include +#include +#endif +#include "defines.h" +#include "parse.h" +#include "site_file.h" +#include "unix2.h" +#include "error.h" +#include "lang_parsers.h" + +/* + 'mon' points to the first character of the month string. + + E.g. "Mar" + + 'day' points to the first character of the day string. + + E.g. "25" + + 't_y' points to the first character of the "time or year" string. + + E.g. "13:51" or "1992" + + Assume: time_t is the number of seconds since 00:00:00 Jan 1, 1970 GMT. ANSI does not + guarantee this. +*/ + +int +u2db_time(mon, day, t_y, cse) + const char *mon ; + const char *day ; + const char *t_y ; + core_site_entry_t *cse ; +{ + extern int local_timezone; + + static char *months[13] = { "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", + "Aug", "Sep", "Oct", "Nov", "Dec", (char *)0 } ; + static struct tm *mytime; + int dm ; + int hr ; + int m = 0 ; + int min ; + int y ; + struct tm bd_time ; /* broken down time */ + time_t ltime; + time_t the_time ; + +#if defined(AIX) || defined(SOLARIS) + + extern long timezone; + +#else + + extern time_t time(); + struct tm *our_time ; /* broken down time */ + +#endif + + ptr_check(mon, char, "u2db_time", 0) ; + ptr_check(day, char, "u2db_time", 0) ; + ptr_check(t_y, char, "u2db_time", 0) ; + ptr_check(cse, core_site_entry_t, "u2db_time", 0) ; + + if(mytime == (struct tm *) NULL){ + the_time = time((time_t *) NULL); + + + if((mytime = (struct tm *) malloc(sizeof(struct tm))) == (struct tm *) NULL){ + + error(A_SYSERR, "u2db_time", "Can't malloc space for time structure"); + return 0; + } + + memcpy(mytime, gmtime(&the_time), sizeof(struct tm)); + } + + while(months[m] != (char *)0) + { + if(strncmp(mon, months[m], 4) == 0) + { + break ; + } + else + { + m++ ; + } + } + if(m == 12) + { + return 0 ; + } + + if(sscanf(day, "%d", &dm) != 1) + { + + /* "Error in date '%s'" */ + + error(A_ERR, "u2db_time", U2DB_TIME_001, day) ; + return 0 ; + } + if(t_y[2] == ':') + { + if(sscanf(t_y, "%2d:%2d", &hr, &min) != 2) + { + + /* "Error in time '%s'" */ + + error(A_ERR, "u2db_time", U2DB_TIME_002, t_y) ; + return 0 ; + } + + + if(mytime -> tm_mon - m < 6 ){ + if(mytime -> tm_mon - m < 0 ) + y = mytime -> tm_year + 1900 - 1; + else + y = mytime -> tm_year + 1900; + } + else + y = mytime -> tm_year + 1900; + + } + else + { + if(sscanf(t_y, "%d", &y) != 1) + { + + /* "Error in year '%s'" */ + + error(A_ERR, "u2db_time", U2DB_TIME_003, t_y) ; + return 0 ; + } + hr = 0 ; + min = 0 ; + } + if(dm < 1 || dm > 31 || y < 1900) + { + + +/* "Day-of-month or year value error in '%s %s %s'" */ + + error(A_ERR, "u2db_time", U2DB_TIME_004, mon, day, t_y) ; + return 0 ; + } + +#if defined(AIX) || defined(SOLARIS) + + /* AIX can't handle dates less than 1970, so reset them to that */ + + if(y < 1970) + y = 1970; + +#endif + + if(hr < 0 || hr > 23 || min < 0 || min > 59) + { + + + /* "Hour or minute value error in '%s'" */ + + error(A_ERR, "u2db_time", U2DB_TIME_005, t_y) ; + return 0 ; + } + else + { + time_t timenow; + + memset((void *)&bd_time, 0, sizeof bd_time) ; + bd_time.tm_sec = 0 ; + bd_time.tm_min = min ; + bd_time.tm_hour = hr ; + bd_time.tm_mday = dm ; + bd_time.tm_mon = m ; + bd_time.tm_year = y - 1900 ; + bd_time.tm_isdst = -1 ; + +#if !defined(AIX) && !defined(SOLARIS) + + timenow = time((time_t *) NULL); + + our_time = localtime(&timenow); + + ltime = our_time -> tm_gmtoff + local_timezone; + + + if((the_time = timelocal(&bd_time)) == -1) + { + + /* "Error from timelocal()" */ + + error(A_ERR, "u2db_time", U2DB_TIME_006) ; + + /* reset the time to "now" */ + + the_time = time((time_t) NULL); + } + +#else + + ltime = (timezone * timezone_sign()) + local_timezone; + + + if((the_time = mktime(&bd_time)) == -1) + { + + /* "Error from timegm()" */ + + error(A_ERR, "u2db_time", U2DB_TIME_007) ; + return 0 ; + } + +#endif + + + cse->date = the_time + ltime; + } + return 1 ; +} + + +int +u2db_links(v, cse) + const char *v ; + core_site_entry_t *cse ; +{ + ptr_check(v, char, "u2db_links", 0) ; + ptr_check(cse, core_site_entry_t, "u2db_links", 0) ; + return 1 ; +} + + +int +u2db_name(v, cse) + const char *v ; + core_site_entry_t *cse ; +{ + ptr_check(v, char, "u2db_name", 0) ; + ptr_check(cse, core_site_entry_t, "u2db_name", 0) ; + return 1 ; +} + + +int +u2db_owner(u, v, cse) + const char *u ; + const char *v ; + core_site_entry_t *cse ; +{ + ptr_check(u, char, "u2db_owner", 0) ; + /* v (group) may be null */ + ptr_check(cse, core_site_entry_t, "u2db_owner", 0) ; + return 1 ; +} + + +int +u2db_perm(v, cse) + const char *v ; + core_site_entry_t *cse ; +{ + int i, j; + perms_t perms = 0 ; + + ptr_check(v, char, "u2db_perm", 0) ; + ptr_check(cse, core_site_entry_t, "u2db_perm", 0) ; + + for(i=0, j = 9 ; i < 9 ;i++, j--) + { + switch(v[j]) + { + case 'R': + perms |= (0x01 << 2) | (0x01 << 5) | (0x01<< 8); /* like r--r--r-- */ + break; + case 'W': + perms |= (0x01 << 1) | (0x01 << 4) | (0x01<<7); /* like -w--w--w- */ + break; + case 'C': + perms |= (0x01 << 2) | (0x01 << 5) | (0x01<< 8); /* like r--r--r-- */ + perms |= (0x01 << 1) | (0x01 << 4) | (0x01<<7); /* like -w--w--w- */ + break ; + + case 'F': + if ( CSE_IS_DIR((*cse)) ) { + perms |=( 0x01 << 0 | 0x01 << 3 | 0x01 << 6 ); + } + break; + case 'E': + case 'M': + case 'A': + case '-': + case '[': + case ']': + break; + + default: + + /* "Unknown permission character %c, line %s" */ + + error(A_ERR, "u2db_perm", U2DB_PERM_001, v[j], v) ; + return 0 ; + } + } + + cse->perms = perms ; + return 1 ; +} + + +int +u2db_size(v, cse) + const char *v ; + core_site_entry_t *cse ; +{ + ptr_check(v, char, "u2db_size", 0) ; + ptr_check(cse, core_site_entry_t, "u2db_size", 0) ; + + if( ! isdigit((int)*v)) + { + return 0 ; + } + else + { + cse->size = atoi(v) ; + return 1 ; + } +} diff --git a/archie/anonftp/parse/output.c b/archie/anonftp/parse/output.c new file mode 100644 index 0000000..141e79e --- /dev/null +++ b/archie/anonftp/parse/output.c @@ -0,0 +1,62 @@ +#include +#include +#include +#include +#include +#include "protos.h" +#include "parse.h" +#include "parser_file.h" +#include "output.h" +#include "lang_parsers.h" +#include "error.h" + +/* + Write a parser entry, followd by the file name to the output file. The + file name is padded (with Satanic messages, when viewed backwards) to a + multiple of 4 bytes. The file name (when written) is not nul + terminated; the length field should reflect this. +*/ + +int +print_core_info(fp, pe,name) + FILE *fp ; + parser_entry_t *pe ; + char *name ; +{ + char padding[PAD - 1] ; + int npad ; + + ptr_check(fp, FILE, "print_core_info", 0) ; + ptr_check(pe, parser_entry_t, "print_core_info", 0) ; + ptr_check(name, char, "print_core_info", 0) ; + + memset(padding, '\0', sizeof padding) ; + if(fwrite((void *)pe, sizeof *pe, (size_t)1, fp) != 1) + { + + /* "Error fwrite'ing parser_entry_t structure" */ + + error(A_ERR, "print_core_info", PRINT_CORE_INFO_001); + return 0 ; + } + if(fwrite((void *)name, (size_t)pe->slen, (size_t)1, fp) != 1) + { + + /* "Error fwrite'ing file name" */ + + error(A_ERR, "print_core_info", PRINT_CORE_INFO_002); + return 0 ; + } + if((npad = pe->slen % PAD) != 0) + { + if(fwrite((void *)padding, (size_t)(PAD - npad), (size_t)1, fp) != 1) + { + + /* "Error fwrite'ing padding" */ + + error(A_ERR,"print_core_info", PRINT_CORE_INFO_003); + return 0 ; + } + } + return 1 ; +} diff --git a/archie/anonftp/parse/output.h b/archie/anonftp/parse/output.h new file mode 100644 index 0000000..f2d9639 --- /dev/null +++ b/archie/anonftp/parse/output.h @@ -0,0 +1,12 @@ +#ifndef OUTPUT_H +#define OUTPUT_H + +#define PAD 4 + +#ifdef __STDC__ +extern int print_core_info(FILE *fp, parser_entry_t *pe, char *name) ; +#else +extern int print_core_info(/* FILE *fp, parser_entry_t *pe, char *name */) ; +#endif + +#endif diff --git a/archie/anonftp/parse/pars_ent_holder.h b/archie/anonftp/parse/pars_ent_holder.h new file mode 100644 index 0000000..dc469b5 --- /dev/null +++ b/archie/anonftp/parse/pars_ent_holder.h @@ -0,0 +1,13 @@ +#ifndef PARS_ENT_HOLDER_H +#define PARS_ENT_HOLDER_H + +#include "parser_file.h" + +typedef struct +{ + parser_entry_t pent ; + char *name ; +} +Pars_ent_holder ; + +#endif diff --git a/archie/anonftp/parse/parse.c b/archie/anonftp/parse/parse.c new file mode 100644 index 0000000..5fc39c3 --- /dev/null +++ b/archie/anonftp/parse/parse.c @@ -0,0 +1,1029 @@ +/* + Usage: + _parser [-h] [-i ] [-o ] [-p ] [-r ] + + Read a recursive directory listing and write it out in a form suitable for insertion into + the archie database. + + Definitions: + + a "directory declaration" (DDec) is the listing of a directory in the same manner as a + listing of an ordinary file (i.e. permissions, owner, date modified, etc.). + + a "directory definition" (DDef) is the listing of the contents of the directory. + + a directory definition header (DDH) is a line specifying to which directory the + following DDef belongs. + + + 1) the parser would like all DDHs to be rooted (any root will do). + + 2) most (all?) UNIX listings don't start with a DDH. + + Therefore, if all but the first (missing) DDHs are rooted (usually ./) then use the -r + option to supply the first DDH (e.g. -r .:). If, as well, the other DDHs are not rooted + then use the -p option to prepend a root to them (e.g. -p .). + + - Bill Heelan (wheelan@cs.mcgill.ca) + + ----------------------------------------------------------------------------------------- + + while( ! eof) + read line + if starts directory list then + while top of stack queue is empty + pop the stack + remove entry from queue + push it on the stack + if ! (path through stack is same as current path) + abort + else + if is a directory file then + add entry to queue + create new core record + store core record +*/ + +#include +#include +#include +#include +#include "defines.h" +#include "parse.h" +#include "utils.h" +#include "stack.h" +#include "queue.h" +#include "input.h" +#include "line_type.h" +#include "pars_ent_holder.h" +#include "storage.h" +#include "output.h" +#include "header.h" +#include "typedef.h" +#include "error.h" +#include "lang_parsers.h" +#ifdef SOLARIS +#include "protos.h" +#else + +#ifdef __STDC__ + +extern int check_stack(void) ; +extern int handle_dir_start(char *line, char *prep_dir, int state) ; +extern int handle_file(char *line, int state) ; +extern int output_header(FILE *ofp, int ignore_header, header_t *hrec, int parse_failed) ; +extern int parser_output(FILE *ofp, header_t *hrec) ; +extern void usage(void) ; + +#else + +extern int check_stack(/* void */) ; +extern int handle_dir_start(/* char *line, char *prep_dir, int state */) ; +extern int handle_file(/* char *line, int state */) ; +extern int output_header(/* FILE *ofp, int ignore_header, header_t *hrec, int parse_failed */) ; +extern int parser_output(/* FILE *ofp, header_t *hrec */) ; +extern void usage(/* void */) ; + +#endif +#endif + +char *prog ; +int verbose = 0 ; + +#define MAX_TABLE_SIZE 20 +#define MAX_ERROR_NUM 20 + +int local_timezone = 0; +static int dir_seen = 0; +static int error_seen = 0; +static int files_seen = 0; +static int blank_seen = 0; +static int retry_mode = 0; + +static char *table[MAX_TABLE_SIZE]; +static int table_num; + + +void +usage() +{ + error(A_ERR, "usage", USAGE_001, prog); + exit(1) ; +} + + +static char *build_dir(prep_dir,line) +char *prep_dir,*line; +{ + + char *t,*tmp,*tmp_dir; + int len; + + + t = strchr(line,':' ); + if ( t == NULL ) + return NULL; + + tmp = t; + while ( t != line && *t != '/' ) + t--; + + if ( t == line ) + t = tmp; + + + len = strlen(prep_dir)+1+(t-line)+1+1; + tmp_dir = (char*)malloc(sizeof(char)*len ); + if ( tmp_dir == NULL ) + return NULL; + + strcpy(tmp_dir,prep_dir); + strcat(tmp_dir,"/"); + strncat(tmp_dir,line,t-line); + tmp_dir[len-2] = ':'; + tmp_dir[len-1] = '\0'; +#if 0 + if ( strncmp(line,"./",2) == 0 ) { + } + else { + len = (t-line)+1+1; + tmp_dir = (char*)malloc(sizeof(char)*len ); + if ( tmp_dir == NULL ) + return NULL; + strncpy(tmp_dir,line,t-line); + tmp_dir[len-2] = ':'; + tmp_dir[len-1] = '\0'; + } +#endif + + return tmp_dir; +} + + + +int +main(ac, av) + int ac ; + char **av ; +{ + char *infile = (char *)0 ; + char line[2 * MAX_LINE_LEN + 1] ; + char origline[2 * MAX_LINE_LEN + 1] ; + char *lp ; + char *outfile = (char *)0 ; + char *prep_dir = (char *)0 ; + char *root_dir = (char *)0 ; + FILE *infp = stdin ; + FILE *outfp = stdout ; + header_t hrec ; + int done = 0 ; + int parse_error = 0 ; + int ignore_header = 0 ; + int old_state ; + int state; + int logging = 0; + pathname_t logfile; + pathname_t orig_root_dir; + pathname_t tmp_root_dir; + + orig_root_dir[0] = tmp_root_dir[0] = '\0'; + + prog = tail(av[0]) ; + while(av++, --ac) + { + if(av[0][0] != '-') + { + usage() ; + } + else + { + switch(av[0][1]) + { + case 'h': + ignore_header = 1 ; /* the listing is not expected to have a header */ + break ; + + case 'i': + if( ! (av++, --ac)) + { + usage() ; + } + else + { + infile = av[0] ; + } + break ; + + case 'o': + if( ! (av++, --ac)) + { + usage() ; + } + else + { + outfile = av[0] ; + } + break ; + + case 'p': + if( ! (av++, --ac)) + { + usage() ; + } + else + { + prep_dir = av[0] ; + } + break ; + + case 'r': + if( ! (av++, --ac)) + { + usage() ; + } + else + { + root_dir = av[0] ; + } + break ; + + case 'L': + if( ! (av++, --ac)) + { + usage() ; + } + else + { + strcpy(logfile, av[0]); + logging = 1; + } + break ; + + case 'l': + logging = 1; + break; + + case 'v': + verbose = 1 ; + break ; + + default: + usage() ; + break ; + } + } + } + + /* set up logs */ + + if(logging) + { + if(logfile[0] == '\0') + { + if(open_alog((char *) NULL, A_INFO, prog) == ERROR) + { + + /* "Can't open default log file" */ + + error(A_ERR, "parse_anonftp", PARSE_ANONFTP_017); + exit(ERROR); + } + } + else + { + if(open_alog(logfile, A_INFO, prog) == ERROR) + { + + /* "Can't open log file %s" */ + + error(A_ERR, "parse_anonftp", PARSE_ANONFTP_018, logfile); + exit(ERROR); + } + } + } + if ( root_dir != NULL ) { + strcpy(tmp_root_dir, root_dir); + strcpy(orig_root_dir ,root_dir); + } + + retry_with_blanks: + if ( blank_seen && root_dir != NULL ) { + strcpy(tmp_root_dir,orig_root_dir); + root_dir = tmp_root_dir; + } + +retry_with_new_root: + + if ( retry_mode ) { + free_elts(); + } + + state = L_BLANK ; + + if(infile != (char *)0) + { + if(strcmp(infile, "-") != 0) + { + if((infp = fopen(infile, "r")) == (FILE *)0) + { + + /* "Can't open file %s for reading" */ + + error(A_ERR, "parse_anonftp", PARSE_ANONFTP_001, infile) ; + exit(ERROR) ; + } + } + } + if(outfile != (char *)0) + { + if(strcmp(outfile, "-") != 0) + { + if((outfp = fopen(outfile, "w")) == (FILE *)0) + { + + /* "can't open %s for writing" */ + + error(A_SYSERR,"parse_anonftp", PARSE_ANONFTP_002, outfile) ; + exit(1) ; + } + } + } + + if( ! ignore_header && read_header(infp, &hrec, (u32 *)0, 0,0) != A_OK) + { + error(A_ERR,"Error from read_header() file %s", infile); + exit(ERROR) ; + } + + if(HDR_GET_TIMEZONE(hrec.header_flags)) + { + local_timezone = hrec.timezone; + } + + if( ! S_init_parser()) + { + /* "Can't initialize line parser" */ + + error(A_ERR, "parse_anonftp", PARSE_ANONFTP_004); + exit(ERROR) ; + } + if( /*! retry_mode &&*/ ! set_elt_size(sizeof(Pars_ent_holder))) + { + error(A_ERR, "parse_anonftp", PARSE_ANONFTP_005); + exit(ERROR) ; + } + if(root_dir != (char *)0) + { + if( ! init_stack(root_dir)) + { + + /* "Can't initialize directory stack" */ + + error(A_ERR, "parse_anonftp", PARSE_ANONFTP_006); + exit(ERROR) ; + } + } + else + { + parse_error = 0; + while( ! done) /* initialize a root directory */ + { + if( ! get_line(line, MAX_LINE_LEN, infp)) + { + done = 1 ; + parse_error = 1 ; + strcpy(origline, line); + + /* "Error trying to initialize root directory" */ + + error(A_ERR, "parse_anonftp", PARSE_ANONFTP_007); + } + else + { + strcpy(origline, line); + + old_state = state ; + switch(state = S_line_type(line)) + { + + /* "Unexpected %s line #%d in listing" */ + +#define badline(ltype) \ + do { error(A_WARN, "parse_anonftp", PARSE_ANONFTP_008, ltype, line_num()) ; parse_error++; if ( parse_error >5) done = 1; } while(0) + + case L_BLANK: + break ; + case L_UNKNOWN: + badline("unknown") ; + break ; + case L_ERROR: + badline("error") ; + break ; + case L_TOTAL: + badline("total") ; + break ; + case L_CONT: + badline("continuation") ; + break ; + case L_PARTIAL: + badline("partial") ; + break ; + case L_FILE: + badline("file") ; + break ; + case L_UNREAD: + badline("unreadable") ; + break ; + + case L_DIR_START: + if( ! init_stack(line)) + { + + /* "Error initializing directory stack with root directory" */ + + error(A_ERR, "parse_anonftp", PARSE_ANONFTP_009); + parse_error = 1 ; + } + done = 1 ; + break ; + + default: + error(A_ERR, "parse_anonftp", PARSE_ANONFTP_010,line_num()) ; + parse_error = 1 ; + done = 1 ; + break ; + } + } + } + } + if( ! parse_error) + { + done = 0 ; + lp = line ; + if ( ! process_fake_entries() ) { + parse_error = done = 1; + } + while( ! done) + { + if( ! get_line(lp, MAX_LINE_LEN, infp)) + { + mck ; + done = 1 ; + } + else + { + mck ; + old_state = state ; + strcpy(origline, line); + switch(state = S_line_type(lp)) + { + case L_BLANK: + case L_ERROR: + case L_TOTAL: + case L_UNREAD: /* will later get flagged as missing */ + break ; + + case L_CONT: + if(old_state == L_PARTIAL) + { + skip_line() ; + } + else + { + badline("continuation") ; + } + break ; + + case L_PARTIAL: + lp = strend(lp) ; *lp = ' ' ; *++lp = '\0' ; + break ; + + case L_UNKNOWN: + badline("unknown") ; + break ; + + case L_FILE: + mck ; + files_seen++; + if( ! handle_file(line, state)) + { + blank_seen++; + error_seen++; + if ( error_seen > MAX_ERROR_NUM ) { + error(A_ERR,"parse_anonftp", "Too many errors .. aborting"); + parse_error = done = 1; + } + if ( infp != stdin && outfp != stdout) { + fclose(infp); + fclose(outfp); + retry_mode = 1; + init_line_num(); + goto retry_with_blanks; + } + else { + /* "Cannot figure out the number of leading blanks " */ + error(A_ERR,"parse_anonftp", "Cannot figure out the number of leading blanks") ; + + /* "Error from handle_dir_start() on line #%d: aborting" */ + + error(A_ERR,"parse_anonftp", PARSE_ANONFTP_012, line_num()) ; + parse_error = done = 1 ; + } + + } + + mck ; + break ; + + case L_DIR_START: + + mck ; + dir_seen++; + if( ! handle_dir_start(line, prep_dir, state)) + { + error_seen++; + if ( error_seen > MAX_ERROR_NUM ) { + + error(A_ERR,"parse_anonftp", "Too many errors...aborting"); + parse_error = done = 1 ; + break; + } + else + { + int num; + if ( (num = strspn(origline," ")) ){ + set_blanks(num); + fclose(infp); + fclose(outfp); + retry_mode = 1; + init_line_num(); + blank_seen = 1; + goto retry_with_blanks; + } + else + if ( infp != stdin && outfp != stdout) { + + /* if one does ls -lR pub .. one will not see + the name of the directory pub listed + as pub: + */ + if ( files_seen && table_num == 0 ) { + + root_dir = build_dir(prep_dir,origline); + + if ( root_dir != NULL ) { + /* "Trying to figure out the root_dir %s" */ + error(A_INFO,"parse_anonftp", PARSE_ANONFTP_019, root_dir); + fclose(infp); + fclose(outfp); + retry_mode = 1; + init_line_num(); + strcpy(tmp_root_dir, root_dir); + root_dir = tmp_root_dir; + goto retry_with_new_root; + } + else { + /* "Cannot determine the root_dir" */ + error(A_INFO,"parse_anonftp", PARSE_ANONFTP_021); + + /* "Error from handle_dir_start() on line #%d: aborting" */ + + error(A_ERR,"parse_anonftp", PARSE_ANONFTP_012, line_num()) ; + parse_error = done = 1 ; + } + } + else { + + /* Probably the user did ls-lR pub1 pub2 .. pubn + In which case the name of the directory appears */ + + if ( ! add_fake_entry(line) ) { + error(A_ERR,"handle_dir_start","Too many errors, aborting"); + parse_error = done = 1 ; + } + else { + fclose(infp); + fclose(outfp); + retry_mode = 1; + init_line_num(); + strcpy(tmp_root_dir, orig_root_dir); + root_dir = tmp_root_dir; + goto retry_with_new_root; + } + + } + } + else { + /* "Cannot figure out root_dir due to usage of standard streams" */ + error(A_ERR,"parse_anonftp", PARSE_ANONFTP_020) ; + + /* "Error from handle_dir_start() on line #%d: aborting" */ + + error(A_ERR,"parse_anonftp", PARSE_ANONFTP_012, line_num()) ; + parse_error = done = 1 ; + } + + } + } + mck ; +#ifdef DEBUG + error(A_INFO, "parse_anonftp", "Post-dir-start") ; print_stack() ; +#endif + break ; + + default: + + /* "Unknown state = '%d' on line #%d" */ + + error(A_ERR, "parse_anonftp", PARSE_ANONFTP_013, state, line_num()) ; + exit(1) ; + break ; + } + if(state != L_PARTIAL) + { + lp = line ; + } + } + } + } + mck ; + + if(parse_error) + { + + /* "Error at line #%d: '%s'" */ + + error(A_ERR, "parse_anonftp", PARSE_ANONFTP_014, line_num(), origline); + + sprintf(hrec.comment, PARSE_ANONFTP_014, line_num(), origline) ; + HDR_SET_HCOMMENT(hrec.header_flags); + + hrec.format = FRAW; + HDR_SET_FORMAT(hrec.header_flags); + + if( ! output_header(outfp, ignore_header, &hrec, parse_error)) + { + + /* Error from output_header(): aborting" */ + + error(A_ERR, "parse_anonftp", PARSE_ANONFTP_015); + } + exit(1) ; + } + else + { + if(check_stack()) + { + /* parse_error if no records were processed */ + + if( ! output_header(outfp, ignore_header, &hrec, elt_num() < 1)) + { + /* "Error from output_header(): aborting" */ + error(A_ERR, "parse_anonftp", PARSE_ANONFTP_015); + exit(1) ; + } + else + { + parser_output(outfp, &hrec) ; + exit(0) ; + } + } + else + { + + /* "Error from check_stack() on line #%d: aborting" */ + + error(A_ERR, "parse_anonftp", PARSE_ANONFTP_016, line_num()) ; + if( ! output_header(outfp, ignore_header, &hrec, 1)) + { + /* "Error from output_header(): aborting" */ + error(A_ERR,"parse_anonftp", PARSE_ANONFTP_015); + } + exit(1) ; + } + } + exit(A_OK); + return(A_OK); /* keep gcc -Wall happy */ +} + + +/* + If there are any directories left on the stack (i.e. there is a non-empty queue) then + there is a directory that was listed as a file, but has no corresponding listing. + + Only print out warning messages. +*/ + +int +check_stack() +{ + while( ! empty_stack()) + { + if( ! pop()) + { + while( ! empty_queue(tos())) + { + Queue_elt *qe ; + + /* "Expected listing for the directory '%s' at the end" */ + +#ifdef DEBUG + error(A_ERR, "check_stack", CHECK_STACK_001, tos()->q.head->ident->name) ; +#endif + if((qe = remq(tos())) == (Queue_elt *)0) + { + + /* "Error removing queue element from top of stack" */ + + error(A_ERR,"check_stack", CHECK_STACK_002); + return 0 ; + } + dispose_Queue_elt(qe) ; + } + } + } + return 1 ; +} + + +/* + Check that the sub-directory listing is the one that is expected (i.e. it is at the head + of the top-most non-empty queue on the stack. +*/ + +int +handle_dir_start(line, prep_dir, state) + char *line ; + char *prep_dir ; + int state ; +{ + char **p ; + int dev ; + int n ; + Queue_elt *qe ; + + ptr_check(line, char, "handle_dir_start", 0) ; + + if( ! S_split_dir(line, prep_dir, &dev, &n, &p)) + { + + /* "Error from S_split_dir()" */ + + error(A_ERR, "handle_dir_start", HANDLE_DIR_START_001); + return 0 ; + } + + /* + If it turns out the directory we are expecting to see at this point isn't here, then + drop it and look for the next in the sequence (by jumping to try_next_dir). + */ + + try_next_dir: + + while(empty_queue(tos())) + { + if( ! pop()) + { + + /* "Error from pop() while looking for non-empty queue" */ + + error(A_ERR, "handle_dir_start", HANDLE_DIR_START_002); + return 0 ; + } + } + if(empty_stack()) + { + pathname_t new_line; + +#ifdef __STDC__ + extern int vfprintf_path(FILE *fp, char **p, int n); +#else + extern int vfprintf_path(); +#endif + + /* "directory '" */ + + error(A_ERR, "handle_dir_start", HANDLE_DIR_START_003); + vfprintf_path(stderr, p, n) ; + + /* "' was not previously declared" */ + + fprintf(stderr, HANDLE_DIR_START_004); + return 0 ; + + } + if((qe = remq(tos())) == (Queue_elt *)0) + { + + /* "Error removing queue element from top of stack" */ + + error(A_ERR, "handle_dir_start", HANDLE_DIR_START_005); + return 0 ; + } + if( ! push(qe->ident)) + { + + /* "Error from push()" */ + + error(A_ERR, "handle_dir_start", HANDLE_DIR_START_006); + return 0 ; + } + qe->ident = (Info_cell *)0 ; + dispose_Queue_elt(qe) ; + if( ! stack_match((const char **)p, n)) + { + + /* "Error expected listing for directory %s on line %d" */ + +#ifdef DEBUG + error(A_ERR, "handle_dir_start", HANDLE_DIR_START_007, tos()->ident->name, line_num()) ; +#endif + + pop() ; + goto try_next_dir ; /* I really ought to get rid of this... */ + } + tos()->ident->addr->pent.core.child_idx = elt_num() + 1 ; + return 1 ; +} + + +/* + The input string will be overwritten if S_file_parse() is called. +*/ + +int +handle_file(line, state) + char *line ; + int state ; +{ + Pars_ent_holder *peh ; + char *name ; + int is_dir ; + + ptr_check(line, char, "handle_file", 0) ; + + if((peh = (Pars_ent_holder *)new_elt()) == (Pars_ent_holder *)0) + { + + /* "Error allocating space for parser record" */ + + error(A_ERR, "handle_file", HANDLE_FILE_001); + return 0 ; + } + if((name = S_file_parse(line, &peh->pent, &is_dir)) == (char *)0) + { + + /* "Error from S_file_parse()" */ + + error(A_ERR, "handle_file", HANDLE_FILE_002, line_num()); + return 0 ; + } + if( ! is_dir) + { + CSE_SET_NON_DIR(peh->pent.core) ; + } + else /* directory file */ + { + char *s ; + Queue_elt *qe ; + + if((s = S_dup_dir_name(name)) == (char *)0) + { + + /* "Error strdup'ing directory name" */ + + error(A_ERR, "handle_file", HANDLE_FILE_003); + return 0 ; + } + CSE_SET_DIR(peh->pent.core) ; + qe = new_Queue_elt(s) ; + qe->ident->addr = peh ; + qe->ident->idx = elt_num() ; + if( ! addq(qe, tos())) + { + + /* "Error adding directory to queue" */ + + error(A_ERR, "handle_file", HANDLE_FILE_004); + return 0 ; + } + } + peh->pent.core.parent_idx = tos()->ident->idx ; + if((peh->name = strdup(name)) == (char *)0) + { + + /* "Error strdup'ing file name" */ + + error(A_ERR, "handle_file", HANDLE_FILE_005); + return 0 ; + } + return 1 ; +} + + +int +output_header(ofp, ignore_header, hrec, parse_failed) + FILE *ofp ; + int ignore_header ; + header_t *hrec ; + int parse_failed ; +{ + ptr_check(ofp, FILE, "output_header", 0) ; + ptr_check(hrec, header_t, "output_header", 0) ; + + if( ! ignore_header) + { + hrec->generated_by = PARSER ; + HDR_SET_GENERATED_BY(hrec->header_flags) ; + + hrec->no_recs = elt_num() + 1 ; /* starts at 0 */ + HDR_SET_NO_RECS(hrec->header_flags) ; + + hrec->update_status = parse_failed ? FAIL : SUCCEED ; + HDR_SET_UPDATE_STATUS(hrec->header_flags) ; + + hrec->parse_time = (date_time_t)time((time_t *)0) ; + HDR_SET_PARSE_TIME(hrec->header_flags) ; + + if(write_header(ofp, hrec, (u32 *)0, 0, 0) != A_OK) + { + + /* "Error from write_header()" */ + + error(A_ERR, "parser_output", HANDLE_FILE_006); + return 0 ; + } + } + return 1 ; +} + + +/* + Write the processed listing to the output file. +*/ + +int +parser_output(ofp, hrec) + FILE *ofp ; + header_t *hrec ; +{ + Pars_ent_holder *peh ; + + ptr_check(ofp, FILE, "parser_output", 0) ; + ptr_check(hrec, header_t, "parser_output", 0) ; + + if((peh = (Pars_ent_holder *)first_elt()) == (Pars_ent_holder *)0) + { + /* "Error from first_elt()" */ + + error(A_ERR, "parser_output", PARSER_OUTPUT_001); + return 0 ; + } + do + { + if( ! print_core_info(ofp, &peh->pent, peh->name)) + { + + /* "Error from print_core_info()" */ + + error(A_ERR, "parser_output", PARSER_OUTPUT_002); + return 0 ; + } + } + while((peh = (Pars_ent_holder *)next_elt()) != (Pars_ent_holder *)0) ; + free_elts() ; + return 1 ; +} + + +static int add_fake_entry(line) + pathname_t line; +{ + + if ( table_num == MAX_TABLE_SIZE ) { + return 0; + } + + table[table_num] = strdup(line); + table_num++; + return 1; +} + + +static int process_fake_entries() +{ + int i; + char fake_line[100]; + + for ( i = 0; i < table_num; i++ ) { + strcpy(fake_line, + "drwxr-xr-x 2 root 512 Jan 1 1971 "); + strcat(fake_line,table[i]); + if ( ! handle_file(fake_line,0) ) { + return 0; + } + } + + return 1; + +} diff --git a/archie/anonftp/parse/parse.h b/archie/anonftp/parse/parse.h new file mode 100644 index 0000000..63bc54e --- /dev/null +++ b/archie/anonftp/parse/parse.h @@ -0,0 +1,73 @@ +#ifndef DEFS_H +#define DEFS_H + +#include "mem_debug.h" + +#define MAX_FIELDS 16 +#define MAX_LINE_LEN 512 +#define MAX_PATH_ELTS 50 +#define MAX_RE_LEN 512 + +#define WHITE_STR " \t" +#define DEV_WHITE_STR " \t" + + +/* + ANSI C. +*/ + +#if 0 + +#ifdef __STDC__ + +#ifndef PARAM_CHECK +# define ptr_check(ptr, type, func, ret_val) +#else +# define ptr_check(ptr, type, func, ret_val) \ + do \ + { \ + if((ptr) == (type *)0) \ + { \ + fprintf(stderr, "%s: %s: parameter '" #ptr "' is a null pointer.\n", prog, func) ; \ + return ret_val ; \ + } \ + } while(0) +#endif + +extern char *prog ; +extern void regerr(int c) ; + +typedef void *Void_ptr ; + +#else + + +/* + K&R C. +*/ + +#ifndef PARAM_CHECK +# define ptr_check(ptr, type, func, ret_val) +#else +# define ptr_check(ptr, type, func, ret_val) \ + do { if((ptr) == (type *)0) { \ + fprintf(stderr, "%s: %s: a parameter is a null pointer.\n", prog, func) ; \ + return ret_val ; \ + } \ + } while(0) +#endif + +#endif + +extern char *prog ; +extern void regerr(/* int c */) ; + +#define const +typedef char *Void_ptr ; + + +#endif +#endif + +extern int verbose ; +#define vfprintf if(verbose) fprintf diff --git a/archie/anonftp/parse/parse_anonftp.c b/archie/anonftp/parse/parse_anonftp.c new file mode 100644 index 0000000..a704890 --- /dev/null +++ b/archie/anonftp/parse/parse_anonftp.c @@ -0,0 +1,723 @@ +/* + * This file is copyright Bunyip Information Systems Inc., 1992. This file + * may not be reproduced, copied or transmitted by any means mechanical or + * electronic without the express written consent of Bunyip Information + * Systems Inc. + * + * $Id: parse_anonftp.c,v 2.0 1996/08/20 22:42:27 archrlse Exp $ + */ + + +#include +#include +#include +#include +#if !defined(AIX) && !defined(SOLARIS) +#include +#endif +#include +#include +#include "typedef.h" +#include "header.h" +#include "db_files.h" +#include "error.h" +#include "files.h" +#include "lang_anonftp.h" +#include "master.h" +#include "protos.h" + +/* + * parse_anonftp: handles the parsing of an anonftp listing, spawning the + * appropriate parser + + argv, argc are used. + + + Parameters: + -i Mandatory + -o Mandatory + -t + -f + -M + -h + -l write to log file (default) + -L +*/ + +int verbose = 0; +char *prog; + +int main(argc, argv) + int argc; + char *argv[]; + +{ +#if 0 +#ifdef __STDC__ + + extern int getopt(int, char **, char *); + extern time_t time(time_t *); + +#else + + extern int getopt(); + extern time_t time(); + +#endif +#endif + + extern int opterr; + extern char *optarg; + + char **cmdline_ptr; + int cmdline_args; + + int option; + + /* Directory pathnames */ + + pathname_t master_database_dir; + pathname_t host_database_dir; + pathname_t tmp_dir; + + /* log filename */ + + pathname_t logfile; + + + /* Filter and parser programs */ + + pathname_t filter_pgm; + pathname_t process_pgm; + + pathname_t outname; + pathname_t outname2; + + char **arglist; + + + int logging = 0; + + int finished; + + int erron = 0; + + file_info_t *input_file = create_finfo(); + file_info_t *output_file = create_finfo(); + file_info_t *tmp_file = create_finfo(); + + char *str; + header_t header_rec; + + int status, result; + + char retr_list[MAX_ACCESS_COMM]; + char retr_string[MAX_ACCESS_COMM]; + char user[MAX_ACCESS_METHOD]; + char pass[MAX_ACCESS_METHOD]; + char acct[MAX_ACCESS_METHOD]; + char root_dir[MAX_ACCESS_METHOD]; + + opterr = 0; + tmp_dir[0] = '\0'; + + host_database_dir[0] = master_database_dir[0] = filter_pgm[0] = '\0'; + logfile[0] = '\0'; + + /* ignore argv[0] */ + + cmdline_ptr = argv + 1; + cmdline_args = argc - 1; + + while((option = (int) getopt(argc, argv, "h:M:t:L:i:o:f:lv")) != EOF){ + + switch(option){ + + /* Log filename */ + + case 'L': + strcpy(logfile, optarg); + logging = 1; + cmdline_ptr += 2; + cmdline_args -= 2; + break; + + /* master database directory */ + + case 'M': + strcpy(master_database_dir,optarg); + cmdline_ptr += 2; + cmdline_args -= 2; + break; + + /* name of filter program */ + + case 'f': + strcpy(filter_pgm, optarg); + cmdline_ptr += 2; + cmdline_args -= 2; + break; + + /* host database directory */ + + case 'h': + strcpy(host_database_dir,optarg); + cmdline_ptr += 2; + cmdline_args -= 2; + break; + + /* input filename */ + + case 'i': + strcpy(input_file -> filename, optarg); + cmdline_ptr += 2; + cmdline_args -= 2; + break; + + /* log output, default file */ + + case 'l': + logging = 1; + cmdline_ptr++; + cmdline_args--; + break; + + /* output filename */ + + case 'o': + strcpy(output_file -> filename, optarg); + cmdline_ptr += 2; + cmdline_args -= 2; + break; + + /* tmp directory */ + + case 't': + strcpy(tmp_dir,optarg); + cmdline_ptr += 2; + cmdline_args -= 2; + break; + + /* verbose */ + + case 'v': + verbose = 1; + cmdline_ptr++; + cmdline_args--; + break; + } + + } + + + if(logging){ + if(logfile[0] == '\0'){ + if(open_alog((char *) NULL, A_INFO, tail(argv[0])) == ERROR){ + + /* "Can't open default log file" */ + + error(A_ERR, "parse_anonftp", PARSE_ANONFTP_001); + exit(ERROR); + } + } + else{ + if(open_alog(logfile, A_INFO, tail(argv[0])) == ERROR){ + + /* "Can't open log file %s" */ + + error(A_ERR, "parse_anonftp", PARSE_ANONFTP_002, logfile); + exit(ERROR); + } + } + } + + /* Check to see that input and output filename were given */ + + if(input_file -> filename[0] == '\0'){ + + /* "No input file given" */ + + error(A_ERR,"parse_anonftp", PARSE_ANONFTP_003); + exit(ERROR); + } + + if(output_file -> filename[0] == '\0'){ + + error(A_ERR,"parse_anonftp", PARSE_ANONFTP_004); + exit(ERROR); + } + + + if(set_master_db_dir(master_database_dir) == (char *) NULL){ + + /* "Error while trying to set master database directory"*/ + + error(A_ERR, "parse_anonftp", PARSE_ANONFTP_005); + exit(ERROR); + } + + + if(tmp_dir[0] == '\0') + sprintf(tmp_dir,"%s/%s",get_master_db_dir(), DEFAULT_TMP_DIR); + + + if(open_file(input_file, O_RDONLY) == ERROR){ + + /* "Can't open input file %s" */ + + error(A_ERR, "parse_anonftp", PARSE_ANONFTP_006, input_file -> filename); + exit(ERROR); + } + + if(read_header(input_file -> fp_or_dbm.fp, &header_rec, (u32 *) NULL, 0, 1) == ERROR){ + + /* "Error reading header of input file %s" */ + + error(A_ERR, "parse_anonftp", PARSE_ANONFTP_007, input_file -> filename); + goto onerr; + } + + if(header_rec.format != FRAW){ + + /* "Input file %s not in raw format. Cannot process" */ + + error(A_ERR,"parse_anonftp", PARSE_ANONFTP_008, input_file -> filename); + goto onerr; + } + + /* Generate a "random" file name */ + + srand(time((time_t *) NULL)); + + for(finished = 0; !finished;){ + + sprintf(outname,"%s_%d%s%s", output_file -> filename, rand() % 100, SUFFIX_UPDATE, TMP_SUFFIX); + + if(access(outname, R_OK | F_OK) == -1) + finished = 1; + } + + str = get_tmp_filename(tmp_dir); + + if(str) + strcpy(tmp_file -> filename, str); + else{ + + /* "Can't get temporary name for file %s" */ + + error(A_INTERR,"parse_anonftp", PARSE_ANONFTP_009, input_file -> filename); + goto onerr; + } + + if(open_file(tmp_file, O_WRONLY) == ERROR){ + + /* "Can't open temporary file %s" */ + + error(A_ERR, "parse_anonftp", PARSE_ANONFTP_010, tmp_file -> filename); + goto onerr; + } + + if ( header_rec.os_type == NOVELL ) { + retr_list[0] = retr_string[0] = user[0] = pass[0] = acct[0] = root_dir[0] = '\0'; + + + /* Check what method is to be used to retrieve info */ + + if(HDR_GET_ACCESS_COMMAND(header_rec.header_flags)){ + + strcpy(retr_string, header_rec.access_command); + + if(str_decompose(retr_string,NET_DELIM_CHAR,retr_list,user,pass,acct,root_dir) == ERROR){ + + /* "Unable to parse access command in header" */ + + do_error_header(tmp_file, output_file,0, &header_rec, SUFFIX_PARSE, PARSE_ANONFTP_029); + return(ERROR); + } + sprintf(retr_string,"%s:%s:%s:%s:%s",retr_list,user,pass,acct,root_dir); + + } + } + + if(write_header(tmp_file -> fp_or_dbm.fp, &header_rec, (u32 *) NULL, 0, 0) == ERROR){ + + /* "Error while writing header of output file" */ + + error(A_ERR, "parse_anonftp", PARSE_ANONFTP_011); + goto onerr; + } + + switch(header_rec.os_type){ + + case UNIX_BSD: + if(filter_pgm[0] == '\0') + sprintf(filter_pgm,"%s/%s/%s%s_%s", get_archie_home(), DEFAULT_BIN_DIR, FILTER_PREFIX, header_rec.access_methods, OS_TYPE_UNIX_BSD); + break; + + case VMS_STD: + if(filter_pgm[0] == '\0') + sprintf(filter_pgm,"%s/%s/%s%s_%s", get_archie_home(), DEFAULT_BIN_DIR, FILTER_PREFIX, header_rec.access_methods, OS_TYPE_VMS_STD); + break; + + case NOVELL: + + if(filter_pgm[0] == '\0') + sprintf(filter_pgm,"%s/%s/%s%s_%s", get_archie_home(), DEFAULT_BIN_DIR, FILTER_PREFIX, header_rec.access_methods, OS_TYPE_NOVELL); + break; + } + + + /* first fork the filter program */ + +#ifndef AIX + if((result = vfork()) == 0){ +#else + if((result = fork()) == 0){ +#endif + + /* Make the input file the stdin of filter and tmp_file the stdout */ + + dup2(fileno(input_file -> fp_or_dbm.fp), 0); + dup2(fileno(tmp_file -> fp_or_dbm.fp), 1); + + execlp(filter_pgm, filter_pgm, (char *) NULL); + + /* if we've gotten here then the execlp didn't work */ + + /* "Can't execlp() filter program %s" */ + + error(A_SYSERR, "parse_anonftp", PARSE_ANONFTP_012, filter_pgm); + } + + if(result == -1){ + + /* "Can't vfork() filter program %s" */ + + error(A_SYSERR,"parse_anonftp", PARSE_ANONFTP_013, filter_pgm); + goto onerr; + } + + if(wait(&status) == -1){ + + /* "Error while in wait() for filter program %s" */ + + error(A_SYSERR,"parse_anonftp", PARSE_ANONFTP_014, filter_pgm); + goto onerr; + } + + + if(WIFEXITED(status) && WEXITSTATUS(status)){ + + /* "Filter program %s exited abnormally with exit code %d" */ + + error(A_ERR,"parse_anonftp", PARSE_ANONFTP_015, filter_pgm, WEXITSTATUS(status)); + goto onerr; + } + + if(WIFSIGNALED(status)){ + + /* "Filter program %s terminated abnormally with signal %d" */ + + error(A_ERR,"parse_anonftp", PARSE_ANONFTP_016, filter_pgm, WTERMSIG(status)); + goto onerr; + } + + + if(close_file(input_file) == ERROR){ + + /* "Can't close input file %s" */ + + error(A_ERR, "parse_anonftp", PARSE_ANONFTP_017, input_file -> filename); + } + + if(close_file(tmp_file) == ERROR){ + + /* "Can't close temporary file %s" */ + + error(A_ERR, "parse_anonftp", PARSE_ANONFTP_018, tmp_file -> filename); + } + + if((arglist = (char **) malloc(MAX_NO_PARAMS * sizeof(char *))) == (char **) NULL){ + + /* "Can't malloc space for argument list" */ + + error(A_SYSERR, "parse_anonftp", PARSE_ANONFTP_027); + exit(ERROR); + } + + switch(header_rec.os_type){ + + case UNIX_BSD: + + sprintf(process_pgm,"%s/%s/%s%s_%s", get_archie_home(), DEFAULT_BIN_DIR, PARSE_PREFIX, header_rec.access_methods, OS_TYPE_UNIX_BSD); + break; + + case VMS_STD: + sprintf(process_pgm,"%s/%s/%s%s_%s", get_archie_home(), DEFAULT_BIN_DIR, PARSE_PREFIX, header_rec.access_methods, OS_TYPE_VMS_STD); + break; + + case NOVELL: + sprintf(process_pgm,"%s/%s/%s%s_%s", get_archie_home(), DEFAULT_BIN_DIR, PARSE_PREFIX, header_rec.access_methods, OS_TYPE_NOVELL); + break; + } + + /* launch the parsing process */ + + + if((result = fork()) == 0){ + + switch(header_rec.os_type){ + char *logname; + int i; + + case UNIX_BSD: + + i = 0; + arglist[i++] = process_pgm; + + arglist[i++] = "-r"; + arglist[i++] = ".:"; + + arglist[i++] = "-p"; + arglist[i++] = "."; + + arglist[i++] = "-i"; + arglist[i++] = tmp_file -> filename; + + arglist[i++] = "-o"; + arglist[i++] = outname; + + logname = get_archie_logname(); + + if(logname[0]){ + + arglist[i++] = "-L"; + arglist[i++] = logname; + } + + if(verbose) + arglist[i++] = "-v"; + + arglist[i] = (char *) NULL; + + if(verbose){ + int j; + pathname_t holds; + pathname_t thold; + + holds[0] = '\0'; + + for(j = 0; j < i; j++){ + + sprintf(thold, " %s", arglist[j]); + strcat(holds, thold); + } + + error(A_INFO, "parse_anonftp", "Calling %s %s", process_pgm, holds); + } + + execv(process_pgm, arglist); + break; + + case VMS_STD: + + i = 0; + arglist[i++] = process_pgm; + + arglist[i++] = "-i"; + arglist[i++] = tmp_file -> filename; + + arglist[i++] = "-o"; + arglist[i++] = outname; + + logname = get_archie_logname(); + + if(logname[0]){ + + arglist[i++] = "-L"; + arglist[i++] = logname; + } + + if(verbose) + arglist[i++] = "-v"; + + arglist[i] = (char *) NULL; + + if(verbose){ + int j; + pathname_t holds; + pathname_t thold; + + holds[0] = '\0'; + + for(j = 0; j < i; j++){ + + sprintf(thold, " %s", arglist[j]); + strcat(holds, thold); + } + + error(A_INFO, "parse_anonftp", "Calling %s %s", process_pgm, holds); + } + + execv(process_pgm, arglist); + break; + + case NOVELL: + + i = 0; + arglist[i++] = process_pgm; + + arglist[i++] = "-i"; + arglist[i++] = tmp_file -> filename; + + arglist[i++] = "-o"; + arglist[i++] = outname; + +/* arglist[i++] = "-r"; + arglist[i++] = ".:"; +*/ + + arglist[i++] = "-r"; + arglist[i++] = root_dir; + strcat(arglist[i-1],":"); + logname = get_archie_logname(); + + if(logname[0]){ + + arglist[i++] = "-L"; + arglist[i++] = logname; + } + + if(verbose) + arglist[i++] = "-v"; + + arglist[i] = (char *) NULL; + + if(verbose){ + int j; + pathname_t holds; + pathname_t thold; + + holds[0] = '\0'; + + for(j = 0; j < i; j++){ + + sprintf(thold, " %s", arglist[j]); + strcat(holds, thold); + } + + error(A_INFO, "parse_anonftp", "Calling %s %s", process_pgm, holds); + } + + execv(process_pgm, arglist); + break; + + } + + + /* "Can't execv() parse program %s" */ + + error(A_SYSERR, "parse_anonftp", PARSE_ANONFTP_019, process_pgm); + goto onerr; + } + + + free(arglist); + + if(result == -1){ + + /* "Can't vfork() parse program %s" */ + + error(A_SYSERR,"parse_anonftp", PARSE_ANONFTP_020, process_pgm); + goto onerr; + } + + if(wait(&status) == -1){ + + /* "Error while in wait() for parse program %s" */ + + error(A_ERR,"parse_anonftp", PARSE_ANONFTP_021, process_pgm); + goto onerr; + } + + if(WIFEXITED(status) && WEXITSTATUS(status)){ + + /* "Parse program %s exited abnormally with code %d" */ + + error(A_ERR,"parse_anonftp", PARSE_ANONFTP_022, process_pgm, WEXITSTATUS(status)); + goto onerr; + } + + if(WIFSIGNALED(status)){ + + /* "Parse program %s terminated abnormally with signal %d" */ + + error(A_ERR,"parse_anonftp", PARSE_ANONFTP_023, process_pgm, WTERMSIG(status)); + goto onerr; + } + + goto jumpos; + +onerr: + + erron = 1; + +jumpos: + + + for(finished = 0; !finished;){ + + sprintf(outname2,"%s_%d%s", output_file -> filename, rand() % 100, SUFFIX_UPDATE); + + if(access(outname2, R_OK | F_OK) == -1) + finished = 1; + } + + if(rename(outname, outname2) == -1){ + + /* "Can't rename output file %s" */ + + error(A_SYSERR,"parse_anonftp", PARSE_ANONFTP_024, outname); + erron = 1; + } + + + /* Don't unlink files if there is an error in parsing */ + + if(!erron){ + if(unlink(input_file -> filename) == -1){ + + /* "Can't unlink input file %s" */ + + error(A_SYSERR,"parse_anonftp", PARSE_ANONFTP_025, input_file -> filename); + erron = 1; + } + + if(unlink(tmp_file -> filename) == -1){ + + /* "Can't unlink temporary file %s" */ + + error(A_SYSERR,"parse_anonftp", PARSE_ANONFTP_026, tmp_file -> filename); + erron = 1; + } + } + else{ + + /* Rename the tmp file to something more useful */ + + sprintf(outname2,"%s_%d%s", output_file -> filename, rand() % 100, SUFFIX_FILTERED); + + if(rename(tmp_file -> filename, outname2) == -1){ + + /* "Can't rename failed temporary file %s to %s" */ + + error(A_SYSERR,"parse_anonftp", PARSE_ANONFTP_028, tmp_file -> filename, outname2); + } + } + + if(erron) + exit(ERROR); + + exit(A_OK); + return(A_OK); +} diff --git a/archie/anonftp/parse/parser.man b/archie/anonftp/parse/parser.man new file mode 100644 index 0000000..60b8f9a --- /dev/null +++ b/archie/anonftp/parse/parser.man @@ -0,0 +1,95 @@ +.TH PARSER 1 "4 August 1992" +.SH NAME +parser \- generate input to the insertion routine from recursive listings + +.SH SYNOPSIS +\fIsys_type\fB_parser +[ +.B \-h +] [ +.B \-i +.I input\-file +] [ +.B \-o +.I output\-file +] [ +.B \-p +.I prep\-dir +] [ +.B \-r +.I root\-dir +] + +.SH DESCRIPTION +.LP +\fIsys_type\fB_parser\fR describes a family of parsers, currenly with members +.B unix_parser +and +.BR vms_parser . + +.PP +\fIsys_type\fB_parser\fR +reads a recursive directory listing obtained under the \fIsys_type\fR operating +system. +Its output is intended to be the input to the program which inserts site +listings into the archie(TM) database. + +.SH OPTIONS +.LP +.TP 5n +.B \-h +No headers. +The listing is not expected to have a special header (normally used by all +programs in the database insertion pipeline), nor will it generate one on +output. This option can be used for debugging or to test raw (unprocessed) listings. +.TP 5n +.B \-i +Input. +The next argument is the name of the file containing the recursive listing. If +unspecified, +.I stdin +is assumed. +.TP 5n +.B \-o +Output. +The next argument is the name of the file to which the output will be written. +If unspecified, +.I stdout +is assumed. +.TP 5n +.B \-p +Prepended directory. +Currently, this is used only by the UNIX parser. The next argument is +prepended to the start of all \fIdirectory definitions\fR. For +example, an argument of `.' can be used to turn the \fIdirectory +definition\fR `bin:' into `./bin:', which is more easily digested by the parser. +.TP 5n +.B \-r +Root directory. +This is currently only used by the UNIX parser. The next argument is the name +the root directory from which the listing is assumed to be taken. This option +is often, but not always, used in conjunction with the +.B \-p +option, and is typically the same string, but with the trailing `/' replaced +with a `:'. For example, together these arguments might be `-r .: -p .'. +.TP 5n +.B \-v +Verbose. +Unless this option is given, +\fIsys_type\fB_parser\fR will emit no warnings or error messages. The only +indication that something has gone wrong will be the return code, and the +truncated (but valid) output. + +.SH SEE ALSO +.BR foo (5), + +.SH BUGS +Lots, probably. + +.SH AUTHOR +The archie Group +.br +Bunyip Information Systems +.br +.br +Montr\o"\'e"al, Qu\o"\'e"bec, Canada diff --git a/archie/anonftp/parse/queue.c b/archie/anonftp/parse/queue.c new file mode 100644 index 0000000..0070cb5 --- /dev/null +++ b/archie/anonftp/parse/queue.c @@ -0,0 +1,145 @@ +#include +#include /* malloc? */ +#include "defines.h" +#include "parse.h" +#include "stack.h" +#include "info_cell.h" +#include "queue.h" +#include "error.h" +#include "lang_parsers.h" + +/* + Add an element to the tail of the queue. +*/ + +int +addq(nqe, s) + Queue_elt *nqe ; + Stack *s ; +{ + ptr_check(nqe, Queue_elt, "addq", 0) ; + ptr_check(s, Stack, "addq", 0) ; + + nqe->next = s->q.tail ; + nqe->prev = (Queue_elt *)0 ; + if(s->q.tail != (Queue_elt *)0) + { + s->q.tail->prev = nqe ; + } + s->q.tail = nqe ; + if(s->q.head == (Queue_elt *)0) + { + s->q.head = nqe ; + } + return 1 ; +} + +int +dispose_Queue_elt(qe) + Queue_elt *qe ; +{ + ptr_check(qe, Queue_elt, "dispose_Queue_elt", 0) ; + + if(qe->ident != (Info_cell *)0) + { + dispose_Info_cell(qe->ident) ; + } + free(qe) ; + return 1 ; +} + + +/* + 's' may be null if we have popped the stack until it is empty. +*/ + +int +empty_queue(s) + const Stack *s ; +{ + if(s == (Stack *)0) + { + return 0 ; + } + return s->q.head == (Queue_elt *)0 ; +} + + +Queue_elt * +new_Queue_elt(s) + char *s ; +{ + Queue_elt *qe = (Queue_elt *)0 ; + + ptr_check(s, char, "new_Queue_elt", qe) ; + + if((qe = (Queue_elt *)malloc((unsigned)sizeof(Queue_elt))) == (Queue_elt *)0) + { + + /* "Error allocating %d bytes for new queue element" */ + + error(A_ERR, "new_Queue_elt", NEW_QUEUE_ELT_001, sizeof(Queue_elt)) ; + } + else + { + if((qe->ident = new_Info_cell(s)) != (Info_cell *)0) + { + qe->next = qe->prev = (Queue_elt *)0 ; + } + else + { + + /* "Error from init_Info_cell()" */ + + error(A_ERR, "new_Queue_elt", NEW_QUEUE_ELT_002) ; + free(qe) ; + qe = (Queue_elt *)0 ; + } + } + + return qe ; +} + + +int +print_queue(q) + const Queue_elt *q ; +{ + Queue_elt *qe = q ; + + fprintf(stderr, "-|") ; + while(qe != (Queue_elt *)0) + { + fprintf(stderr, "%s|", qe->ident->name) ; + qe = qe->next ; + } + fprintf(stderr, "-\n") ; + return 1 ; +} + + +Queue_elt * +remq(s) + Stack *s ; +{ + Queue_elt *qe = (Queue_elt *)0 ; + + ptr_check(s, Stack, "remq", qe) ; + + if(s->q.head == (Queue_elt *)0) + { + return qe ; + } + qe = s->q.head ; + s->q.head = qe->prev ; + if(s->q.head != (Queue_elt *)0) + { + qe->prev->next = (Queue_elt *)0 ; + } + else + { + s->q.tail = (Queue_elt *)0 ; + } + qe->prev = (Queue_elt *)0 ; + return qe ; +} diff --git a/archie/anonftp/parse/queue.h b/archie/anonftp/parse/queue.h new file mode 100644 index 0000000..4bfa6a8 --- /dev/null +++ b/archie/anonftp/parse/queue.h @@ -0,0 +1,28 @@ +#ifndef QUEUE_H +#define QUEUE_H + +#include "queue_def.h" +#include "stack.h" + +#ifdef __STDC__ + +extern int addq(Queue_elt *nqe, Stack *s) ; +extern int dispose_Queue_elt(Queue_elt *qe) ; +extern int empty_queue(const Stack *s) ; +extern int print_queue(const Queue_elt *q) ; +extern Queue_elt *new_Queue_elt(char *s) ; +extern Queue_elt *remq(Stack *s) ; +extern Queue *new_queue_t(void) ; + +#else + +extern int addq(/* Queue_elt *nqe, Stack *s */) ; +extern int dispose_Queue_elt(/* Queue_elt *qe */) ; +extern int empty_queue(/* const Stack *s */) ; +extern int print_queue(/* const Queue_elt *q */) ; +extern Queue_elt *new_Queue_elt(/* char *s */) ; +extern Queue_elt *remq(/* Stack *s */) ; +extern Queue *new_queue_t(/* void */) ; + +#endif +#endif diff --git a/archie/anonftp/parse/queue_def.h b/archie/anonftp/parse/queue_def.h new file mode 100644 index 0000000..0aa8ff6 --- /dev/null +++ b/archie/anonftp/parse/queue_def.h @@ -0,0 +1,22 @@ +#ifndef QUEUE_DEF_H +#define QUEUE_DEF_H + +#include "info_cell.h" + +typedef struct Queue_elt Queue_elt ; + +struct Queue_elt +{ + Info_cell *ident ; + + Queue_elt *next ; + Queue_elt *prev ; +} ; + +typedef struct queue_t +{ + Queue_elt *head ; + Queue_elt *tail ; +} Queue ; + +#endif diff --git a/archie/anonftp/parse/stack.c b/archie/anonftp/parse/stack.c new file mode 100644 index 0000000..48dc49a --- /dev/null +++ b/archie/anonftp/parse/stack.c @@ -0,0 +1,296 @@ +#include +#include +#include /* malloc? */ +#include "parse.h" +#include "line_type.h" +#include "queue.h" +#include "info_cell.h" +#include "stack.h" +#include "error.h" +#include "lang_parsers.h" +#ifdef SOLARIS +#include "protos.h" +#else + +#ifdef __STDC__ +static Stack *new_Stack(Info_cell *ic) ; +#else +static Stack *new_Stack(/* Info_cell *ic */) ; +#endif +#endif + +static Stack *stop = (Stack *)0 ; + + +int +empty_stack() +{ + return stop == (Stack *)0 ; +} + + +int +init_stack(root_dir) + char *root_dir ; +{ + if(root_dir != (char *)0) + { + if(S_line_type(root_dir) != L_DIR_START) + { + + /* "Root directory '%s' doesn't match pattern" */ + + error(A_ERR, "init_stack", INIT_STACK_001, root_dir) ; + return 0 ; + } + else + { + char **path ; + int i ; + int has_dev ; + int npath ; + + if( ! S_split_dir(root_dir, (char *)0, &has_dev, &npath, &path)) + { + + /* "Error from S_split_dir()" */ + + error(A_ERR, "init_stack", INIT_STACK_002) ; + return 0 ; + } + for(i = 0 ; i < npath ; i++) + { + char *s ; + Info_cell *ic ; + + if((s = strdup(path[i])) == (char *)0) + { + + /* "Error strdup'ing '%s'" */ + + error(A_ERR, "init_stack", INIT_STACK_003, path[i]) ; + return 0 ; + } + if((ic = new_Info_cell(s)) == (Info_cell *)0) + { + + /* "Error from new_Info_cell()" */ + + error(A_ERR, "init_stack", INIT_STACK_004) ; + return 0 ; + } + if ( i != npath-1 || npath == 1 ) { + ic->idx = -1 ; + if( ! push(ic)) + { + + /* "Error from push()" */ + + error(A_ERR, "init_stack", INIT_STACK_005) ; + return 0 ; + } + } + else { + Pars_ent_holder *peh ; + Queue_elt *qe ; + + if((peh = (Pars_ent_holder *)new_elt()) == (Pars_ent_holder *)0) + { + + /* "Error allocating space for parser record" */ + + error(A_ERR, "handle_file", HANDLE_FILE_001); + return 0 ; + } + + CSE_SET_DIR(peh->pent.core) ; + qe = new_Queue_elt(strdup(s)) ; + qe->ident->addr = peh ; + qe->ident->idx = elt_num() ; + if( ! addq(qe, tos())) + { + + /* "Error adding directory to queue" */ + + error(A_ERR, "handle_file", HANDLE_FILE_004); + return 0 ; + } + + peh->pent.core.parent_idx = tos()->ident->idx ; + if((peh->name = strdup(s)) == (char *)0) + { + + /* "Error strdup'ing file name" */ + + error(A_ERR, "handle_file", HANDLE_FILE_005); + return 0 ; + } + peh->pent.slen = strlen(peh->name); + ic->idx = -1 ; + if( ! push(ic)) + { + + /* "Error from push()" */ + + error(A_ERR, "init_stack", INIT_STACK_005) ; + return 0 ; + } + + } + } + } + } + return 1 ; +} + + +/* + Create a new stack element. 'str' is assumed to point to storage which may be freed by + pop. +*/ + +static Stack * +new_Stack(ic) + Info_cell *ic ; +{ + Stack *s ; + + ptr_check(ic, Info_cell, "new_Stack", 0) ; + + if((s = (Stack *)malloc((unsigned)sizeof(Stack))) == (Stack *)0) + { + + /* "Error allocating %d bytes for new stack element" */ + + error(A_SYSERR, "new_Stack", NEW_STACK_001, sizeof(Stack)) ; + return((Stack *) NULL); + } + s->ident = ic ; + s->q.head = s->q.tail = (Queue_elt *)0 ; + return s ; +} + + +int +pop() +{ + Stack *s ; + + if(stop == (Stack *)0) + { + +#if 0 + /* "Stack is empty" */ + + error(A_ERR, "pop", POP_001) ; +#endif + + return 0 ; + } + if( ! empty_queue(tos())) + { + + /* "Queue is not empty" */ + +#if 0 + error(A_ERR, "pop", POP_002) ; +#endif + + return 0 ; + } + s = stop ; + stop = stop->prev ; + if( ! dispose_Info_cell(s->ident)) + { + + /* "Error from dispose_Info_cell()" */ + + error(A_ERR, "pop", POP_003) ; + return 0 ; + } + free(s) ; + return 1 ; +} + + +int +print_stack() +{ + if(stop == (Stack *)0) + { + /* "Stack is empty" */ + fprintf(stderr, PRINT_STACK_001) ; + } + else + { + Stack *s = stop ; + + fprintf(stderr, "------ stack -----\n") ; + while(s != (Stack *)0) + { + fprintf(stderr, "%s: ", s->ident->name) ; + print_queue(s->q.tail) ; + s = s->prev ; + } + fprintf(stderr, "==================\n") ; + } + return 1 ; +} + + +int +push(ic) + Info_cell *ic ; +{ + Stack *s ; + + ptr_check(ic, Info_cell, "push", 0) ; + + if((s = new_Stack(ic)) == (Stack *)0) + { + + /* "Error from new_Stack()" */ + + error(A_ERR, "push", PUSH_001) ; + return 0 ; + } + s->prev = stop ; + stop = s ; + return 1 ; +} + + +int +stack_match(p, n) + const char **p ; + int n ; +{ + int i ; + Stack *s = stop ; + + ptr_check(p, char *, "stack_match", 0) ; + + if(stop == (Stack *)0) + { + return n == 0 ; + } + for(i = n ; i > 0 ; --i, s = s->prev) + { + if(s == (Stack *)0) + { + break ; + } + if(strcmp(s->ident->name, *(p + i - 1)) != 0) + { + return 0 ; + } + } + return i == 0 && s == (Stack *)0 ; +} + + +Stack * +tos() +{ + return stop ; +} diff --git a/archie/anonftp/parse/stack.h b/archie/anonftp/parse/stack.h new file mode 100644 index 0000000..af3c3a0 --- /dev/null +++ b/archie/anonftp/parse/stack.h @@ -0,0 +1,38 @@ +#ifndef STACK_H +#define STACK_H + +#include "queue_def.h" + + +typedef struct Stack Stack ; + +struct Stack +{ + Info_cell *ident ; + Queue q ; + + Stack *prev ; +} ; + +#ifdef __STDC__ + +extern int empty_stack(void) ; +extern int init_stack(char *root_dir) ; +extern int pop(void) ; +extern int print_stack(void) ; +extern int push(Info_cell *ic) ; +extern int stack_match(const char **p, int n) ; +extern Stack *tos(void) ; + +#else + +extern int empty_stack(/* void */) ; +extern int init_stack(/* char *root_dir */) ; +extern int pop(/* void */) ; +extern int print_stack(/* void */) ; +extern int push(/* Info_cell *ic */) ; +extern int stack_match(/* const char **p, int n */) ; +extern Stack *tos(/* void */) ; + +#endif +#endif diff --git a/archie/anonftp/parse/storage.c b/archie/anonftp/parse/storage.c new file mode 100644 index 0000000..4cc9404 --- /dev/null +++ b/archie/anonftp/parse/storage.c @@ -0,0 +1,228 @@ +/* + We assume that a series of memory allocations of fixed length are to be + done, followed by a single 'free' of all allocated memory. + + We provide routines to allocate an element. +*/ + +#include +#include +#include +#include "parse.h" +#include "error.h" + +/* default number of elements in a block */ +#define NELTS 512 + +typedef struct block Block ; +struct block +{ + void *mem ; /* pointer to first entry in block */ + void *end ; /* pointer to last entry in block */ + + struct block *next ; /* pointer to next block */ +} ; + +typedef struct header Header ; +struct header +{ + int elts_per_blk ; /* counter of number of elements in each block */ + int elt_size ; /* size of each element */ + + int block_size ; /* derived: size of each block of elements */ + + int curr_elt ; + int total_elts ; /* number of elements used in all blocks */ + + void *next_elt ; /* pointer to next available element */ + + Block *first ; /* pointer to first block of elements */ + Block *last ; /* pointer to last (current) block of elements */ +} ; + +static Header hd ; + + +int +free_elts() +{ + Block *b ; + + mck ; + for(b = hd.first ; b != (Block *)0 ; ) + { + Block *tmp; + + free(b->mem) ; + tmp = b->next; + free((void *)b) ; + b = tmp; + } + hd.total_elts = hd.elts_per_blk = hd.elt_size = hd.block_size = 0 ; + hd.curr_elt = -1; + hd.next_elt = (void *)0 ; + hd.first = hd.last = (Block *)0 ; + mck ; + return 1 ; +} + + +int elt_num() +{ + return hd.curr_elt ; +} + + +static Block * +new_block() +{ + Block *b ; + + mck ; + if((b = (Block *)malloc(sizeof(Block))) != (Block *)0) + { + void *p ; + + if((p = malloc((size_t)hd.block_size)) == (void *)0) + { + free((void *)b) ; + b = (Block *)0 ; + } + else + { + b->next = (Block *)0 ; + b->mem = (Block *)p ; + b->end = (void *)((char *)b->mem + (hd.elts_per_blk - 1) * hd.elt_size) ; + } + } + mck ; + return b ; +} + + +/* + Upon entry hd.next_elt points to the next unused memory location. +*/ + +void * +new_elt() +{ + void *p = hd.next_elt ; + + mck ; + if(hd.next_elt < hd.last->end) + { + hd.next_elt = (void *)((char *)hd.next_elt + hd.elt_size) ; + } + else + { + Block *b = new_block() ; + + if(b == (Block *)0) + { + return (void *)0 ; + } + else + { + hd.next_elt = b->mem ; + + hd.last->next = b ; + hd.last = b ; + } + } + hd.curr_elt++ ; + hd.total_elts++ ; + mck ; + memset(p,0,hd.elt_size); + return p ; +} + + +static Block *curr_blk = (Block *)0 ; +static void *curr_mem = (void *)0 ; + +void * +first_elt() +{ + void *p = (void *)0 ; + + mck ; + if(hd.first == (Block *)0) + { + error(A_ERR, "first_elt", "storage has not been initialized") ; + } + else if(hd.total_elts > 0) + { + curr_blk = hd.first ; + p = curr_mem = hd.first->mem ; + hd.curr_elt = 0 ; + } + mck ; + return p ; +} + + +/* + Upon entry curr_elt is the number of elements returned and curr_mem points to the last + entry returned. +*/ + +void * +next_elt() +{ + void *p = (void *)0 ; + + mck ; + if(hd.curr_elt < hd.total_elts - 1) /* hd.curr_elt counts from 0 */ + { + if(curr_mem != curr_blk->end) + { + hd.curr_elt++ ; + p = curr_mem = (void *)((char *)curr_mem + hd.elt_size) ; + } + else /* go to next block */ + { + if((curr_blk = curr_blk->next) != (Block *)0) /* have we done the last block? */ + { + hd.curr_elt++ ; + p = curr_mem = curr_blk->mem ; + } + } + } + mck ; + return p ; +} + + +int +set_elt_size(size) + size_t size ; +{ + mck ; + if(hd.elt_size != 0) + { + error(A_ERR, "set_elt_type", "element type has already been set") ; + return 0 ; + } + else + { + Block *b ; + + hd.elt_size = size ; + hd.elts_per_blk = NELTS ; + + hd.block_size = hd.elt_size * hd.elts_per_blk ; + + if((b = new_block()) != (Block *)0) + { + hd.total_elts = 0 ; + hd.next_elt = b->mem ; + hd.first = hd.last = b ; + } + + hd.curr_elt = -1 ; /* cuz we want to start at 0 */ + + mck ; + return b != (Block *)0 ; + } +} diff --git a/archie/anonftp/parse/storage.h b/archie/anonftp/parse/storage.h new file mode 100644 index 0000000..ebf371a --- /dev/null +++ b/archie/anonftp/parse/storage.h @@ -0,0 +1,25 @@ +#ifndef STORAGE_H +#define STORAGE_H + +#ifdef __STDC__ + +#include + +extern int elt_num(void) ; +extern int free_elts(void) ; +extern int set_elt_size(size_t size) ; +extern void *first_elt(void) ; +extern void *new_elt(void) ; +extern void *next_elt(void) ; + +#else + +extern int elt_num(/* void */) ; +extern int free_elts(/* void */) ; +extern int set_elt_size(/* size_t size */) ; +extern void *first_elt(/* void */) ; +extern void *new_elt(/* void */) ; +extern void *next_elt(/* void */) ; + +#endif +#endif diff --git a/archie/anonftp/parse/str.c b/archie/anonftp/parse/str.c new file mode 100644 index 0000000..9ccd30b --- /dev/null +++ b/archie/anonftp/parse/str.c @@ -0,0 +1,55 @@ +#include + +extern char *malloc() ; + + +char * +strdup(s) + char *s ; +{ + char *t = malloc((unsigned)(strlen(s)+1)) ; + + return t == (char *)0 ? t : strcpy(t, s) ; +} + + +static char * +findfirst(s, set) + char *s ; + char *set ; +{ + char *p ; + + for( ; *s != '\0' ; s++) + { + for(p = set ; *p != '\0' ; p++) + { + if(*p == *s) + { + return s ; + } + } + } + return (char *)0 ; +} + + +char * +strsep(s, set) + char **s ; + char *set ; +{ + char *p ; + char *start = *s ; + + if((p = findfirst(*s, set)) == (char *)0) + { + return (char *)0 ; + } + else + { + *p = '\0' ; + *s = ++p ; + return start ; + } +} diff --git a/archie/anonftp/parse/str.h b/archie/anonftp/parse/str.h new file mode 100644 index 0000000..9fb5552 --- /dev/null +++ b/archie/anonftp/parse/str.h @@ -0,0 +1,10 @@ +#ifndef STR_H +#define STR_H + +#ifdef __STDC__ +#else +extern char *strdup() ; +extern char *strsep() ; +#endif + +#endif diff --git a/archie/anonftp/parse/test-queue.c b/archie/anonftp/parse/test-queue.c new file mode 100644 index 0000000..2b6ca6c --- /dev/null +++ b/archie/anonftp/parse/test-queue.c @@ -0,0 +1,80 @@ +#include +#include +#include "queue.h" + +#ifdef __STDC__ +extern void sig(int s) ; +#else +extern void sig(int s) ; +#endif + + +char *prog = "tq" ; +volatile int trap = 0 ; + +int main() +{ + char s[128] ; + int i ; + Queue_elt *qe ; + Queue *q1 = new_Queue() ; + Queue *q2 = new_Queue() ; + + signal(SIGINT, sig) ; + while(trap == 0) + { + /* fprintf(stderr, "start\n") ; sleep(1) ;*/ + for(i = 0 ; i < 1 ; i++) + { + if((qe = new_Queue_elt(sprintf(s, "foo %d", i))) == (Queue_elt *)0) + { + fprintf(stderr, "new_queue_elt failed.\n") ; + exit(1) ; + } + if( ! addq(qe, q1)) + { + fprintf(stderr, "addq failed.\n") ; + exit(1) ; + } + } + /* fprintf(stderr, "created 1\n") ;*/ + while((qe = remq(q1)) != (Queue_elt *)0) + { + addq(qe, q2) ; + } + /* fprintf(stderr, "moved 1 to 2\n") ;*/ + while((qe = remq(q2)) != (Queue_elt *)0) + { + dispose_Queue_elt(qe) ; + } + /* fprintf(stderr, "disposed of 2\n") ;*/ + } + printq("q1", q1) ; + printq("q2", q2) ; + return 1 ; +} + + +int +printq(s, q) + char *s ; + Queue *q ; +{ + Queue_elt *qe = q->head ; + + ptr_check(s, char, "printq", 0) ; + + while(qe != (Queue_elt *)0) + { + printf("%s: %s\n", s, qe->str) ; + qe = qe->prev ; + } + return 1 ; +} + + +void sig(s) + int s ; +{ + trap = 1 ; +} diff --git a/archie/anonftp/parse/test-vms_parser.c b/archie/anonftp/parse/test-vms_parser.c new file mode 100644 index 0000000..8c2ac85 --- /dev/null +++ b/archie/anonftp/parse/test-vms_parser.c @@ -0,0 +1,187 @@ +#include +#ifdef NULL +# undef NULL +#endif +#include +#include +#include +#include "defines.h" +#include "utils.h" +#include "db2v.h" +#include "parser_file.h" +#include "archie_inet.h" +#include "header.h" +#include "host_db.h" +#include "error.h" + +#ifdef __STDC__ + +extern int print_parser_info(FILE *fp, parser_entry_t *pe, char *name, int n) ; +extern void usage(void) ; + +#else + +extern int print_parser_info(/* FILE *fp, parser_entry_t *pe, char *name, int n */) ; +extern void usage(/* void */) ; + +#endif + +#define MAX_LINE_LEN 512 + + +char *prog ; +int verbose = 1 ; + + +int +main(ac, av) + int ac ; + char **av ; +{ + header_t h ; + int ignore_header = 0 ; + int len ; + long n = 0 ; + parser_entry_t pe ; + + prog = tail(av[0]) ; + + while(av++, --ac) + { + if(av[0][0] != '-') + { + usage() ; + } + else + { + switch(av[0][1]) + { + case 'h': + ignore_header = 1 ; + break ; + + default: + usage() ; + break ; + } + } + } + + if( ! ignore_header) + { + if(read_header(stdin, &h, (u32 *)0, 0,0) != A_OK) + { + fprintf(stderr, "%s: error from read_header().\n", prog) ; + exit(1) ; + } + if(write_header(stdout, &h, (u32 *)0, 0) != A_OK) + { + fprintf(stderr, "%s: error from write_header().\n", prog) ; + exit(1) ; + } + } + + while(1) + { + char name[MAX_LINE_LEN] ; + + if(fread((void *)&pe, sizeof pe, (size_t)1, stdin) < 1) + { + if(feof(stdin)) + { + if(ignore_header) + { + exit(0) ; + } + else + { + if(n == h.no_recs) + { + exit(0) ; + } + else + { + fflush(stdout) ; + fprintf(stderr, "%s: expected %ld records, but actually saw %ld.\n", prog, + (long)h.no_recs, n) ; + exit(1) ; + } + } + } + else + { + fflush(stdout) ; + fprintf(stderr, "%s: error fread'ing parser entry.\n", prog) ; + exit(1) ; + } + } + len = (pe.slen + 3) & ~0x03 ; + if(fread((void *)name, (size_t)len, (size_t)1, stdin) < 1) + { + if(feof(stdin)) + { + fflush(stdout) ; + fprintf(stderr, "%s: unexpected eof while trying to read file name (rec #%ld).\n", + prog, n) ; + exit(1) ; + } + else + { + fflush(stdout) ; + fprintf(stderr, "%s: error fread'ing %ld bytes for file name (rec #%ld).\n", + prog, (long)len, n) ; + exit(1) ; + } + } + *(name + len) = '\0' ; + if( ! print_parser_info(stdout, &pe, name, n)) + { + fflush(stdout) ; + fprintf(stderr, "%s: error from print_parser_info() (rec #%ld).\n", prog, n) ; + exit(1) ; + } + n++ ; + } + return 0 ; /* for gcc -Wall */ +} + + +int +print_parser_info(fp, pe, name, n) + FILE *fp ; + parser_entry_t *pe ; + char *name ; + int n ; +{ + char out[MAX_LINE_LEN] ; + char *s = out ; + + ptr_check(fp, FILE, "print_parser_info", 0) ; + ptr_check(pe, parser_entry_t, "print_parser_info", 0) ; + ptr_check(name, char, "print_parser_info", 0) ; + + if(CSE_IS_DIR(pe->core)) + { + sprintf(out, "%5d %5d %5d\t", n, pe->core.parent_idx, pe->core.child_idx) ; + } + else + { + sprintf(out, "%5d %5d %5s\t", n, pe->core.parent_idx, " ") ; + } + + strcat(out, name) ; strcat(out, " ") ; + db2v_size(pe, s = strend(s)) ; strcat(out, " ") ; + db2v_date(pe, s = strend(s), 64) ; strcat(out, " ") ; + db2v_owner(pe, s = strend(s)) ; strcat(out, " ") ; + db2v_perms(pe, s = strend(s)) ; + + return puts(out) != EOF ; +} + + +void +usage() +{ + fprintf(stderr, "Usage: %s [-h]\n", prog) ; + exit(1) ; +} diff --git a/archie/anonftp/parse/unix.c b/archie/anonftp/parse/unix.c new file mode 100644 index 0000000..32bece2 --- /dev/null +++ b/archie/anonftp/parse/unix.c @@ -0,0 +1,413 @@ +#include +#include +#include +#include "regexp.h" +#include "defines.h" +#include "parser_file.h" +#include "parse.h" +#include "utils.h" +#include "queue.h" +#include "stack.h" +#include "output.h" +#include "line_type.h" +#include "storage.h" +#include "pars_ent_holder.h" +#include "unix2.h" +#include "error.h" +#include "lang_parsers.h" +#ifdef SOLARIS +#include "protos.h" +#endif + +#define S_BLANK "^$" +#define S_CONT (regexp *)0 ; +#define S_DIR_START "^/?[^/]+(/[^/]+)*:$" +#define S_ERROR (regexp *)0 ; +#define S_FILE "^[-bcdlpsyDFL][-r][-w][-xsSl][-r][-w][-xsSl][-r][-w][-xtT][ \t]+" +#define S_PARTIAL (regexp *)0 ; +#define S_TOTAL "^total[ \t]+[0-9]+" +#define S_UNREAD "^[^ \t]+[ \t]+unreadable$" +#define S_UNKNOWN (regexp *)0 ; + +enum /* declared as enum to make debugging easier */ +{ + F_PERM = 0, + F_LINKS, + F_OWNER, + F_GROUP, + F_SIZE, + F_MONTH, + F_DAY, + F_T_Y, /* time (16:36) or year (1992) */ + F_NAME, + UNIX_NUM_FLDS /* this must be last */ +} ; + +static regexp *re[L_NUM_ELTS] ; + +static int leading_blanks = -1; + +char *S_dup_dir_name(name) + const char *name ; +{ + return strdup(name) ; +} + + +/* + Given a file line (see below for example) produce a core site entry + and return a pointer to the file name. Return a null pointer upon + an error. + + The input string will be overwritten. + + An input line looks something like: + + -rw------- 1 news 1630 Mar 18 16:15 #alt.music.alternative~ + + as well, a group name may be present and/or the time may be specified + differently: + + -rw-r--r-- 1 news 12 Jul 11 1991 .rhosts + or + -rw-r--r-- 1 news news 12 Jul 11 1991 .rhosts + + Then again, we may have a device with major and minor numbers in place of + the size: + + crw-rw-rw- 1 0 1 3, 12 Mar 19 17:03 zero +*/ + +char *S_file_parse(in, pe, is_dir) + char *in ; + parser_entry_t *pe ; + int *is_dir ; +{ + char *field[UNIX_NUM_FLDS] ; + char *p = in ; + int is_symlink = 0; + int num_blanks; + + ptr_check(in, char, "S_file_parse", (char *)0) ; + ptr_check(pe, parser_entry_t, "S_file_parse", (char *)0) ; + +#define try_get_dev_field(fld, instr, fldname) \ + do \ + { \ + instr += strspn(instr, DEV_WHITE_STR) ; \ + if((field[fld] = strsep(&instr, DEV_WHITE_STR)) == (char *)0) \ + { \ + /* "Error looking for white space after %s" */\ + error(A_ERR, "S_file_parse", U_S_FILE_PARSE_001, fldname) ; \ + return (char *)0 ; \ + } \ + } while(0) + +#define try_get_field(fld, instr, fldname) \ + do \ + { \ + instr += strspn(instr, WHITE_STR) ; \ + if((field[fld] = strsep(&instr, WHITE_STR)) == (char *)0) \ + { \ + /* "Error looking for white space after %s" */\ + error(A_ERR, "S_file_parse", U_S_FILE_PARSE_001, fldname) ; \ + return (char *)0 ; \ + } \ + } while(0) + + + try_get_field(F_PERM, p, "permissions") ; + try_get_field(F_LINKS, p, "links") ; + try_get_field(F_OWNER, p, "owner") ; + + if(*field[F_PERM] == 'b' || *field[F_PERM] == 'c') /* devices */ + { + try_get_dev_field(F_GROUP, p, "group or major number") ; + if(*(field[F_GROUP] + strlen(field[F_GROUP]) - 1) == ',' ) /* is major number */ + + { + /* there is no group -- toss the major and minor numbers */ + + try_get_field(F_GROUP, p, "minor number") ; + field[F_GROUP] = (char *)0 ; + } + else /* is group */ + { + /* there is a group -- still toss the major and minor numbers */ +#if 0 + + p+= strspn(p, DEV_WHITE_STR) ; + if((field[F_NAME] = strsep(&p, DEV_WHITE_STR)) == (char *)0) + { + /* "Error looking for white space after %s" */ + error(A_ERR, "S_file_parse", U_S_FILE_PARSE_001, "major") ; + return (char *)0 ; + } + + p += strspn(p, DEV_WHITE_STR) ; + + if((field[F_NAME] = strsep(&p, DEV_WHITE_STR)) == (char *)0) + { + /* "Error looking for white space after %s" */ + error(A_ERR, "S_file_parse", U_S_FILE_PARSE_001, "minor") ; + return (char *)0 ; + } +#endif + if ( strchr(field[F_GROUP],',') == NULL ) { + char *ptr; + + try_get_dev_field(F_NAME, p, "major number") ; + ptr = strchr(field[F_NAME],','); + + if ( ptr == NULL || ptr-field[F_NAME] == strlen(field[F_NAME])-1 ) + try_get_dev_field(F_NAME, p, "minor number") ; + } + + } + field[F_SIZE] = "0" ; + try_get_field(F_MONTH, p, "month") ; + } + else /* non-devices */ + { + is_symlink = *field[F_PERM] == 'l'; + + try_get_field(F_GROUP, p, "group or size") ; /* may be size */ + try_get_field(F_SIZE, p, "size or month") ; /* may be month */ + + if(isdigit(*field[F_SIZE])) /* there was a group field */ + { + try_get_field(F_MONTH, p, "month") ; + } + else /* no group field -- group was size, size was month */ + { + field[F_MONTH] = field[F_SIZE] ; + field[F_SIZE] = field[F_GROUP] ; + field[F_GROUP] = (char *)0 ; + } + } + + try_get_field(F_DAY, p, "day") ; + try_get_field(F_T_Y, p, "time or year") ; + + num_blanks = strspn(p, WHITE_STR); /* Assume that there is 1 separating */ + if ( leading_blanks > num_blanks ) { + leading_blanks = num_blanks; + error(A_INFO,"S_file_parse", "Confused by leading blank characters, will restart and try to be more intelligent !"); + return 0; + } + if ( leading_blanks == -1 ) + leading_blanks = num_blanks; + + p+= leading_blanks; + + + + field[F_NAME] = p ; + if(*field[F_NAME] == '\0') + { + + /* "Missing file name" */ + + error(A_ERR, "S_file_parse", U_S_FILE_PARSE_002) ; + return (char *)0 ; + } + + /* + If the file is a symbolic link, put a nul at the first occurrence + of " -> ". + */ + if (is_symlink) + { + char *p; + + if ( ! (p = strstr(field[F_NAME], " -> "))) + { + error(A_WARN, "S_file_parse", U_S_FILE_PARSE_006, in, line_num()); + } + else + { + *p = '\0'; + } + } + +#ifdef __STDC__ + +#define try_cvt_str(s) if( ! (s)) do { error(A_ERR, "S_file_parse", "Error from " #s "\n") ; return (char *)0 ; } while(0) +#else + +/* "Error extracting field" */ + +#define try_cvt_str(s) if( ! (s)) do { error(A_ERR, "S_file_parse", U_S_FILE_PARSE_004) ; return (char *)0 ; } while(0) +#endif + + try_cvt_str(u2db_perm(field[F_PERM], &pe->core)) ; + try_cvt_str(u2db_owner(field[F_OWNER], field[F_GROUP], &pe->core)) ; + try_cvt_str(u2db_size(field[F_SIZE], &pe->core)) ; + try_cvt_str(u2db_time(field[F_MONTH], field[F_DAY], field[F_T_Y], &pe->core)) ; + + pe->slen = strlen(field[F_NAME]) ; /* when writing we don't include the nul terminator */ + + /* Is it an entry for a directory? */ + + if( ! S_file_type(field[F_PERM], is_dir)) + { + + /* "Error from S_file_type()" */ + + error(A_ERR, "S_file_parse", U_S_FILE_PARSE_005) ; + return (char *)0 ; + } + return field[F_NAME] ; + +#undef try_get_field +#undef try_cvt_str +} + + +int S_file_type(s, is_dir) + const char *s ; + int *is_dir ; +{ + ptr_check(s, char, "S_file_type", 0) ; + ptr_check(is_dir, int, "S_file_type", 0) ; + + *is_dir = ((*s == 'd') || (*s == 'D')); + return 1 ; +} + + +int S_init_parser() +{ + re[L_BLANK] = regcomp(S_BLANK) ; + re[L_CONT] = S_CONT ; + re[L_DIR_START] = regcomp(S_DIR_START) ; + re[L_ERROR] = S_ERROR ; + re[L_FILE] = regcomp(S_FILE) ; + re[L_PARTIAL] = S_PARTIAL ; + re[L_TOTAL] = regcomp(S_TOTAL) ; + re[L_UNREAD] = regcomp(S_UNREAD) ; + re[L_UNKNOWN] = S_UNKNOWN ; + + return 1 ; +} + + +#ifdef DEBUG +# define dbg_show(t) error(A_INFO,"(unknown)", "D: %s '%s'\n", t, line) ; +#else +# define dbg_show(t) /* nothing */ +#endif + +int S_line_type(line) + const char *line ; +{ + ptr_check(line, char, "S_line_type", L_INTERN_ERR) ; + + if(regexec(re[L_FILE], line)) + { + dbg_show("file") ; + return L_FILE ; + } + else if(regexec(re[L_BLANK], line)) + { + dbg_show("blank") ; + return L_BLANK ; + } + else if(regexec(re[L_DIR_START], line)) + { + dbg_show("dir_start") ; + return L_DIR_START ; + } + else if(regexec(re[L_TOTAL], line)) + { + dbg_show("total") ; + return L_TOTAL ; + } + else if(regexec(re[L_UNREAD], line)) + { + dbg_show("unreadable") ; + return L_UNREAD ; + } + else + { + dbg_show("unknown") ; + return L_UNKNOWN ; + } +} + + +/* + Split a directory path name into its components. + + Return a pointer to an array of pointers into 'str', where each element + points to the start of a file name in the path. The number of path elements + will be returned in 'n'. If this type of listing has device name prefixes, + then '*dev' will point to it. + + The string will be overwritten. + + If an error occurs return a null pointer. +*/ + +int S_split_dir(str, prep_dir, dev, n, p) + char *str ; + char *prep_dir ; + int *dev ; + int *n ; + char ***p ; +{ + static char *path[MAX_PATH_ELTS + 1] ; + char *s = str ; + int i = 0 ; + + ptr_check(str, char, "S_split_dir", 0) ; + ptr_check(dev, int, "S_split_dir", 0) ; + ptr_check(n, int, "S_split_dir", 0) ; + ptr_check(p, char **, "S_split_dir", 0) ; + + *dev = 0 ; /* UNIX sites don't have a device name prefix */ + if(prep_dir != (char *)0) + { + path[i++] = prep_dir ; + } + if(*s == '/') /* any leading / is meaningless to us */ + { + s++ ; + } + path[i++] = s ; + while(*s != '\0') + { + if(*s != '/') + { + s++ ; + } + else + { + *s++ = '\0' ; + path[i++] = s ; + } + } + if(*--s == ':') /* knock off the trailing colon from the file name */ + { + *s = '\0' ; + } + else + { + + /* "Expected ':' at end of path, but found '%c'" */ + + error(A_ERR, "S_split_dir", S_SPLIT_DIR_001, *s) ; + return 0 ; + } + *n = i ; + *p = path ; + return 1 ; +} + + +int set_blanks(num) + int num; +{ + if (leading_blanks != -1 ) + leading_blanks -= num; +} diff --git a/archie/anonftp/parse/unix2.c b/archie/anonftp/parse/unix2.c new file mode 100644 index 0000000..110dc0e --- /dev/null +++ b/archie/anonftp/parse/unix2.c @@ -0,0 +1,325 @@ +#include +#include +#include +#if defined(AIX) || defined(SOLARIS) +#include +#include +#endif +#include "defines.h" +#include "parse.h" +#include "site_file.h" +#include "unix2.h" +#include "error.h" +#include "lang_parsers.h" + +/* + 'mon' points to the first character of the month string. + + E.g. "Mar" + + 'day' points to the first character of the day string. + + E.g. "25" + + 't_y' points to the first character of the "time or year" string. + + E.g. "13:51" or "1992" + + Assume: time_t is the number of seconds since 00:00:00 Jan 1, 1970 GMT. ANSI does not + guarantee this. +*/ + +int +u2db_time(mon, day, t_y, cse) + const char *mon ; + const char *day ; + const char *t_y ; + core_site_entry_t *cse ; +{ + extern int local_timezone; + + static char *months[13] = { "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", + "Aug", "Sep", "Oct", "Nov", "Dec", (char *)0 } ; + static struct tm *mytime; + int dm ; + int hr ; + int m = 0 ; + int min ; + int y ; + struct tm bd_time ; /* broken down time */ + time_t ltime; + time_t the_time ; + +#if defined(AIX) || defined(SOLARIS) + + extern long timezone; + +#else + + extern time_t time(); + struct tm *our_time ; /* broken down time */ + +#endif + + ptr_check(mon, char, "u2db_time", 0) ; + ptr_check(day, char, "u2db_time", 0) ; + ptr_check(t_y, char, "u2db_time", 0) ; + ptr_check(cse, core_site_entry_t, "u2db_time", 0) ; + + if(mytime == (struct tm *) NULL){ + the_time = time((time_t *) NULL); + + + if((mytime = (struct tm *) malloc(sizeof(struct tm))) == (struct tm *) NULL){ + + error(A_SYSERR, "u2db_time", "Can't malloc space for time structure"); + return 0; + } + + memcpy(mytime, gmtime(&the_time), sizeof(struct tm)); + } + + while(months[m] != (char *)0) + { + if(strncmp(mon, months[m], 4) == 0) + { + break ; + } + else + { + m++ ; + } + } + if(m == 12) + { + return 0 ; + } + + if(sscanf(day, "%d", &dm) != 1) + { + + /* "Error in date '%s'" */ + + error(A_ERR, "u2db_time", U2DB_TIME_001, day) ; + return 0 ; + } + if(t_y[2] == ':') + { + if(sscanf(t_y, "%2d:%2d", &hr, &min) != 2) + { + + /* "Error in time '%s'" */ + + error(A_ERR, "u2db_time", U2DB_TIME_002, t_y) ; + return 0 ; + } + + + if(mytime -> tm_mon - m < 6 ){ + if(mytime -> tm_mon - m < 0 ) + y = mytime -> tm_year + 1900 - 1; + else + y = mytime -> tm_year + 1900; + } + else + y = mytime -> tm_year + 1900; + + } + else + { + if(sscanf(t_y, "%d", &y) != 1) + { + + /* "Error in year '%s'" */ + + error(A_ERR, "u2db_time", U2DB_TIME_003, t_y) ; + return 0 ; + } + hr = 0 ; + min = 0 ; + } + if(dm < 1 || dm > 31 || y < 1900) + { + + +/* "Day-of-month or year value error in '%s %s %s'" */ + + error(A_ERR, "u2db_time", U2DB_TIME_004, mon, day, t_y) ; + return 0 ; + } + +#if defined(AIX) || defined(SOLARIS) + + /* AIX can't handle dates less than 1970, so reset them to that */ + + if(y < 1970) + y = 1970; + +#endif + + if(hr < 0 || hr > 23 || min < 0 || min > 59) + { + + + /* "Hour or minute value error in '%s'" */ + + error(A_ERR, "u2db_time", U2DB_TIME_005, t_y) ; + return 0 ; + } + else + { + time_t timenow; + + memset((void *)&bd_time, 0, sizeof bd_time) ; + bd_time.tm_sec = 0 ; + bd_time.tm_min = min ; + bd_time.tm_hour = hr ; + bd_time.tm_mday = dm ; + bd_time.tm_mon = m ; + bd_time.tm_year = y - 1900 ; + bd_time.tm_isdst = -1 ; + +#if !defined(AIX) && !defined(SOLARIS) + + timenow = time((time_t *) NULL); + + our_time = localtime(&timenow); + + ltime = our_time -> tm_gmtoff + local_timezone; + + + if((the_time = timelocal(&bd_time)) == -1) + { + + /* "Error from timelocal()" */ + + error(A_ERR, "u2db_time", U2DB_TIME_006) ; + + /* reset the time to "now" */ + + the_time = time((time_t) NULL); + } + +#else + + ltime = (timezone * timezone_sign()) + local_timezone; + + + if((the_time = mktime(&bd_time)) == -1) + { + + /* "Error from timegm()" */ + + error(A_ERR, "u2db_time", U2DB_TIME_007) ; + + /* reset the time to "now" */ + + the_time = time((time_t) NULL); + + } + +#endif + + + cse->date = the_time + ltime; + } + return 1 ; +} + + +int +u2db_links(v, cse) + const char *v ; + core_site_entry_t *cse ; +{ + ptr_check(v, char, "u2db_links", 0) ; + ptr_check(cse, core_site_entry_t, "u2db_links", 0) ; + return 1 ; +} + + +int +u2db_name(v, cse) + const char *v ; + core_site_entry_t *cse ; +{ + ptr_check(v, char, "u2db_name", 0) ; + ptr_check(cse, core_site_entry_t, "u2db_name", 0) ; + return 1 ; +} + + +int +u2db_owner(u, v, cse) + const char *u ; + const char *v ; + core_site_entry_t *cse ; +{ + ptr_check(u, char, "u2db_owner", 0) ; + /* v (group) may be null */ + ptr_check(cse, core_site_entry_t, "u2db_owner", 0) ; + return 1 ; +} + + +int +u2db_perm(v, cse) + const char *v ; + core_site_entry_t *cse ; +{ + int i, j; + perms_t perms = 0 ; + + ptr_check(v, char, "u2db_perm", 0) ; + ptr_check(cse, core_site_entry_t, "u2db_perm", 0) ; + + for(i=0, j = 9 ; i < 9 ;i++, j--) + { + switch(v[j]) + { + case 'r': + case 'w': + case 'x': + case 't': + case 's': + case 'l': + case 'S': + case 'T': + perms |= 0x01 << i; + break ; + + case '-': + break; + + default: + + /* "Unknown permission character %c, line %s" */ + + error(A_ERR, "u2db_perm", U2DB_PERM_001, v[j], v) ; + return 0 ; + } + } + + cse->perms = perms ; + return 1 ; +} + + +int +u2db_size(v, cse) + const char *v ; + core_site_entry_t *cse ; +{ + ptr_check(v, char, "u2db_size", 0) ; + ptr_check(cse, core_site_entry_t, "u2db_size", 0) ; + + if( ! isdigit((int)*v)) + { + return 0 ; + } + else + { + cse->size = atoi(v) ; + return 1 ; + } +} diff --git a/archie/anonftp/parse/unix2.h b/archie/anonftp/parse/unix2.h new file mode 100644 index 0000000..52924f4 --- /dev/null +++ b/archie/anonftp/parse/unix2.h @@ -0,0 +1,25 @@ +#ifndef UNIX2_H +#define UNIX2_H + +#ifdef __STDC__ + +extern int u2db_links(const char *v, core_site_entry_t *cse) ; +extern int u2db_name(const char *v, core_site_entry_t *cse) ; +extern int u2db_owner(const char *u, const char *v, core_site_entry_t *cse) ; +extern int u2db_perm(const char *v, core_site_entry_t *cse) ; +extern int u2db_size(const char *v, core_site_entry_t *cse) ; +extern int u2db_time(const char *mon, const char *day, const char *t_y, core_site_entry_t *cse) ; +extern int u2db_type(const char *v, core_site_entry_t *cse) ; + +#else + +extern int u2db_links(/* const char *v, core_site_entry_t *cse */) ; +extern int u2db_name(/* const char *v, core_site_entry_t *cse */) ; +extern int u2db_owner(/* const char *u, const char *v, core_site_entry_t *cse */) ; +extern int u2db_perm(/* const char *v, core_site_entry_t *cse */) ; +extern int u2db_size(/* const char *v, core_site_entry_t *cse */) ; +extern int u2db_time(/* const char *mon, const char *day, const char *t_y, core_site_entry_t *cse */) ; +extern int u2db_type(/* const char *v, core_site_entry_t *cse */) ; + +#endif +#endif diff --git a/archie/anonftp/parse/unix_filter b/archie/anonftp/parse/unix_filter new file mode 100644 index 0000000..bd945c6 --- /dev/null +++ b/archie/anonftp/parse/unix_filter @@ -0,0 +1,26 @@ +#!/bin/sh +# +# Filter UNIX listings to get rid of selected bogosities. +# +# - Bill Heelan (wheelan@cs.mcgill.ca) +# +sed ' +# trash the line with the error and the one following it. + +/: Permission denied$/{ +N +d +} + +# trash the line with the error + +/[ ]not found$/d +/: Could not open/d +/^can not access directory/d +/^Total: [0-9][0-9]* kbytes$/d + +# separate any permissions and links fields that have been +# squashed together + +/^\([-bcdlps][-r][-w][-xsS][-r][-w][-xsS][-r][-w][-xtT]\)\([0-9][0-9]*\)[ ]/s//\1 \2 / +' diff --git a/archie/anonftp/parse/utils.c b/archie/anonftp/parse/utils.c new file mode 100644 index 0000000..219abf6 --- /dev/null +++ b/archie/anonftp/parse/utils.c @@ -0,0 +1,147 @@ +#include +#include +#include "defines.h" +#include "parse.h" +#include "error.h" + + +int +vfprintf_path(fp, p, n) + FILE *fp ; + char **p ; + int n ; +{ + ptr_check(fp, FILE, "vfprintf_path", 0) ; + ptr_check(p, char *, "vfprintf_path", 0) ; + + if(n < 1) + { + return 0 ; + } + else + { + int i ; + + for(i = 0 ; i < n - 1 ; i++) + { + fprintf(stderr, "%s/", p[i]) ; + } + fprintf(stderr, "%s", p[i]) ; + return 1 ; + } +} + +char * +nuke_nl(s) + char *s ; +{ + char *p ; + + ptr_check(s, char, "nuke_nl", (char *)0) ; + + p = strchr(s, '\n') ; + if(p != (char *)0) + { + *p = '\0' ; + } + return s ; +} + +#if 0 +char * +strdup(s) + char *s ; +{ + char *t ; + + ptr_check(s, char, "strdup", (char *)0) ; + + t = (char *)malloc((size_t)(strlen(s)+1)) ; + return t == (char *)0 ? t : strcpy(t, s) ; +} +#endif + +/* + Return a pointer to the nul in a nul terminated string. +*/ + +char * +strend(s) + char *s ; +{ + ptr_check(s, char, "strend", (char *)0) ; + + for( ; *s != '\0' ; s++) + ; + return s ; +} + +static char * +findfirst(s, set) + char *s ; + char *set ; +{ + char *p ; + + ptr_check(s, char, "findfirst", (char *)0) ; + ptr_check(set, char, "findfirst", (char *)0) ; + + for( ; *s != '\0' ; s++) + { + for(p = set ; *p != '\0' ; p++) + { + if(*p == *s) + { + return s ; + } + } + } + return (char *)0 ; +} + +/* + Return a pointer to the first occurence in '*s' of a character in 'set'. If none + exists return the null pointer. + + If a character is found, set it to '\0' and set *s to point to the first character + after the '\0'. +*/ + +char * +strsep(s, set) + char **s ; + char *set ; +{ + char *p ; + char *start = *s ; + + ptr_check(s, char *, "strsep", (char *)0) ; + ptr_check(*s, char, "strsep", (char *)0) ; + ptr_check(set, char, "strsep", (char *)0) ; + + if((p = findfirst(*s, set)) == (char *)0) + { + return (char *)0 ; + } + else + { + *p = '\0' ; + *s = ++p ; + return start ; + } +} + +#if 0 +char * +tail(path) + char *path ; +{ + char *p ; + + ptr_check(path, char, "tail", (char *)0) ; + + p = strrchr(path, '/') ; + return p == (char *)0 ? path : ++p ; +} + +#endif diff --git a/archie/anonftp/parse/utils.h b/archie/anonftp/parse/utils.h new file mode 100644 index 0000000..533e40b --- /dev/null +++ b/archie/anonftp/parse/utils.h @@ -0,0 +1,21 @@ +#ifndef UTILS_H +#define UTILS_H + +#ifdef __STDC__ + +extern char *nuke_nl(char *s) ; +extern char *strend(char *s) ; +extern char *strsep(char **s, char *set) ; +extern char *tail(char *path) ; +extern int fprintf_path(FILE *fp, char **p, int n) ; + +#else + +extern char *nuke_nl(/* char *s */) ; +extern char *strend(/* char *s */) ; +extern char *strsep(/* char **s, char *set */) ; +extern char *tail(/* char *path */) ; +extern int fprintf_path(/* FILE *fp, char **p, int n */) ; + +#endif +#endif diff --git a/archie/anonftp/parse/vms.c b/archie/anonftp/parse/vms.c new file mode 100644 index 0000000..f4fe74a --- /dev/null +++ b/archie/anonftp/parse/vms.c @@ -0,0 +1,318 @@ +/* + vms.c +*/ + +#include +#include +#include "defines.h" +#include "regexp.h" +#include "parser_file.h" +#include "parse.h" +#include "utils.h" +#include "queue.h" +#include "stack.h" +#include "output.h" +#include "line_type.h" +#include "storage.h" +#include "pars_ent_holder.h" +#include "error.h" +#include "lang_parsers.h" +#include "vms2.h" +#ifdef SOLARIS +#include "protos.h" +#endif +static regexp *re_cont ; +static regexp *re_dir_start ; +static regexp *re_error ; +static regexp *re_file ; +static regexp *re_partial ; + +#define S_BLANK "^$" +#define S_CONT "^[ \t]+[%0-9]" +#define S_DIR_START "^([^:]+):\\[([^].]+)(\\.[^].]+)*\\]" +#define S_ERROR "^[^.]*\\.[^;]*;[0-9]+[ \t]+[%0-9]" +#define S_FILE "^[^.]*\\.[^;]*;[0-9]+[ \t]+[0-9]+" +#define S_PARTIAL "^[^.]*\\.[^;]*;[0-9]+" +#define S_TOTAL "^Total of|^Grand total of" +#define S_UNKNOWN (regexp *)0 ; + +static regexp *re[L_NUM_ELTS] ; + + +#define F_NAME 0 +#define F_SIZE 1 +#define F_DATE 2 +#define F_TIME 3 +#define F_OWN 4 +#define F_PERM 5 +#define VMS_NUM_FLDS (F_PERM+1) + + +char * +S_dup_dir_name(name) + const char *name ; +{ + char *d = strchr(name, '.') ; /* can it only have one '.'? */ + + if(d == (char *)0) + { + + /* "'%S' doesn't contain a '.'" */ + + error(A_ERR, "S_dup_dir_name", S_DUP_DIR_NAME_001, name) ; + return (char *)0 ; + } + else + { + char *s ; + + *d = '\0' ; + s = strdup(name) ; + *d = '.' ; + return s ; + } +} + +/* + Given a file line (see below for example) produce a core site entry + and return a pointer to the file name. Return a null pointer upon + an error. + + The input string will be overwritten. + + An input line looks something like: + + ARIZONET.DIS;10 2 8-NOV-1989 17:05 NETINFO (RWED,RWED,RWED,RE) +*/ + +char * +S_file_parse(in, pe, is_dir) + char *in ; + parser_entry_t *pe ; + int *is_dir ; +{ + char *field[VMS_NUM_FLDS] ; + + ptr_check(in, char, "S_file_parse", (char *)0) ; + ptr_check(pe, parser_entry_t, "S_file_parse", (char *)0) ; + +#define try_get_field(fld, instr, fldname) \ + if((field[fld] = strtok(instr, WHITE_STR)) == (char *)0) \ + do \ + { \ + /* "Error looking for white space after %s" */\ + error(A_ERR, "S_file_parse", V_S_FILE_PARSE_001, fldname) ; \ + return (char *)0 ; \ + } while(0) + + try_get_field(F_NAME, in, "file name") ; + try_get_field(F_SIZE, (char *)0, "file size") ; + try_get_field(F_DATE, (char *)0, "date") ; + try_get_field(F_TIME, (char *)0, "time") ; + try_get_field(F_OWN, (char *)0, "owner") ; + try_get_field(F_PERM, (char *)0, "permissions") ; + +#ifdef __STDC__ +#define try_cvt_str(s) \ + if( ! (s)) \ + do \ + { \ + error(A_ERR, "S_file_parse","Error from " #s "\n") ; return (char *)0 ; \ + } while(0) +#else +#define try_cvt_str(s) \ + if( ! (s)) \ + do \ + { \ + /* "Error extracting field" */\ + error(A_ERR, "S_file_parse", V_S_FILE_PARSE_002) ; return (char *)0 ; \ + } while(0) +#endif + + try_cvt_str(v2db_perm(field[F_PERM], &pe->core)) ; + try_cvt_str(v2db_owner(field[F_OWN], &pe->core)) ; /* includes group owner */ + try_cvt_str(v2db_size(field[F_SIZE], &pe->core)) ; + try_cvt_str(v2db_time(field[F_DATE], field[F_TIME], &pe->core)) ; + + pe->slen = strlen(field[F_NAME]) ; /* when writing we don't include the nul terinator */ + + /* Is it an entry for a directory? */ + + if( ! S_file_type(field[F_NAME], is_dir)) + { + + /* "Error from S_file_type()" */ + + error(A_ERR, "S_file_parse", V_S_FILE_PARSE_003) ; + return (char *)0 ; + } + return field[F_NAME] ; + +#undef try_get_field +#undef try_cvt_str +} + +int +S_file_type(s, is_dir) + const char *s ; + int *is_dir ; +{ + char *d = strchr(s, '.') ; + + ptr_check(s, char, "S_file_type", 0) ; + ptr_check(is_dir, int, "S_file_type", 0) ; + + if(d == (char *)0) + { + + + /* "Can't find '.' in file name '%s'" */ + + error(A_ERR, "S_file_type", S_FILE_TYPE_001, s) ; + return 0 ; + } + else + { + *is_dir = strncmp(d, ".DIR;", 5) == 0 ; + return 1 ; + } +} + +int +S_init_parser() +{ + re[L_BLANK] = regcomp(S_BLANK) ; + re[L_CONT] = regcomp(S_CONT) ; + re[L_DIR_START] = regcomp(S_DIR_START) ; + re[L_ERROR] = regcomp(S_ERROR) ; + re[L_FILE] = regcomp(S_FILE) ; + re[L_PARTIAL] = regcomp(S_PARTIAL) ; + re[L_TOTAL] = regcomp(S_TOTAL) ; + re[L_UNKNOWN] = S_UNKNOWN ; + return 1 ; +} + +#ifdef DEBUG +# define dbg_show(t) error(A_INFO, "(unknown)", "D: %s '%s'", t, nuke_nl(line)) ; +#else +# define dbg_show(t) /* nothing */ +#endif + +int +S_line_type(line) + const char *line ; +{ + ptr_check(line, char, "S_line_type", L_INTERN_ERR) ; + + if(regexec(re[L_FILE], line)) + { + dbg_show("file") ; + return L_FILE ; + } + else if(regexec(re[L_BLANK], line)) + { + dbg_show("blank") ; + return L_BLANK ; + } + else if(regexec(re[L_DIR_START], line)) + { + dbg_show("dir_start") ; + return L_DIR_START ; + } + else if(regexec(re[L_ERROR], line)) + { + dbg_show("error") ; + return L_ERROR ; + } + else if(regexec(re[L_PARTIAL], line)) /* should check length as well */ + { + dbg_show("partial") ; + return L_PARTIAL ; + } + else if(regexec(re[L_CONT], line)) + { + dbg_show("cont") ; + return L_CONT ; + } + else if(regexec(re[L_TOTAL], line)) + { + dbg_show("total") ; + return L_TOTAL ; + } + else + { + dbg_show("unknown") ; + return L_UNKNOWN ; + } +} + + +/* + Split a directory path name into its components. + + Return a pointer to an array of pointers into 'str', where each + element points to the start of a file name in the path. The + number of path elements will be returned in 'n'. + + If this type of listing has device name prefixes, then '*dev' will + point to it. + + The string will be overwritten. + + If an error occurs return a null pointer. +*/ + +#define DEV_TERM ':' +#define PATH_START '[' +#define PATH_SEP '.' +#define PATH_END ']' + +int +S_split_dir(str, prep_dir, dev, n, p) + char *str ; + char *prep_dir ; + int *dev ; + int *n ; + char ***p ; +{ + static char *path[MAX_PATH_ELTS + 1] ; + char *s = str ; + int i = 0 ; + + ptr_check(str, char, "S_split_dir", 0) ; + ptr_check(dev, int, "S_split_dir", 0) ; + ptr_check(n, int, "S_split_dir", 0) ; + ptr_check(p, char **, "S_split_dir", 0) ; + + *dev = 1 ; /* VMS sites have a device name prefix */ + path[i++] = s ; + *(s = strchr(s, DEV_TERM)) = '\0' ; + s += 2 ; + do + { + path[i++] = s ; + switch(*(s = strpbrk(s, ".]"))) + { + case '.': + *s++ = '\0' ; + break ; + + case ']': + *s = '\0' ; /* terminate the loop */ + break ; + } + } + while(*s != '\0') ; + *n = i ; + *p = path ; + return 1 ; +} + + +int set_blanks(num) + int num; +{ +/* if (leading_blanks != -1 ) + leading_blanks -= num; + */ +} diff --git a/archie/anonftp/parse/vms2.c b/archie/anonftp/parse/vms2.c new file mode 100644 index 0000000..2747382 --- /dev/null +++ b/archie/anonftp/parse/vms2.c @@ -0,0 +1,309 @@ +#include +#include +#include +#if defined(AIX) || defined(SOLARIS) +#include +#include +#endif +#include "defines.h" +#include "parse.h" +#include "site_file.h" +#include "error.h" +#include "lang_parsers.h" + +/* + 'd' points to the first character of the date string. + + E.g. "15-JUL-1991" + + 't' points to the first character of the time string. + + E.g. "13:51" + + Assume: time_t is the number of seconds since 00:00:00 Jan 1, 1970 GMT. ANSI does not + guarantee this. +*/ + +int +v2db_time(d, t, cse) + char *d ; + char *t ; + core_site_entry_t *cse ; +{ + extern int local_timezone; + + static char *months[13] = { "JAN", "FEB", "MAR", "APR", "MAY", "JUN", "JUL", + "AUG", "SEP", "OCT", "NOV", "DEC", (char *)0 } ; + char mstr[4] ; /* error waiting to happen... */ + date_time_t dt = 0 ; + int dm ; + int hr ; + int m = 0 ; + int min ; + int y ; + struct tm bd_time ; /* broken down time */ + time_t the_time ; + time_t ltime ; + +#if defined(AIX) || defined(SOLARIS) + + extern long timezone; + +#else + + struct tm *our_time ; /* broken down time */ + +#endif + + ptr_check(d, char, "v2db_time", 0) ; + ptr_check(t, char, "v2db_time", 0) ; + ptr_check(cse, core_site_entry_t, "v2db_time", 0) ; + + if(sscanf(d, "%d-%[^-]-%d", &dm, mstr, &y) != 3) + { + + /* "Error in date '%s'" */ + + error(A_ERR, "v2db_date", V2DB_DATE_001, d) ; + return 0 ; + } + if(sscanf(t, "%2d:%2d", &hr, &min) != 2) + { + + /* "Error in time '%s'" */ + + error(A_ERR, "v2db_date", V2DB_DATE_002, t) ; + return 0 ; + } + if(dm > 31 || y < 1970) + { + + + /* "Day-of-month or year value error in '%s'" */ + + error(A_ERR, "v2db_date", V2DB_DATE_003, d) ; + return 0 ; + } + if(hr > 23 || min > 59) + { + + + /* "Hour or minute value error in '%s'" */ + + error(A_ERR, "v2db_date", V2DB_DATE_004, t) ; + return 0 ; + } + else + { + time_t timenow; + + + while(months[m] != (char *)0) + { + if(strncmp(mstr, months[m], 3) == 0) + { + break ; + } + else + { + m++ ; + } + } + if(m == 12) + { + return 0 ; + } + memset((void *)&bd_time, 0, sizeof bd_time) ; + bd_time.tm_sec = 0 ; + bd_time.tm_min = min ; + bd_time.tm_hour = hr ; + bd_time.tm_mday = dm ; + bd_time.tm_mon = m ; + bd_time.tm_year = y - 1900 ; + bd_time.tm_isdst = -1 ; + +#if !defined(AIX) && !defined(SOLARIS) + + timenow = time((time_t *) NULL); + + our_time = localtime(&timenow); + + ltime = our_time -> tm_gmtoff + local_timezone; + + if((the_time = timelocal(&bd_time)) == -1) + { + + /* "Error from timegm()" */ + + error(A_ERR, "v2db_time", V2DB_DATE_005 ) ; + return 0 ; + } + +#else + + ltime = timezone + local_timezone; + + if((the_time = mktime(&bd_time)) == -1) + { + + /* "Error from timegm()" */ + + error(A_ERR, "v2db_time", V2DB_DATE_005 ) ; + return 0 ; + } + + +#endif + + + cse->date = the_time + ltime; + } + return 1 ; +} + +int +v2db_links(v, cse) + char *v ; + core_site_entry_t *cse ; +{ + ptr_check(v, char, "v2db_links", 0) ; + return 1 ; +} + +int +v2db_name(v, cse) + char *v ; + core_site_entry_t *cse ; +{ + ptr_check(v, char, "v2db_name", 0) ; + return 1 ; +} + +static int +v2db_one_set_perm(in, perm) + char *in ; + perms_t *perm ; +{ + char *iptr = in ; + perms_t p = 0 ; + + ptr_check(in, char, "v2db_one_set_perm", 0) ; + ptr_check(perm, perms_t, "v2db_one_set_perm", 0) ; + + while(*iptr != ',' && *iptr != ')') + { + switch(*iptr++) + { + case 'R': p |= 0x08 ; break ; + case 'W': p |= 0x04 ; break ; + case 'E': p |= 0x02 ; break ; + case 'D': p |= 0x01 ; break ; + + default: + + /* "Unexpected character ('%c') in permissions '%s'" */ + + error(A_ERR, "v2db_one_set_perm", V2DB_ONE_SET_PERM_001, *(iptr - 1), in) ; + return 0 ; + } + } + + *perm = p ; + return 1 ; +} + +int +v2db_owner(v, cse) + char *v ; + core_site_entry_t *cse ; +{ + ptr_check(v, char, "v2db_owner", 0) ; + ptr_check(cse, core_site_entry_t, "v2db_owner", 0) ; + return 1 ; +} + +int +v2db_perm(v, cse) + char *v ; + core_site_entry_t *cse ; +{ + perms_t p = 0 ; + perms_t perms = 0 ; + + ptr_check(v, char, "v2db_perm", 0) ; + ptr_check(cse, core_site_entry_t, "v2db_perm", 0) ; + + /* Probably should do some error checking in here. */ + + ++v ; + v2db_one_set_perm(v, &p) ; + perms = p << 12 ; + + while(*v++ != ',') ; + + v2db_one_set_perm(v, &p) ; + perms |= p << 8 ; + + while(*v++ != ',') ; + + v2db_one_set_perm(v, &p) ; + perms |= p << 4 ; + + while(*v++ != ',') ; + + v2db_one_set_perm(v, &p) ; + perms |= p ; + + cse->perms |= perms ; + return 1 ; +} + +int +v2db_size(v, cse) + char *v ; + core_site_entry_t *cse ; +{ + ptr_check(v, char, "v2db_size", 0) ; + ptr_check(cse, core_site_entry_t, "v2db_size", 0) ; + + if( ! isdigit((int)*v)) + { + return 0 ; + } + else + { + cse->size = atoi(v) ; + return 1 ; + } +} + + +#if 0 /* Directory or non-directory is determined higher up */ +int +v2db_type(v, cse) + char *v ; + core_site_entry_t *cse ; +{ + char *p ; + + ptr_check(v, char, "v2db_type", 0) ; + ptr_check(cse, core_site_entry_t, "v2db_type", 0) ; + + if((p = strrchr(v, ';')) == (char *)0) + { + return 0 ; + } + else + { + if(*--p == 'R' && *--p == 'I' && *--p == 'D' && *--p == '.') + { + cse->perms |= 01000 ; + } + else + { + cse->perms &= ~01000 ; + } + return 1 ; + } +} +#endif diff --git a/archie/anonftp/parse/vms2.h b/archie/anonftp/parse/vms2.h new file mode 100644 index 0000000..5e151c4 --- /dev/null +++ b/archie/anonftp/parse/vms2.h @@ -0,0 +1,27 @@ +#ifndef VMS2_H +#define VMS2_H + +#ifdef __STDC__ + +extern int v2db_type(char *v, core_site_entry_t *cse) ; +extern int v2db_time(char *v, char *x, core_site_entry_t *cse) ; +extern int v2db_size(char *v, core_site_entry_t *cse) ; +extern int v2db_perm(char *v, core_site_entry_t *cse) ; +extern int v2db_owner(char *v, core_site_entry_t *cse) ; +extern int v2db_name(char *v, core_site_entry_t *cse) ; +extern int v2db_links(char *v, core_site_entry_t *cse) ; +extern int v2db_date(char *v, core_site_entry_t *cse) ; + +#else + +extern int v2db_type(/* char *v, core_site_entry_t *cse */) ; +extern int v2db_time(/* char *v, core_site_entry_t *cse */) ; +extern int v2db_size(/* char *v, core_site_entry_t *cse */) ; +extern int v2db_perm(/* char *v, core_site_entry_t *cse */) ; +extern int v2db_owner(/* char *v, core_site_entry_t *cse */) ; +extern int v2db_name(/* char *v, core_site_entry_t *cse */) ; +extern int v2db_links(/* char *v, core_site_entry_t *cse */) ; +extern int v2db_date(/* char *v, core_site_entry_t *cse */) ; + +#endif +#endif diff --git a/archie/anonftp/retrieve/.gitignore b/archie/anonftp/retrieve/.gitignore new file mode 100644 index 0000000..f3c7a7c --- /dev/null +++ b/archie/anonftp/retrieve/.gitignore @@ -0,0 +1 @@ +Makefile diff --git a/archie/anonftp/retrieve/AIX-2/.gitignore b/archie/anonftp/retrieve/AIX-2/.gitignore new file mode 100644 index 0000000..f3c7a7c --- /dev/null +++ b/archie/anonftp/retrieve/AIX-2/.gitignore @@ -0,0 +1 @@ +Makefile diff --git a/archie/anonftp/retrieve/AIX-2/Makefile.in b/archie/anonftp/retrieve/AIX-2/Makefile.in new file mode 100755 index 0000000..221761b --- /dev/null +++ b/archie/anonftp/retrieve/AIX-2/Makefile.in @@ -0,0 +1,12 @@ +# +# Use GNU's fixed header files. +# +SYS_DEFS = -DAIX +SENT_FLAGS = -ffixed-%g2 -ffixed-%g3 -ffixed-%g4 +SYS_LIBS = -L${BERKDB_ROOT}/${SYSTYPE} -ldb + +include ../Makefile.pre + +include ../Makefile.post + +# DO NOT DELETE THIS LINE -- make depend depends on it diff --git a/archie/anonftp/retrieve/Makefile.post b/archie/anonftp/retrieve/Makefile.post new file mode 100755 index 0000000..5fe0966 --- /dev/null +++ b/archie/anonftp/retrieve/Makefile.post @@ -0,0 +1,18 @@ +# +# anonftp/retrieve module. +# + +all: $(EXES) + + +include $(ARCHIE_ROOT)/Makefile.post + + +retrieve_anonftp: \ + $(LIBARCHIE_MODULE)/$(SYSTYPE)/libarchie.a \ + $(HOSTDB_MODULE)/$(SYSTYPE)/libhostdb.a \ + ${OBJS} + ${CC} ${CFLAGS} -o $@ ${OBJS} ${MOD_LIBS} ${SYS_LIBS} + +clean: + rm -f *.o $(EXES) core diff --git a/archie/anonftp/retrieve/Makefile.pre b/archie/anonftp/retrieve/Makefile.pre new file mode 100755 index 0000000..f6a088d --- /dev/null +++ b/archie/anonftp/retrieve/Makefile.pre @@ -0,0 +1,33 @@ +# +# Anonftp/retrieve module. +# + +#MOD_CFLAGS = -traditional -pipe +MOD_DEBUG = -g3 +MOD_WARN = -Wall -Wshadow -Wpointer-arith -Wcast-align +MOD_INCS = -I$(INCLUDE_MODULE) -I$(REGEX_MODULE) -I. +MOD_LIBS = \ + -L$(LIBARCHIE_MODULE)/$(SYSTYPE) -larchie \ + -L$(HOSTDB_MODULE)/$(SYSTYPE) -lhostdb + + +include $(ARCHIE_ROOT)/Makefile.pre + + +INCS = \ + ftp.h \ + ftp_getfile.h \ + lang_retrieve.h + +SRCS = \ + ftp.c \ + ftp_getfile.c \ + lang_retrieve.c + +OBJS = \ + ftp.o \ + ftp_getfile.o \ + lang_retrieve.o + +EXES = \ + retrieve_anonftp diff --git a/archie/anonftp/retrieve/SunOS-4.1.4/.gitignore b/archie/anonftp/retrieve/SunOS-4.1.4/.gitignore new file mode 100644 index 0000000..f3c7a7c --- /dev/null +++ b/archie/anonftp/retrieve/SunOS-4.1.4/.gitignore @@ -0,0 +1 @@ +Makefile diff --git a/archie/anonftp/retrieve/SunOS-4.1.4/Makefile.in b/archie/anonftp/retrieve/SunOS-4.1.4/Makefile.in new file mode 100755 index 0000000..8969907 --- /dev/null +++ b/archie/anonftp/retrieve/SunOS-4.1.4/Makefile.in @@ -0,0 +1,11 @@ +# +# Use GNU's fixed header files. +# +SYS_DEFS = -D__USE_FIXED_PROTOTYPES__ -DPOSIX_SOURCE -DSUNOS +SENT_FLAGS = -ffixed-%g2 -ffixed-%g3 -ffixed-%g4 +SYS_LIBS = -lresolv -L${BERKDB_ROOT}/${SYSTYPE} -ldb + +include ../Makefile.pre +include ../Makefile.post + +# DO NOT DELETE THIS LINE -- make depend depends on it diff --git a/archie/anonftp/retrieve/SunOS-5.4/.gitignore b/archie/anonftp/retrieve/SunOS-5.4/.gitignore new file mode 100644 index 0000000..f3c7a7c --- /dev/null +++ b/archie/anonftp/retrieve/SunOS-5.4/.gitignore @@ -0,0 +1 @@ +Makefile diff --git a/archie/anonftp/retrieve/SunOS-5.4/Makefile.in b/archie/anonftp/retrieve/SunOS-5.4/Makefile.in new file mode 100755 index 0000000..b6f25cb --- /dev/null +++ b/archie/anonftp/retrieve/SunOS-5.4/Makefile.in @@ -0,0 +1,11 @@ +# +# Use GNU's fixed header files. +# +SYS_DEFS = -D__USE_FIXED_PROTOTYPES__ -DSOLARIS +SENT_FLAGS = -ffixed-%g2 -ffixed-%g3 -ffixed-%g4 +SYS_LIBS = -lresolv -lnsl -lsocket -L${BERKDB_ROOT}/${SYSTYPE} -ldb + +include ../Makefile.pre +include ../Makefile.post + +# DO NOT DELETE THIS LINE -- make depend depends on it diff --git a/archie/anonftp/retrieve/SunOS-5.6 b/archie/anonftp/retrieve/SunOS-5.6 new file mode 120000 index 0000000..7b4e044 --- /dev/null +++ b/archie/anonftp/retrieve/SunOS-5.6 @@ -0,0 +1 @@ +SunOS-5.4 \ No newline at end of file diff --git a/archie/anonftp/retrieve/ftp.c b/archie/anonftp/retrieve/ftp.c new file mode 100644 index 0000000..b7baed3 --- /dev/null +++ b/archie/anonftp/retrieve/ftp.c @@ -0,0 +1,492 @@ +/* + * This file is copyright Bunyip Information Systems Inc., 1992. This file + * may not be reproduced, copied or transmitted by any means mechanical or + * electronic without the express written consent of Bunyip Information + * Systems Inc. + */ + + +#include +#include +#include +#include +#include +#include +#include +#include +#ifdef AIX +#include +#endif +#include +#include "protos.h" +#include "typedef.h" +#include "error.h" +#include "ftp.h" +#include "lang_retrieve.h" + +/* ftp.c: low level ftp routines */ + + +static pathname_t reply_string; +static pathname_t out_string; + + + +/* + * get_reply_string: return the last reply string from the ftp session + */ + +extern char *prog; + + +char *get_reply_string() + +{ + static char rep_str[BUFSIZ]; + + strcpy(rep_str, reply_string); + rep_str[strlen(rep_str) - 1] = '\0'; + + return(rep_str); +} + +/* + * get_request_string: return the last command to the remote ftp server + */ + +char *get_request_string() + +{ + static char req_str[BUFSIZ]; + + strcpy(req_str, out_string); + + return(req_str); +} + +void put_request_string(s) + char *s; +{ + + strcpy(out_string, s); +} + +void put_reply_string(s) + char *s; +{ + + strcpy(reply_string, s); +} + + +/* + * ftp_connect: connect to the given hostname on the port and return two + * file pointers to the input and output streams + */ + + +con_status_t ftp_connect(hostname, port, command_in, command_out, timeout) + hostname_t hostname; /* host name to connect to */ + int port; /* port number to connect to */ + FILE **command_in; /* returned input file pointer */ + FILE **command_out; /* returned output file pointer */ + int timeout; + +{ +#ifdef __STDC__ + + extern int fclose(FILE *); + +#else + + extern int fclose(); + extern setsockopt(); + +#endif + + + extern int verbose; + int command_fd; + int on = 1; + int retcode; + + if(verbose){ + + /* "Trying to connect to %s on port %u" */ + + error(A_INFO,"ftp_connect", FTP_CONNECT_001, hostname, port); + } + + if((retcode = cliconnect(hostname, port, &command_fd)) != A_OK) + return(retcode); + + if(verbose){ + + /* "Connected to %s" */ + + error(A_INFO,"ftp_connect", FTP_CONNECT_002, hostname); + } + + if((*command_in = fdopen(command_fd, "r")) == (FILE *) NULL){ + + /* "Can't open file I/O for incoming connection" */ + + error(A_ERR,"ftp_connect", FTP_CONNECT_003); + return(ERROR); + } + + if((*command_out = fdopen(command_fd, "w")) == (FILE *) NULL){ + + /* "Can't open file I/O for outgoing connection" */ + + error(A_ERR,"ftp_connect", FTP_CONNECT_004); + + if(command_in) + fclose(*command_in); + + return(ERROR); + } + +#ifdef SO_OOBINLINE + + if(setsockopt(command_fd, SOL_SOCKET, SO_OOBINLINE, (char *) &on, sizeof(on)) == -1){ + + + /* "Can't set socket options" */ + + error(A_SYSERR, "ftp_connect", FTP_CONNECT_005); + return(CON_SOCKETFAILED); + } + +#endif + + /* get the login message */ + + if(get_reply(*command_in, *command_out, &retcode,0, timeout) == ERROR) + return(retcode); + + return(A_OK); + +} + + +/* + * ftp_login: perform the login sequence to the remote ftp server + */ + + +int ftp_login(comm_in, comm_out, user, pass, acct, timeout) + FILE *comm_in; + FILE *comm_out; + char *user; + char *pass; + char *acct; + int timeout; + +{ + int retcode; + + retcode = send_command(comm_in, comm_out,0,timeout,"USER %s", user); + + if(retcode == FTP_USER_OK){ /* User name ok, need password */ + + if((retcode = send_command(comm_in, comm_out,0, timeout, "PASS %s", pass)) == FTP_LOGIN_OK){ + + /* User logged in OK */ + + return(A_OK); + } + else{ + + if(retcode == FTP_ACCT_WANTED){ /* Need "ACCT" name */ + + if((retcode = send_command(comm_in, comm_out,0, timeout, "ACCT %s", acct)) == FTP_LOGIN_OK){ + + /* User logged in OK */ + + return(A_OK); + } + else{ + + /* "ACCT command '%s' not accepted" */ + + /* error(A_ERR,"ftp_login", FTP_LOGIN_001, acct); */ + return(retcode); /* ACCT not accepted */ + } + } + else{ + + /* "FTP password '%s' not accepted" */ + + /* error(A_ERR,"ftp_login", FTP_LOGIN_002, pass); */ + return(retcode); /* Login incorrect */ + } + } + } + else + if(retcode == FTP_LOGIN_OK) /* User logged in without password */ + return(A_OK); + else if(retcode == FTP_NOT_LOGGED_IN){ + + /* "Login not accepted. Service not currently available" */ + + /* error(A_ERR,"ftp_login", FTP_LOGIN_003, retcode); */ + return(retcode); + }else{ + + /* "Login not accepted. FTP code %u" */ + + /* error(A_ERR,"ftp_login", FTP_LOGIN_004, retcode); */ + return(retcode); + } + +} + +/* + * send_command: send an ftp command. varargs + */ + + +int send_command(va_alist) + va_dcl +/* FILE *comm_in; + FILE *comm_out; + int expecteof; + int timeout; + char *format; + arglist */ + +{ + extern int vfprintf(); + extern int vsprintf(); + +#ifdef __STDC__ + + extern int fflush(FILE *); + +#else + + extern int fflush(); + +#endif + + extern int verbose; + + FILE *comm_in; + FILE *comm_out; + va_list al; + char *format; + int retcode; + char outformat[BUFSIZ]; + int expecteof; + int timeout; + + + va_start(al); + + comm_in = va_arg(al, FILE *); + comm_out = va_arg(al, FILE *); + expecteof = va_arg(al, int); + timeout = va_arg(al, int); + format = va_arg(al, char *); + + sprintf(outformat,"%s\r\n", format); + + vfprintf(comm_out, outformat, al); + + vsprintf(out_string, format, al); + + if(verbose) + error(A_INFO, "send_command","%s", out_string); + + + fflush(comm_out); + + va_end(al); + + if(get_reply(comm_in, comm_out, &retcode,0, timeout) == ERROR) + return(-1); + else + return(retcode); + +} + +/* + * get_reply: read the reply from the remote ftp daemon + */ + + +status_t get_reply(comm_in, comm_out, retcode, expecteof, timeout) + FILE *comm_in; /* input file pointer */ + FILE *comm_out; /* output file pointer */ + int *retcode; /* returned pointer to ftp return code */ + int expecteof; /* non-zero if EOF condition expected on next read from remote daemon */ + int timeout; /* Time to wait for reply */ + +{ + extern void sig_handle(); + extern int signal_set; + + extern int verbose; + int c, n; + int code; + char *cp; + int dig; + int continuation = 0; + int originalcode = 0; + +#if 0 + fd_set read_set; + int select_code; + struct timeval timev_struct; + + timev_struct.tv_sec = timeout; + timev_struct.tv_usec = 0L; + + FD_ZERO(&read_set); + FD_SET(fileno(comm_in),&read_set); + + if((select_code = select(FD_SETSIZE, &read_set, (fd_set *) NULL, (fd_set *) NULL, &timev_struct)) < 0){ + + /* "Error in select() while waiting for reply from remote server" */ + + error(A_SYSERR, "get_reply", GET_REPLY_001); + *retcode = FTP_LOST_CONN; + return(ERROR); + } + else{ + /* timeout */ + + if(select_code == 0){ + + /* "Timed out while waiting for reply from remote ftp server" */ + + error(A_ERR, "get_reply", GET_REPLY_002); + put_reply_string(GET_REPLY_002); + *retcode = FTP_LOST_CONN; + return(ERROR); + } + } +#endif + +#ifndef SOLARIS + /* + * Don't restart the system call (a read) if we are interrupted by + * sigalarm. This is the default behaviour under Solaris, so we don't + * need this call + */ + siginterrupt(SIGALRM, 1); +#endif + + signal_set = 0; + signal(SIGALRM, sig_handle); + alarm(timeout); + + c = getc(comm_in); + + if(signal_set){ + + /* "Timed out while waiting for reply from remote ftp server" */ + + error(A_ERR, "get_reply", GET_REPLY_002); + put_reply_string(GET_REPLY_002); + *retcode = FTP_LOST_CONN; + return(ERROR); + } + + alarm(0); + signal(SIGALRM, SIG_DFL); + + +#ifndef SOLARIS + siginterrupt(SIGALRM, 0); +#endif + + ungetc(c, comm_in); + + while(1){ + + dig = n = code = 0; + cp = reply_string; + + while((c = getc(comm_in)) != '\n'){ + + if(c == IAC){ /* handle telnet comms */ + + switch (c = getc(comm_in)) { + + case WILL: + case WONT: + + c = getc(comm_in); + fprintf(comm_out, "%c%c%c",IAC,DONT,c); + fflush(comm_out); + break; + + case DO: + case DONT: + + c = getc(comm_in); + fprintf(comm_out, "%c%c%c",IAC,WONT,c); + fflush(comm_out); + break; + + default: + break; + } + + continue; + + } + + dig++; + + if(c == EOF){ + + if(expecteof){ + *retcode = FTP_QUIT; + return (A_OK); + } + + *retcode = FTP_LOST_CONN; + return(ERROR); + } + + if(dig < 4 && isdigit(c)) + code = code * 10 + (c - '0'); + + if(dig == 4 && c == '-'){ + if(continuation) + code = 0; + continuation++; + } + + if(n == 0) + n = c; + + if(cp < &reply_string[sizeof(reply_string) - 1]) + *cp++ = c; + + } + + if(continuation && (code != originalcode)){ + if(originalcode == 0) + originalcode = code; + continue; + } + + *cp = '\0'; + + if(verbose) + error(A_INFO,"get_reply","%s", reply_string); + + if(code == FTP_LOST_CONN || originalcode == FTP_LOST_CONN){ + return(ERROR); + } + + *retcode = code; + return(A_OK); + } + +} + diff --git a/archie/anonftp/retrieve/ftp.h b/archie/anonftp/retrieve/ftp.h new file mode 100644 index 0000000..0880ed2 --- /dev/null +++ b/archie/anonftp/retrieve/ftp.h @@ -0,0 +1,55 @@ +#ifndef _FTP_H_ +#define _FTP_H_ + +#include "archie_inet.h" + +#define FTP_DATACONN_OPEN 125 +#define FTP_OPEN_DATACONN 150 +#define FTP_COMMAND_OK 200 +#define FTP_FILE_STATUS 213 +#define FTP_QUIT 221 /* Quit OK */ +#define FTP_TRANSFER_COMPLETE 226 /* File transfer completed */ +#define FTP_LOGIN_OK 230 /* Login OK */ +#define FTP_FILE_ACTION_OK 250 +#define FTP_PATHNAME_NONRFC 251 +#define FTP_PATHNAME_CREATED 257 /* Returned on successful PWD */ +#define FTP_USER_OK 331 /* Give USER */ +#define FTP_ACCT_WANTED 332 /* Give ACCT */ +#define FTP_LOST_CONN 421 /* Lost connection to site */ +#define FTP_CANT_DATACONN 425 /* Can't build data connection */ +#define FTP_ABORT_DATACONN 426 /* Data conection aborted */ +#define FTP_FILE_UNAVAILABLE 450 /* File unavailable */ +#define FTP_LOCAL_ERROR 451 /* Action aborted, local processing error */ +#define FTP_COMMAND_NOT_IMPL 500 /* Command not implemented */ +#define FTP_COMM_PARAM_NOT_IMPL 504 /* Given parameters to command not implemented */ +#define FTP_NOT_LOGGED_IN 530 /* Currently not logged in */ +#define FTP_ACTION_NOT_TAKEN 550 /* Action not taken, file unavailable */ + +#ifdef __STDC__ + +extern int send_command( ); +extern status_t get_reply(FILE *, FILE *, int *, int, int); +extern con_status_t ftp_connect(hostname_t, int, FILE **, FILE **, int); +extern int ftp_login(FILE *, FILE *, char *, char *, char *, int); +extern status_t setup_dataconn(FILE **,int *); +extern char * get_reply_string(void); +extern char * get_request_string(void); + +#else + +extern status_t get_reply(); +extern int send_command(); +extern con_status_t ftp_connect(); +extern int ftp_login(); +extern status_t setup_dataconn(); +extern char * get_reply_string(); +extern char * get_request_string(); + +#endif + + +extern void put_request_string PROTO((char*)); +extern void put_reply_string PROTO((char*)); + + +#endif diff --git a/archie/anonftp/retrieve/ftp_getfile.c b/archie/anonftp/retrieve/ftp_getfile.c new file mode 100644 index 0000000..8dcddea --- /dev/null +++ b/archie/anonftp/retrieve/ftp_getfile.c @@ -0,0 +1,2400 @@ +/* + * This file is copyright Bunyip Information Systems Inc., 1992. This file + * may not be reproduced, copied or transmitted by any means mechanical or + * electronic without the express written consent of Bunyip Information + * Systems Inc. + */ + + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#ifdef AIX +#include +#endif +#ifdef SOLARIS +#include +#endif +#include +#include "protos.h" +#include "typedef.h" +#include "db_files.h" +#include "db_ops.h" +#include "ftp_getfile.h" +#include "ftp.h" +#include "header.h" +#include "host_db.h" +#include "protonet.h" +#include "error.h" +#include "archie_strings.h" +#include "files.h" +#include "lang_retrieve.h" +#include "master.h" +#include "archie_mail.h" +#include "times.h" +#include "protos.h" + +/* + ftp_getfile.c: routine to retrieve raw archie data via FTP + + + +*/ + + + + +file_info_t *curr_file; + +#define UC(x) (int)(((int)(x))&0xff) + +int verbose = 0; + +int signal_set = 0; + +char *prog; + +int main(argc, argv) + int argc; + char *argv[]; + + +{ + extern char *optarg; +#if 0 +#ifdef __STDC__ + + extern int getopt(int, char **, char *); + +#else + + extern int getopt(); + extern int unlink(); + +#endif +#endif + + char **cmdline_ptr; + int cmdline_args; + + pathname_t master_database_dir; + pathname_t tmp_dir; + + pathname_t logfile; + + int logging = 0; + + file_info_t *header_file = create_finfo(); + file_info_t *defs_file = create_finfo(); + file_info_t *output_file = create_finfo(); + + header_t header_rec; + retdefs_t *retdefs; + + int globbing = 1; + + int timeout = DEFAULT_TIMEOUT; + int sleep_period; + + int pickup_lslR = 0; + + int compress_flag = 1; /* Actively compress resulting retreived info == 1 + Actively uncompress == -1 + Do nothing == 0 + Actively gzip == 2 + Actively gunzip == -2 */ + int option; + + cmdline_ptr = argv + 1; + cmdline_args = argc - 1; + + curr_file = create_finfo(); + + master_database_dir[0] = defs_file -> filename[0] = '\0'; + tmp_dir[0] = '\0'; + + while((option = (int) getopt(argc, argv, "M:o:C:l:Uvni:L:T:gh:ZS:t:F")) != EOF){ + + switch(option){ + + /* configuration filename */ + + case 'C': + strcpy(defs_file -> filename,optarg); + cmdline_ptr += 2; + cmdline_args -= 2; + break; + + case 'F': /* Force retrieve .. not used here */ + cmdline_ptr++; + cmdline_args++; + break; + + /* Master database directory name */ + + case 'M': + strcpy(master_database_dir,optarg); + cmdline_ptr += 2; + cmdline_args -= 2; + break; + + + /* log messages, given file */ + + case 'L': + strcpy(logfile, optarg); + logging = 1; + cmdline_ptr += 2; + cmdline_args -= 2; + break; + + /* timeout */ + + case 'T': + timeout = atoi(optarg) * 60; /* in minutes */ + cmdline_ptr += 2; + cmdline_args -= 2; + break; + + case 'S': + sleep_period = atoi(optarg); /* in seconds */ + cmdline_ptr += 2; + cmdline_args -= 2; + break; + + /* Actively uncompress retrieved information */ + + case 'U': + compress_flag = -1; + cmdline_ptr ++; + cmdline_args --; + break; + + /* Get index file if it exists */ + + case 'Z': + pickup_lslR = 1; + cmdline_ptr ++; + cmdline_args --; + break; + + /* turn globbing off */ + + case 'g': + globbing = 0; + cmdline_ptr ++; + cmdline_args --; + break; + + + /* host db directory name. Ignored */ + + case 'h': + cmdline_ptr += 2; + cmdline_args -= 2; + break; + + /* input file */ + + case 'i': + strcpy(header_file -> filename, optarg); + cmdline_ptr += 2; + cmdline_args -= 2; + break; + + /* log messages, default file */ + + case 'l': + logging = 1; + cmdline_ptr++; + cmdline_args--; + break; + + /* leave data in original format */ + + case 'n': + compress_flag = 0; + cmdline_ptr++; + cmdline_args--; + break; + + /* Output file */ + + case 'o': + strcpy(output_file -> filename,optarg); + cmdline_ptr += 2; + cmdline_args -= 2; + break; + + /* tmp directory */ + + case 't': + strcpy(tmp_dir,optarg); + cmdline_ptr += 2; + cmdline_args -= 2; + break; + + /* verbose mode */ + + case 'v': + verbose = 1; + cmdline_ptr ++; + cmdline_args --; + break; + + default: + + /* "Unknown option %c" */ + + error(A_ERR, argv[0], RETRIEVE_ANONFTP_001, option); + exit(ERROR); + break; + } + } + + if(logging){ + if(logfile[0] == '\0'){ + if(open_alog((char *) NULL, A_INFO, tail(argv[0])) == ERROR){ + + /* "Can't open default log file" */ + + error(A_ERR, argv[0], RETRIEVE_ANONFTP_002); + exit(ERROR); + } + } + else{ + if(open_alog(logfile, A_INFO, tail(argv[0])) == ERROR){ + + /* "Can't open log file %s" */ + + error(A_ERR, argv[0], RETRIEVE_ANONFTP_003, logfile); + exit(ERROR); + } + } + } + + if(header_file -> filename[0] == '\0'){ + + /* "No input (header) file given" */ + + error(A_ERR,argv[0], RETRIEVE_ANONFTP_004); + exit(ERROR); + } + + if(output_file -> filename[0] == '\0'){ + + /* "No output file template specified" */ + + error(A_ERR,argv[0], RETRIEVE_ANONFTP_005); + exit(ERROR); + } + + if(set_master_db_dir(master_database_dir) == (char *) NULL){ + + /* "Error while trying to set master database directory" */ + + error(A_ERR,argv[0], RETRIEVE_ANONFTP_006); + exit(ERROR); + } + + if(open_file(header_file, O_RDONLY) == ERROR){ + + /* "Can't open input file %s" */ + + error(A_ERR, argv[0], RETRIEVE_ANONFTP_007, header_file -> filename); + exit(ERROR); + } + + if(read_header(header_file -> fp_or_dbm.fp, &header_rec, (u32 *) NULL, 0, 0) == ERROR){ + + /* "Can't read header of input file %s" */ + + error(A_ERR, argv[0], RETRIEVE_ANONFTP_008, header_file -> filename); + exit(ERROR); + } + + if(close_file(header_file) == ERROR){ + + /* "Can't close input file %s" */ + + error(A_ERR, argv[0], RETRIEVE_ANONFTP_009, header_file -> filename); + } + + sprintf(curr_file -> filename, "%s%s%s", output_file -> filename, SUFFIX_PARSE, TMP_SUFFIX); + + /* compose default configuration file if none given */ + + if(defs_file -> filename[0] == '\0') + sprintf(defs_file -> filename, "%s/%s/%s", get_archie_home(), DEFAULT_ETC_DIR, DEFAULT_RETDEFS); + + + if((retdefs = (retdefs_t *) malloc(MAX_RETDEFS * sizeof(retdefs_t))) == (retdefs_t *) NULL){ + + /* "Can't malloc() for retrieve defaults" */ + + error(A_SYSERR,"ftp_getfile", RETRIEVE_ANONFTP_010); + exit(ERROR); + } + + if(read_retdefs(defs_file, retdefs) == ERROR){ + + /* "Error reading configuration file %s" */ + + error(A_ERR, argv[0], RETRIEVE_ANONFTP_011, defs_file -> filename); + exit(ERROR); + } + + + if(do_retrieve(&header_rec, output_file, header_file, retdefs, compress_flag,timeout, globbing, pickup_lslR) == ERROR){ + + /* "Error in retrieve from file %s" */ + + error(A_ERR,argv[0], RETRIEVE_ANONFTP_012, header_file -> filename); + } + + free(retdefs); + + if(unlink(header_file -> filename) == -1){ + + /* "Can't unlink header file %s" */ + + error(A_SYSERR,argv[0], RETRIEVE_ANONFTP_013, header_file -> filename); + exit(ERROR); + } + + destroy_finfo(header_file); + + exit(A_OK); + return(A_OK); +} + + +/* do_retrieve: main routine for performing retrieve via FTP */ + + +status_t do_retrieve(header_rec, output_file, input_file, retdefs, compress_flag, timeout, globbing, pickup_lslR) + header_t *header_rec; /* input header record */ + file_info_t *output_file; /* output file pointer */ + file_info_t *input_file; /* input file */ + retdefs_t *retdefs; /* configuration information */ + int compress_flag; /* compression status */ + int timeout; /* Timeout on retrieve */ + int globbing; /* Globbing on ? */ + int pickup_lslR; /* pickup the default index file */ + +{ + +#if 0 +#ifdef __STDC__ + + extern int strcasecmp(char *, char *); + +#else + + extern int strcasecmp(); + extern int rename(); + +#endif +#endif + int sleepy_time = RETRY_DELAY; + int retcode; + char retr_list[MAX_ACCESS_COMM]; + char retr_string[MAX_ACCESS_COMM]; + +#ifdef SOLARIS + struct utsname un; +#endif + + hostname_t hostname; + ip_addr_t hostaddr, *hostaddr_ptr; + + char user[MAX_ACCESS_METHOD]; + char pass[MAX_ACCESS_METHOD]; + char acct[MAX_ACCESS_METHOD]; + char root_dir[MAX_ACCESS_METHOD]; + struct servent *serv; + int finished; + FILE *comm_in, *comm_out; + int tries; + int count = 0; + retdefs_t *rt = (retdefs_t *) NULL; + AR_DNS *dns; + char **file_list; + pathname_t home_dir; + + ptr_check(header_rec, header_t, "do_retrieve", ERROR); + ptr_check(output_file, file_info_t, "do_retrieve", ERROR); + ptr_check(retdefs, retdefs_t, "do_retrieve", ERROR); + + retr_list[0] = retr_string[0] = user[0] = pass[0] = acct[0] = root_dir[0] = '\0'; + + + /* Check what method is to be used to retrieve info */ + + if(HDR_GET_ACCESS_COMMAND(header_rec -> header_flags)){ + + strcpy(retr_string, header_rec -> access_command); + + if(str_decompose(retr_string,NET_DELIM_CHAR, retr_list,user,pass,acct,root_dir) == ERROR){ + + /* "Unable to parse access command in header" */ + + error_header(curr_file, output_file, count, header_rec, SUFFIX_PARSE, DO_RETRIEVE_001); + return(ERROR); + } + sprintf(header_rec->access_command,"%s:%s:%s:%s",retr_list,user,pass,acct); + + } + + header_rec -> generated_by = RETRIEVE; + HDR_SET_GENERATED_BY(header_rec -> header_flags); + + HDR_UNSET_PARSE_TIME(header_rec -> header_flags); + HDR_UNSET_NO_RECS(header_rec -> header_flags); + HDR_UNSET_CURRENT_STATUS(header_rec -> header_flags); + HDR_UNSET_HCOMMENT(header_rec -> header_flags); + +#ifndef SOLARIS + if(gethostname(hostname, sizeof(hostname_t)) == -1){ + + /* "get_archie_hostname() failed. Can't get local host name!" */ + + error_header(curr_file, output_file, count, header_rec, SUFFIX_PARSE, DO_RETRIEVE_002); + return(ERROR); + } +#else + + if(uname(&un) == -1){ + + /* "get_archie_hostname() failed. Can't get local host name!" */ + + error_header(curr_file, output_file, count, header_rec, SUFFIX_PARSE, DO_RETRIEVE_002); + return(ERROR); + } + + strcpy(hostname, un.nodename); + +#endif + + if((dns = ar_open_dns_name(hostname, DNS_EXTERN_ONLY, (void *) NULL)) == (AR_DNS *) NULL){ + + /* "Can't get hostname DNS record for %s" */ + + error_header(curr_file, output_file, count, header_rec, SUFFIX_PARSE, DO_RETRIEVE_003, hostname); + return(ERROR); + } + + if((hostaddr_ptr = get_dns_addr(dns)) == (ip_addr_t *) NULL){ + + /* "Can't get host address for %s" */ + + error_header(curr_file, output_file, count, header_rec, SUFFIX_PARSE, DO_RETRIEVE_004 , hostname); + return(ERROR); + } + + + ar_dns_close(dns); + + hostaddr = *hostaddr_ptr; + + + if(user[0] == '\0' || pass[0] == '\0' || acct[0] == '\0'){ + + for(count = 0, rt = &retdefs[0], finished = 0; + (rt -> access_methods[0] != '\0') && !finished; count++){ + + rt = &retdefs[count]; + + if((strcasecmp(header_rec -> access_methods, rt -> access_methods) == 0) + && (header_rec -> os_type == rt -> os_type)) + finished = 1; + } + + if(!finished){ + + /* "No default entry for %s in configuration file from %s" */ + + error_header(curr_file, output_file, count, header_rec,SUFFIX_PARSE, DO_RETRIEVE_005, header_rec -> access_methods, hostname); + return(ERROR); + } + + if(user[0] == '\0') + if(rt -> def_user[0] != '\0') + strcpy(user, rt -> def_user); + else + strcpy(user, ARCHIE_USER); + + + if(pass[0] == '\0') + if(rt -> def_pass[0] != '\0') + strcpy(pass, rt -> def_pass); + else{ + hostname_t tmp_hostname; + + sprintf(pass,"%s@%s", ARCHIE_USER, get_archie_hostname(tmp_hostname, sizeof(tmp_hostname))); + } + } + + count = 0; + + if((retr_list[0] == '\0') && (rt -> def_ftparg[0] == '\0')){ + + /* "Neither access command nor default action provided for %s" */ + + error_header(curr_file, output_file, count, header_rec, SUFFIX_PARSE, DO_RETRIEVE_006, hostname); + return(ERROR); + } + + + if((serv = getservbyname("ftp", "tcp")) == (struct servent *) NULL){ + + /* "Can't find service 'ftp/tcp' in list of services" */ + + error_header(curr_file, output_file, count, header_rec, SUFFIX_PARSE, DO_RETRIEVE_007); + return(ERROR); + } + + for(tries = 0, finished = 0; (tries < MAX_RETRIEVE_RETRY) && !finished; tries++){ + + switch(retcode = ftp_connect(header_rec -> primary_hostname, serv -> s_port, &comm_in, &comm_out, timeout)){ + + case A_OK: + finished = 1; + break; + + case ERROR: /* Possible non-permenent error */ + case -CON_SOCKETFAILED: + case -CON_UNREACHABLE: + case -CON_NETUNREACHABLE: + case -CON_TIMEOUT: + + sleepy_time *= 2; + break; + + case -CON_HOST_UNKNOWN: + + error_header(curr_file, output_file, count, header_rec, SUFFIX_PARSE, "Host unknown: %s", hostname); + finished = 2; + break; + + case -CON_REFUSED: + error_header(curr_file, output_file, count, header_rec, SUFFIX_PARSE, "Connection to %s refused", hostname); + finished = 2; + break; + + case FTP_LOST_CONN: + error_header(curr_file, output_file, count, header_rec, SUFFIX_PARSE, "Connection to %s lost", hostname); + finished = 2; + break; + + default: + + /* "Error %d while trying to connect to %s" */ + + error_header(curr_file, output_file, count, header_rec, SUFFIX_PARSE, DO_RETRIEVE_008, retcode, hostname); + finished = 2; + break; + + } + + if(!finished){ + sleep(sleepy_time); + finished = 0; + } + else + break; + } + + /* + * Either MAX_RETRIEVE_RETRY has been exceeded or a fatal error has + * occurred + */ + + if(finished == 1){ + + switch(ftp_login(comm_in, comm_out, user, pass, acct, timeout)){ + + case A_OK: + break; + + case FTP_NOT_LOGGED_IN: + default: + + /* "Can't login as %s" */ + + error_header(curr_file, output_file, count, header_rec, SUFFIX_PARSE, DO_RETRIEVE_009, user); + return(ERROR); + break; + } + } + else{ + char *erstr = get_conn_err(retcode); + + /* "Unable to connect: %s" */ + + error_header(curr_file, output_file, count, header_rec, SUFFIX_PARSE, DO_RETRIEVE_010, erstr); + return(ERROR); + } + + + + /* Novell Systems do not create the ls-lR file correctly... + the root is not present in the listing. + */ + if ( header_rec->os_type == NOVELL ) { /* Get the pwd */ + home_dir[0] = '\0'; + get_pwd(output_file, comm_in, comm_out,header_rec,hostname, hostaddr,rt,timeout,home_dir); + + strcat(header_rec -> access_command,":"); + strcat(header_rec -> access_command,home_dir); + } + + /* Logged in ok, now figure out what to do */ + + file_list = str_sep(retr_list,NET_SEPARATOR_CHAR); + + if((file_list == (char **) NULL) || (file_list[0] == '\0')){ + if(pickup_lslR){ + + if((file_list = (char **) malloc(sizeof(char *) * 2)) == (char **) NULL){ + error_header(curr_file, output_file, count, header_rec, SUFFIX_PARSE, "Can't malloc for file list"); + return(ERROR); + } + + file_list[0] = '\0'; + file_list[1] = '\0'; + + check_for_lslRZ(comm_in, comm_out, file_list, header_rec, timeout, rt); + } + } + else{ + + /* non-NULL file list. Check to see if files are atend */ + + if(strcasecmp(file_list[0], ATEND_FILE) == 0) + gather_atend(&file_list, input_file); + } + + if(!file_list){ + /* "Can't determine action (no access_commands)" */ + + error_header(curr_file, output_file, count, header_rec, SUFFIX_PARSE, DO_RETRIEVE_026); + return(ERROR); + } + + if((file_list != (char **) NULL) && ((file_list[0] == (char *) NULL) || (strcasecmp(file_list[0], IGNORE_FILE) == 0))) + get_list(output_file, comm_in, comm_out, header_rec, hostname, hostaddr, compress_flag, rt, timeout); + else + get_files(output_file, comm_in, comm_out, header_rec, hostname, hostaddr, compress_flag, rt, timeout, file_list, globbing); + + send_command(comm_in, comm_out, 1, timeout, "QUIT"); + + destroy_finfo(curr_file); + +#if 0 + /* This is should work .. but generate core dumps on Solaris */ + if ( file_list ) { + free_opts(file_list); + } +#endif + return(A_OK); +} + +/* + * read_retdefs: read the given configuration file and place infromation + * into internal structures + */ + +status_t read_retdefs(defs_file, retdefs) + file_info_t *defs_file; /* configuration file */ + retdefs_t *retdefs; /* returned information */ + +{ +#if 0 +#ifdef __STDC__ + + extern int strcasecmp(char *, char *); + +#else + + extern int strcasecmp(); + +#endif +#endif + + int count; + char input_buf[BUFSIZ]; + retdefs_t *rt; + char os[MAX_ACCESS_METHOD]; + char *chptr; + pathname_t tmp_str; + + ptr_check(defs_file, file_info_t, "read_retdefs", ERROR); + ptr_check(retdefs, retdefs_t, "read_retdefs", ERROR); + + + if(open_file(defs_file, O_RDONLY) == ERROR){ + + /* "Can't open configuration file %s" */ + + error(A_ERR, "read_retdefs", READ_RETDEFS_001, defs_file -> filename); + return(ERROR); + } + + for(count = 0; fgets(input_buf, sizeof(input_buf), defs_file -> fp_or_dbm.fp) != (char *) NULL; count++){ + + rt = &retdefs[count]; + + memset(rt, '\0', sizeof(retdefs_t)); + + if((chptr = strrchr(input_buf,'\n')) != (char *) NULL) + *chptr = '\0'; + + /* blank line */ + + if(sscanf(input_buf, "%s", tmp_str) <= 0) + continue; + + if(str_decompose(input_buf, NET_DELIM_CHAR, rt -> access_methods, os, rt -> bin_access, + rt -> def_compress_ext, rt -> def_user, + rt -> def_pass, rt -> def_acct, rt -> def_ftparg, rt -> def_ftpglob, + rt -> def_indexfile) == ERROR){ + + /* "Error while parsing line %u in configuration file %s" */ + + error(A_ERR, "read_retdefs", READ_RETDEFS_002, count, defs_file -> filename); + return(ERROR); + } + + if(rt -> access_methods[0] == '\0'){ + + /* "Invalid empty access methods field in configuration file line %d" */ + + error(A_ERR,"read_retdefs",READ_RETDEFS_003, count); + return(ERROR); + } + + if(rt -> bin_access[0] == '\0'){ + + /* "Invalid empty binary access field line %d" */ + + error(A_ERR,"read_retdefs", READ_RETDEFS_004, count); + return(ERROR); + } + + if(rt -> def_compress_ext[0] == '\0'){ + + /* "Invalid empty default compress extension field line %d" */ + + error(A_ERR,"read_retdefs", READ_RETDEFS_005, count); + return(ERROR); + } + + if(os[0] != '\0'){ + + if(strcasecmp(OS_TYPE_UNIX_BSD, os) == 0) + rt -> os_type = UNIX_BSD; + else if(strcasecmp(OS_TYPE_VMS_STD, os) == 0) + rt -> os_type = VMS_STD; + else if(strcasecmp(OS_TYPE_NOVELL, os) == 0) + rt -> os_type = NOVELL; + else{ + + /* "Invalid OS field: %s" */ + + error(A_ERR, "read_retdefs", READ_RETDEFS_006, os); + return(ERROR); + } + } + else{ + + /* "Invalid empty OS field in configuration file line %d" */ + + error(A_ERR,"read_retdefs", READ_RETDEFS_007, count); + return(ERROR); + } + + } + + + retdefs[count].access_methods[0] = '\0'; + + close_file(defs_file); + + return(A_OK); +} + +/* + * get_input: get the incoming data stream an write it to the output file + */ + + + +status_t get_input(o_file, header_rec, compress_flag, data_socket, timeout) + file_info_t *o_file; /* output file handle */ + header_t *header_rec; /* input header record */ + int compress_flag; /* compress status */ + int data_socket; /* incoming data socket */ + int timeout; /* inactivity timeout */ + +{ +#ifdef __STDC__ + + extern int accept(int, struct sockaddr *, int *); + extern int shutdown(int, int); + extern time_t time(time_t *); + +#else + + extern int accept(); + extern int shutdown(); + extern time_t time(); + +#endif + + + struct sockaddr_in sockaddr; + int retval = 0; + int sockaddr_len; + int status; + pathname_t prog_name; + int old_ds; + fd_set readmask; + struct timeval timeval_struct; + int waitstat; + int finished; + hostname_t tmp_hostname; + + + ptr_check(o_file, file_info_t, "get_input", ERROR); + ptr_check(header_rec, header_t, "get_input", ERROR); + + if(timeout == 0) + error(A_WARN, "get_input", "Timeout set to 0 seconds!"); + + if(open_file(o_file, O_WRONLY) == ERROR){ + + /* "Can't open output file %s" */ + + error(A_ERR, "get_input", GET_INPUT_001, o_file -> filename); + return(ERROR); + } + + /* Accept the connection from the server */ + + sockaddr_len = sizeof(struct sockaddr_in); + + old_ds = data_socket; + + FD_ZERO(&readmask); + + FD_SET(old_ds, &readmask); + + timeval_struct.tv_sec = (long) timeout; + timeval_struct.tv_usec = 0L; + + if((finished = select(FD_SETSIZE, &readmask, (fd_set *) NULL, (fd_set *) NULL, &timeval_struct)) == 0){ + pathname_t tmp_str; + + /* "Timeout of %d minutes on site %s retrieve" */ + + sprintf(tmp_str, GET_INPUT_012, timeout/60, header_rec -> primary_hostname); + put_reply_string(tmp_str); + error(A_ERR, "get_input", GET_INPUT_012, timeout/60, header_rec -> primary_hostname); + return(ERROR); + } + else{ + if(finished == -1){ + + /* "Error while in select() for data transfer" */ + + error(A_SYSERR, "get_input", GET_INPUT_015); + return(ERROR); + } + } + + if((data_socket = accept(old_ds, (struct sockaddr *) &sockaddr, &sockaddr_len)) == -1){ + + /* "Can't accept() data connection from %s" */ + + error(A_SYSERR,"get_input",GET_INPUT_002, header_rec -> primary_hostname); + return(ERROR); + } + + close(old_ds); + + prog_name[0] = '\0'; + + header_rec -> retrieve_time = time((time_t *) NULL); + HDR_SET_RETRIEVE_TIME(header_rec -> header_flags); + + switch ( compress_flag ) { + case 1: /* Actively compress */ + header_rec -> format = FCOMPRESS_LZ; + HDR_SET_FORMAT(header_rec -> header_flags); + + strcpy(prog_name, COMPRESS_PGM); + break; + + case -1: /* Actively uncompress */ + header_rec -> format = FRAW; + HDR_SET_FORMAT(header_rec -> header_flags); + strcpy(prog_name, UNCOMPRESS_PGM); + break; + + default: + case 0: /* Leave it alone. Assume that format is set elsewhere */ + strcpy(prog_name, CAT_PGM); + break; + + case 2: /* Actively gzip */ + header_rec -> format = FCOMPRESS_GZIP; + HDR_SET_FORMAT(header_rec -> header_flags); + if ( get_option_path( "COMPRESS", "GZIP", prog_name) == ERROR ) { + return ERROR; + } + break; + + case -2: /* Actively gunzip */ + header_rec -> format = FRAW; + HDR_SET_FORMAT(header_rec -> header_flags); + if ( get_option_path( "UNCOMPRESS", "GZIP", prog_name) == ERROR ) { + return ERROR; + } + break; + } + + + HDR_SET_UPDATE_STATUS(header_rec -> header_flags); + + header_rec -> update_status = SUCCEED; + + HDR_SET_SOURCE_ARCHIE_HOSTNAME(header_rec -> header_flags); + strcpy(header_rec -> source_archie_hostname, get_archie_hostname(tmp_hostname, sizeof(tmp_hostname))); + + /* Write the header out to the output file */ + + if(write_header(o_file -> fp_or_dbm.fp, header_rec, (u32 *) NULL, 0, 0)== ERROR){ + + /* "Can't write header for incoming data to output file %s" */ + + error(A_ERR, "get_input", GET_INPUT_004, o_file -> filename); + return(ERROR); + } + + /* + * Set things up so that prog_name reads directly from the socket + * and writes directly to the output file + */ + + if((retval = fork()) == 0){ /* child process */ + dup2(data_socket, 0); + dup2(fileno(o_file -> fp_or_dbm.fp), 1); + + execlp(prog_name, prog_name, (char *) NULL); + + /* "Can't spawn process %s" */ + + error(A_SYSERR,"get_input", GET_INPUT_005, prog_name); + return(ERROR); + } + + if(retval == -1){ + + /* "Can't fork() for %s" */ + + error(A_SYSERR,"get_input", GET_INPUT_006, prog_name); + return(ERROR); + } + + + FD_ZERO(&readmask); + + FD_SET(data_socket, &readmask); + + /* First wait for half the timeout value */ + +#ifndef SOLARIS + siginterrupt(SIGALRM, 1); +#endif + + signal(SIGALRM, sig_handle); + + alarm(timeout/2); + + if(((waitstat = wait(&status)) == -1) && (!signal_set)){ + + /* "Error while in wait() for %s" */ + + error(A_SYSERR,"get_input", GET_INPUT_007, prog_name); + return(ERROR); + } + else if(waitstat > 0){ + + if(WIFSIGNALED(status)){ + + /* "%s terminated abnormally with signal %u" */ + + error(A_ERR,"get_input", GET_INPUT_009, prog_name, WTERMSIG(status)); + return(ERROR); + } + + if(WIFEXITED(status) && WEXITSTATUS(status)){ + + /* "%s exited abnormally with status %u" */ + + error(A_ERR,"get_input", GET_INPUT_008, prog_name, WEXITSTATUS(status)); + + /* Kludge */ + + if(((header_rec -> format == FCOMPRESS_LZ) || (header_rec->format == FCOMPRESS_GZIP) ) + && (WEXITSTATUS(status) == 2)){ + + /* "Insufficient data to compress(1). Empty listings" */ + + put_request_string(GET_INPUT_011); + put_reply_string(""); + } + + close(data_socket); + close_file(o_file); + + return(ERROR); + } + + close(data_socket); + close_file(o_file); + +#ifndef SOLARIS + siginterrupt(SIGALRM, 0); +#endif + alarm(0); + signal(SIGALRM, SIG_DFL); + + return(A_OK); + } + +#ifndef SOLARIS + siginterrupt(SIGALRM, 0); +#endif + + alarm(0); + + signal(SIGALRM, SIG_DFL); + + timeval_struct.tv_sec = timeout/2; + timeval_struct.tv_usec = 0; + + while(1){ + + + if((waitstat = waitpid(-1, &status, WNOHANG)) == -1){ + + /* "Error while in wait() for %s" */ + + error(A_SYSERR,"get_input", GET_INPUT_007, prog_name); + break; + } + else if(waitstat > 0) + goto testwait; + + /* Select on the socket for reading for the other half of the timeout */ + + if((finished = select(FD_SETSIZE, &readmask, (fd_set *) NULL, (fd_set *) NULL, &timeval_struct)) >= 0){ + + if((waitstat = waitpid(-1, &status, WNOHANG)) == -1){ + + /* "Error while in wait() for %s" */ + + error(A_SYSERR,"get_input", GET_INPUT_007, prog_name); + break; + } + else if(waitstat > 0) + goto testwait; + + if(finished == 0){ + pathname_t tmp_str; + + /* The timeout has expired */ + + /* "Timeout of %d minutes on site %s retrieve" */ + + sprintf(tmp_str, GET_INPUT_012, timeout/60, header_rec -> primary_hostname); + put_request_string(tmp_str); + put_reply_string(""); + error(A_ERR, "get_input", GET_INPUT_012, timeout/60, header_rec -> primary_hostname); + kill(retval, SIGHUP); + return(ERROR); + + } + else{ + sleep(timeout/2); + + /* Check to see if the child has finished in the meantime */ + + if((waitstat = waitpid(-1, &status, WNOHANG)) == -1){ + + /* "Error while in wait() for %s" */ + + error(A_SYSERR,"get_input", GET_INPUT_007, prog_name); + + break; + } + else if(waitstat > 0) + goto testwait; + + /* Child not finished */ + + FD_ZERO(&readmask); + FD_SET(data_socket, &readmask); + timeval_struct.tv_sec = timeout/2; + timeval_struct.tv_usec = 0; + continue; + } + + } + else{ + + /* "Error while in select() for %s" */ + + error(A_SYSERR, "get_input", GET_INPUT_014, prog_name); + } + + if(wait(&status) == -1){ + + /* "Error while in wait() for %s" */ + + error(A_SYSERR,"get_input", GET_INPUT_007, prog_name); + break; + } + +testwait: + + if(WIFSIGNALED(status)){ + + /* "%s terminated abnormally with signal %u" */ + + error(A_ERR,"get_input", GET_INPUT_009, prog_name, WTERMSIG(status)); + break; + } + + if(WIFEXITED(status) && WEXITSTATUS(status)){ + + /* "%s exited abnormally with status %u" */ + + error(A_ERR,"get_input", GET_INPUT_008, prog_name, WEXITSTATUS(status)); + + /* Kludge */ + + if(((header_rec -> format == FCOMPRESS_LZ) || (header_rec->format == FCOMPRESS_GZIP) ) + && (WEXITSTATUS(status) == 2)){ + + /* "Insufficient data to compress(1). Empty listings" */ + + put_request_string(GET_INPUT_011); + put_reply_string(""); + } + + return(ERROR); + } + + break; + + } + + close(data_socket); + + close_file(o_file); + + return(A_OK); +} + + +/* + * sig_handle: set the global variable when a signal is caught + */ + +#ifndef SOLARIS +void sig_handle(sig, code, scp, addr) + int sig, code; + struct sigcontext *scp; + char *addr; +#else +void sig_handle(sig) + int sig; +#endif +{ + + if(sig == SIGALRM) + signal_set = 1; + else{ + + /* "retrieve program terminated with signal %d" */ + + error(A_ERR,"sig_handle",SIG_HANDLE_001, sig); + exit(ERROR); + } +} + + +status_t get_files(output_file, comm_in, comm_out, header_rec, hostname,hostaddr, compress_flag, rt, timeout, file_list, globbing) + file_info_t *output_file; + FILE *comm_in; + FILE *comm_out; + header_t *header_rec; + hostname_t hostname; + ip_addr_t hostaddr; + int compress_flag; + retdefs_t *rt; + int timeout; + char **file_list; + int globbing; +{ + int count = 0; + int retcode; + pathname_t retr_file; + pathname_t retr_dir; + pathname_t home_dir; + char **file_ltmp; + int portint; + int data_socket; + u16 port; + char *p, *h; + pathname_t tmp_name; + char type[MAX_ACCESS_METHOD]; + char **filel; + char **fl_name; + char *small_list[3]; + int orig_compress = compress_flag; + int nodir; + char **a; + int i; + + retcode = send_command(comm_in, comm_out,0, timeout, "PWD"); + + switch(retcode){ + char *pptr; + char *qptr; + + case FTP_PATHNAME_NONRFC: + case FTP_PATHNAME_CREATED: + + pptr = get_reply_string(); + + if((pptr = strchr(pptr, '"')) == (char *) NULL){ + + /* "Can't get home directory name for site" */ + + error_header(curr_file, output_file, count, header_rec, SUFFIX_PARSE, DO_RETRIEVE_011); + return(ERROR); + } + + if((qptr = strrchr(pptr, '"')) == (char *) NULL){ + + error_header(curr_file, output_file, count, header_rec, SUFFIX_PARSE, DO_RETRIEVE_011); + return(ERROR); + } + + count = (qptr - 1) - pptr; + + strncpy(home_dir, pptr + 1, count); + home_dir[count] = '\0'; + break; + + /* Try to fake it */ + + case FTP_COMMAND_NOT_IMPL: + strcpy(home_dir,"/"); + sprintf(header_rec -> comment, "Site %s does not implement PWD command", hostname); + break; + + + default: + + /* "Unexpected return code" */ + + error_header(curr_file, output_file, count, header_rec, SUFFIX_PARSE, DO_RETRIEVE_012); + return(ERROR); + break; + } + + for(count = 0, file_ltmp = file_list ; *file_ltmp != (char *) NULL; file_ltmp++, count++){ + char *pptr; + + nodir = 0; + + compress_flag = orig_compress; + + sprintf(curr_file -> filename, "%s_%d%s%s", output_file -> filename, count, SUFFIX_PARSE, TMP_SUFFIX); + + retr_file[0] = retr_dir[0] = '\0'; + + if(count != 0){ + retcode = send_command(comm_in, comm_out,0,timeout, "CWD %s", home_dir); + + switch(retcode){ + + case FTP_FILE_ACTION_OK: + + break; + + default: + + /* "Unexpected return code" */ + + error_header(curr_file, output_file, count, header_rec, SUFFIX_PARSE, DO_RETRIEVE_012); + return(ERROR); + break; + + } + } + /* Get filename and the directory that its in to be retrieved */ + + strcpy(retr_file, tail(*file_ltmp)); + + strcpy(retr_dir, *file_ltmp); + + if((pptr = strrchr(retr_dir, '/')) == (char *) NULL) + retr_dir[0] = '\0'; + else + *pptr = '\0'; + + if(retr_dir[0] != '\0'){ + + char *curr_ptr; + char dir_copy[MAX_ACCESS_METHOD]; + + strcpy(dir_copy, retr_dir); + + curr_ptr = strtok(dir_copy,"/"); + + + /* Repeatedly do CWD commands until we're in the right directory */ + + while(!nodir && (curr_ptr != (char *) NULL)){ + + retcode = send_command(comm_in, comm_out, 0, timeout, "CWD %s", curr_ptr); + + switch(retcode){ + + case FTP_FILE_ACTION_OK: + break; + + case FTP_LOST_CONN: + + /* "Lost connection" */ + + error_header(curr_file, output_file, count, header_rec, SUFFIX_PARSE, DO_RETRIEVE_013); + return(ERROR); + break; + + case FTP_ACTION_NOT_TAKEN: + + /* "Can't change directory to %s" */ + + error_header(curr_file, output_file, count, header_rec, SUFFIX_PARSE, DO_RETRIEVE_014, curr_ptr); + nodir = 1; + break; + + + default: + error_header(curr_file, output_file, count, header_rec, SUFFIX_PARSE, DO_RETRIEVE_012); + return(ERROR); + break; + } + + curr_ptr = strtok((char *) NULL,"/"); + } + + } + + if(nodir) + continue; + + HDR_UNSET_HCOMMENT(header_rec -> header_flags); + header_rec -> comment[0] = '\0'; + + /* Support filename globbing if turned on and the given + filename contains globbing characters */ + + if((strpbrk(retr_file, rt -> def_ftpglob) != (char *) NULL) + && globbing){ + struct sockaddr_in sockaddr; + int sockaddr_len; + fd_set readmask; + struct timeval timeval_struct; + int old_ds; + int curr_count = 0; + int max_count = 0; + char **tmp_list; + + int finished = 0; + FILE *tmp_fp; + + if((tmp_list = (char **) malloc(DEFAULT_NO_FILES * sizeof(char *))) == (char **) NULL){ + + /* "Can't malloc() space for file list" */ + + error_header(curr_file, output_file, count, header_rec, SUFFIX_PARSE, DO_RETRIEVE_025); + return(ERROR); + } + + max_count = DEFAULT_NO_FILES; + curr_count = 0; + + /* Set up the data connection for NLST */ + + if(get_new_port(&portint, &data_socket) == ERROR){ + + /* "Unable to get local port for data transfer" */ + + error_header(curr_file, output_file, count, header_rec, SUFFIX_PARSE, DO_RETRIEVE_015); + return(ERROR); + } + + port = portint; + + hostaddr = htonl(hostaddr); + port = htons(port); + + h = (char *) &hostaddr; + p = (char *) &port; + + retcode = send_command(comm_in, comm_out,0, timeout, "PORT %d,%d,%d,%d,%d,%d", + UC(h[0]),UC(h[1]),UC(h[2]),UC(h[3]),UC(p[0]),UC(p[1])); + + switch(retcode){ + + case FTP_COMMAND_OK: + break; + + case FTP_LOST_CONN: + + /* "Lost connection" */ + + error_header(curr_file, output_file, count, header_rec, SUFFIX_PARSE, DO_RETRIEVE_013); + return(ERROR); + break; + + /* + * In this case we should follow RFC 959 and accept the default data + * port. Another version perhaps. + */ + + case FTP_COMMAND_NOT_IMPL: + + /* "Command not implemented" */ + + error_header(curr_file, output_file, count, header_rec, SUFFIX_PARSE, DO_RETRIEVE_016); + return(ERROR); + break; + + default: + + /* "Unexpected return code" */ + + error_header(curr_file, output_file, count, header_rec, SUFFIX_PARSE, DO_RETRIEVE_012); + return(ERROR); + break; + } + + retcode = send_command(comm_in, comm_out, 0, timeout, "NLST %s", retr_file); + + switch(retcode){ + + case FTP_OPEN_DATACONN: + case FTP_DATACONN_OPEN: + break; + + case FTP_FILE_UNAVAILABLE: + + /* "Can't get file %s. Currently unavailable" */ + + error_header(curr_file, output_file, count, header_rec, SUFFIX_PARSE, DO_RETRIEVE_019, retr_file); + break; + + case FTP_ACTION_NOT_TAKEN: + + /* "Can't get file %s. File does not exist" */ + + error_header(curr_file, output_file, count, header_rec, SUFFIX_PARSE, DO_RETRIEVE_020, retr_file); + continue; + break; + + default: + + /* "Unexpected return code" */ + + error_header(curr_file, output_file, count, header_rec, SUFFIX_PARSE, DO_RETRIEVE_012); + return(ERROR); + break; + } + + /* Accept the connection from the server */ + + sockaddr_len = sizeof(struct sockaddr_in); + + old_ds = data_socket; + + FD_ZERO(&readmask); + + FD_SET(old_ds, &readmask); + + timeval_struct.tv_sec = (long) timeout; + timeval_struct.tv_usec = 0L; + + if((finished = select(FD_SETSIZE, &readmask, (fd_set *) NULL, (fd_set *) NULL, &timeval_struct)) == 0){ + pathname_t tmp_str; + + /* "Timeout of %d minutes on site %s retrieve" */ + + sprintf(tmp_str, GET_INPUT_012, timeout/60, header_rec -> primary_hostname); + put_reply_string(tmp_str); + error(A_ERR, "get_files", GET_INPUT_012, timeout/60, header_rec -> primary_hostname); + return(ERROR); + } + else{ + if(finished == -1){ + + /* "Error while in select() for data transfer" */ + + error(A_SYSERR, "get_files", GET_INPUT_015); + return(ERROR); + } + } + + if((data_socket = accept(old_ds, (struct sockaddr *) &sockaddr, &sockaddr_len)) == -1){ + + /* "Can't accept() data connection from %s" */ + + error_header(curr_file, output_file, count, header_rec, SUFFIX_PARSE, DO_RETRIEVE_020, retr_file); + return(ERROR); + } + + close(old_ds); + + if((tmp_fp = fdopen(data_socket, "r")) == (FILE *) NULL){ + + error_header(curr_file, output_file, count, header_rec, SUFFIX_PARSE, DO_RETRIEVE_023); + return(ERROR); + } + + while(fgets(tmp_name, sizeof(tmp_name), tmp_fp) == tmp_name){ + + *(strchr(tmp_name, '\r')) = '\0'; + + if(verbose) + error(A_INFO, "get_files", "File: %s", tmp_name); + + if(curr_count < max_count) + tmp_list[curr_count] = strdup(tmp_name); + else{ + char **mylist; + + if((mylist = (char **) realloc( tmp_list, (max_count + NO_FILES_INC) * sizeof(char *))) == (char **) NULL){ + + /* "Can't realloc() space for file list" */ + + error_header(curr_file, output_file, count, header_rec, SUFFIX_PARSE, DO_RETRIEVE_024); + return(ERROR); + } + tmp_list = mylist; + + max_count += NO_FILES_INC; + tmp_list[curr_count] = strdup(tmp_name); + } + + curr_count++; + } + + tmp_list[curr_count] = (char *) NULL; + fclose(tmp_fp); + filel = tmp_list; + + if(get_reply(comm_in, comm_out, &retcode, 0, timeout) == ERROR){ + + /* "Unable to perform transfer" */ + + error_header(curr_file, output_file, count, header_rec, SUFFIX_PARSE, DO_RETRIEVE_021); + return(ERROR); + } + + + switch(retcode){ + + case FTP_TRANSFER_COMPLETE: + break; + + default: + + /* "Unexpected return code" */ + + error_header(curr_file, output_file, count, header_rec, SUFFIX_PARSE, DO_RETRIEVE_012); + return(ERROR); + break; + } + + + + } + else{ + small_list[0] = retr_file; + small_list[1] = (char *) NULL; + filel = small_list; + } + + for(fl_name = filel; *fl_name != (char *) NULL; fl_name++, count++){ + + strcpy(retr_file, *fl_name); + + /* Set up the data connection */ + + + if(get_new_port(&portint, &data_socket) == ERROR){ + + /* "Unable to get local port for data transfer" */ + + error_header(curr_file, output_file, count, header_rec, SUFFIX_PARSE, DO_RETRIEVE_015); + return(ERROR); + } + + port = portint; + + hostaddr = htonl(hostaddr); + port = htons(port); + + h = (char *) &hostaddr; + p = (char *) &port; + + retcode = send_command(comm_in, comm_out,0, timeout, "PORT %d,%d,%d,%d,%d,%d", + UC(h[0]),UC(h[1]),UC(h[2]),UC(h[3]),UC(p[0]),UC(p[1])); + + switch(retcode){ + + case FTP_COMMAND_OK: + break; + + case FTP_LOST_CONN: + + /* "Lost connection" */ + + error_header(curr_file, output_file, count, header_rec, SUFFIX_PARSE, DO_RETRIEVE_013); + return(ERROR); + break; + + /* + * In this case we should follow RFC 959 and accept the default data + * port. Another version perhaps. + */ + + case FTP_COMMAND_NOT_IMPL: + + /* "Command not implemented" */ + + error_header(curr_file, output_file, count, header_rec, SUFFIX_PARSE, DO_RETRIEVE_016); + return(ERROR); + break; + + default: + + /* "Unexpected return code" */ + + error_header(curr_file, output_file, count, header_rec, SUFFIX_PARSE, DO_RETRIEVE_012); + return(ERROR); + break; + } + + + header_rec -> format = FRAW; + HDR_SET_FORMAT(header_rec -> header_flags); + + /* Non-default action to be taken. See if the retrieved file has the + compression extension for that system */ + + a = str_sep(rt->def_compress_ext,','); + if ( a != NULL ) { + for ( i = 0; a[i] != NULL; i++ ) { + + if(strcmp(retr_file + strlen(retr_file) - strlen(a[i]), a[i]) == 0){ + + /* The file is compressed */ + if ( strcmp(a[i],".gz") == 0 ) { + header_rec -> format = FCOMPRESS_GZIP; + if ( compress_flag < 0 ) + orig_compress = compress_flag = -2; + } + + if ( strcmp(a[i],".Z") == 0 ) { + header_rec -> format = FCOMPRESS_LZ; + } + HDR_SET_FORMAT(header_rec -> header_flags); + + if(compress_flag >= 1){ + + /* The file is compressed and we want it that way, so nothing + need be done to it */ + + compress_flag = 0; + } + + /* Have to change the transmission method to retrieve in the + default binary access method for this system */ + + if(strcasecmp(rt -> bin_access, "image") == 0) + strcpy(type,"I"); + else if(strcasecmp(rt -> bin_access,"tenex") == 0) + strcpy(type,"L 8"); + else{ + + /* "Binary access method '%s' is not supported" */ + + error_header(curr_file, output_file, count, header_rec, SUFFIX_PARSE, DO_RETRIEVE_018, rt -> bin_access); + return(ERROR); + } + + + retcode = send_command(comm_in, comm_out, 0, timeout, "TYPE %s", type); + + switch(retcode){ + + case FTP_COMMAND_OK: + break; + + case FTP_COMM_PARAM_NOT_IMPL: + + /* "Command not implemented" */ + + error_header(curr_file, output_file, count, header_rec, SUFFIX_PARSE, DO_RETRIEVE_016); + return(ERROR); + + break; + + case FTP_LOST_CONN: + + /* "Lost connection" */ + + error_header(curr_file, output_file, count, header_rec, SUFFIX_PARSE, DO_RETRIEVE_013); + return(ERROR); + + break; + + case FTP_COMMAND_NOT_IMPL: + + /* "Command not implemented" */ + + error_header(curr_file, output_file, count, header_rec, SUFFIX_PARSE, DO_RETRIEVE_016); + return(ERROR); + break; + + default: + + /* "Unexpected return code" */ + + error_header(curr_file, output_file, count, header_rec, SUFFIX_PARSE, DO_RETRIEVE_012); + return(ERROR); + break; + } + break; + } + } + } + if ( a == NULL || a[i] == NULL ) { + if(compress_flag == -1) + compress_flag = 0; + } + + sprintf(header_rec -> data_name, "%s/%s", retr_dir, retr_file); + HDR_SET_DATA_NAME(header_rec -> header_flags); + + retcode = send_command(comm_in, comm_out, 0, timeout, "RETR %s", retr_file); + + switch(retcode){ + + case FTP_OPEN_DATACONN: + break; + + case FTP_FILE_UNAVAILABLE: + + /* "Can't get file %s. Currently unavailable" */ + + error_header(curr_file, output_file, count, header_rec, SUFFIX_PARSE, DO_RETRIEVE_019, retr_file); + continue; + break; + + case FTP_ACTION_NOT_TAKEN: + + /* "Can't get file %s. File does not exist" */ + + error_header(curr_file, output_file, count, header_rec, SUFFIX_PARSE, DO_RETRIEVE_020, retr_file); + continue; + break; + + default: + + /* "Unexpected return code" */ + + error_header(curr_file, output_file, count, header_rec, SUFFIX_PARSE, DO_RETRIEVE_012); + continue; + break; + } + + + if(get_input(curr_file, header_rec, compress_flag, data_socket, timeout) == ERROR){ + + /* "Unable to perform transfer" */ + + error_header(curr_file, output_file, count, header_rec, SUFFIX_PARSE, DO_RETRIEVE_021); + return(ERROR); + } + + if(get_reply(comm_in, comm_out, &retcode, 0, timeout) == ERROR){ + + /* "Unable to perform transfer" */ + + error_header(curr_file, output_file, count, header_rec, SUFFIX_PARSE, DO_RETRIEVE_021); + return(ERROR); + } + + + switch(retcode){ + + case FTP_TRANSFER_COMPLETE: + break; + + default: + + /* "Unexpected return code" */ + + error_header(curr_file, output_file, count, header_rec, SUFFIX_PARSE, DO_RETRIEVE_012); + return(ERROR); + break; + } + + + sprintf(tmp_name, "%s_%d%s", output_file -> filename, count, SUFFIX_PARSE); + + if(rename(curr_file -> filename, tmp_name) == -1){ + + /* "Can't rename temporary file %s to %s" */ + + error(A_SYSERR,"do_retrieve", DO_RETRIEVE_022, curr_file -> filename, tmp_name); + return(ERROR); + } + + } + + if(filel != small_list) + free_opts(filel); + } + + return(A_OK); +} + + +status_t get_pwd( output_file, comm_in, comm_out, header_rec, hostname, hostaddr, rt, timeout, home_dir) + file_info_t *output_file; + FILE *comm_in; + FILE *comm_out; + header_t *header_rec; + hostname_t hostname; + ip_addr_t hostaddr; + retdefs_t *rt; + int timeout; + pathname_t home_dir; + +{ + + int count = 0; + int retcode = 0; + + retcode = send_command(comm_in, comm_out, 0, timeout, "PWD"); + + + switch(retcode){ + char *pptr; + char *qptr; + + case FTP_PATHNAME_NONRFC: + case FTP_PATHNAME_CREATED: + + pptr = get_reply_string(); + + if((pptr = strchr(pptr, '"')) == (char *) NULL){ + + /* "Can't get home directory name for site" */ + + error_header(curr_file, output_file, count, header_rec, SUFFIX_PARSE, DO_RETRIEVE_011); + return(ERROR); + } + + if((qptr = strrchr(pptr, '"')) == (char *) NULL){ + + error_header(curr_file, output_file, count, header_rec, SUFFIX_PARSE, DO_RETRIEVE_011); + return(ERROR); + } + + count = (qptr - 1) - pptr; + + strncpy(home_dir, pptr + 1, count); + home_dir[count] = '\0'; + break; + + /* Try to fake it */ + + case FTP_COMMAND_NOT_IMPL: + strcpy(home_dir,"/"); + sprintf(header_rec -> comment, "Site %s does not implement PWD command", hostname); + break; + + + default: + + /* "Unexpected return code" */ + + error_header(curr_file, output_file, count, header_rec, SUFFIX_PARSE, DO_RETRIEVE_012); + return(ERROR); + break; + } + + return(A_OK); + +} + + +status_t get_list(output_file, comm_in, comm_out, header_rec, hostname,hostaddr, compress_flag, rt, timeout) + file_info_t *output_file; + FILE *comm_in; + FILE *comm_out; + header_t *header_rec; + hostname_t hostname; + ip_addr_t hostaddr; + int compress_flag; + retdefs_t *rt; + int timeout; +{ + int portint; + int data_socket; + u16 port; + char *p, *h; + int count = 0; + int retcode = 0; + pathname_t tmp_name; + + + /* Set up the data connection */ + + if(get_new_port(&portint, &data_socket) == ERROR){ + + /* "Unable to get local port for data transfer" */ + + error_header(curr_file, output_file, count, header_rec, SUFFIX_PARSE, DO_RETRIEVE_015); + return(ERROR); + } + + + port = portint; + + hostaddr = htonl(hostaddr); + port = htons(port); + + + h = (char *) &hostaddr; + p = (char *) &port; + + + retcode = send_command(comm_in, comm_out,0, timeout, "PORT %d,%d,%d,%d,%d,%d", + UC(h[0]),UC(h[1]),UC(h[2]),UC(h[3]),UC(p[0]),UC(p[1])); + + switch(retcode){ + + case FTP_COMMAND_OK: + break; + + case FTP_LOST_CONN: + + /* "Lost connection" */ + + error_header(curr_file, output_file, count, header_rec, SUFFIX_PARSE, DO_RETRIEVE_013); + return(ERROR); + break; + + /* + * In this case we should follow RFC 959 and accept the default data + * port. Another version perhaps. + */ + + case FTP_COMMAND_NOT_IMPL: + + /* "Command not implemented" */ + + error_header(curr_file, output_file, count, header_rec, SUFFIX_PARSE, DO_RETRIEVE_016); + return(ERROR); + break; + + default: + + /* "Unexpected return code" */ + + error_header(curr_file, output_file, count, header_rec, SUFFIX_PARSE, DO_RETRIEVE_012); + return(ERROR); + break; + } + + + header_rec -> format = FRAW; + HDR_SET_FORMAT(header_rec -> header_flags); + + + /* LIST command retrieves in uncompressed ASCII. If uncompress flag + is set, then turn it off */ + + if(compress_flag <= -1) + compress_flag = 0; + + + /* Port command was accepted, issue the LIST command */ + + retcode = send_command(comm_in, comm_out, 0, timeout, "LIST %s", rt -> def_ftparg); + + switch(retcode){ + + case FTP_DATACONN_OPEN: + case FTP_OPEN_DATACONN: + break; + + case FTP_CANT_DATACONN: + case FTP_ABORT_DATACONN: + case FTP_LOCAL_ERROR: + case FTP_FILE_UNAVAILABLE: + + /* "Error in making data connection" */ + + error_header(curr_file, output_file, count, header_rec, SUFFIX_PARSE, DO_RETRIEVE_017); + return(ERROR); + break; + + case FTP_LOST_CONN: + + /* "Lost connection" */ + + error_header(curr_file, output_file, count, header_rec, SUFFIX_PARSE, DO_RETRIEVE_013); + return(ERROR); + break; + + case FTP_COMMAND_NOT_IMPL: + + /* "Command not implemented" */ + + error_header(curr_file, output_file, count, header_rec, SUFFIX_PARSE, DO_RETRIEVE_016); + break; + + default: + + /* "Unexpected return code" */ + + error_header(curr_file, output_file, count, header_rec, SUFFIX_PARSE, DO_RETRIEVE_012); + return(ERROR); + break; + } + + + if(get_input(curr_file, header_rec, compress_flag, data_socket, timeout) == ERROR){ + + /* "Unable to perform transfer" */ + + error_header(curr_file, output_file, count, header_rec, SUFFIX_PARSE, DO_RETRIEVE_021); + return(ERROR); + } + + if(get_reply(comm_in, comm_out, &retcode, 0, timeout) == ERROR){ + + /* "Unable to perform transfer" */ + + error_header(curr_file, output_file, count, header_rec, SUFFIX_PARSE, DO_RETRIEVE_021); + return(ERROR); + } + + + switch(retcode){ + + case FTP_TRANSFER_COMPLETE: + break; + + default: + + /* "Unexpected return code" */ + + error_header(curr_file, output_file, count, header_rec, SUFFIX_PARSE, DO_RETRIEVE_012); + return(ERROR); + break; + } + + sprintf(tmp_name, "%s_%d%s", output_file -> filename, count, SUFFIX_PARSE); + + if(rename(curr_file -> filename, tmp_name) == -1){ + + /* "Can't rename temporary file %s to %s" */ + + error(A_SYSERR,"do_retrieve", DO_RETRIEVE_022, curr_file -> filename, tmp_name); + return(ERROR); + } + + return(A_OK); +} + + + +/* Check to see if ls-lR.Z file exists. If so, then see if modification time + is more recent that when we last looked */ + +int check_for_lslRZ(comm_in, comm_out, file_list, header_rec, timeout, rt) + FILE *comm_in; + FILE *comm_out; + char **file_list; + header_t *header_rec; + int timeout; + retdefs_t *rt; +{ + pathname_t tmp_str; + pathname_t ft; + date_time_t last_time; + pathname_t currf; + pathname_t currd; + int retcode; + + char **a; + int i; + + + a = str_sep(rt->def_compress_ext,','); + + if ( a == NULL ) + return 0; + + for ( i = 0; a[i] != NULL; i++ ) { + /* sprintf(tmp_str, "%s%s", rt -> def_indexfile, rt -> def_compress_ext); */ + sprintf(tmp_str, "%s%s", rt -> def_indexfile, a[i]); + strcpy(currf, tmp_str); + currd[0] = '\0'; + + if((retcode = send_command(comm_in, comm_out, 0, timeout, "MDTM %s", currf)) != FTP_FILE_STATUS){ + + if(retcode == FTP_COMMAND_NOT_IMPL){ + if(file_list){ + free_opts(file_list); + file_list[0] = (char *) NULL; + } + return 0; + } + + strcpy(currf, tmp_str); + + if(send_command(comm_in, comm_out, 0, timeout, "MDTM %s", currf) != FTP_FILE_STATUS){ + + /* No such file or directory */ + + /* Change into the "pub" directory */ + + strcpy(currd, "/PUB/"); + + /* Have to check for both "PUB" and "pub" */ + + if((send_command(comm_in, comm_out, 0, timeout, "CWD %s", currd) == FTP_FILE_ACTION_OK) + || (send_command(comm_in, comm_out, 0, timeout, "CWD %s", make_lcase(currd)) == FTP_FILE_ACTION_OK)){ + + sprintf(tmp_str, "%s%s", rt -> def_indexfile, a[i]); + strcpy(currf, tmp_str); + + if(send_command(comm_in, comm_out, 0, timeout, "MDTM %s", currf) != FTP_FILE_STATUS){ + + + sprintf(tmp_str, "%s%s", rt -> def_indexfile, a[i]); + strcpy(currf, tmp_str); + + if(send_command(comm_in, comm_out, 0, timeout, "MDTM %s", currf) != FTP_FILE_STATUS){ + + send_command(comm_in, comm_out, 0, timeout, "CDUP"); + if(file_list){ +/* free_opts(file_list); */ + file_list[0] = (char *) NULL; + } + continue; /*return 0; */ + } + } + } + else + continue; /*return 0; */ + } + } + break; + } + if ( a[i] == NULL ) { + return 0; + } + strcpy(tmp_str, get_reply_string()); + + sscanf(tmp_str, "%*d %s", ft); + + last_time = cvt_to_inttime(ft, 0); + + if(last_time > header_rec -> retrieve_time){ + char *tmp; + /* Next check the size */ + + if(send_command(comm_in, comm_out, 0, timeout, "SIZE %s", currf) == FTP_FILE_STATUS){ + + strcpy(tmp_str, get_reply_string()); + + sscanf(tmp_str, "%*d %s", ft); + + if(atoi(ft) < MIN_LSLR_SIZE){ + + /* "WARNING: This listing file '%s%s' may be a soft link" */ + + sprintf(header_rec -> comment, CHECK_FOR_LSLRZ_001, currd, currf); + HDR_SET_HCOMMENT(header_rec -> header_flags); + write_mail(MAIL_RETR_FAIL, "%s %s %s", header_rec -> primary_hostname, header_rec -> access_methods, header_rec -> comment); + } + } + + sprintf(tmp_str, "%s%s", currd, currf); + tmp = strdup(tmp_str); + file_list[0] = tmp; /*strdup(tmp_str);*/ + file_list[1] = (char *) NULL; + + } + else{ + pathname_t timehold; + + strcpy(timehold, cvt_to_usertime(last_time, 1)); + + /* "WARNING: file '%s%s' has date of %s, last retrieve done %s. Not taken" */ + if ( last_time != 0 ) { + sprintf(header_rec -> comment, CHECK_FOR_LSLRZ_002, currd, currf, timehold, cvt_to_usertime(header_rec -> retrieve_time, 1)); + HDR_SET_HCOMMENT(header_rec -> header_flags); + write_mail(MAIL_RETR_FAIL, "%s %s %s", header_rec -> primary_hostname, header_rec -> access_methods, header_rec -> comment); + } + if(file_list){ +/* free_opts(file_list); */ + file_list[0] = (char *) NULL; + } + } + + if(currd[0]) + send_command(comm_in, comm_out, 0, timeout, "CDUP"); + + return 0; +} + + +status_t gather_atend(file_list, input_file) + char ***file_list; + file_info_t *input_file; +{ + char **local_list; + header_t discard_header; + pathname_t inbuf; + int curr_count; + int max_count; + + max_count = MAX_DEF_FILES; + + if((local_list = (char **) malloc(max_count * sizeof(char *))) == (char **) NULL){ + + error(A_ERR, "gather_atend", "Can't malloc space for default file list"); + return(ERROR); + } + + curr_count = 0; + + if(open_file(input_file, O_RDONLY) == ERROR){ + + error(A_ERR, "gather_atend", "Can't open input file %s", input_file -> filename); + return(ERROR); + } + + if(read_header(input_file -> fp_or_dbm.fp, &discard_header, (u32 *) NULL, 0, 0) == ERROR){ + + error(A_ERR, "gather_atend", "Can't read header of input file %s", input_file -> filename); + return(ERROR); + } + + /* Have read and thown away the header */ + + while(fgets(inbuf, sizeof(inbuf), input_file -> fp_or_dbm.fp) == inbuf){ + char *tstr; + + if((tstr = strrchr(inbuf, '\n')) != (char *) NULL) + *tstr = '\0'; + + local_list[curr_count++] = strdup(inbuf); + + if(curr_count == max_count){ + + max_count += DEF_INCR; + + if((local_list = (char **) realloc(local_list, max_count * sizeof(char *))) == (char **) NULL){ + + error(A_ERR, "gather_atend", "Can't realloc space for file list"); + return(ERROR); + } + } + } + + local_list[curr_count] = (char *) NULL; + + *file_list = local_list; + + close_file(input_file); + + return(A_OK); +} + + +void error_header( va_alist ) + va_dcl + +/* file_info_t *curr_file; + file_info_t *output_file; + int count; + header_t *header_rec; + char *format; + char *suffix; + arglist +*/ +{ + pathname_t tmp_name; + file_info_t *c_file; /* the output file */ + file_info_t *output_file; /* the output file */ + int count; /* */ + header_t *header_rec; /* the header record to be written */ + char *suffix; + char holdstr[1024]; + va_list al; + + va_start( al ); + + c_file = va_arg(al, file_info_t *); + output_file = va_arg(al, file_info_t *); + count = va_arg(al, int); + header_rec = va_arg(al, header_t *); + suffix = va_arg(al, char *); + + sprintf(tmp_name, "%s (%s) (%s)", va_arg(al, char *), get_request_string(), get_reply_string()); + + vsprintf(holdstr, tmp_name, al); + + do_error_header(c_file, output_file, count, header_rec, suffix, holdstr); + + va_end( al ); + +} diff --git a/archie/anonftp/retrieve/ftp_getfile.h b/archie/anonftp/retrieve/ftp_getfile.h new file mode 100644 index 0000000..1f14892 --- /dev/null +++ b/archie/anonftp/retrieve/ftp_getfile.h @@ -0,0 +1,65 @@ +#ifndef _FTP_GETFILE_H_ +#define _FTP_GETFILE_H_ + +#include "header.h" + +typedef struct{ + + access_methods_t access_methods; + os_type_t os_type; + char bin_access[MAX_ACCESS_METHOD]; + char def_compress_ext[MAX_ACCESS_METHOD]; + char def_user[MAX_ACCESS_METHOD]; + char def_pass[MAX_ACCESS_METHOD]; + char def_acct[MAX_ACCESS_METHOD]; + char def_ftparg[MAX_ACCESS_METHOD]; + char def_ftpglob[MAX_ACCESS_METHOD]; + pathname_t def_indexfile; +} retdefs_t; + +#ifndef DEFAULT_RETDEFS +#define DEFAULT_RETDEFS "arretdefs.cf" +#endif + +#ifndef MAX_RETDEFS +#define MAX_RETDEFS 20 +#endif + +#ifndef MAX_RETRIEVE_RETRY +#define MAX_RETRIEVE_RETRY 2 +#endif + +#ifndef RETRY_DELAY +#define RETRY_DELAY 5 * 60 /* 5 Minutes */ +#endif + +#define DEFAULT_TIMEOUT 15 * 60 /* 15 minutes */ + +#ifndef MIN_LSLR_SIZE +#define MIN_LSLR_SIZE 100 /* Must be 100 bytes long */ +#endif + +#define IGNORE_FILE "*IGNORE*" +#define ATEND_FILE "*ATEND*" + +#define MAX_DEF_FILES 100 +#define DEF_INCR 200 + + +extern status_t read_retdefs PROTO((file_info_t *, retdefs_t *)); +extern status_t do_retrieve PROTO((header_t *,file_info_t *, file_info_t *, retdefs_t *, int, int, int, int)); +extern status_t get_input PROTO((file_info_t *,header_t *,int,int,int)); +extern void error_header PROTO((va_alist)); +#ifndef SOLARIS +extern void sig_handle PROTO((int, int, struct sigcontext *, char *)); +#else +extern void sig_handle PROTO((int)); +#endif +extern status_t get_files PROTO((file_info_t *, FILE *, FILE *, header_t *, hostname_t, ip_addr_t, int, retdefs_t *, int, char **, int)); +extern status_t get_list PROTO((file_info_t *, FILE *, FILE *, header_t *, hostname_t, ip_addr_t, int, retdefs_t *, int)); +extern status_t get_pwd PROTO((file_info_t *, FILE *, FILE *, header_t *, hostname_t, ip_addr_t, retdefs_t *, int, pathname_t)); +extern char* get_conn_err PROTO((int)); +extern status_t gather_atend PROTO((char ***,file_info_t *)); +extern int check_for_lslRZ PROTO((FILE *, FILE *,char **,header_t *, int, retdefs_t *)); + +#endif diff --git a/archie/anonftp/retrieve/glob.c b/archie/anonftp/retrieve/glob.c new file mode 100644 index 0000000..f7e44bb --- /dev/null +++ b/archie/anonftp/retrieve/glob.c @@ -0,0 +1,662 @@ +/* + * Copyright (c) 1980 Regents of the University of California. + * All rights reserved. + * + * Redistribution and use in source and binary forms are permitted + * provided that: (1) source distributions retain this entire copyright + * notice and comment, and (2) distributions including binaries display + * the following acknowledgement: ``This product includes software + * developed by the University of California, Berkeley and its contributors'' + * in the documentation or other materials provided with the distribution + * and in all advertising materials mentioning features or use of this + * software. Neither the name of the University nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + */ + +#ifndef lint +static char sccsid[] = "@(#)glob.c 5.8 (Berkeley) 6/1/90"; +#endif /* not lint */ + +/* + * C-shell glob for random programs. + */ + +#include +#include +#include + +#include +#include +#include + +#define QUOTE 0200 +#define TRIM 0177 +#define eq(a,b) (strcmp(a, b)==0) +#define GAVSIZ (NCARGS/6) +#define isdir(d) ((d.st_mode & S_IFMT) == S_IFDIR) + +static char **gargv; /* Pointer to the (stack) arglist */ +static int gargc; /* Number args in gargv */ +static int gnleft; +static short gflag; +static int tglob(); +char **glob(); +char *globerr; +char *home; +struct passwd *getpwnam(); +extern int errno; +static char *strspl(), *strend(); +char *malloc(), *strcpy(), *strcat(); +char **copyblk(); + +static int globcnt; + +char *globchars = "`{[*?"; + +static char *gpath, *gpathp, *lastgpathp; +static int globbed; +static char *entp; +static char **sortbas; + +char ** +glob(v) + register char *v; +{ + char agpath[BUFSIZ]; + char *agargv[GAVSIZ]; + char *vv[2]; + vv[0] = v; + vv[1] = 0; + gflag = 0; + rscan(vv, tglob); + if (gflag == 0) + return (copyblk(vv)); + + globerr = 0; + gpath = agpath; gpathp = gpath; *gpathp = 0; + lastgpathp = &gpath[sizeof agpath - 2]; + ginit(agargv); globcnt = 0; + collect(v); + if (globcnt == 0 && (gflag&1)) { + blkfree(gargv), gargv = 0; + return (0); + } else + return (gargv = copyblk(gargv)); +} + +static +ginit(agargv) + char **agargv; +{ + + agargv[0] = 0; gargv = agargv; sortbas = agargv; gargc = 0; + gnleft = NCARGS - 4; +} + +static +collect(as) + register char *as; +{ + if (eq(as, "{") || eq(as, "{}")) { + Gcat(as, ""); + sort(); + } else + acollect(as); +} + +static +acollect(as) + register char *as; +{ + register int ogargc = gargc; + + gpathp = gpath; *gpathp = 0; globbed = 0; + expand(as); + if (gargc != ogargc) + sort(); +} + +static +sort() +{ + register char **p1, **p2, *c; + char **Gvp = &gargv[gargc]; + + p1 = sortbas; + while (p1 < Gvp-1) { + p2 = p1; + while (++p2 < Gvp) + if (strcmp(*p1, *p2) > 0) + c = *p1, *p1 = *p2, *p2 = c; + p1++; + } + sortbas = Gvp; +} + +static +expand(as) + char *as; +{ + register char *cs; + register char *sgpathp, *oldcs; + struct stat stb; + + sgpathp = gpathp; + cs = as; + if (*cs == '~' && gpathp == gpath) { + addpath('~'); + for (cs++; letter(*cs) || digit(*cs) || *cs == '-';) + addpath(*cs++); + if (!*cs || *cs == '/') { + if (gpathp != gpath + 1) { + *gpathp = 0; + if (gethdir(gpath + 1)) + globerr = "Unknown user name after ~"; + (void) strcpy(gpath, gpath + 1); + } else + (void) strcpy(gpath, home); + gpathp = strend(gpath); + } + } + while (!any(*cs, globchars)) { + if (*cs == 0) { + if (!globbed) + Gcat(gpath, ""); + else if (stat(gpath, &stb) >= 0) { + Gcat(gpath, ""); + globcnt++; + } + goto endit; + } + addpath(*cs++); + } + oldcs = cs; + while (cs > as && *cs != '/') + cs--, gpathp--; + if (*cs == '/') + cs++, gpathp++; + *gpathp = 0; + if (*oldcs == '{') { + (void) execbrc(cs, ((char *)0)); + return; + } + matchdir(cs); +endit: + gpathp = sgpathp; + *gpathp = 0; +} + +static +matchdir(pattern) + char *pattern; +{ + struct stat stb; + register struct direct *dp; + DIR *dirp; + + dirp = opendir(gpath); + if (dirp == NULL) { + if (globbed) + return; + goto patherr2; + } + if (fstat(dirp->dd_fd, &stb) < 0) + goto patherr1; + if (!isdir(stb)) { + errno = ENOTDIR; + goto patherr1; + } + while ((dp = readdir(dirp)) != NULL) { + if (dp->d_ino == 0) + continue; + if (match(dp->d_name, pattern)) { + Gcat(gpath, dp->d_name); + globcnt++; + } + } + closedir(dirp); + return; + +patherr1: + closedir(dirp); +patherr2: + globerr = "Bad directory components"; +} + +static +execbrc(p, s) + char *p, *s; +{ + char restbuf[BUFSIZ + 2]; + register char *pe, *pm, *pl; + int brclev = 0; + char *lm, savec, *sgpathp; + + for (lm = restbuf; *p != '{'; *lm++ = *p++) + continue; + for (pe = ++p; *pe; pe++) + switch (*pe) { + + case '{': + brclev++; + continue; + + case '}': + if (brclev == 0) + goto pend; + brclev--; + continue; + + case '[': + for (pe++; *pe && *pe != ']'; pe++) + continue; + continue; + } +pend: + brclev = 0; + for (pl = pm = p; pm <= pe; pm++) + switch (*pm & (QUOTE|TRIM)) { + + case '{': + brclev++; + continue; + + case '}': + if (brclev) { + brclev--; + continue; + } + goto doit; + + case ','|QUOTE: + case ',': + if (brclev) + continue; +doit: + savec = *pm; + *pm = 0; + (void) strcpy(lm, pl); + (void) strcat(restbuf, pe + 1); + *pm = savec; + if (s == 0) { + sgpathp = gpathp; + expand(restbuf); + gpathp = sgpathp; + *gpathp = 0; + } else if (amatch(s, restbuf)) + return (1); + sort(); + pl = pm + 1; + if (brclev) + return (0); + continue; + + case '[': + for (pm++; *pm && *pm != ']'; pm++) + continue; + if (!*pm) + pm--; + continue; + } + if (brclev) + goto doit; + return (0); +} + +static +match(s, p) + char *s, *p; +{ + register int c; + register char *sentp; + char sglobbed = globbed; + + if (*s == '.' && *p != '.') + return (0); + sentp = entp; + entp = s; + c = amatch(s, p); + entp = sentp; + globbed = sglobbed; + return (c); +} + +static +amatch(s, p) + register char *s, *p; +{ + register int scc; + int ok, lc; + char *sgpathp; + struct stat stb; + int c, cc; + + globbed = 1; + for (;;) { + scc = *s++ & TRIM; + switch (c = *p++) { + + case '{': + return (execbrc(p - 1, s - 1)); + + case '[': + ok = 0; + lc = 077777; + while (cc = *p++) { + if (cc == ']') { + if (ok) + break; + return (0); + } + if (cc == '-') { + if (lc <= scc && scc <= *p++) + ok++; + } else + if (scc == (lc = cc)) + ok++; + } + if (cc == 0) + if (ok) + p--; + else + return 0; + continue; + + case '*': + if (!*p) + return (1); + if (*p == '/') { + p++; + goto slash; + } + s--; + do { + if (amatch(s, p)) + return (1); + } while (*s++); + return (0); + + case 0: + return (scc == 0); + + default: + if (c != scc) + return (0); + continue; + + case '?': + if (scc == 0) + return (0); + continue; + + case '/': + if (scc) + return (0); +slash: + s = entp; + sgpathp = gpathp; + while (*s) + addpath(*s++); + addpath('/'); + if (stat(gpath, &stb) == 0 && isdir(stb)) + if (*p == 0) { + Gcat(gpath, ""); + globcnt++; + } else + expand(p); + gpathp = sgpathp; + *gpathp = 0; + return (0); + } + } +} + +static +Gmatch(s, p) + register char *s, *p; +{ + register int scc; + int ok, lc; + int c, cc; + + for (;;) { + scc = *s++ & TRIM; + switch (c = *p++) { + + case '[': + ok = 0; + lc = 077777; + while (cc = *p++) { + if (cc == ']') { + if (ok) + break; + return (0); + } + if (cc == '-') { + if (lc <= scc && scc <= *p++) + ok++; + } else + if (scc == (lc = cc)) + ok++; + } + if (cc == 0) + if (ok) + p--; + else + return 0; + continue; + + case '*': + if (!*p) + return (1); + for (s--; *s; s++) + if (Gmatch(s, p)) + return (1); + return (0); + + case 0: + return (scc == 0); + + default: + if ((c & TRIM) != scc) + return (0); + continue; + + case '?': + if (scc == 0) + return (0); + continue; + + } + } +} + +static +Gcat(s1, s2) + register char *s1, *s2; +{ + register int len = strlen(s1) + strlen(s2) + 1; + + if (len >= gnleft || gargc >= GAVSIZ - 1) + globerr = "Arguments too long"; + else { + gargc++; + gnleft -= len; + gargv[gargc] = 0; + gargv[gargc - 1] = strspl(s1, s2); + } +} + +static +addpath(c) + char c; +{ + + if (gpathp >= lastgpathp) + globerr = "Pathname too long"; + else { + *gpathp++ = c; + *gpathp = 0; + } +} + +static +rscan(t, f) + register char **t; + int (*f)(); +{ + register char *p, c; + + while (p = *t++) { + if (f == tglob) + if (*p == '~') + gflag |= 2; + else if (eq(p, "{") || eq(p, "{}")) + continue; + while (c = *p++) + (*f)(c); + } +} +/* +static +scan(t, f) + register char **t; + int (*f)(); +{ + register char *p, c; + + while (p = *t++) + while (c = *p) + *p++ = (*f)(c); +} */ + +static +tglob(c) + register char c; +{ + + if (any(c, globchars)) + gflag |= c == '{' ? 2 : 1; + return (c); +} +/* +static +trim(c) + char c; +{ + + return (c & TRIM); +} */ + + +letter(c) + register char c; +{ + + return (c >= 'a' && c <= 'z' || c >= 'A' && c <= 'Z' || c == '_'); +} + +digit(c) + register char c; +{ + + return (c >= '0' && c <= '9'); +} + +any(c, s) + register int c; + register char *s; +{ + + while (*s) + if (*s++ == c) + return(1); + return(0); +} +blklen(av) + register char **av; +{ + register int i = 0; + + while (*av++) + i++; + return (i); +} + +char ** +blkcpy(oav, bv) + char **oav; + register char **bv; +{ + register char **av = oav; + + while (*av++ = *bv++) + continue; + return (oav); +} + +blkfree(av0) + char **av0; +{ + register char **av = av0; + + while (*av) + free(*av++); +} + +static +char * +strspl(cp, dp) + register char *cp, *dp; +{ + register char *ep = malloc((unsigned)(strlen(cp) + strlen(dp) + 1)); + + if (ep == (char *)0) + fatal("Out of memory"); + (void) strcpy(ep, cp); + (void) strcat(ep, dp); + return (ep); +} + +char ** +copyblk(v) + register char **v; +{ + register char **nv = (char **)malloc((unsigned)((blklen(v) + 1) * + sizeof(char **))); + if (nv == (char **)0) + fatal("Out of memory"); + + return (blkcpy(nv, v)); +} + +static +char * +strend(cp) + register char *cp; +{ + + while (*cp) + cp++; + return (cp); +} +/* + * Extract a home directory from the password file + * The argument points to a buffer where the name of the + * user whose home directory is sought is currently. + * We write the home directory of the user back there. + */ +gethdir(home) + char *home; +{ + register struct passwd *pp = getpwnam(home); + + if (!pp || home + strlen(pp->pw_dir) >= lastgpathp) + return (1); + (void) strcpy(home, pp->pw_dir); + return (0); +} diff --git a/archie/anonftp/retrieve/lang_retrieve.c b/archie/anonftp/retrieve/lang_retrieve.c new file mode 100644 index 0000000..e6a09ae --- /dev/null +++ b/archie/anonftp/retrieve/lang_retrieve.c @@ -0,0 +1,90 @@ +char* RETRIEVE_ANONFTP_001 = "Unknown option %c"; +char* RETRIEVE_ANONFTP_002 = "Can't open default log file"; +char* RETRIEVE_ANONFTP_003 = "Can't open log file %s"; +char* RETRIEVE_ANONFTP_004 = "No input (header) file given"; +char* RETRIEVE_ANONFTP_005 = "No output file template specified"; +char* RETRIEVE_ANONFTP_006 = "Error while trying to set master database directory"; +char* RETRIEVE_ANONFTP_007 = "Can't open input file %s"; +char* RETRIEVE_ANONFTP_008 = "Can't read header of input file %s"; +char* RETRIEVE_ANONFTP_009 = "Can't close input file %s" ; +char* RETRIEVE_ANONFTP_010 = "Can't malloc() for retrieve defaults"; +char* RETRIEVE_ANONFTP_011 = "Error reading configuration file %s"; +char* RETRIEVE_ANONFTP_012 = "Error in retrieve from file %s"; +char* RETRIEVE_ANONFTP_013 = "Can't unlink input file %s"; + +char* DO_RETRIEVE_001 = "Unable to parse access command in header"; +char* DO_RETRIEVE_002 = "get_archie_hostname() failed. Can't get local host name!"; +char* DO_RETRIEVE_003 = "Can't get hostname DNS record for %s"; +char* DO_RETRIEVE_004 = "Can't get host address for %s"; +char* DO_RETRIEVE_005 = "No default entry for %s in configuration file from %s"; +char* DO_RETRIEVE_006 = "Neither access command nor default action provided for %s"; +char* DO_RETRIEVE_007 = "Can't find service 'ftp/tcp' in list of services"; +char* DO_RETRIEVE_008 = "Error %d while trying to connect to %s"; +char* DO_RETRIEVE_009 = "Can't login as %s"; +char* DO_RETRIEVE_010 = "Unable to connect: %s"; +char* DO_RETRIEVE_011 = "Can't get home directory name for site"; +char* DO_RETRIEVE_012 = "Unexpected return code"; +char* DO_RETRIEVE_013 = "Lost connection"; +char* DO_RETRIEVE_014 = "Can't change directory to %s"; +char* DO_RETRIEVE_015 = "Unable to get local port for data transfer"; +char* DO_RETRIEVE_016 = "Command not implemented"; +char* DO_RETRIEVE_017 = "Error in making data connection"; +char* DO_RETRIEVE_018 = "Binary access method '%s' is not supported"; +char* DO_RETRIEVE_019 = "Can't get file %s. Currently unavailable"; +char* DO_RETRIEVE_020 = "Can't get file %s. File does not exist"; +char* DO_RETRIEVE_021 = "Unable to perform transfer"; +char* DO_RETRIEVE_022 = "Can't rename temporary file %s to %s"; +char* DO_RETRIEVE_023 = "Can't get file pointer for data connection"; +char* DO_RETRIEVE_024 = "Can't realloc() space for file list"; +char* DO_RETRIEVE_025 = "Can't malloc() space for file list"; +char* DO_RETRIEVE_026 = "Can't determine action (no access_commands)"; + +char* READ_RETDEFS_001 = "Can't open configuration file %s"; +char* READ_RETDEFS_002 = "Error while parsing line %u in configuration file %s"; +char* READ_RETDEFS_003 = "Invalid empty access methods field in configuration file line %d"; +char* READ_RETDEFS_004 = "Invalid empty binary access field %d"; +char* READ_RETDEFS_005 = "Invalid empty default compress extension field line %d"; +char* READ_RETDEFS_006 = "Invalid OS field: %s"; +char* READ_RETDEFS_007 = "Invalid empty OS field in configuration file line %d"; + +char* GET_INPUT_001 = "Can't open output file %s"; +char* GET_INPUT_002 = "Can't accept() data connection from %s"; +char* GET_INPUT_003 = "Can't shutdown() accepting socket"; +char* GET_INPUT_004 = "Can't write header for incoming data to output file %s"; +char* GET_INPUT_005 = "Can't spawn process %s"; +char* GET_INPUT_006 = "Can't fork() for %s"; +char* GET_INPUT_007 = "Error while in wait() for %s"; +char* GET_INPUT_008 = "%s exited abnormally with status %u"; +char* GET_INPUT_009 = "%s terminated abnormally with signal %u"; +char* GET_INPUT_010 = "Can't shutdown() data socket"; +char* GET_INPUT_011 = "Insufficient data to compress(1). Empty listings"; +char* GET_INPUT_012 = "Timeout of %d minutes on site %s retrieve"; +char* GET_INPUT_013 = "Can't fstat socket"; +char* GET_INPUT_014 = "Error while in select() for %s"; +char* GET_INPUT_015 = "Error while in select() for data transfer"; + + +/* ftp.c */ + +char* FTP_CONNECT_001 = "Trying to connect to %s on port %u"; +char* FTP_CONNECT_002 = "Connected to %s"; +char* FTP_CONNECT_003 = "Can't open file I/O for incoming connection"; +char* FTP_CONNECT_004 = "Can't open file I/O for outgoing connection"; +char* FTP_CONNECT_005 = "Can't set socket options"; + +char* FTP_LOGIN_001 = "ACCT command '%s' not accepted"; +char* FTP_LOGIN_002 = "FTP password '%s' not accepted"; +char* FTP_LOGIN_003 = "Login not accepted. Service not currently available"; +char* FTP_LOGIN_004 = "Login not accepted. FTP code %u"; + +char* GET_REPLY_001 = "Error in select() while waiting for reply from remote server"; +char* GET_REPLY_002 = "Timed out while waiting for reply from remote ftp server"; + +char* CHECK_FOR_LSLRZ_001 = "WARNING: This listing file '%s%s' may be a soft link"; +char* CHECK_FOR_LSLRZ_002 = "WARNING: file '%s%s' has date of %s, last retrieve done %s. Not taken"; + +char* SIG_HANDLE_001 = "Retrieve program terminated with signal %d"; + + +char* DO_ERROR_HEADER_001 = "Invalid NULL pointer passed to routine"; +char* DO_ERROR_HEADER_002 = "Can't rename temporary file %s to %s"; diff --git a/archie/anonftp/retrieve/lang_retrieve.h b/archie/anonftp/retrieve/lang_retrieve.h new file mode 100644 index 0000000..670298e --- /dev/null +++ b/archie/anonftp/retrieve/lang_retrieve.h @@ -0,0 +1,90 @@ +extern char* RETRIEVE_ANONFTP_001 ; +extern char* RETRIEVE_ANONFTP_002 ; +extern char* RETRIEVE_ANONFTP_003 ; +extern char* RETRIEVE_ANONFTP_004 ; +extern char* RETRIEVE_ANONFTP_005 ; +extern char* RETRIEVE_ANONFTP_006 ; +extern char* RETRIEVE_ANONFTP_007 ; +extern char* RETRIEVE_ANONFTP_008 ; +extern char* RETRIEVE_ANONFTP_009 ; +extern char* RETRIEVE_ANONFTP_010 ; +extern char* RETRIEVE_ANONFTP_011 ; +extern char* RETRIEVE_ANONFTP_012 ; +extern char* RETRIEVE_ANONFTP_013 ; + +extern char* DO_RETRIEVE_001 ; +extern char* DO_RETRIEVE_002 ; +extern char* DO_RETRIEVE_003 ; +extern char* DO_RETRIEVE_004 ; +extern char* DO_RETRIEVE_005 ; +extern char* DO_RETRIEVE_006 ; +extern char* DO_RETRIEVE_007 ; +extern char* DO_RETRIEVE_008 ; +extern char* DO_RETRIEVE_009 ; +extern char* DO_RETRIEVE_010 ; +extern char* DO_RETRIEVE_011 ; +extern char* DO_RETRIEVE_012 ; +extern char* DO_RETRIEVE_013 ; +extern char* DO_RETRIEVE_014 ; +extern char* DO_RETRIEVE_015 ; +extern char* DO_RETRIEVE_016 ; +extern char* DO_RETRIEVE_017 ; +extern char* DO_RETRIEVE_018 ; +extern char* DO_RETRIEVE_019 ; +extern char* DO_RETRIEVE_020 ; +extern char* DO_RETRIEVE_021 ; +extern char* DO_RETRIEVE_022 ; +extern char* DO_RETRIEVE_023 ; +extern char* DO_RETRIEVE_024 ; +extern char* DO_RETRIEVE_025 ; +extern char* DO_RETRIEVE_026 ; + +extern char* READ_RETDEFS_001 ; +extern char* READ_RETDEFS_002 ; +extern char* READ_RETDEFS_003 ; +extern char* READ_RETDEFS_004 ; +extern char* READ_RETDEFS_005 ; +extern char* READ_RETDEFS_006 ; +extern char* READ_RETDEFS_007 ; + +extern char* GET_INPUT_001 ; +extern char* GET_INPUT_002 ; +extern char* GET_INPUT_003 ; +extern char* GET_INPUT_004 ; +extern char* GET_INPUT_005 ; +extern char* GET_INPUT_006 ; +extern char* GET_INPUT_007 ; +extern char* GET_INPUT_008 ; +extern char* GET_INPUT_009 ; +extern char* GET_INPUT_010 ; +extern char* GET_INPUT_011 ; +extern char* GET_INPUT_012 ; +extern char* GET_INPUT_013 ; +extern char* GET_INPUT_014 ; +extern char* GET_INPUT_015 ; + +/* ftp.c */ + +extern char* FTP_CONNECT_001 ; +extern char* FTP_CONNECT_002 ; +extern char* FTP_CONNECT_003 ; +extern char* FTP_CONNECT_004 ; +extern char* FTP_CONNECT_005 ; + +extern char* FTP_LOGIN_001 ; +extern char* FTP_LOGIN_002 ; +extern char* FTP_LOGIN_003 ; +extern char* FTP_LOGIN_004 ; + +extern char* GET_REPLY_001 ; +extern char* GET_REPLY_002 ; + + +extern char* CHECK_FOR_LSLRZ_001 ; +extern char* CHECK_FOR_LSLRZ_002 ; + +extern char* SIG_HANDLE_001 ; + +extern char* DO_ERROR_HEADER_001 ; +extern char* DO_ERROR_HEADER_002 ; + diff --git a/archie/anonftp/update/.gitignore b/archie/anonftp/update/.gitignore new file mode 100644 index 0000000..f3c7a7c --- /dev/null +++ b/archie/anonftp/update/.gitignore @@ -0,0 +1 @@ +Makefile diff --git a/archie/anonftp/update/AIX-2/.gitignore b/archie/anonftp/update/AIX-2/.gitignore new file mode 100644 index 0000000..f3c7a7c --- /dev/null +++ b/archie/anonftp/update/AIX-2/.gitignore @@ -0,0 +1 @@ +Makefile diff --git a/archie/anonftp/update/AIX-2/Makefile.in b/archie/anonftp/update/AIX-2/Makefile.in new file mode 100755 index 0000000..73d93e8 --- /dev/null +++ b/archie/anonftp/update/AIX-2/Makefile.in @@ -0,0 +1,9 @@ +SYS_DEFS = -DAIX +SENT_FLAGS = -ffixed-%g2 -ffixed-%g3 -ffixed-%g4 +SYS_LIBS = -L${BERKDB_ROOT}/${SYSTYPE} -ldb + +include ../Makefile.pre + +include ../Makefile.post + +# DO NOT DELETE THIS LINE -- make depend depends on it diff --git a/archie/anonftp/update/Makefile.post b/archie/anonftp/update/Makefile.post new file mode 100755 index 0000000..c2db17f --- /dev/null +++ b/archie/anonftp/update/Makefile.post @@ -0,0 +1,95 @@ +# +# module. +# + +all: $(EXES) + + +include $(ARCHIE_ROOT)/Makefile.post + + +check_anonftp: \ + $(ANONFTP_MODULE)/lib/$(SYSTYPE)/libanonftp.a \ + $(LIBARCHIE_MODULE)/$(SYSTYPE)/libarchie.a \ + $(STRIDX_MODULE)/$(SYSTYPE)/libarchstridx.a \ + $(HOSTDB_MODULE)/$(SYSTYPE)/libhostdb.a \ + $(PATRIE_MODULE)/$(SYSTYPE)/libpatrie.a \ + $(STARTDB_MODULE)/$(SYSTYPE)/libstartdb.a \ + $(WEBINDEX_MODULE)/lib/$(SYSTYPE)/libwebindex.a \ + check_anonftp.o lang_anonftp.o + ${CC} ${CFLAGS} -o check_anonftp check_anonftp.o lang_anonftp.o $(MOD_LIBS) $(SYS_LIBS) + +delete_anonftp: \ + $(ANONFTP_MODULE)/lib/$(SYSTYPE)/libanonftp.a \ + $(LIBARCHIE_MODULE)/$(SYSTYPE)/libarchie.a \ + $(STRIDX_MODULE)/$(SYSTYPE)/libarchstridx.a \ + $(HOSTDB_MODULE)/$(SYSTYPE)/libhostdb.a \ + $(PATRIE_MODULE)/$(SYSTYPE)/libpatrie.a \ + $(STARTDB_MODULE)/$(SYSTYPE)/libstartdb.a \ + $(WEBINDEX_MODULE)/lib/$(SYSTYPE)/libwebindex.a \ + delete_anonftp.o lang_anonftp.o setup_delete.o + ${CC} ${CFLAGS} -o delete_anonftp delete_anonftp.o lang_anonftp.o setup_delete.o \ + $(MOD_LIBS) $(SYS_LIBS) + +insert_anonftp: \ + $(ANONFTP_MODULE)/lib/$(SYSTYPE)/libanonftp.a \ + $(LIBARCHIE_MODULE)/$(SYSTYPE)/libarchie.a \ + $(STRIDX_MODULE)/$(SYSTYPE)/libarchstridx.a \ + $(HOSTDB_MODULE)/$(SYSTYPE)/libhostdb.a \ + $(PATRIE_MODULE)/$(SYSTYPE)/libpatrie.a \ + $(STARTDB_MODULE)/$(SYSTYPE)/libstartdb.a \ + $(WEBINDEX_MODULE)/lib/$(SYSTYPE)/libwebindex.a \ + insert_anonftp.o setup_insert.o lang_anonftp.o + ${CC} ${CFLAGS} -o insert_anonftp insert_anonftp.o setup_insert.o lang_anonftp.o \ + $(MOD_LIBS) $(SYS_LIBS) + +insert_anonftp.ma: \ + $(ANONFTP_MODULE)/lib/$(SYSTYPE)/libanonftp.a \ + $(LIBARCHIE_MODULE)/$(SYSTYPE)/libarchie.a \ + $(STRIDX_MODULE)/$(SYSTYPE)/libarchstridx.a \ + $(HOSTDB_MODULE)/$(SYSTYPE)/libhostdb.a \ + $(PATRIE_MODULE)/$(SYSTYPE)/libpatrie.a \ + $(STARTDB_MODULE)/$(SYSTYPE)/libstartdb.a \ + $(WEBINDEX_MODULE)/lib/$(SYSTYPE)/libwebindex.a \ + insert_anonftp.o setup_insert.o lang_anonftp.o + ${SENTINEL} ${CC} ${SENT_FLAGS} ${CFLAGS} -o insert_anonftp \ + insert_anonftp.o setup_insert.o lang_anonftp.o $(MOD_LIBS) $(SYS_LIBS) + +interact_anonftp: \ + $(ANONFTP_MODULE)/lib/$(SYSTYPE)/libanonftp.a \ + $(LIBARCHIE_MODULE)/$(SYSTYPE)/libarchie.a \ + $(STRIDX_MODULE)/$(SYSTYPE)/libarchstridx.a \ + $(HOSTDB_MODULE)/$(SYSTYPE)/libhostdb.a \ + $(PATRIE_MODULE)/$(SYSTYPE)/libpatrie.a \ + $(STARTDB_MODULE)/$(SYSTYPE)/libstartdb.a \ + $(WEBINDEX_MODULE)/lib/$(SYSTYPE)/libwebindex.a \ + interact_anonftp.o lang_anonftp.o + ${CC} ${CFLAGS} -o interact_anonftp interact_anonftp.o $(MOD_LIBS) $(SYS_LIBS) + +net_anonftp: \ + $(ANONFTP_MODULE)/lib/$(SYSTYPE)/libanonftp.a \ + $(LIBARCHIE_MODULE)/$(SYSTYPE)/libarchie.a \ + $(STRIDX_MODULE)/$(SYSTYPE)/libarchstridx.a \ + $(HOSTDB_MODULE)/$(SYSTYPE)/libhostdb.a \ + $(PATRIE_MODULE)/$(SYSTYPE)/libpatrie.a \ + $(STARTDB_MODULE)/$(SYSTYPE)/libstartdb.a \ + $(WEBINDEX_MODULE)/lib/$(SYSTYPE)/libwebindex.a \ + net_anonftp.o lang_anonftp.o + ${CC} ${CFLAGS} -o net_anonftp net_anonftp.o lang_anonftp.o $(MOD_LIBS) $(SYS_LIBS) + +update_anonftp: \ + $(ANONFTP_MODULE)/lib/$(SYSTYPE)/libanonftp.a \ + $(LIBARCHIE_MODULE)/$(SYSTYPE)/libarchie.a \ + $(STRIDX_MODULE)/$(SYSTYPE)/libarchstridx.a \ + $(HOSTDB_MODULE)/$(SYSTYPE)/libhostdb.a \ + $(PATRIE_MODULE)/$(SYSTYPE)/libpatrie.a \ + $(STARTDB_MODULE)/$(SYSTYPE)/libstartdb.a \ + $(WEBINDEX_MODULE)/lib/$(SYSTYPE)/libwebindex.a \ + update_anonftp.o lang_anonftp.o + ${CC} ${CFLAGS} -o update_anonftp update_anonftp.o lang_anonftp.o $(MOD_LIBS) $(SYS_LIBS) + +clean: + rm -f *.o $(EXES) core + + + diff --git a/archie/anonftp/update/Makefile.pre b/archie/anonftp/update/Makefile.pre new file mode 100755 index 0000000..64d1032 --- /dev/null +++ b/archie/anonftp/update/Makefile.pre @@ -0,0 +1,65 @@ +# +# anonftp/update module. +# + +MOD_CFLAGS = -ansi -pedantic -pipe +#MOD_CFLAGS = -traditional -pipe -DSLEEP +MOD_DEBUG = -g3 +MOD_OPT = -O3 +MOD_WARN = -Wall -Wshadow -Wpointer-arith -Wcast-align +MOD_INCS = \ + -I$(INCLUDE_MODULE) \ + -I$(PROSPERO_ROOT)/include \ + -I$(PATRIE_MODULE) \ + -I$(STARTDB_MODULE) \ + -I$(STRIDX_MODULE) \ + -I$(WEBINDEX_MODULE)/lib \ + -I. +MOD_LIBS = \ + -L$(ANONFTP_MODULE)/lib/$(SYSTYPE) -lanonftp \ + -L$(LIBARCHIE_MODULE)/$(SYSTYPE) -larchie \ + -L$(STRIDX_MODULE)/$(SYSTYPE) -larchstridx \ + -L$(HOSTDB_MODULE)/$(SYSTYPE) -lhostdb \ + -L$(PATRIE_MODULE)/$(SYSTYPE) -lpatrie \ + -L$(STARTDB_MODULE)/$(SYSTYPE) -lstartdb \ + -L$(WEBINDEX_MODULE)/lib/$(SYSTYPE) -lwebindex \ + -ldb + + +include $(ARCHIE_ROOT)/Makefile.pre + + +INCS = \ + delete_anonftp.h \ + insert_anonftp.h \ + lang_anonftp.h \ + lcheck_anonftp.h \ + net_anonftp.h \ + update_anonftp.h + +SRCS = \ + check_anonftp.c \ + delete_anonftp.c \ + insert_anonftp.c \ + lang_anonftp.c \ + net_anonftp.c \ + setup_delete.c \ + setup_insert.c \ + update_anonftp.c + +OBJS = \ + check_anonftp.o \ + delete_anonftp.o \ + insert_anonftp.o \ + lang_anonftp.o \ + net_anonftp.o \ + setup_delete.o \ + setup_insert.o \ + update_anonftp.o \ + +EXES = \ + check_anonftp \ + delete_anonftp \ + insert_anonftp \ + net_anonftp \ + update_anonftp diff --git a/archie/anonftp/update/SunOS-4.1.4/.gitignore b/archie/anonftp/update/SunOS-4.1.4/.gitignore new file mode 100644 index 0000000..f3c7a7c --- /dev/null +++ b/archie/anonftp/update/SunOS-4.1.4/.gitignore @@ -0,0 +1 @@ +Makefile diff --git a/archie/anonftp/update/SunOS-4.1.4/Makefile.in b/archie/anonftp/update/SunOS-4.1.4/Makefile.in new file mode 100755 index 0000000..7b7672e --- /dev/null +++ b/archie/anonftp/update/SunOS-4.1.4/Makefile.in @@ -0,0 +1,11 @@ +# +# Use GNU's fixed header files. +# +SYS_DEFS = -D__USE_FIXED_PROTOTYPES__ -DSUNOS +SENT_FLAGS = -ffixed-%g2 -ffixed-%g3 -ffixed-%g4 +SYS_LIBS = -lresolv -L${BERKDB_ROOT}/${SYSTYPE} -ldb + +include ../Makefile.pre +include ../Makefile.post + +# DO NOT DELETE THIS LINE -- make depend depends on it diff --git a/archie/anonftp/update/SunOS-5.4/.gitignore b/archie/anonftp/update/SunOS-5.4/.gitignore new file mode 100644 index 0000000..f3c7a7c --- /dev/null +++ b/archie/anonftp/update/SunOS-5.4/.gitignore @@ -0,0 +1 @@ +Makefile diff --git a/archie/anonftp/update/SunOS-5.4/Makefile.in b/archie/anonftp/update/SunOS-5.4/Makefile.in new file mode 100755 index 0000000..b6f25cb --- /dev/null +++ b/archie/anonftp/update/SunOS-5.4/Makefile.in @@ -0,0 +1,11 @@ +# +# Use GNU's fixed header files. +# +SYS_DEFS = -D__USE_FIXED_PROTOTYPES__ -DSOLARIS +SENT_FLAGS = -ffixed-%g2 -ffixed-%g3 -ffixed-%g4 +SYS_LIBS = -lresolv -lnsl -lsocket -L${BERKDB_ROOT}/${SYSTYPE} -ldb + +include ../Makefile.pre +include ../Makefile.post + +# DO NOT DELETE THIS LINE -- make depend depends on it diff --git a/archie/anonftp/update/SunOS-5.6 b/archie/anonftp/update/SunOS-5.6 new file mode 120000 index 0000000..7b4e044 --- /dev/null +++ b/archie/anonftp/update/SunOS-5.6 @@ -0,0 +1 @@ +SunOS-5.4 \ No newline at end of file diff --git a/archie/anonftp/update/check_anonftp.c b/archie/anonftp/update/check_anonftp.c new file mode 100644 index 0000000..57d4b51 --- /dev/null +++ b/archie/anonftp/update/check_anonftp.c @@ -0,0 +1,526 @@ +/* + * This file is copyright Bunyip Information Systems Inc., 1993. This file + * may not be reproduced, copied or transmitted by any means mechanical or + * electronic without the express written consent of Bunyip Information + * Systems Inc. + */ + + +#include +#include +#include +#include +#include +#include "typedef.h" +#include "db_files.h" +#include "db_ops.h" +#include "host_db.h" +#include "error.h" +#include "files.h" +#include "archie_strings.h" +#include "archie_dbm.h" +#include "check_anonftp.h" +#include "lang_anonftp.h" +#include "debug.h" +#include "master.h" +#include "core_entry.h" + +#include "site_file.h" +#include "start_db.h" + +#include "patrie.h" +#include "archstridx.h" + +#include "strings_index.h" +#include "protos.h" + +int verbose = 0; + +char *prog; + +/* + * check_anonftp: perform consistency checking on anonftp database + * + * + + argv, argc are used. + + Parameters: -w + -M + -h + -p + -v verbose mode + -l write to log file + -L + +*/ + + + +int main(argc, argv) + int argc; + char *argv[]; + +{ +#if 0 +#ifdef __STDC__ + + extern int getopt(int, char **, char *); + extern status_t get_port(access_comm_t, char *, int *); + +#else + + extern int getopt(); + extern status_t get_port(); + +#endif +#endif + + extern int opterr; + extern char *optarg; + + char **cmdline_ptr; + int cmdline_args; + + int option; + + /* Directory names */ + + pathname_t master_database_dir; + pathname_t files_database_dir; + pathname_t start_database_dir; + pathname_t host_database_dir; + + file_info_t *curr_finfo = create_finfo(); + + file_info_t *hostbyaddr = create_finfo(); + file_info_t *hostdb = create_finfo(); + file_info_t *hostaux_db = create_finfo(); + + /*startdb stuff*/ + file_info_t *start_db = create_finfo(); + file_info_t *domain_db = create_finfo(); + /*startdb stuff*/ + + struct arch_stridx_handle *strhan; + char *dbdir; + + /* host databases */ + + hostdb_t hostdb_rec; + hostdb_aux_t hostaux_rec; + + pathname_t logfile; + hostname_t hostname; + + int logging = 0; + + int port = 0; + int count = 0; + + char **file_list = (char **) NULL; + + prog = argv[0]; + logfile[0] = hostname[0] = '\0'; + files_database_dir[0] = start_database_dir[0] = host_database_dir[0] = master_database_dir[0] = '\0'; + opterr = 0; /* turn off getopt() error messages */ + + /* ignore argv[0] */ + + cmdline_ptr = argv + 1; + cmdline_args = argc - 1; + files_database_dir[0] = host_database_dir[0] = '\0'; + + while((option = (int) getopt(argc, argv, "H:w:h:M:L:lv")) != EOF){ + + switch(option){ + + + /* hostname to be checked */ + + case 'H': + strcpy(hostname,optarg); + cmdline_ptr += 2; + cmdline_args -= 2; + break; + + /* Log filename */ + + case 'L': + strcpy(logfile, optarg); + logging = 1; + cmdline_ptr += 2; + cmdline_args -= 2; + break; + + /* Master directory */ + + case 'M': + strcpy(master_database_dir,optarg); + cmdline_ptr += 2; + cmdline_args -= 2; + break; + + /* Host database directory name */ + + case 'h': + strcpy(host_database_dir,optarg); + cmdline_ptr += 2; + cmdline_args -= 2; + break; + + /* port of the site */ + + case 'p': + port = atoi(optarg); + cmdline_ptr += 2; + cmdline_args -= 2; + break; + + /* enable logging, default file */ + + case 'l': + logging = 1; + cmdline_ptr++; + cmdline_args--; + break; + + /* verbose mode */ + + case 'v': + verbose = 1; + cmdline_ptr++; + cmdline_args--; + break; + + /* Get files database directory name, argument "w" */ + + case 'w': + strcpy(files_database_dir,optarg); + cmdline_ptr += 2; + cmdline_args -= 2; + break; + + + default: + error(A_ERR,"check_anonftp","Usage: [-H ] [-p ] [-d ] [-w ] [-l] [-L ]"); + exit(A_OK); + break; + } + + } + + /* set up logs */ + + if(logging){ + if(logfile[0] == '\0'){ + if(open_alog((char *) NULL, A_INFO, tail(argv[0])) == ERROR){ + + /* "Can't open default log file" */ + + error(A_ERR, "check_anonftp", CHECK_ANONFTP_001); + exit(A_OK); + } + } + else{ + if(open_alog(logfile, A_INFO, tail(argv[0])) == ERROR){ + + /* "Can't open log file %s" */ + + error(A_ERR, "check_anonftp", CHECK_ANONFTP_002, logfile); + exit(A_OK); + } + } + } + + + /* Set up system directories and files */ + + + if(set_master_db_dir(master_database_dir) == (char *) NULL){ + + /* "Error while trying to set master database directory" */ + + error(A_ERR,"check_anonftp", CHECK_ANONFTP_003); + exit(A_OK); + } + + + if( (dbdir = set_files_db_dir(files_database_dir)) == (char *)NULL) { + + /* "Error while trying to set anonftp database directory" */ + + error(A_ERR, "check_anonftp", INSERT_ANONFTP_022); + exit(A_OK); + } + + if(set_start_db_dir(start_database_dir,DEFAULT_FILES_DB_DIR) == (char *) NULL){ + + /* "Error while trying to set start database directory" */ + + error(A_ERR, "check_anonftp", "Error while trying to set start database directory\n"); + exit(A_OK); + } + + if(set_host_db_dir(host_database_dir) == (char *) NULL){ + + /* "Error while trying to set host database directory" */ + + error(A_ERR,"check_anonftp", CHECK_ANONFTP_005); + exit(A_OK); + } + + /* Open other files database files */ + + if ( open_start_dbs(start_db,domain_db,O_RDONLY ) == ERROR ) { + + /* "Can't open start/host database" */ + + error(A_ERR, "inser_anonftp", "Can't open start/host database"); + exit(A_OK); + } + + if ( !(strhan = archNewStrIdx()) ) { + error( A_ERR, "check_anonftp", "Could create string handler" ); + exit(ERROR); + } + + if ( !archOpenStrIdx( strhan, dbdir, ARCH_STRIDX_SEARCH ) ) + { + error( A_WARN, "check_anonftp", "Could not find strings_idx files, abort.\n" ); + exit(A_OK); + } + + if(open_host_dbs(hostbyaddr, hostdb, (file_info_t *) NULL, hostaux_db, O_RDONLY) != A_OK){ + + /* "Error while trying to open host database" */ + + error(A_ERR,"check_anonftp", CHECK_ANONFTP_007); + exit(A_OK); + } + + if(hostname[0] != '\0'){ +/* + if(get_input_file(hostname, ANONFTP_DB_NAME, files_db_filename, curr_finfo, &hostdb_rec, &hostaux_rec, hostdb, hostaux_db, hostbyaddr) == ERROR){ +*/ + + if(get_input_file(hostname, ANONFTP_DB_NAME, (index_t)0, files_db_filename, curr_finfo, &hostdb_rec, &hostaux_rec, hostdb, hostaux_db, hostbyaddr) == ERROR){ + + /* "Can't find host %s in anonftp database" */ + + error(A_ERR, "check_anonftp", CHECK_ANONFTP_008, hostname); + exit(ERROR); + } + + if((file_list = (char **) malloc( 2 * sizeof(char *))) == (char **) NULL){ + + /* "Can't malloc space for file list" */ + + error(A_ERR, "check_anonftp", CHECK_ANONFTP_009); + exit(ERROR); + } + + file_list[0] = strdup(inet_ntoa(ipaddr_to_inet(hostdb_rec.primary_ipaddr))); + file_list[1] = (char *) NULL; + count = 1; + } + else{ + + if(get_file_list(get_files_db_dir(), &file_list, (char *) NULL, &count) == ERROR){ + + /* "Can't get list of files in directory %s" */ + + error(A_ERR, "check_anonftp", CHECK_ANONFTP_010, get_files_db_dir()); + exit(ERROR); + } + } + + if(port==0){ + /* "No port number given" */ + + error(A_WARN,"check_anonftp","No port number given assuming default port"); + if( get_port((char *)NULL, ANONFTP_DB_NAME, &port ) == ERROR ){ + error(A_ERR,"get_port","Could not get port for site"); + exit(A_OK); + } + } + + check_indiv(file_list, strhan, hostbyaddr, hostaux_db, port); + close_start_dbs(start_db,domain_db); + + exit(A_OK); + return(A_OK); + +} + +status_t check_indiv(file_list, strhan, hostbyaddr, hostaux_db, port) + char **file_list; + struct arch_stridx_handle *strhan; + file_info_t *hostbyaddr; + file_info_t *hostaux_db; + int port; +{ + /* File information */ + + char **curr_file; + char *result; + + ip_addr_t ipaddr = 0; + hostbyaddr_t hba_ent; + int act_size = 0; + + int tmp_val; + + hostdb_aux_t hostaux_ent; + + index_t curr_strings; + index_t curr_count; + + full_site_entry_t *curr_ent; + full_site_entry_t *curr_endptr; + + full_site_entry_t *tmp_ent; + + chklist_t *chklist; + + file_info_t *curr_finfo = create_finfo(); + + ptr_check(file_list, char*, "check_indiv", ERROR); + ptr_check(hostbyaddr, file_info_t, "check_indiv", ERROR); + + /* go through each file in file_list */ + + for(curr_file = file_list; *curr_file != (char *) NULL; curr_file++){ + + if(sscanf(*curr_file, "%*d.%*d.%*d.%d", &tmp_val) != 1) + continue; + + ipaddr = inet_addr(*curr_file); + + if(get_dbm_entry(&ipaddr, sizeof(ip_addr_t), &hba_ent, hostbyaddr) == ERROR){ + + /* "Can't get host address cache entry for %s" */ + + error(A_INTERR, "check_indiv", CHECK_INDIV_001); + continue; + } + + if(get_hostaux_entry(hba_ent.primary_hostname, ANONFTP_DB_NAME, (index_t)0, &hostaux_ent, hostaux_db) == ERROR){ + +/* if(get_hostaux_ent(hba_ent.primary_hostname, ANONFTP_DB_NAME, &hostaux_ent, hostaux_db) == ERROR){ +*/ + /* "Ignoring %s" */ + + error(A_ERR, "check_indiv", CHECK_INDIV_003, *curr_file); + continue; + } + + + if(verbose){ + + /* "Checking site %s (%s)" */ + + error(A_INFO,"check_indiv", CHECK_INDIV_002, hba_ent.primary_hostname, *curr_file); + } + + strcpy(curr_finfo -> filename, files_db_filename(*curr_file,port)); + + /* Open current file */ + + if(open_file(curr_finfo, O_RDONLY) == ERROR){ + + /* "Ignoring %s" */ + + error(A_ERR, "check_indiv", CHECK_INDIV_003, *curr_file); + continue; + } + + /* mmap it */ + + if(mmap_file(curr_finfo, O_RDONLY) == ERROR){ + + /* "Ignoring %s" */ + + error(A_ERR, "check_indiv", CHECK_INDIV_003, *curr_file); + continue; + } + + act_size = curr_finfo -> size / sizeof(full_site_entry_t); + + if(hostaux_ent.site_no_recs != act_size){ + + /* "Number of records in site file %s (%s) %d does not match auxiliary host database record %d" */ + + error(A_WARN, "check_indiv", CHECK_INDIV_004, hba_ent.primary_hostname, *curr_file, hostaux_ent.no_recs, act_size); + + } + + if((chklist = (chklist_t *) malloc(act_size * sizeof(chklist_t))) == (chklist_t *) NULL){ + + /* "Can't malloc space for checklist" */ + + error(A_SYSERR, "check_indiv", CHECK_INDIV_005); + return(ERROR); + } + + memset((char *)chklist, '\0', act_size * sizeof(chklist_t)); + + /* Go through each entry in current site file */ + + for(curr_ent = (full_site_entry_t *) curr_finfo -> ptr, curr_endptr = curr_ent + act_size, curr_count = 0; + curr_ent < curr_endptr; + curr_ent++){ + + curr_strings = curr_ent -> strt_1; + + /* Check if string offset is valid */ + + if(curr_strings < (index_t)(0)){ + /* "Site %s (%s) record %d has string index %d out of bounds" */ + error(A_ERR, "check_indiv", CHECK_INDIV_008, hba_ent.primary_hostname, *curr_file, curr_count, curr_strings); + }else{ + fprintf(stdout,"\nrecno: %li\n",curr_count); + fprintf(stdout,"flags: %d \n", curr_ent -> flags); + fprintf(stdout,"string_idx: %li \n", curr_strings); + + if ( CSE_IS_SUBPATH((*curr_ent)) || + CSE_IS_PORT((*curr_ent)) || + CSE_IS_NAME((*curr_ent)) ) + { + fprintf(stdout," original location: %li \n",curr_ent -> core.prnt_entry.strt_2); + fprintf(stdout," parent: %li \n",curr_strings); + + if( curr_ent -> core.prnt_entry.strt_2 >= (index_t)(0)) { + tmp_ent = ((full_site_entry_t *) curr_finfo -> ptr)+(curr_ent -> core.prnt_entry.strt_2); + if(tmp_ent->strt_1 >= (index_t)(0) ) + if( !archGetString( strhan, tmp_ent->strt_1, &result)) + { /* "Site %s (%s) record %d has string index %d out of bounds" */ + error(A_ERR, "check_indiv", CHECK_INDIV_008, hba_ent.primary_hostname, *curr_file, curr_count, curr_strings); + }else{ + fprintf(stdout," original:%s \n",(char *)(result) ); + free(result); + } + } + }else{ + fprintf(stdout,"size: %li date: %li \n", curr_ent -> core.entry.size, curr_ent -> core.entry.date); + if( (curr_strings < (index_t)(0) )|| !archGetString( strhan, curr_strings, &result)){ + /* "Site %s (%s) record %d has string index %d out of bounds" */ + error(A_ERR, "check_indiv", CHECK_INDIV_008, hba_ent.primary_hostname, *curr_file, curr_count, curr_strings); + }else + fprintf(stdout," string = %s\n",(char *)result); + } + /* Check "next" links */ + } + curr_count++; + + } + + free(chklist); + close_file(curr_finfo); + } + + archCloseStrIdx(strhan); + archFreeStrIdx(&strhan); + return(A_OK); +} + diff --git a/archie/anonftp/update/check_anonftp.h b/archie/anonftp/update/check_anonftp.h new file mode 100644 index 0000000..e79c5a0 --- /dev/null +++ b/archie/anonftp/update/check_anonftp.h @@ -0,0 +1,21 @@ +#include "archstridx.h" +#include "patrie.h" +#ifndef _CHECK_ANONFTP_H_ +#define _CHECK_ANONFTP_H_ + +typedef struct{ + char p; + char n; +} chklist_t; + +#ifdef __STDC__ + +extern status_t check_indiv(char **, struct arch_stridx_handle *, file_info_t *, file_info_t *, int); + +#else + +extern status_t check_indiv(); + +#endif + +#endif diff --git a/archie/anonftp/update/delete_anonftp.c b/archie/anonftp/update/delete_anonftp.c new file mode 100644 index 0000000..4cfa67e --- /dev/null +++ b/archie/anonftp/update/delete_anonftp.c @@ -0,0 +1,424 @@ +/* + * This file is copyright Bunyip Information Systems Inc., 1992. This file + * may not be reproduced, copied or transmitted by any means mechanical or + * electronic without the express written consent of Bunyip Information + * Systems Inc. + */ + + +#include +#include +#include +/* #include */ +#include +#include "typedef.h" +#include "db_files.h" +#include "db_ops.h" +#include "host_db.h" +#include "error.h" +#include "files.h" +#include "archie_strings.h" +#include "archie_dbm.h" +#include "delete_anonftp.h" +#include "lang_anonftp.h" +#include "debug.h" +#include "master.h" + +#include "../startdb/start_db.h" +#include "../startdb/lang_startdb.h" + +extern int errno; +int verbose = 0; + +char *prog; + +#ifdef __STDC__ + extern status_t setup_delete( file_info_t *, file_info_t *, + int, ip_addr_t, int ); +#else + extern status_t setup_delete(); + extern status_t get_port(); +#endif + +/* + * delete_anonftp: remove a site from the archie anonftp database. It + * modifies the primary host database as well as the auxiliary database. It + * performs no file locking, for exculsive file access + + NOTE: Return codes in this program are non-standard. Only database errors + cause an exit code of ERROR, other errors exit with A_OK + + argv, argc are used. + + + Parameters: -H Mandatory. + -p + -w + -M + -h + -v verbose + -l write to log file + -L + +*/ + + +int main(argc, argv) + int argc; + char *argv[]; + +{ + extern int opterr; + extern char *optarg; + + char **cmdline_ptr; + int cmdline_args; + + int option; + + char *dbdir; + pathname_t tmp_string; + + /* Directory names */ + + pathname_t master_database_dir; + pathname_t start_database_dir; + pathname_t files_database_dir; + pathname_t host_database_dir; + + /* File information */ + + file_info_t *input_finfo = create_finfo(); + file_info_t *hostbyaddr = create_finfo(); + file_info_t *hostdb = create_finfo(); + file_info_t *hostaux_db = create_finfo(); + + file_info_t *start_db = create_finfo(); + file_info_t *domain_db = create_finfo(); + + /* host databases */ + + header_t header_rec; /* Input header record */ + + hostdb_t hostdb_rec; + hostdb_aux_t hostaux_rec; + + hostname_t hostname; + pathname_t logfile; + + int logging = 0; + + int port = 0; + int nofile = 0; + + prog = argv[0]; + + input_finfo -> filename[0] = logfile[0] = '\0'; + + opterr = 0; /* turn off getopt() error messages */ + + /* ignore argv[0] */ + + cmdline_ptr = argv + 1; + cmdline_args = argc - 1; + + master_database_dir[0] = start_database_dir[0] = files_database_dir[0] = host_database_dir[0] = '\0'; + + hostname[0] = logfile[0] = '\0'; + + while((option = (int) getopt(argc, argv, "w:h:H:p:t:M:L:lv")) != EOF){ + + switch(option){ + + + /* hostname to be deleted */ + + case 'H': + strcpy(hostname,optarg); + cmdline_ptr += 2; + cmdline_args -= 2; + break; + + /* Log filename */ + + case 'L': + strcpy(logfile, optarg); + logging = 1; + cmdline_ptr += 2; + cmdline_args -= 2; + break; + + /* Master directory */ + + case 'M': + strcpy(master_database_dir,optarg); + cmdline_ptr += 2; + cmdline_args -= 2; + break; + + /* Host database directory name */ + + case 'h': + strcpy(host_database_dir,optarg); + cmdline_ptr += 2; + cmdline_args -= 2; + break; + + /* port of the site */ + + case 'p': + port = atoi(optarg); + cmdline_ptr += 2; + cmdline_args -= 2; + break; + + /* enable logging, default file */ + + case 'l': + logging = 1; + cmdline_ptr++; + cmdline_args--; + break; + + + /* debugging level */ + + case 'v': + verbose = 1; + cmdline_ptr++; + cmdline_args--; + break; + + /* Get files database directory name, argument "w" */ + + case 'w': + strcpy(files_database_dir,optarg); + cmdline_ptr += 2; + cmdline_args -= 2; + break; + + case 't': + cmdline_ptr += 2; + cmdline_args -= 2; + break; + + default: + error(A_ERR,"delete_anonftp","Usage: -H [-p ] [-L ] [-M ] [-l] [-v ] [-w ]"); + { int kk; + for ( kk = 0 ; kk < argc; kk++ ) { + fprintf(stderr,"%s\n",argv[kk]); + } + } + exit(A_OK); + break; + } + + } + +#ifdef SLEEP + fprintf(stderr,"Sleeping...\n"); + sleep(20); +#endif + + /* set up logs */ + + if(logging){ + if(logfile[0] == '\0'){ + if(open_alog((char *) NULL, A_INFO, tail(argv[0])) == ERROR){ + + /* "Can't open default log file" */ + + error(A_ERR, "delete_anonftp", DELETE_ANONFTP_013); + exit(A_OK); + } + } + else{ + if(open_alog(logfile, A_INFO, tail(argv[0])) == ERROR){ + + /* "Can't open log file %s" */ + + error(A_ERR, "delete_anonftp", DELETE_ANONFTP_014, logfile); + exit(A_OK); + } + } + } + + /* Check to see if the hostname was given. It is mandatory */ + + if(hostname[0] == '\0'){ + + /* "No site name or address given" */ + + error(A_ERR,"delete_anonftp", DELETE_ANONFTP_001); + exit(A_OK); + } + + if(port==0){ + + /* "No port number given" */ + + error(A_INFO,"delete_anonftp","No port number given, assuming default one"); + if( get_port((char *)NULL, ANONFTP_DB_NAME, &port ) == ERROR ){ + error(A_ERR,"get_port","Could not get port for site"); + exit(A_OK); + } + } + + /* Set up system directories and files */ + + if(set_master_db_dir(master_database_dir) == (char *) NULL){ + + /* "Error while trying to set master database directory" */ + + error(A_ERR,"delete_anonftp", DELETE_ANONFTP_002); + exit(A_OK); + } + + if((dbdir = set_files_db_dir(files_database_dir)) == (char *) NULL){ + + /* "Error while trying to set anonftp database directory" */ + + error(A_ERR,"delete_anonftp", DELETE_ANONFTP_003); + exit(A_OK); + } + + + if((set_start_db_dir(start_database_dir,DEFAULT_FILES_DB_DIR)) == (char *) NULL){ + + /* "Error while trying to set start database directory" */ + + error(A_ERR, "insert_anonftp", "Error while trying to set start database directory\n"); + exit(A_OK); + } + + if(set_host_db_dir(host_database_dir) == (char *) NULL){ + + /* "Error while trying to set host database directory" */ + + error(A_ERR,"delete_anonftp", DELETE_ANONFTP_004); + exit(A_OK); + } + + /* Open other files database files */ + + if ( open_start_dbs(start_db,domain_db,O_RDWR ) == ERROR ) { + + /* "Can't open start/host database" */ + + error(A_ERR, "delete_anonftp", "Can't open start/host database"); + exit(A_OK); + } + + if(open_host_dbs(hostbyaddr, hostdb, (file_info_t *) NULL, hostaux_db, O_RDWR) != A_OK){ + + /* "Error while trying to open host database" */ + + error(A_ERR,"delete_anonftp", DELETE_ANONFTP_006); + exit(A_OK); + } + + + /* get input file information */ + if(get_input_file(hostname, ANONFTP_DB_NAME, (index_t)0, files_db_filename, input_finfo, &hostdb_rec, &hostaux_rec, hostdb, hostaux_db, hostbyaddr) == ERROR){ +/* + if(get_input_file(hostname, ANONFTP_DB_NAME, files_db_filename, input_finfo, &hostdb_rec, &hostaux_rec, hostdb, hostaux_db, hostbyaddr) == ERROR){ +*/ + /* "Can't determine input file for site %s" */ + + error(A_ERR,"delete_anonftp", DELETE_ANONFTP_007, hostname); + exit(A_OK); + } + else{ + /* Open it */ + + if(open_file(input_finfo, O_RDWR) == ERROR){ + + /* "Can't find input database file for %s" */ + + error(A_WARN,"delete_anonftp", DELETE_ANONFTP_008, hostname); + nofile = 1; + } + + } + + /* if(mmap_file(input_finfo, O_RDONLY) == ERROR){ + + "Can't mmap() input file %s" + + error(A_SYSERR,"insert_anonftp", INSERT_ANONFTP_003, input_finfo -> filename); + exit(A_OK); + } + */ + + if(delete_from_hostdb(hostdb_rec.primary_hostname, ANONFTP_DB_NAME, (index_t)0, hostaux_db) == ERROR){ + + /* "Error while trying to inactivate %s in host database" */ + + error(A_ERR,"delete_anonftp", DELETE_ANONFTP_009, hostdb_rec.primary_hostname); + exit(A_OK); + } + + if(nofile) + exit(A_OK); + + sprintf(tmp_string,"%s.%s.0",hostdb_rec.primary_hostname, ANONFTP_DB_NAME); + + if(get_dbm_entry(tmp_string, strlen(tmp_string) + 1, &hostaux_rec, hostaux_db) == ERROR){ + + /* "Can't find requested host %s database %s in local auxiliary host database" */ + + error(A_ERR,"net_anonftp", NET_ANONFTP_010, hostdb_rec.primary_hostname, ANONFTP_DB_NAME); + header_rec.update_status = FAIL; + } + + if(setup_delete( input_finfo, start_db, (int)hostaux_rec.site_no_recs, hostdb_rec.primary_ipaddr, port) == ERROR ){ + + error(A_ERR,"delete_anonftp","Failed in setup_delete.\n"); + if(close_file(input_finfo) == ERROR){ + + /* "Can't close input file %s" */ + + error(A_ERR, "delete_anonftp", DELETE_ANONFTP_012, input_finfo -> filename); + } + exit(A_OK); + return(A_OK); + } + + /* Close data file */ + + if(close_file(input_finfo) == ERROR){ + + /* "Can't close input file %s" */ + + error(A_ERR, "delete_anonftp", DELETE_ANONFTP_012, input_finfo -> filename); + } + + close_start_dbs(start_db,domain_db); + + /* Remove data file from database */ + + if(unlink(input_finfo -> filename) == -1){ + + /* "Can't remove the site file %s" */ + + error(A_SYSERR,"delete_anonftp", DELETE_ANONFTP_011, input_finfo -> filename); + exit(A_OK); + } + + strcat(input_finfo->filename,".idx"); + if(unlink(input_finfo -> filename) == -1){ + + if ( errno != ENOENT ) { + /* "Can't remove the site file %s" */ + + error(A_SYSERR,"delete_anonftp", DELETE_ANONFTP_011, input_finfo -> filename); + exit(A_OK); + } + } + + exit(A_OK); + + return(A_OK); + +} + diff --git a/archie/anonftp/update/delete_anonftp.h b/archie/anonftp/update/delete_anonftp.h new file mode 100644 index 0000000..b987435 --- /dev/null +++ b/archie/anonftp/update/delete_anonftp.h @@ -0,0 +1,13 @@ +#ifndef _DELETE_H_ +#define _DELETE_H_ + +#include +#include "typedef.h" +#include "host_db.h" + +#define MAX_INTERNAL_LINKNO 5000 + + +extern status_t setup_delete PROTO((file_info_t *,file_info_t *, int, ip_addr_t, int)); + +#endif diff --git a/archie/anonftp/update/insert_anonftp.c b/archie/anonftp/update/insert_anonftp.c new file mode 100644 index 0000000..e4afc9d --- /dev/null +++ b/archie/anonftp/update/insert_anonftp.c @@ -0,0 +1,1224 @@ +/* + * This file is copyright Bunyip Information Systems Inc., 1992. This file + * may not be reproduced, copied or transmitted by any means mechanical or + * electronic without the express written consent of Bunyip Information + * Systems Inc. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "typedef.h" +#include "db_files.h" +#include "header.h" +#include "db_ops.h" + +#include "site_file.h" +#include "start_db.h" +#include "lang_startdb.h" +#include "patrie.h" +#include "archstridx.h" + +#include "protos.h" +#include "defines.h" + +#include "host_db.h" +#include "insert_anonftp.h" +#include "error.h" +#include "debug.h" +#include "lang.h" +#include "lang_anonftp.h" +#include "files.h" +#include "master.h" +#include "archie_dbm.h" +#include "archie_strings.h" +#include "archie_mail.h" + + +extern status_t insert_compare_hstart_db(full_site_entry_t *fp1, int s1, + full_site_entry_t *fp2, int s2, + file_info_t *start_db, header_t header_rec, + int port); +extern status_t insert_hstart_db(full_site_entry_t *fp, file_info_t *start_db, + file_info_t *domain_db, header_t header_rec, + int port); + + + + + + +/* + This function does a rename across partitions + The operation is performed by copying the file to the other + partition. To guarantee that the operation be done properly + it is first copied to the other partition under a different + name and then renamed. + -Sandro Feb 8th 1995 +*/ + +#define COPY_FILENAME "temp_COPY_file" +#define BUFF_SIZE 8192 +#ifndef SOLARIS +#ifdef __STDC__ + + extern int rename(const char *, const char *); + extern status_t insert_hstart_db( full_site_entry_t *, + file_info_t *, file_info_t *, + header_t, int ); + extern status_t insert_compare_hstart_db( full_site_entry_t *, + int, full_site_entry_t *, + int, file_info_t *, header_t, + int ); + extern status_t count_extra_recs( char *, int, header_t * ); +#else + + extern int rename(); + status_t insert_hstart_db(); + status_t insert_compare_hstart_db( ); + status_t get_port( ); + extern status_t count_extra_recs(); + extern status_t host_table_find(); + extern status_t host_table_add(); + extern status_t update_start_dbs(); + extern status_t close_start_dbs(); + extern status_t open_start_dbs(); + extern status_t inactivate_if_found(); + extern status_t get_port(); + +#endif +#endif + +/* In order to allow an open file that will change in size to + either expand or shrink according to no_recs relative to what + currently is in the file */ + + +status_t resize_output_file(output_finfo,no_recs) + file_info_t *output_finfo; + int no_recs; +{ + +#ifdef __STDC__ + + extern int ftruncate(int, off_t); + +#else + + extern int ftruncate(); + +#endif + + /* Check pointers */ + + ptr_check(output_finfo, file_info_t, "resize_output_file", ERROR); + + /* Open the file */ + + if(open_file(output_finfo,O_RDWR) == ERROR){ + + /* "Can't open output file %s" */ + + error(A_SYSERR,"resize_output_file", SETUP_OUTPUT_FILE_004, output_finfo -> filename); + return(ERROR); + } + + /* + * We know how many records there are, so extend the new file to the + * correct length + */ + + if((int) ftruncate(fileno(output_finfo -> fp_or_dbm.fp), (no_recs) * sizeof(full_site_entry_t)) != 0){ + + /* "Can't ftruncate output file %s" */ + + error(A_SYSERR,"resize_output_file", SETUP_OUTPUT_FILE_005, output_finfo -> filename); + return(ERROR); + } + + close_file(output_finfo); + + /* + * now map it into core / + * + * if(mmap_file(output_finfo, O_RDWR ) != A_OK){ + * + * + * / "Can't mmap() output file %s" / + * + * error(A_INTERR, "resize_output_file", SETUP_OUTPUT_FILE_006, + * output_finfo -> filename); return(ERROR); + * } + */ + + return(A_OK); +} + +static void unique( list, sz ) + index_t **list; + int *sz; +{ + int i, bef, aft, rep; + for( i=0, bef=0, aft=1, rep=0; aft<*sz ; i++ ){ + if( (*list)[bef] == (*list)[aft] ){ + aft++; + rep = 1; + }else if( (*list)[bef] < (*list)[aft] && rep == 1){ + rep = 0; + bef++; + (*list)[bef] = (*list)[aft]; + }else{ + bef++; + aft++; + } + } + *sz = bef+1; +} + + +/* + * This is the main controlling routine for the insert_anonftp program. + * This program inserts information given in the input file into the archie + * anonftp database. It modifies the hostaux_db with the new information + + argv, argc are used. + + + Parameters: -i Mandatory + -w + -M + -h + -t + -l write to log file (default) + -L + + + */ + + +int verbose = 0; /* verbose */ +char *prog; + + +int main(argc, argv) + int argc; + char *argv[]; + +{ +#ifndef __STDC__ + + extern int getopt(); + extern int ftruncate(); + +#endif + + extern int opterr; /* NOT USED */ + extern char *optarg; /* option argument */ + + char **cmdline_ptr; /* command line arguments */ + int cmdline_args; /* command line arg count */ + + int option; /* Option character */ + + int first=0; + int ans=0; + + int minidxsize = MIN_INDEX_SIZE; + /* System directories */ + + pathname_t master_database_dir; + pathname_t start_database_dir; + pathname_t files_database_dir; + pathname_t host_database_dir; + pathname_t tmp_dir; + pathname_t file1, file2; + + pathname_t logfile; + + flags_t flags = 0; + + /* file handles */ + + file_info_t *input_finfo = create_finfo(); + file_info_t *hostbyaddr = create_finfo(); + file_info_t *hostdb = create_finfo(); + file_info_t *hostaux_db = create_finfo(); + file_info_t *output_finfo = create_finfo(); + file_info_t *curr_finfo = create_finfo(); + + file_info_t *start_db = create_finfo(); + file_info_t *domain_db = create_finfo(); + + int output_rec_no; + int port = 0; + int index_file = 0; + + header_t header_rec; /* Input header record */ + + host_status_t host_st; /* Checking host status in database */ + + u32 offset; /* Offset of start of data in input */ + int curr_size; + + struct arch_stridx_handle *strhan; + char *dbdir; + + int logging = FALSE; /* write to log */ + + prog = argv[0]; + input_finfo -> filename[0] = logfile[0] = '\0'; + + opterr = 0; + + /* ignore argv[0] */ + + cmdline_ptr = argv + 1; + cmdline_args = argc - 1; + + master_database_dir[0] = files_database_dir[0] = start_database_dir[0] = host_database_dir[0] = tmp_dir[0] = '\0'; + + logfile[0] = '\0'; + + /* Process command line options */ + + while((option = getopt(argc, argv, "i:w:vt:I:h:M:sL:l")) != EOF){ + + switch(option){ + + /* Master directory name */ + + case 'M': + strcpy(master_database_dir,optarg); + cmdline_ptr += 2; + cmdline_args -= 2; + break; + + /* start/host database directory */ + + case 'T': + strcpy(start_database_dir,optarg); + cmdline_ptr += 2; + cmdline_args -= 2; + break; + + /* Log filename */ + + case 'L': + strcpy(logfile, optarg); + logging = 1; + cmdline_ptr += 2; + cmdline_args -= 2; + break; + + /* host database directory name */ + + case 'h': + strcpy(host_database_dir,optarg); + cmdline_ptr += 2; + cmdline_args -= 2; + break; + + /* Input filename */ + + case 'i': + strcpy(input_finfo -> filename,optarg); + cmdline_ptr += 2; + cmdline_args -= 2; + break; + + /* write to log */ + + case 'l': + logging = 1; + cmdline_ptr++; + cmdline_args--; + break; + + /* Standalone mode... kept for backward compatibility */ + + case 's': + cmdline_ptr++; + cmdline_args--; + break; + + + /* temporary directory */ + + case 't': + strcpy(tmp_dir,optarg); + cmdline_ptr += 2; + cmdline_args -= 2; + break; + + /* Verbose */ + + case 'v': + verbose = 1; + cmdline_ptr++; + cmdline_args--; + break; + + /* Minimum Index Size */ + + case 'I': + minidxsize = atoi(optarg); + cmdline_ptr++; + cmdline_args--; + break; + + /* files database directory name */ + + case 'w': + strcpy(files_database_dir,optarg); + cmdline_ptr += 2; + cmdline_args -= 2; + break; + + default: + error(A_ERR,"insert_anonftp","Unknown option '%s'\nUsage: insert_anonftp -i -w -M -T -h -t -I -v -s -l -L ", *cmdline_ptr); + exit(A_OK); + + } + + } + +#ifdef SLEEP + fprintf(stderr,"sleeping \n"); + sleep(30); +#endif + + /* Set up log files */ + + if(logging){ + if(logfile[0] == '\0'){ + if(open_alog((char *) NULL, A_INFO, tail(argv[0])) == ERROR){ + + /* "Can't open default log file" */ + + error(A_ERR, "insert_anonftp", INSERT_ANONFTP_020); + exit(A_OK); + } + } + else{ + if(open_alog(logfile, A_INFO, tail(argv[0])) == ERROR){ + + /* "Can't open log file %s" */ + + error(A_ERR, "insert_anonftp", INSERT_ANONFTP_019, logfile); + exit(A_OK); + } + } + } + + + /* Check that input file was given */ + + if(input_finfo -> filename[0] == '\0'){ + + /* "No site name or address given" */ + + error(A_ERR,"insert_anonftp", INSERT_ANONFTP_024); + exit(A_OK); + } + + /* Open system files */ + + if(set_master_db_dir(master_database_dir) == (char *) NULL){ + + /* "Error while trying to set master database directory" */ + + error(A_ERR, "insert_anonftp", INSERT_ANONFTP_022); + exit(A_OK); + } + + if((dbdir = set_files_db_dir(files_database_dir)) == (char *) NULL){ + + /* "Error while trying to set anonftp database directory" */ + + error(A_ERR, "insert_anonftp", INSERT_ANONFTP_022); + exit(A_OK); + } + + if((set_start_db_dir(start_database_dir,DEFAULT_FILES_DB_DIR)) == (char *) NULL){ + + /* "Error while trying to set start database directory" */ + + error(A_ERR, "insert_anonftp", "Error while trying to set start database directory"); + exit(A_OK); + } + + if(set_host_db_dir(host_database_dir) == (char *) NULL){ + + /* "Error while trying to set host database directory" */ + + error(A_ERR, "insert_anonftp", INSERT_ANONFTP_023); + exit(A_OK); + } + + + if(tmp_dir[0] == '\0') + sprintf(tmp_dir,"%s/%s", get_master_db_dir(), DEFAULT_TMP_DIR); + + + /* Open the input file and read its header */ + + if(open_file(input_finfo, O_RDONLY) == ERROR){ + + /* "Can't open input file %s" */ + + error(A_SYSERR,"insert_anonftp", INSERT_ANONFTP_001, input_finfo -> filename); + exit(A_OK); + } + + if(read_header(input_finfo -> fp_or_dbm.fp, &header_rec, &offset, 0, 0) == ERROR){ + + /* "Can't read header record of %s" */ + + error(A_ERR,"insert_anonftp", INSERT_ANONFTP_002, input_finfo -> filename); + exit(A_OK); + } + + input_finfo -> offset = offset; + + if(mmap_file(input_finfo, O_RDONLY) == ERROR){ + + /* "Can't mmap() input file %s" */ + + error(A_SYSERR,"insert_anonftp", INSERT_ANONFTP_003, input_finfo -> filename); + exit(A_OK); + } + + if((int)(input_finfo -> size - offset) <= 0){ + + /* "Input file %s contains no data after header" */ + error(A_ERR, "insert_anonftp", INSERT_ANONFTP_026, input_finfo -> filename); + exit(A_OK); + } + + /* fprintf(stderr,"records before recountig :no_recs=%li site_no_recs=%li\n",header_rec.no_recs,header_rec.site_no_recs); */ + + if( count_extra_recs( input_finfo->ptr, input_finfo->size, &header_rec) == ERROR){ + + /* "Can't count extra records to be added to output file %s" */ + + error(A_WARN, "insert_anonftp","Can't count extra records to be added to output file %s", output_finfo -> filename); + goto unlink_output; + } + +/* fprintf(stderr,"records after recountig :no_recs=%li site_no_recs=%li\n",header_rec.no_recs,header_rec.site_no_recs); */ + + /* header_rec.no_recs = final_no_recs; */ + + if(setup_output_file(output_finfo, &header_rec, tmp_dir) == ERROR){ + + /* "Can't set up output file %s" */ + + error(A_WARN, "insert_anonftp", INSERT_ANONFTP_017, output_finfo -> filename); + goto unlink_output; + } + + /* Open other files database files */ + + if ( open_start_dbs(start_db,domain_db,O_RDWR ) == ERROR ) { + + /* "Can't open stbart/host database" */ + + error(A_ERR, "insert_anonftp", "Can't open start/host database"); + goto unlink_output; + } + + if ( !(strhan = archNewStrIdx()) ) { + error( A_ERR, "insert_anonftp", "Could not find create string handler"); + exit(A_OK); + } + + if ( archStridxExists( dbdir, &ans) ){ + + switch (ans){ + + case 1: /* all the files exist */ + if ( !archOpenStrIdx( strhan, dbdir, ARCH_STRIDX_APPEND ) ) { + error( A_ERR, "insert_anonftp", "All the Strings files exist but could not be open! Check you permissions. Exiting"); + exit(ERROR); + } + break; + + case -1: /* some files exist */ + error( A_ERR, "insert_anonftp", "Some of the Strings files exist but not all of them. Couldn't open Strings files. Exiting"); + exit(ERROR); + break; + + case 0: /* no strings files exist. */ + error( A_INFO, "insert_anonftp", "Could not find Strings files, will create them." ); + first = 1; + + if ( !(strhan = archNewStrIdx()) ) { + error( A_ERR, "insert_anonftp", "Could not create a string handler"); + exit(A_OK); + } + + if ( !archCreateStrIdx( strhan, dbdir, ARCH_INDEX_CHARS ) ) { + error( A_ERR, "insert_anonftp", "Could not create strings_idx files." ); + exit(A_OK); + } + break; + + } + }else{ + error( A_ERR, "insert_anonftp", "archStridxExists() failed. Something is terribly wrong! Report to archie-group@bunyip.com"); + exit(ERROR); + } + + if(open_host_dbs(hostbyaddr, hostdb, (file_info_t *) NULL, hostaux_db, O_RDWR) != A_OK){ + + /* "Can't open master database directory" */ + + error(A_ERR, "insert_anonftp", NOT_OPEN_MASTER_000); + goto unlink_output; + } + + /* "Doing hostname lookup" INSERT_ANONFTP_006 */ + + if(verbose) + error(A_INFO,"insert_anonftp","Inactivating the site if found in the database. "); + + if(inactivate_if_found(header_rec.primary_hostname, ANONFTP_DB_NAME, header_rec.preferred_hostname, header_rec.access_command, hostaux_db) == ERROR){ + + /* "Error while trying to inactivate %s in host database" */ + + error(A_ERR,"delete_anonftp", DELETE_ANONFTP_009, header_rec.primary_hostname); + goto unlink_output; + } + + if((host_st = do_hostdb_update(hostbyaddr, hostdb, hostaux_db, &header_rec, ANONFTP_DB_NAME, flags, 0)) != HOST_OK){ + + if(host_st == HOST_IGNORE){ + + close_file(input_finfo); + goto unlink_output; + + } + /* "Error updating host database: %s" */ + + error(A_ERR,"insert_anonftp", INSERT_ANONFTP_007, get_host_error(host_st)); + goto unlink_output; + } + + + /* If the input record has a failure then we end here */ + + if(header_rec.update_status == FAIL){ + + if(unlink(output_finfo -> filename) == -1){ + + /* "Can't unlink failed output file %s" */ + + error(A_SYSERR, "insert_anonftp", INSERT_ANONFTP_025, output_finfo -> filename); + exit(ERROR); + } + + exit(A_OK); + } + + /* "Reading input" */ + + if(verbose) + error(A_INFO,"insert_anonftp", INSERT_ANONFTP_009); + + if(setup_insert(strhan, input_finfo -> ptr, input_finfo -> size, + (full_site_entry_t *) output_finfo -> ptr, + &output_rec_no, header_rec) == ERROR){ + + error(A_ERR, "insert_anonftp", INSERT_ANONFTP_010); + goto unlink_output; + } + + /* just like we used open_output_file() using the header_rec->site_no_recs + to allocate memory, we must use a remap_output_file() to reallocate + the memory with the new (definite) site_no_recs */ + + + if(activate_site(&header_rec, ANONFTP_DB_NAME, hostaux_db) == ERROR){ + + /* "Can't activate host database record for %s" */ + + error(A_ERR,"insert_anonftp", INSERT_ANONFTP_016, header_rec.primary_hostname); + exit(A_OK); + } + + close_host_dbs(hostbyaddr,hostdb,(file_info_t*)NULL, hostaux_db); + + if( get_port( header_rec.access_command, ANONFTP_DB_NAME, &port ) == ERROR ){ + error(A_ERR,"insert_anonftp","Could not find the port for this site %s", header_rec.primary_hostname); + exit(A_OK); + } + + if(access(files_db_filename(inet_ntoa( ipaddr_to_inet(header_rec.primary_ipaddr)),port), F_OK) < 0){ + + /* "File %s does not exist in the database. No need to compare" */ + + error(A_INFO,"insert_anonftp", "File %s does not exist in the database. No need to compare", + files_db_filename(inet_ntoa( ipaddr_to_inet(header_rec.primary_ipaddr)),port)); + + /* I need to have another processing here where I only insert the new_file + into the host/start database */ + + if(insert_hstart_db( (full_site_entry_t *)output_finfo -> ptr , + start_db, domain_db, header_rec, port ) == ERROR ) + { + error(A_ERR,"insert_anonftp","can't insert into start/host database site %s", + files_db_filename(inet_ntoa( ipaddr_to_inet(header_rec.primary_ipaddr)),port)); + goto unlink_output; + } + } + else + { + /* This is where two of the site files are open. The newly created and the + * old site file. They are read, sorted according to their starts, compared + * and then the old strings are removed while the new strings are inserted + * into the starts/host database. + */ + + + strcpy(curr_finfo -> filename, files_db_filename(inet_ntoa( ipaddr_to_inet(header_rec.primary_ipaddr)),port)); + + /* Open current file */ + + if(open_file(curr_finfo, O_RDONLY) == ERROR){ + + /* "Ignoring %s" */ + + error(A_ERR, "check_indiv", CHECK_INDIV_003, curr_finfo->filename); + goto unlink_output; + } + + /* mmap it */ + + if(mmap_file(curr_finfo, O_RDONLY) == ERROR){ + + /* "Ignoring %s" */ + + error(A_ERR, "check_indiv", CHECK_INDIV_003, curr_finfo ->filename); + goto unlink_output; + } + + curr_size = curr_finfo -> size / sizeof(full_site_entry_t); + + if( insert_compare_hstart_db( (full_site_entry_t *) output_finfo -> ptr, + header_rec.site_no_recs, + (full_site_entry_t *) curr_finfo -> ptr, + curr_size, start_db, header_rec, port ) == ERROR ) + { + /* "Error in compare_site_files for site %s." */ + + error(A_ERR,"insert_anonftp","Error in compare_site_files for site %s." , + files_db_filename(inet_ntoa( ipaddr_to_inet(header_rec.primary_ipaddr)),port)); + goto unlink_output; + } + } + + + if ( output_rec_no * sizeof(full_site_entry_t) >= minidxsize ) { + index_file = 1; + if ( create_site_index(output_finfo->filename,output_finfo->ptr,output_rec_no) == ERROR ) { + index_file = 0; + } + } + + close_file(output_finfo); + resize_output_file( output_finfo, output_rec_no ); + + /* just like we used open_output_file() using the header_rec->site_no_recs + to allocate memory, we must use a remap_output_file() to reallocate + the memory with the new (definite) site_no_recs */ + + if(rename(output_finfo -> filename, files_db_filename(inet_ntoa( ipaddr_to_inet(header_rec.primary_ipaddr)),port)) != 0){ + + if ( errno != EXDEV || + archie_rename(output_finfo -> filename, + files_db_filename(inet_ntoa( ipaddr_to_inet(header_rec.primary_ipaddr)),port)) != 0){ + + /* "Can't rename %s to %s. anonftp database not changed." */ + + error(A_SYSERR,"insert_anonftp", INSERT_ANONFTP_013, output_finfo -> filename, + files_db_filename(inet_ntoa( ipaddr_to_inet(header_rec.primary_ipaddr)),port)); + goto unlink_output; + } + } + + sprintf(file1,"%s%s",output_finfo->filename, SITE_INDEX_SUFFIX); + sprintf(file2,"%s%s",files_db_filename(inet_ntoa( ipaddr_to_inet(header_rec.primary_ipaddr)),port),SITE_INDEX_SUFFIX); + + if ( index_file ) { + + if(rename(file1, file2) != 0 ) { + if ( errno != EXDEV || + archie_rename(file1, file2) != 0 ) { + + /* "Can't rename %s to %s. anonftp database not changed." */ + + error(A_SYSERR,"insert_anonftp", INSERT_ANONFTP_013, file1, file2); + goto unlink_output; + } + } + }else{ + (void)unlink(file2); + } + + strcpy(output_finfo->filename,files_db_filename(inet_ntoa( ipaddr_to_inet(header_rec.primary_ipaddr)),port)); + if ( first ){ + if ( ! archUpdateStrIdx(strhan)) { + error( A_ERR, "insert_anonftp", "Could not update strings_idx files."); + archCloseStrIdx(strhan); + archFreeStrIdx(&strhan); + exit(A_OK); + } + } + + close_start_dbs(start_db,domain_db); + archCloseStrIdx(strhan); + archFreeStrIdx(&strhan); + + exit(A_OK); + + unlink_output: + + close_file(output_finfo); + + if ( index_file ) { + pathname_t file1; + + sprintf(file1,"%s%s",output_finfo->filename, SITE_INDEX_SUFFIX); + (void)unlink(file1); + } + + if(unlink(output_finfo -> filename) == -1){ + +#if 0 + /* "Can't unlink failed output file %s" */ + + error(A_SYSERR, "insert_anonftp", INSERT_ANONFTP_025, output_finfo -> filename); +#endif + exit(A_OK); + } + + /* + if ( (strhan) && ! archUpdateStrIdx(strhan)) { + error( A_WARN, "insert_anonftp", "Could not update strings_idx files."); + archCloseStrIdx(&strhan); + exit(A_OK); + } + */ + + close_start_dbs(start_db,domain_db); + archCloseStrIdx(strhan); + archFreeStrIdx(&strhan); + + return(A_OK); /* to make gcc happy */ + exit(A_OK); +} + + +/* + * setup_output_file: given the header record and a temporary directory, + * create an output file and mmap it filling int the output_finfo + * structure. We return ERROR on error. + */ + + +status_t setup_output_file(output_finfo, header_rec, tmp_dir) + file_info_t *output_finfo; + header_t *header_rec; /* Header record to use */ + char *tmp_dir; /* pathname of temporary directory */ +{ + +#ifdef __STDC__ + + extern int ftruncate(int, off_t); + +#else + + extern int ftruncate(); + +#endif + + char *str; + + /* Check pointers */ + + ptr_check(output_finfo, file_info_t, "setup_output_file", ERROR); + ptr_check(header_rec, header_t, "setup_output_file", ERROR); + ptr_check(tmp_dir, char, "setup_output_file", ERROR); + + /* If the number of records is not greater than 0 then return */ + + if((header_rec -> update_status == SUCCEED) && (header_rec -> no_recs <= 0)){ + + /* "Number of records %d. Ignoring" */ + + error(A_WARN,"setup_output_file", SETUP_OUTPUT_FILE_001, header_rec -> no_recs); + return(ERROR); + } + + if(header_rec -> update_status == FAIL) + return(A_OK); + + /* Get a temporary name for the output file */ + + str = tempnam(tmp_dir, DEFAULT_TMP_PREFIX); + + if(str){ + strcpy(output_finfo -> filename, str); + free(str); + } + else{ + + /* "Can't get temporary name for file %s." */ + + error(A_INTERR,"preprocess_file", SETUP_OUTPUT_FILE_003, header_rec -> primary_hostname); + return(ERROR); + } + + /* Open the file */ + + + if(open_file(output_finfo,O_WRONLY) == ERROR){ + + /* "Can't open output file %s" */ + + error(A_SYSERR,"setup_output_file", SETUP_OUTPUT_FILE_004, output_finfo -> filename); + return(ERROR); + } + + /* + * We know how many records there are, so extend the new file to the + * correct length + */ + + + if((int) ftruncate(fileno(output_finfo -> fp_or_dbm.fp), + (header_rec->site_no_recs )*sizeof(full_site_entry_t)) != 0){ + + /* "Can't ftruncate output file %s" */ + + error(A_SYSERR,"setup_output_file", SETUP_OUTPUT_FILE_005, output_finfo -> filename); + return(ERROR); + } + + + /* now map it into core */ + + if(mmap_file(output_finfo, O_WRONLY) != A_OK){ + + + /* "Can't mmap() output file %s" */ + + error(A_INTERR, "setup_output_file", SETUP_OUTPUT_FILE_006, output_finfo -> filename); + return(ERROR); + } + + return(A_OK); +} + + + + + +/* + * reopen_output_file: reopen an existing file that was mmaped and remap it. + */ + + +status_t reopen_output_file(output_finfo) + file_info_t *output_finfo; +{ + /* Check pointers */ + + ptr_check(output_finfo, file_info_t, "reopen_output_file", ERROR); + + /* Open the file */ + + if(open_file(output_finfo,O_RDWR) == ERROR){ + + /* "Can't open output file %s" */ + + error(A_SYSERR,"reopen_output_file", SETUP_OUTPUT_FILE_004, output_finfo -> filename); + return(ERROR); + } + + + /* now map it into core */ + + if(mmap_file(output_finfo, O_RDWR ) != A_OK){ + + + /* "Can't mmap() output file %s" */ + + error(A_INTERR, "reopen_output_file", SETUP_OUTPUT_FILE_006, output_finfo -> filename); + return(ERROR); + } + + return(A_OK); +} + + +int intcompare(i,j) +index_t *i, *j; +{ + return((int)(*i - *j)); +} + + + +/* create_str_array: ceates an array of sorted starts from the array + * of records of type full_site_entry_t. sz is the size of the input array. + */ + +status_t create_str_array( fp, sz, array, arsz ) + full_site_entry_t *fp; + int sz; + int *array; + int *arsz; +{ + int no , i; + + i = 0; + for ( no=0; no= *arsz ) + { error( A_ERR,"insert_anonftp","failed in create_str_array"); + return(ERROR); + } + + array[i] = fp[no].strt_1; + i++; + } + } + + *arsz = i; + + qsort(array,*arsz,sizeof(int),intcompare); + + return (A_OK); +} + + + +/* insert_hstart_db: takes as argument an array of full_site_entry_t records + * and for each start in the file: it inserts the site into the host/start + * database. returns 0 on success. + */ + +status_t insert_hstart_db( fp, start_db, domain_db, header_rec, port) + full_site_entry_t *fp; /* file pointer contains an array of records */ + file_info_t *start_db; + file_info_t *domain_db; + header_t header_rec; + int port; +{ + + int no, sz; + index_t in; + ip_addr_t ip; + host_table_index_t hin; + + + sz = header_rec.site_no_recs; + ip = header_rec.primary_ipaddr; + + if ( host_table_find(&ip, + header_rec.primary_hostname, &port, &hin ) == ERROR ) + { + /* "New site %s will be added to host/start table\n" */ + error(A_INFO,"insert_anonftp","New site %s will be added to host/start table", + (char *)(inet_ntoa( ipaddr_to_inet(ip)))); + if ( host_table_add( ip, header_rec.primary_hostname, port, &hin ) == ERROR ) + { /* "insert_hstart_db : Could not add host %s to host_table" */ + error(A_ERR,"insert_anonftp","insert_hstart_db : Could not add host %s to host_table", + (char *)(inet_ntoa( ipaddr_to_inet(ip))) ); + return ERROR; + } + /* fprintf(stderr, "host: %s (%s) hin=%d\n", (char *)(inet_ntoa( ipaddr_to_inet(ip))), header_rec.primary_hostname, hin);*/ + } + + for ( no=0; no ar2[k] ) /* old file has an old element */ + { + /* remove ar2[k] from the host/start db */ + if ( update_start_dbs(start_db, ar2[k], hin, DELETE_SITE ) == ERROR ) + { /* "Could not update start/host table with %s ." */ + error(A_ERR,"insert_compare_hstart_db","Could not update start/host table with %s .", + (char *)(inet_ntoa( ipaddr_to_inet(ip))) ); + return ERROR; + } + k++; + }else if( ar1[i] == ar2[k] ) /* both files have a shared element */ + { + i++; k++; + } + } + + while( i +#include "defines.h" +#include "typedef.h" +#include "header.h" +#include "host_db.h" +#include "archstridx.h" +#include "patrie.h" + +typedef struct{ + index_t new_record_no; + index_t strings_idx; + int status; + index_t parent_idx; +/* site_entry_ptr_t site_rec; */ + char *instring; +} outlist__t; + +typedef outlist__t * outlist_t; + +struct tmp_list{ + index_t recno; + struct tmp_list *next; +}; + +typedef struct tmp_list tmp_list_t; + + +#define STRING_NOT_FOUND (int) 0 +#define STRING_FOUND (int) 1 +#define PRNT_STRING (int) -1 +#define ACTIVE_STRING "A" + +extern status_t setup_output_file PROTO((file_info_t *, header_t *, char *)); +extern status_t reopen_output_file PROTO((file_info_t *)); +extern int outlist_compare PROTO((outlist_t, outlist_t)); +extern status_t setup_insert PROTO((struct arch_stridx_handle *, char *, int, full_site_entry_t *, int *, header_t)); + +#endif diff --git a/archie/anonftp/update/interact_anonftp.c b/archie/anonftp/update/interact_anonftp.c new file mode 100644 index 0000000..3de1f3b --- /dev/null +++ b/archie/anonftp/update/interact_anonftp.c @@ -0,0 +1,559 @@ +/* + * This file is copyright Bunyip Information Systems Inc., 1993. This file + * may not be reproduced, copied or transmitted by any means mechanical or + * electronic without the express written consent of Bunyip Information + * Systems Inc. + */ + + +#include +#include +#include +#include +#include +#include "typedef.h" +#include "db_files.h" +#include "domain.h" +#include "header.h" +#include "db_ops.h" +#include "host_db.h" +#include "error.h" +#include "files.h" +#include "archie_strings.h" +#include "archie_dbm.h" +#include "interact_anonftp.h" +#include "core_entry.h" +#include "lang_anonftp.h" +#include "debug.h" +#include "master.h" + +#include "site_file.h" +#include "../startdb/start_db.h" +#include "../startdb/lang_startdb.h" +#include "patrie.h" +#include "archstridx.h" + +#include "strings_index.h" +#include "protos.h" + +#define MAX_STR 64 + +#define EXACT 0 +#define SUB 1 +#define REGEXP 2 +#define MAX_HITS 100 +#define MAX_MATCH 50 + +int verbose = 0; + +char *prog; + +status_t archQuery(); +status_t getResultFromStart( ); +extern status_t host_table_find(); +extern status_t update_start_dbs(); +extern status_t close_start_dbs(); +extern status_t open_start_dbs(); +extern status_t get_index_start_dbs(); +extern int archSearchSub(); +extern status_t get_port(); + +status_t archQuery( strhan, qry, type, case_sens, h, m, hpm, start_db) + struct arch_stridx_handle *strhan; + char *qry; + int type; /* type of search */ + int case_sens; /* case_sens */ + int h; /* maximum hits (all in all) */ + int m; /* maximum match (different unique strings) */ + int hpm; /* maximum hits per match */ + file_info_t *start_db; +{ + /* File information */ + + host_table_index_t inds[65536], hin; + int indslen,state,j,i,k,l,all = 0; + unsigned long hits = 0; + hostname_t hnm; + ip_addr_t ipaddr = (ip_addr_t)(0); + + int port, site_hits; + + index_t *start; + hnm[0] = '\0'; + port = 0; + + if(h<=0) h= MAX_HITS; + if(m<=0) m= MAX_MATCH; + switch( type ){ + + case EXACT: + + start = (index_t *)malloc(sizeof(index_t)); + if( !archSearchExact( strhan, qry, &start[0], &state) ){ + error(A_ERR, "archQuery", "Could not perform exact search successfully.\n"); + return(A_OK); + } + if( state != 1 ){ + fprintf(stderr,"String %s was not found in the database.\n",qry); + return(A_OK); + } + hits = 1; + break; + + case SUB: + + start = (index_t *)malloc(sizeof(index_t)*m); + if( !archSearchSub( strhan, qry, case_sens, m, &hits, start ) ){ + error(A_ERR, "archQuery", "Could not perform exact search successfully.\n"); + return(A_OK); + } + if( hits <= 0 ){ + fprintf(stderr,"String %s was not found in the database.\n",qry); + return(A_OK); + } + break; + + default: + error(A_ERR," archQuery", "Did not supply any search type for query"); + return(A_OK); + break; + } + + site_hits = 0; + for(j=0,l=0 ; (j=h){ + free(start); + return(A_OK); + } + } + } + free(start); + return(A_OK); +} + +status_t getResultFromStart( start, strhan, ip, port, hits ) + index_t start; + struct arch_stridx_handle *strhan; + ip_addr_t ip; + int port; + int *hits; +{ + /* File information */ + char *res, *totstr, *tmpstr, t[MAX_STR]; + + int l, act_size = 0; + int cnt = 0; + int limit = 0; + index_t curr_strings; + index_t curr_count; + index_t curr_prnt=0; + + full_site_entry_t *curr_ent, *ent; + full_site_entry_t *curr_endptr; + full_site_entry_t *prnt_ent; + + file_info_t *curr_finfo = create_finfo(); + + res = tmpstr = totstr = (char *)(0); + limit = *hits; + *hits = cnt; + + if(access(files_db_filename(inet_ntoa( ipaddr_to_inet(ip)),port), F_OK) < 0){ + /* "File %s does not exist in the database. No need to look for starts in it" */ + error(A_WARN,"insert_anonftp", "File %s does not exist in the database. No need to look for starts in it.\n", + files_db_filename(inet_ntoa( ipaddr_to_inet(ip)),port)); + return(A_OK); + + }else{ + + strcpy(curr_finfo -> filename, files_db_filename(inet_ntoa( ipaddr_to_inet(ip)) ,port)); + /* Open current file */ + if(open_file(curr_finfo, O_RDONLY) == ERROR){ + /* "Ignoring %s" */ + error(A_ERR, "interact_anonftp", "Ignoring %s", curr_finfo->filename); + return(A_OK); + } + + /* mmap it */ + if(mmap_file(curr_finfo, O_RDONLY) == ERROR){ + /* "Ignoring %s" */ + error(A_ERR, "interact_anonftp", "Ignoring %s", curr_finfo ->filename); + return(A_OK); + } + act_size = curr_finfo -> size / sizeof(full_site_entry_t); + } + + for(curr_ent = (full_site_entry_t *) curr_finfo -> ptr, curr_endptr = curr_ent + act_size, curr_count = 0; + curr_ent < curr_endptr; + curr_ent++, curr_count++){ + + curr_strings = curr_ent -> strt_1; + /* Check if string offset is valid */ + if(curr_strings >= (index_t)(0)){ + if ( CSE_IS_SUBPATH((*curr_ent))|| + CSE_IS_PORT((*curr_ent))|| + CSE_IS_NAME((*curr_ent)) ){ + curr_prnt = curr_count; + }else{ + if( curr_strings == start ){ + sprintf(t,"%s \t size:%ld \t perms:%o", (char *)cvt_to_usertime(curr_ent -> core.entry.date,0), + curr_ent -> core.entry.size, curr_ent -> core.entry.perms); + ent = curr_ent; + tmpstr = (char *)0; + while(( curr_prnt >= (index_t)(0) )&&( curr_strings >= (index_t)(0) )){ + if( !archGetString( strhan, curr_strings, &res) ) + { /* "Site %s (%s) record %d has string index %d out of bounds" */ + error(A_ERR, "getResultFromStart", "Site %s (%s) record %d has string index %d out of bounds", + files_db_filename(inet_ntoa( ipaddr_to_inet(ip)),port), curr_count, curr_strings ); + close_file(curr_finfo); + free(curr_finfo); + return(ERROR); + }else{ + if( tmpstr == (char *)(0) ){ + l = (strlen(res)+1); + tmpstr = (char *)malloc( sizeof(char)*l ); + totstr = (char *)malloc( sizeof(char)*l ); + sprintf(tmpstr,"%s",res); + sprintf(totstr,"%s",res); + } + else{ + l = strlen(res) + strlen(totstr) + 2; + if ( (tmpstr = (char *)realloc( tmpstr, sizeof(char)*(l) )) == (char *)NULL ){ + error(A_SYSERR,"getResultFromStr","could not allocate memory.\n"); + close_file(curr_finfo); + free(curr_finfo); + return(ERROR); + } + sprintf(tmpstr,"%s/%s",res,totstr); + if ( (totstr = (char *)realloc( totstr, sizeof(char)*(l) )) == (char *)NULL ){ + error(A_SYSERR,"getResultFromStr","could not allocate memory.\n"); + close_file(curr_finfo); + free(curr_finfo); + return(ERROR); + } + strcpy(totstr ,tmpstr); + } + free( res ); + prnt_ent = (full_site_entry_t *) (curr_finfo -> ptr + curr_prnt*sizeof(full_site_entry_t)); + if(!(CSE_IS_SUBPATH((*prnt_ent))|| + CSE_IS_PORT((*prnt_ent))|| + CSE_IS_NAME((*prnt_ent))) ) { + error(A_ERR, "getResultFromStart","Corruption in site file %s\n", + files_db_filename(inet_ntoa( ipaddr_to_inet(ip)),port) ); + close_file(curr_finfo); + free(curr_finfo); + return(ERROR); + } + curr_prnt = prnt_ent->strt_1; + if( curr_prnt >= (index_t)(0) ){ + ent = (full_site_entry_t *) (curr_finfo -> ptr + + prnt_ent->core.prnt_entry.strt_2*sizeof(full_site_entry_t)); + curr_strings = ent->strt_1; + } + } + } + fprintf(stderr," %s\n",totstr); + + free(tmpstr); + free(totstr); + tmpstr = (char *)0; + fprintf(stderr," %s\n",t); + cnt++; + } + } + if( cnt >= limit ) break; + } + } + + *hits = cnt; + close_file(curr_finfo); + free(curr_finfo); + return(A_OK); +} + + +/* + * interact_anonftp: perform consistency checking on anonftp database + * + * + + argv, argc are used. + + Parameters: -w + -M + -v verbose mode + -l write to log file + -L + +*/ + + +int main(argc, argv) + int argc; + char *argv[]; + +{ + +#ifdef __STDC__ + + extern int getopt(int, char **, char *); + extern status_t compile_domains( char *, domain_t *, file_info_t *, int *); + +#else + + extern int getopt(); + extern status_t compile_domains(); + +#endif + + + extern int opterr; + extern char *optarg; + + char **cmdline_ptr; + int cmdline_args; + + int option; + + /* Directory names */ + + pathname_t master_database_dir; + pathname_t files_database_dir; + pathname_t start_database_dir; + pathname_t host_database_dir; + + /*startdb stuff*/ + file_info_t *start_db = create_finfo(); + file_info_t *domain_db = create_finfo(); + /*startdb stuff*/ + + struct arch_stridx_handle *strhan; + char *dbdir; + + char qry[MAX_PATH_LEN]; + + /* host databases */ + + pathname_t logfile; + hostname_t hostname; + + int logging = 0; + int hits = 0; + int mtch = 0; + int hpm = 0; + int type = EXACT; + int case_sens = 0; + + prog = argv[0]; + + logfile[0] = hostname[0] = '\0'; + + host_database_dir[0] = files_database_dir[0] = start_database_dir[0] = master_database_dir[0] = '\0'; + + opterr = 0; /* turn off getopt() error messages */ + + /* ignore argv[0] */ + + cmdline_ptr = argv + 1; + cmdline_args = argc - 1; + + while((option = (int) getopt(argc, argv, "H:h:m:w:M")) != EOF){ + + switch(option){ + + /* Master directory */ + + case 'M': + strcpy(master_database_dir,optarg); + cmdline_ptr += 2; + cmdline_args -= 2; + break; + + /* Type of search */ + + case 't': + type = atoi(optarg); + cmdline_ptr += 2; + cmdline_args -= 2; + break; + + /* case sensetive */ + + case 'c': + case_sens = atoi(optarg); + cmdline_ptr += 2; + cmdline_args -= 2; + break; + + /* Hits */ + + case 'H': + hits = atoi(optarg); + cmdline_ptr += 2; + cmdline_args -= 2; + break; + + /* Hits per match */ + + case 'h': + hpm = atoi(optarg); + cmdline_ptr += 2; + cmdline_args -= 2; + break; + + /* Match */ + + case 'm': + mtch = atoi(optarg); + cmdline_ptr += 2; + cmdline_args -= 2; + break; + + /* Get files database directory name, argument "w" */ + + case 'w': + strcpy(files_database_dir,optarg); + cmdline_ptr += 2; + cmdline_args -= 2; + break; + + + default: + error(A_ERR,"interact_anonftp","Usage: [-M master-database-dir] [-t ] [-c ] [-H ] [-h ] [-m ] [-w ]"); + exit(A_OK); + break; + } + + } + + /* set up logs */ + + if(logging){ + if(logfile[0] == '\0'){ + if(open_alog((char *) NULL, A_INFO, tail(argv[0])) == ERROR){ + + /* "Can't open default log file" */ + + error(A_ERR, "interact_anonftp", "Can't open default log file.\n"); + exit(A_OK); + } + } + else{ + if(open_alog(logfile, A_INFO, tail(argv[0])) == ERROR){ + + /* "Can't open log file %s" */ + + error(A_ERR, "interact_anonftp", "Can't open log file %s.\n", logfile); + exit(A_OK); + } + } + } + + + /* Set up system directories and files */ + + + if(set_master_db_dir(master_database_dir) == (char *) NULL){ + + /* "Error while trying to set master database directory" */ + + error(A_ERR,"interact_anonftp", "Error while trying to set master database directory.\n"); + exit(A_OK); + } + + if((dbdir = set_files_db_dir(files_database_dir)) == (char *) NULL){ + + /* "Error while trying to set anonftp database directory" */ + + error(A_ERR,"interact_anonftp", "Error while trying to set anonftp database directory\n"); + exit(A_OK); + } + + if(set_host_db_dir(host_database_dir) == (char *) NULL){ + + /* "Error while trying to set host database directory" */ + + error(A_ERR,"interact_anonftp", "Error while trying to set host database directory\n"); + exit(A_OK); + } + + + if(set_start_db_dir(start_database_dir,DEFAULT_FILES_DB_DIR) == (char *) NULL){ + + /* "Error while trying to set start database directory" */ + + error(A_ERR, "interact_anonftp", "Error while trying to set start database directory\n"); + exit(A_OK); + } + + /* Open other files database files */ + + if ( open_start_dbs(start_db,domain_db,O_RDWR ) == ERROR ) { + + /* "Can't open start/host database" */ + + error(A_ERR, prog, "Can't open start/host database"); + exit(A_OK); + } + + if ( !archOpenStrIdx( dbdir, ARCH_STRIDX_SEARCH, &strhan ) ){ + error( A_WARN, "interact_anonftp", "Could not find strings files, aborting." ); + exit(A_OK); + } + + while(1){ + char *p; + fprintf(stderr,"\n#Give a string:"); + fgets(qry,MAX_PATH_LEN,stdin); + p=qry; + if(p!=(char *)NULL){ + for(; (*p!='\0')&&(*p!='\n'); p++); + *p = '\0'; + } + + if(qry[0] != '\0') { + if (archQuery( strhan, qry, type, hits, mtch, hpm, start_db) == ERROR){ + error(A_ERR,"interact_anonftp","archQuery failed, abort\n"); + exit(A_OK); + } + }else + break; + } + + close_start_dbs(start_db,domain_db); + + destroy_finfo(start_db); + destroy_finfo(domain_db); + exit(A_OK); + return(A_OK); +} diff --git a/archie/anonftp/update/interact_anonftp.h b/archie/anonftp/update/interact_anonftp.h new file mode 100644 index 0000000..56f873e --- /dev/null +++ b/archie/anonftp/update/interact_anonftp.h @@ -0,0 +1,22 @@ +#ifndef _INTERACT_ANONFTP_H_ +#define _INTERACT_ANONFTP_H_ +#include +#include "defines.h" +#include "typedef.h" +#include "header.h" +#include "host_db.h" +#include "archstridx.h" +#include "patrie.h" + +#ifdef __STDC__ + +extern status_t archQuery PROTO((struct arch_stridx_handle *, char *, file_info_t *, file_info_t *)); +extern status_t getResultFromStart PROTO(( index_t, struct arch_stridx_handle *, ip_addr_t, int )); +#else + +extern status_t archQuery PROTO(()); +extern status_t getResultFromStart PROTO(()); + +#endif + +#endif diff --git a/archie/anonftp/update/lang_anonftp.c b/archie/anonftp/update/lang_anonftp.c new file mode 100644 index 0000000..0e1f7b7 --- /dev/null +++ b/archie/anonftp/update/lang_anonftp.c @@ -0,0 +1,284 @@ + +char* INSERT_ANONFTP_001 = "Can't open input file %s"; +char* INSERT_ANONFTP_002 = "Can't read header record of %s"; +char* INSERT_ANONFTP_003 = "Can't mmap() input file %s"; +char* INSERT_ANONFTP_004 = "Can't open anonftp database"; +char* INSERT_ANONFTP_005 = "Can't malloc() space for outlist"; +char* INSERT_ANONFTP_006 = "Doing hostname lookup"; +char* INSERT_ANONFTP_007 = "Error updating host database: %s"; +char* INSERT_ANONFTP_008 = "File %s already exists in the database"; +char* INSERT_ANONFTP_009 = "Reading input"; +char* INSERT_ANONFTP_010 = "Error while processing input. No data has been lost"; +char* INSERT_ANONFTP_011 = "Making internal links"; +char* INSERT_ANONFTP_012 = "Error while making internal links. No data has been lost"; +char* INSERT_ANONFTP_013 = "Can't rename %s to %s. anonftp database not changed."; +char* INSERT_ANONFTP_014 = "Resolving new strings for site %s"; +char* INSERT_ANONFTP_015 = "Can't resolve new strings for %s."; +char* INSERT_ANONFTP_016 = "Can't activate host database record for %s"; +char* INSERT_ANONFTP_017 = "Can't set up output file %s"; +char* INSERT_ANONFTP_019 = "Can't open log file %s"; +char* INSERT_ANONFTP_020 = "Can't open default log file"; +char* INSERT_ANONFTP_021 = "Error while trying to set master database directory"; +char* INSERT_ANONFTP_022 = "Error while trying to set anonftp database directory"; +char* INSERT_ANONFTP_023 = "Error while trying to set host database directory"; +char* INSERT_ANONFTP_024 = "No site name or address given"; +char* INSERT_ANONFTP_025 = "Can't unlink failed output file %s"; +char* INSERT_ANONFTP_026 = "Input file %s contains no data after header"; +char* INSERT_ANONFTP_027 = "Can't open dest file %s, errno = %d"; +char* INSERT_ANONFTP_028 = "Can't open src file %s, errno = %d"; +char* INSERT_ANONFTP_029 = "While copying file %s to %s, errno = %d"; +char* INSERT_ANONFTP_030 = "File %s does exist in the database. No need to compare"; + +char* SETUP_OUTPUT_FILE_001 = "Number of records %d. Ignoring"; +char* SETUP_OUTPUT_FILE_002 = "Can't get new file info structure"; +char* SETUP_OUTPUT_FILE_003 = "Can't get temporary name for file %s."; +char* SETUP_OUTPUT_FILE_004 = "Can't open output file %s"; +char* SETUP_OUTPUT_FILE_005 = "Can't ftruncate output file %s"; +char* SETUP_OUTPUT_FILE_006 = "Can't mmap() output file %s"; + +/* setup_insert.c */ + + +char* ADD_TMP_STRING_001 = "Can't malloc space for new tmp_list element"; + +char* SETUP_HASH_TABLE_001 = "Can't allocate space for has table"; + +char* SETUP_INSERT_001 = "Can't setup hash table"; +char* SETUP_INSERT_002 = "Possible zero length strings index file\nIgnore error message if this is a new database"; +char* SETUP_INSERT_003 = "Can't malloc space for input string"; +char* SETUP_INSERT_004 = "Can't add string to hash table"; +char* SETUP_INSERT_005 = "Can't unmap strings index file"; +char* SETUP_INSERT_006 = "Error while reading '%s' from hashed strings database"; + + +char* DO_INTERNAL_001 = "Possible zero length strings index file\nIgnore error message if this is a new database"; +char* DO_INTERNAL_002 = "Cannot process new or inactive record number %u, string %s"; +char* DO_INTERNAL_003 = "Can't unmap strings index file" ; + +char* MAKE_LINKS_001 = "Error while seeking end of strings_list file"; +char* MAKE_LINKS_002 = "Error while extending strings_list file"; +char* MAKE_LINKS_003 = "Error while seeking end of strings_idx file"; +char* MAKE_LINKS_004 = "Error while seeking end of strings_idx file"; +char* MAKE_LINKS_005 = "Error while reading last record in strings index file"; +char* MAKE_LINKS_006 = "Error while seeking end of strings_idx file"; +char* MAKE_LINKS_007 = "Error while seeking last string in strings file"; +char* MAKE_LINKS_008 = "Error while reading last string in strings file"; +char* MAKE_LINKS_009 = "Error while seeking end of last string in strings_list file"; +char* MAKE_LINKS_010 = "Error while seeking beginning of strings_list file"; +char* MAKE_LINKS_011 = "Can't insert new string into hash database"; +char* MAKE_LINKS_012 = "Error writing strings_idx file"; +char* MAKE_LINKS_013 = "Error writing new string in strings_list file"; +char* MAKE_LINKS_014 = "Can't mmap() strings index file"; +char* MAKE_LINKS_015 = "Can't unmap previous site file"; +char* MAKE_LINKS_016 = "Can't close previous site file"; +char* MAKE_LINKS_017 = "Can't open site file for link insertion"; +char* MAKE_LINKS_018 = "Can't mmap() site file for link insertion"; +char* MAKE_LINKS_019 = "Can't unmap strings index file"; + + + +/* delete.c */ + +char* DELETE_ANONFTP_001 = "No site name or address given"; +char* DELETE_ANONFTP_002 = "Error while trying to set master database directory"; +char* DELETE_ANONFTP_003 = "Error while trying to set anonftp database directory"; +char* DELETE_ANONFTP_004 = "Error while trying to set host database directory"; +char* DELETE_ANONFTP_005 = "Error while trying to open anonftp database"; +char* DELETE_ANONFTP_006 = "Error while trying to open host database"; +char* DELETE_ANONFTP_007 = "Can't determine input file for site %s"; +char* DELETE_ANONFTP_008 = "Can't find input database file for %s"; +char* DELETE_ANONFTP_009 = "Error while trying to inactivate %s in host database"; +char* DELETE_ANONFTP_010 = "Error while trying to set up deletion of %s"; +char* DELETE_ANONFTP_011 = "Can't remove the site file %s"; +char* DELETE_ANONFTP_012 = "Can't close input file %s"; +char* DELETE_ANONFTP_013 = "Can't open default log file"; +char* DELETE_ANONFTP_014 = "Can't open log file %s"; + +/* setup_delete.c */ + +char* SETUP_DELETE_001 = "Can't malloc space for internal list"; +char* SETUP_DELETE_002 = "No input file %s"; +char* SETUP_DELETE_003 = "Can't mmap site file to be deleted %s"; +char* SETUP_DELETE_004 = "Can't mmap strings index file"; +char* SETUP_DELETE_005 = "Can't open site file %s"; +char* SETUP_DELETE_006 = "Can't mmap site file %s"; +char* SETUP_DELETE_007 = "Can't unmap site file %s"; +char* SETUP_DELETE_008 = "Can't close site file %s"; +char* SETUP_DELETE_009 = "Can't unmap strings index file"; +char* SETUP_DELETE_010 = "Can't free internal list"; +char* SETUP_DELETE_011 = "Can't fstat() input site file %s"; +char* SETUP_DELETE_012 = "Number of records in host auxiliary database (%d) different from implied by file size (%d)"; +char* SETUP_DELETE_013 = "Site %s record %d points to itself (previous)"; +char* SETUP_DELETE_014 = "Site %s record %d points to itself (next)"; +char* SETUP_DELETE_015 = "Site %s record %d points to already checked record"; + +/* parse_anonftp.c */ + +char* PARSE_ANONFTP_001 = "Can't open default log file"; +char* PARSE_ANONFTP_002 = "Can't open log file %s"; +char* PARSE_ANONFTP_003 = "No input file given"; +char* PARSE_ANONFTP_004 = "No output file given"; +char* PARSE_ANONFTP_005 = "Error while trying to set master database directory"; +char* PARSE_ANONFTP_006 = "Can't open input file %s"; +char* PARSE_ANONFTP_007 = "Error reading header of input file %s"; +char* PARSE_ANONFTP_008 = "Input file %s not in raw format. Cannot process"; +char* PARSE_ANONFTP_009 = "Can't get temporary name for file %s"; +char* PARSE_ANONFTP_010 = "Can't open temporary file %s"; +char* PARSE_ANONFTP_011 = "Error while writing header of output file"; +char* PARSE_ANONFTP_012 = "Can't execlp() filter program %s"; +char* PARSE_ANONFTP_013 = "Can't vfork() filter program %s"; +char* PARSE_ANONFTP_014 = "Error while in wait() for filter program %s"; +char* PARSE_ANONFTP_015 = "Filter program %s exited abnormally with exit code %d"; +char* PARSE_ANONFTP_016 = "Filter program %s terminated abnormally with signal %d"; +char* PARSE_ANONFTP_017 = "Can't close input file %s"; +char* PARSE_ANONFTP_018 = "Can't close temporary file %s"; +char* PARSE_ANONFTP_019 = "Can't execvp() parse program %s"; +char* PARSE_ANONFTP_020 = "Can't vfork() parse program %s"; +char* PARSE_ANONFTP_021 = "Error while in wait() for parse program %s"; +char* PARSE_ANONFTP_022 = "Parse program %s exited abnormally with code %d"; +char* PARSE_ANONFTP_023 = "Parse program %s terminated abnormally with signal %d"; +char* PARSE_ANONFTP_024 = "Can't rename output file %s"; +char* PARSE_ANONFTP_025 = "Can't unlink input file %s"; +char* PARSE_ANONFTP_026 = "Can't unlink temporary file %s"; +char* PARSE_ANONFTP_027 = "Can't malloc space for argument list"; +char* PARSE_ANONFTP_028 = "Can't rename failed temporary file %s to %s"; +char* PARSE_ANONFTP_029 = "Unable to parse access command in header"; + +/* net_anonftp.c */ + +char* NET_ANONFTP_001 = "Can't open default log file"; +char* NET_ANONFTP_002 = "Can't open log file %s"; +char* NET_ANONFTP_003 = "Error while trying to set master database directory"; +char* NET_ANONFTP_004 = "Error while trying to set anonftp database directory"; +char* NET_ANONFTP_005 = "Error while trying to set host database directory"; +char* NET_ANONFTP_006 = "Error while trying to open anonftp database"; +char* NET_ANONFTP_007 = "Error while trying to open host database"; +char* NET_ANONFTP_008 = "No host specified for output mode"; +char* NET_ANONFTP_009 = "Can't find requested host %s in local primary host database"; +char* NET_ANONFTP_010 = "Can't find requested host %s database %s in local auxiliary host database"; +char* NET_ANONFTP_012 = "Error sending anonftp site file"; +char* NET_ANONFTP_013 = "Error receiving anonftp site file"; +char* NET_ANONFTP_014 = "Broken pipe: remote data transfer process existed prematurely"; + + +char* GET_ANONFTP_SITE_001 = "Error reading header of remote site file"; +char* GET_ANONFTP_SITE_002 = "Error opening local site parser file %s"; +char* GET_ANONFTP_SITE_003 = "Error writing header of local site parser file %s"; +char* GET_ANONFTP_SITE_004 = "Can't open XDR stream for stdin"; +char* GET_ANONFTP_SITE_005 = "Error in translating XDR input. Deleting output file."; +char* GET_ANONFTP_SITE_006 = "Can't rename temporary file %s to %s"; +char* GET_ANONFTP_SITE_007 = "Can't unlink failed transfer file"; +char* GET_ANONFTP_SITE_008 = "Can't open pipe to uncompression program"; +char* GET_ANONFTP_SITE_009 = "Can't dup2 pipe to stdout"; +char* GET_ANONFTP_SITE_010 = "Can't execute uncompression program %s"; +char* GET_ANONFTP_SITE_011 = "Can't fork() for uncompression process"; +char* GET_ANONFTP_SITE_012 = "Can't open incoming pipe"; +char* GET_ANONFTP_SITE_013 = "Can't open XDR stream for fp"; +char* GET_ANONFTP_SITE_014 = "Can't fstat() output file %s"; +char* GET_ANONFTP_SITE_015 = "Transferred %d bytes in %d seconds (%6.2f bytes/sec)"; +char* GET_ANONFTP_SITE_016 = "Input for %s in compressed format"; +char* GET_ANONFTP_SITE_017 = "Input for %s not in compressed format"; +char* GET_ANONFTP_SITE_018 = "Can't open pipe to cat program"; +char* GET_ANONFTP_SITE_019 = "Can't execute cat program %s"; +char* GET_ANONFTP_SITE_020 = "Can't fork() for cat process %s"; + +char* SEND_ANONFTP_SITE_001= "Can't open anonftp database sitefile %s"; +char* SEND_ANONFTP_SITE_002= "Can't mmap anonftp database sitefile %s"; +char* SEND_ANONFTP_SITE_003= "Can't open XDR stream for stdout"; +char* SEND_ANONFTP_SITE_004= "Error translating site file to XDR stream"; +char* SEND_ANONFTP_SITE_005= "Can't open pipe to compression program"; +char* SEND_ANONFTP_SITE_006= "Can't dup2 pipe to stdin"; +char* SEND_ANONFTP_SITE_007= "Can't execute compression program %s"; +char* SEND_ANONFTP_SITE_008= "Can't open outgoing pipe"; +char* SEND_ANONFTP_SITE_009= "Can't open XDR stream for compression ftp"; +char* SEND_ANONFTP_SITE_010= "Can't fork() for compression process"; +char* SEND_ANONFTP_SITE_011= "Error while writing header of output file"; +char* SEND_ANONFTP_SITE_012= "Output for %s in compressed format"; + + +char* COPY_PARSER_TO_XDR_001= "Can't mmap strings file"; +char* COPY_PARSER_TO_XDR_002= "Conversion to XDR stream from raw format failed"; +char* COPY_PARSER_TO_XDR_003= "Conversion of string to XDR opaque type from raw format failed"; +char* COPY_PARSER_TO_XDR_004= "Can't umap strings file"; + +char* COPY_XDR_TO_PARSER_001= "Conversion to raw format from XDR format failed"; +char* COPY_XDR_TO_PARSER_002= "Can't write out parser record %d"; +char* COPY_XDR_TO_PARSER_003= "Conversion of string to parser from XDR format failed for record %d"; +char* COPY_XDR_TO_PARSER_004= "Can't write out parser string %s record %d"; + +/* update_anonftp.c */ + +char* UPDATE_ANONFTP_001 = "Can't open log file %s"; +char* UPDATE_ANONFTP_002 = "Can't open default log file"; +char* UPDATE_ANONFTP_003 = "No input file given"; +char* UPDATE_ANONFTP_004 = "Error while trying to set master database directory"; +char* UPDATE_ANONFTP_005 = "Error while trying to set anonftp database directory"; +char* UPDATE_ANONFTP_006 = "Can't open given input file %s"; +char* UPDATE_ANONFTP_007 = "Can't read header on %s"; +char* UPDATE_ANONFTP_008 = "Error while checking for lockfile %s"; +char* UPDATE_ANONFTP_009 = "Can't open lock file %s"; +char* UPDATE_ANONFTP_010 = "Update for %s (%s) at %s"; +char* UPDATE_ANONFTP_011 = "Giving up after %d tries to update %s"; +char* UPDATE_ANONFTP_012 = "Deleting %s"; +char* UPDATE_ANONFTP_013 = "Can't execvp() delete program %s for %s database"; +char* UPDATE_ANONFTP_014 = "Can't vfork() delete program %s"; +char* UPDATE_ANONFTP_015 = "Error while in wait() for delete program %s"; +char* UPDATE_ANONFTP_016 = "Delete program %s exited with value %u"; +char* UPDATE_ANONFTP_017 = "Delete program %s terminated abnormally with signal %u"; +char* UPDATE_ANONFTP_018 = "Inserting %s into %s with %s"; +char* UPDATE_ANONFTP_019 = "Can't execvp() insert program %s for %s database"; +char* UPDATE_ANONFTP_020 = "Can't vfork() insert program %s"; +char* UPDATE_ANONFTP_021 = "Error while in wait() for insert program %s"; +char* UPDATE_ANONFTP_022 = "Insert program %s exited with value %u"; +char* UPDATE_ANONFTP_023 = "Insert program %s terminated abnormally with signal %d"; +char* UPDATE_ANONFTP_025 = "Error while trying to open host database"; +char* UPDATE_ANONFTP_026 = "Can't get auxiliary database entry for site %s database %s for deletion"; +char* UPDATE_ANONFTP_027 = "Can't write deletion record for %s to auxiliary host database"; +char* UPDATE_ANONFTP_028 = "Waiting for lock file %s"; +char* UPDATE_ANONFTP_029 = "Can't unlink original input file %s"; +char* UPDATE_ANONFTP_030 = "Can't malloc space for argument list"; +char* UPDATE_ANONFTP_031 = "Input file %s has retrieve time older than current entry. Ignoring."; + +/* added on Aug-14-95 to accomodate the set-to-zero change in update_naonftp*/ +char* UPDATE_ANONFTP_032 = "Can't commit fail-count set to Zero for %s to auxiliary host database"; +char* UPDATE_ANONFTP_033 = "Can't get auxiliary database entry for site %s database %s for updating information"; + +/* check_anonftp.c */ + +char* CHECK_ANONFTP_001 = "Can't open default log file"; +char* CHECK_ANONFTP_002 = "Can't open log file %s"; +char* CHECK_ANONFTP_003 = "Error while trying to set master database directory"; +char* CHECK_ANONFTP_004 = "Error while trying to set anonftp database directory"; +char* CHECK_ANONFTP_005 = "Error while trying to set host database directory"; +char* CHECK_ANONFTP_006 = "Error while trying to open anonftp database"; +char* CHECK_ANONFTP_007 = "Error while trying to open host database"; +char* CHECK_ANONFTP_008 = "Can't find host %s in anonftp database"; +char* CHECK_ANONFTP_009 = "Can't malloc space for file list"; +char* CHECK_ANONFTP_010 = "Can't get list of files in directory %s" ; + +char* CHECK_INDIV_001 = "Can't get host address cache entry for %s"; +char* CHECK_INDIV_002 = "Checking site %s (%s)"; +char* CHECK_INDIV_003 = "Ignoring %s"; +char* CHECK_INDIV_004 = "Number of records in site file %s (%s) %d does not match auxiliary host database record %d"; +char* CHECK_INDIV_005 = "Can't malloc space for checklist"; +char* CHECK_INDIV_006 = "Site %s (%s) record %d points to itself!"; +char* CHECK_INDIV_007 = "Site %s (%s) record %d has string %s but is on chain for record %d with string %s"; +char* CHECK_INDIV_008 = "Site %s (%s) record %d has string index %d out of bounds"; +char* CHECK_INDIV_009 = "Site %s (%s) record %d has string %s but is on chain for record %d with string %s"; +char* CHECK_INDIV_010 = "Site %s (%s) rec %d -> rec %d -> site %s rec %d"; +char* CHECK_INDIV_011 = "Site %s (%s) record %d points to next record, out of bounds"; +char* CHECK_INDIV_012 = "Can't mmap strings file"; +char* CHECK_INDIV_013 = "Site %s (%s) record %d points to site file %s record %d"; +char* CHECK_INDIV_014 = "Site %s (%s) record %d points to site file %s record %d out of bounds (max: %d)"; +char* CHECK_INDIV_015 = "Site %s (%s) record %d (string offset: %d \"%s\") points to site file %s record %d (strings offset: %d \"%s\")"; +char* CHECK_INDIV_016 = "Site %s (%s) record %d points to site file %s record %d but not reverse (site %s record %d)"; +char* CHECK_INDIV_017 = "Can't mmap strings index file" ; +char* CHECK_INDIV_018 = "Site %s (%s) rec: %d -> strings id rec: %d out of bounds (max: %d)"; +char* CHECK_INDIV_019 = "Site %s (%s) rec: %d (off: %d \"%s\") -> strings idx rec: %d (off: %d, \"%s\") -> sitefile %s rec: %d"; +char* CHECK_INDIV_020 = "Site %s (%s) rec: %d (offset: %d \"%s\") -> strings index rec: %d -> inactive string (off: %d) \"%s\""; +char* CHECK_INDIV_021 = "Site %s (%s) rec: %d (off: %d \"%s\") -> strings idx rec: %d -> string (off: %d \"%s\")"; +char* CHECK_INDIV_022 = "Site %s (%s) rec %d -> site %s rec %d -> site %s rec %d"; + + + + diff --git a/archie/anonftp/update/lang_anonftp.h b/archie/anonftp/update/lang_anonftp.h new file mode 100644 index 0000000..74c1a3e --- /dev/null +++ b/archie/anonftp/update/lang_anonftp.h @@ -0,0 +1,291 @@ +/* + * This file is copyright Bunyip Information Systems Inc., 1993. This file + * may not be reproduced, copied or transmitted by any means mechanical or + * electronic without the express written consent of Bunyip Information + * Systems Inc. + */ + + +#ifndef _LANG_ANONFTP_H_ +#define _LANG_ANONFTP_H_ + +extern char* INSERT_ANONFTP_001; +extern char* INSERT_ANONFTP_002; +extern char* INSERT_ANONFTP_003; +extern char* INSERT_ANONFTP_004; +extern char* INSERT_ANONFTP_005; +extern char* INSERT_ANONFTP_006; +extern char* INSERT_ANONFTP_007; +extern char* INSERT_ANONFTP_008; +extern char* INSERT_ANONFTP_009; +extern char* INSERT_ANONFTP_010; +extern char* INSERT_ANONFTP_011; +extern char* INSERT_ANONFTP_012; +extern char* INSERT_ANONFTP_013; +extern char* INSERT_ANONFTP_014; +extern char* INSERT_ANONFTP_015; +extern char* INSERT_ANONFTP_016; +extern char* INSERT_ANONFTP_017; +extern char* INSERT_ANONFTP_018; +extern char* INSERT_ANONFTP_019; +extern char* INSERT_ANONFTP_020; +extern char* INSERT_ANONFTP_021; +extern char* INSERT_ANONFTP_022; +extern char* INSERT_ANONFTP_023; +extern char* INSERT_ANONFTP_024; +extern char* INSERT_ANONFTP_025; +extern char* INSERT_ANONFTP_026; +extern char* INSERT_ANONFTP_027; +extern char* INSERT_ANONFTP_028; +extern char* INSERT_ANONFTP_029; +extern char* INSERT_ANONFTP_030; + +extern char* SETUP_OUTPUT_FILE_001; +extern char* SETUP_OUTPUT_FILE_002; +extern char* SETUP_OUTPUT_FILE_003; +extern char* SETUP_OUTPUT_FILE_004; +extern char* SETUP_OUTPUT_FILE_005; +extern char* SETUP_OUTPUT_FILE_006; + + +/* setup_insert.c */ + + +extern char* ADD_TMP_STRING_001 ; + +extern char* SETUP_HASH_TABLE_001 ; + +extern char* SETUP_INSERT_001 ; +extern char* SETUP_INSERT_002 ; +extern char* SETUP_INSERT_003 ; +extern char* SETUP_INSERT_004 ; +extern char* SETUP_INSERT_005 ; +extern char* SETUP_INSERT_006 ; + +extern char* DO_INTERNAL_001 ; +extern char* DO_INTERNAL_002 ; +extern char* DO_INTERNAL_003 ; + +extern char* MAKE_LINKS_001 ; +extern char* MAKE_LINKS_002 ; +extern char* MAKE_LINKS_003 ; +extern char* MAKE_LINKS_004 ; +extern char* MAKE_LINKS_005 ; +extern char* MAKE_LINKS_006 ; +extern char* MAKE_LINKS_007 ; +extern char* MAKE_LINKS_008 ; +extern char* MAKE_LINKS_009 ; +extern char* MAKE_LINKS_010 ; +extern char* MAKE_LINKS_011 ; +extern char* MAKE_LINKS_012 ; +extern char* MAKE_LINKS_013 ; +extern char* MAKE_LINKS_014 ; +extern char* MAKE_LINKS_015 ; +extern char* MAKE_LINKS_016 ; +extern char* MAKE_LINKS_017 ; +extern char* MAKE_LINKS_018 ; +extern char* MAKE_LINKS_019 ; + +/* delete.c */ + +extern char* DELETE_ANONFTP_001 ; +extern char* DELETE_ANONFTP_002; +extern char* DELETE_ANONFTP_003; +extern char* DELETE_ANONFTP_004 ; +extern char* DELETE_ANONFTP_005 ; +extern char* DELETE_ANONFTP_006 ; +extern char* DELETE_ANONFTP_007 ; +extern char* DELETE_ANONFTP_008 ; +extern char* DELETE_ANONFTP_009 ; +extern char* DELETE_ANONFTP_010 ; +extern char* DELETE_ANONFTP_011 ; +extern char* DELETE_ANONFTP_012 ; +extern char* DELETE_ANONFTP_013 ; +extern char* DELETE_ANONFTP_014 ; + +/* setup_delete.c */ + +extern char* SETUP_DELETE_001 ; +extern char* SETUP_DELETE_002 ; +extern char* SETUP_DELETE_003 ; +extern char* SETUP_DELETE_004 ; +extern char* SETUP_DELETE_005 ; +extern char* SETUP_DELETE_006 ; +extern char* SETUP_DELETE_007 ; +extern char* SETUP_DELETE_008 ; +extern char* SETUP_DELETE_009 ; +extern char* SETUP_DELETE_010 ; +extern char* SETUP_DELETE_011 ; +extern char* SETUP_DELETE_012 ; +extern char* SETUP_DELETE_013 ; +extern char* SETUP_DELETE_014 ; +extern char* SETUP_DELETE_015 ; + +/* parse_anonftp.c */ + +extern char* PARSE_ANONFTP_001 ; +extern char* PARSE_ANONFTP_002 ; +extern char* PARSE_ANONFTP_003 ; +extern char* PARSE_ANONFTP_004 ; +extern char* PARSE_ANONFTP_005 ; +extern char* PARSE_ANONFTP_006 ; +extern char* PARSE_ANONFTP_007 ; +extern char* PARSE_ANONFTP_008 ; +extern char* PARSE_ANONFTP_009 ; +extern char* PARSE_ANONFTP_010 ; +extern char* PARSE_ANONFTP_011 ; +extern char* PARSE_ANONFTP_012 ; +extern char* PARSE_ANONFTP_013 ; +extern char* PARSE_ANONFTP_014 ; +extern char* PARSE_ANONFTP_015 ; +extern char* PARSE_ANONFTP_016 ; +extern char* PARSE_ANONFTP_017 ; +extern char* PARSE_ANONFTP_018 ; +extern char* PARSE_ANONFTP_019 ; +extern char* PARSE_ANONFTP_020 ; +extern char* PARSE_ANONFTP_021 ; +extern char* PARSE_ANONFTP_022 ; +extern char* PARSE_ANONFTP_023 ; +extern char* PARSE_ANONFTP_024 ; +extern char* PARSE_ANONFTP_025 ; +extern char* PARSE_ANONFTP_026 ; +extern char* PARSE_ANONFTP_027 ; +extern char* PARSE_ANONFTP_028 ; +extern char* PARSE_ANONFTP_029 ; + +/* net_anonftp.c */ + +extern char* NET_ANONFTP_001 ; +extern char* NET_ANONFTP_002 ; +extern char* NET_ANONFTP_003 ; +extern char* NET_ANONFTP_004 ; +extern char* NET_ANONFTP_005 ; +extern char* NET_ANONFTP_006 ; +extern char* NET_ANONFTP_007 ; +extern char* NET_ANONFTP_008 ; +extern char* NET_ANONFTP_009 ; +extern char* NET_ANONFTP_010 ; +extern char* NET_ANONFTP_011 ; +extern char* NET_ANONFTP_012 ; +extern char* NET_ANONFTP_013 ; +extern char* NET_ANONFTP_014 ; + +extern char* GET_ANONFTP_SITE_001 ; +extern char* GET_ANONFTP_SITE_002 ; +extern char* GET_ANONFTP_SITE_003 ; +extern char* GET_ANONFTP_SITE_004 ; +extern char* GET_ANONFTP_SITE_005 ; +extern char* GET_ANONFTP_SITE_006 ; +extern char* GET_ANONFTP_SITE_007 ; +extern char* GET_ANONFTP_SITE_008 ; +extern char* GET_ANONFTP_SITE_009 ; +extern char* GET_ANONFTP_SITE_010 ; +extern char* GET_ANONFTP_SITE_011 ; +extern char* GET_ANONFTP_SITE_012 ; +extern char* GET_ANONFTP_SITE_013 ; +extern char* GET_ANONFTP_SITE_014 ; +extern char* GET_ANONFTP_SITE_015 ; +extern char* GET_ANONFTP_SITE_016 ; +extern char* GET_ANONFTP_SITE_017 ; +extern char* GET_ANONFTP_SITE_018 ; +extern char* GET_ANONFTP_SITE_019 ; +extern char* GET_ANONFTP_SITE_020 ; + + +extern char* SEND_ANONFTP_SITE_001; +extern char* SEND_ANONFTP_SITE_002; +extern char* SEND_ANONFTP_SITE_003; +extern char* SEND_ANONFTP_SITE_004; +extern char* SEND_ANONFTP_SITE_005; +extern char* SEND_ANONFTP_SITE_006; +extern char* SEND_ANONFTP_SITE_007; +extern char* SEND_ANONFTP_SITE_008; +extern char* SEND_ANONFTP_SITE_009; +extern char* SEND_ANONFTP_SITE_010; +extern char* SEND_ANONFTP_SITE_011; +extern char* SEND_ANONFTP_SITE_012; + +extern char* COPY_PARSER_TO_XDR_001; +extern char* COPY_PARSER_TO_XDR_002; +extern char* COPY_PARSER_TO_XDR_003; +extern char* COPY_PARSER_TO_XDR_004; + +extern char* COPY_XDR_TO_PARSER_001; +extern char* COPY_XDR_TO_PARSER_002; +extern char* COPY_XDR_TO_PARSER_003; +extern char* COPY_XDR_TO_PARSER_004; + +/* update_anonftp.c */ + +extern char* UPDATE_ANONFTP_001 ; +extern char* UPDATE_ANONFTP_002 ; +extern char* UPDATE_ANONFTP_003 ; +extern char* UPDATE_ANONFTP_004 ; +extern char* UPDATE_ANONFTP_005 ; +extern char* UPDATE_ANONFTP_006 ; +extern char* UPDATE_ANONFTP_007 ; +extern char* UPDATE_ANONFTP_008 ; +extern char* UPDATE_ANONFTP_009 ; +extern char* UPDATE_ANONFTP_010 ; +extern char* UPDATE_ANONFTP_011 ; +extern char* UPDATE_ANONFTP_012 ; +extern char* UPDATE_ANONFTP_013 ; +extern char* UPDATE_ANONFTP_014 ; +extern char* UPDATE_ANONFTP_015 ; +extern char* UPDATE_ANONFTP_016 ; +extern char* UPDATE_ANONFTP_017 ; +extern char* UPDATE_ANONFTP_018 ; +extern char* UPDATE_ANONFTP_019 ; +extern char* UPDATE_ANONFTP_020 ; +extern char* UPDATE_ANONFTP_021 ; +extern char* UPDATE_ANONFTP_022 ; +extern char* UPDATE_ANONFTP_023 ; +extern char* UPDATE_ANONFTP_024 ; +extern char* UPDATE_ANONFTP_025 ; +extern char* UPDATE_ANONFTP_026 ; +extern char* UPDATE_ANONFTP_027 ; +extern char* UPDATE_ANONFTP_028 ; +extern char* UPDATE_ANONFTP_029 ; +extern char* UPDATE_ANONFTP_030 ; +extern char* UPDATE_ANONFTP_031 ; + +extern char* UPDATE_ANONFTP_032 ; +extern char* UPDATE_ANONFTP_033 ; + +/* check_anonftp.c */ + +extern char* CHECK_ANONFTP_001 ; +extern char* CHECK_ANONFTP_002 ; +extern char* CHECK_ANONFTP_003 ; +extern char* CHECK_ANONFTP_004 ; +extern char* CHECK_ANONFTP_005 ; +extern char* CHECK_ANONFTP_006 ; +extern char* CHECK_ANONFTP_007 ; +extern char* CHECK_ANONFTP_008 ; +extern char* CHECK_ANONFTP_009 ; +extern char* CHECK_ANONFTP_010 ; + +extern char* CHECK_INDIV_001 ; +extern char* CHECK_INDIV_002 ; +extern char* CHECK_INDIV_003 ; +extern char* CHECK_INDIV_004 ; +extern char* CHECK_INDIV_005 ; +extern char* CHECK_INDIV_006 ; +extern char* CHECK_INDIV_007 ; +extern char* CHECK_INDIV_008 ; +extern char* CHECK_INDIV_009 ; +extern char* CHECK_INDIV_010 ; +extern char* CHECK_INDIV_011 ; +extern char* CHECK_INDIV_012 ; +extern char* CHECK_INDIV_013 ; +extern char* CHECK_INDIV_014 ; +extern char* CHECK_INDIV_015 ; +extern char* CHECK_INDIV_016 ; +extern char* CHECK_INDIV_017 ; +extern char* CHECK_INDIV_018 ; +extern char* CHECK_INDIV_019 ; +extern char* CHECK_INDIV_020 ; +extern char* CHECK_INDIV_021 ; +extern char* CHECK_INDIV_022 ; + +#endif diff --git a/archie/anonftp/update/net_anonftp.c b/archie/anonftp/update/net_anonftp.c new file mode 100644 index 0000000..4ff4ea2 --- /dev/null +++ b/archie/anonftp/update/net_anonftp.c @@ -0,0 +1,1427 @@ +/* + * This file is copyright Bunyip Information Systems Inc., 1993. This file + * may not be reproduced, copied or transmitted by any means mechanical or + * electronic without the express written consent of Bunyip Information + * Systems Inc. + */ + + + +#include +#include +#include +#include +#include +#include +#include +#include +#if defined(AIX) || defined(SOLARIS) +#include +#endif +#include +#include +#include +#ifdef AIX +#include +#include +#endif + +#include "protos.h" +#include "typedef.h" +#include "db_ops.h" +#include "host_db.h" +#include "parser_file.h" + +#include "core_entry.h" +#include "site_file.h" + +#include "start_db.h" + +#include "patrie.h" +#include "archstridx.h" + +#include "header.h" +#include "error.h" +#include "files.h" +#include "master.h" +#include "archie_dbm.h" +#include "archie_strings.h" +#include "net_anonftp.h" +#include "db_files.h" +#include "archie_xdr.h" +#include "lang_anonftp.h" + +extern int errno; +/* + * net_anonftp: this program is responsible for inter-archie transmission + * of anonftp database files. It is not normally invoked manually. This + * program can both transmit and receive data, which is transmitted in Sun + * XDR format to allow inter-architecture communications + + argv, argc are used. + + + Parameters: -I + -O + -p + -w + -M + -h + -l write to log file (default) + -L + -v verbose + + */ + +/* this has to be here so that the signal handler can see it */ + +file_info_t *sitefile = (file_info_t *) NULL; + +int verbose = 0; +int timeout = 900; + +char *prog; + +static int rec_number = 0; + +static void sig_alarm(num) + int num; +{ + static last_rec_number = 0; + + if ( last_rec_number == rec_number ) { + error(A_ERR,"net_anonftp","Timeout of %d seconds expired", timeout); + exit(ERROR); + } + + alarm(timeout); + signal(SIGALRM,sig_alarm); + last_rec_number = rec_number; +} + + +int main(argc, argv) + int argc; + char *argv[]; + +{ +#ifndef __STDC__ + + extern int getopt(); + extern status_t get_port(); + +#endif + + extern char *optarg; + + char **cmdline_ptr; + int cmdline_args; + + int option; + + /* Directories */ + + pathname_t files_database_dir; + pathname_t start_database_dir; + pathname_t master_database_dir; + pathname_t host_database_dir; + + hostname_t io_host; + + hostdb_t hostdb_ent; + hostdb_aux_t hostaux_ent; + header_t header_rec; + + pathname_t tmp_string; + pathname_t logfile; + + pathname_t compress_pgm; + + file_info_t *hostdb = create_finfo(); + file_info_t *hostaux_db = create_finfo(); + + file_info_t *start_db = create_finfo(); + file_info_t *domain_db = create_finfo(); + + int output_mode = 1; + + format_t outhdr = FXDR; + + struct arch_stridx_handle *strhan; + char *dbdir; + + int logging = 0; + int port = 0; + + prog = argv[0]; + files_database_dir[0] = host_database_dir[0] = master_database_dir[0] = start_database_dir[0] = '\0'; + compress_pgm[0] = logfile[0] = '\0'; + + cmdline_ptr = argv + 1; + cmdline_args = argc - 1; + + while((option = (int) getopt(argc, argv, "w:i:p:M:h:IO:lL:cvt:n:")) != EOF){ + + switch(option){ + + /* Input mode */ + + case 'I': + output_mode = 0; + cmdline_ptr++; + cmdline_args--; + break; + + /* Log filename */ + + case 'L': + strcpy(logfile, optarg); + logging = 1; + cmdline_ptr += 2; + cmdline_args -= 2; + break; + + /* port of the site */ + + case 'p': + port = atoi(optarg); + cmdline_ptr += 2; + cmdline_args -= 2; + break; + + /* Master database directory */ + + case 'M': + strcpy(master_database_dir,optarg); + cmdline_ptr += 2; + cmdline_args -= 2; + break; + + /* Output mode */ + + case 'O': + strcpy(io_host,optarg); + output_mode = 1; + cmdline_ptr += 2; + cmdline_args -= 2; + break; + + /* use compress(1) on outgoing data */ + + case 'c': + strcpy(compress_pgm, COMPRESS_PGM); + outhdr = FXDR_COMPRESS_LZ; + cmdline_ptr++; + cmdline_args--; + break; + + /* host database directory name */ + + case 'h': + strcpy(host_database_dir,optarg); + cmdline_ptr += 2; + cmdline_args -= 2; + break; + + /* Log process, default file */ + + case 'l': + logging = 1; + cmdline_ptr++; + cmdline_args--; + break; + + /* Verbose mode */ + + case 'v': + verbose = 1; + cmdline_ptr++; + cmdline_args--; + break; + + case 'n': + cmdline_ptr += 2; + cmdline_args -= 2; + break; + + /* anonftp database directory name */ + + case 'w': + strcpy(files_database_dir,optarg); + cmdline_ptr += 2; + cmdline_args -= 2; + break; + + /* Timeout in seconds */ + case 't': + timeout = atoi(optarg); + cmdline_ptr += 2; + cmdline_args -= 2; + break; + + } + } + + /* set up logs */ +sleep(30); + + if(logging){ + if(logfile[0] == '\0'){ + if(open_alog((char *) NULL, A_INFO, tail(argv[0])) == ERROR){ + + /* "Can't open default log file" */ + + error(A_ERR, "parse_anonftp", NET_ANONFTP_001); + exit(ERROR); + } + } + else{ + if(open_alog(logfile, A_INFO, tail(argv[0])) == ERROR){ + + /* "Can't open log file %s" */ + + error(A_ERR, "parse_anonftp", NET_ANONFTP_002, logfile); + exit(ERROR); + } + } + } + + if(port==0){ + + /* "No port number given" */ + + /* error(A_ERR,"net_anonftp","No port number given"); */ + if( get_port((char *)NULL, ANONFTP_DB_NAME, &port ) == ERROR ){ + error(A_ERR,"get_port","Could not get port for site"); + exit(A_OK); + } + } + + if(set_master_db_dir(master_database_dir) == (char *) NULL){ + + /* "Error while trying to set master database directory" */ + + error(A_ERR, "net_anonftp", NET_ANONFTP_003); + exit(ERROR); + } + + if((dbdir = set_files_db_dir(files_database_dir)) == (char *) NULL){ + + /* "Error while trying to set anonftp database directory" */ + + error(A_ERR, "net_anonftp", NET_ANONFTP_004); + exit(ERROR); + } + + if((set_start_db_dir(start_database_dir,DEFAULT_FILES_DB_DIR)) == (char *) NULL){ + + /* "Error while trying to set start database directory" */ + + error(A_ERR, "net_anonftp", "Error while trying to set start database directory\n"); + exit(A_OK); + } + + if(set_host_db_dir(host_database_dir) == (char *) NULL){ + + /* "Error while trying to set host database directory" */ + + error(A_ERR, "net_anonftp", NET_ANONFTP_005); + exit(ERROR); + } + + /* Open other files database files */ + + if ( output_mode ) { + + if ( open_start_dbs(start_db,domain_db,O_RDONLY ) == ERROR && output_mode) { + + /* "Can't open start/host database" */ + + error(A_ERR, "net_anonftp", "Can't open start/host database"); + exit(ERROR); + } + + if ( !(strhan = archNewStrIdx()) ) { + if ( output_mode ) { + error( A_ERR, "net_anonftp", "Could create string handler" ); + exit(ERROR); + } + } + + if ( !archOpenStrIdx( strhan, dbdir, ARCH_STRIDX_SEARCH ) ) + { + if ( output_mode ) { + error( A_ERR, "net_anonftp", "Could not find strings_idx files" ); + exit(ERROR); + } + } + + } + + if(open_host_dbs((file_info_t *) NULL, hostdb, (file_info_t *) NULL, hostaux_db,O_RDWR) == ERROR){ + + /* "Error while trying to open host database" */ + + error(A_ERR, "net_anonftp", NET_ANONFTP_007); + exit(ERROR); + } + + /*fprintf(stderr,"sleeping zzz\n"); + sleep(15); + */ + if(output_mode){ + + + signal(SIGPIPE, sig_handle); + + if(io_host[0] == '\0'){ + + /* "No host specified for output mode" */ + + error(A_ERR,"net_anonftp", NET_ANONFTP_008); + exit(ERROR); + } + + header_rec.header_flags = 0; + HDR_HOSTDB_ALSO(header_rec.header_flags); + HDR_HOSTAUX_ALSO(header_rec.header_flags); + + HDR_SET_UPDATE_STATUS(header_rec.header_flags); + + + if(get_dbm_entry(make_lcase(io_host), strlen(io_host) + 1, &hostdb_ent, hostdb) == ERROR){ + + /* "Can't find requested host %s in local primary host database" */ + + error(A_ERR,"net_anonftp", NET_ANONFTP_009, io_host); + header_rec.update_status = FAIL; + } + + sprintf(tmp_string,"%s.%s.0",hostdb_ent.primary_hostname, ANONFTP_DB_NAME); + + if(get_dbm_entry(tmp_string, strlen(tmp_string) + 1, &hostaux_ent, hostaux_db) == ERROR){ + + /* "Can't find requested host %s database %s in local auxiliary host database" */ + + error(A_ERR,"net_anonftp", NET_ANONFTP_010, hostdb_ent.primary_hostname, ANONFTP_DB_NAME); + header_rec.update_status = FAIL; + } + hostaux_ent.origin = NULL; + set_aux_origin(&hostaux_ent, ANONFTP_DB_NAME, 0); + + /* if the host is "ACTIVE" and the data file does not + exist in the anonftp directory mark it as FAIL */ + + if((hostaux_ent.current_status == ACTIVE) + && (access(files_db_filename(inet_ntoa(ipaddr_to_inet(hostdb_ent.primary_ipaddr)),port), R_OK | F_OK) == -1)) + header_rec.update_status = FAIL; + else + header_rec.update_status = SUCCEED; + + + make_header_hostdb_entry(&header_rec,&hostdb_ent,0); + make_header_hostaux_entry(&header_rec,&hostaux_ent,0); + + if((hostaux_ent.current_status == DEL_BY_ARCHIE) || + (hostaux_ent.current_status == DEL_BY_ADMIN) || + (hostaux_ent.current_status == DELETED)){ + + header_rec.no_recs = 0; + header_rec.site_no_recs = 0; + } + + /* set the output header to whatever is the current method */ + + header_rec.format = outhdr; + HDR_SET_FORMAT(header_rec.header_flags); + + header_rec.generated_by = SERVER; + HDR_SET_GENERATED_BY(header_rec.header_flags); + + /* set the header only to reflect the database name for this database */ + + strcpy(header_rec.access_methods,ANONFTP_DB_NAME); + + if(send_anonftp_site( hostdb_ent.primary_ipaddr, &header_rec, &hostaux_ent, outhdr, compress_pgm, strhan) == ERROR){ + + /* "Error sending anonftp site file" */ + + error(A_ERR, "net_anonftp", NET_ANONFTP_012); + exit(ERROR); + } + + } + else{ /* Input mode */ + + signal(SIGHUP, sig_handle); + + + if(get_anonftp_site(hostdb, hostaux_db ) == ERROR){ + + /* "Error receiving anonftp site file" */ + + error(A_ERR, "net_anonftp", NET_ANONFTP_013); + exit(errno); + } + } + + if ( output_mode ) { + close_start_dbs(start_db,domain_db); + archCloseStrIdx(strhan); + archFreeStrIdx(&strhan); + } + + exit(A_OK); + return(A_OK); +} + +/* + * get_anonftp_site: receive the site file from a remote process and write + * it out + */ + + +status_t get_anonftp_site(hostdb, hostaux_db) + file_info_t *hostdb; + file_info_t *hostaux_db; + +{ + + header_t header_rec; + XDR *xdrs; + hostdb_t hostdb_ent; + hostdb_aux_t hostaux_ent; + pathname_t hostaux_name; + pathname_t tmp_filename; + int finished, num_suff; + format_t origformat; + int retcode; + int p[2]; + FILE *fp; + int statusp; + time_t start_time; + time_t end_time; + struct stat statbuf; + + ptr_check(hostdb, file_info_t, "get_anonftp_site", ERROR); + ptr_check(hostaux_db, file_info_t, "get_anonftp_site", ERROR); + + hostaux_ent.origin = NULL; + + if(sitefile == (file_info_t *) NULL) + sitefile = create_finfo(); + + if(read_header(stdin, &header_rec, (u32 *) NULL,1,1) == ERROR){ + + /* "Error reading header of remote site file" */ + + error(A_ERR, "get_anonftp_site", GET_ANONFTP_SITE_001); + return(ERROR); + } + + if(header_rec.update_status == FAIL) + return(A_OK); + + /* Try and randomize things a little */ + + srand(time((time_t *) NULL)); + rand(); rand(); + + for(finished = 0; !finished;){ + + sprintf(sitefile -> filename,"%s/%s/%s-%s_%d%s%s", get_master_db_dir(), DEFAULT_TMP_DIR, header_rec.primary_hostname, header_rec.access_methods, (num_suff = rand() % 100), SUFFIX_UPDATE,TMP_SUFFIX); + + if(access(sitefile -> filename, R_OK | F_OK) == -1) + finished = 1; + } + + /* This may not be necessary */ + + + /* Check to see if the host already is in the local database */ + + if(get_dbm_entry(header_rec.primary_hostname, + strlen(header_rec.primary_hostname) + 1, &hostdb_ent, hostdb) == ERROR){ + + header_rec.action_status = NEW; + HDR_SET_ACTION_STATUS(header_rec.header_flags); + + } + else{ + + sprintf(hostaux_name,"%s.%s.0", header_rec.primary_hostname, header_rec.access_methods); + + if(get_dbm_entry(hostaux_name, + strlen(hostaux_name) + 1, &hostaux_ent, hostaux_db) == ERROR){ + + header_rec.action_status = NEW; + HDR_SET_ACTION_STATUS(header_rec.header_flags); + hostaux_ent.origin = NULL; + set_aux_origin(&hostaux_ent,ANONFTP_DB_NAME, -1 ); + } + else{ + + header_rec.action_status = UPDATE; + HDR_SET_ACTION_STATUS(header_rec.header_flags); + hostaux_ent.origin = NULL; + set_aux_origin(&hostaux_ent,ANONFTP_DB_NAME, 0 ); + } + } + + + if(open_file(sitefile, O_WRONLY) == ERROR){ + + /* "Error opening local site parser file %s" */ + + error(A_ERR, "get_anonftp_site", GET_ANONFTP_SITE_002, sitefile -> filename); + return(ERROR); + } + + origformat = header_rec.format; + + header_rec.format = FRAW; + HDR_SET_FORMAT(header_rec.header_flags); + + if(write_header( sitefile -> fp_or_dbm.fp, &header_rec, (u32 *) NULL, 0, 0) == ERROR){ + + /* "Error writing header of local site parser file %s" */ + + error(A_ERR, "get_anonftp_site", GET_ANONFTP_SITE_003, sitefile -> filename); + return(ERROR); + } + + /* if the record is a deletion, then just rename the file and finish */ + + + if((header_rec.current_status == DEL_BY_ARCHIE) || + (header_rec.current_status == DEL_BY_ADMIN) || + (header_rec.current_status == DELETED)){ + + sprintf(tmp_filename,"%s/%s/%s-%s_%d%s", get_master_db_dir(), DEFAULT_TMP_DIR, header_rec.primary_hostname, header_rec.access_methods, num_suff, SUFFIX_UPDATE); + + if(rename(sitefile -> filename, tmp_filename) == -1){ + + /* "Can't rename temporary file %s to %s" */ + + error(A_SYSERR,"get_anonftp_site", GET_ANONFTP_SITE_006, sitefile -> filename, tmp_filename); + return(ERROR); + } + + exit(A_OK); + } + + if(origformat == FXDR_COMPRESS_LZ) { + + if(verbose){ + + /* "Input for %s in compressed format" */ + + error(A_INFO, "get_anonftp_site", GET_ANONFTP_SITE_016, header_rec.primary_hostname); + } + + if(pipe(p) == -1){ + + /* "Can't open pipe to uncompression program" */ + + error(A_ERR,"get_anonftp_site", GET_ANONFTP_SITE_008); + return(ERROR); + } + + if((retcode = fork()) == 0){ + + if(dup2(p[1], 1) == -1){ + + /* "Can't dup2 pipe to stdout" */ + + error(A_ERR, "get_anonftp_site", GET_ANONFTP_SITE_009); + exit(ERROR); + } + + close(p[0]); + + execl(UNCOMPRESS_PGM, UNCOMPRESS_PGM, (char *) 0); + + /* "Can't execute uncompression program %s" */ + + error(A_ERR, "get_anonftp_site", GET_ANONFTP_SITE_010, UNCOMPRESS_PGM); + exit(ERROR); + } + else{ + if(retcode == -1){ + + /* "Can't fork() for uncompression process" */ + + error(A_ERR, "get_anonftp_file", GET_ANONFTP_SITE_011); + return(ERROR); + } + } + + close(p[1]); + + if((fp = fdopen(p[0], "r")) == (FILE *) NULL){ + + /* "Can't open incoming pipe" */ + + error(A_ERR, "get_anonftp_site", GET_ANONFTP_SITE_012); + return(ERROR); + } + + + if((xdrs = open_xdr_stream(fp, XDR_DECODE)) == (XDR *) NULL){ + + /* "Can't open XDR stream for fp" */ + + error(A_ERR, "get_anonftp_site", GET_ANONFTP_SITE_013); + return(ERROR); + } + + } else { /* Not compressed; only XDR */ + + if(verbose){ + /* "Input for %s not in compressed format" */ + error(A_INFO, "get_anonftp_site", GET_ANONFTP_SITE_017, header_rec.primary_hostname); + } +#if 0 + /* This section of code is not required. - lucb */ + if(pipe(p) == -1){ + + /* "Can't open pipe to cat program" */ + + error(A_ERR,"get_anonftp_site", GET_ANONFTP_SITE_018); + return(ERROR); + } + + if((retcode = fork()) == 0){ + + if(dup2(p[1], 1) == -1){ + + /* "Can't dup2 pipe to stdout" */ + + error(A_ERR, "get_anonftp_site", GET_ANONFTP_SITE_009); + exit(ERROR); + } + + close(p[0]); + + execl(CAT_PGM, CAT_PGM, (char *) 0); + + /* "Can't execute cat program %s" */ + + error(A_ERR, "get_anonftp_site", GET_ANONFTP_SITE_019, CAT_PGM); + exit(ERROR); + } else { + if(retcode == -1){ + + /* "Can't fork() for cat process" */ + + error(A_ERR, "get_anonftp_file", GET_ANONFTP_SITE_020); + return(ERROR); + } + } + + close(p[1]); + + if((fp = fdopen(p[0], "r")) == (FILE *) NULL){ + + /* "Can't open incoming pipe" */ + + error(A_ERR, "get_anonftp_site", GET_ANONFTP_SITE_012); + return(ERROR); + } + +#endif + + if((xdrs = open_xdr_stream(stdin, XDR_DECODE)) == (XDR *) NULL){ + + /* "Can't open XDR stream for stdin" */ + + error(A_ERR, "get_anonftp_site", GET_ANONFTP_SITE_004); + return(ERROR); + } + } + + start_time = time((time_t *) NULL); + + if(copy_xdr_to_parser( xdrs, sitefile, header_rec.no_recs) == ERROR){ + + /* "Error in translating XDR input. Deleting output file." */ + + error(A_ERR, "get_anonftp_site", GET_ANONFTP_SITE_005); + + + if(unlink(sitefile -> filename) == -1){ + + /* "Can't unlink failed transfer file" */ + + error(A_SYSERR, "get_anonftp_site", GET_ANONFTP_SITE_007); + return(ERROR); + } + + if ((origformat != FXDR) && (waitpid(-1, &statusp, WNOHANG) == -1)){ + + error(A_ERR, "copy_xdr_to_parser", "Auxiliary program exited with %d", WEXITSTATUS(statusp)); + + if(WTERMSIG(statusp)) + error(A_ERR, "copy_xdr_to_parser", "Auxiliary program exited with signal %d", WTERMSIG(statusp)); + } + + return(A_OK); + } + + if((origformat != FXDR) && (waitpid(-1, &statusp, WNOHANG) == -1)){ + + error(A_ERR, "copy_xdr_to_parser", "Auxiliary program exited with %d", WEXITSTATUS(statusp)); + + if(WTERMSIG(statusp)) + error(A_ERR, "copy_xdr_to_parser", "Auxiliyar program exited with signal %d", WTERMSIG(statusp)); + } + + sprintf(tmp_filename,"%s/%s/%s-%s_%d%s", get_master_db_dir(), DEFAULT_TMP_DIR, header_rec.primary_hostname, header_rec.access_methods, num_suff, SUFFIX_UPDATE); + + if(verbose){ + double bps; + + if(fstat(fileno(sitefile -> fp_or_dbm.fp), &statbuf) == -1){ + + /* "Can't fstat() output file %s" */ + + error(A_SYSERR, "get_anonftp_site", GET_ANONFTP_SITE_014, sitefile -> filename); + } + + /* "Tranferred %d bytes in %d seconds (%6.2f bytes/sec)" */ + + bps = (double) statbuf.st_size / ((end_time = time((time_t *) NULL)) - start_time); + + error(A_INFO, "get_anonftp_site", GET_ANONFTP_SITE_015, statbuf.st_size, end_time - start_time, bps); + } + + + + close_file(sitefile); + + if(rename(sitefile -> filename, tmp_filename) == -1){ + + /* "Can't rename temporary file %s to %s" */ + + error(A_SYSERR,"get_anonftp_site", GET_ANONFTP_SITE_006, sitefile -> filename, tmp_filename); + return(ERROR); + } + + close_xdr_stream(xdrs); /* Wasn't xdr malloc'd? -lucb */ + destroy_finfo(sitefile); + + return(A_OK); +} + + + +/* + * send_anonftp: Open the anonftp site file specified by siteaddr and + * convert it to an XDR stream on stdout + */ + + +status_t send_anonftp_site(siteaddr, header_rec, hostaux_ent, outhdr, compress_pgm, strhan) + ip_addr_t siteaddr; /* address of site to be opened */ + header_t *header_rec; /* header record */ + hostdb_aux_t *hostaux_ent; + format_t outhdr; /* outgoing format */ + char *compress_pgm; /* Compression program */ + struct arch_stridx_handle *strhan; +{ + XDR *xdrs; + FILE *fp; + int retcode; + int p[2]; + int no_recs; + int port; + + no_recs = header_rec -> no_recs; + + if( get_port( header_rec->access_command, ANONFTP_DB_NAME, &port ) == ERROR ){ + error(A_ERR,"insert_anonftp","Could not find the port for this site", header_rec->primary_hostname); + exit(A_OK); + } + + sitefile = create_finfo(); + + /* Open apropriate site file */ + + strcpy(sitefile -> filename, files_db_filename(inet_ntoa(ipaddr_to_inet(siteaddr)),port)); + + if(open_file(sitefile, O_RDONLY) == ERROR){ + + /* "Can't open anonftp database sitefile %s" */ + + error(A_ERR,"send_anonftp_site", SEND_ANONFTP_SITE_001, sitefile -> filename); + header_rec -> update_status = FAIL; + } + else{ + if(mmap_file(sitefile, O_RDONLY) == ERROR){ + + /* "Can't mmap anonftp database sitefile %s" */ + + error(A_ERR,"send_anonftp_site", SEND_ANONFTP_SITE_002, sitefile -> filename); + header_rec -> update_status = FAIL; + } + } + + if(write_header(stdout, header_rec, (u32 *) NULL, 0,0) == ERROR){ + + /* "Error while writing header of output file" */ + + error(A_ERR, "send_anonftp_site", SEND_ANONFTP_SITE_011); + return(ERROR); + } + + if((hostaux_ent -> current_status == DEL_BY_ARCHIE) || + (hostaux_ent -> current_status == DEL_BY_ADMIN) || + (hostaux_ent -> current_status == DELETED) || + (header_rec -> update_status == FAIL)){ + + return(A_OK); + } + + if(outhdr != FXDR){ + + if(verbose){ + + /* "Output for %s in compressed format" */ + + error(A_INFO, "send_anonftp_site", SEND_ANONFTP_SITE_012, header_rec -> primary_hostname); + } + + if(pipe(p) == -1){ + + /* "Can't open pipe to compression program" */ + + error(A_ERR,"send_anonftp_site", SEND_ANONFTP_SITE_005); + return(ERROR); + } + + if((retcode = fork()) == 0){ + + if(dup2(p[0], fileno(stdin)) == -1){ + + /* "Can't dup2 pipe to stdin" */ + + error(A_ERR, "send_anonftp_site", SEND_ANONFTP_SITE_006); + exit(ERROR); + } + + close(p[1]); + + execl(compress_pgm, compress_pgm, (char *) 0); + + /* "Can't execute compression program %s" */ + + error(A_ERR, "send_anonftp_site", SEND_ANONFTP_SITE_007, compress_pgm); + exit(ERROR); + } + else{ + if(retcode == -1){ + + /* "Can't fork() for compression process" */ + + error(A_ERR, "send_anonftp_file", SEND_ANONFTP_SITE_010); + return(ERROR); + } + } + + close(p[0]); + + + if((fp = fdopen(p[1], "w")) == (FILE *) NULL){ + + /* "Can't open outgoing pipe" */ + + error(A_ERR, "send_anonftp_site", SEND_ANONFTP_SITE_008); + return(ERROR); + } + + if((xdrs = open_xdr_stream(fp, XDR_ENCODE)) == (XDR *) NULL){ + + /* "Can't open XDR stream for compression ftp" */ + + error(A_ERR, "send_anonftp_site", SEND_ANONFTP_SITE_009); + return(ERROR); + } + + } + else{ + + /* found host db entry now open XDR stream */ + + if((xdrs = open_xdr_stream(stdout, XDR_ENCODE)) == (XDR *) NULL){ + + /* "Can't open XDR stream for stdout" */ + + error(A_ERR, "send_anonftp_site", SEND_ANONFTP_SITE_003); + return(ERROR); + } + } + /* Convert site file into parser output format, then to XDR stream */ + + if(copy_parser_to_xdr( xdrs, sitefile, no_recs, strhan) == ERROR){ + + /* "Error translating site file to XDR stream" */ + + error(A_ERR, "send_anonftp_site", SEND_ANONFTP_SITE_004); + return(ERROR); + } + + close_xdr_stream(xdrs); + close_file(sitefile); + + destroy_finfo(sitefile); + + return(A_OK); +} + +/* + * copy_parser_to_xdr: take given sitefile, convert it to parser format and + * then convert to XDR stream + */ + + + +status_t copy_parser_to_xdr( xdrs, sitefile, no_recs, strhan) + XDR *xdrs; /* active XDR stream */ + file_info_t *sitefile; /* file control for site file */ + index_t no_recs; /* number of records in site file */ + struct arch_stridx_handle *strhan; +{ + parser_entry_t parser_rec; + index_t *children_arr, *parents_arr; + static full_site_entry_t *site_ent, *next_ent; + /* static char tmp_string[8096]; lucb - was pathname_t */ + char *tmp_string; + int curr_recno; + index_t *strings_arr; + index_t curr_parent = (index_t) (-1); + int *rec_numbers ; + /* Stores the original parent indexes mapped to + their new locations after the addition of the parent + entries.*/ + + int num, i = 0; + + if ((rec_numbers = (int *)malloc(sizeof(int)*(no_recs*2)))== (int *) NULL){ + + /* "Can't malloc space for integer" */ + + error(A_SYSERR, "copy_parser_to_xdr", "Can't malloc space for integer array\n"); + return(ERROR); + } + + + ptr_check(xdrs, XDR, "copy_parser_to_xdr", ERROR); + ptr_check(sitefile, file_info_t, "copy_parser_to_xdr", ERROR); + + /* Map the strings file */ + if (( children_arr = (index_t *)malloc(sizeof(index_t)*(no_recs)))== (index_t *) NULL){ + + /* "Can't malloc space for children array" */ + + error(A_SYSERR, "copy_parser_to_xdr", "Can't malloc space for children array"); + return(ERROR); + } + + if (( parents_arr = (index_t *)malloc(sizeof(index_t)*(no_recs)))== (index_t *) NULL){ + + /* "Can't malloc space for parents array" */ + + error(A_SYSERR, "copy_parser_to_xdr", "Can't malloc space for parents array"); + return(ERROR); + } + + if (( strings_arr = (index_t *)malloc(sizeof(index_t)*(no_recs))) == (index_t *) NULL ){ + + /* "Can't malloc space for char array" */ + + error(A_SYSERR, "copy_parser_to_xdr", "Can't malloc space for char array\n"); + return(ERROR); + } + + + /* For each record in the site file */ + + /* - We first take a first pass at all the records in which + * we create the following: + * 1- the correct index mappings from the array of full_site_entry_t and + * to the array of parser_entry_t. The latter is shorter since it does + * not contain the extra parent_entry records. + * 2- recreate the correct child_idx pointers for the new parser records. + */ + + + num = no_recs; + i = 0; + + /* num will be increasing as potential parent_entries are + * foreseen. Once I see a record that is a directory and not a file + * num is increased. + */ + + for(curr_recno = 0; curr_recno < num; curr_recno++){ + + /* Get the full site entry record */ + if( (curr_recno == 1)||(curr_recno == 2)) { + rec_numbers[ curr_recno ] = i; + num++; + continue; + } + site_ent = (full_site_entry_t *) sitefile -> ptr + curr_recno; + + /* Get the parser record */ + + rec_numbers[ curr_recno ] = i; + + if( !(CSE_IS_SUBPATH((*site_ent)) || + CSE_IS_NAME((*site_ent)) || + CSE_IS_PORT((*site_ent)) ) ) { + + /* rec_numbers takes care of the mapping from the indecies + * of the site file (reflecting the bigger array) to the smaller + * current array idecies to be sent. + */ + + parents_arr[i] = curr_parent; + children_arr[i] = (index_t)(-1); + strings_arr[i] = site_ent -> strt_1; + + i++; + + /* i only increases when an element is to be sent is being + * prepeared. It is used for the mapping of indecies. + */ + + }else + { + num++; + + /* - must increase it to take care of the extra + * records we add at insertion time for each parent entry.. + */ + + /* rec_numbers takes care of the mapping from the indecies + * from the site file (reflecting the bigger array) to the smaller + * current array idecies to be sent. + */ + + if( (index_t) site_ent -> core.prnt_entry.strt_2 >= 0 ) + { + /* To get the original listing of this parent_entry. strt_2 points + * to its original location in its parent's listing. + */ + + curr_parent = rec_numbers[site_ent -> core.prnt_entry.strt_2] ; + + if( curr_recno+1 < num ) { + + /* This should take care of the case when there are no children for + * this parent directory. If the next record is another parent directory + * then there are no children for the current parent_entry. + */ + next_ent = (full_site_entry_t *) sitefile -> ptr + curr_recno + 1; + if( !(CSE_IS_SUBPATH((*next_ent)) || + CSE_IS_NAME((*next_ent)) || + CSE_IS_PORT((*next_ent)) ) ) + { children_arr[ curr_parent ] = i; + /* the first entry in this directory listing, i already is increased */ + } + } + }else + { + curr_parent = (index_t) (-1); + /* This case only occurs in the top directory ./ */ + } + } + } + + for(i = 0, curr_recno = 0; curr_recno < num; curr_recno++){ + + + if( (curr_recno == 1)||(curr_recno == 2)) { + continue; + } + + site_ent = (full_site_entry_t *) sitefile -> ptr + curr_recno; + + /* Get the parser record */ + + if( !(CSE_IS_SUBPATH((*site_ent)) || + CSE_IS_NAME((*site_ent)) || + CSE_IS_PORT((*site_ent)) ) ) { + + /* rec_numbers takes care of the mapping from the indecies + * of the site file (reflecting the bigger array) to the smaller + * current array idecies to be sent. + */ + + parser_rec.core.size = site_ent -> core.entry.size; + parser_rec.core.date = site_ent -> core.entry.date; + parser_rec.core.perms = site_ent -> core.entry.perms; + parser_rec.core.parent_idx = parents_arr[i]; + parser_rec.core.child_idx = children_arr[i]; + parser_rec.core.flags = site_ent -> flags; + + /* Get the string associated with parser record */ + + if( !archGetString( strhan, strings_arr[i], &tmp_string) ){ + error(A_ERR,"copy_parser_to_xdr","Could not find the string using archGetString\n"); + return( ERROR ); + } + + parser_rec.slen = strlen(tmp_string); + + if( xdr_parser_entry_t(xdrs,&parser_rec) != TRUE){ + + /* "Conversion to XDR stream from raw format failed" */ + + error(A_INTERR,"copy_parser_to_xdr", COPY_PARSER_TO_XDR_002); + return(ERROR); + } + + /* + * This might have to be changed to xdr_array but since xdr_char + * unpacks characters into 4 bytes each the space requirements would + * be too expensive. We'll try with this for now + */ + + if( xdr_opaque( xdrs, tmp_string, parser_rec.slen) != TRUE){ + + /* "Conversion of string to XDR opaque type from raw format failed" */ + + error(A_INTERR,"copy_parser_to_xdr", COPY_PARSER_TO_XDR_003); + return(ERROR); + } + + i++; + free(tmp_string); + + } + /* when it is not a file do nothing */ + } + if( strings_arr != NULL ) { free(strings_arr); strings_arr = NULL; } + if( parents_arr != NULL ) { free(parents_arr); parents_arr = NULL; } + if( children_arr != NULL ) { free(children_arr); children_arr = NULL; } + if( rec_numbers != NULL ) { free(rec_numbers); rec_numbers = NULL; } + return(A_OK); +} + + +/* + * copy_xdr_to_parser: copy incoming XDR stream (in parser format) to raw + * parser format + */ + + +status_t copy_xdr_to_parser( xdrs, sitefile, no_recs) + XDR *xdrs; /* active XDR stream */ + file_info_t *sitefile; /* file to be written to */ + index_t no_recs; /* number of records in site file */ + +{ + + int curr_recno; + parser_entry_t parser_rec; + static char string_buf[8096]; /* lucb - was pathname_t [256] */ + int s_length; + fd_set fds; + + ptr_check(xdrs, XDR, "copy_xdr_to_parser", ERROR); + ptr_check(sitefile, file_info_t, "copy_xdr_to_parser", ERROR); + + + + /* for each record in the incoming stream */ + + signal(SIGALRM,sig_alarm); + alarm(timeout); + + for(curr_recno = 0; curr_recno < no_recs; curr_recno++){ +#if 0 + struct timeval timeval_struct; + int finished; + + FD_ZERO(&fds); + FD_SET(0,&fds); + timeval_struct.tv_sec = (long) timeout; + timeval_struct.tv_usec = 0L; + + /* convert from XDR to parser format */ + if ( (finished=select(1 , &fds,NULL,NULL,&timeval_struct)) >= 0 ) { + if ( finished == 0 ) { + error(A_ERR,"net_anonftp", "Timeout of %d secs while receiving data",timeout); + return ERROR; + } + } + else { + error(A_ERR,"net_anonftp", "Select failed with errno %d",errno); + return ERROR; + } +#endif + memset(&parser_rec,0,sizeof(parser_rec)); + rec_number = curr_recno; + if(xdr_parser_entry_t(xdrs,&parser_rec) != TRUE){ + + /* "Conversion to raw format from XDR format failed" */ + /* debug("copy_xdr_to_parser", "Failed on record %d", curr_recno); */ + error(A_WARN,"copy_xdr_to_parser", COPY_XDR_TO_PARSER_001); + return(ERROR); + } + + /* LIttle hack in the case of anonymous ftp .. */ + if ( parser_rec.core.flags > 3 ) + parser_rec.core.flags &= 0x03; + + /* write out the record */ + + if(fwrite((char *) &parser_rec, sizeof(parser_entry_t), 1, sitefile -> fp_or_dbm.fp) == 0){ + + /* "Can't write out parser record %d" */ + + error(A_SYSERR,"copy_xdr_to_parser", COPY_XDR_TO_PARSER_002, curr_recno ); + return(ERROR); + } + + if (parser_rec.slen >= 8096) { + error(A_SYSERR, "copy_xdr_to_parser", + "Internal buffer overflow (%d > 8096)", parser_rec.slen); + return(ERROR); + } + if(xdr_opaque(xdrs, string_buf, parser_rec.slen) != TRUE){ + + /* "Conversion of string to parser from XDR format failed for record %d" */ + + error(A_WARN,"copy_xdr_to_parser", COPY_XDR_TO_PARSER_003, curr_recno); + return(ERROR); + } + + + /* + * length of incoming string has been padded up to the nearest word + * boundary (4 bytes, 32 bits) + */ + + s_length = parser_rec.slen; + + if( s_length & 0x3 ) + s_length += (4 - (s_length & 0x3)); + + + /* printf("string=%s recno=%d \n",string_buf,curr_recno); */ + + + if(fwrite(string_buf, s_length, 1, sitefile -> fp_or_dbm.fp) == 0){ + + /* "Can't write out parser string %s record %d" */ + + error(A_SYSERR,"copy_xdr_to_parser", COPY_XDR_TO_PARSER_004, string_buf, curr_recno); + return(ERROR); + } + memset(string_buf,0,s_length); + } + + return(A_OK); +} + + + +/* + * Note that many of the xdr_ calls for the "basic" (simple) elements + * are macros not procedure calls defined in typedef.h + */ + + +/* + * xdr_core_site_entry_t: convert a core_site_entry_t record to/from XDR + * stream format + */ + +bool_t xdr_core_site_entry_t( xdrs, core_rec ) + XDR *xdrs; + core_site_entry_t *core_rec; + +{ +#if 0 + + int r1,r2,r3,r4,r5,r6; + + ptr_check(xdrs, XDR, "xdr_core_site_entry_t", FALSE); + ptr_check(core_rec, core_site_entry_t, "xdr_core_site_entry_t", FALSE); + + /* debugging */ + + r1 = xdr_file_size_t(xdrs, &(core_rec -> size)); + r2 = xdr_date_time_t(xdrs, &(core_rec -> date)); + r3 = xdr_index_t(xdrs, &(core_rec -> parent_idx)); + r4 = xdr_index_t(xdrs, &(core_rec -> child_idx)); + r5 = xdr_perms_t(xdrs, &(core_rec -> perms)); + r6 = xdr_flags_t(xdrs, &(core_rec -> flags)); + + return (r1 && r2 && r3 && r4 && r5 && r6); + +#else + + ptr_check(xdrs, XDR, "xdr_core_site_entry_t", FALSE); + ptr_check(core_rec, core_site_entry_t, "xdr_core_site_entry_t", FALSE); + + + return( xdr_file_size_t(xdrs, &(core_rec -> size)) && + xdr_date_time_t(xdrs, &(core_rec -> date)) && + xdr_index_t(xdrs, &(core_rec -> parent_idx)) && + xdr_index_t(xdrs, &(core_rec -> child_idx)) && + xdr_perms_t(xdrs, &(core_rec -> perms)) && + xdr_flags_t(xdrs, &(core_rec -> flags)) + ); +#endif +} + + + +/* + * xdr_parser_entry_t: convert parser record to/from XDR stream + */ + + +bool_t xdr_parser_entry_t( xdrs, parser_rec) + XDR *xdrs; + parser_entry_t *parser_rec; + +{ + + ptr_check(xdrs, XDR, "xdr_parser_entry_t", FALSE); + ptr_check(parser_rec, parser_entry_t, "xdr_parser_entry_t", FALSE); + + return(xdr_core_site_entry_t(xdrs, &(parser_rec -> core)) && + xdr_strlen_t(xdrs, &(parser_rec -> slen))); +} + +/* Signal handler */ + + +void sig_handle(sig) + int sig; +{ + + if(sig == SIGPIPE){ + + /* "Broken pipe: remote data transfer process existed prematurely" */ + + error(A_ERR, "sig_handle", NET_ANONFTP_014); + exit(A_OK); + } + + if(sig == SIGHUP){ + + if(sitefile -> fp_or_dbm.fp != (FILE *) NULL) + close_file(sitefile); + + if(sitefile -> filename[0] != '\0') + unlink(sitefile -> filename); + } + + exit(A_OK); +} diff --git a/archie/anonftp/update/net_anonftp.h b/archie/anonftp/update/net_anonftp.h new file mode 100644 index 0000000..581465f --- /dev/null +++ b/archie/anonftp/update/net_anonftp.h @@ -0,0 +1,13 @@ +#ifndef _NET_ANONFTP_H_ +#define _NET_ANONFTP_H_ + +extern status_t send_anonftp_site PROTO(( ip_addr_t, header_t *, hostdb_aux_t *, format_t, char *, struct arch_stridx_handle *)); +extern bool_t xdr_parser_entry_t PROTO(( XDR *, parser_entry_t *)); +extern status_t get_anonftp_site PROTO((file_info_t *, file_info_t * )); +extern status_t copy_xdr_to_parser PROTO((XDR *, file_info_t *, index_t)); +extern status_t copy_parser_to_xdr PROTO((XDR *, file_info_t *, index_t, struct arch_stridx_handle *)); +/* #warning I am not sure this is properly defined */ +extern void sig_handle PROTO((int/*, int, struct sigcontext *, char * */)); + +#endif + diff --git a/archie/anonftp/update/setup_delete.c b/archie/anonftp/update/setup_delete.c new file mode 100644 index 0000000..69d4f1e --- /dev/null +++ b/archie/anonftp/update/setup_delete.c @@ -0,0 +1,171 @@ +/* + * This file is copyright Bunyip Information Systems Inc., 1992. This file + * may not be reproduced, copied or transmitted by any means mechanical or + * electronic without the express written consent of Bunyip Information + * Systems Inc. + */ + + +#include +#include +#include +#include +#include +#include +#include +#include "typedef.h" +#include "strings_index.h" +#include "site_file.h" +#include "db_ops.h" +#include "lang_anonftp.h" +#include "files.h" +#include "error.h" +#include "archie_inet.h" +#include "delete_anonftp.h" +#include "protos.h" +#include "../startdb/start_db.h" +#include "../startdb/lang_startdb.h" + +#ifndef __STDC__ + extern status_t host_table_find(); + extern status_t update_start_dbs(); +#endif + +/* + * setup_delete: performs the deletion of the site from the anonftp + * database + */ + + + +status_t setup_delete(delete_file, start_db, recno, ipaddr, port) + file_info_t *delete_file; /* The file containing the data in the anonftp database */ + file_info_t *start_db; + int recno; /* Number of records in the data */ + ip_addr_t ipaddr; /* The IP address of the site being deleted */ + int port; +{ + int count; + host_table_index_t hin; + + full_site_entry_t *site_ent_ptr; + + hostname_t hname; + + struct stat statbuf; + + + hname[0] = '\0'; + + ptr_check(delete_file, file_info_t, "setup_delete", ERROR); + + if(delete_file -> fp_or_dbm.fp == (FILE *) NULL){ + + /* "No input file %s" */ + + error(A_ERR,"setup_delete", SETUP_DELETE_002, delete_file -> filename); + return(A_OK); + } + + + if(fstat(fileno(delete_file -> fp_or_dbm.fp), &statbuf) == -1){ + + /* "Can't fstat() input site file %s" */ + + error(A_SYSERR,"setup_delete", SETUP_DELETE_011, delete_file -> filename); + return(A_OK); + } + else{ + + if(statbuf.st_size != recno * sizeof(full_site_entry_t)){ + + /* "Number of records in host auxiliary database (%d) different from implied by file size (%d)" */ + + error(A_WARN, "setup_delete", SETUP_DELETE_012, recno, statbuf.st_size / sizeof(full_site_entry_t)); + + recno = statbuf.st_size / sizeof(full_site_entry_t); + } + } + + + /* Allocate space for internal list */ + + /* + if((checklist = malloc(sizeof(char) * recno)) == (char *) NULL){ + + / "Can't malloc space for internal list" / + + error(A_SYSERR, "setup_delete", SETUP_DELETE_001); + return(A_OK); + } + + memset(checklist, '\0', recno * sizeof(char)); + */ + + + if(mmap_file(delete_file, O_RDWR) == ERROR){ + + /* "Can't mmap site file to be deleted %s" */ + + error(A_ERR, "setup_delete", SETUP_DELETE_003, delete_file -> filename); + return(A_OK); + } + + + if ( host_table_find( &ipaddr, hname, &port , &hin) == ERROR ) + { + /* "Site %s should be in host/start table but is not. Corruption\n" */ + error(A_ERR,"setup_delete","Site %s should be in host/start table but is not. Corruption\n", + (char *)(inet_ntoa( ipaddr_to_inet(ipaddr)))); + return ERROR; + } + + + for(site_ent_ptr = (full_site_entry_t *) delete_file -> ptr, count =0; + count < recno; count++, site_ent_ptr++){ + + /* if the pointer to next record on chain is in the same file + (internal link) follow chain until it points out of the site + (external link) */ + + + if( !(CSE_IS_SUBPATH((*site_ent_ptr)) || + CSE_IS_PORT((*site_ent_ptr)) || + CSE_IS_NAME((*site_ent_ptr))) ){ + /* site_ent_ptr->flags != (flags_t)1 ){ */ + if ( update_start_dbs(start_db, site_ent_ptr->strt_1, hin, DELETE_SITE ) == ERROR ) + { + /* "Could not update start/host table with %s ." */ + error(A_ERR,"insert_compare_hstart_db","Could not update start/host table with %s .\n", + (char *)(inet_ntoa( ipaddr_to_inet(ipaddr))) ); + return ERROR; + } + + } + + } + + if(munmap_file(delete_file) == ERROR){ + + /* "Can't unmap site file %s" */ + + error(A_ERR, "setup_delete", SETUP_DELETE_007, delete_file -> filename); + } + + +#if !defined(__STDC__) && !defined(AIX) + /* + if(checklist) + if(free(checklist) == -1){ + + / "Can't free internal list" / + + error(A_SYSERR, "setup_delete", SETUP_DELETE_010); + } + #else + free(checklist); + */ +#endif + + return(A_OK); +} diff --git a/archie/anonftp/update/setup_insert.c b/archie/anonftp/update/setup_insert.c new file mode 100644 index 0000000..8e73522 --- /dev/null +++ b/archie/anonftp/update/setup_insert.c @@ -0,0 +1,344 @@ +/* + * This file is copyright Bunyip Information Systems Inc., 1992. This file + * may not be reproduced, copied or transmitted by any means mechanical or + * electronic without the express written consent of Bunyip Information + * Systems Inc. + */ + + +#include +#include +#include +#include +#include +#include +#include "typedef.h" + +#include "strings_index.h" + +#include "site_file.h" +#include "header_def.h" + +#include "host_db.h" +#include "insert_anonftp.h" +#include "error.h" +#include "archie_dbm.h" +#include "lang_anonftp.h" +#include "debug.h" +#include "files.h" + + +/* + * setup_insert.c This file contains the routines for the first pass over + * the input data for an insertion into the anonftp database. + */ + +/* extern fprintf(); */ + +/* + * count_extra_recs() Read the parser input file and construct the extra + * number of records that will be added to reflect the parent-entries. + */ + + +status_t count_extra_recs(in_array, input_size, header_rec) + char *in_array; /* Input parser "array" (mmaped file) */ + int input_size; + header_t *header_rec; /* The input header record where no_recs and site_no_recs are found */ +{ + + parser_entry_t curr_irec; /* Current input record */ + int curr_recno; /* and its record number */ + + + int no_recs; + int extra_recs = 3; /* this counts for the top 3 extra entries + * inserted in setup_insert that should account + * for the hostname and the top / directory + */ + int byte_offset = 0; /* Byte offset of current record */ + + no_recs = header_rec->no_recs; + + ptr_check(in_array, char, "count_extra_recs", ERROR); + + + /* Check to see if the header_rec->header_flags includes the site_no_recs + * field. If it does then we don't need to recount the number of extra + * records. Otherwise we recount and assign the new number to + * header_rec.header_flags. + */ + + if(HDR_GET_SITE_NO_RECS(header_rec -> header_flags)) + { + return(A_OK); + } + + /* Go through the input one record at a time */ + + + for( curr_recno=0; byte_offset < input_size && curr_recno < no_recs; curr_recno++){ + + memcpy(&curr_irec, &in_array[byte_offset], sizeof(parser_entry_t)); + + if (CSE_IS_DIR(curr_irec.core)) + { + extra_recs++; + } + + byte_offset += sizeof(parser_entry_t) + curr_irec.slen; + + /* Align it on the next 4 byte boundary. May be NON-PORTABLE*/ + + if( byte_offset & 0x3 ) + byte_offset += (4 - (byte_offset & 0x3)); + } + + HDR_SET_SITE_NO_RECS(header_rec -> header_flags); + header_rec -> site_no_recs = no_recs + extra_recs; + + return(A_OK); +} + + + + + +/* + * setup_insert() Read the parser input file and construct list of records + * to be modified + */ + + +status_t setup_insert(strhan,in_array, input_size, out_array, out_rec_no, header_rec ) + struct arch_stridx_handle *strhan; + char *in_array; /* Input parser "array" (mmaped file) */ + int input_size; + full_site_entry_t *out_array; /* Output "array" (mmaped output file) */ + int *out_rec_no; + header_t header_rec; +/* int no_records; * Number of input records */ +{ + + index_t *outlist; /* Constructed outlist */ + parser_entry_t curr_irec; /* Current input record */ + int curr_recno; /* and its record number */ + char input_string[MAX_PATH_LEN]; /* Current input string */ + + index_t tmp_index; + index_t prev_prnt_dir; + int curr_prnt_dir; + + int byte_offset = 0; /* Byte offset of current record */ + + int no_recs, web; + + int *rec_numbers; + /* Stores the original parent indexes mapped to + their new locations after the addition of the parent + entries.*/ + + int l, extra_recs = 0; + + no_recs = header_rec.site_no_recs; + *out_rec_no = 0; + if((outlist = (index_t *)malloc( no_recs * sizeof(index_t))) == (index_t) 0){ + + /* "Can't malloc() space for outlist" */ + + error(A_SYSERR,"setup_insert", INSERT_ANONFTP_005); + return(ERROR); + } + + if ((rec_numbers = (int *)malloc(sizeof(int)*(no_recs)))== (int *) NULL){ + + /* "Can't malloc space for integer" */ + + error(A_SYSERR, "setup_insert", "Can't malloc space for integer array\n"); + return(ERROR); + } + + ptr_check(in_array, char, "setup_insert", ERROR); + ptr_check(out_array, full_site_entry_t, "setup_insert", ERROR); + + prev_prnt_dir = (index_t) (-2); + curr_prnt_dir = (index_t) (-1); + web = 0; + + /* Go through the input one record at a time */ + + for( curr_recno=0; byte_offset < input_size && (curr_recno) < no_recs; curr_recno++){ + + memcpy(&curr_irec, &in_array[byte_offset], sizeof(parser_entry_t)); + + if( curr_irec.slen ){ + if( !(CSE_IS_SUBPATH(curr_irec.core) || + CSE_IS_PORT(curr_irec.core) || + CSE_IS_NAME(curr_irec.core)) ) + { + if ( !web && (curr_irec.core.parent_idx != prev_prnt_dir) ) + { + extra_recs++; + outlist[curr_recno] = curr_prnt_dir; + + CSE_SET_SUBPATH(out_array[curr_recno]); + if( curr_irec.core.parent_idx >= 0 ) { + out_array[curr_recno].core.prnt_entry.strt_2 = + rec_numbers[curr_irec.core.parent_idx] ; + out_array[curr_recno].strt_1 = + (index_t)(outlist[ rec_numbers[curr_irec.core.parent_idx] ]); + curr_prnt_dir = curr_recno; + prev_prnt_dir = curr_irec.core.parent_idx; + curr_recno++; + + }else + { + out_array[curr_recno].core.prnt_entry.strt_2 = + (index_t) (-1); + out_array[curr_recno].strt_1 = (index_t)(-1); + curr_prnt_dir = curr_recno; + prev_prnt_dir = curr_irec.core.parent_idx; + curr_recno++; + + /* This was written to insert the name of the site at the top + * of the site file like it is done in webindex to relieve the + * other programs from using other resources to find out the name + * of the site. I am not sure if the source of my hostname is right. + * I must check that. + * + */ + if( HDR_GET_PREFERRED_HOSTNAME(header_rec.header_flags) ){ + + l = strlen(header_rec.preferred_hostname); +/* if((input_string = (char *) malloc( l + 1)) == (char *) NULL){ + / "Can't malloc space for input string" / + error(A_SYSERR, "setup_insert", SETUP_INSERT_003); + free(outlist); + return(ERROR); + } +*/ + input_string[0] = '\0'; + strncpy( input_string, header_rec.preferred_hostname,l); + input_string[l] = '\0'; + + }else if( HDR_GET_PRIMARY_HOSTNAME(header_rec.header_flags) ){ + + l = strlen(header_rec.primary_hostname); +/* if((input_string = (char *) malloc( l + 1)) == (char *) NULL){ + / "Can't malloc space for input string" / + error(A_SYSERR, "setup_insert", SETUP_INSERT_003); + free(outlist); + return(ERROR); + } +*/ + input_string[0] = '\0'; + strncpy( input_string, header_rec.primary_hostname,l); + input_string[l] = '\0'; + } + + if( (curr_recno==1) && (input_string[0]!='\0')){ + + /* Inserting the entry representing the name as a list of the top + * subpath "/" + */ + extra_recs++; + outlist[curr_recno] = 0; + CSE_SET_DIR(out_array[curr_recno]); + if( archAppendKey( strhan, input_string, &tmp_index ) ){ + out_array[curr_recno].strt_1 = tmp_index ; +/* fprintf(stderr,"%d:%s at %lu.\n",curr_recno, input_string, tmp_index); */ +/* free(input_string);*/ + }else{ +/* archCloseStrIdx(&strhan); */ + error(A_ERR,"setup_insert","couldn't complete archAppendKey\n"); + free(outlist); +/* free(input_string);*/ + return(ERROR); + } + curr_recno++; + + /* Inserting the name as a parent entry with its parent pointers + * defined. + */ + + extra_recs++; + outlist[curr_recno] = 0; + CSE_SET_NAME(out_array[curr_recno]); + out_array[curr_recno].core.prnt_entry.strt_2 = (index_t) (curr_recno-1); + out_array[curr_recno].strt_1 = (index_t)(curr_prnt_dir); + prev_prnt_dir = curr_irec.core.parent_idx ; + curr_prnt_dir = curr_recno; + curr_recno++; + + /* rec_numbers[0] = 1; */ + } + } + } + }else{ + curr_prnt_dir = curr_recno; + prev_prnt_dir = curr_irec.core.parent_idx; + web = 1; + } + + outlist[curr_recno] = curr_prnt_dir; + + input_string[0] = '\0'; + + strncpy( input_string, (char *) &in_array[byte_offset] + sizeof(parser_entry_t), + curr_irec.slen); + + input_string[curr_irec.slen] = '\0'; + if( archAppendKey( strhan, input_string, &tmp_index ) ){ + out_array[curr_recno].strt_1 = tmp_index ; +/* fprintf(stderr,"%d:%s at %lu.\n",curr_recno, input_string, tmp_index); */ +/* free(input_string);*/ + } else { +/* archCloseStrIdx(&strhan); */ + error(A_ERR,"setup_insert","couldn't complete archAppendKey\n"); + free(outlist); +/* free(input_string);*/ + return(ERROR); + } + + /* "write out" the output record, with external pointers unresolved */ + + if ((CSE_IS_FILE(curr_irec.core) )|| + CSE_IS_LINK(curr_irec.core) || + CSE_IS_DOC(curr_irec.core) || + CSE_IS_DIR(curr_irec.core) ) + { /* file or directory*/ + out_array[curr_recno].flags = (flags_t)curr_irec.core.flags; + out_array[curr_recno].core.entry.size = curr_irec.core.size ; + out_array[curr_recno].core.entry.date = curr_irec.core.date ; + out_array[curr_recno].core.entry.perms = curr_irec.core.perms ; + rec_numbers[curr_recno - extra_recs] = curr_recno; + }else if (CSE_IS_KEY(curr_irec.core) ) + { + out_array[curr_recno].core.kwrd.weight = CSE_GET_WEIGHT(curr_irec.core); + } + /* Increment the byte offset to next record */ + + byte_offset += sizeof(parser_entry_t) + curr_irec.slen; + + /* Align it on the next 4 byte boundary. May be NON-PORTABLE*/ + + if( byte_offset & 0x3 ) + byte_offset += (4 - (byte_offset & 0x3)); + + } + } + + *out_rec_no = curr_recno; + + free(outlist); + free(rec_numbers); + /* + * All done with the input, sort the outlist in increasing IP address and + * increasing record number. This is to recognise when internal links are + * to be made. See documentation + */ + + return(A_OK); +} + + diff --git a/archie/anonftp/update/update_anonftp.c b/archie/anonftp/update/update_anonftp.c new file mode 100644 index 0000000..a2d2722 --- /dev/null +++ b/archie/anonftp/update/update_anonftp.c @@ -0,0 +1,787 @@ +/* + * This file is copyright Bunyip Information Systems Inc., 1992. This file + * may not be reproduced, copied or transmitted by any means mechanical or + * electronic without the express written consent of Bunyip Information + * Systems Inc. + */ + +#include +#include +#if !defined(AIX) && !defined(SOLARIS) +#include +#endif +#include +#include +#include +#include "typedef.h" +#include "header.h" + +#include "db_files.h" +#include "db_ops.h" +#include "webindexdb_ops.h" +#include "host_db.h" +#include "update_anonftp.h" +#include "error.h" +#include "archie_dbm.h" +#include "lang_anonftp.h" +#include "files.h" +#include "archie_strings.h" +#include "master.h" +#include "times.h" +#include "archie_mail.h" +#include "patrie.h" +#include "archstridx.h" + + +#ifdef __STDC__ + extern char *strrchr( char *, char ); +#else + extern char *strrchr(); +#endif + + +status_t get_basename(path, file) + char *path; + char *file; +{ + char *t; + + if ( file == NULL || path == NULL ) + return ERROR; + + t = strrchr(path, '/'); + if ( t == NULL ) { + strcpy(file,path); + return A_OK; + } + + if ( *(t+1) == '\0' ) { + *t = '\0'; + t = strrchr(path, '/'); + if ( t == NULL ) { + strcpy(file,path); + return A_OK; + } + } + + t++; + strcpy(file,t); + + return A_OK; + +} + + +/* + * update_anonftp.c: perform required updates on the anonftp database. + * Performs the requried database locking + + argv, argc are used. + + + Parameters: -i input filename. Mandatory. + -w + -M + -h + -l write to log file (default) + -t temporary directory name + -I minimum size to be indexed + -L + + */ + + +int verbose = 0; +pathname_t prog; + + +int main(argc, argv) + int argc; + char *argv[]; + +{ + extern int opterr; + extern char *optarg; + + extern int errno; + +#ifndef __STDC__ + + extern int getopt(); + extern time_t time(); + +#endif + + char **cmdline_ptr; + int cmdline_args; + + int option; + pathname_t master_database_dir; + pathname_t host_database_dir; + pathname_t files_database_dir; + + char minsize[256]; + + pathname_t tmp_dir; + + pathname_t logfile; + + pathname_t process_pgm; + index_t index; + + char **arglist; + + int i; + + int logging = 0; + + int minidxsize = 0; + + int tries, finished; + + file_info_t *input_file = create_finfo(); + file_info_t *lock_file = create_finfo(); + file_info_t *hostdb = create_finfo(); + file_info_t *hostaux_db = create_finfo(); + + header_t header_rec; + +/* hostdb_t hostdb_rec;*/ + hostdb_aux_t hostaux_ent; + + int status, result; + + char *dbdir; + + opterr = 0; + + if ( get_basename(argv[0],prog) == ERROR ) { + strcpy(prog,"update_anonftp"); + } + + host_database_dir[0] = master_database_dir[0] = files_database_dir[0] = '\0'; + tmp_dir[0] = logfile[0] = '\0'; + + cmdline_ptr = argv + 1; + cmdline_args = argc - 1; + + + while((option = (int) getopt(argc, argv, "h:M:t:I:L:i:lw:vo:")) != EOF){ + + switch(option){ + + /* logging with specified file */ + + case 'L': + strcpy(logfile, optarg); + logging = 1; + cmdline_ptr += 2; + cmdline_args -= 2; + break; + + /* master database directory name */ + + case 'M': + strcpy(master_database_dir,optarg); + cmdline_ptr += 2; + cmdline_args -= 2; + break; + + + /* host database directory name */ + + case 'h': + strcpy(host_database_dir,optarg); + cmdline_ptr += 2; + cmdline_args -= 2; + break; + + /* input filename */ + + case 'i': + strcpy(input_file -> filename, optarg); + cmdline_ptr += 2; + cmdline_args -= 2; + break; + + /* disregard */ + case 'o': + break; + + /* logging, default file */ + + case 'l': + logging = 1; + cmdline_ptr++; + cmdline_args--; + break; + + /* temporary directory name */ + + case 't': + strcpy(tmp_dir,optarg); + cmdline_ptr += 2; + cmdline_args -= 2; + break; + + /* Minimum Index file size */ + + case 'I': + minidxsize = atoi(optarg); + cmdline_ptr += 2; + cmdline_args -= 2; + break; + + /* verbose */ + + case 'v': + verbose = 1; + cmdline_ptr++; + cmdline_args--; + break; + + + /* anonftp database directory name */ + + case 'w': + strcpy(files_database_dir,optarg); + cmdline_ptr += 2; + cmdline_args -= 2; + break; + + + default: + error(A_ERR,"update_anonftp","Unknown option '%s'\nUsage: update_anonftp -i -w -M -h -l -t -I -L ", *cmdline_ptr); + exit(A_OK); + break; + } + + } + +#ifdef SLEEP + fprintf(stderr,"Sleeping\n"); + sleep(5); +#endif + + /* set up logs */ + + if(logging){ + if(logfile[0] == '\0'){ + if(open_alog((char *) NULL, A_INFO, tail(argv[0])) == ERROR){ + + /* "Can't open default log file" */ + + error(A_ERR, prog, UPDATE_ANONFTP_002); + exit(ERROR); + } + } + else{ + if(open_alog(logfile, A_INFO, tail(argv[0])) == ERROR){ + + /* "Can't open log file %s" */ + + error(A_ERR, prog, UPDATE_ANONFTP_001, logfile); + exit(ERROR); + } + } + } + + + if(input_file -> filename[0] == '\0'){ + + /* "No input file given" */ + + error(A_ERR,prog, UPDATE_ANONFTP_003); + exit(ERROR); + } + + + /* Set up system directories and files */ + + if(set_master_db_dir(master_database_dir) == (char *) NULL){ + + /* "Error while trying to set master database directory" */ + + error(A_ERR,prog, UPDATE_ANONFTP_002); + exit(ERROR); + } + + if((dbdir = set_files_db_dir(files_database_dir)) == (char *) NULL){ + + /* "Error while trying to set anonftp database directory" */ + + error(A_ERR,prog, UPDATE_ANONFTP_003); + exit(ERROR); + } + + + if(set_host_db_dir(host_database_dir) == (char *) NULL){ + + /* "Error while trying to set host database directory" */ + + error(A_ERR,prog, UPDATE_ANONFTP_004); + exit(ERROR); + } + + if(open_host_dbs((file_info_t *) NULL, hostdb, (file_info_t *) NULL, hostaux_db, O_RDONLY) != A_OK){ + + /* "Error while trying to open host database" */ + + error(A_ERR,prog, DELETE_ANONFTP_006); + exit(A_OK); + } + + if ( strcmp(prog,"update_anonftp" ) == 0 ){ + sprintf(lock_file -> filename,"%s/%s/%s", get_master_db_dir(), DEFAULT_LOCK_DIR, ANONFTP_LOCKFILE); + }else if ( strcmp(prog,"update_webindex" ) == 0 ){ + sprintf(lock_file -> filename,"%s/%s/%s", get_master_db_dir(), DEFAULT_LOCK_DIR, WEBINDEX_LOCKFILE); + } + + if(open_file(input_file, O_RDONLY) == ERROR){ + + /* "Can't open given input file %s" */ + + error(A_ERR, prog, UPDATE_ANONFTP_006, input_file -> filename); + return(ERROR); + } + + if(read_header(input_file -> fp_or_dbm.fp, &header_rec, (u32 *) NULL, 0, 0) == ERROR){ + + /* "Can't read header on %s" */ + + error(A_ERR,prog, UPDATE_ANONFTP_007, input_file -> filename); + exit(ERROR); + } + + close_file(input_file); + + if ( get_hostaux_ent(header_rec.primary_hostname, header_rec.access_methods, + &index, header_rec.preferred_hostname, + header_rec.access_command, &hostaux_ent, hostaux_db) != ERROR){ + +/* if(get_hostaux_ent(header_rec.primary_hostname, header_rec.access_methods, &hostaux_ent, hostaux_db) != ERROR){ +*/ + /* Site/database already exists in database */ + + /* Check to see if it is older data than currently in database */ + + if((header_rec.retrieve_time < hostaux_ent.retrieve_time) + && !((header_rec.current_status == DEL_BY_ARCHIE) || (header_rec.current_status == DEL_BY_ADMIN))){ + + /* "Input file %s has retrieve time older than current entry. Ignoring." */ + + error(A_INFO, prog, UPDATE_ANONFTP_031, input_file -> filename); + if(unlink(input_file -> filename) == -1){ + + error(A_SYSERR, prog, "Can't unlink old input file %s", input_file -> filename); + } + exit(A_OK); + } + } + + for(tries = 0, finished = 0; (tries < MAX_UTRIES) && !finished; tries++){ + + + if(access(lock_file -> filename, F_OK) == 0){ + + /* lock file exists */ + + /* "Waiting for lock file %s" */ + + error(A_INFO, prog, UPDATE_ANONFTP_028, lock_file -> filename); + + write_mail(MAIL_HOST_FAIL, UPDATE_ANONFTP_028, lock_file -> filename); + + sleep(UPDATE_WAIT); + } + else{ + + if(errno != ENOENT){ + + /* "Error while checking for lockfile %s" */ + + error(A_SYSERR, prog, UPDATE_ANONFTP_008, lock_file -> filename); + + write_mail(MAIL_HOST_FAIL, UPDATE_ANONFTP_008, lock_file -> filename); + + exit(ERROR); + } + + finished = 1; + + if(open_file(lock_file, O_WRONLY) == ERROR){ + + /* "Can't open lock file %s" */ + + error(A_ERR,prog, UPDATE_ANONFTP_009, lock_file -> filename); + + write_mail(MAIL_HOST_FAIL, UPDATE_ANONFTP_009, lock_file -> filename); + exit(ERROR); + } + + /* "Update for %s (%s) at %s" */ + + fprintf(lock_file -> fp_or_dbm.fp, UPDATE_ANONFTP_010, header_rec.primary_hostname, input_file -> filename, cvt_from_inttime(time((time_t *) NULL))); + fflush(lock_file -> fp_or_dbm.fp); + } + } + + if(!finished){ + + /* "Giving up after %d tries to update %s" */ + + error(A_ERR,prog, UPDATE_ANONFTP_011, tries, input_file -> filename); + + write_mail(MAIL_HOST_FAIL, UPDATE_ANONFTP_011, tries, input_file -> filename); + exit(ERROR); + } + + /* Check to see if the input file is older than information currently + in database */ + + if((arglist = (char **) malloc(MAX_NO_PARAMS * sizeof(char *))) == (char **) NULL){ + + /* "Can't malloc space for argument list" */ + + error(A_SYSERR, "cntl_function", UPDATE_ANONFTP_030); + unlock_db(lock_file); + exit(ERROR); + } + + + /* if the action status is NEW, then we don't need to delete this site */ + + if(header_rec.action_status == NEW) + goto insert_only; + + /* It has been decided to keep the old file around for processing to + * compare the strings among the new and old files. The new file + * will replace the old file without us having to ermove the + * first file first. + */ + + /* Delete stuff deleted ! */ + + /* database entry is to be deleted */ + + if((header_rec.current_status == DEL_BY_ARCHIE) || (header_rec.current_status == DEL_BY_ADMIN)){ + hostdb_aux_t hostaux_rec; + pathname_t tmp_name; + index_t indx; + file_info_t *hostaux_dbase = create_finfo(); + + + if(open_host_dbs((file_info_t *) NULL, (file_info_t *) NULL, (file_info_t *) NULL, hostaux_dbase, O_RDWR) != A_OK){ + + /* "Error while trying to open host database" */ + + error(A_ERR,prog, UPDATE_ANONFTP_025); + write_mail(MAIL_HOST_FAIL, UPDATE_ANONFTP_025); + unlock_db(lock_file); + exit(A_OK); + } + + /** starting actual deletion **/ + + sprintf(process_pgm,"%s/%s/%s%s",get_archie_home(),DEFAULT_BIN_DIR, DELETE_PREFIX, header_rec.access_methods); + + /* set up argument list */ + + i = 0; + arglist[i++] = process_pgm; + + arglist[i++] = "-M"; + arglist[i++] = get_master_db_dir(); + + arglist[i++] = "-w"; + if( !strcmp(header_rec.access_methods,DEFAULT_WFILES_DB_DIR) ) + arglist[i++] = get_wfiles_db_dir(); + else if( !strcmp(header_rec.access_methods,DEFAULT_FILES_DB_DIR) ) + arglist[i++] = get_files_db_dir(); + + if ( tmp_dir[0] != '\0' ) { + arglist[i++] = "-t"; + arglist[i++] = tmp_dir; + } + + arglist[i++] = "-h"; + arglist[i++] = get_host_db_dir(); + + arglist[i++] = "-H"; + arglist[i++] = header_rec.primary_hostname; + + if(logging){ + + arglist[i++] = "-L"; + arglist[i++] = get_archie_logname(); + } + + if(verbose) + arglist[i++] = "-v"; + + arglist[i] = (char *) NULL; + + /* "Deleting %s" */ + + if(verbose) + error(A_INFO,prog,UPDATE_ANONFTP_012, header_rec.primary_hostname); + +#ifndef AIX + if((result = vfork()) == 0) +#else + if((result = fork()) == 0) +#endif + { + /* Set logging on */ + + execvp(process_pgm, arglist); + + /* "Can't execvp() delete program %s for %s database" */ + + error(A_SYSERR,prog, UPDATE_ANONFTP_013 , tail(process_pgm), header_rec.access_methods); + exit(ERROR); + } + + + if(result == -1){ + + /* "Can't vfork() delete program %s" */ + + error(A_SYSERR,prog, UPDATE_ANONFTP_014, tail(process_pgm)); + unlock_db(lock_file); + exit(ERROR); + } + + if(wait(&status) == -1){ + + /* "Error while in wait() for delete program %s" */ + + error(A_ERR,prog, UPDATE_ANONFTP_015, tail(process_pgm)); + unlock_db(lock_file); + exit(ERROR); + } + + if(WIFEXITED(status) && WEXITSTATUS(status)){ + + /* "delete program %s exited with value %u" */ + + error(A_ERR,prog, UPDATE_ANONFTP_016, tail(process_pgm), WEXITSTATUS(status)); + write_mail(MAIL_HOST_FAIL, UPDATE_ANONFTP_016, tail(process_pgm), WEXITSTATUS(status)); + exit(ERROR); + } + + if(WIFSIGNALED(status)){ + + /* "Delete program %s terminated abnormally with signal %u" */ + + error(A_ERR,prog, UPDATE_ANONFTP_017, tail(process_pgm), WTERMSIG(status)); + write_mail(MAIL_HOST_FAIL, UPDATE_ANONFTP_017, tail(process_pgm), WTERMSIG(status)); + exit(ERROR); + } + + + /** ending actual deletion **/ + + if ( get_hostaux_ent(header_rec.primary_hostname,header_rec.access_methods, + &indx, header_rec.preferred_hostname, + header_rec.access_command, &hostaux_rec, hostaux_dbase) == ERROR){ + + /* "Can't get auxiliary database entry for site %s database %s for deletion" */ + + error(A_INFO, prog, UPDATE_ANONFTP_026, header_rec.primary_hostname, header_rec.access_methods); + } + else{ + + hostaux_rec.current_status = DELETED; + sprintf(tmp_name,"%s.%s.%d", header_rec.primary_hostname, + header_rec.access_methods, (int)indx); + + if(put_dbm_entry(tmp_name, strlen(tmp_name) + 1, &hostaux_rec, sizeof(hostdb_aux_t), hostaux_dbase, 1) == ERROR){ + + /* "Can't write deletion record for %s to auxiliary host database" */ + + error(A_ERR, prog, UPDATE_ANONFTP_027, tmp_name); + } + + write_mail(MAIL_HOST_DELETE, "%s %s %d" , header_rec.primary_hostname, + header_rec.access_methods, (int)indx ) ; + } + + unlock_db(lock_file); + + close_host_dbs((file_info_t *) NULL, (file_info_t *) NULL, (file_info_t *) NULL, hostaux_dbase); + + destroy_finfo(hostaux_dbase); + + unlink(input_file -> filename); + + exit(A_OK); + } + +insert_only: + + /* perform insertion */ + + sprintf(process_pgm,"%s/%s/%s%s",get_archie_home(),DEFAULT_BIN_DIR, INSERT_PREFIX, header_rec.access_methods); + + /* set up argument list */ + + i = 0; + arglist[i++] = process_pgm; + + arglist[i++] = "-M"; + arglist[i++] = get_master_db_dir(); + + arglist[i++] = "-w"; + if( !strcmp(header_rec.access_methods,DEFAULT_WFILES_DB_DIR) ) + arglist[i++] = get_wfiles_db_dir(); + else if( !strcmp(header_rec.access_methods,DEFAULT_FILES_DB_DIR) ) + arglist[i++] = get_files_db_dir(); + + arglist[i++] = "-h"; + arglist[i++] = get_host_db_dir(); + + arglist[i++] = "-i"; + arglist[i++] = input_file -> filename; + + if ( tmp_dir[0] != '\0' ) { + arglist[i++] = "-t"; + arglist[i++] = tmp_dir; + } + + if ( minidxsize != 0 ) { + arglist[i++] = "-I"; + sprintf(minsize,"%d",minidxsize); + arglist[i++] = minsize; + } + + if(logging){ + + arglist[i++] = "-L"; + arglist[i++] = get_archie_logname(); + } + + if(verbose) + arglist[i++] = "-v"; + + arglist[i] = (char *) NULL; + + /* "Inserting %s into %s with %s" */ + + if(verbose) + error(A_INFO,prog,UPDATE_ANONFTP_018, header_rec.primary_hostname, header_rec.access_methods, tail(process_pgm)); + +#ifndef AIX + if((result = vfork()) == 0) +#else + if((result = fork()) == 0) +#endif + { + /* Set logging on and make it not standalone */ + + execvp(process_pgm, arglist); + + /* "Can't execvp() insert program %s for %s database" */ + + error(A_SYSERR,UPDATE_ANONFTP_019, tail(process_pgm), header_rec.access_methods); + unlock_db(lock_file); + exit(ERROR); + } + + + if(result == -1){ + + /* "Can't vfork() insert program %s" */ + + error(A_SYSERR,prog, UPDATE_ANONFTP_020, tail(process_pgm)); + unlock_db(lock_file); + write_mail(MAIL_HOST_FAIL, UPDATE_ANONFTP_020, tail(process_pgm)); + exit(ERROR); + } + + if(wait(&status) == -1){ + + /* "Error while in wait() for insert program %s" */ + + error(A_ERR,prog, UPDATE_ANONFTP_021, tail(process_pgm)); + unlock_db(lock_file); + write_mail(MAIL_HOST_FAIL, UPDATE_ANONFTP_021, tail(process_pgm)); + exit(ERROR); + } + + if(WIFEXITED(status) && WEXITSTATUS(status)){ + + /* "Insert program %s exited with value %u" */ + + error(A_ERR,prog, UPDATE_ANONFTP_022, tail(process_pgm), WEXITSTATUS(status)); + write_mail(MAIL_HOST_FAIL, UPDATE_ANONFTP_022, tail(process_pgm), WEXITSTATUS(status)); + exit(ERROR); + } + + if(WIFSIGNALED(status)){ + + /* "Insert program %s terminated abnormally with signal %d" */ + + error(A_ERR,prog, UPDATE_ANONFTP_023, tail(process_pgm), WTERMSIG(status)); + write_mail(MAIL_HOST_FAIL, UPDATE_ANONFTP_023, tail(process_pgm), WTERMSIG(status)); + exit(ERROR); + } + + unlock_db(lock_file); + + if(unlink(input_file -> filename) == -1){ + + /* "Can't unlink original input file %s" */ + + error(A_SYSERR, prog, input_file -> filename); + } + + /* We must update the strings index files here */ + + /* Here we reset the fail-count to 0 since the insertion was successful + August 11 1995 */ + + + /*update_hostaux_rec_failcount_to_zero: */ + { + hostdb_aux_t hostaux_rec; + pathname_t tmp_name; +/* file_info_t *hostaux_db = create_finfo();*/ + + if(open_host_dbs((file_info_t *) NULL, (file_info_t *) NULL, (file_info_t *) NULL, hostaux_db, O_RDWR) != A_OK){ + + /* "Error while trying to open host database" */ + + error(A_ERR,prog, UPDATE_ANONFTP_025); + write_mail(MAIL_HOST_FAIL, UPDATE_ANONFTP_025); + exit(A_OK); + } + + sprintf(tmp_name,"%s.%s.0", header_rec.primary_hostname, header_rec.access_methods); + + if(get_dbm_entry(tmp_name, strlen(tmp_name) + 1, &hostaux_rec, hostaux_db) == ERROR){ + + /* "Can't get auxiliary database entry for site %s database %s for updating information" */ + + error(A_INFO, prog, UPDATE_ANONFTP_033, header_rec.primary_hostname, header_rec.access_methods); + } + else{ + + if ( hostaux_rec.fail_count > 0 ) { + hostaux_rec.fail_count = 0 ; + if(put_dbm_entry(tmp_name, strlen(tmp_name) + 1, &hostaux_rec, sizeof(hostdb_aux_t), hostaux_db, 1) == ERROR){ + + /* "Can't commit fail-count set to Zero for %s to auxiliary host database" */ + + error(A_ERR, prog, UPDATE_ANONFTP_032, tmp_name); + } + } + } + close_host_dbs((file_info_t *) NULL, (file_info_t *) NULL, (file_info_t *) NULL, hostaux_db); + + destroy_finfo(hostaux_db); + } + + exit(A_OK); + return(A_OK); +} diff --git a/archie/anonftp/update/update_anonftp.h b/archie/anonftp/update/update_anonftp.h new file mode 100644 index 0000000..7f597af --- /dev/null +++ b/archie/anonftp/update/update_anonftp.h @@ -0,0 +1,9 @@ +#ifndef _UPDATE_ANONFTP_H_ +#define _UPDATE_ANONFTP_H_ + +#define MAX_UTRIES 2 +#define UPDATE_WAIT 60 * 1 /* One minute */ + +#define MAX_NO_PARAMS 30 /* Maximum parameters for execvp() procs */ + +#endif diff --git a/archie/cgi/bin/archie.cgi b/archie/cgi/bin/archie.cgi new file mode 100644 index 0000000..2c8328f --- /dev/null +++ b/archie/cgi/bin/archie.cgi @@ -0,0 +1,455 @@ +#!/usr/local/bin/perl +# +# Archie Perl Client (front-end) +# This script needs the binary cgi-client (back-end) to pass the query parameters +# to. It then reads the result returned from cgi-client and reformats it +# for the http server. +############################################################################## + +############################################################################## +# These few lines MUST be configured according to your system. +# The first variable holds the full path to your cgi-client binary which could +# be of any name you wish. The $archie_user variable holds the user name under which +# your archie service is running. +############################################################################## + +$archiebin = "/work/archie/cgi-client"; + # You can rename the binary to archie.bin or any other suitable name you + # choose. + +$archieperl = "http://archie.bunyip.com/cgi-bin/archie.cgi"; + # This same perl script you are looking at. Where will its URL be? + +$archie_user = "archie"; + # If your archie server is running under another user name then please + # change this accordingly. + +$adv_page = "http://archie.bunyip.com/archie-adv.html"; +$smpl_page = "http://archie.bunyip.com/archie.html"; + # The above URLs will take you to our web pages! We don't mind but we doubt + # that you setup an Archie server for nothing! Please change the web site + # in those lines to your web site name. + +$gif_url = "http://archie.bunyip.com/results.gif"; + # Where the results.gif file is. +############################################################################## +# The following lines hold the different strings sent back to the httpd +# server. It is optional to modify them to comply with your HTML-look +# preference. +############################################################################## + +$excerpt_offset = 9; +$site_offset = 6; +$info_offset = 5; + +$archie_title = "Archie Results\n"; +$archie_header_plain = "

Archie Results

\n";
+$archie_header_logo = "\"Archie\n";
+$archie_continue_button = "
New Advanced Query | New Simple Query
Modify Search
:
\n"; +$archie_pages = "
New Advanced Query | New Simple Query
\n"; +$str1 = "

Found %d Hit(s)

\n"; +$str2 = "(%d) %s

\n"; +$str3 = "\n"; +$str4 = "\n"; +$str5 = "(%d)%s

\n"; +$str6 = "(%d)%s

\n"; +$str7 = ' 'x$info_offset."%d "; +$str8 = ' 'x$site_offset."%s"; +$str9 = "Keyword: %s"; +$str10 = "Date: %s"; +$str11 = ' 'x$info_offset."Size: %d"; +$str12 = ' 'x$excerpt_offset."

%s

";
+$str13 = "
\n"; +$str14 = "Type: %s"; + +format OUTINFO = +~
@<<<<<<<<<<<<<@<<<<<<<<<<< @<<<<<<<<<<<<<<<<<<<<<<<<<<< @* +$perms, $size, $date, $strout +. + + +format OUTPATH = +@* +$path +. + +############################################################################## +# END OF CHANGES +############################################################################## + +%proto =( +"Anonymous FTP", "ftp", +"Web Index", "http" +); + +%main_tran =( + FORM_PLAIN_OUTPUT_FLAG, "oflag", + FORM_CASE, "case", + FORM_CASE_SENS, "Sensitive", + FORM_CASE_INS, "Insensitive", + FORM_QUERY, "query", + FORM_ORIG_QUERY, "origquery", + FORM_OLD_QUERY, "oldquery", + FORM_STRINGS_ONLY, "strings", + FORM_MORE_SEARCH, "more", + FORM_SERV_URL, "url", + FORM_GIF_URL, "gifurl", + FORM_STR_HANDLE, "strhan", + FORM_STRINGS_NO, "NO", + FORM_STRINGS_YES, "YES", + FORM_DB, "database", + FORM_ANONFTP_DB, "Anonymous FTP", + FORM_WEB_DB, "Web Index", + I_ANONFTP_DB, 0, + I_WEBINDEX_DB, 1, + FORM_TYPE, "type", + FORM_EXACT, "Exact", + FORM_SUB, "Sub String", + FORM_REGEX, "Regular Expression", + FORM_MAX_HITS, "maxhits", + FORM_MAX_HPM, "maxhpm", + FORM_MAX_MATCH, "maxmatch", + FORM_PATH_REL, "pathrel", + FORM_PATH, "path", + FORM_EXCLUDE_PATH, "expath", + FORM_AND, "AND", + FORM_OR, "OR", + FORM_START_STRING, "start_string", + FORM_START_STOP, "start_stop", + FORM_START_SITE_STOP, "start_site_stop", + FORM_START_SITE_FILE, "start_site_file", + FORM_START_SITE_PRNT, "start_site_prnt", + FORM_BOOLEAN_MORE_ENT, "bool_more_ent", + PATH_AND, 0, + PATH_OR, 1, + FORM_DOMAINS, "domains", + FORM_DOMAIN_1, "domain1", + FORM_DOMAIN_2, "domain2", + FORM_DOMAIN_3, "domain3", + FORM_DOMAIN_4, "domain4", + FORM_DOMAIN_5, "domain5", + PLAIN_HITS, "HITS", + FORM_ERROR, "ERROR", + FORM_FORMAT, "format", + FORM_FORMAT_KEYS, "Keywords Only", + FORM_FORMAT_EXC, "Excerpts Only", + FORM_FORMAT_LINKS, "Links Only", + FORM_FORMAT_STRINGS_ONLY, "Strings Only", + FTYPE_NOT_INDX, "Not indexed yet", + FTYPE_UNINDX, "Unindexable", + FTYPE_INDX, "indexed", + I_FORMAT_KEYS, 2, + I_FORMAT_EXC, 0, + I_FORMAT_LINKS, 1 +); + +%result_tran=( + PLAIN_START, "START_RESULT", + PLAIN_END, "END_RESULT", + PLAIN_URL, "URL", + PLAIN_STRING, "STRING", + PLAIN_TITLE, "TITLE", + PLAIN_NO_TITLE, "NO_TITLE", + PLAIN_SITE, "SITE", + PLAIN_PATH, "PATH", + PLAIN_TYPE, "TYPE", + PLAIN_WEIGHT, "WEIGHT", + PLAIN_TEXT, "TEXT", + PLAIN_PERMS, "PERMS", + PLAIN_SIZE, "SIZE", + PLAIN_DATE, "DATE", + PLAIN_FILE, "FILE", + PLAIN_KEY, "KEY", + PLAIN_START_STRINGS, "START_STRINGS_ONLY", + PLAIN_END_STRINGS, "END_STRINGS_ONLY", + PLAIN_FTYPE, "FTYPE", + PLAIN_FTYPE_INDX, "FTYPE_INDX", + PLAIN_FTYPE_NOT_INDX, "FTYPE_NOT_INDX", + PLAIN_FTYPE_UNINDX, "FTYPE_UNINDX" +); + +$ENV{"ARCH_USER"} = $archie_user; +$| = 1; +open(stdin,"-"); +open(IN,"$archiebin < '$stdin' |"); + +$i = 1; +$s = 1; +$top=1; +$k = 1; +$no_sites = 1; +$entry{"FORM_GIF_URL"} = $gif_url; +$entry{"FORM_SERV_URL"} = $archieperl; +while (){ + chop; + if( $_ =~ /^$main_tran{"FORM_PLAIN_OUTPUT_FLAG"}/ ){ + ($junk,$flag) = split(/=/,$_,2); + if( $flag == 1 ){ + ## This is for plain results returned to the web + ## server in record-like format (no processing is + ## done on the results). Used for certain types + ## of URAs. Unlikely to be used by our clients! + print STDOUT "Content-type: text/plain\n\n"; + print STDOUT $_."\n"; + foreach $k (keys %entry){ + if( $k ne "FORM_QUERY" ){ + print STDOUT "$main_tran{$k}=$entry{$k}\n"; + } + } + while (){ + print STDOUT $_; + } + exit 1; + } + } + if ( $_ =~ /^$main_tran{"FORM_ERROR"}/ ) { + $entry{"PLAIN_HITS"} = 0; + ($junk,$err) = split(/=/,$_,2); + &print_error($err,$entry{"FORM_GIF_URL"}); + last; + }elsif( ($i == 0) && !( $_ =~ /^$main_tran{"PLAIN_HITS"}/ )){ + &print_error("Returned results are incorrect",$entry{"FORM_GIF_URL"}); + last; + }else{ + if( !($_ =~ /=/) ) { + last; + } + ($junk,$value) = split(/=/,$_,2); + if( ($i == 1) && ( $junk eq $main_tran{"PLAIN_HITS"} ) && ($value == 0)){ + &print_error("No hits",$entry{"FORM_GIF_URL"}); + exit 1; + } + if($value eq ""){ + next; + } + $main = 0; + foreach $key (keys (%main_tran)) { + if( $main_tran{$key} eq $junk ){ + if( $key eq "FORM_ORIG_QUERY" ){ + $value =~ s/"/"\;/g; + } + $entry{$key} = $value; + $main = 1; + last; + } + } + $strings_only=0; + if($result_tran{"PLAIN_START_STRINGS"} eq $junk){ + $strings_only = 1; + &print_header($entry{"FORM_GIF_URL"},$entry{"FORM_SERV_URL"}); + printf STDOUT $str1,$entry{"PLAIN_HITS"}; + $_ = ; + if( $_ eq "" ){ + last; + } + chop; + if( $_ !~ /=/ ) { + last; + } + ($junk,$value) = split(/=/,$_,2); + if($value eq ""){ + next; + } + }elsif( ($main == 0) && ($junk ne $result_tran{"PLAIN_START"}) ){ + $entry{$junk} = $value; + $main = 1; + } + + if( $main == 0 ){ + if( defined($entry{"FORM_DB"}) && ($entry{"FORM_DB"} eq $main_tran{"FORM_ANONFTP_DB"} )){ + $db = $main_tran{"I_ANONFTP_DB"}; + }else{ + $db = $main_tran{"I_WEBINDEX_DB"}; + } + if (($strings_only == 0) && (!defined( $entry{"FORM_SERV_URL"} )) ){ + &print_error("The submitted information does not include URL information. Read the HELP pages to setup your html page correctly.",$entry{"FORM_GIF_URL"}); + exit 1; + } +# do while instead + + while (1){ + if($result_tran{"PLAIN_END_STRINGS"} eq $junk){ + last; + }elsif($strings_only == 1){ + printf STDOUT $str2, $s ,$value; + $s++; + }elsif( $result_tran{"PLAIN_START"} eq $junk ){ + $rec_num = $value+1; + if($top != 1){ + $old_site = $curr_site; + $old_str = $curr_str; + } + }elsif( $result_tran{"PLAIN_END"} eq $junk ){ + if ($top == 1){ + &print_header($entry{"FORM_GIF_URL"},$entry{"FORM_SERV_URL"}); + printf STDOUT $archie_continue_button, $entry{"FORM_ORIG_QUERY"}; + foreach $k ( keys %entry ){ + if( $k eq "PLAIN_HITS" ){ + printf STDOUT $str1, $entry{$k}; + printf STDOUT $str3; + }else{ + if( $k ne "FORM_QUERY" ){ + printf STDOUT $str4, $main_tran{$k}, $entry{$k}; + } + } + } + print STDOUT "
\n";
+												$top=0;
+										}
+										if($db == $main_tran{"I_ANONFTP_DB"}){
+												if( $old_site ne $curr_site ){
+														## Do some processing for a new site
+														$no_sites++;
+														printf STDOUT "

"; + + if($result{"PLAIN_STRING"} ne $result{"PLAIN_SITE"}){ + printf STDOUT $str5, $rec_num, $result{"PLAIN_SITE"}; + }else{ + printf STDOUT $str6, $rec_num, $result{"PLAIN_URL"}, $result{"PLAIN_SITE"}; + } + } + $str = $result{"PLAIN_STRING"}; + $size = $result{"PLAIN_SIZE"}; + $date = $result{"PLAIN_DATE"}; + $perms = $result{"PLAIN_PERMS"}; + if($result{"PLAIN_STRING"} ne $result{"PLAIN_SITE"}){ + $path = $result{"PLAIN_PATH"}; + &print_spaces($info_offset); + printf STDOUT $str7, $proto{"Anonymous FTP"}, $result{"PLAIN_SITE"}, $result{"PLAIN_PATH"}, $rec_num; + + $~ = "OUTPATH"; + write; + + $strout = "".$result{"PLAIN_STRING"}."

"; + $~ = "OUTINFO"; + write; + } + }elsif($db == $main_tran{"I_WEBINDEX_DB"}){ + if( defined( $result{"PLAIN_TITLE"})){ + $title =$result{"PLAIN_TITLE"}; + }else{ + $title = $result{"PLAIN_NO_TITLE"}; + } + + (defined ($result{"PLAIN_SITE"})) && ($site = $result{"PLAIN_SITE"}); + (defined ($result{"PLAIN_TEXT"})) && ($text = $result{"PLAIN_TEXT"}); + (defined ($result{"PLAIN_STRING"})) && ($str = $result{"PLAIN_STRING"}); + (defined ($result{"PLAIN_SIZE"})) && ($size = $result{"PLAIN_SIZE"}); + (defined ($result{"PLAIN_WEIGHT"})) && ($weight = $result{"PLAIN_WEIGHT"}); + (defined ($result{"PLAIN_TYPE"})) && ($type = $result{"PLAIN_TYPE"}); + (defined ($result{"PLAIN_DATE"})) && ($date = $result{"PLAIN_DATE"}); + (defined ($result{"PLAIN_URL"})) && ($strurl = $result{"PLAIN_URL"}); + (defined ($result{"PLAIN_FTYPE"})) && ($ftype = $result{"PLAIN_FTYPE"}); + if ($strurl eq $title) { + $title =~ s/:80\//\//; + $strurl = $title; + $title = "(NO-TITLE) $title"; + }elsif($strurl !~ /:80\d+/){ + $strurl =~ s/:80//; + } + if($site !~ /:80\d+/){ + $site =~ s/:80//; + } + if( $old_site ne $curr_site ){ + ## Do some processing for a new site + $no_sites++; + print STDOUT "

"; + + if($result{"PLAIN_STRING"} ne $result{"PLAIN_SITE"}){ + printf STDOUT $str5, $rec_num, $site; + }else{ + printf STDOUT $str6, $rec_num, $strurl, $site; + } + } + + if($result{"PLAIN_STRING"} ne $result{"PLAIN_SITE"}){ + &print_spaces($site_offset); + printf STDOUT $str8, $strurl, $title; + defined( $ftype ) && ($ftype ne $result_tran{"PLAIN_FTYPE_INDX"}) && (print STDOUT "\n\n".' 'x$site_offset) && (printf STDOUT $str14, $main_tran{$result{"PLAIN_FTYPE"}} ); +# defined( $weight ) && (print STDOUT "\n\n".' 'x$site_offset) && (printf STDOUT $str9, $str); + defined( $type ) && ( $type eq $result_tran{"PLAIN_KEY"}) && (print STDOUT "\n\n".' 'x$site_offset) && (printf STDOUT $str9, $str); + defined( $date ) && (print STDOUT "\n\n".' 'x$site_offset) && (printf STDOUT $str10, $date) && (&print_spaces($info_offset)) && (printf STDOUT $str11, $size); + printf STDOUT $str12, $text; + } + } + + undef(%result); + undef $site; undef $text; undef $str; undef $size; undef $weight; undef $date; undef $strurl; + }else{ + foreach $key (keys (%result_tran)) { + if( $result_tran{$key} eq $junk ){ + $result{$key} = $value; + if($key eq "PLAIN_SITE"){ + $curr_site = $value; + } + if($key eq "PLAIN_STRING"){ + $curr_str = $value; + } + $main = 1; + last; + } + } + } + $_ = ; + if( $_ eq "" ){ + last; + } + chop; + if( $_ !~ /=/ ) { + last; + } + ($junk,$value) = split(/=/,$_,2); + if($value eq ""){ + next; + } + } + last; + } + } + $i++; +} +# printf STDOUT $archie_continue_button, $entry{"FORM_OLD_QUERY"}; +if( !defined( $entry{"PLAIN_HITS"} ) ){ + &print_error("No hits",$entry{"FORM_GIF_URL"}); +}elsif($err eq ""){ + print STDOUT $str13; +} +exit 1; + + + +sub print_error { + local($error_msg,$gifurl) = @_; + print STDOUT "Content-type: text/html\n\n"; + if( $gifurl eq "" ){ + print STDOUT "

Archie Results


\n\n"; + }else{ + printf STDOUT $archie_header_logo, $gifurl; + print STDOUT "

Archie Results


\n\n"; + } +# print STDOUT "

Archie Error


\n\n"; + + print STDOUT "".$error_msg."

\n"; + printf STDOUT $archie_pages; + print STDOUT "\n"; + return(1); +} + +sub print_header { + local($gifurl, $url) = @_; + print STDOUT "Content-type: text/html\n\n"; + printf STDOUT $archie_title; + if( $gifurl eq "" ){ + printf STDOUT $archie_header_plain; + }else{ + printf STDOUT $archie_header_logo, $gifurl; + } + print STDOUT "
\n"; + return(1); +} + +sub print_spaces { + local($n) = $_; + print STDOUT ' 'x$n; + return(1); +} diff --git a/archie/cgi/html/archie-adv.html b/archie/cgi/html/archie-adv.html new file mode 100644 index 0000000..14f1a2f --- /dev/null +++ b/archie/cgi/html/archie-adv.html @@ -0,0 +1,47 @@ + + +Search in Archie + + + +
+Archie Query Form
+Search for:
+

+

+
+
+Database: Anonymous FTP Web Index +Search Type: Sub String Exact Regular Expression +Case: Insensitive Sensitive

+Output Format For Web Index Search: Keywords Excerpts + Links Strings +

+
+
+

Optional Search Parameters

+
    +

    +

  • Maximum Hits:
    + +
  • If you want to limit the search so that it only looks in certain domains +(such as ca, edu or com), enter one or more in the following boxes:
    + +
    + +
  • Limit the search results to match a directory path (this is optional): +

    + +
  • You can use as many terms as you like in your path restriction field, as long as you separate them by spaces. The operator among these terms is: +
    OR AND
    + +
  • Exclude search results that match a directory path you don't want (this is also optional): +

    +
+
+Help | Simple Search | Archie's Home Page +
+
+ diff --git a/archie/cgi/html/archie-help.html b/archie/cgi/html/archie-help.html new file mode 100644 index 0000000..d650ade --- /dev/null +++ b/archie/cgi/html/archie-help.html @@ -0,0 +1,138 @@ + +Archie Help +

Archie Help

+
This help file explains in moderate detail what each field in the search page +means. If you still can't locate the help you need or you want to report an +error please mail us at archie-group@bunyip.com and we +will get back to you as soon as we can. +
+
+
+Search For: +
+Here you type in the search variable. If regular expression is the type of +search you are using then the string would be the +regular expression you are +looking for. +
+ +Database: +
+The database which will be undergoing the search. If you are searching the +web then press on the Web Index button. Otherwise if you are searching +the FTP sites then press on the other button. +
+ +Search Type: +
+
    +
  • Exact: +
  • Sub String:
    +Substring (case insensitive): A match occurs if +the file (or directory) name in the database contains +the user-given substring, without regard to case. +
    +Example:
    +
    +               The pattern:
    +                    is
    +
    +               matches any of the following:
    +
    +                    islington
    +                    this
    +                    poison
    +
    +
    +Substring (case sensitive): As above, but taking case as significant. + +
    +Example:
    +
    +               The pattern:
    +
    +                    TeX
    +
    +               will match:
    +
    +                    LaTeX
    +
    +               but neither of the following:
    +
    +                    Latex
    +                    TExTroff
    +
    +
  • Regular Expression: + Regular expressions follow the conventions of the ed(1) command, + allowing sophisticated pattern matching. Regular expressions imbue + certain characters with special meaning, providing a quoting mechanism to remove + this special meaning when required. +
+
+ +Case: +
+This option only affects searches of type Regular Expression and Substring. +
+ +Output Format: +
+This controls the output format for results from the Web Index database. +
    +
  • Keywords Only: The most frequently occurring Keywords in each document will +be displayed after the document's URL. +
  • Excerpts Only: A short excerpt from each document is displayed +after its URL. +
  • Links Only: Only links are displayed with no further details. No excerpts +or Keywords are displayed with each URL. +
+
+ +

Optional Parameters

+
    +
  • Path restriction or exclusion: Several parameters could be used to +improve your search results. But first you must specify what type of operation +to be used on those upcoming fields. If you specify OR then you ask +that the strings you provide in these fields have an OR relationship among +them. Otherwise if you specify AND then you are asking for all the +strings that you provide in these fields to be considered. +
      +
    • Path Restriction : You can improve the results by restricting on +the path of each URL that comes back. The strings you provide in these field +will be matched against the paths returned in the result and paths that do not +contain these strings will be disregarded. If you have chosen the OR +as your operator among the strings then if any of the strings occur in a path +this path will be considered valid. However if you have chosen AND as +your operator then unless all the entered strings appear in the path, the path +is invalid. +
    • Path Exclusion : You can exclude certain results from coming back +if they contain a specific string you don't need to see. By specifying this +string in this field you will achieve your goal. +
    +
  • Domains: This variable allows you to restrict the scope of +your search based upon the Fully Qualified Domain Names (FQDN) of the +anonymous FTP or Web sites being searched. In this way, you can specify a +list of domain names to which all returned sites must match. + +
  • Maximum Hits : Allows Archie to generate at most the +specified number of matches (permissible range: 0-200; default: 100). + +
  • Maximum Hits Per Match : Across all the anonymous FTP and +Web archives on the Internet (and even on one single anonymous FTP archive) many +files will have the same name. For example, if you +search for a very common filename like "README" you can +get hundreds even thousands of matches. You can limit +the number of files with the same name through this variable. + +
  • Maximum Match : This variable will limit the number filenames (or +strings matched) returned. +For example, if maxmatch is set to 2 and you perform a +substring search for the string "etc", and the database +contains filenames "etca", "betc" and "detc" only the +filenames "etca" and "betc" will be returned. However, +depending on the values of maxhitspm and maxhits you +will get back a number of actual files with those +names. +
+ \ No newline at end of file diff --git a/archie/cgi/html/archie.html b/archie/cgi/html/archie.html new file mode 100644 index 0000000..e297eee --- /dev/null +++ b/archie/cgi/html/archie.html @@ -0,0 +1,30 @@ + + +Search in Archie + +
+ + +
+Archie Query Form
+Search for:
+
+ +
+
+
+Database: Anonymous FTP Web Index +Search Type: Sub String Exact Regular Expression +Case: Insensitive Sensitive

+Output Format For Web Index Search: Keywords + Excerpts + Links + Strings +

+
+
+
+Help | Advanced Search | Archie's Home Page +
+
+ diff --git a/archie/cgi/html/query.gif b/archie/cgi/html/query.gif new file mode 100644 index 0000000000000000000000000000000000000000..9708601763b391255865ae9ad84cbdf046fcac89 GIT binary patch literal 6845 zcmdUs`9ISSz`#HIjG23zVa_&l%{lj#%#kZLc z5=!}^6v+{ZeCz9ZoK{OEr6jfr0KjdYfuMI$|WusHE4E1E^8B}P-cob5MXHO@aRp00{EB4A#z>{%@O z;QZI8ucqg}Zbm0oS=d);85QFQ#TXomPOqX+XkK1)KfhvUXPTB49fxD#a8(#g6#z6+ z5MC^d#b6>0`2P>?Hx~o|KtS#PQvUA=iRX|Crlittq@`zMW@XcJZr)<#GHW+|^nKlHX*4V&iKU8aJQEBgJhw&n~q1BueDBrW*!52frBWc{c zX55e1004P2Ju~~Jp|wr5V_t>Z42kPuLQRZJ)&zxxVFa${6~=42a{F7`S={Q}1egFV z!-jO5e#Q8|8wj}O@nld0ezdqLJY5L3DUBkt!&oT^CgB-A9FkRky74)h=Uut^?wfaE zy8oI}z12eBMTPpc-gc*Y&!^0zf&dVjpMB;#7TXj6fr?&YB$eh?l!}S^G34I?=@~p& z@8+<(a)UWkRr5j2yM=m^^xEO{HFX<6K8GiozuR+<_?(l6o{@;NiJgCuC5&mQ>YS*f za^J%915Yd?p|F@|f&N)ncm!f4?rhZjc&+&^EB1&$Wzv(z45_{Oj~Uso?+r@x{%uwp z-$yKGab{M-Yr|_TnuYxat|+moQ8C`FunV`K5bkGf4d11ffmRd5VsNr0x98N9XSX>Q(pJ2+N*Ho))rWNPG9iL|ChIP% zkL#JCA}LZw{+Fl~RCj;DLnwLbf*qJlOZ8PYMk662TZ*?pNxtoSLP9NWvseZ%h&o!@ z3uW@}6WKnI#`0-0hXU|Sj?7VQZ3P90!$w5;4Ts373PA7}J5{jFXh6zFPYj$Cw09QG zb$cd2BDu<6_-JD%sOmWZr1)h`F4p=JTazlg19bdqYqV}rrH_KD4Xipo9g0=>FUe)=Pk9syPAZrR;gM$neXv{35derj zRSXga4R8XLb=ur zFYC;NwXgr0BPta4&InVm`tJgz)&W2D{`I|os64MSd1S^uM$e+pko8A`Hgi}D3>%H# zpFit$n)CRomh4Tq=GguITAHqrpiS^UngUTB3Ob)0s-u)!FE|-}AHx>wAieyUZq+C;(vMUL-d23DM^X>IAi6Ed~ZV}ZbOcj^FF z0o3(Xs+VEuG=I$R6p6|~d8EoB?}NOy3^=GgL?0`f)`E&< zVs(CZkTa$ssYp{QOf(+S+V&e1@20|J`c9O5*Fs@XwDXFS4)6dXBqm-1Y3a+K$wy4Z zWGHY8wgkE*wFu>Mv~^r0Y#V67_T3zY0r1z~N=19br-uT56XHE$gbbElRXujn)m&Al4c`M zfo?fkX6k3&;|a*YxlSQe@-5h8N;1Fnl3dXpI|S;mHsAoE{dTh9v*wbVazw<|&2POe zvccax>48{vbY4F$(WuU8ZL#!f2}Rq)Fu)GxOs(g8QyG0cM9tI|ZgAD+YUOJ7DfN`1 zQm;xQ0kFZZ_vf2!BYpf|_K;Joj}%I!4=Tmss3|T0xm9xD>V#{RYnKyf#qo!C6pUa# z&CKCa&$vw9@e~8ytL&<6I5}f^aO4?F0fP?HK0)+aZ|~&yI`_6#t3E5Al>Q4EkxDfM zHS8TKjE)5nhP?y6-rBd%(u3(HkV1R>1 zNJMy*?8&AqrFIQQO8&E8KZhe84xc3F_K{q+^bH5tT+E-ZgCwEtQRf9Zbjs>_oy#pI z!43Fm>JwvevzcY|1Na#RJ?81|zoo4pG-VM#;v=ME<_r<^u!UYXHkW6nx4%dK0l-^3 z-ksE)l#3S&CE)mGZ-PVwjx#)ud#J18#?F_Pr#1lsm%|g(p`iN80rI_MrkXq;J!~66 z#6pBH=0<^MCS}4e@faS(5`G?5N`!1YaeWe+8Kj9Tq2y!F?yp2wG(Q27I= zM?P6E<*Xpd`3ci!_copNyeav|Xgo8OuKbFBRxVsYk|&9aJTIiY ze=B`z{G?FRerzD|$9*X(jJzK7JB$RCat+}zEQJejc(*hs9FEe-0K|W*6Taa4ajRD^ zFQ`{Ahfi3%M1?vbNt!&gY#_zE+6YOh`a+rKYc2`;W~aD2%iN)+JsOCzw-C9rtJvFY z_1VhF$N$>8=j7@M1o#Ad^JCnLOZ%Vujx%m+>_|(|2P}G490bnQ6lMWjx+iOyW-l@i zYI`Hp2($BBCT-&LW6~REb*lo%=#-~il?~N@Ox+sV#u!{^dHsT(&_OxL>r5_tH$JoB z-(I;96dDp0&!Gsj0sCR4@$_GIOo`J+mLSVOlgPPXm$+*z4`_V3m z9%obR-$x1$=N(4waU~qtw;S>k{rFYa9SpV2hue#XUtUyo_B|2e3k(jNa*s;%(K=C6 zsbAj=T$`|z?YxFN_ZO(c>a0d93 z#RQSJvazu`_{)(vQS;`I*g;+B@J+!VZYp}jQVfFoH^SNXrfMY011|xRO+h1!p@QkA zHVH`1m29#|CE*VSy{|87X`&dNPPzZaspzeuwaXFwPT|$th;BExCA@(G2~;Bkf(UOh zKW&5$0J4qqnS?bQpv};3DR=W` zqw?;MG_tN-6yQV!E(#^>hEgPaW}VN7WvHvKVlJFk)w%4EQhM~DI#)4-*ZcQjJ~YPd zETKT1x1a$mV8z2_sgS*8ox8Wsmig)~h@NY5)5Vhuk%&UZ_T6{O0$<&H=a$ciJ#7ktpsnDjtY0dYue4B^Qr8DIR-Qj9P%E`kX(`>!nBq z&HNzQslYcq=eq`&`CVm36u87o{Y)rf$f*d8U(6W{l1*du^c^P!o|lU`EAFnVG>Fc( zRfODC)gIQ&87=|5e6~Z*l3ecJi}F2%Ddp=dO(R~|i8pu`Un9~G=7`5D2@LLUx%El*gn(}q z$$rO`2aZ1D3rypK^d$tgw~0(q{Z9lE7#4B!ZOSI{K(Fs1pMbNa3i9@rL~J$n_~Epp z(|{)JxKF&IaB-Xp1YdK_vM%4N{%sazrjU|6D0|Zih#6`8)d^zD)U~1>-Y=~dS5Dnz zq-R8geP^kZkO6xS=*#EUCasBXZyU>9EX8_HbPc$QmED%*H-c^%IqNexh4r`dm};lQw0VPJtDNKi5WI}s1GIizoy0pTL-7cG;R%2o{%mDf1>GF zw>UsV|9*~p7z&?f1}&;|c2wDCW+Wc1WQT(qN+&w`C~!g71aeeJs1fkIN#+>b{OZqw zUQ|~qQG@+&S6?D;YFGBZE2?PKyaE31-Zk}s(Y!jYu778lz1t6SsNt^x_Ccuao=XF# zpD(su)``G|MSzDoex8x0!nn{i#I^hK?HBVASk>sFw5-V`v`DEEA4b|#K~X)zdTl`s zt$N~=zlB(G$DXs|KNFx6r8RB*s_{60M7XRmEV3jlSY@i~mSj!h@dX~v6B9|1h?t5C zF`Q(JN+i z6ZqjdxY8b3F8LmZT1q32>0*-faF{bGb2}1@T@)-Eqo$qxf(B>x0ww6w@yATTsEbL* zJ>FZ0RXlJ$YA6-lAnmgxWC^FMJkVAy2cIbE?h_`1ABpBLr896k?9 zzOZ&5y8tjUlDPnlNK!<`%%lxW=`v%- z(9Y>$aha#4rq1GrZoUn&uQR+B)F($PlX2dU+nQ0%)h2wRh&Uw$ya;oe3qGPo4%mKi zB)ATK`MI6$^K`y#!%n4?FS;*r5YwiC_D4+eocL+|fpJ-Q`}s(Gam!o!3;I@O%0OjU z7N9iv;;}X?gHkN26mZNbSqVo@+-_-?b(GpCB36A`4wR2ARKEnv&`=4`%{Si21mClA zN-_6Zr23&EVo}MyIm=^RKG}9?c9DO>Qh<94s3~m?tuamreI7F8)sBUlv9-I2;2rs@ zU5@gM2LrdzZisg1Y^Nt4N3aEyC!l!)jLr#>Ihk4eDWv#lL8_~0uA!bRCl_yw>ZDP# zG-*h!g5+%YhZ_G^CJ1mTJ!z(0vdqT5)k2_rQS|%;*Unu;zPtB=m=btA{IFCGCTiLi zHLuw8`omxT<)FDxmypLp%0!cgm~+wT<8P$hP*B-Pqa%MM zRvZ_j8<6B6otu~-)0DQ6iA!DE`8~;#T?II*5%7-_E(y9u8kN4}ctbGGfqqs>Rqq>W z@kZoa!4DoieuNq1+?U|+g{Ol~`P(^wt=8#P+M1myRC+POKvTU%W@jLQ>)xU6%QxV& z3t|$knWzcUc;n|{(PX2q60{T)2e)y#%Hmm)r=bs22dikD)O*#bb-me5$l~J!jx3Vy z>K0|H*}SnkFQl-SkUD<#%*5&Jc(@)7?;zBl!ro}7$(Xfnsw_VVo{2N5c;U0A4_nO^SgP!Ze4!l66kfgR_AMCjw>bDWUO58u@xtT1S4`5K3)S5o zEQQ{UAG)A<+d)j{ciur-`scqYnTaR4-=Lq~Qv0s`wWja3Vv$0R)RnueV_KZu1MjC% zwNgV$FM(8s^y*2S_&=Fl-Tiu!KRrVSV$`l%(PY<{?ZUf9x&F; zb0!42sP}97(l`<`k_r=$wq*fLWvSeJ;_!H5^Boe%g^UV(Kd_^i z0)^|!Y@>0kWG6JTJf-Gxt>s0BB5fCA?OL^ZbYpn5%I>$8aIR+(al~or>6mrme~Ag~ z#b@njK9(Pd?@p<^a9#e4C3C#br=EQ}Em)lEKi7M1PV!6L#Z;IG!K1AKaQX58DJW@} z0YJcUOI{)A6^HjSKHzGTu1cU{L8NP&3`zl{6|i98*W5@ ziNl0F0@xRtS&#(Bq4_9|CP&7m@`>|WT7KU{oJ+y}R813#?=Al@j~+Uq3V zXOK#%0IX*-m8)x(veepEma+*O%_q-`6u>{_81}^Z_^SnozlpJGbuV`j|D`bPDa;6% zrd3ti9pCD{2P1TW)kl*tYwPVdoQoE!ebU+r8M!I-8=c?7YkQj% zJ{Nv_IIEAfc)b3lezS*=Fb?T{qBy7g2wys?{tT|vzy|&U!`3;vT16XuXb%Amh?L>c z&AOWq%+qIsComXXTOc1(^ELVDb zay#tjL>h|G2Q9k$bvPL1m-=(c^|fTYBOfdnxadCo%8veblU4kHV?i9(t)1>Kp+tO z{P~l|awyjCX>lvFj7-f6A}_)Vq!u=LjwW=JUu;KTwH8zZOzTi zNhFevjt&-!MWIkVZEf3`+iBa1ZQZtlk&uuY6SJ-RUlD;oz~OLMtPT!0Mk3h~aBcO~ zjD#3YYA7?nRtJZTF(>qtrM58>>O*Z)T}UoExKI+VjFDQO8rs8*X=8+v2)Ozf7fu;t zx}}9*?X)PR`KfQ7bgAI}9&=wO-4Sbb+U4Ym#TwERD2OG`@&gM-^k|6g+d2TUMX`uTHV8{0Os zrKRbGg|X@B!LhNPZGMA;Z9P3L+noN7B8OAGv@}*lqvzn;x59NM)3T#-t`}<4ItI#xPPD^{EU_Lh5!_H9^NSA(a!8 zzzL11_Y5d=@nqV%Y->240o9%X^)8-eo&g+Nmuhp{GLkvd+?GQ!uP2#vbV$`YqJ2ZgOiVL1S5yP8_+>p9ic^-SjW@|fEdk-9w?r_II1v$~p-kidwENi{dO zC6UY-jP0UpOGsdrm9;RLoY2rz24g#`B{j7^A)%VVXo=b0-q3A_`hWmNKtQ#N3)9oH z-qVv~Ys<8?Epu_%4yw(~w_^@zdp=|H zhcu`|>LKU=06^G8fB*mk^tNN*f6oL3B>;p_%FbMNdnQU+H!wF2vV&pOEyA3euXGpS zjE_wAHrG8X#@pp9?_HhCPLsnr2PhmVy$S#!{Z@A0#T8BBW(F$luI;ZeFRk)t0csg= za}kUTp2)sBe2rG;QsdHcW3&__X2qp9c07d>uHynx0aUXj_i8iS< zK!!KR=)T9AhEbUl%iKW+POa*eI;Rlv?}wn!jPk~ zTmc*857$Qg2jL2=9*xc^()V#ZT}drXt1gCFeRt4B{Ul8&uiLqS$4JxJtqjgv^@!ZJek?zFdH_StCk^z#+ZFSe2c5Z@r5%=+(gCwq= zP)RzB>^n{tb?yzz%xXW!D|Llsv#q#Iu!6jYcOwGgS4URG&D$D(go7XX8@LLgrq!an z^{aNe7Fi!}FEU;%3RcH09*roz4Es9bHK70B>AL5~^8Q56d-vh6&s606Sb0h(5uQ1S z%cnb>cATWgIi*U;s9jP?DoaPIrYx=?5hvZ~g$OY^+dx>MtJVpq+&b3|3qweu6i#kA zr6VMWY{=7fXTpG?*e|(>c2wARoIcvwS%LoX?ypa^#j_oYVSu6VP^fh1QQ+qK-Qksd z=Ai#egDgk#Y#7Sv$J>y%R*vorDb4ruaZ9-SQH=cU zMiZ~|tlSLU`nI0=3({?xuv%QFs791ELoN1%^&Q-=<sAo(4TR@aU+EcRQ`k1Vb}{vsFNwpL?pbGjXs{B*z7y7KUTvt#%FO+4}1 zSbcEotNIt4)xOj{MQiq@hugy26#(#*2XkI!Dg52{DnN{7)z^x4>Z((HtCod}z+uj}arw*1Cg;4!V zKu*nmV@7Fo;x;`p%pR^3#xd)Z7o4A2yjdwq9;j3O-TutxS99?x^i}-Z++vJMr|O^O z9JN2>UPp`75*9xDJ6SP?ui$L4td7P+{uAwRL z;LeJ!)REOagg6~n0)99n&DcQ>uFqtiq0{&mwq;iK?h_tNA3@V-!>hoeW0iIj z`CrQKTTF5Gw{*xRy*tJvu)CCO-cD5Vsey&#b_A}&p%XnII*sdi$c&$B&ay?=i?kz9 zzYO6#Gs0@J({5F}Mn`Kojpqc)Y>E_7KX1o}+JLCuKPV-(f=lsf`ZU z5f%G84R*-XlQ-e~jOSV%aN(2dewg>3JmbIdfKgey*ds4Zc#x%D?8uz#>wUo&pyqoQ zB!SLu+Qs2G58R{kSo80>CC63g&{sKn2ej&z!pLJbS)+3T@&1A=?|!}TLJLFc z6S-m`A{#7@9i51zIf#c^H7JX# zuIY zV)%_`2)SA4LMaB8#>>P{OXurh$sOY{Z?_9#La5Tej+nMySlMSCLCCE02tkC!L=v zompBIrzqgmgpCz@Z%;MVwV$h0ycyk4Ic z;&mn9`v8)Rn}Jy%D3U@^5UO>f80DuXp43Z0e7XXl8G~hK$TbfaJJKDjIu#`8mR~A* z-6siN2pQVyaL_qQ%dPd5V&t*Y1Xz6Ue?RVTv~0cCI=&gad*BmaIOg!y5j(A9VlbZksRlwtF>l zgVDad^L{ysE?QAD7_nRcnGs!cEdzklu?PYFFF$8B6BJECG4S(omR;xCvEf@t7qMbX z(XB|>8B)~2)aPkgGZ)rH#?p?j(_UYNJ5fAr9lYlfeVyy0Mfv+iR@}K|dSSGESh9)? z_e`|LK1FWQk1$YoT_OWQD$fW-B_`)-;SpCNVdEJF+E7`d8^y(WZiHTS-z*tvL`9rr$`nuBxiZI`k2gkNu7j-uR#%`AjF3V zB!IBIZ_P;<$8wkBGCYMq3A~r=&tM;1&WT0eG^~fQwzqr>4RnZF!B;{(>{ojDht3Jp{Ph=?zh>b)cMp3`C4)E5QixqkBIAClDUBC}~ zjS7gWm2MxG4yPlJEF&d|AexP``vFQ)g5Fn1j?=^{kh0^%gT){w;6iFAA<&Nm%mQK$ zXeAH0qHk!YJ35%6_fq@+DdH!JOw+_pt?Hb8mx3|{MCoaMbk~#hz#~*~wGi?oUAR>G z&{u(^z7$=2jE_3TJ+vqTyrhFoKB(vOWH}G@d&_$;B8LxuH^U8=Q9CjBb9_`vjMr&m z_phC-h`$J+p`QT~?}-@4$layB5`MR>&uf|pf5$zWiHhkAKagQNz^dV8 zmai|1-$x#oJc0@7^DVC3omCoHsCC$}6R>%xRv4<_^}zZyTXB(Sy%C{|`i{%b6q|#@ z65g5l9XNU07ofoERDWny^#nE2c0Iz@KEYc5oKw1e0$smC9pLY*XA!eJMDeG9dqj!d zu$XnCgzEzt%?{SvbH^3#X`Hn?xy~}utyBE4-0&Y=ove|iL7)f=*Z_g#hF1#V;ryP05KO~WBfS8lSLq$%g*B%8spiwP&pt4d# z5+nQ}5{-=-*i^zN#C)DP{6H7of#sm@X;_Cw6n>{?r5ml)6F)%Fz7wfvIl^7MvDQy{ zVgAmKikt@zmBbBidvbW>KTsOIZ`1I;5&q>>Koq8ti2*#j9}pGe-UGEuRJ z9N`{sr{PxcO-rAYKF}I}%$Z5L9QOLeH3mvLWI>MEz?I2j)RQ9Q3bHLLedAc^2H z1)*pjS8SQ6^%bE0UdJN&t$(}4=CI|+IPvBgd^hdLNP-=bvfDKuh-!FXD_8qbTH+BO zBV;C_a{%!0#O=3;(tma@Wtc8e*LY_I*A9vP7FH7`9zlLauk93j_gw5VAmOYe2DR%x zqaESIi>sYL%QJ{4eyDk80-Eao?vk$kPHe#K+Ua#e?AR$_04r8Wt#cJgIv{C&{SGQp zJ{d_AIfXZW4+9rQfUB7XPj3G6MGdThfItn{z9`o%d)Jq5EuY@8f^JiUI?q=$99Fcm zI(Xld9`f(mkg7A2&sNLT#07md;2Wq9|4?)LVj#szIG05dy5)ni}Wp{FQ_LIu*ei%X1F#?4j<%gif`De!A|7hKOPj^ ze-?X(`*JCQ~q6NDD0Kq z)T^B@PM^ODcOb%p1ze#(3PO($Hy!uf!9|L(z?^s}3@~Wf-uY1SUj)rHH_f}AIXm!XU@E_`Caak_GT= zV;U&R`|`)@TVc*C{r}X10Xd%gJ8>V!!pT_eC>lHm44SPR_xh?bg)^N%P2*(Q;14Gd z3k-dgWVIRR-s^iV_vBp;&YZ6@;m|U6{*dgcz=!P-@p_l$7M%eIE96B-5h&gyn<20`qC#!fRE&Yge4&Bfkt*u*^XPx`-tH z3AkJkxv{#vr1~0Hsk;`j9oNyBMM$^fP4=W;yd|?QXPsNt?ElWr& zgEzm)ukDwd{IvS8<45LGNtnrDRcXjz_jjMYvx**KS?!AZE>iDDiWSH2LM5$7g`=;`;`i~foD@T&maGmghy@mZGLS>s_>Bu z7mzd_@{N!D8N3LVrB8@M?O?IrP9MI9)LI9yD{^`?)(o`Wt3>F9wZ`%6awT_|m60JJ z{gi^V_Dltko(_}W6`(<5Lm-Qw<=HgO5C50>5QAsu&G6b;@`hE23(cx+MP^jZz>lwL zJ<8S36@}%G=r~-SlfmjmeFrQrH=s@_-(UrMU2rY1J*|rmxmBTbQ*}9IIQBrZ!}G!V zUG#JzYS`L0@s)oS6itp#R}%s^-0<45yp4GE_Lb1y;!TuMrdF}4cJ2??8LL{%owPzd zZxmq`glFnrwzU-gtZ^q)VM^Sa?zJxH2%A0oUUzSiUt4IiYn29D?=|uA>M?!eXx@Tj z3rYy)7G;=F2%^=Lyb?iblmyFn5JtLQ+Fk|{}WD_e|VPLQIfM89NxQ28*$0& zvo*Xt1!+Drzc*3|+}jkhF9+q!gNgqT?aD|qNrz+FU&)}cy+3;4EOF5isMzr@uTFxh zmi$H9h8=Z9#G1#W^Qp$%h|07#c!4@X%q5kb{sz0+-xxBk(+9y_Rz51fIjT;n3SBa-ZvwY`Z@Yq8yk~x{le`2s@-E3Ti5G-;J0)laAkbz z!hMm8Leb{~x&7L5%prfz^pic0{y8l4rjk|ZTPZU3DE-06gXb^|mM~z^8z@|8KEt*v zCZn1|G1_KP(kx2vvYo5ta;u=T*}bWRQiLAIdGpcpt)ZDmunrK@2p#PWL*f5u6YAzg zmNi@@Sl!o7SY#OzVEq0lhawqrWO-!BxqF)T$Bh;mG>sn~XLF?3T6HHyR~zF`zpeX7 z3Hh}D@sm>-RAqz9A1aUB%$&I=r~XNf&IT{vlj_&l`HUlyo-*sU1^I?08iJP><3A)u zzH1Kruitb}RAuOVty1LZQ=|A*=DW?QwxG(qzJ&YR-_>B{=k_O>@fFs+(53S5e_xk{ zG+jIY_TK>igv$*fP`XfmpL6xwm>UbH-$g}7CN?{RSX#Qc>&%X78baX%P1xpi$o>cl z8i~J?Ze*{IRcgvq>E{cwtxv1PsFm66K#d}85*?+g8zHb4YbtJX1QvUc_f~T!06)~P zZz6Ko+HB~0EtZ}1m8=pg!#2F`ck3`GWS?VxqdottTHM!^{WD|nH~t&4SKfc5WPhS} zvD%59ryLa^_oP{i@o+>MqOzvHr@lNs%s$|CU0xpfo%9h(k?sXMsE9U13>kojQXkj) zi~3^1!Vn56lXbL7B&Lcfk=U>=%l)Wn_wxt!|2#kS>dT~7QDGD&QS5WB)2C}rLd;0j z+sTePsaet`Xj(a3o1)b7qZsRbMIw<6$2Ac;9Lv(t@wu)dpZQeFWURy~z+R)Nz0%!^ zC(h`Alr*_HfPi)dCPf<&?t_FBYN@&u~nX+sS^J9N(501JcYEw>;U0v1eyWb_=i&C zJRdE^hsi6{I#I>*X@_#*W#95@>}wNCV_1p#%i7t!)uugCqjz$bmqo15nlhI+uBd3n zB5lK)X^USv!fniZEH+xZ!`+6?{r)_!ZJGBV+NWFju!*eIV^hoO{uBG|CT1eFxjcvQ z*@}2>kKucIrJ4N)ObX9VVVPcOWil%vGCyFfKygEF1!KVRu01l`3vIoG>bWgvXW&Qv zIpUx|msxj-xV+%OY9(D2SCX)T9k|%$z&QEtqS}5FOZ}N>jkt$5awr-P%cmq?seQZY zG)>dei78x=QBrW;=TSCs{<>Yssj{hW5ir`3_w#D~rRA`Qc&6*GeNgzwb$btzYS?_N zzHZgRu1L>wpX)PP*5cfi>)sGqr*Gd-AcXsHbw|4#PAICs=rsv)0h;?u0fj}LYVQcz zF^nQ{4C+F>QA9qRrZU7dyLPOy4h%rE5~yVRNKIZ&v{XJCB=YvCa)B;Q-)u?THEMo$ zQLpBprS?#eBeXIMua;}Ozr6Q-7*f8#d*zZ4pmU_8Am6RF^bFZ6?=)&z?6UpZJqJOO zvr&j0vvO-t>pEm;oH+k79oO02$dKwuWcsi9b%ibG&Mkl2MX~$jeWUeG*!;J0Nk_S# zr-hgOPOIzO2~F&JoRWR~`p8l9n?@g>i)jD1sZjuYZ?H`v^eq8Mnwxpt%yx?jQq-HQ z6o)|cv8b49yO&LQ26&j9rVQ>AFRx=i9iE0-2@1hwh_I5u_@?NiFTJF~N9UNg#ny`Y z+DA^9FlE(r^NJ3?nWHt_Qyt#;V$zd<{^~2F+=X{aI~G-vuybPIj#!`B+3y7^YR7^e z{;e|(BcKo4uOxyk?&|wWzU3;s#lQa|73K0mASKdBNOtq%eJ4+wCXrt+cYE5s7KP)TR6A*rM}u^W3v18# zfBy2Y|6;A!r@mhKxS#T;v`<|3<#m3oKNu+Z6<&I5vEb^XsFxF;OIDxP{0?gO3p~|r z^CNNpH5FUZV}BG@$v@HPt}}JtcYfb`=j;IRMB8z(=FO#}+SA@^QBFD!1;d3w5cB#M ze$7AkkLU)M)ma~s`1Af}_-1^VVX(r=7vmYiCOb&|o?Y-JFu_VE9|gpYIP>;kC`cS!hOCNRF52+QYc{%>$VP#JXbg&)iS|AwNF&sdD`GekFl2ivR z`+S*XP>GnSqX!AI9!TQPrD4+%Y=#LJZjHD5UDrUS-;822B3KXh{?3tH%xui-#D32R zPn5ZzUT`f}jEfQ*vUR#mb4n_cNSrU-tl&AnL3#V-d@iuzhB%bYJj;!1|3^lwyrR^t z%;0dKXdbs53hYfwe0DahH;K`kz16K>n=X%q2~-+0ba?=>5fCFYBys7Y%e}E(JNNSu z(JX{}ZZ@#I)A=L9jh-Db!?>f{CprUJ$7R}VAmfgCx0A>SvqP>^b1V{q?00K1MfLr3>b}Tr018K3?hpmIoXoLMt zuFoI44h*=ym~nliS~=3`N>}bpCvCtqY2X8m{UuiWF|C>8DERITq!nMxa0am3fQxb=-`|-!_)Lpj zxLuT;RfWZB6a2fqdslvD_|ccOjF(`IhazW45#i8u*F$B>gRTryLS@{uf@vhfWbrWN zR#=I0I+lpAVZo^znG6abF)BvIy8FH@0Jh+J?*M3)c^isi#D~(j5P7k$HnY=Lj3Sw9 zD(LCZS3ToJ{?pB1dRf$a6>JUZax->1!)6otqBPI1lMp5fj%F1L<6gG0A<;%Sl{|3g z3Sfj~ETF4mj}DT%;8dEUUYy5cG->Zn@nNW}?YftzzK@r+kGFWw4x#<6NBQrzhOwv- z>Yta~T*zot%%$bQf{YV}2Q?Za;?dGKZf4?cL#t?MVs}Ow*ITazGCgmqWa|@M<9mcN z*5o~kZ-m`HIy!sWhw>hv3Lyeo%0($&MyRpl0b^@+L%};e9&aJ-@bGmLgnS{~3O`Iv z^pJ#xeqPm%`Evjg_e+mO`GoJ=6$KvKIaspgOWo;hR#5=2@YFqHCnxJ9&})Q~y?rrQ zFFn@lOI>i1EKkT8VCB9{xAre{^WW?mv$D=$tdIE#z4kxj2Ri};i#JP$4#5N zOz7)9tOt+d#)wmnV)WOSn&90h4qh!hSgTAiv*>>OBJjnFK*i;uqhH@%aC=oD{yM&9 zr!d9)z;C2s>w(AG9xa7-y*s5NYXU_YCx!ittR@4erVf>T4YU%P5i_z4Kh#D{Lq5{bW$T?2K@$-mzV6h`)5~r6Hlef#1IRE}i#}ub;Th^h4{9 zov8;}3r)c!;A5Mi1SVK{aP|%YuDmfNVg9Dtw!!f_BX>K!;e^E|6w zX)IXxR!H4rhBPhXtN0W?n=V`aa+4?X!_Qb}&|{ZPsL2nT7&tp)hj8Gpmc#F4X+DA7 zNv@%mPv#uex1V7qs=4V(e(A_d{;D-zRt8~q<@HOSAu^bb#SQFqm?hYR?Y%S~-GaJs sE>pY$W;2s%&Ek_A!f2THUTr|ZMkX3yG!6jToFI>5;RkwNLI7a-KN@fT;{X5v literal 0 HcmV?d00001 diff --git a/archie/clients/.gitignore b/archie/clients/.gitignore new file mode 100644 index 0000000..f3c7a7c --- /dev/null +++ b/archie/clients/.gitignore @@ -0,0 +1 @@ +Makefile diff --git a/archie/clients/Makefile.in b/archie/clients/Makefile.in new file mode 100755 index 0000000..80b5822 --- /dev/null +++ b/archie/clients/Makefile.in @@ -0,0 +1,15 @@ +# +# clients +# + +BIN_DIRS = \ + cgi \ + email \ + mail_back_end \ + telnet + + +DIRS = \ + $(BIN_DIRS) + +include $(ARCHIE_ROOT)/Makefile.multi diff --git a/archie/clients/Makefile.pre b/archie/clients/Makefile.pre new file mode 100755 index 0000000..7ec8458 --- /dev/null +++ b/archie/clients/Makefile.pre @@ -0,0 +1,8 @@ +# +# + +DIRS = \ + email \ + telnet + + diff --git a/archie/clients/cgi/.gitignore b/archie/clients/cgi/.gitignore new file mode 100644 index 0000000..f3c7a7c --- /dev/null +++ b/archie/clients/cgi/.gitignore @@ -0,0 +1 @@ +Makefile diff --git a/archie/clients/cgi/AIX-2/.gitignore b/archie/clients/cgi/AIX-2/.gitignore new file mode 100644 index 0000000..f3c7a7c --- /dev/null +++ b/archie/clients/cgi/AIX-2/.gitignore @@ -0,0 +1 @@ +Makefile diff --git a/archie/clients/cgi/AIX-2/Makefile.in b/archie/clients/cgi/AIX-2/Makefile.in new file mode 100755 index 0000000..73d93e8 --- /dev/null +++ b/archie/clients/cgi/AIX-2/Makefile.in @@ -0,0 +1,9 @@ +SYS_DEFS = -DAIX +SENT_FLAGS = -ffixed-%g2 -ffixed-%g3 -ffixed-%g4 +SYS_LIBS = -L${BERKDB_ROOT}/${SYSTYPE} -ldb + +include ../Makefile.pre + +include ../Makefile.post + +# DO NOT DELETE THIS LINE -- make depend depends on it diff --git a/archie/clients/cgi/Makefile.post b/archie/clients/cgi/Makefile.post new file mode 100755 index 0000000..399eb03 --- /dev/null +++ b/archie/clients/cgi/Makefile.post @@ -0,0 +1,24 @@ +# +# clients/cgi +# + +all: $(EXES) + + +include $(ARCHIE_ROOT)/Makefile.post + + +cgi-client: \ + $(ANONFTP_MODULE)/lib/$(SYSTYPE)/libanonftp.a \ + $(LIBARCHIE_MODULE)/$(SYSTYPE)/libarchie.a \ + $(ARCHSEARCH_MODULE)/$(SYSTYPE)/libarchsearch.a \ + $(STRIDX_MODULE)/$(SYSTYPE)/libarchstridx.a \ + $(HOSTDB_MODULE)/$(SYSTYPE)/libhostdb.a \ + $(PATRIE_MODULE)/$(SYSTYPE)/libpatrie.a \ + $(STARTDB_MODULE)/$(SYSTYPE)/libstartdb.a \ + $(WEBINDEX_MODULE)/lib/$(SYSTYPE)/libwebindex.a \ + $(OBJS) + ${CC} ${CFLAGS} -o $@ $(OBJS) $(MOD_LIBS) $(SYS_LIBS) + +clean: + rm -f *.o $(EXES) core diff --git a/archie/clients/cgi/Makefile.pre b/archie/clients/cgi/Makefile.pre new file mode 100755 index 0000000..630a901 --- /dev/null +++ b/archie/clients/cgi/Makefile.pre @@ -0,0 +1,39 @@ +# +# Anonftp/lib module. +# + +#MOD_CFLAGS = -ansi -pedantic -pipe +MOD_DEBUG = -g3 +#MOD_DEBUG = -pg -g3 +MOD_WARN = -Wall -Wtraditional -Wshadow -Wpointer-arith -Wcast-align +MOD_INCS = \ + -I$(INCLUDE_MODULE) \ + -I$(PROSPERO_ROOT)/include \ + -I$(PATRIE_MODULE) \ + -I$(ARCHSEARCH_MODULE) \ + -I$(STARTDB_MODULE) \ + -I$(STRIDX_MODULE) \ + -I$(WEBINDEX_MODULE)/lib \ + -I. +MOD_LIBS = \ + -L$(ANONFTP_MODULE)/lib/$(SYSTYPE) -lanonftp \ + -L$(ARCHSEARCH_MODULE)/$(SYSTYPE) -larchsearch \ + -L$(LIBARCHIE_MODULE)/$(SYSTYPE) -larchie \ + -L$(STRIDX_MODULE)/$(SYSTYPE) -larchstridx \ + -L$(HOSTDB_MODULE)/$(SYSTYPE) -lhostdb \ + -L$(PATRIE_MODULE)/$(SYSTYPE) -lpatrie \ + -L$(STARTDB_MODULE)/$(SYSTYPE) -lstartdb \ + -L$(WEBINDEX_MODULE)/lib/$(SYSTYPE) -lwebindex + + +include $(ARCHIE_ROOT)/Makefile.pre + + +SRCS = \ + cgi-client.c + +OBJS = \ + cgi-client.o + +EXES = \ + cgi-client diff --git a/archie/clients/cgi/SunOS-4.1.4/.gitignore b/archie/clients/cgi/SunOS-4.1.4/.gitignore new file mode 100644 index 0000000..f3c7a7c --- /dev/null +++ b/archie/clients/cgi/SunOS-4.1.4/.gitignore @@ -0,0 +1 @@ +Makefile diff --git a/archie/clients/cgi/SunOS-4.1.4/Makefile.in b/archie/clients/cgi/SunOS-4.1.4/Makefile.in new file mode 100755 index 0000000..10d574e --- /dev/null +++ b/archie/clients/cgi/SunOS-4.1.4/Makefile.in @@ -0,0 +1,11 @@ +# +# Use GNU's fixed header files. +# +SYS_DEFS = -D__USE_FIXED_PROTOTYPES__ -DSUNOS +SENT_FLAGS = -ffixed-%g2 -ffixed-%g3 -ffixed-%g4 +SYS_LIBS = -L${BERKDB_ROOT}/${SYSTYPE} -ldb + +include ../Makefile.pre +include ../Makefile.post + +# DO NOT DELETE THIS LINE -- make depend depends on it diff --git a/archie/clients/cgi/SunOS-5.4/.gitignore b/archie/clients/cgi/SunOS-5.4/.gitignore new file mode 100644 index 0000000..f3c7a7c --- /dev/null +++ b/archie/clients/cgi/SunOS-5.4/.gitignore @@ -0,0 +1 @@ +Makefile diff --git a/archie/clients/cgi/SunOS-5.4/Makefile.in b/archie/clients/cgi/SunOS-5.4/Makefile.in new file mode 100755 index 0000000..b2750e5 --- /dev/null +++ b/archie/clients/cgi/SunOS-5.4/Makefile.in @@ -0,0 +1,12 @@ +# +# Use GNU's fixed header files. +# +SYS_DEFS = -D__USE_FIXED_PROTOTYPES__ -DSOLARIS +SENT_FLAGS = -ffixed-%g2 -ffixed-%g3 -ffixed-%g4 +SYS_LIBS = -lnsl -lsocket -L${BERKDB_ROOT}/${SYSTYPE} -ldb + +include ../Makefile.pre +RANLIB = : +include ../Makefile.post + +# DO NOT DELETE THIS LINE -- make depend depends on it diff --git a/archie/clients/cgi/SunOS-5.6 b/archie/clients/cgi/SunOS-5.6 new file mode 120000 index 0000000..7b4e044 --- /dev/null +++ b/archie/clients/cgi/SunOS-5.6 @@ -0,0 +1 @@ +SunOS-5.4 \ No newline at end of file diff --git a/archie/clients/cgi/cgi-client.c b/archie/clients/cgi/cgi-client.c new file mode 100644 index 0000000..75abf15 --- /dev/null +++ b/archie/clients/cgi/cgi-client.c @@ -0,0 +1,408 @@ +/* + * This file is copyright Bunyip Information Systems Inc., 1993. This file + * may not be reproduced, copied or transmitted by any means mechanical or + * electronic without the express written consent of Bunyip Information + * Systems Inc. + */ + + +#include +#include +#include +#include +#include +/* #include "protos.h" */ +#include "typedef.h" +#include "archie_dns.h" +#include "db_files.h" +#include "domain.h" +#include "header.h" +#include "db_ops.h" +#include "webindexdb_ops.h" +#include "host_db.h" +#include "error.h" +#include "files.h" +#include "archie_strings.h" +#include "archie_dbm.h" +#include "search.h" +#include "core_entry.h" +#include "debug.h" +#include "master.h" + +#include "site_file.h" +#include "start_db.h" +#include "lang_startdb.h" +#include "patrie.h" +#include "archstridx.h" + +#include "strings_index.h" +#include "get-info.h" + +char *prog; +int verbose=1; + +#ifndef SOLARIS +#ifdef __STDC__ +#else + extern status_t archQuery( ); + extern status_t archQueryMore( ); + extern status_t getResultFromStart( ); + extern status_t host_table_find(); + extern status_t update_start_dbs(); + extern status_t close_start_dbs(); + extern status_t open_start_dbs(); + extern status_t get_index_start_dbs(); + extern int archSearchSub(); + extern status_t get_port(); + extern int archWebBooleanQuery(); + extern int archWebBooleanQueryMore(); +#endif +#endif + +#define DEFAULT_QUERY_LOG_FILE "query.log" + +/* + * interact: interacts with the databases through the CGI interface. + * + */ + + +int main(argc, argv) +int argc; +char *argv[]; +{ + +#ifndef SOLARIS +#ifdef __STDC__ + + extern status_t compile_domains( char *, domain_t *, file_info_t *, int *); + extern int send_error_in_plain( char *); + extern char *dequoteString( const char * ); + +#else + + extern int getopt(); + extern status_t compile_domains(); + extern int send_error_in_plain(); + extern char *dequoteString(); + +#endif +#endif + + + extern int opterr; + + /* Directory names */ + + pathname_t master_database_dir; + pathname_t files_database_dir; + pathname_t start_database_dir; + pathname_t host_database_dir; + + /*startdb stuff*/ + file_info_t *start_db = create_finfo(); + file_info_t *domain_db = create_finfo(); + /*startdb stuff*/ + struct arch_stridx_handle *strhan; + char *dbdir=NULL; + int db = 0; + + pathname_t logfile; + hostname_t hostname; + + entry *ents; + domain_t d_list[MAX_NO_DOMAINS]; + int d_cnt = 0; + + + int srch_type=0; + int logging = 1; /* send all error messages to log file */ + bool_query_t qry; /*used to be char *qry */ + char *han; + int path_rel; + int path_items; + char **path_r; /* path restriction */ + int max_hits = 0; + int ret_hits = 0; + int match = 0; + int hpm = 0; + int type = EXACT; + int booltype = 0; + int case_sens = 0; + int format = 0; + start_return_t start_tbl; + boolean_return_t more_tbl; + + char domains[MAX_PATH_LEN], *expath; + query_result_t *result; + index_t **strs; + char *serv_url= NULL , *gif_url = NULL, *req = NULL; + + strcpy(domains,DOMAIN_ALL); + expath = (char *)NULL; + serv_url = (char *)NULL; + start_tbl.stop = -1; + start_tbl.string = -1; + more_tbl.and_tpl = -1; + path_r = NULL; + path_rel = PATH_OR; + path_items = 0; + prog = argv[0]; + logfile[0] = hostname[0] = '\0'; + + files_database_dir[0] = host_database_dir[0] = start_database_dir[0] = master_database_dir[0] = '\0'; + + opterr = 0; /* turn off getopt() error messages */ + + /* set up logs */ + if(logging){ + if(logfile[0] == '\0'){ + sprintf(logfile, "%s/%s/%s", get_archie_home(), DEFAULT_LOG_DIR, DEFAULT_QUERY_LOG_FILE); + } + if(open_alog(logfile, A_INFO, tail(argv[0])) == ERROR){ + + /* "Can't open log file %s" */ + + error(A_ERR, prog, "Can't open log file %s.", logfile); + exit(A_OK); + } + } + + if( !read_form_entries_post( &ents, &req)){ + error(A_ERR,"cgi-client","Could not get entries from form."); + exit(A_OK); + }else{ + error(A_INFO,"REQUEST:","(%s)",req); + } + free(req); req = NULL; + + if( !(srch_type = parse_entries(ents, &qry, &db, &type, &case_sens, + &max_hits, &hpm, &match, &path_r, &expath, + &path_rel, &path_items, domains, &serv_url, + &gif_url, &han, &format, &booltype, + &start_tbl, &more_tbl ))){ + error(A_ERR,prog,"Could not parse entries in form."); + exit(A_OK); + } + + if( strcmp( qry.string,"" )==0 ){ + send_error_in_plain("Your request is missing the query!"); + exit(A_OK); + } + if( serv_url == (char *)NULL ){ +/* + * error(A_WARN,prog,"The HTML Page does not contain the location of the + * archie gifs as hidden values."); + * send_error_in_plain("Your Search Page is missing the + * url hidden value. Please fix your page."); return 0; + */ + } + if( serv_url ) { + free(serv_url); serv_url = NULL; + } + if( gif_url ) { + free(gif_url); gif_url = NULL; + } + + /* Set up system directories and files */ + + if(set_master_db_dir(master_database_dir) == (char *) NULL){ + /* "Error while trying to set master database directory" */ + send_error_in_plain("Error while trying to set master database directory."); + error(A_ERR, prog, "Error while trying to set master database directory."); + exit(A_OK); + } + + if( db == I_WEBINDEX_DB){ + if((dbdir = (char *)set_wfiles_db_dir(files_database_dir)) == (char *) NULL){ + /* "Error while trying to set webindex database directory" */ + send_error_in_plain("Error while trying to set webindex database directory."); + error(A_ERR, prog, "Error while trying to set webindex database directory"); + exit(A_OK); + } + if(set_start_db_dir(start_database_dir,DEFAULT_WFILES_DB_DIR) == (char *) NULL){ + /* "Error while trying to set start database directory" */ + send_error_in_plain("Error while trying to set start database directory."); + error(A_ERR, prog, "Error while trying to set start database directory"); + exit(A_OK); + } + }else if( db == I_ANONFTP_DB){ + if((dbdir = (char *)set_files_db_dir(files_database_dir)) == (char *) NULL){ + /* "Error while trying to set anonftp database directory" */ + send_error_in_plain("Error while trying to set anonftp database directory."); + error(A_ERR, prog, "Error while trying to set anonftp database directory"); + exit(A_OK); + } + if(set_start_db_dir(start_database_dir,DEFAULT_FILES_DB_DIR) == (char *) NULL){ + /* "Error while trying to set start database directory" */ + send_error_in_plain("Error while trying to set start database directory."); + error(A_ERR, prog, "Error while trying to set start database directory"); + exit(A_OK); + } + } + + if( set_host_db_dir(host_database_dir) == (char *) NULL){ + /* "Error while trying to set host database directory" */ + send_error_in_plain("Error while trying to set host database directory."); + error(A_ERR, prog, "Error while trying to set host database directory"); + exit(A_OK); + } + + /* Open other files database files */ + + if ( open_start_dbs(start_db,domain_db,O_RDONLY ) == ERROR ) { + /* "Can't open start/host database" */ + send_error_in_plain("Error while trying to open start database directory."); + error(A_ERR,prog,"Could not open start/host database.. exiting! Please inform the administrator of this site"); + exit(A_OK); + } + + if ( !(strhan = archNewStrIdx()) ) { + send_error_in_plain("Error while trying to get string handle."); + error(A_ERR,prog,"Could not get string handle .. exiting! Please inform the administrator of this site"); + exit(A_OK); + } + + if ( !archOpenStrIdx( strhan, dbdir, ARCH_STRIDX_SEARCH ) ){ + send_error_in_plain("Error while trying to open strings files."); + error(A_ERR,prog,"Could not open strings index files.. exiting! Please inform the administrator of this site"); + exit(A_OK); + } + + if( srch_type == SEARCH_STRINGS_ONLY ){ + int html_format = 0; + if (booltype == 0 ){ + strOnlyQuery(strhan, qry.string, type, case_sens, max_hits, + html_format ); + goto finish; + }else{ + strOnlyBooleanQuery(strhan, qry, type, case_sens, max_hits, + 0, &more_tbl, html_format ); + goto finish; + } + } + + if( compile_domains( domains, d_list, domain_db, &d_cnt) == ERROR ){ + error(A_ERR,"archQuery","Could not construct the domain list from domain_db"); + goto finish; + } + + if( srch_type == SEARCH_MORE_STRINGS ){ + char errstr[MAX_STR], *deq_str; + + if (booltype == 0 ){ + if( han ) { + deq_str = (char *)dequoteString(han); + free( han ); han = NULL; + }else{ + sprintf(errstr,"Did not supply strhan string for more searches."); + send_error_in_plain(errstr); + error(A_ERR,prog,errstr); + goto finish; + } + + if (!archSetStateFromString(strhan,deq_str)){ + sprintf(errstr,"Could not convert the state string into strhan. String representing strhan = %s

",deq_str); + free( deq_str ); + send_error_in_plain(errstr); + error(A_ERR,prog,errstr); + goto finish; + } + free( deq_str ); + if( archQueryMore( strhan, max_hits, match, hpm, path_r, expath, + path_rel, path_items, d_list, d_cnt, db, start_db, + 0, &result, &strs, &ret_hits, &start_tbl, + (char *)NULL, 0, format) == ERROR){ + send_error_in_plain(" Could not complete archQueryMore()\n"); + error(A_ERR,prog," Could not complete archQueryMore()"); + goto finish; + } + }else{ + if( db == I_WEBINDEX_DB ){ + if( archWebBooleanQueryMore(strhan, qry, type, case_sens, max_hits, + match, hpm, path_r, expath, + path_rel, path_items, d_list, d_cnt, db, + start_db, 0, &result, &strs, &ret_hits, + &more_tbl, (char *)NULL, 0, format) == ERROR){ + send_error_in_plain(" Could not complete archWebBooleanQueryMore()\n"); + error(A_ERR,prog," Could not complete archWebBooleanQueryMore()"); + goto finish; + } + }else if( db == I_ANONFTP_DB ){ + if( archBooleanQueryMore(strhan, qry, type, case_sens, max_hits, + match, hpm, path_r, expath, + path_rel, path_items, d_list, d_cnt, db, + start_db, 0, &result, &strs, &ret_hits, + &more_tbl, (char *)NULL, 0, format) == ERROR){ + send_error_in_plain(" Could not complete archWebBooleanQueryMore()\n"); + error(A_ERR,prog," Could not complete archBooleanQueryMore()"); + goto finish; + } + /* put code for archBooleanQueryMore() here */ + } + + } + send_result_in_plain(result, strs, ret_hits, start_tbl, + more_tbl, db, strhan, ents, format ); + goto finish; + } + + if(qry.string != (char *)NULL && qry.string[0] != '\0') { + if ( booltype ){ + memset(&(more_tbl),'\0',sizeof(boolean_return_t)); + if( db == I_ANONFTP_DB ){ + if (archBooleanQueryMore( strhan, qry, type, case_sens, max_hits, + match, hpm, path_r, expath, path_rel, + path_items, d_list, d_cnt, db, start_db, + 0, &result, &strs, &ret_hits, &more_tbl, + (char *)NULL, 0, format) == ERROR){ + send_error_in_plain("archBooleanQuery failed, abort"); + error(A_ERR,prog,"archBooleanQuery failed, abort"); + goto finish; + } + }else if( db == I_WEBINDEX_DB ){ + if (archWebBooleanQueryMore( strhan, qry, type, case_sens, max_hits, + match, hpm, path_r, expath, path_rel, + path_items, d_list, d_cnt, db, start_db, + 0, &result, &strs, &ret_hits, &more_tbl, + (char *)NULL, 0, format) == ERROR){ + send_error_in_plain("archWebBooleanQuery failed, abort"); + error(A_ERR,prog,"archWebBooleanQuery failed, abort"); + goto finish; + } + } + + }else{ + if (archQuery( strhan, qry.string, type, case_sens, max_hits, match, + hpm, path_r, expath, path_rel, path_items, d_list, d_cnt, + db, start_db, 0, &result, &strs, &ret_hits, &start_tbl, + (char *)NULL, 0, format) == ERROR){ + send_error_in_plain("archQuery failed, abort"); + error(A_ERR,prog,"archQuery failed, abort"); + goto finish; + } + } + send_result_in_plain(result, strs, ret_hits, start_tbl, + more_tbl, db, strhan, ents, format ); + + } + +finish: + + free_entries( &ents ); + free_strings( &strs, max_hits ); + if ( qry.string != NULL ) free(qry.string); + if ( qry.and_list != NULL ) free_list(&(qry.and_list),qry.orn); /* 222 MUST FREE .lowrds FOR EACH */ + if ( qry.not_list != NULL ) free_list(&(qry.not_list),qry.orn); + if ( result != NULL ) free(result); + + archCloseStrIdx( strhan); + archFreeStrIdx(&strhan); + close_start_dbs(start_db,domain_db); + destroy_finfo(start_db); + destroy_finfo(domain_db); + + exit(A_OK); + return(A_OK); + +} diff --git a/archie/clients/email/.gitignore b/archie/clients/email/.gitignore new file mode 100644 index 0000000..f3c7a7c --- /dev/null +++ b/archie/clients/email/.gitignore @@ -0,0 +1 @@ +Makefile diff --git a/archie/clients/email/AIX-2/.gitignore b/archie/clients/email/AIX-2/.gitignore new file mode 100644 index 0000000..f3c7a7c --- /dev/null +++ b/archie/clients/email/AIX-2/.gitignore @@ -0,0 +1 @@ +Makefile diff --git a/archie/clients/email/AIX-2/Makefile.in b/archie/clients/email/AIX-2/Makefile.in new file mode 100755 index 0000000..21bcdbb --- /dev/null +++ b/archie/clients/email/AIX-2/Makefile.in @@ -0,0 +1,11 @@ +# +# Use GNU's fixed header files. +# +SYS_DEFS = -DAIX +SENT_FLAGS = -ffixed-%g2 -ffixed-%g3 -ffixed-%g4 + +include ../Makefile.pre + +include ../Makefile.post + +# DO NOT DELETE THIS LINE -- make depend depends on it diff --git a/archie/clients/email/Makefile.post b/archie/clients/email/Makefile.post new file mode 100755 index 0000000..08f56ff --- /dev/null +++ b/archie/clients/email/Makefile.post @@ -0,0 +1,17 @@ +# +# clients/email +# + +all: $(EXES) + + +include $(ARCHIE_ROOT)/Makefile.post + + +email-client: \ + $(LIBARCHIE_MODULE)/$(SYSTYPE)/libarchie.a \ + $(OBJS) + $(CC) $(CFLAGS) -o $@ $(OBJS) $(MOD_LIBS) $(SYS_LIBS) + +clean: + rm -f *.o $(EXES) email-client core diff --git a/archie/clients/email/Makefile.pre b/archie/clients/email/Makefile.pre new file mode 100755 index 0000000..c427c8e --- /dev/null +++ b/archie/clients/email/Makefile.pre @@ -0,0 +1,30 @@ +# +# clients/email +# + +#MOD_CFLAGS = -ansi -pedantic -pipe +#MOD_CFLAGS = -pipe +MOD_DEBUG = -g3 +MOD_WARN = -Wall -Wtraditional -Wshadow -Wpointer-arith -Wcast-align \ + -Wstrict-prototypes -Wnested-externs +MOD_INCS = -I$(ARCHIE_ROOT)/include -I$(PROSPERO_ROOT)/include -I. +MOD_LIBS = -L$(LIBARCHIE_MODULE)/$(SYSTYPE) -larchie + + +include $(ARCHIE_ROOT)/Makefile.pre + + +INCS = \ + email.h \ + lang_email.h + +SRCS = \ + email.c \ + lang_email.c + +OBJS = \ + email.o \ + lang_email.o + +EXES = \ + email-client diff --git a/archie/clients/email/SunOS-4.1.4/.gitignore b/archie/clients/email/SunOS-4.1.4/.gitignore new file mode 100644 index 0000000..f3c7a7c --- /dev/null +++ b/archie/clients/email/SunOS-4.1.4/.gitignore @@ -0,0 +1 @@ +Makefile diff --git a/archie/clients/email/SunOS-4.1.4/Makefile.in b/archie/clients/email/SunOS-4.1.4/Makefile.in new file mode 100755 index 0000000..5fcf9ab --- /dev/null +++ b/archie/clients/email/SunOS-4.1.4/Makefile.in @@ -0,0 +1,10 @@ +# +# Use GNU's fixed header files. +# +SYS_DEFS = -D__USE_FIXED_PROTOTYPES__ -DSUNOS +SENT_FLAGS = -ffixed-%g2 -ffixed-%g3 -ffixed-%g4 + +include ../Makefile.pre +include ../Makefile.post + +# DO NOT DELETE THIS LINE -- make depend depends on it diff --git a/archie/clients/email/SunOS-5.4/.gitignore b/archie/clients/email/SunOS-5.4/.gitignore new file mode 100644 index 0000000..f3c7a7c --- /dev/null +++ b/archie/clients/email/SunOS-5.4/.gitignore @@ -0,0 +1 @@ +Makefile diff --git a/archie/clients/email/SunOS-5.4/Makefile.in b/archie/clients/email/SunOS-5.4/Makefile.in new file mode 100755 index 0000000..e37eb32 --- /dev/null +++ b/archie/clients/email/SunOS-5.4/Makefile.in @@ -0,0 +1,11 @@ +# +# Use GNU's fixed header files. +# +SYS_DEFS = -D__USE_FIXED_PROTOTYPES__ -DSOLARIS +SENT_FLAGS = -ffixed-%g2 -ffixed-%g3 -ffixed-%g4 +SYS_LIBS = -lresolv -lnsl -lsocket + +include ../Makefile.pre +include ../Makefile.post + +# DO NOT DELETE THIS LINE -- make depend depends on it diff --git a/archie/clients/email/SunOS-5.6 b/archie/clients/email/SunOS-5.6 new file mode 120000 index 0000000..7b4e044 --- /dev/null +++ b/archie/clients/email/SunOS-5.6 @@ -0,0 +1 @@ +SunOS-5.4 \ No newline at end of file diff --git a/archie/clients/email/batch-email b/archie/clients/email/batch-email new file mode 100755 index 0000000..dfc5ed1 --- /dev/null +++ b/archie/clients/email/batch-email @@ -0,0 +1,48 @@ +#!/bin/sh +# +# batch-email (c) Copyright Bunyip Information Systems, Inc. 1994 +# +# This routine can be used to batch incoming email requests for later +# processing +# +PATH=/bin:/usr/bin:/usr/ucb + + +ch_tmp() +{ + + if p=`grep "^archie:" /etc/passwd` ; then + archiehome=`echo $p | awk -F: '{print $6}'` + elif p=`ypmatch archie passwd` ; then + archiehome=`echo $p | awk -F: '{print $6}'` + fi + + chdir $archiehome/db/tmp +} + +usage() { + echo "Usage: batch-email -t " + exit 1 +} + +tdir="notset" + +while [ $# -gt 1 ] ; do + case $1 in + +#temp directory + -t) if [ $# -gt 1 ] ; then shift ; tdir=$1; else usage; fi;; + + esac + shift +done + + +if [ $tdir = "notset" ]; then + ch_tmp +else + chdir $tdir +fi + +cat > aremail.`date +%y.%T`.$$ + diff --git a/archie/clients/email/email.c b/archie/clients/email/email.c new file mode 100644 index 0000000..a8ba90d --- /dev/null +++ b/archie/clients/email/email.c @@ -0,0 +1,793 @@ +/* + * This file is copyright Bunyip Information Systems Inc., 1994. This file + * may not be reproduced, copied or transmitted by any means mechanical or + * electronic without the express written consent of Bunyip Information + * Systems Inc. + */ + + + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "protos.h" +#include "typedef.h" +#include "db_files.h" +#include "files.h" +#include "master.h" +#include "email.h" +#include "error.h" +#include "lang_email.h" + +/* aremail: archie email clien + + + argv, argc are used. + + + Parameters: - + +*/ + +char *prog; +static int verbose = 0; + + +int main(argc, argv) + int argc; + char *argv[]; + +{ + extern int opterr; + extern char *optarg; +#if 0 +#ifdef __STDC__ + + extern int getopt(int, char **, char *); + +#else + + extern int getopt(); + +#endif +#endif + char **cmdline_ptr; + int cmdline_args; + + int option; + + pathname_t tmp_dir; + + pathname_t telnet_pgm; + pathname_t master_database_dir; + pathname_t host_database_dir; + + pathname_t logfile; + + int logging = 1; + + int log_address = 0; + + file_info_t *input_file = create_finfo(); + + prog = argv[0]; + opterr = 0; + + + cmdline_ptr = argv + 1; + cmdline_args = argc - 1; + + telnet_pgm[0] = tmp_dir[0] = '\0'; + logfile[0] = '\0'; + + host_database_dir[0] = master_database_dir[0] = '\0'; + + while((option = (int) getopt(argc, argv, "i:t:T:L:luvM:h:")) != EOF){ + + switch(option){ + + /* Log filename */ + + case 'L': + strcpy(logfile, optarg); + cmdline_ptr += 2; + cmdline_args -= 2; + break; + + + /* master database directory name */ + + case 'M': + strcpy(master_database_dir,optarg); + cmdline_ptr += 2; + cmdline_args -= 2; + break; + + /* telnet program name */ + + case 'T': + strcpy(telnet_pgm,optarg); + cmdline_ptr += 2; + cmdline_args -= 2; + break; + + /* host database directory name */ + + case 'h': + strcpy(host_database_dir,optarg); + cmdline_ptr += 2; + cmdline_args -= 2; + break; + + /* input file */ + + case 'i': + strcpy(input_file -> filename, optarg); + cmdline_ptr += 2; + cmdline_args -= 2; + break; + + /* log output, default file */ + + case 'l': + logging = 0; + cmdline_ptr++; + cmdline_args--; + break; + + /* temporary directory name */ + + case 't': + strcpy(tmp_dir,optarg); + cmdline_ptr += 2; + cmdline_args -= 2; + break; + + case 'u': + log_address = 1; + cmdline_ptr++; + cmdline_args--; + break; + + case 'v': + verbose = 1; + cmdline_ptr++; + cmdline_args--; + break; + + default: + error(A_ERR, "email-client", "Usage: email-client [ -T ] [ -u ] [ - v ] [ -t ] [ -i ] [ - l ] [ -L ]"); + exit(ERROR); + break; + } + + } + + + /* set up logs */ + + if(logging){ + + if(logfile[0] == '\0'){ + + sprintf(logfile, "%s/%s/%s", get_archie_home(), DEFAULT_LOG_DIR, EMAIL_LOG_FILE); + } + + if(open_alog(logfile, A_INFO, tail(argv[0])) == ERROR) + exit(ERROR); + } + + if(verbose) + error(A_INFO, "email-client", "Setting working directory to %s", get_archie_home()); + + /* change working directory */ + + if(chdir(get_archie_home()) == -1){ + + /* "Can't change working directory to %s" */ + + error(A_SYSERR, "email-client", EMAIL_005, get_archie_home()); + exit(ERROR); + } + + if(set_master_db_dir(master_database_dir) == (char *) NULL){ + + error(A_ERR,"email-client", "Error while trying to set master database directory"); + exit(ERROR); + } + + + /* setup default tmp directory if not given */ + + if(tmp_dir[0] == '\0') + sprintf(tmp_dir,"%s/%s", get_master_db_dir(), DEFAULT_TMP_DIR); + + if(access(tmp_dir, R_OK | W_OK | X_OK | F_OK) == -1){ + + /* "Can't access temporary directory %s" */ + + error(A_SYSERR, "email-client", EMAIL_001, tmp_dir); + exit(ERROR); + } + + if(verbose) + error(A_INFO, "email-client", "Set temp directory to %s", tmp_dir); + + /* open the input file */ + + if(input_file -> filename[0] != '\0'){ + + if(open_file(input_file, O_RDONLY) == ERROR){ + + /* "Can't open given input file %s" */ + + error(A_ERR, "email-client", EMAIL_002, input_file -> filename); + exit(ERROR); + } + + if(verbose) + error(A_INFO, "email-client", "Reading input from %s", input_file -> filename); + + } + else{ + + /* The input comes from stdin */ + + if(verbose) + error(A_INFO, "email-client", "Reading input from stdin"); + + input_file -> fp_or_dbm.fp = stdin; + saveinput(input_file, tmp_dir); + } + + + if(process_input(input_file,telnet_pgm, log_address, logging) == ERROR){ + + /* "Error processing input" */ + + error(A_ERR, "email-client", EMAIL_004); + + exit(ERROR); + } + else{ + +#if 0 + if(verbose) + error(A_INFO, "email-client", "Unlinking input file %s", input_file -> filename); + + if(unlink(input_file -> filename) == 1){ + + /* "Can't unlink input file %s" */ + + error(A_ERR, "email-client", EMAIL_003, input_file -> filename); + exit(ERROR); + } +#endif + + } + + exit(A_OK); + return(A_OK); + +} + +/* saveinput: save the incoming input into temporary file */ + +status_t saveinput(input_file,tmp_dir) + file_info_t *input_file; + char *tmp_dir; + +{ + + pathname_t line; + file_info_t *tmp_file = create_finfo(); + + sprintf(tmp_file -> filename, get_tmp_filename(tmp_dir)); + + + /* Make sure the file doesn't already exist by unlinking it */ + + unlink(tmp_file -> filename); + + /* Open the file */ + + if(open_file(tmp_file, O_WRONLY) == -1){ + + /* "Can't open temporary file %s" */ + + error(A_ERR, "saveinput", SAVEINPUT_001, tmp_file -> filename); + return(ERROR); + } + + /* Unlink it, the file descriptor remains valid until closed */ + + unlink(tmp_file -> filename); + + if(verbose) + error(A_INFO, "saveinput", "Copying input from stdin to %s", tmp_file -> filename); + + /* For the process for copying */ + + while (1){ + if(fgets(line,sizeof(pathname_t), stdin) != line) + break; + fputs(line, tmp_file -> fp_or_dbm.fp); + } + + fflush(tmp_file -> fp_or_dbm.fp); + + rewind(tmp_file -> fp_or_dbm.fp); + + strcpy(input_file -> filename, tmp_file -> filename); + + input_file -> fp_or_dbm.fp = tmp_file -> fp_or_dbm.fp; + + return(A_OK); +} + + +#define ISLINE(hdr,readfrom) (!strncasecmp((readfrom),(hdr),sizeof(hdr)-1)) + +#define DOLINE(hdr,var,readfrom) do {if (ISLINE(hdr,readfrom)) strcpy((var),&(readfrom)[sizeof(hdr)-1]); } while (0) + + +status_t process_input(input_file, telnet_pgm, log_address, logging) + file_info_t *input_file; + char *telnet_pgm; + int log_address; + int logging; +{ + pathname_t line; + pathname_t subject_line; + pathname_t envfrom, from, retpath, reply; + pathname_t addr_copy; + char *address; + char *c, *d; + int p[2]; + int not_empty = 0; + pathname_t inp_line; + int retcode; + int telnet_quit; + int status; + char **arglist; + int i,counter = 0; + + subject_line[0] = '\0'; + + envfrom[0] = from[0] = retpath[0] = reply[0] = '\0'; + + while (readline(input_file,line) == A_OK){ + + if(line[0] == '\n') + break; + + DOLINE("from ", envfrom, line); + DOLINE("from: ", from, line); + DOLINE("return-path: ", retpath, line); + DOLINE("reply-to: ", reply, line); + + if (ISLINE("subject: ",line)){ + + for(c= &line[sizeof("subject: ") - 1];isspace(*c);c++); + strcpy(subject_line, c); + not_empty = 1; + } + } + + /* Choose the correct return address */ + + if(reply[0]) + address = &reply[0]; + else if(retpath[0]) + address = retpath; + else if(from[0]) + address = &from[0]; + else if(envfrom[0]) + address = &envfrom[0]; + else + return(ERROR); + + addr_copy[0] = '\0'; + + for(c = address, d = addr_copy; *c != (char) '\0'; c++){ + + if(*c == '"'){ + *d++ = '\\'; + *d++ = '"'; + } + else + *d++ = *c; + } + + *d = '\0'; + + strcpy(address, addr_copy); + + if((c = strchr(address, '\n'))) + *c = '\0'; + + if(log_address) + error(A_INFO, "process_input", "From: %s", address); + + if(telnet_pgm[0] == '\0') + sprintf(telnet_pgm, "%s/%s/%s", get_archie_home(), DEFAULT_BIN_DIR, TELNET_PGM_NAME); + + if((arglist = (char **) malloc(MAX_NO_PARAMS * sizeof(char *))) == (char **) NULL){ + + /* "Can't malloc space for argument list" */ + + error(A_SYSERR, "process_input", PROCESS_INPUT_017); + return(ERROR); + } + + /* set up argument list */ + + i = 0; + arglist[i++] = telnet_pgm; + + arglist[i++] = "-e"; + + if(logging){ + + arglist[i++] = "-L"; + arglist[i++] = get_archie_logname(); + } + + arglist[i] = (char *) NULL; + + if(pipe(p) == -1){ + + /* "Can't open pipe to telnet server process" */ + + error(A_SYSERR, "process_input", PROCESS_INPUT_001); + goto on_error; + } + + if(verbose) + error(A_INFO, "process_input", "Starting telnet client %s", telnet_pgm); + + if((retcode = fork()) == 0){ + + if(dup2(p[0], 0) == -1){ + + /* "Can't dup2 pipe to stdin" */ + + error(A_SYSERR, "process_input", PROCESS_INPUT_002); + exit(ERROR); + } + + if(verbose) + error(A_INFO, "process_input", "Started telnet client %s", telnet_pgm); + + execvp(telnet_pgm, arglist); + + /* "Can't execvp the telnet server %s" */ + + error(A_SYSERR, "process_input", PROCESS_INPUT_003, telnet_pgm); + exit(ERROR); + } + + if(verbose) + error(A_INFO, "process_input", "Writing path command (%s) to telnet-client", address); + + sprintf(inp_line, "%s %s\n", PATH_COMMAND, address); + + if(write(p[1], inp_line, strlen(inp_line)) == -1){ + + /* "Can't write initial path to telnet client" */ + + error(A_SYSERR, "process_input", PROCESS_INPUT_004); + goto on_error; + } + + /* Make sure that the telnet client hasn't died on us here */ + + status = 0; + + if((telnet_quit = waitpid(-1, &status, WNOHANG)) == -1){ + + /* "Erorr in wait3() for telnet client" */ + + error(A_SYSERR, "process_input", PROCESS_INPUT_006); + goto on_error; + } + + if((telnet_quit != 0) && (telnet_quit != retcode)){ + + /* "Child returned from wait3() (pid: %d) not same as forked (pid: %d)" */ + + error(A_INTERR, "process_input", PROCESS_INPUT_018, telnet_quit, retcode); + } + + if(telnet_quit){ + + if(WIFEXITED(status) && WEXITSTATUS(status)){ + + /* "telnet client %s exited abnormally with value %d" */ + + error(A_ERR, "process_input", PROCESS_INPUT_007, telnet_pgm, WEXITSTATUS(status)); + goto on_error; + } + + if(WIFSIGNALED(status)){ + + /* "telnet program %s terminated abnormally with signal %d" */ + + error(A_ERR,"process_input", PROCESS_INPUT_008, telnet_pgm, WTERMSIG(status)); + goto on_error; + } + } + + if(verbose) + error(A_INFO, "process_input", "Writing subject line '%s'", subject_line); + + + if(write(p[1], subject_line, strlen(subject_line)) == -1){ + + /* "Can't write subject line command to telnet client" */ + + error(A_SYSERR, "process_input", PROCESS_INPUT_005); + goto on_error; + } + + /* process the mail, line by line */ + + status = 0; + + do{ + counter++; + if((telnet_quit = waitpid(-1, &status, WNOHANG)) == -1){ + + /* "Erorr in wait3() for telnet client" */ + + error(A_SYSERR, "process_input", PROCESS_INPUT_006); + } + + if(telnet_quit){ + + if(WIFEXITED(status) && WEXITSTATUS(status)){ + + /* "telnet client %s exited abnormally with value %d" */ + + error(A_ERR, "process_input", PROCESS_INPUT_007, telnet_pgm, WEXITSTATUS(status)); + + goto on_error; + } + + if(WIFSIGNALED(status)){ + + /* "telnet program %s terminated abnormally with signal %d" */ + + error(A_ERR,"process_input", PROCESS_INPUT_008, telnet_pgm, WTERMSIG(status)); + goto on_error; + } + + goto on_error; + } + + if((telnet_quit != 0) && (telnet_quit != retcode)){ + + /* "Child returned from wait3() (pid: %d) not same as forked (pid: %d)" */ + + error(A_INTERR, "process_input", PROCESS_INPUT_018, telnet_quit, retcode); + } + + if(verbose) + error(A_INFO, "process_input", "Writing line '%s'", line); + + if(telnet_quit) + break; + + /* empty line */ + + if(sscanf(line, " %[a-zA-Z]*", inp_line) != 1) + continue; + + not_empty = 1; + + if(write(p[1], line, strlen(line)) == -1){ + + /* "Can't write line %s to telnet client" */ + + error(A_SYSERR, "process_input", PROCESS_INPUT_014, line); + goto on_error; + } + + }while(readline(input_file, line) == A_OK && counter < 50 ); + + if(!telnet_quit){ + + if(verbose) + error(A_INFO, "process_input", "Mail not terminated with 'quit'. Writing 'quit'"); + + sprintf(inp_line, "%s\n", QUIT_COMMAND); + + /* Mail has ended without a "quit" */ + + if(write(p[1], inp_line, strlen(inp_line)) == -1){ + + /* "Can't write quit command to telnet client" */ + + error(A_SYSERR, "process_input", PROCESS_INPUT_013); + goto on_error; + + } + + if(close(p[1]) == -1) + error(A_SYSERR, "process_input", "Can't close pipe to telnet-client"); + + if(close(p[0]) == -1) + error(A_SYSERR, "process_input", "Can't close pipe to telnet-client"); + + if((telnet_quit = wait(&status)) == -1){ + + /* "Erorr in wait for telnet client" */ + + error(A_SYSERR, "process_input", PROCESS_INPUT_009); + goto on_error; + } + + if(telnet_quit){ + + if(WIFEXITED(status) && WEXITSTATUS(status)){ + + /* "telnet client %s exited abnormally with value %d" */ + + error(A_ERR, "process_input", PROCESS_INPUT_007, telnet_pgm, WEXITSTATUS(status)); + + goto on_error; + } + + if(WIFSIGNALED(status)){ + + /* "telnet program %s terminated abnormally with signal %d" */ + + error(A_ERR,"process_input", PROCESS_INPUT_008, telnet_pgm, WTERMSIG(status)); + goto on_error; + } + + } + + if(telnet_quit != retcode){ + + /* "Child returned from wait3() (pid: %d) not same as forked (pid: %d)" */ + + error(A_INTERR, "process_input", PROCESS_INPUT_018, telnet_quit, retcode); + } + + } + else{ + + if(verbose) + error(A_INFO, "process_input", "telnet-client quit"); + + if(close(p[1]) == -1) + error(A_SYSERR, "process_input", "Can't close pipe to telnet-client"); + + if(close(p[0]) == -1) + error(A_SYSERR, "process_input", "Can't close pipe to telnet-client"); + } + + + close_file(input_file); + + if(log_address) + error(A_INFO, "process_input", "Request from: %s completed OK", address); + + return(A_OK); + +on_error: + +#if 0 + do_error_reply(input_file, address); +#endif + + if(log_address) + error(A_INFO, "process_input", "Request from: %s completed with errors", address); + + return(ERROR); + +} + + +status_t readline(input_file, line) + file_info_t *input_file; + char *line; +{ + int i; + + if(fgets(line,sizeof(pathname_t), input_file -> fp_or_dbm.fp) != line) + return(ERROR); + + i = strlen(line) - 1; + + if (i < 0) + return(ERROR); + +#if 0 + while ((i>=0) && isascii(line[i]) && isspace(line[i])) i --; + + line[i+1] = '\0'; +#endif + + return(A_OK); +} + + + +#if 0 +status_t open_mailserv(mail_host, mail_port, mail_conn) + char *mail_host; /* host to connect to */ + char *mail_port; /* port (service) to connect to */ + fd *mail_conn; /* returned file pointer */ + +{ + int portno; + + struct servent *server_ent; + + ptr_check(mail_host, char, "open_mailserv", ERROR); + ptr_check(mail_port, char, "open_mailserv", ERROR); + ptr_check(mail_conn, int, "open_mailserv", ERROR); + + if(mail_host[0] == '\0'){ + char *tmp_ptr; + + if((tmp_ptr = get_var(V_MAIL_HOST)) == '\0'){ + + /* "No mail host given" */ + + error(A_ERR, "open_mailserv", OPEN_MAILSERV_001); + return(ERROR); + } + + strcpy(mail_host, tmp_ptr); + + } + + if(mail_port[0] == '\0'){ + char *tmp_port; + + if((tmp_port = get_var(V_MAIL_SERVICE)) == '\0'){ + + /* "No mail port (service) given" */ + + erorr(A_ERR, "open_mailserv", OPEN_MAILSERV_002); + return(ERROR); + } + + strcpy(mail_port, tmp_port); + } + + + if(sscanf(mail_port, "%d", &portno) != 1){ + + if((server_ent = getservbyname(mail_port, "tcp")) == (struct servent *) NULL){ + + /* "Unknown service %s" */ + + error(A_ERR, "open_mailserv", mail_port); + return(ERROR); + } + + portno = server_ent -> s_port; + } + + if(cliconnect(mail_host, portno, mail_conn) != A_OK){ + + /* "Can't open connection to mailserver %s port %d" */ + + error(A_ERR, "open_mailserv", OPEN_MAILSERV_004, mail_host, portno); + return(ERROR); + } + + return(A_OK); +} + +#endif diff --git a/archie/clients/email/email.h b/archie/clients/email/email.h new file mode 100644 index 0000000..c2c874f --- /dev/null +++ b/archie/clients/email/email.h @@ -0,0 +1,20 @@ +#ifndef _EMAIL_H_ +#define _EMAIL_H_ + +#define EMAIL_LOG_FILE "email.log" + +#define EMAIL_TMP_DIR "tmp" + +#define EMAIL_PREFIX "archie.email" + +#define TELNET_PGM_NAME "telnet-client" + +#define PATH_COMMAND "path" +#define QUIT_COMMAND "quit" + + +extern status_t saveinput PROTO((file_info_t *, char *)); +extern status_t process_input PROTO((file_info_t *, char *, int, int)); +extern status_t readline PROTO((file_info_t *, char *)); + +#endif diff --git a/archie/clients/email/lang_email.c b/archie/clients/email/lang_email.c new file mode 100644 index 0000000..a6eebf0 --- /dev/null +++ b/archie/clients/email/lang_email.c @@ -0,0 +1,36 @@ +char* EMAIL_001 = "Can't access temporary directory %s"; +char* EMAIL_002 = "Can't open given input file %s"; +char* EMAIL_003 = "Can't unlink input file %s"; +char* EMAIL_004 = "Error processing input"; +char* EMAIL_005 = "Can't change working directory to %s"; + +char* SAVEINPUT_001 = "Can't open temporary file %s"; +char* SAVEINPUT_002 = "Can't dup2 copied temporary file"; +char* SAVEINPUT_003 = "Error while waiting for copy"; +char* SAVEINPUT_004 = "Can't setup copying pipe"; + +char* PROCESS_INPUT_001 = "Can't open pipe to telnet server process"; +char* PROCESS_INPUT_002 = "Can't dup2 pipe to stdin" ; +char* PROCESS_INPUT_003 = "Can't execvp the telnet server %s"; +char* PROCESS_INPUT_004 = "Can't write initial path to telnet client"; +char* PROCESS_INPUT_005 = "Can't write subject line command to telnet client"; +char* PROCESS_INPUT_006 = "Erorr in wait3() for telnet client"; +char* PROCESS_INPUT_007 = "telnet client %s exited abnormally with value %d"; +char* PROCESS_INPUT_008 = "telnet program %s terminated abnormally with signal %d"; +char* PROCESS_INPUT_009 = "Erorr in wait for telnet client"; +char* PROCESS_INPUT_010 = "Can't dup2 temporary file %s to stdout"; +char* PROCESS_INPUT_011 = "Can't dup2 temporary file %s to stderr"; +char* PROCESS_INPUT_012 = "Can't open temporary file %s"; +char* PROCESS_INPUT_013 = "Can't write quit command to telnet client"; +char* PROCESS_INPUT_014 = "Can't write line %s to telnet client"; +char* PROCESS_INPUT_015 = "Can't unlink input file %s"; +char* PROCESS_INPUT_016 = "Can't unlink temporary file %s"; +char* PROCESS_INPUT_017 = "Can't malloc space for argument list"; +char* PROCESS_INPUT_018 = "Child returned from wait3() (pid: %d) not same as forked (pid: %d)"; + +#if 0 +char* OPEN_MAILSERV_001 = "No mail host given"; +char* OPEN_MAILSERV_002 = "No mail port (service) given"; +char* OPEN_MAILSERV_003 = "Unknown service %s"; +char* OPEN_MAILSERV_004 = "Can't open connection to mailserver %s port %d"; +#endif diff --git a/archie/clients/email/lang_email.h b/archie/clients/email/lang_email.h new file mode 100644 index 0000000..eb52009 --- /dev/null +++ b/archie/clients/email/lang_email.h @@ -0,0 +1,33 @@ +#ifndef _LANG_EMAIL_H_ +#define _LANG_EMAIL_H_ + +extern char* EMAIL_001 ; +extern char* EMAIL_002 ; +extern char* EMAIL_003 ; +extern char* EMAIL_004 ; +extern char* EMAIL_005 ; + +extern char* SAVEINPUT_001 ; +extern char* SAVEINPUT_002 ; +extern char* SAVEINPUT_003 ; +extern char* SAVEINPUT_004 ; + +extern char* PROCESS_INPUT_001 ; +extern char* PROCESS_INPUT_002 ; +extern char* PROCESS_INPUT_003 ; +extern char* PROCESS_INPUT_004 ; +extern char* PROCESS_INPUT_005 ; +extern char* PROCESS_INPUT_006 ; +extern char* PROCESS_INPUT_007 ; +extern char* PROCESS_INPUT_008 ; +extern char* PROCESS_INPUT_009 ; +extern char* PROCESS_INPUT_010 ; +extern char* PROCESS_INPUT_011 ; +extern char* PROCESS_INPUT_012 ; +extern char* PROCESS_INPUT_013 ; +extern char* PROCESS_INPUT_014 ; +extern char* PROCESS_INPUT_015 ; +extern char* PROCESS_INPUT_016 ; +extern char* PROCESS_INPUT_017 ; +extern char* PROCESS_INPUT_018 ; +#endif diff --git a/archie/clients/email/process-email b/archie/clients/email/process-email new file mode 100755 index 0000000..c2d2ca9 --- /dev/null +++ b/archie/clients/email/process-email @@ -0,0 +1,56 @@ +#!/bin/sh +# +# process-email (c) Copyright Bunyip Information Systems, Inc. 1994 +# +# This routine can be used to batch incoming email requests for later +# processing +# +PATH=/bin:/usr/bin:/usr/ucb + + +ch_tmp() +{ + + if p=`grep "^archie:" /etc/passwd` ; then + archiehome=`echo $p | awk -F: '{print $6}'` + elif p=`ypmatch archie passwd` ; then + archiehome=`echo $p | awk -F: '{print $6}'` + fi + + chdir $archiehome/db/tmp +} + +usage() { + echo "Usage: batch-email -t " + exit 1 +} + +tdir="notset" + +while [ $# -gt 1 ] ; do + case $1 in + +#temp directory + -t) if [ $# -gt 1 ] ; then shift ; tdir=$1; else usage; fi;; + + esac + shift +done + + +if [ $tdir = "notset" ]; then + ch_tmp +else + chdir $tdir +fi + +for i in aremail.*; do +# $archiehome/bin/email-client -i $i $* + if ($archiehome/bin/email-client < $i) ; then + /bin/rm -f $i + else + /bim/mv -f $i FAILED_$i + fi +done + + diff --git a/archie/clients/mail_back_end/.gitignore b/archie/clients/mail_back_end/.gitignore new file mode 100644 index 0000000..f3c7a7c --- /dev/null +++ b/archie/clients/mail_back_end/.gitignore @@ -0,0 +1 @@ +Makefile diff --git a/archie/clients/mail_back_end/AIX-2/.gitignore b/archie/clients/mail_back_end/AIX-2/.gitignore new file mode 100644 index 0000000..f3c7a7c --- /dev/null +++ b/archie/clients/mail_back_end/AIX-2/.gitignore @@ -0,0 +1 @@ +Makefile diff --git a/archie/clients/mail_back_end/AIX-2/Makefile.in b/archie/clients/mail_back_end/AIX-2/Makefile.in new file mode 100755 index 0000000..21bcdbb --- /dev/null +++ b/archie/clients/mail_back_end/AIX-2/Makefile.in @@ -0,0 +1,11 @@ +# +# Use GNU's fixed header files. +# +SYS_DEFS = -DAIX +SENT_FLAGS = -ffixed-%g2 -ffixed-%g3 -ffixed-%g4 + +include ../Makefile.pre + +include ../Makefile.post + +# DO NOT DELETE THIS LINE -- make depend depends on it diff --git a/archie/clients/mail_back_end/Makefile.post b/archie/clients/mail_back_end/Makefile.post new file mode 100755 index 0000000..5786a34 --- /dev/null +++ b/archie/clients/mail_back_end/Makefile.post @@ -0,0 +1,16 @@ +# +# Patrie module. +# + +all: $(EXES) + +include $(ARCHIE_ROOT)/Makefile.post + + +split_file: $(OBJS) + $(CC) $(CFLAGS) -o $@ $(OBJS) $(MOD_LIBS) $(SYS_LIBS) + + + +clean: + rm -f *.o $(EXES) diff --git a/archie/clients/mail_back_end/Makefile.pre b/archie/clients/mail_back_end/Makefile.pre new file mode 100755 index 0000000..27873a3 --- /dev/null +++ b/archie/clients/mail_back_end/Makefile.pre @@ -0,0 +1,31 @@ +# +# Anonftp/lib module. +# + +#MOD_CFLAGS = -ansi -pedantic -pipe +#MOD_CFLAGS = -pipe +MOD_DEBUG = -g3 +MOD_WARN = -Wall -Wtraditional -Wshadow -Wpointer-arith -Wcast-align \ + -Wstrict-prototypes -Wnested-externs + +MOD_INCS = -I$(CLIENT_MODULE)/telnet + +include $(ARCHIE_ROOT)/Makefile.pre + + +#INCS = \ +# email.h \ +# lang_email.h + +SRCS = \ + split_file.c + + +OBJS = \ + split_file.o + + +EXES = \ + split_file + + diff --git a/archie/clients/mail_back_end/README b/archie/clients/mail_back_end/README new file mode 100644 index 0000000..4501cd1 --- /dev/null +++ b/archie/clients/mail_back_end/README @@ -0,0 +1,18 @@ + + The program `split_file' is used to split large files prior to mailing + them back to the user. + + Its usage is: + + split_file -s -f [-n] + + By default an integral number of text lines will be written to each "split + file". That is, bytes, plus how ever may characters it takes + to commplete the current text line. + + The `-n' option specifies that exactly bytes will be written + to each "split file". + + is the base part of the output file name; a `.' will be + appended to the actual name, where is a number greater than or equal + to zero. diff --git a/archie/clients/mail_back_end/SunOS-4.1.4/.gitignore b/archie/clients/mail_back_end/SunOS-4.1.4/.gitignore new file mode 100644 index 0000000..f3c7a7c --- /dev/null +++ b/archie/clients/mail_back_end/SunOS-4.1.4/.gitignore @@ -0,0 +1 @@ +Makefile diff --git a/archie/clients/mail_back_end/SunOS-4.1.4/Makefile.in b/archie/clients/mail_back_end/SunOS-4.1.4/Makefile.in new file mode 100755 index 0000000..5fcf9ab --- /dev/null +++ b/archie/clients/mail_back_end/SunOS-4.1.4/Makefile.in @@ -0,0 +1,10 @@ +# +# Use GNU's fixed header files. +# +SYS_DEFS = -D__USE_FIXED_PROTOTYPES__ -DSUNOS +SENT_FLAGS = -ffixed-%g2 -ffixed-%g3 -ffixed-%g4 + +include ../Makefile.pre +include ../Makefile.post + +# DO NOT DELETE THIS LINE -- make depend depends on it diff --git a/archie/clients/mail_back_end/SunOS-5.4/.gitignore b/archie/clients/mail_back_end/SunOS-5.4/.gitignore new file mode 100644 index 0000000..f3c7a7c --- /dev/null +++ b/archie/clients/mail_back_end/SunOS-5.4/.gitignore @@ -0,0 +1 @@ +Makefile diff --git a/archie/clients/mail_back_end/SunOS-5.4/Makefile.in b/archie/clients/mail_back_end/SunOS-5.4/Makefile.in new file mode 100755 index 0000000..e37eb32 --- /dev/null +++ b/archie/clients/mail_back_end/SunOS-5.4/Makefile.in @@ -0,0 +1,11 @@ +# +# Use GNU's fixed header files. +# +SYS_DEFS = -D__USE_FIXED_PROTOTYPES__ -DSOLARIS +SENT_FLAGS = -ffixed-%g2 -ffixed-%g3 -ffixed-%g4 +SYS_LIBS = -lresolv -lnsl -lsocket + +include ../Makefile.pre +include ../Makefile.post + +# DO NOT DELETE THIS LINE -- make depend depends on it diff --git a/archie/clients/mail_back_end/SunOS-5.6 b/archie/clients/mail_back_end/SunOS-5.6 new file mode 120000 index 0000000..7b4e044 --- /dev/null +++ b/archie/clients/mail_back_end/SunOS-5.6 @@ -0,0 +1 @@ +SunOS-5.4 \ No newline at end of file diff --git a/archie/clients/mail_back_end/archiemail b/archie/clients/mail_back_end/archiemail new file mode 100755 index 0000000..6515409 --- /dev/null +++ b/archie/clients/mail_back_end/archiemail @@ -0,0 +1,70 @@ +#!/bin/sh +# +# Invoke the script that mails output back to the user. +# If any errors are generated by this script, collect them +# and mail them to `recipient'. +# +# The path must include: +# +# - the `mail_receiver' shell script +# - a mail program that takes the -s option +# - rm +# - whoami + +PATH=/usr/ucb:/bin:bin +#PATH=/usr/ucb:/bin:/archie/src/3.0/telnet-client/archie-client/mail_back_end + +# ---------------- Configure ---------------- +# the address, at your site, to which to mail errors generated +# when attepmting to send mail +recipient=archie-errors +# +# temporary file in which to collect any error messages +err=/tmp/mailerr$$ +# -------------- End Configure -------------- + +> $err +if [ $# -ge 1 ] ; then + if [ "$1" != "-d" ] ; then + args="" + else + exec 2> $err + set -x + args="-d" + fi +fi + +fatal() +{ + echo "" + echo "${prog}: $1" + exit 1 +} + +get_home() +{ + if [ $# -ne 1 ] ; then + fatal "get_home: bad number of arguments" + fi + if p=`grep "^${1}:" /etc/passwd` ; then + echo $p | awk -F: '{print $6}' + elif p=`ypmatch $1 passwd` ; then + echo $p | awk -F: '{print $6}' + else + fatal "get_home: can't find home directory for $1" + fi +} + +prog=`basename $0` +if cd `get_home \`whoami\`` ; then + : +else + fatal "can't change to home directory!" +fi + +umask 077 +mail_receiver $args 2>> $err +if [ -f $err -a -s $err ] ; then + mail -s "error from mail_receiver $err" $recipient < $err +fi +rm -f $err diff --git a/archie/clients/mail_back_end/archiemail.curr b/archie/clients/mail_back_end/archiemail.curr new file mode 100755 index 0000000..af0db52 --- /dev/null +++ b/archie/clients/mail_back_end/archiemail.curr @@ -0,0 +1,59 @@ +#!/bin/sh +# +# Invoke the script that mails output back to the user. +# If any errors are generated by this script, collect them +# and mail them to `recipient'. +# +# The path must include: +# +# - the `mail_receiver' shell script +# - a mail program that takes the -s option +# - rm +# - whoami + +PATH=/usr/ucb:/bin:bin +#PATH=/usr/ucb:/bin:/archie/src/3.0/telnet-client/archie-client/mail_back_end + +# ---------------- Configure ---------------- +# the address, at your site, to which to mail errors generated +# when attepmting to send mail +recipient=archie-errors +# +# temporary file in which to collect any error messages +err=/tmp/mailerr$$ +# -------------- End Configure -------------- + +fatal() +{ + echo "" + echo "${prog}: $1" + exit 1 +} + +get_home() +{ + if [ $# -ne 1 ] ; then + fatal "get_home: bad number of arguments" + fi + if p=`grep "^${1}:" /etc/passwd` ; then + echo $p | awk -F: '{print $6}' + elif p=`ypmatch $1 passwd` ; then + echo $p | awk -F: '{print $6}' + else + fatal "get_home: can't find home directory for $1" + fi +} + +prog=`basename $0` +if cd `get_home \`whoami\`` ; then + : +else + fatal "can't change to home directory!" +fi + +umask 077 +mail_receiver 2> $err +if [ -f $err -a -s $err ] ; then + mail -s "error from mail_receiver $err" $recipient < $err +fi +rm -f $err diff --git a/archie/clients/mail_back_end/mail_handler b/archie/clients/mail_back_end/mail_handler new file mode 100755 index 0000000..5473d42 --- /dev/null +++ b/archie/clients/mail_back_end/mail_handler @@ -0,0 +1,7 @@ +#!/bin/sh + +fbase=zzz$$ +rm -f Info MailHeader +sed -e '/@Begin/,/@MailHeader/w Info' -e '/@MailHeader/,/@End/w MailHeader' \ + -e '/@Begin/,/@End/d' | \ + (ms_size=`sed -n 's/^MaxSplitSize: //p' < Info` ; cat Info ; echo $ms_size ; split_file -s $ms_size -f $fbase) diff --git a/archie/clients/mail_back_end/mail_receiver b/archie/clients/mail_back_end/mail_receiver new file mode 100755 index 0000000..242639e --- /dev/null +++ b/archie/clients/mail_back_end/mail_receiver @@ -0,0 +1,107 @@ +#!/bin/sh -u +# +# We handle the output, from the telnet and e-mail clients, that is to +# be mailed to the user. +# + +if [ $# -ge 1 ] ; then + if [ "$1" = "-d" ] ; then + set -x + fi +fi + +do_trap () +{ + echo "${prog}: caught trap!" 1>&2 + failure +} + +failure () +{ + echo "${prog}: cleaning up and exiting." 1>&2 + rm -f $info $mhead $data $part.* + exit 1 +} + +# ----------------- Configure ---------------------- + +# +# The path must include: +# +# - your mailer ($mailcmd) (e.g. /usr/lib/sendmail) +# - any compression programs ($compress) (e.g. /usr/ucb/compress) +# - any encoding programs ($encode) (e.g. /usr/bin/uuencode) +# - sed +# - cat +# - split_file (comes with archie) +# - echo +# - wc +# - expr +# - grep +# - rm + +PATH=/usr/bin:/usr/ucb:/usr/lib:bin +#PATH=/usr/bin:/usr/ucb:/usr/lib:/archie/src/3.0/telnet-client/archie-client/mail_back_end + +tmp=/tmp +# Must use quotes +mailcmd="sendmail -t -farchie-errors" + +# --------------- End Configure -------------------- + + +info=$tmp/Info$$ +mhead=$tmp/Head$$ +data=$tmp/Data$$ +part=$tmp/Part$$ + +prog=`basename $0` +umask 077 +trap do_trap 1 2 3 15 + +if sed -e "/@Begin/,/@MailHeader/w $info" -e "/@MailHeader/,/@End/w $mhead" \ + -e '/@Begin/,/@End/d' > $data ; then + : +else + echo "${prog}: failed to extract info and mail headers." 1>&2 + failure +fi + +if acmd=`sed -n 's/Command: //p' < $info` && \ + compress=`sed -n 's/Compress: //p' < $info` && \ + encode=`sed -n 's/Encode: //p' < $info` && \ + ms_size=`sed -n 's/MaxSplitSize: //p' < $info` ; then + : +else + echo "${prog}: failed to extract variables from info header." 1>&2 + failure +fi + +if [ "$compress" = "none" ] ; then + compress=cat +fi + +# uuencode _requires_ an argument; pain in the butt +# +case $encode in + none) encode=cat ;; + uuencode) encode="uuencode archie-output" ;; + *) encode=cat ;; +esac + +if $compress < $data | $encode | split_file -s $ms_size -f $part ; then + : +else + echo "${prog}: compress, encode, split_file pipeline failed." 1>&2 + failure +fi + +nparts=`echo $part.* | wc -w | sed 's/[ ][ ]*//g'` +for f in $part.* ; do + pnum=`expr $f : '.*\.\(.*\)$'` + (grep -v '^@' $mhead ; \ + echo "Subject: archie [$acmd] part $pnum of $nparts" ; \ + echo "" ; cat $f) | $mailcmd +done +rm -f $info $mhead $data $part.* +exit 0 diff --git a/archie/clients/mail_back_end/mail_receiver.curr b/archie/clients/mail_back_end/mail_receiver.curr new file mode 100755 index 0000000..fec3da6 --- /dev/null +++ b/archie/clients/mail_back_end/mail_receiver.curr @@ -0,0 +1,101 @@ +#!/bin/sh -u +# +# We handle the output, from the telnet and e-mail clients, that is to +# be mailed to the user. +# + +do_trap () +{ + echo "${prog}: caught trap!" 1>&2 + failure +} + +failure () +{ + echo "${prog}: cleaning up and exiting." 1>&2 + rm -f $info $mhead $data $part.* + exit 1 +} + +# ----------------- Configure ---------------------- + +# +# The path must include: +# +# - your mailer ($mailcmd) (e.g. /usr/lib/sendmail) +# - any compression programs ($compress) (e.g. /usr/ucb/compress) +# - any encoding programs ($encode) (e.g. /usr/bin/uuencode) +# - sed +# - cat +# - split_file (comes with archie) +# - echo +# - wc +# - expr +# - grep +# - rm + +PATH=/usr/bin:/usr/ucb:/usr/lib:bin +#PATH=/usr/bin:/usr/ucb:/usr/lib:/archie/src/3.0/telnet-client/archie-client/mail_back_end + +tmp=/tmp +# Must use quotes +mailcmd="sendmail -t" + +# --------------- End Configure -------------------- + + +info=$tmp/Info$$ +mhead=$tmp/Head$$ +data=$tmp/Data$$ +part=$tmp/Part$$ + +prog=`basename $0` +umask 077 +trap do_trap 1 2 3 15 + +if sed -e "/@Begin/,/@MailHeader/w $info" -e "/@MailHeader/,/@End/w $mhead" \ + -e '/@Begin/,/@End/d' > $data ; then + : +else + echo "${prog}: failed to extract info and mail headers." 1>&2 + failure +fi + +if acmd=`sed -n 's/Command: //p' < $info` && \ + compress=`sed -n 's/Compress: //p' < $info` && \ + encode=`sed -n 's/Encode: //p' < $info` && \ + ms_size=`sed -n 's/MaxSplitSize: //p' < $info` ; then + : +else + echo "${prog}: failed to extract variables from info header." 1>&2 + failure +fi + +if [ "$compress" = "none" ] ; then + compress=cat +fi + +# uuencode _requires_ an argument; pain in the butt +# +case $encode in + none) encode=cat ;; + uuencode) encode="uuencode archie-output" ;; + *) encode=cat ;; +esac + +if $compress < $data | $encode | split_file -s $ms_size -f $part ; then + : +else + echo "${prog}: compress, encode, split_file pipeline failed." 1>&2 + failure +fi + +nparts=`echo $part.* | wc -w | sed 's/[ ][ ]*//g'` +for f in $part.* ; do + pnum=`expr $f : '.*\.\(.*\)$'` + (grep -v '^@' $mhead ; \ + echo "Subject: archie [$acmd] part $pnum of $nparts" ; \ + echo "" ; cat $f) | $mailcmd +done +rm -f $info $mhead $data $part.* +exit 0 diff --git a/archie/clients/mail_back_end/split_file.c b/archie/clients/mail_back_end/split_file.c new file mode 100644 index 0000000..a5eb8ec --- /dev/null +++ b/archie/clients/mail_back_end/split_file.c @@ -0,0 +1,248 @@ +/* + Usage: + + split_file -s -f [-n] + + By default an integral number of text lines will be written to each "split + file". That is, bytes, plus how ever may characters it takes + to commplete the current text line. + + The `-n' option specifies that exactly bytes will be written to + each "split file". + + is the base part of the output file name; a `.' will be appended + to the actual name, where is a number greater than or equal to zero. + +*/ + + +#include +#include +#include +#ifndef __GNUC__ +#include /* mempcy is a GNU built-in & non-ANSI definition conflicts */ +#endif +#include +#include +#include "ansi_compat.h" +/* #include "misc_ansi_defs.h"*/ + + +#define MIN_SPLIT_SIZE 1024 /* minimum size of a split file */ +#define LSIZE MIN_SPLIT_SIZE /* limits line length in line-at-a-time mode */ + + +extern const char *tail PROTO((const char *path)); +extern int fill_file PROTO((FILE *ifp, FILE *ofp, int size, int line_at_a_time)); +extern void usage PROTO((void)); + + +const char *prog; + + +int main(ac, av) + int ac; + char **av; +{ + FILE *ofp; + char *fname; + char *fnbase = (char *)0; + int filenum = 0; + int eof = 0; + int s = INT_MIN; + int line_at_a_time = 1; + + prog = tail(av[0]); + while(av++, --ac) + { + if (av[0][0] != '-') + { + usage(); + } + else + { + switch (av[0][1]) + { + case 'f': + av++, --ac; + fnbase = av[0]; + break; + + case 's': + av++, --ac; + s = atoi(av[0]); + break; + + case 'n': + line_at_a_time = 0; + break; + + default: + usage(); + } + } + } + if ( ! fnbase || s == INT_MIN) + { + usage(); + } + if (s < MIN_SPLIT_SIZE) + { + fprintf(stderr, "%s: you must specify a size greater than or equal to `%d'.\n", + prog, MIN_SPLIT_SIZE); + usage(); + } + if ( ! (fname = malloc((unsigned)strlen(fnbase) + 12))) + { + fprintf(stderr, "%s: error malloc()ing %d bytes for output file names: ", prog, + strlen(fnbase) + 12); + perror(""); + exit(1); + } + + umask(077); + while ( ! eof) + { + int n; + + filenum++; + sprintf(fname, "%s.%d", fnbase, filenum); + if ( ! (ofp = fopen(fname, "w"))) + { + fprintf(stderr, "%s: error opening `%s' write-only: ", prog, fname); perror(""); + fprintf(stderr, "%s: exiting.\n", prog); + free(fname); + exit(1); + } + + switch (n = fill_file(stdin, ofp, s, line_at_a_time)) + { + case -1: + fprintf(stderr, "%s: error -- exiting.\n", prog); + fclose(ofp); + free(fname); + exit(1); + + case 0: + /* + End of file and nothing was written, so we can toast the newly + created file. + */ + eof = 1; + unlink(fname); + break; + + default: + if (n < s) /* eof */ + { + eof = 1; + } + break; + } + + fclose(ofp); + } + free(fname); + exit(0); +} + + +int fill_file(ifp, ofp, size, line_at_a_time) + FILE *ifp; + FILE *ofp; + int size; + int line_at_a_time; +{ + int nwritten = 0; + + if (line_at_a_time) + { + char line[LSIZE + 1]; + + while (nwritten < size) + { + int slen; + + line[LSIZE - 1] = '\0'; + if (fgets(line, sizeof line, ifp)) + { + if (line[LSIZE - 1] != '\0' && line[LSIZE - 1] != '\n') + { + fprintf(stderr, "%s: line too long! (> %d bytes)\n", prog, LSIZE); + return -1; + } + slen = strlen(line); + if (fwrite(line, 1, slen, ofp) == slen) + { + nwritten += slen; + } + else + { + fprintf(stderr, "%s: error fwrite()ing %d bytes: ", prog, slen); perror(""); + return -1; + } + } + else + { + if (feof(ifp)) + { + return nwritten; + } + else + { + fprintf(stderr, "%s: error reading one line: ", prog); perror(""); + return -1; + } + } + } + } + else + { + while (nwritten < size) + { + int c; + + if ((c = getc(ifp)) != EOF) + { + if (putc(c, ofp) == c) + { + nwritten++; + } + else + { + fprintf(stderr,"%s: error writing one character: ", prog); perror(""); + return -1; + } + } + else + { + if (feof(ifp)) + { + return nwritten; + } + else + { + fprintf(stderr, "%s: error reading a character: ", prog); perror(""); + return -1; + } + } + } + } + + return nwritten; /* nwritten == size */ +} + + +const char *tail(path) + const char *path; +{ + const char *p = strrchr(path, '/'); + return p ? p + 1 : path; +} + + +void usage() +{ + fprintf(stderr, "Usage: %s -s -f [-n]\n", prog); + exit(1); +} diff --git a/archie/clients/telnet/.gitignore b/archie/clients/telnet/.gitignore new file mode 100644 index 0000000..f3c7a7c --- /dev/null +++ b/archie/clients/telnet/.gitignore @@ -0,0 +1 @@ +Makefile diff --git a/archie/clients/telnet/AIX-2/.gitignore b/archie/clients/telnet/AIX-2/.gitignore new file mode 100644 index 0000000..f3c7a7c --- /dev/null +++ b/archie/clients/telnet/AIX-2/.gitignore @@ -0,0 +1 @@ +Makefile diff --git a/archie/clients/telnet/AIX-2/Makefile.in b/archie/clients/telnet/AIX-2/Makefile.in new file mode 100644 index 0000000..bf88b41 --- /dev/null +++ b/archie/clients/telnet/AIX-2/Makefile.in @@ -0,0 +1,15 @@ +# +# Use GNU's fixed header files. +# +SYS_DEFS = -DAIX +SENT_FLAGS = -ffixed-%g2 -ffixed-%g3 -ffixed-%g4 +SYS_LIBS = -L${BERKDB_ROOT}/${SYSTYPE} -ldb + +include ../Makefile.pre + +# A hack to get rid of -u option. +XXF_CCL = + +include ../Makefile.post + +# DO NOT DELETE THIS LINE -- make depend depends on it diff --git a/archie/clients/telnet/Makefile.post b/archie/clients/telnet/Makefile.post new file mode 100755 index 0000000..4d9aa79 --- /dev/null +++ b/archie/clients/telnet/Makefile.post @@ -0,0 +1,47 @@ +# +# clients/telnet +# + +all: $(EXES) + + +include $(ARCHIE_ROOT)/Makefile.post + + +_always_first_: + $(CC) $(CFLAGS) -c ../version.c -DVERSION="\"telnet-client: version 3.5 (p5 `date`)\"" + +telnet-client: \ + $(LIBARCHIE_MODULE)/$(SYSTYPE)/libarchie.a \ + $(PROSPERO_ROOT)/lib/psrv/libpsrv.a \ + $(PROSPERO_ROOT)/lib/pfs/libpfs.a \ + $(PROSPERO_ROOT)/lib/filters/libfilter.a \ + $(PROSPERO_ROOT)/lib/ardp/libardp.a \ + $(LIBPARCHIE_MODULE)/$(SYSTYPE)/libparchie.a \ + $(LIBPSARCHIE_MODULE)/$(SYSTYPE)/libpsarchie.a \ + $(ARCHSEARCH_MODULE)/$(SYSTYPE)/libarchsearch.a \ + $(STARTDB_MODULE)/$(SYSTYPE)/libstartdb.a \ + $(STRIDX_MODULE)/$(SYSTYPE)/libarchstridx.a \ + $(PATRIE_MODULE)/$(SYSTYPE)/libpatrie.a \ + $(WEBINDEX_MODULE)/lib/$(SYSTYPE)/libwebindex.a \ + _always_first_ $(OBJS) + ${CC} $(CFLAGS) -o $@ $(OBJS) $(MOD_LIBS) $(SYS_LIBS) + +telnet-client.ma: \ + $(LIBARCHIE_MODULE)/$(SYSTYPE)/libarchie.a \ + $(PROSPERO_ROOT)/lib/psrv/libpsrv.a \ + $(PROSPERO_ROOT)/lib/pfs/libpfs.a \ + $(PROSPERO_ROOT)/lib/filters/libfilter.a \ + $(PROSPERO_ROOT)/lib/ardp/libardp.a \ + $(LIBPARCHIE_MODULE)/$(SYSTYPE)/libparchie.a \ + $(LIBPSARCHIE_MODULE)/$(SYSTYPE)/libpsarchie.a \ + $(ARCHSEARCH_MODULE)/$(SYSTYPE)/libarchsearch.a \ + $(STARTDB_MODULE)/$(SYSTYPE)/libstartdb.a \ + $(STRIDX_MODULE)/$(SYSTYPE)/libarchstridx.a \ + $(PATRIE_MODULE)/$(SYSTYPE)/libpatrie.a \ + $(WEBINDEX_MODULE)/lib/$(SYSTYPE)/libwebindex.a \ + _always_first_ $(OBJS) + $(SENTINEL) ${CC} $(CFLAGS) -o $@ $(OBJS) $(MOD_LIBS) $(SYS_LIBS) + +clean: + rm -f *.o $(EXES) core diff --git a/archie/clients/telnet/Makefile.pre b/archie/clients/telnet/Makefile.pre new file mode 100755 index 0000000..25e6147 --- /dev/null +++ b/archie/clients/telnet/Makefile.pre @@ -0,0 +1,162 @@ +# +# clients/telnet +# + +MOD_CFLAGS = \ + -pipe \ + -u ${COMPILER_PREPENDS_C_SYMBOLS_WITH_UNDERSCORE}plog \ + -u ${COMPILER_PREPENDS_C_SYMBOLS_WITH_UNDERSCORE}sindex \ + -u ${COMPILER_PREPENDS_C_SYMBOLS_WITH_UNDERSCORE}search_site_index +MOD_DEBUG = -g3 +MOD_WARN = -Wall -Wshadow -Wpointer-arith -Wcast-align +MOD_DEFS = -DTELNET_CLIENT +MOD_INCS = \ + -I$(INCLUDE_MODULE) \ + -I$(STRIDX_MODULE) \ + -I$(ARCHSEARCH_MODULE) \ + -I$(STARTDB_MODULE) \ + -I$(WEBINDEX_MODULE)/lib \ + -I$(PATRIE_MODULE) \ + -I$(PROSPERO_ROOT)/include \ + -I. +# If only editline worked properly, sigh... use input.o in its place. +#MOD_LIBS = ... -L../editline -ledit +MOD_LIBS = \ + -L$(LIBARCHIE_MODULE)/$(SYSTYPE) -larchie \ + -L$(PROSPERO_ROOT)/lib/psrv -lpsrv \ + -L$(PROSPERO_ROOT)/lib/pfs -lpfs \ + -L$(PROSPERO_ROOT)/lib/filters -lfilter \ + -L$(PROSPERO_ROOT)/lib/ardp -lardp \ + -L$(LIBPARCHIE_MODULE)/$(SYSTYPE) -lparchie \ + -L$(LIBPSARCHIE_MODULE)/$(SYSTYPE) -lpsarchie \ + -L$(ARCHSEARCH_MODULE)/$(SYSTYPE) -larchsearch \ + -L$(STARTDB_MODULE)/$(SYSTYPE) -lstartdb \ + -L$(STRIDX_MODULE)/$(SYSTYPE) -larchstridx \ + -L$(PATRIE_MODULE)/$(SYSTYPE) -lpatrie \ + -L$(WEBINDEX_MODULE)/lib/$(SYSTYPE) -lwebindex \ + -lcurses -ltermcap + + +include $(ARCHIE_ROOT)/Makefile.pre + + +ENGLISH_SRCS = english-language-strings.c +FRENCH_SRCS = french-language-strings.c + +ENGLISH_OBJS = english-language-strings.o +FRENCH_OBJS = french-language-strings.o + + +INCS = \ + alarm.h \ + ansi_compat.h \ + arch_query.h \ + archie.h \ + argv.h \ + client_defs.h \ + client_structs.h \ + commands.h \ + commands_lang.h \ + debug.h \ + domains.h \ + extern.h \ + find.h \ + fork_wait.h \ + generic_find.h \ + get_types.h \ + get_types_lang.h \ + help.h \ + input.h \ + lang.h \ + list.h \ + macros.h \ + mail.h \ + mail_lang.h \ + mailarchie.h \ + misc.h \ + misc_ansi_defs.h \ + mode.h \ + mode_lang.h \ + pager.h \ + parchie.h \ + prosp.h \ + rmem.h \ + signals.h \ + strmap.h \ + style_lang.h \ + tellwait.h \ + terminal.h \ + terminal_lang.h \ + unixcompat.h \ + vars.h \ + vars_lang.h \ + version.h \ + version_lang.h \ + whatis.h + +SRCS = \ + alarm.c \ + arch_query.c \ + archie.c \ + argv.c \ + commands.c \ + domains.c \ + debug.c \ + find.c \ + fork_wait.c \ + generic_find.c \ + get_types.c \ + help.c \ + input.c \ + lang.c \ + list.c \ + mail.c \ + misc.c \ + mode.c \ + pager.c \ + prospquery.c \ + rmem.c \ + signals.c \ + strmap.c \ + tellwait.c \ + terminal.c \ + unixcompat.c \ + vars.c \ + version.c \ + whatis.c \ + $(ENGLISH_SRCS) + +OBJS = \ + alarm.o \ + arch_query.o \ + archie.o \ + argv.o \ + commands.o \ + domains.o \ + debug.o \ + find.o \ + fork_wait.o \ + generic_find.o \ + get_types.o \ + help.o \ + input.o \ + lang.o \ + list.o \ + mail.o \ + misc.o \ + mode.o \ + pager.o \ + prospquery.o \ + rmem.o \ + signals.o \ + strmap.o \ + tellwait.o \ + terminal.o \ + unixcompat.o \ + vars.o \ + version.o \ + whatis.o \ + $(ENGLISH_OBJS) + +EXES = \ + telnet-client diff --git a/archie/clients/telnet/SunOS-4.1.4/.gitignore b/archie/clients/telnet/SunOS-4.1.4/.gitignore new file mode 100644 index 0000000..f3c7a7c --- /dev/null +++ b/archie/clients/telnet/SunOS-4.1.4/.gitignore @@ -0,0 +1 @@ +Makefile diff --git a/archie/clients/telnet/SunOS-4.1.4/Makefile.in b/archie/clients/telnet/SunOS-4.1.4/Makefile.in new file mode 100644 index 0000000..c9592c3 --- /dev/null +++ b/archie/clients/telnet/SunOS-4.1.4/Makefile.in @@ -0,0 +1,14 @@ +# +# Use GNU's fixed header files. +# +COMPILER_PREPENDS_C_SYMBOLS_WITH_UNDERSCORE=_ + +SYS_CFLAGS = -static +SYS_DEFS = -D__USE_FIXED_PROTOTYPES__ -DSUNOS +SENT_FLAGS = -ffixed-%g2 -ffixed-%g3 -ffixed-%g4 +SYS_LIBS = -L${BERKDB_ROOT}/${SYSTYPE} -ldb + +include ../Makefile.pre +include ../Makefile.post + +# DO NOT DELETE THIS LINE -- make depend depends on it diff --git a/archie/clients/telnet/SunOS-5.4/.gitignore b/archie/clients/telnet/SunOS-5.4/.gitignore new file mode 100644 index 0000000..f3c7a7c --- /dev/null +++ b/archie/clients/telnet/SunOS-5.4/.gitignore @@ -0,0 +1 @@ +Makefile diff --git a/archie/clients/telnet/SunOS-5.4/Makefile.in b/archie/clients/telnet/SunOS-5.4/Makefile.in new file mode 100644 index 0000000..11ead16 --- /dev/null +++ b/archie/clients/telnet/SunOS-5.4/Makefile.in @@ -0,0 +1,11 @@ +# This is used in ../Makefile.pre. +COMPILER_PREPENDS_C_SYMBOLS_WITH_UNDERSCORE = + +SYS_DEFS = -D__USE_FIXED_PROTOTYPES__ -DSOLARIS +SYS_LIBS = -lnsl -lsocket -ldl -L${BERKDB_ROOT}/${SYSTYPE} -ldb +SENT_FLAGS = -ffixed-%g2 -ffixed-%g3 -ffixed-%g4 + +include ../Makefile.pre +include ../Makefile.post + +# DO NOT DELETE THIS LINE -- make depend depends on it diff --git a/archie/clients/telnet/SunOS-5.6 b/archie/clients/telnet/SunOS-5.6 new file mode 120000 index 0000000..7b4e044 --- /dev/null +++ b/archie/clients/telnet/SunOS-5.6 @@ -0,0 +1 @@ +SunOS-5.4 \ No newline at end of file diff --git a/archie/clients/telnet/afe.c b/archie/clients/telnet/afe.c new file mode 100644 index 0000000..67702e2 --- /dev/null +++ b/archie/clients/telnet/afe.c @@ -0,0 +1,37 @@ +/* + * Simulate archie.doc.ic.ac.uk's `login' program, which runs as root and is + * the parent and process group leader of the telnet-client. + * + * This program should be setuid root. + */ + +#ifdef __STDC__ +#include +#include +#endif + +#define TC "/archie/src/3.0/archie/bin/tc.test" + + +main(ac, av, envp) + int ac; + char **av; + char **envp; +{ + switch (fork()) + { + case -1: + exit(1); + + case 0: + setuid(getuid()); + setgid(getgid()); + execle(TC, "-telnet-client", 0, envp); + exit(1); + + default: + setuid(0); + while (wait((int *)0) != -1); + exit(0); + } +} diff --git a/archie/clients/telnet/alarm.c b/archie/clients/telnet/alarm.c new file mode 100644 index 0000000..b001098 --- /dev/null +++ b/archie/clients/telnet/alarm.c @@ -0,0 +1,53 @@ +#ifdef __STDC__ +#include +#include +#endif +#include +#include "protos.h" +#include "debug.h" +#include "defines.h" +#include "error.h" +#include "extern.h" +#include "lang.h" +#include "macros.h" +#include "misc.h" +#include "misc_ansi_defs.h" +#include "vars.h" + + +/* + * Routines to do autologout stuff. + */ + + +int set_alarm() +{ + const char *val; + int mins; + + if ( ! (val = get_var(V_AUTOLOGOUT))) + { + error(A_INTERR, "set_alarm", curr_lang[1]); + return 0; + } + else if ((mins = atoi(val)) == 0) + { + return 0; + } + else + { + alarm(MIN_TO_SEC(mins)); + d4fprintf(stderr, "%s: set_alarm: (%ld) alarm set to %d seconds at %s.\n", + prog, (long)getpid(), MIN_TO_SEC(mins), now()); + return 1; + } +} + + +int unset_alarm() +{ + alarm((unsigned)0); + d4fprintf(stderr, "%s: set_alarm: (%ld) alarm unset at %s.\n", + prog, (long)getpid(), now()); + return 1; +} diff --git a/archie/clients/telnet/alarm.h b/archie/clients/telnet/alarm.h new file mode 100644 index 0000000..93e8548 --- /dev/null +++ b/archie/clients/telnet/alarm.h @@ -0,0 +1,9 @@ +#ifndef ALARM_H +#define ALARM_H + +#include "ansi_compat.h" + +extern int unset_alarm PROTO((void)); +extern int set_alarm PROTO((void)); + +#endif diff --git a/archie/clients/telnet/ansi_compat.h b/archie/clients/telnet/ansi_compat.h new file mode 100644 index 0000000..72404ce --- /dev/null +++ b/archie/clients/telnet/ansi_compat.h @@ -0,0 +1,12 @@ +#ifndef ANSI_COMPAT_H +#define ANSI_COMPAT_H + +#ifdef __STDC__ +# define PROTO(arglist) arglist +#else +# define const +# define volatile +# define PROTO(arglist) () +#endif + +#endif diff --git a/archie/clients/telnet/arch_query.c b/archie/clients/telnet/arch_query.c new file mode 100644 index 0000000..764541b --- /dev/null +++ b/archie/clients/telnet/arch_query.c @@ -0,0 +1,706 @@ +#include +#include /* don't ask... */ +#include +#include +#include "typedef.h" +#include "archie_dns.h" +#include "archie_strings.h" +#include "extern.h" +#include "core_entry.h" +#include "files.h" +#include "get-info.h" +#include "archstridx.h" +#include "db_ops.h" +#include "debug.h" +#include "domain.h" +#include "error.h" +#include "master.h" +#include "search.h" +#include "start_db.h" +#include "times.h" +#include "arch_query.h" + + +/* + * The type of our comparison functions. + */ +typedef int (*CmpFn)(query_result_t *, query_result_t *); + +/* + * The type of the comparison function required by `qsort'. + */ +typedef int (*QsortCmpFn)(const void *, const void *); + +/* + * The type of our result printing functions. + */ +typedef void (*PrintFn)(struct arch_query *, FILE *); + + +struct arch_query { + struct arch_stridx_handle *strhan; + + file_info_t *startsDB; + file_info_t *hostauxDB; + file_info_t *hostbyaddrDB; + + char *key; + + int srchType; /* one of EXACT, REGEX or SUB */ + int caseSens; /* 0: insensitive; 1: sensitive */ + + CmpFn cmpFn; /* sort comparison function */ + PrintFn printFn; /* results printing function */ + + int maxHits; + int maxMatches; + int maxHitsPerMatch; + + char **matchPaths; + int matchPathsCnt; + int pathLogicalPath; + + domain_t matchDomains[MAX_NO_DOMAINS]; + int matchDomainsCnt; + + query_result_t *result; + int resultCnt; +}; + + +static void verbose_results(struct arch_query *q, FILE *ofp); + + +static int cmp_filename(query_result_t *a, query_result_t *b) { + return strcmp(a->qrystr, b->qrystr); +} + + +static int cmp_rfilename(query_result_t *a, query_result_t *b) { + return -cmp_filename(a, b); +} + + +static int cmp_filesize(query_result_t *a, query_result_t *b) { + file_size_t sa = a->details.type.file.size, sb = b->details.type.file.size; + return sa > sb ? -1 : (sa < sb ? 1 : 0); +} + + +static int cmp_rfilesize(query_result_t *a, query_result_t *b) { + return -cmp_filesize(a, b); +} + + +/* + * The `str' field is prefixed by the host name. + */ +static int cmp_hostname(query_result_t *a, query_result_t *b) { + return strcmp(a->str, b->str); +} + + +static int cmp_rhostname(query_result_t *a, query_result_t *b) { + return -cmp_hostname(a, b); +} + + +static int cmp_modtime(query_result_t *a, query_result_t *b) { + date_time_t da = a->details.type.file.date, db = b->details.type.file.date; + return da > db ? -1 : (da < db ? 1 : 0); +} + + +static int cmp_rmodtime(query_result_t *a, query_result_t *b) { + return -cmp_modtime(a, b); +} + + +static void sort_results(struct arch_query *q) +{ + if (q->cmpFn) { + qsort(q->result, q->resultCnt, sizeof *q->result, (QsortCmpFn)q->cmpFn); + } +} + + +void querySetSortOrder(struct arch_query *q, char *sort) +{ + if ( ! sort) return; + + if (strcmp(sort, "filename") == 0) q->cmpFn = cmp_filename; + else if (strcmp(sort, "hostname") == 0) q->cmpFn = cmp_hostname; + else if (strcmp(sort, "none") == 0) q->cmpFn = 0; + else if (strcmp(sort, "nothing") == 0) q->cmpFn = 0; + else if (strcmp(sort, "rfilename") == 0) q->cmpFn = cmp_rfilename; + else if (strcmp(sort, "rhostname") == 0) q->cmpFn = cmp_rhostname; + else if (strcmp(sort, "rnothing") == 0) q->cmpFn = 0; + else if (strcmp(sort, "rsize") == 0) q->cmpFn = cmp_rfilesize; + else if (strcmp(sort, "rtime") == 0) q->cmpFn = cmp_rmodtime; + else if (strcmp(sort, "size") == 0) q->cmpFn = cmp_filesize; + else if (strcmp(sort, "time") == 0) q->cmpFn = cmp_modtime; +} + + +void queryFree(struct arch_query **query) +{ + struct arch_query *q = *query; + + if (q->strhan) { + archCloseStrIdx(q->strhan); + archFreeStrIdx(&q->strhan); + } + + if (q->startsDB) { + close_start_dbs(q->startsDB, 0); + destroy_finfo(q->startsDB); + } + + if (q->hostauxDB) { + close_host_dbs(0, 0, 0, q->hostauxDB); + destroy_finfo(q->hostauxDB); + } + + if (q->hostbyaddrDB) { + close_host_dbs(q->hostbyaddrDB, 0, 0, 0); + destroy_finfo(q->hostbyaddrDB); + } + + if (q->key) free(q->key); + + if (q->matchPaths) free(q->matchPaths); + if (q->result) free(q->result); + + free(q); + *query = 0; +} + + +static int query_init(struct arch_query *q) +{ + char nullStr[1] = ""; + + q->strhan = 0; + + q->startsDB = 0; + + q->key = 0; + + q->srchType = SUB; + q->caseSens = 0; + + q->cmpFn = 0; + q->printFn = verbose_results; + + q->maxHits = 30; + q->maxMatches = 30; + q->maxHitsPerMatch = 30; + + q->matchPaths = 0; + q->matchPathsCnt = 0; + q->pathLogicalPath = PATH_OR; + + q->matchDomainsCnt = 0; + + q->result = 0; + q->resultCnt = 0; + + if ( ! set_master_db_dir(nullStr)) { + error(A_ERR, "queryNew", "error setting the master database directory"); + return 0; + } + + if ( ! set_files_db_dir(nullStr)) { + error(A_ERR, "queryNew", "error setting the anonftp database directory"); + return 0; + } + + if( ! set_start_db_dir(nullStr, ANONFTP_DB_NAME)) { + error(A_ERR, "queryNew", "error setting the starts database directory"); + return 0; + } + + if ( ! set_host_db_dir(nullStr)) { + error(A_ERR, "queryNew", "Error setting the host database directory"); + return 0; + } + + if ( ! (q->startsDB = create_finfo())) { + return 0; + } + + if (open_start_dbs(q->startsDB, 0, O_RDONLY) == ERROR) { + error(A_ERR, "queryNew", "error opening the starts database"); + return 0; + } + + if ( ! (q->hostbyaddrDB = create_finfo()) || + ! (q->hostauxDB = create_finfo())) { + return 0; + } + + if (open_host_dbs(q->hostbyaddrDB, 0, 0, q->hostauxDB, O_RDONLY) == ERROR) { + error(A_ERR, "queryNew", "error opening the hosts databases"); + return 0; + } + + if ( ! (q->strhan = archNewStrIdx())) { + error(A_ERR, "queryNew", "can't create handle for searching the database"); + return 0; + } + + { + char *dir; + + if ( ! (dir = get_files_db_dir())) { + return 0; + } + + if ( ! archOpenStrIdx(q->strhan, dir, ARCH_STRIDX_SEARCH)) { + error(A_ERR, "queryNew", "can't open strings index files"); + free(dir); + return 0; + } + + free(dir); + } + + return 1; +} + + +struct arch_query *queryNew(void) +{ + struct arch_query *q; + + d1fprintf(stdout, "euid is %lu, ruid is %lu\n", + (unsigned long)geteuid(), (unsigned long)getuid()); fflush(stdout); + d1fprintf(stdout, "egid is %lu, rgid is %lu\n", + (unsigned long)getegid(), (unsigned long)getgid()); fflush(stdout); + + if ( ! (q = malloc(sizeof *q))) { + error(A_SYSERR, "queryNew", "can't allocate %ul bytes for query", + (unsigned long)sizeof *q); + return 0; + } + + if ( ! query_init(q)) { + queryFree(&q); + return 0; + } + + return q; +} + + +int queryPerform(struct arch_query *q) +{ + index_t **strings = 0; + start_return_t sr; + + error(A_INFO,"REQUEST","(maxhits=%d&query=%s&database=Anonymous FTP&type=%s&case=%s)",q->maxHits, q->key,get_type(q->srchType), get_case(q->caseSens)); + + if (archQuery( + q->strhan, + q->key, + q->srchType, + q->caseSens, + q->maxHits, + q->maxMatches, + q->maxHitsPerMatch, + q->matchPaths, + 0, + PATH_OR, + q->matchPathsCnt, + q->matchDomains, + q->matchDomainsCnt, + I_ANONFTP_DB, + q->startsDB, + 0, /* unused in archQuery */ + &q->result, + &strings, /* not sure what this is for... */ + &q->resultCnt, + &sr, /* not sure what this is for... */ + 0, + 0, + I_FORMAT_LINKS + ) == ERROR) { + error(A_ERR, "queryPerform", "Archie query failed"); + return 0; + } + + error(A_INFO,"RESULT","Found %d Hits",q->resultCnt); + + if (strings) free_strings(&strings, q->maxHits); + + return 1; +} + + +/* + * `dlist' is a colon separated list of domain, or pseudo-domain, names. + * `archQuery' seems to require domain names, so we expand them first. + */ +int querySetDomainMatches(struct arch_query *q, char *dlist) +{ + file_info_t *domainsDB; + + if ( ! (domainsDB = create_finfo())) { + return 0; + } + + if (open_start_dbs(0, domainsDB, O_RDONLY) == ERROR) { + error(A_ERR, "querySetDomainMatches", "can't open domains database"); + close_start_dbs(0, domainsDB); destroy_finfo(domainsDB); + return 0; + } + + if (compile_domains(dlist, q->matchDomains, domainsDB, &q->matchDomainsCnt) == ERROR) { + q->matchDomainsCnt = 0; /* just in case */ + close_start_dbs(0, domainsDB); destroy_finfo(domainsDB); + return 0; + } + + close_start_dbs(0, domainsDB); + destroy_finfo(domainsDB); + + return 1; +} + + +int querySetKey(struct arch_query *q, char *key) +{ + if ( ! (q->key = strdup(key))) { + error(A_SYSERR, "querySetKey", "can't duplicate search key"); + return 0; + } + + return 1; +} + + +/* + * `plist' is a colon separated list of names that should appear in the path. + */ +int querySetPathMatches(struct arch_query *q, char *plist) +{ + /* bug: assume there are no consecutive colons */ + + if ( ! strsplit(plist, ":", &q->matchPathsCnt, &q->matchPaths)) { + error(A_SYSERR, "querySetPathMatches", "can't split `%s' on `:'", plist); + return 0; + } + + return 1; +} + + +/* + * We deliberately ignore such things as the setuid bit, the sticky bit, etc. + * It's not clear that we can portably check for these. + */ +static char *perms_str(query_result_t res) +{ + static char p[11]; + mode_t m = res.details.type.file.perms; + + p[0] = '-'; + if (CSE_IS_DIR(res.details)) p[0] = 'd'; + else if (CSE_IS_LINK(res.details)) p[0] = 'l'; + + p[1] = m & S_IRUSR ? 'r' : '-'; + p[2] = m & S_IWUSR ? 'w' : '-'; + p[3] = m & S_IXUSR ? 'x' : '-'; + p[4] = m & S_IRGRP ? 'r' : '-'; + p[5] = m & S_IWGRP ? 'w' : '-'; + p[6] = m & S_IXGRP ? 'x' : '-'; + p[7] = m & S_IROTH ? 'r' : '-'; + p[8] = m & S_IWOTH ? 'w' : '-'; + p[9] = m & S_IXOTH ? 'x' : '-'; + + p[10] = '\0'; + + return p; +} + + +static int get_location_info(char *s, + char **hstart, int *hlen, + char **dstart, int *dlen, + char **fstart, int *flen) +{ + char *sl; + + *hstart = s; + if ( ! (sl = strchr(s, '/'))) return 0; + *hlen = sl - *hstart; + if (*hlen == 0) return 0; + + *dstart = sl; + if ( ! (sl = strrchr(s, '/'))) return 0; + *dlen = sl - *dstart; + if (*dlen == 0) return 0; + + *fstart = sl + 1; + *flen = strlen(*fstart); + if (*flen == 0) return 0; + + return 1; +} + + +static int is_same_string(char *s0, int l0, char *s1, int l1) +{ + if (l0 != l1) { + return 0; + } else { + return strncmp(s0, s1, l0) == 0; + } +} + + +/* + * As if by magic, we know that an `ip_addr_t' is an unsigned int containing + * the IP address in network byte order. bug: maybe not... + */ +static const char *ipaddr_string(ip_addr_t ip) +{ + static char ipstr[20]; + unsigned long i = ip; + + sprintf(ipstr, "%lu.%lu.%lu.%lu", + (i >> 24) & 0xFF, (i >> 16) & 0xFF, (i >> 8) & 0xFF, (i >> 0) & 0xFF); + return ipstr; +} + + +static const char *file_or_dir(details_t d) +{ + if (CSE_IS_FILE(d)) return "FILE"; + else if (CSE_IS_DIR(d)) return "DIRECTORY"; + else return "FILE"; /* oh, well... */ +} + + +/* + * Our crystal ball tells us that a `date_time_t' is the number of seconds + * since the epoch, in GMT. We'll also pretend it's a `time_t' rather than + * an unsigned int. + */ +static const char *time_string(date_time_t t) +{ + static char buf[30]; + struct tm *tm; + + if ( ! (tm = localtime(&t)) || + strftime(buf, sizeof buf, "%H:%M %e %h %Y", tm) == 0) { + return ""; + } + + return buf; +} + + +static const char *ztime_string(date_time_t t) +{ + static char buf[30]; + struct tm *tm; + + if ( ! (tm = gmtime(&t)) || + strftime(buf, sizeof buf, "%Y%m%d%H%M%SZ", tm) == 0) { + return ""; + } + + return buf; +} + + +/* + * This is the one we should use when listing the update time of a host. + */ +static const char *retrieved_time(struct arch_query *q, ip_addr_t addr) +{ + AR_DNS *a; + char *pn; + const char *res; + hostdb_aux_t ha; + index_t junk; + + if ((a = ar_gethostbyaddr(addr, DNS_LOCAL_ONLY, q->hostbyaddrDB))) { + if ((pn = get_dns_primary_name(a)) && + (get_hostaux_ent(pn, ANONFTP_DB_NAME, &junk, 0, 0, &ha, q->hostauxDB) != ERROR)) { + res = time_string(ha.retrieve_time); + } + + /* bug: a leak if we don't free it here... */ + if (a->h_addr_list[0]) free(a->h_addr_list[0]); + } + + return res; +} + + +static void machine_results(struct arch_query *q, FILE *ofp) +{ + int i; + + for (i = 0; i < q->resultCnt; i++) { + char *dstart, *fstart, *hstart; + int dlen, flen, hlen; + + if ( ! get_location_info(q->result[i].str, + &hstart, &hlen, &dstart, &dlen, &fstart, &flen)) { + /* Bad news, dude! Skip this result. */ + continue; + } + + fprintf(ofp, "%s %.*s %lu %s %.*s\n", + ztime_string(q->result[i].details.type.file.date), + hlen, hstart, + (unsigned long)q->result[i].details.type.file.size, + perms_str(q->result[i]), + dlen + flen + 1, dstart + ); + } +} + + +static void terse_results(struct arch_query *q, FILE *ofp) +{ + int i; + + for (i = 0; i < q->resultCnt; i++) { + char *dstart, *fstart, *hstart; + int dlen, flen, hlen; + + if ( ! get_location_info(q->result[i].str, + &hstart, &hlen, &dstart, &dlen, &fstart, &flen)) { + /* Bad news, dude! Skip this result. */ + continue; + } + + fprintf(ofp, "%.*s %12s %7lu %s\n", + hlen, hstart, + time_string(q->result[i].details.type.file.date), + (unsigned long)q->result[i].details.type.file.size, + dstart + ); + } +} + + +static void url_results(struct arch_query *q, FILE *ofp) +{ + int i; + + for (i = 0; i < q->resultCnt; i++) { + fprintf(ofp, "\n ftp://%s\n", q->result[i].str); + fprintf(ofp, "\t\tDate: %s Size: %lu bytes\n", + time_string(q->result[i].details.type.file.date), + (unsigned long)q->result[i].details.type.file.size + ); + } +} + + +static void verbose_results(struct arch_query *q, FILE *ofp) +{ + char *od = 0, *oh = 0; /* old directory and host names */ + int odlen = -1, ohlen = -1; /* length of old directory and host names */ + int i; + + for (i = 0; i < q->resultCnt; i++) { + char *dstart, *fstart, *hstart; + int dlen = -1, flen = -1, hlen = -1; + + if ( ! get_location_info(q->result[i].str, + &hstart, &hlen, &dstart, &dlen, &fstart, &flen)) { + /* Bad news, dude! Skip this result. */ + continue; + } + + /* + * Print the current host name only if it differs from the previous one. + */ + + if ( ! is_same_string(hstart, hlen, oh, ohlen)) { + fprintf(ofp, "\n\nHost %.*s\t(%s)\n", + hlen, hstart, + ipaddr_string(q->result[i].ipaddr)); + fprintf(ofp, "Last updated %s\n", retrieved_time(q, q->result[i].ipaddr)); + } + + /* + * Print the current directory only if it differs from the previous one. + */ + + if ( ! is_same_string(dstart, dlen, od, odlen)) { + fprintf(ofp, "\n Location: %.*s\n", dlen, dstart); + } + + /* bug: time in local time, ... */ + + fprintf(ofp, " %s %s %13lu %12s %s\n", + file_or_dir(q->result[i].details), + perms_str(q->result[i]), + (unsigned long)q->result[i].details.type.file.size, + time_string(q->result[i].details.type.file.date), + q->result[i].qrystr + ); + + od = dstart; odlen = dlen; + oh = hstart; ohlen = hlen; + } +} + + +void queryPrintResults(struct arch_query *q, FILE *ofp) +{ + if (q->resultCnt <= 0) { + fprintf(ofp, "\n# No matches were found.\n"); + } else { + sort_results(q); + q->printFn(q, ofp); + } +} + + +void querySetMaxHits(struct arch_query *q, int mh, int mm, int mhpm) +{ + if (mh > 0) q->maxHits = mh; + if (mm > 0) q->maxMatches = mm; + if (mhpm > 0) q->maxHitsPerMatch = mhpm; +} + + +void querySetOutputFormat(struct arch_query *q, char *ofmt) +{ + if (strcmp(ofmt, "machine") == 0) q->printFn = machine_results; + else if (strcmp(ofmt, "silent") == 0) q->printFn = verbose_results; + else if (strcmp(ofmt, "terse") == 0) q->printFn = terse_results; + else if (strcmp(ofmt, "verbose") == 0) q->printFn = verbose_results; + else if (strcmp(ofmt, "url") == 0) q->printFn = url_results; + else q->printFn = verbose_results; +} + + +void querySetSearchType(struct arch_query *q, char *srch) +{ + if ( ! srch) { + return; /* use defaults */ + } + + if (strcmp(srch, "exact") == 0) { + q->srchType = EXACT; + q->caseSens = 1; + } else if (strcmp(srch, "sub") == 0) { + q->srchType = SUB; + q->caseSens = 0; + } else if (strcmp(srch, "subcase") == 0) { + q->srchType = SUB; + q->caseSens = 1; + } else if (strcmp(srch, "regex") == 0) { + q->srchType = REGEX; + q->caseSens = 1; + } +} diff --git a/archie/clients/telnet/arch_query.h b/archie/clients/telnet/arch_query.h new file mode 100644 index 0000000..8bfacfa --- /dev/null +++ b/archie/clients/telnet/arch_query.h @@ -0,0 +1,14 @@ +struct arch_query; + + +extern int queryPerform(struct arch_query *q); +extern int querySetDomainMatches(struct arch_query *q, char *dlist); +extern int querySetKey(struct arch_query *q, char *key); +extern int querySetPathMatches(struct arch_query *q, char *plist); +extern struct arch_query *queryNew(void); +extern void queryFree(struct arch_query **query); +extern void queryPrintResults(struct arch_query *q, FILE *ofp); +extern void querySetMaxHits(struct arch_query *q, int mh, int mm, int mhpm); +extern void querySetOutputFormat(struct arch_query *q, char *ofmt); +extern void querySetSearchType(struct arch_query *q, char *srch); +extern void querySetSortOrder(struct arch_query *q, char *sort); diff --git a/archie/clients/telnet/archie.c b/archie/clients/telnet/archie.c new file mode 100644 index 0000000..4034855 --- /dev/null +++ b/archie/clients/telnet/archie.c @@ -0,0 +1,990 @@ +/* + * + * TELNET ARCHIE + * + * Program to provide telnet interface to the archie system. + * + * History: + * + * - Oct./92 Modified by Peter Deutsch (peterd@bunyip.com): + * + * Changes: + * + * - added DOMAINS command (bajan Tue Aug 17 00:42:03 EDT 1993) + * - modified FIND to use Prospero interface + * - added FIND alias for "PROG" command + * - modified LIST to use Prospero interface + * - dropped support for SITE command + * - Replace SERVERS command + * - added MOTD command + * - redid HELP subsytem to use recursive code and help tree. + * - added support for ".archierc" file to allow specifying server, help + * directory, etc (see sample .archierc file for details...) + * - added support for logfile (-l, -L) options -- bajan Sat Feb 27 21:58:25 EST 1993 + * + * To come (once Prospero 5.0 ready): + * + * - add multple database capability + * - In database + * - set database = + * - add path spec to anonFTP + * - add pseudo-domain support + * - add support for template model (WHOIS) + * + * - Original author: Bill Heelan ( wheelan@cs.mcgill.ca ) + * + * + * Bugs fixed: + * + * - no longer tries to chroot() in server mode if euid != 0. + * (Wed Jan 27 22:28:53 EST 1993) + * - no longer core dumps on "set term", etc. (i.e. numeric or string + * variables without arguments. + * (Fri Jan 29 01:21:30 EST 1993) + * + * + * To do for production: + * + * - stty (DONE) + * - getenv("TERM") for smart telnets (DONE) + * - if no commands in e-mail mode print help on exit (DONE) + * - new command: disable-command ... # sets mode to M_NONE (DONE) + * + * To think about: + * + * - rewrite 1/2 :-) + * - put function pointers in command list & make all front-end functions + * take the same arguments. + * - do pager outside of front-end functions. + * - remove_tmp on login?! Look into it. + * - hack less to take fd argument so we can unlink tmp files right away. + */ + +#include +#include +#ifdef RUTGERS +#include +#endif +#include +#include +#include +#include +#include +#include +#ifdef __STDC__ +# include /* for free() */ +# include +#endif +#include +#include "alarm.h" +#include "archie.h" +#include "archie_inet.h" +#include "argv.h" +#include "client_defs.h" +#include "commands.h" +/*#include "database.h"*/ +#include "debug.h" +#include "defines.h" +#include "domains.h" +#include "error.h" +#include "files.h" /* for tail() in library */ +#include "find.h" +#include "fork_wait.h" +#include "generic_find.h" +#include "help.h" +#include "input.h" +#include "lang.h" +#include "list.h" +#include "macros.h" +#include "mail.h" +#include "master.h" +#include "misc.h" +#include "misc_ansi_defs.h" +#include "mode.h" +#include "pager.h" +#include "prosp.h" +#include "signals.h" +#include "style_lang.h" /*bug: display() should have separate routines*/ +#include "terminal.h" +#include "unixcompat.h" +#include "vars.h" +#include "version.h" +#include "whatis.h" + +#include "protos.h" + +#define ARCHIERC ".archierc" +#define SYSARCHIERC "/usr/lib/.archierc" +#define USERNAME "archie" + +#define PRI_LOW -100 +#define PRI_HIGH 100 +#define PRI_NORMAL 0 + +#define NEXTARG if ( ! (av++, --ac)) usage() +#define NSETARG(var) NEXTARG; var = atoi(av[0]) +#define SETARG(var) NEXTARG; var = av[0] + + +static FILE *create_tmp_file PROTO((int email)); +static int compress_it PROTO((int ac, char **av)); +static int cvt_priority PROTO((int our_pri)); +static int disable_command PROTO((int ac, char **av)); +static int do_motd PROTO((int ac, char **av, FILE *ofp)); +#ifdef MULTIPLE_COLLECTIONS +static int in_it PROTO((int ac, char **av, FILE *ofp)); +#endif +static int init_from_file PROTO((const char *file, FILE *ofp, int mode)); +static int list_servers PROTO((int ac, char **av, FILE *ofp)); +static int man_it PROTO((int ac, char **av, FILE *ofp)); +static int set_path PROTO((int ac, char **av)); +static void command_loop PROTO((FILE *ifp, FILE *ofp, int mode)); +static void display PROTO((FILE *ifp, FILE *ofp)); +static void usage PROTO((void)); + + +char homedir[MAXPATHLEN]; +char rc_path[MAXPATHLEN]; +const char *prog; +int debug = 0; + + +int main(ac, av) + int ac; + char **av; +{ + FILE *ofp; + const char *hd; /* home directory */ + const char *logfile = 0; + pathname_t querylog; + int email = 0; + int hctxt; + int logging = 0; + int priority = PRI_NORMAL; + int server = 0; + + curr_lang = english; + prog = tail(av[0]); + server = *prog == '-'; + strcpy(rc_path, SYSARCHIERC); + +#if defined(VFPROT_VNO) && VFPROT_VNO >= 5 + p_initialize("ggB", 0, (struct p_initialize_st *)0); +#endif + + DBG(uids("pre-initial revoke: ");); + if ( ! revoke_root()) + { + error(A_SYSERR, "main", "error revoking privileges"); + exit(1); + } + DBG(uids("post-initial revoke: ");); + + while (av++, --ac) + { + if (av[0][0] != '-') + { + error(A_ERR, curr_lang[5], curr_lang[6], av[0]); + usage(); + } + else + { + switch (av[0][1]) + { + case 'L': + SETARG(logfile); + logging = 1; + break; + + case 'd': + NEXTARG; + set_var(V_DEBUG, av[0]); /* bug: arg. check */ + break; + + case 'e': + email = server = 1; + break; + + case 'i': + NEXTARG; + strcpy(rc_path, av[0]); + break; + + case 'l': + logging = 1; + break; + + case 'o': /* not used anymore; backward compat. */ + NEXTARG; + break; + + case 'p': + NSETARG(priority); + break; + + case 's': + server = 1; + break; + + default: + error(A_ERR, curr_lang[5], curr_lang[6], av[0]); + usage(); + } + } + } + +#define DEFAULT_QUERY_LOG_FILE "query.log" + + logging = 1; + if (logging) + { + if(logfile == NULL || logfile[0] == '\0'){ + sprintf(querylog, "%s/%s/%s", get_archie_home(), DEFAULT_LOG_DIR, DEFAULT_QUERY_LOG_FILE); + logfile = querylog; + } + + if (open_alog(logfile, A_INFO, prog) == ERROR) + { + exit(ERROR); + } + } + +#ifdef TESTING + putenv("PAGER="); + putenv("LESS="); +#endif +#ifdef LATIN1 + putenv("LESSCHARSET=latin1"); +#endif + + ardp_priority = cvt_priority(priority); + + + /* + * Special requirements for server mode. + */ + if (server) + { + const char *path = "PATH=bin:pager/bin"; + + putenv(path); + + if ((hd = get_home_dir_by_name(USERNAME))) + { + strcpy(homedir, hd); + } + else + { + error(A_INTERR, curr_lang[5], curr_lang[17]); + exit(1); + } + if (chdir(homedir) == -1) + { + error(A_SYSERR, curr_lang[5], curr_lang[18], homedir); + exit(1); + } + /* + * Look for .archierc. + */ + init_from_file(ARCHIERC, stdout, set_mode(M_SYS_RC)); + +#ifdef RUTGERS + /* + * Due a bug at Rutgers we will have, upon startup, a child + * that must be disposed of. + */ + while (wait((int *)0) > 0); +#endif + } + else /* Non-server mode: look for system and user rc files */ + { + /* + * First look for a system initialization file. + */ + init_from_file(rc_path, stdout, set_mode(M_SYS_RC)); + + /* + * Next look in the user's home directory (which would be archie's in + * server mode). + */ + if ((hd = get_home_dir_by_uid(getuid()))) + { + sprintf(rc_path, curr_lang[22], hd, ARCHIERC); + init_from_file(rc_path, stdout, set_mode(M_USER_RC)); + } + } + + if ( ! (ofp = create_tmp_file(email))) + { + error(A_ERR, "main", "can't create temporary file -- exiting.\n"); /*FFF*/ + exit(1); + } + + umask(077); + nice(atoi(get_var(V_NICENESS))); + set_mode(email ? M_EMAIL : M_INTERACTIVE); + + /* + * Set up to do command-line editing (if it's linked in...) + */ + if ((hctxt = new_hist_context()) != -1) + { + set_hist_context(hctxt); + } + else + { + error(A_INTERR, curr_lang[5], curr_lang[23]); + exit(1); /*bug? switch to non-editing input?*/ + } + + +#ifdef UQAM + printf(curr_lang[24]); +#endif + + if (current_mode() != M_EMAIL) + { + const char *s = "stty"; + static const char *args[] = { "show", "search", 0 }; + + printf(curr_lang[26]); + init_term(); + set_tty(1, (char **)&s); /*bug: should fix to do this in .archierc*/ + show_it((int)(sizeof args / sizeof (char *) - 1), (char **)args); + } + + parent_sigs(); + set_alarm(); /* boots user off for idling */ + + command_loop(stdin /* used in batch + email mode */, + ofp, current_mode()); + + fclose(ofp); + exit(0); + return 0; /* keep gcc quiet */ +} + + +static void command_loop(ifp, ofp, mode) + FILE *ifp; /* currently only used in batch & e-mail modes */ + FILE *ofp; + int mode; +{ + char **av; + char ocommand[INPUT_LINE_LEN]; + char *command; + int ac; + int cmd_modes; + int cmd_token; + int seen_a_command = 0; + + ocommand[0] = '\0'; + + while (1) + { + char c[INPUT_LINE_LEN]; /*bug: kludge - fix call to readline*/ + int show_output = 0; + + if (mode == M_INTERACTIVE) + { + command = readline(get_var(V_PROMPT)); + } + else + { + if ((command = fgets(c, sizeof c, ifp))) nuke_newline(command); + } + + if ( ! command) + { + if (mode == M_INTERACTIVE) fputs(curr_lang[28], stdout); /* looks nicer */ + cmd_token = BYE; + } + else + { + unset_alarm(); + cmd_token = get_cmd(command, &ac, &av, &cmd_modes); + + /* Is the command valid in the current mode? */ + if (cmd_modes & mode) + { + /* Don't add empty lines to the command history. */ + if (cmd_token != EMPTY) add_history(command); + } + else + { + if (cmd_modes == M_NONE) + { + printf(curr_lang[29]); + } + else + { + if (av) printf(curr_lang[30], mode_str(mode), av[0]); + else printf(curr_lang[39], command, mode_str(mode)); + } + continue; + } + } + + /* + * Echo commands in email mode, so the user can distinguish the + * different parts of the output. + */ + if (mode == M_EMAIL && command && /* bug: ugly */ + cmd_token != BAD && cmd_token != EMPTY && + cmd_token != BYE && cmd_token != EXIT && cmd_token != QUIT) + { + printf(curr_lang[31], command); + } + + switch (cmd_token) + { + case BYE: + case EXIT: + case QUIT: + /* + * If in e-mail mode and there is stuff to mail back... + */ + if (mode == M_INTERACTIVE) + { + printf(curr_lang[34]); + } + else if (mode == M_EMAIL) + { + if ( ! seen_a_command) + { + const char *h = "help"; + help(1, (char **)&h); + mail_it(1, (char **)&h, h, ofp); + } + else if ( ! fempty(ofp)) + { + const char *s = "mail"; + + mail_it(1, (char **)&s, ocommand, ofp); + } + } + return; + + case COMMENT: + case EMPTY: /* input was an empty line */ + break; + + case COMPRESS: + compress_it(ac, av); + break; + + case DISABLE: + disable_command(ac, av); + break; + + case DOMAINS: + show_output = domains_it(ac, av, ofp); + strcpy(ocommand, command); + seen_a_command = 1; + break; + + case DONE: + printf(curr_lang[35]); + break; + + case FIND: + case PROG: /* find a search string */ + show_output = find_it(ac, av, ofp); + strcpy(ocommand, command); + seen_a_command = 1; + break; + + case HELP: + help(ac, av); + seen_a_command = 1; + if (mode == M_EMAIL) + { + /* + * if the only command in e-mail mode is "help", mail_it() won't send + * anything unless it sees a value for the old command. + */ + strcpy(ocommand, command); + } + break; + +#ifdef MULTIPLE_COLLECTIONS + case IN: + seen_a_command = in_it(ac, av, ofp) && ac > 2; /*bug: kludge*/ + strcpy(ocommand, command); + break; +#endif + + case LIST: /* list the sites we know about */ + show_output = list_it(ac, av, ofp); + strcpy(ocommand, command); + seen_a_command = 1; + break; + + case MAIL: + mail_it(ac, av, ocommand, ofp); + if (current_mode() == M_EMAIL) + { + truncate_fp(ofp); + } + else + { + rewind_fp(ofp); + } + break; + + case MANPAGE: + show_output = man_it(ac, av, ofp); + strcpy(ocommand, command); + seen_a_command = 1; + break; + + case MOTD: + show_output = do_motd(ac, av, ofp); + strcpy(ocommand, command); + seen_a_command = 1; + break; + + case NON_UNIQUE: + printf(curr_lang[36]); + break; + + case NOPAGER: + unset_var(V_PAGER); + break; + + case PAGER: + set_var(V_PAGER, (char *)0); + break; + + case PATH: + set_path(ac, av); /*bug: error reporting? */ + break; + + case SERVERS: + show_output = list_servers(ac, av, ofp); + strcpy(ocommand, command); + seen_a_command = 1; + break; + + case SET: + set_it(ac, av); + break; + + case SHOW: + show_it(ac, av); + seen_a_command = 1; + break; + + case SITE: + printf(curr_lang[37]); + seen_a_command = 1; + break; + + case STTY: + set_tty(ac, av); + break; + + case TERM: + /* Tell us what kind of terminal to use for the pager. */ + install_term(ac, av); + break; + + case UNSET: + /* Unset a variable that has been set with the 'set' command. */ + unset_it(ac, av); + break; + + case VERSION: + printf(curr_lang[38], version); + seen_a_command = 1; + break; + + case WHATIS: + show_output = whatis_it(ac, av, ofp); + strcpy(ocommand, command); + seen_a_command = 1; + break; + + default: + /* So signatures don't produce error messages. (bug? I dunno...) */ + if (mode != M_EMAIL) printf(curr_lang[39], command, mode_str(mode)); + break; + } + + if (av) argvfree(av); + if (mode == M_INTERACTIVE) free(command); + d1fprintf(stdout, "show_output is %d\n", show_output); fflush(ofp); + if (show_output) display(ofp, stdout); + set_alarm(); + } +} + + +static int compress_it(ac, av) + int ac; + char **av; +{ + char **argv; + int argc; + + if (ac != 1) + { + printf(curr_lang[315], av[0]); + return 0; + } + + argvify("set compress compress", &argc, &argv); + set_it(argc, argv); + argvfree(argv); + return 1; +} + + +/* + * Scale our priority into the range of Prospero's, keeping in mind that + * ARDP_MAX_PRI is the _lowest_ priority, while ARDP_MIN_PRI is the + * _highest_. + */ +static int cvt_priority(our_pri) + int our_pri; +{ + float pri; + + if (our_pri > PRI_HIGH) our_pri = PRI_HIGH; + else if (our_pri < PRI_LOW) our_pri = PRI_LOW; + + pri = (float)(our_pri - PRI_LOW) / (PRI_HIGH - PRI_LOW); + return (int)(-pri * (ARDP_MAX_PRI - ARDP_MIN_PRI) + ARDP_MAX_PRI); +} + + +/* + * Create and unlink a temporary file for output (mail and paging). + * + * In email mode redirect stdout and stderr to it. + */ +static FILE *create_tmp_file(email) + int email; +{ + FILE *fp; + char *f; + int fd; + + if ( ! (f = tempnam(get_var(V_TMPDIR), (char *)0))) + { + error(A_SYSERR, "create_tmp_file", "can't create tmp file"); /* FFF */ + return 0; + } + + /* + * I suspect SunOS (4.1.3 at least) doesn't handle append mode correctly + * in the presence of multiple processes. + */ + if ((fd = open(f, O_RDWR | O_APPEND | O_CREAT | O_EXCL, 0600)) == -1) + { + fp = 0; + error(A_SYSERR, "create_tmp_file", "can't open `%s'", f); + } + else if ( ! (fp = fdopen(fd, "a+"))) + { + fp = 0; + error(A_ERR, "create_tmp_file", "can't fdopen() fd %d (`%s').", fd, f); + } + else if (email) + { + /* bug? legal? portable? */ + fflush(stdout); + fflush(stderr); + dup2(fd, fileno(stdout)); + dup2(fd, fileno(stderr)); + + /* + * bug: an alternative to this is to put flushes in fork_me(). + */ + setvbuf(fp, (char *)0, _IOLBF, 0); /* so output doesn't get mixed */ + setvbuf(stdout, (char *)0, _IOLBF, 0); + setvbuf(stderr, (char *)0, _IOLBF, 0); + } + + d1fprintf(stderr, "%s: create_tmp_file: unlink()ing `%s'.\n", prog, f); + unlink(f); + free(f); + return fp; +} + + +static int disable_command(ac, av) + int ac; + char **av; +{ + if (ac < 2) + { + error(A_ERR, curr_lang[40], curr_lang[41], av[0]); + return 0; + } + else + { + while (av++, --ac) + { + cmd_disable(av[0]); + } + } + return 1; +} + + +/* + * Print the Prospero `message of the day' for the current server. + */ +static int do_motd(ac, av, ofp) + int ac; + char **av; + FILE *ofp; +{ + int ret = 0; + + if (ac > 1) + { + printf(curr_lang[315], av[0]); + } + else + { + char *motd; + + if ( ! (motd = get_var(V_MOTD_FILE))) + { + ret = 1; /* succeed if there's no MOTD to print */ + } + else + { + mode_truncate_fp(ofp); + ret = fprint_file(ofp, motd, 1); + } + } + +#if 1 + return 0; /* return value indicates whether we should print the output of command? */ +#else + return ret; +#endif +} + + +#ifdef MULTIPLE_COLLECTIONS +/* + * in db1 [[db2 ...] find str1 [str2 ...]] + */ +static int in_it(ac, av, ofp) + int ac; + char **av; + FILE *ofp; +{ + int pos; + + if (ac < 2) + { + printf(curr_lang[317], av[0]); + return 0; + } + else if ((pos = argvFindStrCase(ac, av, 1, ac-1, "find")) < 0) /*bug: french*/ + { + char *s = argvflatten(ac, av, 1); + int rv = set_var(V_COLLECTIONS, s); + free(s); + return rv; + } + else + { + if (pos == 1) /* error: no databases specified */ + { + printf("# One or more databases must be specified.\n"); /*FFF*/ + return 0; + } + else if (pos == ac - 1) /* error: no search strings */ + { + printf("# One or more search strings must be specified.\n"); /*FFF*/ + return 0; + } + else + { + char **dbs = &av[1]; + char **srchs = &av[pos+1]; + int ndbs = pos - 1; + int nsrchs = ac - pos - 1; + + /* check for anonymous ftp */ + if (argvFindStrCase(ac, av, 1, pos-1, "anonftp") > 0) /*bug: french*/ + { + /* only "anonftp" specified? */ + if (ndbs > 1) + { + printf("# If `%s' is specified, no other databases may appear in the list.\n", + "anonftp"); /*FFF*/ + return 0; + } + else + { + return anonftp_find(nsrchs+1, &av[pos], ofp); + } + } + else /* do a generic search */ + { + int maxhdrs = atoi(get_var(V_MAXHITS)); + int maxdocs = 5; + + return generic_find(maxhdrs, maxdocs, ndbs, dbs, nsrchs, srchs, ofp); + } + } + } +} +#endif + + +static int init_from_file(rcfile, ofp, mode) + const char *rcfile; + FILE *ofp; + int mode; +{ + FILE *rcfp; + + ptr_check(rcfile, const char, curr_lang[43], 0); + + if ( ! (rcfp = fopen(rcfile, curr_lang[44]))) + { + return 0; + } + else + { + command_loop(rcfp, ofp, mode); + fclose(rcfp); + return 1; + } +} + + +static int man_it(ac, av, ofp) + int ac; + char **av; + FILE *ofp; +{ + int ret = 0; + + ptr_check(av, char *, curr_lang[45], 0); + ptr_check(ofp, FILE, curr_lang[45], 0); + + if (ac > 2) + { + printf(curr_lang[156], av[0]); + return 0; + } + + mode_truncate_fp(ofp); + switch (fork_me(0, &ret)) + { + case (enum forkme_e)INTERNAL_ERROR: + break; + + case CHILD: + { + const char *man = get_var(V_MAN_ASCII_FILE); + + if (ac == 2 && strstr(av[1], curr_lang[47])) + { + man = get_var(V_MAN_ROFF_FILE); + } + ret = fprint_file(ofp, man, 0); + } + fork_return(ret); + break; + + case PARENT: + set_alarm(); + break; + + default: + error(A_INTERR, curr_lang[45], curr_lang[48]); + break; + } + + return ret; +} + + +static int set_path(ac, av) + int ac; + char **av; +{ + if (ac < 2) + { + printf(curr_lang[203], av[0]); + return 0; + } + else + { + char *maddr; + int rv; + + maddr = argvflatten(ac, av, 1); + if ( ! maddr) + { + printf(curr_lang[319]); + rv = 0; + } + else + { + rv = set_var(V_MAILTO, maddr); + free(maddr); + } + return rv; + } +} + +static void display(ifp, ofp) + FILE *ifp; + FILE *ofp; +{ + if (current_mode() != M_EMAIL) + { + int ostyle; + + strtoval(get_var(V_OUTPUT_FORMAT), &ostyle, style_list); + if (ostyle != SILENT) + { + if (is_set(V_PAGER)) + { + pager_fp(ifp); + } + else + { + fprint_fp(ofp, ifp); + } + } + } +} + + +static int list_servers(ac, av, ofp) + int ac; + char **av; + FILE *ofp; +{ + const char *slist; + + mode_truncate_fp(ofp); + if ((slist = get_var(V_SERVERS_FILE))) + { + return fprint_file(ofp, slist, 0); + } + else + { + printf(curr_lang[63]); + return 0; + } +} + + +static void usage() +{ + fprintf(stderr, curr_lang[64], prog); + exit(1); +} diff --git a/archie/clients/telnet/archie.h b/archie/clients/telnet/archie.h new file mode 100644 index 0000000..0f11f79 --- /dev/null +++ b/archie/clients/telnet/archie.h @@ -0,0 +1,21 @@ +#ifndef ARCHIE_H +#define ARCHIE_H + +#include "ansi_compat.h" +#include "client_defs.h" + +/* + File paths. +*/ + +#define INTRO_FILE ".archie-motd" /* archie's motd */ + +/* + Miscellaneous defines. +*/ + +#define CR '\015' /* carriage return */ +#define DFLT_TERM_TYPE "dumb" /* default terminal type */ +#define NICE_VAL 10 /* run at this nice value */ + +#endif diff --git a/archie/clients/telnet/argv.c b/archie/clients/telnet/argv.c new file mode 100644 index 0000000..afb4214 --- /dev/null +++ b/archie/clients/telnet/argv.c @@ -0,0 +1,369 @@ +#include +#ifdef AIX +#include +#endif +#include +#include "error.h" +#include "extern.h" +#include "lang.h" +#include "macros.h" +#include "misc_ansi_defs.h" +#include "rmem.h" + +#include "protos.h" + +typedef enum +{ + AV_OUT_STR, + AV_IN_STR, + AV_IN_QUOTE, + AV_Q_IN_STR, + AV_Q_IN_QUOTE, + AV_DONE, + AV_ERROR +} State; + + +/* + * + * Internal routines + * + */ + +#define INIT_ARGV_ELTS 16 +#define INIT_STR_ELTS 32 + + +static char **end_current_str PROTO((char *s, char **av)); +static char **init_argv PROTO((void)); +static char *insert_char PROTO((int c, char *s)); +static char *new_str PROTO((void)); + + +static char *insert_char(c, s) + int c; + char *s; +{ + char ch = c; + char *ts = rappend(s, &ch, char); + + if (ts) return ts; + else + { + rfree(s); + return (char *)0; + } +} + + +static char **end_current_str(s, av) + char *s; + char **av; +{ + char *ts = insert_char('\0', s); + + if (ts) return (char **)rappend(av, &ts, char *); + else + { + rfree(s); + return (char **)0; + } +} + + +static char **init_argv() +{ + char **av; + + if ((av = rmalloc(INIT_ARGV_ELTS, char *))) + { + av[0] = (char *)0; + return (char **)av; + } + else + { + error(A_SYSERR, curr_lang[65]); + return (char **)0; + } +} + + +static char *new_str() +{ + char *s = rmalloc(INIT_STR_ELTS, char); + + if (s) return s; + else + { + error(A_SYSERR, curr_lang[66], curr_lang[67], INIT_STR_ELTS); + return (char *)0; + } +} + + +/* + * + * External routines + * + */ + + +/*bug: generic argvFindStrCmp()*/ +int argvFindStrCase(ac, av, start, end, str) + int ac; + char **av; + int start; + int end; + const char *str; +{ + int i; + + for (i = start; i <= end && i < ac; i++) + { + if (strcasecmp(av[i], str) == 0) return i; + } + return -1; +} + + +/*bug: start > ac or all args empty could cause problems */ +char *argvFlattenSep(ac, av, start, end, sep) + int ac; + char **av; + int start; + int end; + const char *sep; +{ + char *t = (char *)0; + int i; + int len = 0; + int seplen = strlen(sep); + + ptr_check(av, char *, curr_lang[68], (char *)0); + + for (i = start; i <= end && i < ac; i++) + { + len += strlen(av[i]) + seplen; + } + if ( ! (t = malloc((unsigned)(len + 1)))) /*bug? +1 for nul of final strcat */ + { + error(A_SYSERR, curr_lang[68], curr_lang[69], len); + return (char *)0; + } + else + { + t[0] = '\0'; + for (i = start; i <= end && i < ac; i++) + { + strcat(t, av[i]); + strcat(t, sep); + } + t[len - 1] = '\0'; + return (char *)t; + } +} + + +int argvReplaceStr(ac, av, idx, newstr) + int ac; + char **av; + int idx; + const char *newstr; +{ + char *s; + + if (idx >= ac) return 0; + + s = rmalloc((unsigned)strlen(newstr) + 1, char); + if ( ! s) + { + return 0; + } + else + { + strcpy(s, newstr); + rfree(av[idx]); + av[idx] = s; + return 1; + } +} + + +/*bug: start > ac or all args empty could cause problems */ +char *argvflatten(ac, av, start) + int ac; + char **av; + int start; +{ + return argvFlattenSep(ac, av, start, ac, " "); +} + + +void argvfree(av) + char **av; +{ + int i; + + for(i = 0; i <= last_index(av); i++) + { + rfree(av[i]); + av[i] = (char *)0; + } + rfree(av); +} + + +#define try(x, t, v, e) \ +do { if ((t = (e))) { v = t; } else { error(A_ERR, curr_lang[70], curr_lang[71], x); state = ERROR; } } while (0) + + +int argvify(str, argc, argv) + const char *str; + int *argc; + char ***argv; +{ + State state = AV_OUT_STR; + const char *p; + char *ts; + char *s = (char *)0; + char **av; + char **tav; + int done = 0; + + ptr_check(str, const char, curr_lang[70], 0); + ptr_check(argc, int, curr_lang[70], 0); + ptr_check(argv, char **, curr_lang[70], 0); + + *argc = 0; + *argv = (char **)0; + try(curr_lang[72], tav, av, init_argv()); + p = str; + while ( ! done) + { + switch (state) + { + case AV_OUT_STR: + switch (*p) + { + case ' ': + case '\t': + break; + + case '\\': + state = AV_Q_IN_STR; + try(curr_lang[73], ts, s, new_str()); + break; + + case '"': + state = AV_IN_QUOTE; + try(curr_lang[73], ts, s, new_str()); + break; + + case '\0': + state = AV_DONE; + break; + + default: + state = AV_IN_STR; + try(curr_lang[73], ts, s, new_str()); + try(curr_lang[74], ts, s, insert_char(*p, s)); + break; + } + break; + + case AV_IN_STR: + switch (*p) + { + case ' ': + case '\t': + state = AV_OUT_STR; + try(curr_lang[75], tav, av, end_current_str(s, av)); + break; + + case '\\': + state = AV_Q_IN_STR; + break; + + case '"': + state = AV_IN_QUOTE; + break; + + case '\0': + state = AV_DONE; + try(curr_lang[75], tav, av, end_current_str(s, av)); + break; + + default: + state = AV_IN_STR; + try(curr_lang[74], ts, s, insert_char(*p, s)); + break; + } + break; + + case AV_IN_QUOTE: + switch (*p) + { + case '\\': + state = AV_Q_IN_QUOTE; + break; + + case '"': + state = AV_IN_STR; + break; + + case '\0': + state = AV_ERROR; + break; + + default: + state = AV_IN_QUOTE; + try(curr_lang[74], ts, s, insert_char(*p, s)); + break; + } + break; + + case AV_Q_IN_STR: + if ( ! *p) state = AV_ERROR; + else + { + state = AV_IN_STR; + try(curr_lang[74], ts, s, insert_char(*p, s)); + } + break; + + case AV_Q_IN_QUOTE: + if ( ! *p) state = AV_ERROR; + else + { + state = AV_IN_QUOTE; + try(curr_lang[74], ts, s, insert_char(*p, s)); + } + break; + + case AV_DONE: + case AV_ERROR: + default: + done = 1; + break; + } + + p++; + } + + switch (state) + { + case AV_DONE: + *argv = av; + *argc = last_index(av) + 1; + return 1; + + case AV_ERROR: + if (s) rfree(s); + argvfree(av); + return 0; + + default: + error(A_INTERR, curr_lang[70], curr_lang[76], (int)state); + return 0; + } +} diff --git a/archie/clients/telnet/argv.h b/archie/clients/telnet/argv.h new file mode 100644 index 0000000..0c68d89 --- /dev/null +++ b/archie/clients/telnet/argv.h @@ -0,0 +1,14 @@ +#ifndef ARG_H +#define ARG_H + +#include "ansi_compat.h" + + +extern char *argvFlattenSep PROTO((int ac, char **av, int start, int end, const char *sep)); +extern char *argvflatten PROTO((int ac, char **av, int start)); +extern int argvFindStrCase(int ac, char **av, int start, int end, const char *str); +extern int argvReplaceStr(int ac, char **av, int idx, const char *newstr); +extern int argvify PROTO((const char *str, int *ac, char ***av)); +extern void argvfree PROTO((char **av)); + +#endif diff --git a/archie/clients/telnet/aslip b/archie/clients/telnet/aslip new file mode 100755 index 0000000..dfe5f8d --- /dev/null +++ b/archie/clients/telnet/aslip @@ -0,0 +1,12 @@ +#!/bin/csh +set DBIN=~archie/bin +set T=telnet-client +set tc=$DBIN/$T +set otc=$DBIN/$T- +set ntc=$DBIN/$T+ + +if ( -f $T ) then + cp $tc $ntc && cp $T $ntc && rm -f $otc && ln $tc $otc && mv $ntc $tc +else + echo "Error: $T not in current directory" +endif diff --git a/archie/clients/telnet/client_defs.h b/archie/clients/telnet/client_defs.h new file mode 100644 index 0000000..99f85d0 --- /dev/null +++ b/archie/clients/telnet/client_defs.h @@ -0,0 +1,17 @@ +#ifndef CLIENT_DEFS_H +#define CLIENT_DEFS_H + +#define COMMENT_CHAR '#' + +/* + Array lengths. +*/ + +#define COMMAND_LEN 128 /* maximum length of a user's command */ +#define DATE_STR_LEN 30 /* room to hold a string containing the date */ +#define ERR_STR_LEN 128 /* enough room to hold an error message */ +#define INPUT_LINE_LEN 256 /* length of line from generic input file */ +#define REG_EX_LEN 128 /* space for regular expression string */ +#define TC_ENT_LEN 1024 /* space to hold a termcap entry */ + +#endif diff --git a/archie/clients/telnet/client_structs.h b/archie/clients/telnet/client_structs.h new file mode 100644 index 0000000..68d95de --- /dev/null +++ b/archie/clients/telnet/client_structs.h @@ -0,0 +1,58 @@ +#include +#include +#include +#include + +typedef struct +{ + short year; + short month; + short day; + short hour; + short min; +} +datestruct; + +typedef unsigned long db_date; +typedef unsigned int size_type; +typedef unsigned int parenti_type; +typedef unsigned int fchildi_type; +typedef unsigned short perms_type; + +struct site_entry +{ + size_type size; /* Size of file */ + parenti_type parent_ind; /* Record number of parent */ + fchildi_type first_child_ind; /* Record number of first child */ + db_date mod_time; /* Modification time */ + union + { + long strings_ind; /* Index of name */ + struct in_addr ipaddress; /* or site IP addr (root rec) */ + } in_or_addr; + perms_type perms; /* File permissions */ + char dir_or_f; /* Directory or file flag */ + +}; + +struct file_entry +{ + struct in_addr site_addr; /* stored as 32bit IP address */ + int site_ind; /* record index within the file */ + int next_ind; /* pointer to next entry in chain */ +}; + +typedef struct site_entry site_rec; +typedef struct file_entry file_rec; + +struct globals_db_t +{ + int site_recno; + int next_file_recnum; + int file_begin; + int file_recno; +#ifdef DO_NOT_COMPILE + site_rec *site_begin; + int site_size; +#endif +}; diff --git a/archie/clients/telnet/commands.c b/archie/clients/telnet/commands.c new file mode 100644 index 0000000..68d1a18 --- /dev/null +++ b/archie/clients/telnet/commands.c @@ -0,0 +1,138 @@ +#include +#include "argv.h" +#include "client_defs.h" +#include "commands.h" +#include "commands_lang.h" +#include "extern.h" +#include "defines.h" +#include "error.h" +#include "input.h" +#include "lang.h" +#include "macros.h" +#include "misc.h" +#include "misc_ansi_defs.h" +#include "strmap.h" +#include "vars_lang.h" + +#include "protos.h" + +static Command *find_cmd PROTO((const char *cmd, + const char *(*cmp) PROTO((const char *s, const StrMap *map)))); +static Command *really_find_cmd PROTO((const char *cmd)); + + +static Command *find_cmd(cmd, cmp) + const char *cmd; + const char *(*cmp) PROTO((const char *s, const StrMap *map)); +{ + Command *c = commands; + Command *cmd_is = (Command *)0; + + if (cmd[0] == COMMENT_CHAR) + { + return &commands[COMMENT]; + } + + while ( ! mapEmpty(c->cmd_string)) + { + if (cmp(cmd, c->cmd_string)) /*bug: requires full command name*/ + { + if (cmd_is) + { + return &commands[NON_UNIQUE]; + } + else + { + cmd_is = c; + } + } + c++; + } + + return cmd_is ? cmd_is : &commands[BAD]; +} + + +static Command *really_find_cmd(cmd) + const char *cmd; +{ + Command *c; + + if (strcmp(curr_lang[307], get_var(V_LANGUAGE)) != 0) /*bug: kludge!!!*/ + { + c = find_cmd(cmd, mapNCaseStrTo); + if (c->cmd_code != BAD) return c; + } + + return find_cmd(cmd, mapNCaseStrFrom); +} + + +int cmd_disable(cmd) + const char *cmd; +{ + Command *c = really_find_cmd(cmd); + + if (c->cmd_code == BAD || c->cmd_code == NON_UNIQUE) + { + error(A_ERR, curr_lang[77], curr_lang[78], cmd, mapFirstStr(c->cmd_string)); + return 0; + } + else + { + c->mode = M_NONE; + return 1; + } +} + + +/* + * Determine which command the user has entered. It is insensitive to the + * case of the command. + */ + +enum cmd_e get_cmd(line, ac, av, modes) + const char *line; + int *ac; + char ***av; + int *modes; +{ + Command *cmd; + const char *end; + const char *start = line; + + ptr_check(line, const char, curr_lang[79], (enum cmd_e)INTERNAL_ERROR); + ptr_check(ac, int, curr_lang[79], (enum cmd_e)INTERNAL_ERROR); + ptr_check(av, char **, curr_lang[79], (enum cmd_e)INTERNAL_ERROR); + ptr_check(modes, int, curr_lang[79], (enum cmd_e)INTERNAL_ERROR); + + *ac = 0; + *av = (char **)0; + bracketstr(line, &start, &end); + + if ( ! *start) + { + *modes = commands[EMPTY].mode; + return EMPTY; + } + else if (*start == COMMENT_CHAR) + { + /* + Comments are a special case, since there needn't be a space after + the initial character. + */ + + *modes = commands[COMMENT].mode; + return COMMENT; + } + else if ( ! argvify(line, ac, av)) + { + return INTERNAL_ERROR; + } + else + { + cmd = really_find_cmd((*av)[0]); + *modes = cmd->mode; + return cmd->cmd_code; + } +} diff --git a/archie/clients/telnet/commands.h b/archie/clients/telnet/commands.h new file mode 100644 index 0000000..c3b1e79 --- /dev/null +++ b/archie/clients/telnet/commands.h @@ -0,0 +1,67 @@ +#ifndef COMMANDS_H +#define COMMANDS_H + +#include "ansi_compat.h" +#include "defines.h" +#include "mode.h" +#include "strmap.h" + + +#define ENDCMD {(const char *)0, (const char *)0} + + +/* + Numeric values for commands that archie knows about. +*/ + +enum cmd_e +{ + BAD = 0, /* special: unrecognized command */ + BYE, /* alias for "quit" */ + COMMENT, /* # comment */ + COMPRESS, /* same as `set compress compress' */ + DISABLE, + DOMAINS, /* get domains */ + DONE, + EMPTY, /* special: empty line was entered */ + EXIT, /* alias for "quit" */ + FIND, + HELP, + IN, + LIST, + MAIL, + MANPAGE, + MOTD, + NON_UNIQUE, /* special: command abbreviation is not unique */ + NOPAGER, /* same as `unset pager' */ + PAGER, /* same as `set pager' */ + PATH, + PROG, + QUIT, + SERVERS, + SET, + SHOW, + SITE, + STTY, + TERM, /* same as `set term' */ + UNSET, + VERSION, + WHATIS +}; + +typedef struct +{ + enum cmd_e cmd_code; + int mode; + StrMap cmd_string[2]; + const char *cmd_help; +} Command; + +extern int cmd_disable PROTO((const char *cmd)); +extern enum cmd_e get_cmd PROTO((const char *line, int *argc, char ***argv, int *modes)); + +#ifndef AIX +extern Command commands[]; +#endif + +#endif diff --git a/archie/clients/telnet/commands_lang.h b/archie/clients/telnet/commands_lang.h new file mode 100644 index 0000000..fd8c3d8 --- /dev/null +++ b/archie/clients/telnet/commands_lang.h @@ -0,0 +1,261 @@ +#include "macros.h" + + +/* + * Note: + * + * COMMENT is handled in `get_cmd' since it needn't be followed by a space. + */ + +static Command commands[] = +{ + { + BAD, M_ALL, + { + {"bad command", FRENCH("commande incorrecte")}, + ENDCMD + }, + "" + }, + { + BYE, M_ALL, + { + {"bye", FRENCH("au_revoir")}, + ENDCMD + }, + "- exit this program." + }, + { + COMMENT, M_ALL, + { + {"#"}, + ENDCMD + }, + "- uninterpreted comment" + }, + { + COMPRESS, M_ALL, + { + {"compress", FRENCH("condenser")}, + ENDCMD + }, + "- same as `set compress compress'" + }, + { + DISABLE, M_SYS_RC, + { + {"disable_command", FRENCH("desactiver_commande")}, + ENDCMD + }, + " ..." + }, + { + DOMAINS, M_ALL, + { + {"domains", FRENCH("domaines")}, + ENDCMD + }, + "- get domains supported by server" + }, + { + DONE, M_HELP, + { + {"done", FRENCH("fin")}, + ENDCMD + }, + "used to exit help system" + }, + { + EMPTY, M_ALL, + { + {""}, + ENDCMD + }, + "" + }, + { + EXIT, M_ALL, + { + {"exit", FRENCH("sortir")}, + ENDCMD + }, + "- exit this program." + }, + { + FIND, M_EMAIL | M_INTERACTIVE, + { + {"find", FRENCH("chercher")}, + ENDCMD + }, + " - print all files matching the ed(1) regular expression from all sites." + }, + { + HELP, M_EMAIL | M_INTERACTIVE, + { + {"help", FRENCH("aide")}, + ENDCMD + }, + "- print this extremely informative list." + }, + { + IN, M_EMAIL | M_INTERACTIVE, + { + {"in", FRENCH("dans")}, + ENDCMD + }, + "- select a collection" + }, + { + LIST, M_EMAIL | M_INTERACTIVE, + { + {"list", FRENCH("lister")}, + ENDCMD + }, + "[] - list sites in the database" + }, + { + MAIL, M_EMAIL | M_INTERACTIVE, + { + {"mail", FRENCH("poster")}, + ENDCMD + }, + "[] - mail last output to address." + }, + { + MANPAGE, M_EMAIL | M_INTERACTIVE, + { + {"manpage", FRENCH("manuel")}, + ENDCMD + }, + "- print the current archie manual page" + }, + { + MOTD, M_ALL, + { + {"motd"}, + ENDCMD + }, + "- print out login banner message" + }, + { + NON_UNIQUE, M_ALL, + { + {"non-unique command", FRENCH("commande ambigue")}, + ENDCMD + }, + "" + }, + { + NOPAGER, M_ALL, + { + {"nopager", FRENCH("pas_paginer")}, + ENDCMD + }, + "- undoes the effect of \"pager\"." + }, + { + PAGER, M_SYS_RC | M_INTERACTIVE | M_USER_RC, + { + {"pager", FRENCH("paginer")}, + ENDCMD + }, + "- output of \"prog\" and \"site\" is sent through the pager 'less'." + }, + { + PATH, M_EMAIL, + { + {"path", FRENCH("chemin")}, + ENDCMD + }, + " - set the e-mail address to which to mail results." + }, + { + PROG, M_EMAIL | M_INTERACTIVE, + { + {"prog"}, + ENDCMD + }, + " - alias for 'find'." + }, + { + QUIT, M_ALL, + { + {"quit", FRENCH("quitter")}, + ENDCMD + }, + "- exit this program." + }, + { + SERVERS, M_ALL, + { + {"servers", FRENCH("serveurs")}, + ENDCMD + }, + "- list valid archie servers" + }, + { + SET, M_ALL, + { + {"set", FRENCH("fixer")}, + ENDCMD + }, + " [] - set a variable to an optional value." + }, + { + SHOW, M_ALL, + { + {"show", FRENCH("afficher")}, + ENDCMD + }, + " - display the value of a variable." + }, + { + SITE, M_NONE, + { + {"site"}, + ENDCMD + }, + " - print a list of all files at site ." + }, + { + STTY, M_SYS_RC | M_INTERACTIVE | M_USER_RC, + { + {"stty"}, + ENDCMD + }, + " [ ] ... - set options controlling the terminal." + }, + { + TERM, M_ALL, + { + {"term"}, + ENDCMD + }, + " [<#rows> [<#cols>]] - tell the pager about your terminal." + }, + { + UNSET, M_ALL, + { + {"unset", FRENCH("unset")}, + ENDCMD + }, + "- unset a variable" + }, + { + VERSION, M_ALL, + { + {"version", FRENCH("version")}, + ENDCMD + }, + "- print the version number of the software" + }, + { + WHATIS, M_EMAIL | M_INTERACTIVE, + { + {"whatis", FRENCH("apropos")}, + ENDCMD + }, + "" + }, + { (enum cmd_e) 0, M_NONE, ENDCMD, (char *)0} +}; diff --git a/archie/clients/telnet/debug.c b/archie/clients/telnet/debug.c new file mode 100644 index 0000000..db72f97 --- /dev/null +++ b/archie/clients/telnet/debug.c @@ -0,0 +1,40 @@ +#ifdef __STDC__ +#include +#endif +#include "debug.h" +#include "extern.h" +#include "prosp.h" + +#include "protos.h" + +static int debug_level; + + +int dlev() +{ + return debug_level; +} + + +int set_debug(v) + const char *v; +{ + debug_level = atoi(v); + pfs_debug = debug_level; + return 1; +} + + +int unset_debug() +{ + debug_level = 0; + return 1; +} + + +void uids(s) + const char *s; +{ + fprintf(stderr, "%s: %seuid: %ld, ruid: %ld -- egid: %ld, rgid: %ld.\n", + prog, s ? s : "", (long)geteuid(), (long)getuid(), (long)getegid(), (long)getgid()); +} diff --git a/archie/clients/telnet/debug.h b/archie/clients/telnet/debug.h new file mode 100644 index 0000000..cd63661 --- /dev/null +++ b/archie/clients/telnet/debug.h @@ -0,0 +1,33 @@ +#ifndef DEBUG_H +#define DEBUG_H + +#include "ansi_compat.h" +#include "prosp.h" + + +#ifdef DEBUG +# define DBG(cmds) do { cmds } while (0) +#else +# define DBG(cmds) +#endif + + +#define d0fprintf if (dlev() >= 0) fprintf +#define d1fprintf if (dlev() >= 1) fprintf +#define d2fprintf if (dlev() >= 2) fprintf +#define d3fprintf if (dlev() >= 3) fprintf +#define d4fprintf if (dlev() >= 4) fprintf +#define d5fprintf if (dlev() >= 5) fprintf +#define d6fprintf if (dlev() >= 6) fprintf +#define d7fprintf if (dlev() >= 7) fprintf +#define d8fprintf if (dlev() >= 8) fprintf +#define d9fprintf if (dlev() >= 9) fprintf + + +extern int dlev PROTO((void)); +extern int set_debug PROTO((const char *v)); +extern int unset_debug PROTO((void)); +extern void fprint_vlink PROTO((FILE *fp, VLINK v)); +extern void uids PROTO((const char *s)); + +#endif diff --git a/archie/clients/telnet/domains.c b/archie/clients/telnet/domains.c new file mode 100644 index 0000000..4703bba --- /dev/null +++ b/archie/clients/telnet/domains.c @@ -0,0 +1,180 @@ +#include +#include +#include "alarm.h" +#include "ansi_compat.h" +#include "archie.h" +#include "client_defs.h" +#include "defines.h" +#include "error.h" +#include "extern.h" +#include "fork_wait.h" +#include "lang.h" +#include "list.h" +#include "macros.h" +#include "misc.h" +#include "misc_ansi_defs.h" +#include "mode.h" +#include "pager.h" +#include "prosp.h" +#include "signals.h" +#include "style_lang.h" +#include "vars.h" + +#include "protos.h" + +/* + * + * + * Internal routines. + * + * + */ + + +static int do_domains PROTO((FILE *ofp, int prt_status)); +static int fprint_domains_item PROTO((FILE *ofp, VLINK item, int style)); + + +/* + verbose + binkley.cs.mcgill.ca 132.206.51.9 02:13 10 Jan 1993 +*/ + +static int fprint_domains_item(ofp, item, style) + FILE *ofp; + VLINK item; + int style; +{ + char hostname[128]; + + ptr_check(ofp, FILE, curr_lang[108], 0); + if ( ! item) + { + error(A_INTERR, curr_lang[108], curr_lang[147]); + return 0; + } + + switch (style) + { + case MACHINE: + fprintf(ofp, curr_lang[148], hostname, attr_str(item, curr_lang[101])); + break; + + case TERSE: /*bug: unfinished*/ + fprintf(ofp, "%-40s %s\n", item -> lattrib -> value.sequence -> next -> next -> token, + item -> lattrib -> value.sequence -> token); + break; + + case SILENT: + case VERBOSE: /*bug: unfinished*/ + fprintf(ofp, "%-15s %-20s %s\n", item -> lattrib -> value.sequence -> token, + item -> lattrib -> value.sequence -> next -> next -> token, + item -> lattrib -> value.sequence -> next -> token); + + + break; + + default: + error(A_INTERR, curr_lang[150], curr_lang[109], style); + return 0; + } + return 1; +} + + +/* + * Do sorting by attribute other than site name (which the server does, + * anyway)? + * + * Return 0 if no results were produced. + */ +static int do_domains(ofp, prt_status) + FILE *ofp; + int prt_status; +{ + int ret = 0; + struct aquery arq; + + aq_init(&arq); + arq.host = get_var(V_SERVER); + arq.query_type = AQ_DOMAINS; + arq.flags = AQ_NOSORT; + + if (archie_query(&arq, prt_status) != PSUCCESS) + { + perrmesg((char *)0, 0, (char *)0); + } + else + { + VLINK r = arq.results; + int ostyle = TERSE; + + if ( ! r) /*bug: check no matches => r == 0*/ + { + puts(curr_lang[115]); /*bug? new remark?*/ + } + else + { + strtoval(get_var(V_OUTPUT_FORMAT), &ostyle, style_list); + + fputs("\nDomains supported by this server:\n\n", ofp); /*FFF*/ + for (; r; r = r->next) + { + fprint_domains_item(ofp, r, ostyle); + } + + ret = 1; + /* bug: should free up VLINK structs here? */ + vllfree(arq.results); + } + } + + return ret; +} + + + +/* + * + * + * External routines. + * + * + */ + + +/* + * Return 0 if no output was produced, else non-zero. + */ +int domains_it(ac, av, ofp) + int ac; + char **av; + FILE *ofp; +{ + int ret; + + ptr_check(av, char *, curr_lang[152], 0); + ptr_check(ofp, FILE, curr_lang[152], 0); + + mode_truncate_fp(ofp); + switch (fork_me(spin(), &ret)) + { + case (enum forkme_e)INTERNAL_ERROR: + return 0; + + case CHILD: + ret = do_domains(ofp, spin()); + fork_return(ret); + break; + + case PARENT: + set_alarm(); + break; + + default: + error(A_INTERR, curr_lang[152], curr_lang[48]); + return 0; + } + + return ret; +} diff --git a/archie/clients/telnet/domains.h b/archie/clients/telnet/domains.h new file mode 100644 index 0000000..dfe2b7e --- /dev/null +++ b/archie/clients/telnet/domains.h @@ -0,0 +1,10 @@ +#ifndef DOMAINS_H +#define DOMAINS_H + +#include +#include "ansi_compat.h" + + +int domains_it PROTO((int ac, char **av, FILE *ofp)); + +#endif diff --git a/archie/clients/telnet/english-language-strings.c b/archie/clients/telnet/english-language-strings.c new file mode 100644 index 0000000..bd72c96 --- /dev/null +++ b/archie/clients/telnet/english-language-strings.c @@ -0,0 +1,412 @@ +#include "ansi_compat.h" + + +const char *english[] = +{ + +/* ==================== alarm.c ==================== */ + + /* 0 */ "", /* avail */ + /* 1 */ "get_var() returned a null pointer.", + +/* ==================== archie.c ==================== */ + + /* 2 */ "", /* avail */ + /* 3 */ "", /* avail */ + /* 4 */ "", /* avail */ + /* 5 */ "main", + /* 6 */ "unexpected argument `%s'.", + /* 7 */ "argument required after `%s'.", + /* 8 */ "can't run in both e-mail and server modes.", + /* 9 */ "`-e' option requires `-o'.", + /* 10 */ "w+", + /* 11 */ "can't open e-mail output file `%s' with mode \"w+\"", + /* 12 */ "can't freopen() `%s' onto stdout", + /* 13 */ "can't freopen() `%s' onto stderr", + /* 14 */ "", /* avail */ + /* 15 */ "", /* avail */ + /* 16 */ "", /* avail */ + /* 17 */ "can't find home directory!", + /* 18 */ "can't chdir() to home directory, `%s'", + /* 19 */ ".", + /* 20 */ "can't chroot() to home directory", + /* 21 */ "setuid() failed", + /* 22 */ "%s/%s", + /* 23 */ "can't get new history context.", + /* 24 */ "# Version fran\347aise r\351alis\351e en collaboration avec le\n# Service des T\351l\351communications, Universit\351 du Qu\351bec \340 Montr\351al.\n\n", + /* 25 */ "stty", + /* 26 */ "# Bunyip Information Systems, Inc., 1993, 1994, 1995\n\n", + /* 27 */ "", + /* 28 */ "\n", + /* 29 */ "# Sorry, this command has been disabled by the administrator.\n", + /* 30 */ "# Wrong mode, `%s', for the `%s' command.\n", + /* 31 */ "\n>> %s\n", + /* 32 */ "help", + /* 33 */ "mail", + /* 34 */ "# Bye.\n", + /* 35 */ "# This command works only within the `help' subsystem.\n", + /* 36 */ "# Non-unique command prefix.\n", + /* 37 */ "# Sorry, the `site' command is currently unavailable.\n", + /* 38 */ "# %s\n", + /* 39 */ "# Unrecognized command `%s' in %s mode.\n", + /* 40 */ "disable_command", + /* 41 */ "`%s' requires at least one argument.", + /* 42 */ "# Pager failed; printing directly to the screen.\n", + /* 43 */ "init_from_file", + /* 44 */ "r", + /* 45 */ "man_it", + /* 46 */ "# `%s' requires a single argument.\n", + /* 47 */ "roff", + /* 48 */ "unknown return code from fork_me().", + /* 49 */ "whatis_it", + /* 50 */ "new_tmp_file", + /* 51 */ "error opening tmp file `%s'", + /* 52 */ "tempnam() failed.", + /* 53 */ "# `%s' requires at least one argument.\n", + /* 54 */ "# boolean variables do not take arguments.\n", + /* 55 */ "# `numeric' variables require a single argument.\n", + /* 56 */ "# `string' variables require an argument.\n", + /* 57 */ " ", + /* 58 */ "# `%s' is not a known variable.\n", + /* 59 */ "set_it", + /* 60 */ "unknown variable type `%d'.", + /* 61 */ "remove_tmp_file", + /* 62 */ "error unlinking `%s'", + /* 63 */ "# Sorry, I can't find a list of servers.\n", + /* 64 */ "Usage: %s [-d <#>] [-e] [-i ] [-l] [-L ] [-p <#>] [-s]\n", + +/* ==================== argv.c ==================== */ + + /* 65 */ "can't allocate initial pointer element", + /* 66 */ "new_str", + /* 67 */ "failed to rmalloc() `%d' bytes", + /* 68 */ "argvflatten", + /* 69 */ "error malloc()ing `%u' bytes", + /* 70 */ "argvify", + /* 71 */ "failed to %s.", + /* 72 */ "initialize argv", + /* 73 */ "start new string", + /* 74 */ "insert character", + /* 75 */ "end current string", + /* 76 */ "ended in bad state, `%d'.", + +/* ==================== commands.c ==================== */ + + /* 77 */ "cmd_disable", + /* 78 */ "`%s': %s", + /* 79 */ "get_cmd", + +/* ==================== error.c ==================== */ + + /* 80 */ "error: %s.\n", + /* 81 */ "ERROR", + /* 82 */ "INFO", + /* 83 */ "INTERNAL ERROR", + /* 84 */ "SYSTEM CALL ERROR", + /* 85 */ "WARNING", + /* 86 */ "# INTERNAL ERROR: error: unknown error type, %d.\n", + /* 87 */ "# %s: %s: %s", + /* 88 */ ": unlisted error", + /* 89 */ ": ", + /* 90 */ "%s %s\n", + /* 91 */ "/tmp/lll", + /* 92 */ "w", + +/* ==================== find.c ==================== */ + + /* 93 */ "DIRECTORY", + /* 94 */ "%s %s %s %s %s%s\n", + /* 95 */ "LAST-MODIFIED", + /* 96 */ "SIZE", + /* 97 */ "UNIX-MODES", + /* 98 */ "/", + /* 99 */ "%H:%M %e %h %Y", + /* 100 */ "%s %12s %7s %s%s\n", + /* 101 */ "AR_H_LAST_MOD", + /* 102 */ "Host %s (%s)\n", + /* 103 */ "AR_H_IP_ADDR", + /* 104 */ "Last updated %s\n", + /* 105 */ "\n Location: %s\n", + /* 106 */ " DIRECTORY %s %13s %12s %s\n", + /* 107 */ " FILE %s %13s %12s %s\n", + /* 108 */ "fprint_list_item", + /* 109 */ "unknown output style type `%d'.", + /* 110 */ "do_matches", + /* 111 */ "pager", + /* 112 */ "verbose", + /* 113 */ "terse", + /* 114 */ "machine", + /* 115 */ "\n# No matches were found.\n", + /* 116 */ "\n# Error from Prospero server - ", + /* 117 */ "find_it", + +/* ==================== fork_wait.c ==================== */ + + /* 118 */ "working... ", + /* 119 */ "# ERROR: fork_me: fork: ", + /* 120 */ "fork_me", + /* 121 */ "error waiting for child", + +/* ==================== get_types.c ==================== */ + + +/* ==================== help.c ==================== */ + + /* 122 */ "help%s> ", + /* 123 */ "%s/=", + /* 124 */ "display_help", + /* 125 */ "can't access() file `%s'", + /* 126 */ "list_subtopics", + /* 127 */ "can't open directory `%s'.", + /* 128 */ "# Subtopics:\n#\n", + /* 129 */ "#\t%s\n", + /* 130 */ "# No subtopics.\n", + /* 131 */ "pop_topic", + /* 132 */ "can't find a `/' in the current directory string.", + /* 133 */ "push_topics", + /* 134 */ "# Can't find help on `%s'.\n", + /* 135 */ "help_", + /* 136 */ "can't find help file; looking in wrong directory?", + /* 137 */ "?", + /* 138 */ "done", + /* 139 */ "Can't find the file with e-mail help information.", + /* 140 */ "error getting new history context.", + +/* ==================== input.c ==================== */ + + /* 141 */ ".\n", + /* 142 */ "readline", + /* 143 */ "can't malloc() `%d' bytes for a new line.", + /* 144 */ "error reading from `stdin'.", + /* 145 */ "unexpected return value from fread().", + /* 146 */ "error realloc()ing `%d' bytes for input line.", + +/* ==================== lang.c ==================== */ + + +/* ==================== list.c ==================== */ + + /* 147 */ "argument `item' is NULL.", + /* 148 */ "%s %s\n", + /* 149 */ "%-40s %15s %17s\n", + /* 150 */ "fprint_list_itme", + /* 151 */ ".*", + /* 152 */ "list_it", + +/* ==================== mail.c ==================== */ + + /* 153 */ "mail_it", + /* 154 */ "mailto", + /* 155 */ "# You must either specify an e-mail address or set the `mailto' variable.\n", + /* 156 */ "# `%s' takes no more than one argument.\n", + /* 157 */ "# You haven't got any results to mail yet.\n", + /* 158 */ "none", + /* 159 */ "# If you specify compression you must also specify an encoding.\n", + /* 160 */ "invalid port number `%s'.", + /* 161 */ "getservbyname() failed -- can't get port for `%s'.", + /* 162 */ "can't connect to mail host: `%s'.", + /* 163 */ "error fdopen()ing socket to the mail host.", + /* 164 */ "@Begin\n", + /* 165 */ "Command: %s\n", + /* 166 */ "Compress: %s\n", + /* 167 */ "Encode: %s\n", + /* 168 */ "MaxSplitSize: %d\n", + /* 169 */ "@MailHeader\n", + /* 170 */ "To: %s\n", + /* 171 */ "From: %s@%s\n", + /* 172 */ "Reply-To: %s@%s\n", + /* 173 */ "Date: %s\n", + /* 174 */ "@End\n", + /* 175 */ "fputs() is EOF, errno is %d.\n", + /* 176 */ "failed! errno = %d.\n", + /* 177 */ "ferror(mfp) is %d, feof(mfp) is %d.\n", + /* 178 */ "ferror(ofp) is %d, feof(ofp) is %d.\n", + +/* ==================== misc.c ==================== */ + + /* 179 */ "", + /* 180 */ "first_word_of", + /* 181 */ "dequote", + /* 182 */ "nuke_newline", + /* 183 */ "argument is NULL.", + /* 184 */ "Name: `%s', Value: `%s'.\n", + /* 185 */ "print_file", + /* 186 */ "error from fgets() on `%s'", + /* 187 */ "%4u%2u%2u%2u%2u%2u", + /* 188 */ "cvt_to_inttime", + /* 189 */ "error converting time `%s'.", + /* 190 */ "prosp_strftime", + /* 191 */ "prosp_strftime() failed on `%s'.", + /* 192 */ "", + /* 193 */ "size_of_file", + /* 194 */ "can't get size of mail file `%s'.", + /* 195 */ "snarf_n_barf", + /* 196 */ "failed to fputs()", + /* 197 */ "fgets() failed", + /* 198 */ "squeeze_whitespace", + /* 199 */ "argument `str' is NULL.", + /* 200 */ "initskip", + /* 201 */ "can't malloc %d bytes for pattern.", + /* 202 */ "can't realloc %d bytes for pattern.", + /* 203 */ "# `%s' requires an argument.\n", + /* 204 */ "copy_first_word", + +/* ==================== mode.c ==================== */ + + /* 205 */ "", + /* 206 */ "", + /* 207 */ "set_mode", + /* 208 */ "unknown mode `0x%08x'; changing to %s mode.", + +/* ==================== pager.c ==================== */ + + /* 209 */ "close_pager_file", + /* 210 */ "error from `fclose'.", + /* 211 */ "create_pager_file", + /* 212 */ "couldn't create temporary file.", + /* 213 */ "can't open newly created temporary file.", + /* 214 */ "fopen() failed on pager file.", + /* 215 */ "error from fork().", + /* 216 */ "`%s' is NULL.", + /* 217 */ "execl for pager `%s' failed", + /* 218 */ "remove_pager_file", + /* 219 */ "argument `pager_file_name' is NULL.", + /* 220 */ "error removing temporary pager file.", + /* 221 */ "set_pager_opts", + /* 222 */ "argument `val' is NULL.", + +/* ==================== pexec.c ==================== */ + + /* 223 */ "make_argv", + /* 224 */ "argument list is not NULL terminated.", + /* 225 */ "p_close", + /* 226 */ "tried to wait for non-existant child.", + /* 227 */ "argument does not correspond to either end of the pipe.", + /* 228 */ "p_execvp", + /* 229 */ "# ERROR: p_execvp: pipe: ", + /* 230 */ "# ERROR: p_execvp: fdopen: ", + /* 231 */ "# ERROR: p_execvp: fdopen ", + /* 232 */ "type argument to p_execvp is `%s'.", + /* 233 */ "# ERROR: pexecvp: fork ", + /* 234 */ "# ERROR: p_execvp: dup2(p[1], 1) ", + /* 235 */ "# ERROR: p_execvp: dup2(p[0], 0)", + /* 236 */ "# ERROR: p_execvp: execvp", + +/* ==================== prospero_fix.c ==================== */ + + +/* ==================== rmem.c ==================== */ + + /* 237 */ "rfree %p\n", + /* 238 */ "rmalloc: %p\n", + /* 239 */ "got %p again!\n", + /* 240 */ "set foo to %p.\n", + +/* ==================== signals.c ==================== */ + + /* 241 */ "catch_alarm", + /* 242 */ "start", + /* 243 */ "not waiting for child", + /* 244 */ "\n# auto-logout\n", + /* 245 */ "waiting for child", + /* 246 */ "`get_var' returned null.", + /* 247 */ "you can stick around -- with %d secs left", + /* 248 */ "\n# Aborted.\n", + +/* ==================== strmap.c ==================== */ + + +/* ==================== terminal.c ==================== */ + + /* 249 */ "get_key_char", + /* 250 */ "# expected a single character or `^', rather than `%s'.\n", + /* 251 */ "# `%s' (0x%02x) does not make a valid control character.\n", + /* 252 */ "get_key_str", + /* 253 */ "buffer `%s' is too small.", + /* 254 */ "buf", + /* 255 */ "value of `%s' (`%lu') is out of range.", + /* 256 */ "ch", + /* 257 */ "^?", + /* 258 */ "^%c", + /* 259 */ "\\%03o", + /* 260 */ "set_window_size", + /* 261 */ "can't get winsize structure", + /* 262 */ "can't set winsize structure", + /* 263 */ "set_term_type", + /* 264 */ "# Unable to open terminal description file.\n", + /* 265 */ "# Terminal type `%s' is unknown to this system.\n", + /* 266 */ "dumb", + /* 267 */ "tgetent() returned an undocumented value; trying `dumb'.", + /* 268 */ "TERM=", + /* 269 */ "error from putenv().", + /* 270 */ "TERM", + /* 271 */ "init_term", + /* 272 */ "%s %d %d", + /* 273 */ "%s %s %s", + /* 274 */ "%d", + /* 275 */ "# Number of columns, `%s', must be numeric.\n", + /* 276 */ "# Number of rows, `%s', must be numeric.\n", + /* 277 */ "# Command format is `term [<#rows> [<#cols>]]'.\n", + /* 278 */ "set_term", + /* 279 */ "error setting the terminal size.", + /* 280 */ "# Terminal type set to `%s %d %d'.\n", + /* 281 */ "set_tty", + /* 282 */ "# `%s' takes arguments in pairs; see help on `%s' for usage.\n", + /* 283 */ "error getting termios structure", + /* 284 */ "# `erase' character is `%s'.\n", + /* 285 */ "# `%s' is not a valid argument; see help on `%s' for usage.\n", + /* 286 */ "error setting termios structure", + +/* ==================== vars.c ==================== */ + + /* 287 */ "# `%s' cannot be set in %s mode.\n", + /* 288 */ "# `%s' is read-only; it's value may not be changed.\n", + /* 289 */ "# `%s' is not a valid value, `help set %s' for a list.\n", + /* 290 */ "# Value must be an integer.\n", + /* 291 */ "# Value must be in the range [%d,%d].\n", + /* 292 */ "set_var_", + /* 293 */ "can't set new value.", + /* 294 */ "# Value is too long (> %d bytes).\n", + /* 295 */ "set_var", + /* 296 */ "variable has unknown type.", + /* 297 */ "# `%s' is not a known variable in `%s' mode.\n", + /* 298 */ "boolean", + /* 299 */ "# `%s' (type %s) is set.\n", + /* 300 */ "# `%s' (type %s) is not set.\n", + /* 301 */ "numeric", + /* 302 */ "string", + /* 303 */ "show_var", + /* 304 */ "variable `%s' has an unknown type.", + /* 305 */ "# `%s' (type %s) has the value `%s'.\n", + /* 306 */ "# `%s' cannot be unset -- it must always have a value.\n", + /* 307 */ "english", + /* 308 */ "francais", + /* 309 */ "# WARNING: messages will not be in `%s'.\n", + /* 310 */ "# Can't set language to `%s'. No help directory.\n", + +/* ==================== version.c ==================== */ + + +/* ==================== whatis.c ==================== */ + + /* 311 */ "get_whatis_list", + /* 312 */ "can't open description database, `%s'.", + /* 313 */ "%-25s %-54s\n", + /* 314 */ "# Nothing found that matched `%s'.\n", + +/* ==================== EXTRA ==================== */ + + /* 315 */ "# `%s' does not take any arguments.\n", + /* 316 */ "error ftruncate()ing temporary file `%s'", + /* 317 */ "# `%s' requires at least two arguments.\n", + /* 318 */ "# `%s' is not a valid sub-command.\n", + /* 319 */ "# error trying to set mail path.\n", + + /* 320 */ "# Search type: %s", + /* 321 */ "%sDomain: %s", + /* 322 */ "%sPath: %s", + /* 323 */ "child terminated abnormally with signal %d.", + /* 324 */ "\n ftp://%s%s \n", + /* 325 */ "\t\tDate: %12s Size: %7s\n", + /* 326 */ "Precedence: junk\n" +}; diff --git a/archie/clients/telnet/extern.h b/archie/clients/telnet/extern.h new file mode 100644 index 0000000..196e49d --- /dev/null +++ b/archie/clients/telnet/extern.h @@ -0,0 +1,7 @@ +#ifndef EXTERN_H +#define EXTERN_H + +extern char homedir[]; +extern const char *prog; + +#endif diff --git a/archie/clients/telnet/find.c b/archie/clients/telnet/find.c new file mode 100644 index 0000000..f2b3b59 --- /dev/null +++ b/archie/clients/telnet/find.c @@ -0,0 +1,198 @@ +#ifdef __STDC__ +#include +#endif +#ifdef AIX +#include +#endif +#include +#include +#include +#include +#include "alarm.h" +#include "arch_query.h" +#include "archie.h" +#include "argv.h" +/*#include "database.h"*/ +#include "defines.h" +#include "error.h" +#include "extern.h" +#include "files.h" /* for tail() in library */ +#include "find.h" +#include "fork_wait.h" +#include "generic_find.h" +#include "get_types.h" +#include "lang.h" +#include "macros.h" +#include "misc.h" +#include "misc_ansi_defs.h" +#include "mode.h" +#include "pager.h" +#include "prosp.h" +#include "signals.h" +#include "vars.h" + +#include "protos.h" + + +/* + * + * + * Internal routines. + * + * + */ + + +static int do_matches PROTO((const char *arg, FILE *ofp, int nsrchs, int prt_status)); + + +/* + * Return values: + * + * 0 : no matches or failure (e.g. from Prospero) + * 1 : success, with results + */ + +/* + * bug: server variable is ignored, sort type is not yet implemented. + */ +static int do_matches(arg, ofp, nsrchs, prt_status) + const char *arg; + FILE *ofp; + int nsrchs; + int prt_status; +{ + int ret = 0; + struct arch_query *aq; + + ptr_check(arg, const char, curr_lang[110], 0); + ptr_check(ofp, FILE, curr_lang[110], 0); + + if ( ! (aq = queryNew())) { + error(A_ERR, "do_matches", "can't perform search for `%s'", arg); + return 0; + } + + querySetKey(aq, arg); + querySetSearchType(aq, get_var(V_SEARCH)); + querySetSortOrder(aq, get_var(V_SORTBY)); + querySetOutputFormat(aq, get_var(V_OUTPUT_FORMAT)); + querySetMaxHits(aq, atoi(get_var(V_MAXHITS)), + atoi(get_var(V_MAXMATCH)), atoi(get_var(V_MAXHITSPM))); + if (is_set(V_MATCH_DOMAIN)) { + querySetDomainMatches(aq, get_var(V_MATCH_DOMAIN)); + } + if (is_set(V_MATCH_PATH)) { + querySetPathMatches(aq, get_var(V_MATCH_PATH)); + } + + if ( ! queryPerform(aq)) { + error(A_ERR, "do_matches", "search failed"); + } else { + queryPrintResults(aq, ofp); + ret = 1; + } + + queryFree(&aq); + + return ret; +} + + +/* + * + * External routines + * + */ + +int anonftp_find(ac, av, ofp) + int ac; + char **av; + FILE *ofp; +{ + int ret = 0; + + ptr_check(av, char *, curr_lang[117], 0); + ptr_check(ofp, FILE, curr_lang[117], 0); + + if (ac < 2) + { + printf(curr_lang[53], av[0]); + return 0; + } + + mode_truncate_fp(ofp); + fprint_srch_restrictions(stdout); + fflush(stdout); + switch (fork_me(spin(), &ret)) + { + case (enum forkme_e)INTERNAL_ERROR: + return 0; + + case CHILD: + if (ac == 2) + { + ret = do_matches(av[1], ofp, ac-1, spin()); + } + else + { + int i; + + for (i = 1; i < ac; i++) + { + fprintf(ofp, curr_lang[31], av[i]); + ret |= do_matches(av[i], ofp, ac-1, spin()); + } + } + fork_return(ret); + break; + + case PARENT: + set_alarm(); + break; + + default: + error(A_INTERR, curr_lang[117], curr_lang[48]); + return 0; + } + + return ret; +} + + +int find_it(ac, av, ofp) + int ac; + char **av; + FILE *ofp; +{ + int ret = 0; + + ptr_check(av, char *, curr_lang[117], 0); + ptr_check(ofp, FILE, curr_lang[117], 0); + +#ifdef MULTIPLE_COLLECTIONS + if ( ! is_set(V_COLLECTIONS)) + { +#endif + + ret = anonftp_find(ac, av, ofp); + +#ifdef MULTIPLE_COLLECTIONS + } + else + { + char **dbs; + int maxhdrs = atoi(get_var(V_MAXHDRS)); + int maxdocs = atoi(get_var(V_MAXDOCS)); + int ndbs; + + if (argvify(get_var(V_COLLECTIONS), &ndbs, &dbs)) + { + ret = generic_find(maxhdrs, maxdocs, ndbs, dbs, ac-1, &av[1], ofp); + argvfree(dbs); + } + } +#endif + + return ret; +} diff --git a/archie/clients/telnet/find.h b/archie/clients/telnet/find.h new file mode 100644 index 0000000..c2eadf5 --- /dev/null +++ b/archie/clients/telnet/find.h @@ -0,0 +1,11 @@ +#ifndef FIND_H +#define FIND_H + +#include +#include "ansi_compat.h" + + +extern int anonftp_find PROTO((int ac, char **av, FILE *ofp)); +extern int find_it PROTO((int ac, char **av, FILE *ofp)); + +#endif diff --git a/archie/clients/telnet/fork_wait.c b/archie/clients/telnet/fork_wait.c new file mode 100644 index 0000000..a9db7b4 --- /dev/null +++ b/archie/clients/telnet/fork_wait.c @@ -0,0 +1,126 @@ +#include +#include +#include +#include +#ifdef __STDC__ +#include +#endif +#include "debug.h" +#include "defines.h" +#include "error.h" +#include "extern.h" +#include "fork_wait.h" +#include "lang.h" +#include "misc_ansi_defs.h" +#include "signals.h" +#include "tellwait.h" +#include "unixcompat.h" +#include "vars.h" + +#include "protos.h" + +#ifndef DEBUG +#define SLEEP (5 /* tenths of a second */ * (100000)) +#else +#define SLEEP (20 /* tenths of a second */ * (100000)) +#endif + + +#if 1 +static char spintab[] = { '=', 'O' }; +#else +static char spintab[] = { '/', '-', '\\', '|' }; /* boring spinner... */ +#endif + + +static int sit_and_spin PROTO((int *status, int prt_status)); + + +static int sit_and_spin(status, prt_status) + int *status; + int prt_status; +{ +#ifdef PROFILE + return 1; +#else + if ( ! prt_status) + { + return wait(status); + } + else + { + int i = 0; + int rv; + + wait_child(); + fputs(curr_lang[118], stdout); + while ((rv = waitpid(-1, status, WNOHANG)) == 0) + { + putchar('\b'); putchar(spintab[i]); + fflush(stdout); + i = (i + 1) % (sizeof spintab / sizeof spintab[0]); + u_sleep(SLEEP); + } + putchar('\n'); + return rv; + } +#endif +} + + +/* + * Fork and return who we are, parent or child. In the case of the parent + * wait for the child to finish, unless 'is_background' is set. In the case + * of the child catch some signals. + */ + +Forkme fork_me(prt_status, ret) + int prt_status; + int *ret; +{ + int child_pid; + int cstat; + int rpid; + +#ifdef PROFILE + child_pid = 0; +#else + if (prt_status) tell_wait(); + child_pid = fork(); +#endif + + switch (child_pid) + { + case -1: /* error */ + perror(curr_lang[119]); + return (enum forkme_e)INTERNAL_ERROR; + + case 0: /* child */ +#ifdef CHILD_DEBUG + fprintf(stderr, "%s: fork_me: child #%ld; hit return to continue: ", + prog, (long)getpid()); + while (getchar() != '\n'); +#endif + child_sigs(); + return CHILD; + + default: /* parent */ +#ifndef PROFILE + if ( ! prt_status) no_tell_wait(); +#endif + rpid = sit_and_spin(&cstat, prt_status); + if (WIFSIGNALED(cstat)) /*bug: what if child stops?*/ + { + *ret = 0; + error(A_ERR, curr_lang[120], curr_lang[323], WTERMSIG(cstat)); + } + else if (rpid == -1) + { + *ret = 0; + error(A_SYSERR, curr_lang[120], curr_lang[121]); + return (enum forkme_e)INTERNAL_ERROR; + } + *ret = WEXITSTATUS(cstat); + return PARENT; + } +} diff --git a/archie/clients/telnet/fork_wait.h b/archie/clients/telnet/fork_wait.h new file mode 100644 index 0000000..e8f49d2 --- /dev/null +++ b/archie/clients/telnet/fork_wait.h @@ -0,0 +1,30 @@ +#ifndef FORK_WAIT_H +#define FORK_WAIT_H + +#include "ansi_compat.h" +#include "defines.h" +#include "macros.h" + + +#ifdef PROFILE +# define fork_return(x) break +#else +# define fork_return(x) exit(x) +#endif + +/* + * Possible return values for the function 'fork_me'. + */ +enum forkme_e +{ + _FORKME_NOT_USED = INTERNAL_ERROR, + CHILD, + PARENT +}; + +typedef enum forkme_e Forkme; + + +extern Forkme fork_me PROTO((int prt_status, int *ret)); + +#endif diff --git a/archie/clients/telnet/french-language-strings.c b/archie/clients/telnet/french-language-strings.c new file mode 100644 index 0000000..5ac1a2f --- /dev/null +++ b/archie/clients/telnet/french-language-strings.c @@ -0,0 +1,410 @@ +#include "ansi_compat.h" + + +const char *french[] = +{ + +/* ==================== alarm.c ==================== */ + + /* 0 */ "", /* avail */ + /* 1 */ "get_var() est revenu un indicateur nul.", + +/* ==================== archie.c ==================== */ + + /* 2 */ "", /* avail */ + /* 3 */ "", /* avail */ + /* 4 */ "", /* avail */ + /* 5 */ "main", /*X*/ + /* 6 */ "param\350tre inattendu `%s'.", + /* 7 */ "param\350tre n\351cessaire apr\350s `%s'.", + /* 8 */ "ne peut ex\351cuter \340 la fois en mode courrier et en mode serveur.", + /* 9 */ "`-e' option n\351cessitant `-o'.", + /* 10 */ "w+", /*X*/ + /* 11 */ "ne peut ouvrir le fichier sortie de courrier `%s' en mode \"w+\"", + /* 12 */ "can't freopen() `%s' onto stdout", /*???*/ + /* 13 */ "can't freopen() `%s' onto stderr", /*???*/ + /* 14 */ "", /* avail */ + /* 15 */ "", /* avail */ + /* 16 */ "", /* avail */ + /* 17 */ "r\351pertoire initial introuvable!", + /* 18 */ "ne peut pas chdir() au r\351pertoire initial, `%s'", + /* 19 */ ".", /*X*/ + /* 20 */ "ne peut pas chroot() au r\351pertoire initial", + /* 21 */ "setuid() \351chou\351", + /* 22 */ "%s/%s", /*X*/ + /* 23 */ "ne peut pas obtenir nouveau contexte historique.", + /* 24 */ "# Version fran\347aise r\351alis\351e en collaboration avec le\n# Service des T\351l\351communications, Universit\351 du Qu\351bec \340 Montr\351al.\n\n", + /* 25 */ "stty", /*X*/ + /* 26 */ "# Bunyip Information Systems, Inc., 1993, 1994, 1995\n\n", /*X*/ + /* 27 */ "", /*X*/ + /* 28 */ "\n", /*X*/ + /* 29 */ "# D\351sol\351, cette commande a \351t\351 mise hors service par le gestionnaire.\n", + /* 30 */ "# Mode erron\351 `%s' pour l'instruction `%s'.\n", + /* 31 */ "\n>> %s\n", /*X*/ + /* 32 */ "help", /*X*/ + /* 33 */ "mail", /*X*/ + /* 34 */ "# Au revoir.\n", + /* 35 */ "# Cette instruction ne s'utilise qu'avec la commande `aide'.\n", + /* 36 */ "# Pr\351fixe d'instruction multiple.\n", + /* 37 */ "# D\351sol\351, la commande `site' n'est pas disponible.\n", + /* 38 */ "# %s\n", /*X*/ + /* 39 */ "# Commande `%s' inconnue en mode %s.\n", + /* 40 */ "disable_command", /*X*/ + /* 41 */ "`%s' exige au moins un param\350tre.", + /* 42 */ "# Paginer \351chou\351; impression directement sur l'\351cran.\n", + /* 43 */ "init_from_file", /*X*/ + /* 44 */ "r", /*X*/ + /* 45 */ "man_it", /*X*/ + /* 46 */ "# `%s' ne permet qu'un seul param\350tre.\n", + /* 47 */ "roff", /*X*/ + /* 48 */ "code de retour inconnu de fork_me().", + /* 49 */ "whatis_it", /*X*/ + /* 50 */ "new_tmp_file", /*X*/ + /* 51 */ "erreur en ouvrant fichier tmp `%s'", + /* 52 */ "tempnam() a \351chou\351.", + /* 53 */ "# `%s' exige au moins un param\350tre.\n", + /* 54 */ "# les variables bool\351ennes ne permettent aucun param\350tre.\n", + /* 55 */ "# les variables num\351riques ne permettent qu'un seul param\350tre.\n", + /* 56 */ "# les variables de cha\356ne exigent un param\350tre.\n", + /* 57 */ " ", /*X*/ + /* 58 */ "# `%s' est une variable inconnue.\n", + /* 59 */ "set_it", /*X*/ + /* 60 */ "type de variable inconnu `%d'.", + /* 61 */ "remove_tmp_file", /*X*/ + /* 62 */ "erreur en supprimant la liaison `%s'", + /* 63 */ "# D\351sol\351, liste des serveurs introuvable.\n", + /* 64 */ "Usage: %s [-d <#>] [-e] [-i ] [-l] [-L ] [-p <#>] [-s]\n", + +/* ==================== argv.c ==================== */ + + /* 65 */ "impossible d'attribuer un indicateur initial", + /* 66 */ "new_str", /*X*/ + /* 67 */ "erreur rmalloc() `%d' bits ", + /* 68 */ "argvflatten", /*X*/ + /* 69 */ "erreur malloc() `%u' bits ", + /* 70 */ "argvify", /*X*/ + /* 71 */ "n'a pas r\351ussi %s.", + /* 72 */ "initialiser argv", + /* 73 */ "commencer une autre cha\356ne", + /* 74 */ "rentrer un caract\350re", + /* 75 */ "finir la cha\356ne actuelle", + /* 76 */ "fini en mauvais \351tat, `%d'.", + +/* ==================== commands.c ==================== */ + + /* 77 */ "cmd_disable", /*X*/ + /* 78 */ "`%s': %s", /*X*/ + /* 79 */ "get_cmd", /*X*/ + +/* ==================== error.c ==================== */ + + /* 80 */ "erreur: %s.\n", + /* 81 */ "ERREUR", + /* 82 */ "INFO", + /* 83 */ "ERREUR INTERNE", + /* 84 */ "ERREUR D'APPEL DE PROGRAMME", + /* 85 */ "MISE EN GARDE", + /* 86 */ "# ERREUR INTERNE: erreur: type d'erreur inconnu, %d.\n", + /* 87 */ "# %s: %s: %s", /*X*/ + /* 88 */ ": erreur non r\351pertori\351e", + /* 89 */ ": ", /*X*/ + /* 90 */ "%s %s\n", /*X*/ + /* 91 */ "/tmp/lll", /*X*/ + /* 92 */ "w", /*X*/ + +/* ==================== find.c ==================== */ + + /* 93 */ "DIRECTORY", /*X*/ + /* 94 */ "%s %s %s %s %s%s\n", /*X*/ + /* 95 */ "LAST-MODIFIED", /*X*/ + /* 96 */ "SIZE", /*X*/ + /* 97 */ "UNIX-MODES", /*X*/ + /* 98 */ "/", /*X*/ + /* 99 */ "%R %e %h %Y", /*X*/ + /* 100 */ "%s %12s %7s %s%s\n", /*X*/ + /* 101 */ "AR_H_LAST_MOD", /*X*/ + /* 102 */ "Ordinateur central %s (%s)\n", + /* 103 */ "AR_H_IP_ADDR", /*X*/ + /* 104 */ "Derni\350re mise \340 jour %s\n", + /* 105 */ "\n Endroit: %s\n", + /* 106 */ " R\311PERTOIRE %s %13s %12s %s\n", + /* 107 */ " FICHIER %s %13s %12s %s\n", + /* 108 */ "fprint_list_item", /*X*/ + /* 109 */ "type de style de donn\351es inconnu `%d'.", + /* 110 */ "do_matches", /*X*/ + /* 111 */ "pager", /*X*/ + /* 112 */ "verbose", + /* 113 */ "terse", + /* 114 */ "machine", + /* 115 */ "# Correspondances introuvables.\n", + /* 116 */ "\n# Erreur caus\351e par le serveur Prospero - ", + /* 117 */ "find_it", /*X*/ + +/* ==================== fork_wait.c ==================== */ + + /* 118 */ "en cours... ", + /* 119 */ "# ERREUR: fork_me: fork: ", + /* 120 */ "fork_me", /*X*/ + /* 121 */ "erreur en attendant un processus secondaire.", /*???*/ + +/* ==================== get_types.c ==================== */ + + +/* ==================== help.c ==================== */ + + /* 122 */ "aide%s> ", + /* 123 */ "%s/=", /*X*/ + /* 124 */ "display_help", /*X*/ + /* 125 */ "erreur access() pour le fichier `%s'", + /* 126 */ "list_subtopics", /*X*/ + /* 127 */ "impossible d'ouvrir le r\351pertoire `%s'.", + /* 128 */ "# Rubriques\n#\n", + /* 129 */ "#\t%s\n", /*X*/ + /* 130 */ "# Aucun rubrique.\n", /*X*/ + /* 131 */ "pop_topic", /*X*/ + /* 132 */ "`/' introuvable dans la structure actuelle de r\351pertoires.", + /* 133 */ "push_topics", /*X*/ + /* 134 */ "# `%s' ne semble pas exister.\n", + /* 135 */ "help_", /*X*/ + /* 136 */ "fichier d'aide introuvable; consultez-vous le bon r\351pertoire?", + /* 137 */ "?", /*X*/ + /* 138 */ "ex\351cut\351", + /* 139 */ "fichier introuvable avec l'aide du courrier \351.", + /* 140 */ "erreur en tentant d'obtenir un nouveau contexte historique.", /*???*/ + +/* ==================== input.c ==================== */ + + /* 141 */ ".\n", /*X*/ + /* 142 */ "readline", /*X*/ + /* 143 */ "impossible de malloc()er `%d' bits pour une nouvelle ligne.", + /* 144 */ "erreur de lecture sur `stdin'.", + /* 145 */ "valeur de retour inattendue pour fread().", + /* 146 */ "erreur en realloc()ant `%d' bits pour la ligne d'entr\351e.", + +/* ==================== lang.c ==================== */ + + +/* ==================== list.c ==================== */ + + /* 147 */ "argument `article' est NUL.", + /* 148 */ "%s %s\n", /*X*/ + /* 149 */ "%-40s %15s %17s\n", /*X*/ + /* 150 */ "fprint_list_item", /*X*/ + /* 151 */ ".*", /*X*/ + /* 152 */ "list_it", /*X*/ + +/* ==================== mail.c ==================== */ + + /* 153 */ "mail_it", /*X*/ + /* 154 */ "envoyer\340 ", + /* 155 */ "# Vous devez pr\351ciser une adresse de courrier ou fixer la valeur de la variable 'envoyer\340'.\n", + /* 156 */ "# `%s' ne prend qu'un seul param\350tre.\n", + /* 157 */ "# Vous n'avez pas encore de r\351sultats \340 envoyer.\n", + /* 158 */ "aucun", + /* 159 */ "# Si vous pr\351cisez compression, vous devez aussi pr\351ciser un encodage. \n", + /* 160 */ "num\351ro de porte d'acc\350s, `%s', invalide.", + /* 161 */ "getservbyname() \351chou\351 -- porte d'acc\350s introuvable pour `%s'.", + /* 162 */ "liaison avec l'ordinateur central impossible: `%s'.", + /* 163 */ "error fdopen()ing socket to the mail host.", /*???*/ + /* 164 */ "@Begin\n", /*X*/ + /* 165 */ "Command: %s\n", /*X*/ + /* 166 */ "Compress: %s\n", /*X*/ + /* 167 */ "Encode: %s\n", /*X*/ + /* 168 */ "MaxSplitSize: %d\n", /*X*/ + /* 169 */ "@MailHeader\n", /*X*/ + /* 170 */ "To: %s\n", /*X*/ + /* 171 */ "From: %s@%s\n", /*X*/ + /* 172 */ "Reply-To: %s@%s\n", /*X*/ + /* 173 */ "Date: %s\n", /*X*/ + /* 174 */ "@End\n", /*X*/ + /* 175 */ "fputs() est EOF, errno est %d.\n", + /* 176 */ "\351chec! errno = %d.\n", + /* 177 */ "ferror(mfp) est %d, feof(mfp) est %d.\n", + /* 178 */ "ferror(ofp) est %d, feof(ofp) est %d.\n", + +/* ==================== misc.c ==================== */ + + /* 179 */ "", + /* 180 */ "first_word_of", /*X*/ + /* 181 */ "dequote", /*X*/ + /* 182 */ "nuke_newline", /*X*/ + /* 183 */ "l'argument est NUL.", + /* 184 */ "Nom: `%s', Valeur: `%s'.\n", + /* 185 */ "print_file", /*X*/ + /* 186 */ "erreur \340 partir de fgets() sur `%s'", + /* 187 */ "%4u%2u%2u%2u%2u%2u", /*X*/ + /* 188 */ "cvt_to_inttime", /*X*/ + /* 189 */ "erreur de conversion de temps `%s'.", + /* 190 */ "prosp_strftime", /*X*/ + /* 191 */ "prosp_strftime() \351chou\351 sur `%s'.", + /* 192 */ "", + /* 193 */ "size_of_file", /*X*/ + /* 194 */ "impossible d'obtenir la taille du fichier du courrier `%s'.", + /* 195 */ "snarf_n_barf", /*X*/ + /* 196 */ "\351chec dans fputs()", + /* 197 */ "fgets() a \351chou\351", + /* 198 */ "squeeze_whitespace", /*X*/ + /* 199 */ "argument `str' est NUL.", + /* 200 */ "initskip", /*X*/ + /* 201 */ "impossible de malloc()er %d bits pour combinaison.", + /* 202 */ "impossible de realloc()er %d bits pour combinaison.", + /* 203 */ "# `%s' n\351cessite un param\350tre.\n", + /* 204 */ "copy_first_word", /*X*/ + +/* ==================== mode.c ==================== */ + + /* 205 */ "", + /* 206 */ "", + /* 207 */ "set_mode", /*X*/ + /* 208 */ "mode `0x%08x inconnu'; remplacer par mode %s.", + +/* ==================== pager.c ==================== */ + + /* 209 */ "close_pager_file", /*X*/ + /* 210 */ "erreur \340 partir de fclose().", + /* 211 */ "create_pager_file", /*X*/ + /* 212 */ "impossible de cr\351er le fichier temporaire.", + /* 213 */ "impossible d'ouvrir un fichier temporaire cr\351\351 r\351cemment.", + /* 214 */ "fopen() a \351chou\351 sur le fichier paginer.", + /* 215 */ "erreur provenant de fork().", + /* 216 */ "`%s' est NUL.", + /* 217 */ "execl pour pager `%s' a \351chou\351", + /* 218 */ "remove_pager_file", /*X*/ + /* 219 */ "argument `pager_file_name' est NUL.", + /* 220 */ "erreur en effa\347ant un fichier temporaire.", + /* 221 */ "set_pager_opts", /*X*/ + /* 222 */ "argument `val' est NUL.", + +/* ==================== pexec.c ==================== */ + + /* 223 */ "make_argv", /*X*/ + /* 224 */ "liste d'arguments ne se termine pas par NUL.", + /* 225 */ "p_close", /*X*/ + /* 226 */ "a essay\351 d'attendre un processus inexistant.", + /* 227 */ "le param\350tre ne correspond \340 aucun canal de communication.", + /* 228 */ "p_execvp", /*X*/ + /* 229 */ "# ERREUR: p_execvp: pipe: ", + /* 230 */ "# ERREUR: p_execvp: fdopen: ", + /* 231 */ "# ERREUR: p_execvp: fdopen ", + /* 232 */ "genre de param\350tre \340 p_execvp() est `%s'.", + /* 233 */ "# ERREUR: pexecvp: fork ", + /* 234 */ "# ERREUR: p_execvp: dup2(p[1], 1) ", + /* 235 */ "# ERREUR: p_execvp: dup2(p[0], 0)", + /* 236 */ "# ERREUR: p_execvp: execvp", + +/* ==================== prospero_fix.c ==================== */ + + +/* ==================== rmem.c ==================== */ + + /* 237 */ "rfree %p\n", /*X*/ + /* 238 */ "rmalloc: %p\n", /*X*/ + /* 239 */ "encore %p!\n", + /* 240 */ "positionner foo \340 %p.\n", + +/* ==================== signals.c ==================== */ + + /* 241 */ "catch_alarm", /*X*/ + /* 242 */ "marche", + /* 243 */ "n'attend pas de processus secondaire", + /* 244 */ "\n# auto-logout\n", + /* 245 */ "attend un processus secondaire", + /* 246 */ "`get_var' redevenu nul.", + /* 247 */ "vous pouvez attendre -- il reste %d secs", + /* 248 */ "\n# Suspendu.\n", + +/* ==================== strmap.c ==================== */ + + +/* ==================== terminal.c ==================== */ + + /* 249 */ "get_key_char", /*X*/ + /* 250 */ "# s'attendait \340 seul caract\350re ou `^', plut\364t que `%s'.\n", + /* 251 */ "# `%s' (0x%02x) ne constitue pas un caract\350re de contr\364le valide.\n", + /* 252 */ "get_key_str", /*X*/ + /* 253 */ "le tampon `%s' est trop petit.", + /* 254 */ "buf", /*X*/ + /* 255 */ "la valeur de '%s' (`%lu') est hors limites.", + /* 256 */ "ch", /*X*/ + /* 257 */ "^?", /*X*/ + /* 258 */ "^%c", /*X*/ + /* 259 */ "\\%03o", /*X*/ + /* 260 */ "set_window_size", /*X*/ + /* 261 */ "impossible d'obtenir une structure winsize", + /* 262 */ "impossible de r\351gler une structure winsize", + /* 263 */ "set_term_type", /*X*/ + /* 264 */ "# impossible d'ouvrir le fichier de description des terminaux.\n", + /* 265 */ "# type de termnial `%s' inconnu de ce syst\350me, essai de `dumb'.\n", + /* 266 */ "dumb", /*X*/ + /* 267 */ "tgetent() est redevenu une valeur non document\351e; essai de `dumb'.", + /* 268 */ "TERM=", /*X*/ + /* 269 */ "erreur provenant de putenv().", + /* 270 */ "TERM", /*X*/ + /* 271 */ "init_term", /*X*/ + /* 272 */ "%s %d %d", /*X*/ + /* 273 */ "%s %s %s", /*X*/ + /* 274 */ "%d", /*X*/ + /* 275 */ "# le nombre de colonnes, `%s', doit \352tre une valeur num\351rique.\n", + /* 276 */ "# le nombre de lignes, `%s', doit \352tre une valeur num\351rique.\n", + /* 277 */ "# le format de commande est `term [<#lignes> [<#colonnes>]]'.\n", + /* 278 */ "set_term", /*X*/ + /* 279 */ "erreur dans la capacit\351 de m\351moire du terminal.", + /* 280 */ "# Type de terminal r\351gl\351 \340 `%s %d %d'.\n", + /* 281 */ "set_tty", /*X*/ + /* 282 */ "# `%s' exige deux param\350tres; voir aide sur `%s' pour mode d'emploi.\n", + /* 283 */ "erreur en obtenant la structure termios", + /* 284 */ "# caract\350re `erase' est `%s'.\n", + /* 285 */ "# `%s' n'est pas un param\350tre valide; consulter l'aide sur `%s' pour conna\356tre le mode d'emploi.\n", + /* 286 */ "erreur en r\351glant la structure termios", + +/* ==================== vars.c ==================== */ + + /* 287 */ "# `%s' ne peut se r\351gler en mode %s.\n", + /* 288 */ "# `%s' est en lecture seulement; sa valeur ne peut pas changer.\n", + /* 289 */ "# `%s' n'est pas une valeur valide, `aide fixer %s' pour obtenir une liste.\n", + /* 290 */ "# La valeur doit \352tre un nombre entier.\n", + /* 291 */ "# La valeur doit \352tre comprise dans la gamme [%d,%d].\n", + /* 292 */ "set_var_", /*X*/ + /* 293 */ "impossible de fixer une nouvelle valeur.", + /* 294 */ "# La valeur est trop longue (> %d bits).\n", + /* 295 */ "set_var", /*X*/ + /* 296 */ "variable de type inconnu.", + /* 297 */ "# `%s' n'est pas une variable connue en mode `%s'.\n", + /* 298 */ "bool\351en", + /* 299 */ "# `%s' (type %s) est fix\351.\n", + /* 300 */ "# `%s' (type %s) n'est pas fix\351.\n", + /* 301 */ "num\351rique", + /* 302 */ "cha\356ne", + /* 303 */ "show_var", /*X*/ + /* 304 */ "variable `%s' de type inconnu.", + /* 305 */ "# `%s' (type %s) a la valeur `%s'.\n", + /* 306 */ "# `%s' ne peut s'effacer -- il doit toujours avoir une valeur.\n", + /* 307 */ "english", /*X*/ + /* 308 */ "fran\347ais", /*X*/ + /* 309 */ "# MISE EN GARDE: les messages ne seront pas en `%s'.\n", + /* 310 */ "# impossible de r\351gler le langage \340 `%s'. Aucun r\351pertoire d'aide.\n", + +/* ==================== version.c ==================== */ + + +/* ==================== whatis.c ==================== */ + + /* 311 */ "get_whatis_list", /*X*/ + /* 312 */ "impossible d'ouvrir la base de donn\351es de description, `%s'.", + /* 313 */ "%-25s %-54s\n", /*X*/ + /* 314 */ "# N'a rien trouv\351 qui correspond \340 `%s'.\n", + +/* ==================== EXTRA ==================== */ + + /* 315 */ "# `%s' n'exige pas des param\350tres.\n", + /* 316 */ "erreur ftruncate() sur le fichier temporaire `%s'", + /* 317 */ "# `%s' exige au moins deux param\350tres.\n", + /* 318 */ "# `%s' n'est pas une sous-commande valide.\n" + /* 319 */ "# erreur en fixant l'adresse.\n" + + /* 320 */ "# Type de recherche: %s", /* ??? */ + /* 321 */ "%sDomaine: %s", + /* 322 */ "%sVoie d'acc\350s: %s", + /* 323 */ "child terminated abnormally with signal %d." /*FFF*/, + /* 326 */ "Precedence: junk\n" +}; diff --git a/archie/clients/telnet/generic_find.c b/archie/clients/telnet/generic_find.c new file mode 100644 index 0000000..228449e --- /dev/null +++ b/archie/clients/telnet/generic_find.c @@ -0,0 +1,178 @@ +#ifdef __STDC__ +#include +#endif +#include +#include +#include "alarm.h" +#include "argv.h" +#include "error.h" +#include "extern.h" +#include "fork_wait.h" +#include "generic_find.h" +#include "lang.h" +#include "macros.h" +#include "misc_ansi_defs.h" +#include "mode.h" +#include "pager.h" +#include "prosp.h" +#include "style_lang.h" +#include "vars.h" + +#include "protos.h" + +/* + * + * + * Internal routines + * + * + */ + +static int find PROTO((int maxhdrs, int maxdocs, int ndbs, char **dbs, int nsrchs, + char **srchs, FILE *ofp, int prt_status)); +static int fprint_item PROTO((FILE *ofp, VLINK item, int ostyle)); + + +static int fprint_item(ofp, item, ostyle) + FILE *ofp; + VLINK item; + int ostyle; +{ + PATTRIB attrib; + + for(attrib = item->lattrib; attrib; attrib = attrib->next) + { + if (strncmp(attrib->aname, "WAIS", 4) != 0) + { + char attr[128]; + + sprintf(attr, "%c%s: ", toupper(attrib->aname[0]), attrib->aname + 1); + fmtprintf(ofp, attr, attrib->value.sequence->token, 80); + } + } + + return 1; +} + + +static int find(maxhdrs, maxdocs, ndbs, dbs, + nsrchs, srchs, ofp, prt_status) + int maxhdrs; + int maxdocs; + int ndbs; + char **dbs; + int nsrchs; + char **srchs; + FILE *ofp; + int prt_status; +{ + int ret = 0; + struct aquery arq; + + aq_init(&arq); + + if ( ! (arq.dbs = argvFlattenSep(ndbs, dbs, 0, ndbs, ";"))) + { + return 0; + } + if ( ! (arq.string = argvFlattenSep(nsrchs, srchs, 0, nsrchs, ";"))) + { + free(arq.dbs); + return 0; + } + + arq.flags = AQ_NOSORT; + arq.host = get_var(V_SERVER); + arq.maxhits = atoi(get_var(V_MAXHITS)); + arq.maxmatch = arq.maxhitpm = arq.maxhits; /* bug? */ + arq.offset = 0; + arq.query_type = AQ_GENERIC; + + if (archie_query(&arq, prt_status) > 0) + { + perrmesg((char *)0, 0, (char *)0); /*bug: check*/ + } + else + { + VLINK r = arq.results; + int ostyle = VERBOSE; + + if ( ! r) /*bug: check no matches => r == 0*/ + { + fputs(curr_lang[115], nsrchs == 1 ? stdout : ofp); + } + else + { + for (; r; r = r->next) + { + fputs("\n", ofp); + fprint_item(ofp, r, ostyle); + fputs("\n", ofp); + } + + ret = 1; + /* bug: should free up VLINK structs here? */ + vllfree(arq.results); + } + } + + free(arq.dbs); + free(arq.string); + return ret; +} + + +/* + * + * + * External routines + * + * + */ + + +/* + * Return values: + * + * 0 - no matches or error (in arguments, from Prospero, etc.) + * + * 1 - success + */ +int generic_find(maxhdrs, maxdocs, ndbs, dbs, nsrchs, srchs, ofp) + int maxhdrs; + int maxdocs; + int ndbs; + char **dbs; + int nsrchs; + char **srchs; + FILE *ofp; +{ + int ret; + + ptr_check(dbs, char *, "generic_find", 0); + ptr_check(srchs, char *, "generic_find", 0); + ptr_check(ofp, FILE, "generic_find", 0); + + mode_truncate_fp(ofp); + switch (fork_me(spin(), &ret)) + { + case (enum forkme_e)INTERNAL_ERROR: + return 0; + + case CHILD: + /*bug: should check for no matches _at_all_*/ + ret = find(maxhdrs, maxdocs, ndbs, dbs, nsrchs, srchs, ofp, spin()); + fork_return(ret); + break; + + case PARENT: + set_alarm(); + break; + + default: + error(A_INTERR, "generic_find", curr_lang[48]); + return 0; + } + + return ret; +} diff --git a/archie/clients/telnet/generic_find.h b/archie/clients/telnet/generic_find.h new file mode 100644 index 0000000..1eb44a6 --- /dev/null +++ b/archie/clients/telnet/generic_find.h @@ -0,0 +1,7 @@ +#ifndef GENERIC_FIND_H +#define GENERIC_FIND_H + +extern int generic_find(int maxhdrs, int maxdocs, int ndbs, char **dbs, + int nsrchs, char **srchs, FILE *ofp); + +#endif diff --git a/archie/clients/telnet/get_types.c b/archie/clients/telnet/get_types.c new file mode 100644 index 0000000..c7f856e --- /dev/null +++ b/archie/clients/telnet/get_types.c @@ -0,0 +1,38 @@ +#include +#include +#include "ar_search.h" +/*#include "database.h"*/ +#include "get_types.h" +#include "lang.h" +#include "misc.h" +#include "misc_ansi_defs.h" +#include "vars.h" + + +#include "get_types_lang.h" /* protect from translation */ + + +/* + * Check the value of the "sortby" variable and return the appropriate + * enumerated type value. If, for any reason, we get an error we default to + * not sorting. + */ + +int get_sort_type() +{ + int val; + return strtoval(get_var(V_SORTBY), &val, sort_types) ? val : SORT_DBORDER; +} + + +/* + * Same thing, but for the search type. + * + * Note: bug: the new default, if things fail, is a subcase search. + */ + +char get_search_type() +{ + int val; + return strtoval(get_var(V_SEARCH), &val, search_types) ? val : S_SUB_NCASE_STR; +} diff --git a/archie/clients/telnet/get_types.h b/archie/clients/telnet/get_types.h new file mode 100644 index 0000000..7b13faf --- /dev/null +++ b/archie/clients/telnet/get_types.h @@ -0,0 +1,26 @@ +#ifndef GET_TYPES_H +#define GET_TYPES_H + +#include "ansi_compat.h" + + +enum osort_type_t +{ + SORT_DBORDER, + SORT_FILENAME, + SORT_FILESIZE, + SORT_HOSTNAME, + SORT_MODTIME, + SORT_R_FILENAME, + SORT_R_FILESIZE, + SORT_R_HOSTNAME, + SORT_R_MODTIME +}; + +typedef enum osort_type_t osort_type; + + +extern char get_search_type PROTO((void)); +extern int get_sort_type PROTO((void)); + +#endif diff --git a/archie/clients/telnet/get_types_lang.h b/archie/clients/telnet/get_types_lang.h new file mode 100644 index 0000000..c238a37 --- /dev/null +++ b/archie/clients/telnet/get_types_lang.h @@ -0,0 +1,42 @@ +#include "macros.h" + + +StrVal sort_types[] = +{ + { "filename", SORT_FILENAME }, + { "hostname", SORT_HOSTNAME }, + { "nothing", SORT_DBORDER }, + { "rfilename", SORT_R_FILENAME }, + { "rhostname", SORT_R_HOSTNAME }, + { "rnothing", SORT_DBORDER }, + { "rsize", SORT_R_FILESIZE }, + { "rtime", SORT_R_MODTIME }, + { "size", SORT_FILESIZE }, + { "time", SORT_MODTIME }, + + { FRENCH("nom_du_fichier"), SORT_FILENAME }, + { FRENCH("nom_d'hote"), SORT_HOSTNAME }, + { FRENCH("aucun"), SORT_DBORDER }, + { FRENCH("inv_nom_du_fichier"), SORT_R_FILENAME }, + { FRENCH("inv_nom_d'hote"), SORT_R_HOSTNAME }, + { FRENCH("inv_aucun"), SORT_DBORDER }, + { FRENCH("inv_taille"), SORT_R_FILESIZE }, + { FRENCH("inv_temps"), SORT_R_MODTIME }, + { FRENCH("taille"), SORT_FILESIZE }, + { FRENCH("temps"), SORT_MODTIME }, + + { (const char *)0, 0 } +}; + + +StrVal search_types[] = +{ + { "exact", '=' }, + { "regex", 'R' }, + { "sub", 'S' }, + { "subcase", 'C' }, + { "exact_regex", 'r' }, + { "exact_sub", 's' }, + { "exact_subcase", 'c' }, + { (const char *)0, 0 } +}; diff --git a/archie/clients/telnet/help.c b/archie/clients/telnet/help.c new file mode 100644 index 0000000..d076f79 --- /dev/null +++ b/archie/clients/telnet/help.c @@ -0,0 +1,546 @@ +#ifdef __STDC__ +# include /* for free() */ +#endif +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/* Including "signals.h" instead... */ +#if defined(AIX) || defined(SOLARIS) +#include +#endif + +#include "alarm.h" +#include "client_defs.h" +#include "debug.h" +#include "defines.h" +#include "error.h" +#include "extern.h" +#include "help.h" +#include "input.h" +#include "lang.h" +#include "macros.h" +#include "misc.h" +#include "misc_ansi_defs.h" +#include "mode.h" +#include "pager.h" +#include "signals.h" +#include "vars.h" + +#include "protos.h" + +/* + * If the first character of the name is a letter it _may_ be a topic. + */ + +#define MAX_SUBTOPICS 128 +#define MAXCOLS 3 +#define is_topic_name(f) (isascii((int)*f) && isalpha((int)*f)) + + +static char curr_path[MAX_PATH_LEN]; +static char curr_prompt[MAXPATHLEN]; +static int help_ctxt = -1; +static jmp_buf here_on_intr; + + +/* + * + * Internal Routines + * + * + */ + + +static char *get_prompt PROTO((void)); +static int get_subtopics PROTO((char **stlist, int stelts)); +static int display_help PROTO((void)); +static int help_ PROTO((const char *t, int immediate_return)); +static int is_topic PROTO((const char *t)); +static int list_subtopics PROTO((void)); +static int pop_topic PROTO((void)); +static int push_topics PROTO((const char *s)); +static int strptrcmp PROTO((char **p1, char **p2)); +static void catch_help_sigint PROTO((void)); +static void handle_help_sigint PROTO((int sig)); +static void ignore_sigint PROTO((void)); + + +/* + * Create a string suitable for display as a help prompt, and return a + * pointer to it. + */ + +static char *get_prompt() +{ + static char p[MAXPATHLEN+4]; /*bug: inefficient*/ + + sprintf(p, curr_lang[122], curr_prompt); + return p; +} + + +/* + * Signal handler for SIGINT. Returns to help(). + */ + +static void handle_help_sigint(int sig) +{ + d5fprintf(stderr, "%s (%ld): handle_help_sigint: longjmp()ing.\n", + prog, (long)getpid()); + longjmp(here_on_intr, 1); +} + + +/* + * Set-up the signal handler. + */ + +static void catch_help_sigint() +{ + d5fprintf(stderr, "%s (%ld): catch_help_sigint: setting SIGINT handler.\n", + prog, (long)getpid()); + ppc_signal(SIGINT, handle_help_sigint); +} + + +/* + * Invoke the pager, if necessary, on the file containing help. + */ + +static int display_help() +{ + char fname[MAXPATHLEN]; + + sprintf(fname, curr_lang[123], curr_path); + if (access(fname, R_OK) == -1) + { + error(A_SYSERR, curr_lang[124], curr_lang[125], fname); + return 0; + } + if (is_set(V_PAGER)) + { + int ret; + + ignore_sigint(); /* so ^C doesn't longjmp() us past the wait()... */ + ret = pager(fname); + catch_help_sigint(); + return ret; + } + else + { + return fprint_file(stdout, fname, 0); + } +} + + +/* + * Disable trapping of SIGINT. + */ + +static void ignore_sigint() +{ + d5fprintf(stderr, "%s (%ld): ignore_sigint: ignoring SIGINT.\n", + prog, (long)getpid()); + ppc_signal(SIGINT, SIG_IGN); +} + + +/* + * Given the path name of a file, return 1 or 0 depending on whether it is a + * help topic (in reality, whether it is a directory). + */ + +static int is_topic(t) + const char *t; +{ + struct stat sb; + + if (stat(t, &sb) == -1) + { + return 0; + } + return S_ISDIR(sb.st_mode); +} + + +/* + * Using the current path (in the variable `curr_path') print a list of + * subtopics. (Basically, it prints a list of the subdirectories under the + * current directory.) + * + * Print the list in three columns, assuming a maximun topic string length + * of twenty characters. + */ + +static int list_subtopics() +{ + char *subtops[MAX_SUBTOPICS]; + int i; + int ncols = MAXCOLS; + int nelts; + int nrows; + + if ((nelts = get_subtopics(&subtops[0], MAX_SUBTOPICS)) == 0) + { + printf(curr_lang[130]); + return 0; + } + + qsort((char *)&subtops[0], nelts, sizeof subtops[0], strptrcmp); + + nrows = nelts / ncols; + if (nelts % ncols) nrows++; /* i.e. nrows = ceil(nelts / (double)ncols) */ + + printf(curr_lang[128]); + for (i = 0; i < nrows; i++) + { + int j; + + printf("# %-20s", subtops[i]); + for (j = 1; j < ncols; j++) + { + int idx = i + j * nrows; + + if (idx < nelts) printf(" %-20s", subtops[idx]); + } + printf("\n"); + } + printf("#\n"); + + for (i = 0; i < nelts; i++) + { + if (subtops[i]) free(subtops[i]); + } + + return 1; +} + + +/* + * Return the number of subtopics under the current topic. (I.e. Count the + * number of entries, in the current directory, that correspond to + * subtopics.) + */ +static int get_subtopics(stlist, stelts) + char **stlist; + int stelts; +{ + DIR *dir; + int n = 0; + struct dirent *d; + + if ( ! (dir = opendir(curr_path))) + { + error(A_ERR, "get_subtopics", curr_lang[127], curr_path); + return 0; + } + + while ((d = readdir(dir))) + { + if (is_topic_name(d->d_name)) + { + char fname[MAXPATHLEN+1]; + + sprintf(fname, curr_lang[22], curr_path, d->d_name); + if (is_topic(fname)) + { + if (stlist && n < stelts) /* append a topic */ + { + /* bug: strdup() could fail */ + stlist[n] = strdup(d->d_name); + } + n++; + } + } + } + + closedir(dir); + return n; +} + + +/* + * Pop a topic from the stack (of topics). This translates to removing the + * last element from the prompt and the current directory strings. + * Underflow causes us to return 0, otherwise 1. + * + * Underflow should be interpreted as "popping out of help" (i.e. returning + * to the main prompt). + */ + +static int pop_topic() +{ + char *new_end; + + if ( ! (new_end = strrchr(curr_prompt, ' '))) + { + return 0; + } + else + { + *new_end = '\0'; + if ( ! (new_end = strrchr(curr_path, '/'))) + { + error(A_INTERR, curr_lang[131], curr_lang[132]); + return 0; + } + else + { + *new_end = '\0'; + return 1; + } + } +} + + +/* + * Push zero or more topics on the stack. + * + * This translates to appending the appropriate subdirectories to the + * current directory list. We check to see whether the resulting help topic + * is valid (by looking for the file /=); if it isn't we restore + * the current directory list and return 0; otherwise we append the + * subtopics to the prompt and return 1. + * + * The topics are represented as a string of whitespace separated words. + */ + +static int push_topics(s) + const char *s; +{ + char *epath; + struct stat sb; + + ptr_check(s, const char, curr_lang[133], 0); + + if ( ! *s) + { + return 1; + } + + epath = curr_path + strlen(curr_path); + + strcat(curr_path, curr_lang[98]); + strcat(curr_path, s); + strxlate(epath, ' ', '/'); + if (stat(curr_path, &sb) == -1) + { + *epath = '\0'; + printf(curr_lang[134], s); + return 0; + } + else + { + strcat(curr_prompt, curr_lang[57]); + strcat(curr_prompt, s); + return 1; + } +} + + +static int strptrcmp(p1, p2) + char **p1; + char **p2; +{ + return strcmp(*p1, *p2); +} + + +#define m(x) /*fprintf(stderr, "At %d.\n", x);*/ + + +/* + * The argument is assumed to be a whitespace separated sequence of zero or + * more words, which is interpreted as commands to the help interpreter. + * + * A dot (`.') tells us to pop up one level in the help hierarchy. If we + * are already at the bottom most level, the pop will fail, telling us to + * return from help. + * + * A question mark (`?') tells us to list all subtopics of the current + * topic. + * + * Any line consisting only of whitespace (including newline) is ignored, + * and the prompt is redisplayed. + * + * All other lines are assumed to be one or more successively refined help + * topics. If valid, they are pushed on the prompt and directory stacks, + * and the file containing the actual help text is displayed. If this topic + * has no subtopics we pop back to the previous help level. + * + * Now, we accept another line from the user, and repeat the cycle. + */ + +static int help_(t, immediate_return) + const char *t; + int immediate_return; +{ + char *p; + char topics[MAXPATHLEN + 8]; + + curr_prompt[0] = '\0'; + strcpy(topics, t); + squeeze_whitespace(topics); + + /* + Special case: if no topic is specified display the "info on help" + file (the file `=' under the base help directory). + */ + + if ( ! *topics) + { + set_alarm(); + if ( ! display_help()) + { + error(A_INTERR, curr_lang[135], curr_lang[136]); + return 0; + } + } + + while(1) + { + if (strcmp(topics, curr_lang[19]) == 0) + { + if ( ! pop_topic()) + { + return 1; + } + } + else if (strcmp(topics, curr_lang[137]) == 0) + { + list_subtopics(); + } + else if (strcmp(topics, curr_lang[138]) == 0) + { + return 1; + } + else if (*topics && push_topics(topics)) + { + set_alarm(); + display_help(); + if (get_subtopics((char **)0, 0) == 0) + { + pop_topic(); + } + } + set_alarm(); + if ( ! immediate_return && (p = readline(get_prompt()))) + { + strcpy(topics, p); + squeeze_whitespace(topics); + if ( ! *topics) + { + if ( ! pop_topic()) + { + return 1; /* exit on empty line */ + } + } + free(p); + } + else + { + clearerr(stdin); + putchar('\n'); + return 1; + } + } +} + + +/* + * + * External Routines + * + * + */ + +/* + * Set things up so we can call help_(). + * + * Copy the relative path of the help directory into the current directory + * variable (`curr_var'). + * + * If we haven't already done so, get a new history context for help. (For + * this to have any effect the command line editing library must be linked + * in.) + * + * Set up a place we can longjmp() to if the user generates a SIGINT + * (usually ^C). + * + * Catch SIGINT, save the old history context and call help_(). + * + * Upon return from help_() we just clean up a few things: ignore SIGINT, + * and restore the old history context. + */ + +int help(ac, av) + int ac; + char **av; +{ + char old_pager_opts[MAX_VAR_STR_LEN]; + int old_ctxt; + int whence = 0; + + strcpy(curr_path, get_var(V_HELP_DIR)); + strcpy(old_pager_opts, get_var(V_PAGER_OPTS)); + set_var(V_PAGER_OPTS, get_var(V_PAGER_HELP_OPTS)); + + if (current_mode() == M_EMAIL && ac == 1) + { + if (fprint_file(stdout, get_var(V_EMAIL_HELP_FILE), 0)) + { + return 1; + } + else + { + error(A_INTERR, curr_lang[32], curr_lang[139]); + return 0; + } + } + + if (help_ctxt == -1 && set_hist_context(new_hist_context()) == -1) + { + error(A_INTERR, curr_lang[32], curr_lang[140]); + } + else + { + help_ctxt = 0; /* use the same one as non-help */ + } + + if ((whence = setjmp(here_on_intr)) == 0) + { + char topic[256]; + int i; + + topic[0] = topic[1] = '\0'; /*bug: ack!*/ + for(i = 1; i < ac; i++) + { + strcat(topic, curr_lang[57]); /*bug: kludge*/ + strcat(topic, av[i]); + } + + catch_help_sigint(); + old_ctxt = set_hist_context(help_ctxt); + + help_(topic + 1, current_mode() == M_EMAIL); + } + + ignore_sigint(); /* we return here on ^C */ + + set_var(V_PAGER_OPTS, old_pager_opts); + set_hist_context(old_ctxt); + + if (whence) + { + putchar('\n'); /* it just looks nicer with this... */ + } + return 1; +} diff --git a/archie/clients/telnet/help.h b/archie/clients/telnet/help.h new file mode 100644 index 0000000..7a0186a --- /dev/null +++ b/archie/clients/telnet/help.h @@ -0,0 +1,8 @@ +#ifndef HELP_H +#define HELP_H + +#include "ansi_compat.h" + +extern int help PROTO((int ac, char **av)); + +#endif diff --git a/archie/clients/telnet/input.c b/archie/clients/telnet/input.c new file mode 100644 index 0000000..3d3671b --- /dev/null +++ b/archie/clients/telnet/input.c @@ -0,0 +1,103 @@ +#include +#ifdef AIX +#include +#endif +#include "error.h" +#include "input.h" +#include "lang.h" +#include "macros.h" +#include "misc_ansi_defs.h" + +#include "protos.h" + +#define m(x) fprintf(stderr, #x curr_lang[141]) + +#define DFLT_LINE_LEN 81 + + +void add_history(line) + const char *line; +{ +} + + +int new_hist_context() +{ + return 0; +} + + +char *readline(prompt) + const char *prompt; +{ + char *curpos; + char *end; + char *l; + char *line = malloc(DFLT_LINE_LEN); + int lsize = DFLT_LINE_LEN; + int newsize; + + if ( ! line) + { + error(A_SYSERR, curr_lang[142], curr_lang[143], DFLT_LINE_LEN); + return (char *)0; + } + curpos = line; + end = line + DFLT_LINE_LEN; + fputs(prompt, stdout); + while (1) + { + while (curpos < end) + { + switch (fread(curpos, 1, 1, stdin)) + { + case -1: + error(A_SYSERR, curr_lang[142], curr_lang[144]); + free(line); + return (char *)0; + + case 0: + free(line); + return (char *)0; + + case 1: + if (*curpos == '\n') + { + *curpos = '\0'; + return line; + } + curpos++; + break; + + default: + error(A_SYSERR, curr_lang[142], curr_lang[145]); + free(line); + return (char *)0; + } + } + /* + If we get here then we need to get some more space. + */ + if ( ! (l = realloc(line, (unsigned)newsize = lsize + DFLT_LINE_LEN))) + { + error(A_SYSERR, curr_lang[142], curr_lang[146], newsize); + free(line); + return (char *)0; + } + else + { + line = l; + curpos = line + lsize; + lsize = newsize; + end = line + lsize; + } + } + /* NOT REACHED */ +} + + +int set_hist_context(n) + int n; +{ + return 0; +} diff --git a/archie/clients/telnet/input.h b/archie/clients/telnet/input.h new file mode 100644 index 0000000..836f8a0 --- /dev/null +++ b/archie/clients/telnet/input.h @@ -0,0 +1,12 @@ +#ifndef INPUT_H +#define INPUT_H + +#include "ansi_compat.h" + + +extern char *readline PROTO((const char *prompt)); +extern int new_hist_context PROTO((void)); +extern int set_hist_context PROTO((int n)); +extern void add_history PROTO((const char *line)); + +#endif diff --git a/archie/clients/telnet/input.test b/archie/clients/telnet/input.test new file mode 100644 index 0000000..208f2ec --- /dev/null +++ b/archie/clients/telnet/input.test @@ -0,0 +1,61 @@ +set status +set max_split_size 30000 +set maxhits 15 + +set server java.cc.mcgill.ca +set search sub +find ntp +list ^c.*\.c[ah] +domains +set autologout 500 +set search subcase +find etc +servers +set search regex +find a.*[bc].*d$ +show +whatis xnlock + +set server archie.rutgers.edu +servers +list ^c.*\.c[ah] +manpage roff +set search regex +find a.*[bc].*d$ +domains +set autologout 500 +set search sub +find ntp +mail wheelan +whatis xnlock +set search subcase +find etc +show + +set server archie.sura.net +whatis xnlock +set search sub +find ntp +set search regex +find a.*[bc].*d$ +show +servers +domains +set autologout 500 +set search subcase +find etc +list ^c.*\.c[ah] + +set server java +set search regex +find a.*[bc].*d$ +show +set autologout 500 +whatis xnlock +servers +set search sub +find ntp +set search subcase +find etc +domains +list ^c.*\.c[ah] diff --git a/archie/clients/telnet/input2.test b/archie/clients/telnet/input2.test new file mode 100644 index 0000000..f4dd03a --- /dev/null +++ b/archie/clients/telnet/input2.test @@ -0,0 +1,19 @@ +set status +set max_split_size 30000 +set maxhits 15 + +set server archie.rutgers.edu +servers +list ^c.*\.c[ah] +manpage roff +set search regex +find a.*[bc].*d$ +domains +set autologout 500 +set search sub +find ntp +mail wheelan +whatis xnlock +set search subcase +find etc +show diff --git a/archie/clients/telnet/input3.test b/archie/clients/telnet/input3.test new file mode 100644 index 0000000..8057b62 --- /dev/null +++ b/archie/clients/telnet/input3.test @@ -0,0 +1,14 @@ +set status +set max_split_size 30000 +set maxhits 15 + +domains +mail wheelan +whatis xnlock +set search subcase +find etc +show + +set server archie.uqam.ca +whatis xnlock +set search sub diff --git a/archie/clients/telnet/lang.c b/archie/clients/telnet/lang.c new file mode 100644 index 0000000..c2a45b0 --- /dev/null +++ b/archie/clients/telnet/lang.c @@ -0,0 +1,3 @@ +#include "ansi_compat.h" + +const char **curr_lang = (const char **)0; diff --git a/archie/clients/telnet/lang.h b/archie/clients/telnet/lang.h new file mode 100644 index 0000000..eaeaf07 --- /dev/null +++ b/archie/clients/telnet/lang.h @@ -0,0 +1,8 @@ +#ifndef LANG_H +#define LANG_H + +extern const char **curr_lang; +extern const char *english[]; +extern const char *french[]; + +#endif diff --git a/archie/clients/telnet/list.c b/archie/clients/telnet/list.c new file mode 100644 index 0000000..5c60e69 --- /dev/null +++ b/archie/clients/telnet/list.c @@ -0,0 +1,204 @@ +#include +#include +#include "alarm.h" +#include "ansi_compat.h" +#include "archie.h" +#include "client_defs.h" +#include "defines.h" +#include "error.h" +#include "extern.h" +#include "fork_wait.h" +#include "lang.h" +#include "list.h" +#include "macros.h" +#include "misc.h" +#include "misc_ansi_defs.h" +#include "mode.h" +#include "pager.h" +#include "prosp.h" +#include "signals.h" +#include "style_lang.h" +#include "vars.h" + +#include "protos.h" + +/* + * + * + * Internal routines. + * + * + */ + + +static int do_list PROTO((char *arg, FILE *ofp, int nsrchs, int prt_status)); +static int fprint_list_item PROTO((FILE *ofp, VLINK item, int style)); + + +/* + verbose + binkley.cs.mcgill.ca 132.206.51.9 02:13 10 Jan 1993 +*/ + +static int fprint_list_item(ofp, item, style) + FILE *ofp; + VLINK item; + int style; +{ + char hostname[128]; + char tstr[64]; + + ptr_check(ofp, FILE, curr_lang[108], 0); + if ( ! item) + { + error(A_INTERR, curr_lang[108], curr_lang[147]); + return 0; + } + + aq_lhost(item, hostname, sizeof hostname); + + switch (style) + { + case MACHINE: + fprintf(ofp, curr_lang[148], hostname, attr_str(item, curr_lang[101])); + break; + + case TERSE: /*bug: unfinished*/ + fprintf(ofp, curr_lang[148], hostname, attr_str(item, curr_lang[103])); + break; + + case URL: + case SILENT: + case VERBOSE: /*bug: unfinished*/ + prosp_strftime(tstr, sizeof tstr, curr_lang[99], attr_str(item, curr_lang[101])); + fprintf(ofp, curr_lang[149], hostname, attr_str(item, curr_lang[103]), tstr); + break; + + default: + error(A_INTERR, curr_lang[150], curr_lang[109], style); + return 0; + } + return 1; +} + + +/* + * Do sorting by attribute other than site name (which the server does, + * anyway)? + */ + +static int do_list(arg, ofp, nsrchs, prt_status) + char *arg; + FILE *ofp; + int nsrchs; + int prt_status; +{ + char tmpstring[REG_EX_LEN]; + char srch_str[REG_EX_LEN]; /* copy search string into this for call */ + int ret = 0; + struct aquery arq; + + srch_str[0] = '\0'; + if (*arg != '^') /* bug: kludge, kludge!!! RE tells server it's a list command */ + { + strcpy(srch_str, curr_lang[151]); + } + strcat(srch_str, arg); + + sprintf(tmpstring,"(%s)", srch_str); + strcpy(srch_str, tmpstring); + + aq_init(&arq); + arq.host = get_var(V_SERVER); + arq.string = srch_str; + arq.query_type = AQ_SITELIST; + arq.flags = AQ_NOSORT; + + if (archie_query(&arq, prt_status) != PSUCCESS) + { + perrmesg((char *)0, 0, (char *)0); + } + else + { + VLINK r = arq.results; + int ostyle = VERBOSE; + + if ( ! r) /*bug: check no matches => r == 0*/ + { + fputs(curr_lang[115], nsrchs == 1 ? stdout : ofp); + } + else + { + strtoval(get_var(V_OUTPUT_FORMAT), &ostyle, style_list); + + fputs(curr_lang[28], ofp); + for (; r; r = r->next) + { + fprint_list_item(ofp, r, ostyle); + } + + /* bug: should free up VLINK structs here? */ + vllfree(arq.results); + ret = 1; + } + } + + return ret; +} + + + +/* + * + * + * External routines. + * + * + */ + + +int list_it(ac, av, ofp) + int ac; + char **av; + FILE *ofp; +{ + int ret = 0; + + ptr_check(av, char *, curr_lang[152], 0); + ptr_check(ofp, FILE, curr_lang[152], 0); + + mode_truncate_fp(ofp); + switch (fork_me(spin(), &ret)) + { + case (enum forkme_e)INTERNAL_ERROR: + return 0; + + case CHILD: + if (ac == 1 || ac == 2) + { + ret = do_list(ac == 1 ? ".*" : av[1], ofp, 1, spin()); + } + else + { + int i; + + for (i = 1; i < ac; i++) + { + fprintf(ofp, curr_lang[31], av[i]); + ret |= do_list(av[i], ofp, ac-1, spin()); + } + } + fork_return(ret); + break; + + case PARENT: + set_alarm(); + break; + + default: + error(A_INTERR, curr_lang[152], curr_lang[48]); + return 0; + } + + return ret; +} diff --git a/archie/clients/telnet/list.h b/archie/clients/telnet/list.h new file mode 100644 index 0000000..1bad7d6 --- /dev/null +++ b/archie/clients/telnet/list.h @@ -0,0 +1,9 @@ +#ifndef LIST_H +#define LIST_H + +#include "ansi_compat.h" + + +extern int list_it PROTO((int ac, char **av, FILE *ofp)); + +#endif diff --git a/archie/clients/telnet/macros.h b/archie/clients/telnet/macros.h new file mode 100644 index 0000000..86523d2 --- /dev/null +++ b/archie/clients/telnet/macros.h @@ -0,0 +1,22 @@ +#ifndef MACROS_H +#define MACROS_H + +#define CNTRL(c) ((c) & ~0x40) +#define INTERNAL_ERROR 100 /* for functions of enum type */ +#define LRTNC(c) ((c) | 0x40) +#define MAX_HOST_LEN 128 +#define MAX_STRING_LEN 2048 +#define MIN_TO_SEC(m) ((unsigned int)((m)*60)) +#define WHITE_SPACE "\t " +#define is_dot_or_dotdot(s) (s[0] == '.' && (s[1] == '\0' || (s[1] == '.' && s[2] == '\0'))) +#define max(a, b) ((a) > (b) ? (a) : (b)) +#define min(a, b) ((a) < (b) ? (a) : (b)) +#define streq(a, b) (*a == *b && strcmp(a, b) == 0) /* a little speedup *//*bug: inc. string.h*/ + +#ifdef MULTI_LING +# define FRENCH(s) s +#else +# define FRENCH(s) ((const char *)0) +#endif + +#endif diff --git a/archie/clients/telnet/mail.c b/archie/clients/telnet/mail.c new file mode 100644 index 0000000..8234a5c --- /dev/null +++ b/archie/clients/telnet/mail.c @@ -0,0 +1,263 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include "ansi_compat.h" +#include "client_defs.h" +#include "error.h" +#include "extern.h" +#include "lang.h" +#include "macros.h" +#include "master.h" /* get_archie_hostname() */ +#include "mail.h" +#include "mail_lang.h" +#include "misc.h" +#include "misc_ansi_defs.h" +#include "vars.h" + +#include "protos.h" + +/* + * + * + * Internal routines. + * + * + */ + + +static const char *std_mail_time PROTO((void)); +static const char *tzstr PROTO((long offset)); + + +static const char *tzstr(offset) + long offset; /* in seconds */ +{ + if (offset == 0) + { + return "GMT"; + } + else + { + static char timestr[64]; + int tz_hr_diff = abs(offset) / (60 * 60); + int tz_min_diff = (abs(offset) / 60) % 60; + + sprintf(timestr, "%c%02d%02d", + offset < 0 ? '-' : '+', + tz_hr_diff, + tz_min_diff); + return timestr; + } +} + + +static const char *std_mail_time() +{ + char timestr[64]; + static char finalstr[64]; + struct tm *tptr; + time_t t; +#if defined(AIX) || defined(SOLARIS) + extern long timezone; +#endif + + t = time((time_t *)0); + tptr = localtime(&t); + sprintf(timestr, "%s, %d %s %d %02d:%02d", + days[tptr->tm_wday], + tptr->tm_mday, + months[tptr->tm_mon], + tptr->tm_year, + tptr->tm_hour, + tptr->tm_min + ); + sprintf(finalstr, "%s %s", timestr, + +#if !defined(AIX) && !defined(SOLARIS) + tzstr(tptr->tm_gmtoff) +#else + tzstr(timezone * (long)(-timezone_sign())) +#endif + ); + + return finalstr; +} + + +/* + * + * + * External routines. + * + * + */ + + +/* + * Construct a special information header containing a standard (RFC822) + * header, and send it, along with the output data, to a special port. + */ + +int mail_it(ac, av, old_cmd, mfp) + int ac; + char **av; + const char *old_cmd; + FILE *mfp; +{ + FILE *ofp; + char buffer[INPUT_LINE_LEN]; + char hname[MAXHOSTNAMELEN+1]; + const char *compress; + const char *encode; + const char *maddr; + const char *mail_service; + int ofd; + struct servent *servp; + + ptr_check(av, char *, curr_lang[153], 0); + + switch (ac) + { + case 1: + if (is_set(V_MAILTO)) + { + maddr = get_var(V_MAILTO); + } + else + { + printf(curr_lang[155]); + return 0; + } + break; + + case 2: + maddr = av[1]; + break; + + default: + printf(curr_lang[156], av[0]); + return 0; + } + + if ( ! mfp || ! *old_cmd) + { + printf(curr_lang[157]); + return 0; + } + + /* + * Check whether there is actually anything to mail. + */ + rewind_fp(mfp); + if (fempty(mfp)) + { + printf("# There is no output to mail.\n"); /*FFF*/ + return 0; + } + + if ( ! (compress = get_var(V_COMPRESS))) + { + compress = curr_lang[158]; + } + if ( ! (encode = get_var(V_ENCODE))) + { + encode = curr_lang[158]; + } + if (strcmp(compress, curr_lang[158]) != 0 && strcmp(encode, curr_lang[158]) == 0) + { + printf(curr_lang[159]); + return 0; + } + + mail_service = get_var(V_MAIL_SERVICE); + if (isdigit(*mail_service)) + { + int port = atoi(mail_service); + + if (port == 0) + { + error(A_ERR, curr_lang[153], curr_lang[160], mail_service); + return 0; + } + if ( ! (servp = getservbyport((int)htonl((unsigned long)port), (char *)0))) + { + error(A_INTERR, curr_lang[153], curr_lang[161], mail_service); + return 0; + } + } + else + { + if ( ! (servp = getservbyname(mail_service, (char *)0))) + { + error(A_INTERR, curr_lang[153], curr_lang[161], mail_service); + return 0; + } + } + + get_archie_hostname(hname, sizeof hname); + + /* bug: does cliconnect do dotted decimal? */ + if (cliconnect(get_var(V_MAIL_HOST), servp->s_port, &ofd) != A_OK) /*bug: fix defn.*/ + { + error(A_INTERR, curr_lang[153], curr_lang[162], get_var(V_MAIL_HOST)); + return 0; + } + + if ( ! (ofp = fdopen(ofd, curr_lang[92]))) + { + error(A_ERR, curr_lang[153], curr_lang[163]); + close(ofd); + return 0; + } + + /* + Create the informational header. + */ + + fprintf(ofp, curr_lang[164]); + fprintf(ofp, curr_lang[165], old_cmd); + fprintf(ofp, curr_lang[166], compress); + fprintf(ofp, curr_lang[167], encode); + fprintf(ofp, curr_lang[168], atoi(get_var(V_MAX_SPLIT_SIZE))); + fprintf(ofp, curr_lang[169]); + + /* + Create the mail header. + */ + + fprintf(ofp, curr_lang[170], maddr); + fprintf(ofp, curr_lang[171], get_var(V_MAIL_FROM), hname); + fprintf(ofp, curr_lang[172], get_var(V_MAIL_FROM), hname); + fprintf(ofp, curr_lang[173], std_mail_time()); + fprintf(ofp, curr_lang[326]); + +/* to disable the vacation program by setting Precedence: junk in the + header of the mail 950807*/ + + fprintf(ofp, curr_lang[174]); + + /* snarf 'n barf the results */ + + while (fgets(buffer, sizeof buffer, mfp)) + { + if (fputs(buffer, ofp) == EOF) + { + error(A_SYSERR, curr_lang[153], curr_lang[196]); + fclose(ofp); + return 0; + } + } + fclose(ofp); + if (ferror(mfp)) + { + error(A_SYSERR, curr_lang[153], curr_lang[197]); + return 0; + } + + return 1; +} diff --git a/archie/clients/telnet/mail.h b/archie/clients/telnet/mail.h new file mode 100644 index 0000000..8c04ad9 --- /dev/null +++ b/archie/clients/telnet/mail.h @@ -0,0 +1,6 @@ +#ifndef MAIL_H +#define MAIL_H + +extern int mail_it PROTO((int ac, char **av, const char *old_cmd, FILE *mfp)); + +#endif diff --git a/archie/clients/telnet/mail_lang.h b/archie/clients/telnet/mail_lang.h new file mode 100644 index 0000000..e43482d --- /dev/null +++ b/archie/clients/telnet/mail_lang.h @@ -0,0 +1,4 @@ +static const char *days[] = + { "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" }; +static const char *months[] = + { "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" }; diff --git a/archie/clients/telnet/make_strings b/archie/clients/telnet/make_strings new file mode 100755 index 0000000..d84de96 --- /dev/null +++ b/archie/clients/telnet/make_strings @@ -0,0 +1,28 @@ +#!/bin/sh -u +prog=`basename $0` +if [ $# -lt 2 ] ; then + echo "Usage: $prog ..." + exit 0 +fi +lang=$1; shift + +strout=${lang}-language-strings.c + +> .htab ; > $strout +(echo '#include "ansi_compat.h"'; echo "const char *${lang}[] ="; echo "{"; echo "") >> $strout + +n=0 +for f in $* ; do + (echo "/* ==================== $f ==================== */" ; echo "") \ + >> ${strout} + cstrex -index $n -replace "curr_lang[%d]" \ + -define '\t/* %5d */\t"%s",\n' -deffile ${strout} \ + -inhash .htab -outhash .htab < $f > lang-indep-$f + echo "" >> ${strout} + n=`tail -7 ${strout} | \ + sed -n 's;^.*/\*[ ]*\([0-9][0-9]*\).*$;\1;p' | \ + tail -1` + n=`expr $n + 1` +done +echo "};" >> ${strout} +exit 0 diff --git a/archie/clients/telnet/misc.c b/archie/clients/telnet/misc.c new file mode 100644 index 0000000..03d1b42 --- /dev/null +++ b/archie/clients/telnet/misc.c @@ -0,0 +1,800 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "client_defs.h" +#include "defines.h" +#include "error.h" +#include "extern.h" +#include "lang.h" +#include "macros.h" +#include "misc.h" +#include "misc_ansi_defs.h" +#include "mode.h" +#include "prosp.h" +#include "times.h" /* cvt_to_inttime() */ +#include "unixcompat.h" +#include "vars.h" + +#include "protos.h" + +static const char *getstr PROTO((const char *s, int len)); +static const char *skip_blanks PROTO((const char *s)); +static char *make_lcase PROTO((char *s)); +static int char_in_str PROTO((int c, const char *s)); +static int rstrspn PROTO((const char *s, const char *span)); +static void fmt PROTO((FILE *ofp, const char *s, int indent, int len)); + + +/* + * Return the ASCII value of a Prospero attribute. + */ + +const char *attr_str(vl, astr) + VLINK vl; + const char *astr; +{ + PATTRIB p; + + for (p = vl->lattrib; p; p = p->next) + { + if ( ! strcmp(astr, p->aname)) + { + return p->value.sequence->token; + } + } + return curr_lang[179]; +} + + +/* ------------------------------------------------------------------------ */ + +/* + * Test whether the character, `c', is in the set of characters, `s'. + * Return 1 if it is, 0 otherwise. + * + * If `c' is '\0', then 0 will be returned. + */ + +static int char_in_str(c, s) + int c; + const char *s; +{ + if (c == '\0') return 0; + do + { + if (c == *s) return 1; + } + while (*++s); + return 0; +} + + +/* + * Like `strspn', but in reverse. + * + * Return the length of the longest sequence of characters, starting from + * the end of `s' and proceeding to the left, which all belong to the set + * `scan'. + */ + +static int rstrspn(s, span) + const char *s; + const char *span; +{ + const char *e; + int count = 0; + + e = s + strlen(s) - 1; + while (e >= s && char_in_str(*e, span)) + { + count++; --e; + } + return count; +} + + +int bracketstr(s, start, end) + const char *s; + const char **start; + const char **end; +{ + *start = s + strspn(s, WHITE_SPACE); + *end = s + strlen(s) - rstrspn(s, WHITE_SPACE); + return 1; +} + + +/* ------------------------------------------------------------------------ */ + +static const char *skip_blanks(s) + const char *s; +{ + while (*s && *s == ' ') s++; + return s; +} + + +/* + * Find the longest substring of `s', whose length is less than or equal to + * `len', and whose last character precedes a space or nul. + * + * Also, skip over leading blanks in `s'. + */ + +static const char *getstr(s, len) + const char *s; + int len; +{ + char oc = '\0'; + const char *p; + const char *sp = s; + int n = 0; + + for (p = s; *p; p++) + { + if (*p == ' ' && oc != ' ') sp = p; + n++; + if (n >= len) return sp == s ? p : sp; + oc = *p; + } + return p; +} + +static void fmt(ofp, s, indent, len) + FILE *ofp; + const char *s; + int indent; + int len; +{ + const char *last; + const char *p; + int i; + + s = skip_blanks(s); + if ( ! *s) + { + fputc('\n', ofp); + } + else + { + last = getstr(s, len - indent); + for (p = s; *p && p <= last; p++) fputc(*p, ofp); + fputc('\n', ofp); + + while (*last) + { + if ( ! *(s = skip_blanks(last + 1))) + { + return; + } + + last = getstr(s, len - indent); + for (i = 0; i < indent; i++) fputc(' ', ofp); + for (p = s; *p && p <= last; p++) fputc(*p, ofp); + fputc('\n', ofp); + } + } +} + + +/* + * Print a string as a series of lines, each of which is indented (i.e. + * prefixed by spaces) by a specified amount. Assume the first line is + * already indented. + */ +void fmtprintf(ofp, pfix, sfix, len) + FILE *ofp; + const char *pfix; + const char *sfix; + int len; +{ + fputs(pfix, ofp); + fmt(ofp, sfix, (int)strlen(pfix), len); +} + + +/* ------------------------------------------------------------------------ */ + +#define QCHAR '"' + +/* + * If a string both begins and ends with a quote character it is assumed to + * be a quoted string, and they are both stripped off, otherwise the string + * remains unchanged. (Note: a single quote is left unchanged.) + */ + +int dequote(qs) + char *qs; +{ + char *end; + int i; + int len; + + ptr_check(qs, char, curr_lang[181], 0); + + if (*qs == '\0') return 1; + len = strlen(qs); + if (len == 1) return 1; /* implies " is left unchanged */ + end = qs + len - 1; /* end point to the last character */ + if (*qs == QCHAR && *end == QCHAR) + { + for(i = 0; i < len - 1; i++) qs[i] = qs[i+1]; + qs[i-1] = '\0'; + } + return 1; +} + + +void dir_file(path, dir, file) + const char *path; + char **dir; + char **file; +{ + const char *sl; + + if ( ! (sl = strrchr(path, '/'))) + { + if (dir) *dir = strdup("."); + if (file) *file = strdup(path); + } + else + { + if (dir) *dir = strndup(path, sl - path); + if (file) *file = strdup(sl+1); + } +} + + +void fprint_srch_restrictions(fp) + FILE *fp; +{ + int first = 1; + + if (is_set(V_SEARCH)) + { + fprintf(fp, curr_lang[320], get_var(V_SEARCH)); + first = 0; + } + if (is_set(V_MATCH_DOMAIN)) + { + fprintf(fp, curr_lang[321], first ? "# " : ", ", get_var(V_MATCH_DOMAIN)); + first = 0; + } + if (is_set(V_MATCH_PATH)) + { + fprintf(fp, curr_lang[322], first ? "# " : ", ", get_var(V_MATCH_PATH)); + first = 0; + } + if ( ! first) + { + fputs(".\n", fp); + fflush(fp); + } +} + + +const char *get_home_dir_by_name(name) + const char *name; +{ + struct passwd *p = getpwnam(name); + + if (p) + { + return p->pw_dir; + } + else + { + return (const char *)0; + } +} + + +const char *get_home_dir_by_uid(uid) + int uid; +{ + struct passwd *p = getpwuid(uid); + + if (p) + { + return p->pw_dir; + } + else + { + return (const char *)0; + } +} + + +char *head(path, buf, bufsize) + const char *path; + char *buf; + int bufsize; +{ + const char *s = strrchr(path, '/'); + + if ( ! s) + { + *buf = '\0'; + return buf; + } + else + { + int l = min(bufsize, s - path); + + if (l == 0) + { + strcpy(buf, curr_lang[98]); + } + else + { + strncpy(buf, path, (unsigned)l); + buf[l] = '\0'; + } + return buf; + } +} + + +char *make_lcase(s) + char *s; +{ + char *p; + + for (p = s; *p; p++) + { + if (isascii(*p) && isupper(*p)) *p = tolower(*p); + } + return s; +} + + +const char *now() +{ + static char tbuf[64]; + time_t c = time((time_t *)0); + struct tm *t = localtime(&c); + strftime(tbuf, sizeof tbuf, "%T", t); + return tbuf; +} + + +/* + * Replace the newline in 'line' (if it occurs) with '\0'. + */ + +void nuke_newline(line) + char *line; +{ + char *nl; + + if ( ! line) + { + error(A_INTERR, curr_lang[182], curr_lang[183]); + return; + } + if ((nl = strrchr(line, '\n'))) + { + *nl = '\0'; + } +} + + +int fempty(fp) + FILE *fp; +{ + struct stat s; + + if (fstat(fileno(fp), &s) == -1) + { + error(A_SYSERR, "fempty", "fstat() failed on fd %d", fileno(fp)); /*FFF*/ + return 1; /*bug: what else?*/ + } + return s.st_size == 0; +} + + +int fprint_file(ofp, fname, quietly) + FILE *ofp; + const char *fname; + int quietly; +{ + FILE *ifp; + + if ( ! fname) + { + error(A_INTERR, "fprint_file", "file name argument is null"); + return 0; + } + + if ((ifp = fopen(fname, curr_lang[44]))) + { + int ret = fprint_fp(ofp, ifp); + fclose(ifp); + return ret; + } + else if ( ! quietly) + { + error(A_SYSERR, "fprint_file", "fopen() failed to open `%s'", fname); + } + + return 0; +} + + +int fprint_fp(ofp, ifp) + FILE *ofp; + FILE *ifp; +{ + char line[INPUT_LINE_LEN]; + + rewind_fp(ifp); + while (fgets(line, sizeof line, ifp)) + { + if (fputs(line, ofp) == EOF) + { + error(A_SYSERR, "fprint_fp", "fputs() failed"); /* FFF */ + return 0; + } + } + fflush(ofp); + if (ferror(ifp)) + { + error(A_SYSERR, "fprint_fp", "error from fgets()"); /* FFF */ + return 0; + } + + return 1; +} + + +/* ------------------------------------------------------------------------ */ + +/* + * Like strftime(), but pass it a Prospero time string, instead. + */ + +int prosp_strftime(buf, bufsize, fmt, prosp_time) + char *buf; + int bufsize; + const char *fmt; + const char *prosp_time; +{ + struct tm *tlocal; + time_t tt; + + ptr_check(buf, char, curr_lang[190], 0); + ptr_check(fmt, const char, curr_lang[190], 0); + ptr_check(prosp_time, const char, curr_lang[190], 0); + + if ( ! (tt = cvt_to_inttime(prosp_time, 0 /* time in GMT */))) + { + derror((A_INTERR, curr_lang[108], curr_lang[191], prosp_time)); + strcpy(buf, curr_lang[192]); + return 0; + } + tlocal = localtime(&tt); + return strftime(buf, bufsize, fmt, tlocal); +} + + +/* ------------------------------------------------------------------------ */ + +int mode_truncate_fp(fp) + FILE *fp; +{ + fflush(fp); + return current_mode() == M_EMAIL ? 1 : truncate_fp(fp); +} + + +int rewind_fp(fp) + FILE *fp; +{ + fflush(fp); + rewind(fp); + return 1; +} + + +int spin() +{ + return current_mode() != M_EMAIL && is_set(V_STATUS); +} + + +int truncate_fp(fp) + FILE *fp; +{ + if (ftruncate(fileno(fp), (off_t)0) == -1) + { + error(A_SYSERR, "truncate_fp", "ftruncate() failed"); /*FFF*/ + return 0; + } + return 1; +} + + +/* + * Rewrite 'str' in place so that all leading and trailing whitespace is + * removed and all other whitespace is replaced with a single space. + * + * Return -1 upon an error, otherwise return the number of "words" in the + * string. (A word is a sequence of non-whitespace characters.) + */ + +char *squeeze_whitespace(str) + char *str; +{ + char *rd; + char *wr; + int in_word; + + if ( ! str) + { + error(A_INTERR, curr_lang[198], curr_lang[199]); + return (char *)0; + } + + rd = wr = str; + while (isspace((int)*rd)) rd++; /* skip leading whitespace */ + in_word = 1; + + while (*rd != '\0') + { + if (isspace((int)*rd)) + { + rd++; + in_word = 0; + } + else + { + if ( ! in_word) + { + in_word = 1; + *wr++ = ' '; + } + *wr++ = *rd++; + } + } + + *wr = '\0'; + return str; +} + + +/* + * Translate each `fromc' in `s' to a `toc'. + */ + +char *strxlate(s, fromc, toc) + char *s; + int fromc; + int toc; +{ + char *p; + + for (p = s; *p; p++) + { + if (*p == fromc) + { + *p = toc; + } + } + return s; +} + + +#ifndef P5_WHATIS +/* + * The following two routines implement the case-sensitive and case- + * insensitive substring search. + */ + +#define TABLESIZE 256 + +static char *pat = (char *)0; +static int nocase; +static int plen; +static int plen_1; +static int skiptab[TABLESIZE]; + +int initskip(pattern, len, ignore_case) + const char *pattern; + int len; + int ignore_case; +{ + int i; + + plen = len; + plen_1 = plen - 1; + + nocase = ignore_case; + + if (pat == (char *) 0) + { + if ((pat = (char *) malloc((unsigned) (plen + 1))) == (char *) 0) + { + error(A_ERR, curr_lang[200], curr_lang[201], + plen + 1); + return 0; + } + } + else + { + if ((pat = (char *) realloc(pat, (unsigned) (plen + 1))) == (char *) 0) + { + error(A_ERR, curr_lang[200], curr_lang[202], + plen + 1); + return 0; + } + } + + memcpy(pat, pattern, (unsigned)(plen + 1)); + + if (ignore_case) make_lcase(pat); + + for (i = 0; i < TABLESIZE; i++) + skiptab[i] = plen; + + for (i = 0; i < plen; i++) + { + skiptab[(int)*(pat + i)] = plen - 1 - i; + } + + return 1; +} + + +int strfind(txt, tlen) + const char *txt; + int tlen; +{ + int pc; + int skip; + int tc; + unsigned char tchar; + + if (tlen < plen) + return 0; + + pc = tc = plen_1; + + do + { + tchar = *(txt + tc); + if (nocase) + { + if (isascii((int) tchar) && isupper((int) tchar)) + { + tchar = (char) tolower((int) tchar); + } + } + + if (tchar == (unsigned char /*why aren't they the same?*/)*(pat + pc)) + { + --pc; + --tc; + } + else + { + skip = skiptab[tchar]; + tc += (skip < plen_1 - pc) ? plen : skip; + pc = plen_1; + } + } + while (pc >= 0 && tc < tlen); + + return pc < 0; +} +#endif + + +int install_term(ac, av) + int ac; + char **av; +{ + if (ac < 2) + { + printf(curr_lang[203], av[0]); + return 0; + } + else + { + char term[256]; + int i; + + term[0] = term[1] = '\0'; /*bug: kludge*/ + for(i = 1; i < ac; i++) + { + strcat(term, curr_lang[57]); + strcat(term, av[i]); + } + + return set_var(V_TERM, term + 1); /*bug: kludge*/ + } +} + + +/* ------------------------------------------------------------------------ */ + + +/* + * Two routines to convert between strings and their corresponding values, + * as defined by the StrVal structure. + */ + +int strtoval(str, val, sv) + const char *str; + int *val; + StrVal *sv; +{ + StrVal *s = sv; + + if ( ! str || ! val || ! sv) + { + return 0; + } + + for (s = sv; s->str != (const char *)0; s++) + { + if (strcmp(str, s->str) == 0) + { + *val = s->val; + return 1; + } + } + return 0; +} + + +int valtostr(val, str, sv) + int val; + const char **str; + StrVal *sv; +{ + StrVal *s = sv; + + if ( ! str || ! sv) + { + return 0; + } + + for (s = sv; s->str != (const char *)0; s++) + { + if (s->val == val) + { + *str = s->str; + return 1; + } + } + return 0; +} + + +int chroot_for_exec(dir) + const char *dir; +{ + return (regain_root() && + chdir(dir) != -1 && + chroot(".") != -1 && + setuid(getuid()) != -1); +} + + +/* + * Actually, just checks whether or not our effective uid is the same as our + * real uid. (I.e. may fail if we are suid foo, and are started by foo.) + */ +int we_are_suid() +{ + return getuid() != geteuid(); +} diff --git a/archie/clients/telnet/misc.h b/archie/clients/telnet/misc.h new file mode 100644 index 0000000..639c44e --- /dev/null +++ b/archie/clients/telnet/misc.h @@ -0,0 +1,56 @@ +#ifndef MISC_H +#define MISC_H + +#include +#include +#include +#include "ansi_compat.h" +#include "prosp.h" + + +typedef struct +{ + const char *str; + const int val; +} StrVal; + + +extern char *getProspMOTD PROTO((const char *server)); +extern char *head PROTO((const char *path, char *buf, int bufsize)); +extern char *squeeze_whitespace PROTO((char *str)); +extern char *strndup PROTO((const char *s, int n)); +extern char *strxlate PROTO((char *s, int fromc, int toc)); +extern const char *attr_str PROTO((VLINK vl, const char *astr)); +extern const char *get_home_dir_by_name PROTO((const char *name)); +extern const char *get_home_dir_by_uid PROTO((int uid)); +extern const char *now PROTO((void)); +extern int bracketstr PROTO((const char *s, const char **start, const char **end)); +extern int chroot_for_exec PROTO((const char *dir)); +extern int dequote PROTO((char *qs)); +extern int fempty PROTO((FILE *fp)); +extern int fprint_file PROTO((FILE *ofp, const char *fname, int quietly)); +extern int fprint_fp PROTO((FILE *ofp, FILE *ifp)); +extern int fprintfProspMOTD PROTO((FILE *ofp, const char *server)); +#ifndef P5_WHATIS +extern int initskip PROTO((const char *pattern, int len, int ignore_case)); +#endif +extern int install_term PROTO((int ac, char **av)); +extern int mode_truncate_fp PROTO((FILE *fp)); +extern int prosp_strftime PROTO((char *buf, int bufsize, const char *fmt, const char *prosp_time)); +extern int rewind_fp PROTO((FILE *fp)); +extern int spin PROTO((void)); +extern int swap_reuid PROTO((void)); +extern int truncate_fp PROTO((FILE *fp)); +#ifndef P5_WHATIS +extern int strfind PROTO((const char *txt, int tlen)); +#endif +extern int strtoval PROTO((const char *str, int *val, StrVal *sv)); +extern int valtostr PROTO((int val, const char **str, StrVal *sv)); +extern int we_are_suid PROTO((void)); +extern void dir_file PROTO((const char *path, char **dir, char **file)); +extern void fmtprintf PROTO((FILE *ofp, const char *pfix, const char *sfix, int len)); +extern void fprint_srch_restrictions PROTO((FILE *fp)); +extern void freeProspMOTD PROTO((char *s)); +extern void nuke_newline PROTO((char *line)); + +#endif diff --git a/archie/clients/telnet/misc_ansi_defs.h b/archie/clients/telnet/misc_ansi_defs.h new file mode 100644 index 0000000..d7771f2 --- /dev/null +++ b/archie/clients/telnet/misc_ansi_defs.h @@ -0,0 +1,12 @@ +#ifndef MISC_ANSI_DEFS +#define MISC_ANSI_DEFS + +#include +#include +#include +#include +#include +#include "ansi_compat.h" +#include "archie_inet.h" /* for con_status_t */ + +#endif diff --git a/archie/clients/telnet/mode.c b/archie/clients/telnet/mode.c new file mode 100644 index 0000000..e1eb80c --- /dev/null +++ b/archie/clients/telnet/mode.c @@ -0,0 +1,62 @@ +#include "error.h" +#include "lang.h" +#include "misc.h" +#include "mode.h" + + +#include "mode_lang.h" + + +static int mode = M_SYS_RC; /* the current mode */ + + +int current_mode() +{ + return mode; +} + + +const char *mode_str(m) + int m; +{ + const char *s; + + switch (m) + { + case M_SYS_RC: + case M_USER_RC: + case M_EMAIL: + case M_INTERACTIVE: + valtostr(m, &s, mode_strings); + return s; + + case M_NONE: + return curr_lang[205]; + + default: + return curr_lang[206]; + } +} + + +int set_mode(m) + int m; +{ + switch (m) + { + case M_SYS_RC: + case M_USER_RC: + case M_EMAIL: + case M_INTERACTIVE: + case M_NONE: + mode = m; + break; + + default: + mode = M_INTERACTIVE; + error(A_INTERR, curr_lang[207], curr_lang[208], m, mode_str(mode)); + break; + } + + return mode; +} diff --git a/archie/clients/telnet/mode.h b/archie/clients/telnet/mode.h new file mode 100644 index 0000000..475ca33 --- /dev/null +++ b/archie/clients/telnet/mode.h @@ -0,0 +1,22 @@ +#ifndef MODE_H +#define MODE_H + +#include "ansi_compat.h" + + +#define M_EMAIL 0x01 +#define M_HELP 0x02 +#define M_INTERACTIVE 0x04 +#define M_SYS_RC 0x08 +#define M_USER_RC 0x10 +#define M_NONE 0x20 + +/*bug: should change name with addition of HELP*/ +#define M_ALL (M_SYS_RC | M_USER_RC | M_EMAIL | M_INTERACTIVE) +#define M_EIU (M_EMAIL | M_INTERACTIVE | M_USER_RC) + +extern const char *mode_str PROTO((int m)); +extern int current_mode PROTO((void)); +extern int set_mode PROTO((int m)); + +#endif diff --git a/archie/clients/telnet/mode_lang.h b/archie/clients/telnet/mode_lang.h new file mode 100644 index 0000000..08e5853 --- /dev/null +++ b/archie/clients/telnet/mode_lang.h @@ -0,0 +1,16 @@ +#include "macros.h" + + +static StrVal mode_strings[] = +{ + { "e-mail", M_EMAIL }, + { "interactive", M_INTERACTIVE }, + { "system rc", M_SYS_RC }, + { "user rc", M_USER_RC }, + + { FRENCH("courrier \351lectronique"), M_EMAIL }, + { FRENCH("interactif"), M_INTERACTIVE }, + { FRENCH("initialisation syst\350me"), M_SYS_RC }, + { FRENCH("initialisation usager"), M_USER_RC }, + { (const char *)0, 0 } +}; diff --git a/archie/clients/telnet/pager.c b/archie/clients/telnet/pager.c new file mode 100644 index 0000000..bf167d7 --- /dev/null +++ b/archie/clients/telnet/pager.c @@ -0,0 +1,155 @@ +#include +#include +#include +#include +#include +#include +#ifdef __STDC__ +#include +#endif +#ifndef AIX +#include +#else +#include +#endif +#ifdef __STDC__ +#include +#endif +#include "defines.h" +#include "debug.h" +#include "error.h" +#include "extern.h" +#include "files.h" /* for tail() in library */ +#include "fork_wait.h" +#include "lang.h" +#include "misc.h" +#include "misc_ansi_defs.h" +#include "pager.h" +#include "prosp.h" +#include "terminal.h" /*bug: debugging*/ +#include "vars.h" + +#include "protos.h" + +extern char **environ; + + +/* + * Exec the pager. + */ + +int pager(file_name) + const char *file_name; +{ + FILE *ifp; + int ret = 0; + + if ( ! (ifp = fopen(file_name, "r"))) + { + error(A_SYSERR, curr_lang[111], curr_lang[214]); + sleep(2); + } + else + { + ret = pager_fp(ifp); + fclose(ifp); + } + + return ret; +} + + +/* + * Exec the pager, directing `fp' to its stdin. + * + * **** WARNING! **** + * + * Since the child invokes an external program its return value is zero upon + * success and non-zero upon failure. It is up to the parent (see the case + * label PARENT) to reverse this. + */ +int pager_fp(fp) + FILE *fp; +{ + int ret = 1; + + ptr_check(fp, FILE, "pager_fp", 0); + + rewind_fp(fp); + if ( ! fempty(fp)) + { + switch (fork_me(0, &ret)) + { + case (enum fork_me_e)INTERNAL_ERROR: + ret = 0; + break; + + case CHILD: + { + const char *ppath; + + if ( ! (ppath = get_var(V_PAGER_PATH))) + { + error(A_INTERR, "pager_fp", curr_lang[216], V_PAGER_PATH); + } + else + { + const char *p = get_var(V_PAGER_OPTS); + + /* + * bug: if we're running setuid root the pager will not be able to + * open /dev/tty. However, in this case we just happen to know + * that our version of `less' will fall back to using file + * descriptor 2 (?!). + */ + dup2(0, 2); + + dup2(fileno(fp), 0); + + /* less doesn't like an empty string as an argument */ + if (p && ! *p) p = 0; + + if (getuid() != 0) + { + DBG(uids("pager_fp: non-chroot: "); sleep(5);); + execlp(ppath, tail(ppath), p, (char *)0, environ); + error(A_SYSERR, "pager_fp", curr_lang[217], ppath); + } + else + { + /* + * From the pager path we need the directory to which to + * chroot() and the name of the pager executable. + */ + DBG(uids("pager_fp: pre-chroot_for_exec: ");); + if ( ! chroot_for_exec("pager")) + { + error(A_SYSERR, "pager_fp", "can't change to '%s'", "pager"); /*FFF*/ + exit(1); /* paranoid or cautious? :-) */ + } + DBG(uids("pager_fp: post-chroot_for_exec: "); sleep(5);); + /* bug! */ + { + const char *q; + ppath = (q = strchr(ppath, '/')) ? q+1 : ppath; + } + execlp(ppath, tail(ppath), p, (char *)0); + error(A_SYSERR, "pager_fp", curr_lang[217], ppath); + } + } + } + fork_return(ret); + + case PARENT: + ret = ! ret; /* Convert exit status to return value. */ + break; + + default: + error(A_INTERR, curr_lang[152], curr_lang[48]); + ret = 0; + } + } + + return ret; +} + diff --git a/archie/clients/telnet/pager.h b/archie/clients/telnet/pager.h new file mode 100644 index 0000000..316eafa --- /dev/null +++ b/archie/clients/telnet/pager.h @@ -0,0 +1,10 @@ +#ifndef PAGER_H +#define PAGER_H + +#include + + +extern int pager PROTO((const char *file_name)); +extern int pager_fp PROTO((FILE *fp)); + +#endif diff --git a/archie/clients/telnet/parchie.h b/archie/clients/telnet/parchie.h new file mode 100644 index 0000000..ebc56fd --- /dev/null +++ b/archie/clients/telnet/parchie.h @@ -0,0 +1,167 @@ +/* + * Copyright (c) 1993 by the University of Southern California + * + * For copying and distribution information, please see the file + * "usc-copyr.h". + * + * Written by bcn 2/15/93 definitions for archie API + * + * Added extra search types & `dbs' field to aquery structure. + * - wheelan Fri May 28 22:52:29 EDT 1993 + */ + +#include "usc-copyr.h" + +/* + * Known archie servers: Server Prospero Version and comments + * archie.rutgers.edu v5 + * archie.sura.net v1 + * archie.sura.net(1528) v5 - for burn in period only + * archie.ans.net + * archie.unl.edu + * archie.au + * archie.funet.fi + * archie.sogang.ac.kr v5 + * archie.doc.ic.ac.uk + * archie.ncu.edu.tw + * archie.kyoto-u.ac.jp v5 + */ +#define ARCHIE_HOST "archie.rutgers.edu" + +/* + * Default value for max hits. Note that this is normally different + * for different client implementations. Doing so makes it easier to + * collect statistics on the use of the various clients. + */ +#define AQ_MAX_HITS 100 +#define AQ_MAX_MATCH 100 +#define AQ_MAX_HITSPM 100 + +/* + * CLIENT_VERSION may be used to identify the version of the client if + * distributed separately from the Prospero distribution. The version + * command should then identify both the client version and the Prospero + * version identifiers. Note that this identifier is not sent across + * the network. You MUST also obtain a software identifier from + * info-prospero@isi.edu, and set PFS_SW_ID in pfs.h. + * + * #define CLIENT_VERSION "xyz" + */ + +struct aquery /* ** means opaque */ +{ + char *host; /* Archie server w/ opt port */ + char *string; /* String to be matched */ + char *dbs; /* Databases to search */ + struct filter *filters; /* Path or domain restrictions */ + VLINK expand; /* Links to be expanded */ + int maxhits; /* Max entries to return */ + int maxmatch; /* Max strings to match */ + int maxhitpm; /* Max hits per match */ + int offset; /**Where to start search (opaque) */ + char query_type; /* Search type - see above */ + int (*cmp_proc)(); /* Comp procedure for sorting */ + int flags; /* Options - see above */ + VLINK results; /* The results of the query */ + char *motd; /* Motd from server */ + int qpos; /* Service queue pos if available */ + int sys_time; /* Expected time til svc complete */ + struct timeval retry_at; /* Time for retry */ + int wait_fd; /* FD on which waiting */ + struct vdir dirst; /**For directory query */ + VLINK dirquery; /**Args to directory query */ + int status; /* Status of query */ +}; + +#define AQFASTCOMP /* Make assumptions about server to quicken DEFCMP */ + +/* Query types - search = return hits, match = return strings */ +#define AQ_EXACT '=' /* Exact string search */ +#define AQ_CI_SUBSTR 'S' /* Case insensitive substring search */ +#define AQ_CS_SUBSTR 'C' /* Case sensitive substring search */ +#define AQ_REGEX 'R' /* Regular expression search */ +#define AQ_ECI_SUBSTR 's' /* Exact or case insensitive sub srch */ +#define AQ_ECS_SUBSTR 'c' /* Exact or case sensitive sub search */ +#define AQ_EREGEX 'r' /* Exact or regular expression search */ +#define AQ_M_CI_SUBSTR 'Z' /* Case insensitive substring match */ +#define AQ_M_CS_SUBSTR 'K' /* Case sensitive substring match */ +#define AQ_M_REGEX 'X' /* Regular expression match */ +#define AQ_M_ECI_SUBSTR 'z' /* Exact or case insensitive sub match */ +#define AQ_M_ECS_SUBSTR 'k' /* Exact or case sensitive sub match */ +#define AQ_M_EREGEX 'x' /* Exact or regular expression match */ +#define AQ_EXP_LINK '\001' /* Expand single directory link */ +#define AQ_HOSTINFO '\002' /* Obtain info on matching hosts */ +#define AQ_MOTD_ONLY '\003' /* Only check for motd */ + +/* more search tyes - wheelan */ + +#define AQ_SITELIST '\004' +#define AQ_WHATIS '\005' +#define AQ_DOMAIN '\006' +#define AQ_RE_DOMAIN '\007' +#define AQ_GENERIC '\010' +#define AQ_STATUS '\011' /* bajan */ +#define AQ_DOMAINS '\012' /* bajan */ + + +/* Flags */ +#define AQ_NOSORT 0x01 /* Don't sort */ +#define AQ_ASYNC 0x02 /* Run asynchronously */ +#define AQ_MOTD 0x80 /* Request server's motd */ + +/* Status - one of the following or Prospero error code */ +#define AQ_INACTIVE 0 /* Request is inactive */ +#define AQ_COMPLETE -1 /* Request is complete */ +#define AQ_ACTIVE -2 /* Request is executing */ + +/* Definitions for the comparison procedures */ +#define AQ_DEFCMP aq_defcmplink /* Default for query type */ +#define AQ_INVDATECMP aq_invdatecmplink /* Inverted by date */ + +#define aq_init(AQ) \ + (AQ)->host = ARCHIE_HOST; \ + (AQ)->dbs = NULL; \ + (AQ)->string = NULL; \ + (AQ)->filters = NULL; \ + (AQ)->expand = (VLINK) 0; \ + (AQ)->maxhits = AQ_MAX_HITS; \ + (AQ)->maxmatch = AQ_MAX_MATCH; \ + (AQ)->maxhitpm = AQ_MAX_HITSPM;\ + (AQ)->offset = 0; \ + (AQ)->query_type = AQ_EXACT; \ + (AQ)->cmp_proc = AQ_DEFCMP; \ + (AQ)->flags = 0; \ + (AQ)->results = (VLINK) 0; \ + (AQ)->motd = NULL; \ + (AQ)->qpos = 0; \ + (AQ)->sys_time = 0; \ + (AQ)->wait_fd = -1; \ + (AQ)->retry_at.tv_sec = 0; \ + (AQ)->retry_at.tv_usec = 0; \ + (AQ)->dirquery = (VLINK) 0; \ + (AQ)->status = AQ_INACTIVE; + +/* Free fields that may have been filled in in call to archie_query */ +/* This must be called before a used aquery structure is freed, for */ +/* example by returning from a procedure in which it was allocated */ +/* on the stack. It must also be called before an aquery structure */ +/* is reused. If you hang onto the results, expand, or motd fields */ +/* the field should be zeroed as soon as another reference is made */ +/* to it, and it then becomes your resonsibility to explicitly free */ +/* the fields. */ +#define aq_reset(AQ) \ + if((AQ)->filters) fllfree((AQ)->filters); \ + if((AQ)->expand) vllfree((AQ)->expand); \ + if((AQ)->results) vllfree((AQ)->results); \ + if((AQ)->motd) stfree((AQ)->motd); \ + if((AQ)->motd) stfree((AQ)->motd); \ + aq_init(AQ); + +/* Function prototypes */ +int archie_query(struct aquery*,int);/* Front-end to aq_query */ +int aq_query(struct aquery*,int); /* Execute an archie query */ +char *aq_lhost(VLINK,char*,int); /* Extract host name from link */ +char *aq_lhsoname(VLINK); /* Extract filename from link */ +int aq_defcmplink(VLINK,VLINK); /* Compare by host and filename */ +int aq_invdatecmplink(VLINK,VLINK); /* Compare links inverted by date */ +int aq_restrict(struct aquery*,char*,char*,char); /* Add filters */ diff --git a/archie/clients/telnet/prosp.h b/archie/clients/telnet/prosp.h new file mode 100644 index 0000000..6fcb201 --- /dev/null +++ b/archie/clients/telnet/prosp.h @@ -0,0 +1,15 @@ +#ifndef PROSP_H +#define PROSP_H + +#include +#include /* so pmachine.h won't redefine stuff */ + +#include "pfs.h" +#include "perrno.h" +#include "pmachine.h" +#include "pprot.h" /* For VFPROT_VNO, the Prospero version number */ +#include "parchie.h" + +extern int pfs_debug; + +#endif diff --git a/archie/clients/telnet/prospquery.c b/archie/clients/telnet/prospquery.c new file mode 100644 index 0000000..9bc719f --- /dev/null +++ b/archie/clients/telnet/prospquery.c @@ -0,0 +1,553 @@ +/* + * aq_query.c : Programmatic Prospero interface to Archie + * + * Copyright (c) 1991 by the University of Washington + * Copyright (c) 1993 by the University of Southern California + * + * For copying and distribution information, please see the files + * and . + * + * Originally part of the Prospero Archie client by Clifford + * Neuman (bcn@isi.edu). Modifications, early programmatic interface, + * and new sorting code by George Ferguson (ferguson@cs.rochester.edu) + * and Brendan Kehoe (brendan@cs.widener.edu). + * + * - bcn 08/20/91 - make it do it properly (new invdatecmplink) + * - bpk 08/20/91 - made sorting go inverted as we purport it does + */ + +#include "uw-copyright.h" +#include "usc-copyr.h" + +#include +#include +#include +#ifndef SOLARIS +#include /* for char *index() */ +#else +#include +#endif +#ifdef AIX +#include +#endif +#include "debug.h" +#include "macros.h" +#include "prosp.h" +#include "tellwait.h" +#include "vars.h" + +#include "protos.h" + +extern char *p_motd; +extern int ardp_port; + + +int archie_query(arq, prt_status) + struct aquery *arq; + int prt_status; +{ + int flags = arq->flags; + int go = 0; + int qpos = 0; + int ret; + int sys_time = 0; + + if (prt_status) flags |= AQ_ASYNC; + + ret = aq_query(arq, flags); + while (ret == AQ_ACTIVE) + { + fd_set readfds; + struct timeval selwait; + time_t t = arq->retry_at.tv_sec - time((time_t *)0); + + selwait.tv_usec = 0; + selwait.tv_sec = max(t, 0); + + if (prt_status) + { + if (qpos != arq->qpos) + { + qpos = arq->qpos; + printf("# Your queue position: %d\n", qpos); /*FFF*/ + go = 1; + } + if (sys_time != arq->sys_time) + { + sys_time = arq->sys_time; + if (sys_time > 0) + { + int min = sys_time / 60; + int sec = sys_time % 60; + + printf("# Estimated time for completion: "); /*FFF*/ + + if (min > 1) printf("%d minutes%s", min, sec ? ", " : ".\n"); + else if (min == 1) printf("%d minute%s", min, sec ? ", " : ".\n"); + if (sec > 1) printf("%d seconds.\n", sec); + else if (sec == 1) printf("%d second.\n", sec); + } + go = 1; + } + if (go) + { + tell_parent(getppid()); + prt_status = 0; + } + } + + FD_ZERO(&readfds); + FD_SET(arq->wait_fd, &readfds); + select(arq->wait_fd+1, &readfds, (fd_set *)0, (fd_set *)0, &selwait); + + ret = aq_query(arq, AQ_ASYNC); + } + + if (prt_status) + { + tell_parent(getppid()); + } + return ret; +} + + +/* + * aq_query : Sends a request to _host_, telling it to search for + * _string_ using _query_type_ as the search method. + * No more than _max_hits_ matches are to be returned + * skipping over _offset_ matches. + * + * aq_query returns a linked list of virtual links. + * If _flags_ does not include AQ_NOTRANS, then the Archie + * responses will be translated. If _flags_ does not include + * AQ_NOSORT, then the list will be sorted using _cmp_proc_ to + * compare pairs of links. If _cmp_proc_ is NULL or AQ_DEFCMP, + * then the default comparison procedure, defcmplink(), is used + * sorting by host, then filename. If cmp_proc is AQ_INVDATECMP + * then invdatecmplink() is used, sorting inverted by date. + * otherwise a user-defined comparison procedure is called. + * + * aq_query returns NULL and sets perrno if the query + * failed. Note that it can return NULL with perrno == PSUCCESS + * if the query didn't fail but there were simply no matches. + * + * args: See archie.h for form of the aquery structure + * + * flags: AQ_NOSORT Don't sort results + * AQ_ASYNC + */ +int aq_query(struct aquery *aq, int flags) +{ + VDIR dir = &(aq->dirst); /* Directory for get_vdir */ + VLINK lowest, nextp, p, pnext, pprev, q, r; + const char *components = ""; + char qstring[MAX_VPATH]; /* For construting the query */ + int gvdflags; + int tmp; + + p_clear_errors(); + + /* + * It seem that if `p_motd' gets set once, it is used forever after. + * Thus, setting the server to any machine makes it appear that it + * also has the old motd. + * - wheelan (Fri Aug 20 03:33:53 EDT 1993) + */ + if (p_motd) + { + stfree(p_motd); + p_motd = 0; + } + + if(aq->status == AQ_ACTIVE) + { + if((flags&AQ_ASYNC) == 0) aq->flags &= (~AQ_ASYNC); + goto cont_async; + } + + aq->status = AQ_ACTIVE; + aq->flags = flags; /*bug? needed?*/ + vdir_init(dir); + + /* Set the cmp_proc if not given */ + if ( ! aq->cmp_proc) aq->cmp_proc = aq_defcmplink; + + /* Make the query string */ + if(aq->query_type > ' ') + { + sprintf(qstring,"ARCHIE/MATCH(%d,%d,%d,%d,%c)/%s", + aq->maxhits, aq->maxmatch, aq->maxhitpm, aq->offset, + aq->query_type, aq->string); + } + else + { + switch (aq->query_type) + { + case AQ_HOSTINFO: + strcpy(qstring, "ARCHIE/HOST"); + components = aq->string; + break; + + case AQ_SITELIST: /* wheelan */ + sprintf(qstring, "ARCHIE/HOST/%s", aq->string); /* has () around it */ + break; + + case AQ_DOMAINS: + sprintf(qstring, "ARCHIE/DOMAINS"); + break; + + case AQ_WHATIS: /* wheelan */ + sprintf(qstring, "ARCHIE/WHATIS/%s", aq->string); + break; + + case AQ_DOMAIN: /* wheelan */ + sprintf(qstring, "ARCHIE/DOMAIN/%s", aq->string); + break; + + case AQ_RE_DOMAIN: /* wheelan */ + sprintf(qstring, "ARCHIE/DOMAIN/(%s)", aq->string); + break; + + case AQ_GENERIC: /* wheelan */ + sprintf(qstring,"ARCHIE/FIND(%d,%d,1,%s)/%s", + aq->maxhits, aq->maxhits, aq->dbs, aq->string); + break; + + case AQ_MOTD_ONLY: + qstring[0] = '\0'; + break; + + default: + break; /* previous code didn't catch this either */ + } + } + + /* Initialize Prospero structures */ + perrno = 0; + + if(aq->query_type == AQ_EXP_LINK) + { + aq->dirquery = aq->expand; + } + else + { + if(!(aq->host)) return(perrno = aq->status = ARDP_BAD_HOSTNAME); + aq->dirquery = vlalloc(); + aq->dirquery->host = stcopyr(aq->host, aq->dirquery->host); + aq->dirquery->hsoname = stcopyr(qstring, aq->dirquery->hsoname); + aq->dirquery->filters = aq->filters; + } + + cont_async: + + gvdflags = GVD_ATTRIB|GVD_NOSORT; + if(aq->flags & AQ_MOTD) gvdflags |= GVD_MOTD; + if(aq->query_type == AQ_MOTD_ONLY) gvdflags |= GVD_MOTD_O; + if(aq->flags & AQ_ASYNC) gvdflags |= GVD_ASYNC; + + /* Retrieve the list of matches, return error if there was one */ + tmp = get_vdir(aq->dirquery, components, dir, gvdflags, NULL); + + if(tmp == DQ_ACTIVE) + { + aq->wait_fd = ardp_port; + aq->qpos = dir->dqs->preq->inf_queue_pos; + aq->sys_time = dir->dqs->preq->inf_sys_time; + aq->retry_at.tv_sec = dir->dqs->preq->wait_till.tv_sec; + aq->retry_at.tv_usec = dir->dqs->preq->wait_till.tv_usec; + if(!aq->motd && p_motd) aq->motd = stcopyr(p_motd, aq->motd); + return AQ_ACTIVE; + } + + if(aq->query_type != AQ_EXP_LINK) + { + aq->dirquery->filters = NULL; /* Keep them on aq->filters */ + vlfree(aq->dirquery); + aq->dirquery = NULL; + } + + if(p_motd) aq->motd = stcopyr(p_motd, aq->motd); + + if(tmp) return aq->status = tmp; + + /* Save the links, and clear in dir in case it's used again */ + aq->results = dir->links; dir->links = NULL; + + /* As returned, list is sorted by suffix, and conflicting */ + /* suffixes appear on a list of "replicas". We want to */ + /* create a one-dimensional list sorted by host then filename */ + /* and maybe by some other parameter */ + + /* First flatten the doubly-linked list */ + for (p = aq->results; p; p = nextp) + { + nextp = p->next; + if (p->replicas) + { + p->next = p->replicas; + p->next->previous = p; + for (r = p->replicas; r->next; r = r->next) + /*EMPTY*/ ; + r->next = nextp; + nextp->previous = r; + p->replicas = NULL; + } + } + + /* If NOSORT given, then just hand it back */ + if (aq->flags & AQ_NOSORT) + { + perrno = PSUCCESS; + aq->status = AQ_COMPLETE; + return PSUCCESS; + } + + /* Otherwise sort it using a selection sort and the given cmp_proc */ + for (p = aq->results; p; p = nextp) + { + nextp = p->next; + lowest = p; + for (q = p->next; q; q = q->next) + { + if ((*(aq->cmp_proc))(q, lowest) < 0) lowest = q; + } + if (p != lowest) + { + /* swap the two links */ + pnext = p->next; + pprev = p->previous; + if (lowest->next) lowest->next->previous = p; + p->next = lowest->next; + if (nextp == lowest) + { + p->previous = lowest; + } + else + { + lowest->previous->next = p; + p->previous = lowest->previous; + } + if (pprev->next) pprev->next = lowest; + if (nextp == lowest) + { + lowest->next = p; + } + else + { + pnext->previous = lowest; + lowest->next = pnext; + } + lowest->previous = lowest == pprev ? p : pprev; + /* keep the head of the list in the right place */ + if (aq->results == p) aq->results = lowest; + } + } + + /* Return the links */ + perrno = PSUCCESS; + aq->status = AQ_COMPLETE; + return PSUCCESS; +} + + +/* + * aq_defcmplink: The default link comparison function for sorting. Compares + * links p and q first by host then by filename. Returns < 0 if p + * belongs before q, > 0 if p belongs after q, and == 0 if their + * host and filename fields are identical. + */ +int aq_defcmplink(p, q) + VLINK p, q; +{ + char *phost; + char *phson; + char qhostbuf[100]; + char phostbuf[100]; + char *qhost; + char *qhson; + int result; + +#ifdef AQFASTCOMP + /* This is designed to be a fast check for EXTERNAL, but */ + /* not necessarily correct. It will break if archie */ + /* servers start to return other than external links */ + /* a link type that begins with an E */ + + if (*(p->target) == 'E') + { + phost = p->host; + phson = p->hsoname; + } + else + { + aq_lhost(p, phostbuf, sizeof(phostbuf)); + phost = phostbuf; + phson = aq_lhsoname(p); + } + + if (*(q->target) == 'E') + { + qhost = q->host; + qhson = q->hsoname; + } + else + { + aq_lhost(q, qhostbuf, sizeof(qhostbuf)); + qhost = qhostbuf; + qhson = aq_lhsoname(q); + } +#else + aq_lhost(p, phostbuf, sizeof(phostbuf)); + phost = phostbuf; + phson = aq_lhsoname(p); + aq_lhost(q, qhostbuf, sizeof(qhostbuf)); + qhost = qhostbuf; + qhson = aq_lhsoname(q); +#endif /* AQFASTCOMP */ + + if ((result = strcmp(phost, qhost)) != 0) return result; + else return strcmp(phson, qhson); +} + +/* + * aq_invdatecmplink: An alternative comparison function for sorting that + * compares links p and q first by LAST-MODIFIED date, + * if they both have that attribute. If both links + * don't have that attribute or the dates are the + * same, it then calls defcmplink() and returns its + * value. + */ +int aq_invdatecmplink(p, q) + VLINK p, q; +{ + PATTRIB pat, qat; + char *pdate, *qdate; + int result; + + pdate = qdate = NULL; + for (pat = p->lattrib; pat; pat = pat->next) + if(strcmp(pat->aname, "LAST-MODIFIED") == 0) + pdate = pat->value.sequence->token; + for (qat = q->lattrib; qat; qat = qat->next) + if(strcmp(qat->aname, "LAST-MODIFIED") == 0) + qdate = qat->value.sequence->token; + if(!pdate && !qdate) return aq_defcmplink(p, q); + if(!pdate) return 1; + if(!qdate) return -1; + if((result=strcmp(qdate, pdate)) == 0) return aq_defcmplink(p, q); + else return result; +} + + +/* + * aq_restrict - add filter to query + * + * aq_restrict will add a filter with name fname to an archie + * query. If a filter with the same name has already been applied, + * then the new farg is added to the argument for the existing + * filter. + */ +int aq_restrict(struct aquery *query, /* Query to restrict */ + char *fname, /* Name of restriction */ + char *farg, /* Args for restriction */ + char sep) /* Separator */ +{ + FILTER cfil = query->filters; + char argbuf[100]; + char *argp = farg; + char *argsep; + + if(sep) + { + strncpy(argbuf, farg, sizeof(argbuf)-1); + argbuf[sizeof(argbuf)-1] = '\0'; + argp = argbuf; + } + + /* See if filter already exists */ + while(cfil) + { + if(cfil->name && (strcmp(cfil->name, fname) == 0)) + { + /* Found it, add argument */ + if(sep) + { + while((argsep = index(argp, sep))) + { + *argsep = '\0'; + cfil->args = tkappend(argp, cfil->args); + argp = argsep+1; + } + cfil->args = tkappend(argp, cfil->args); + } + else cfil->args = tkappend(farg, cfil->args); + } + cfil = cfil->next; + } + /* Add a new filter */ + cfil = flalloc(); + cfil->name = stcopyr(fname, cfil->name); + cfil->type = FIL_DIRECTORY; + cfil->execution_location = FIL_SERVER; + cfil->pre_or_post = FIL_PRE; + if(sep) + { + while((argsep = index(argp, sep))) + { + *argsep = '\0'; + cfil->args = tkappend(argp, cfil->args); + argp = argsep+1; + } + cfil->args = tkappend(argp, cfil->args); + } + else cfil->args = tkappend(farg, cfil->args); + APPEND_ITEM(cfil, query->filters); + return PSUCCESS; +} + + +char *aq_lhsoname(VLINK l) +{ + char *slash; + char *hostp; + + if(strcmp(l->target, "EXTERNAL") == 0) return l->hsoname; + + /* Need check for FILE, but with FTP prefix */ + + if(strcmp(l->target, "DIRECTORY") != 0) return l->hsoname; + + if(strncmp(l->hsoname, "ARCHIE/HOST", 11) == 0) + { + hostp = l->hsoname + 12; + slash = index(hostp, '/'); + if (slash) return slash; + else return ""; + } + /* If not ARCHIE/HOST, don't change */ + return l->hsoname; +} + +char * +aq_lhost(VLINK l, char *host, int hlen) +{ + char *slash; + + strncpy(host, l->host, (unsigned)hlen-1); + + if(strcmp(l->target, "EXTERNAL") == 0) return host; + + /* Need check for FILE, but with FTP prefix */ + + if(strcmp(l->target, "DIRECTORY") != 0) return host; + + if (strncmp(l->hsoname, "ARCHIE/HOST", 11) == 0) { + *(host+hlen-1) = '\0'; + strncpy(host, l->hsoname+12, (unsigned)hlen-1); + slash = index(host, '/'); + if (slash) *slash = '\0'; + return host; + } + /* If not ARCHIE/HOST, don't change */ + return host; +} diff --git a/archie/clients/telnet/rmem.c b/archie/clients/telnet/rmem.c new file mode 100644 index 0000000..66f4eff --- /dev/null +++ b/archie/clients/telnet/rmem.c @@ -0,0 +1,127 @@ +#include +#ifdef AIX +#include +#endif +#include "lang.h" +#include "rmem.h" + +#include "protos.h" +#ifdef DEBUG +static char *foo; +#endif +#ifdef STATS +long rmem_allocated = 0; +long rmem_freed = 0; +#endif + + +#define RMEM(m) ((Rmem *)(m) - 1) +#define CRMEM(m) ((const Rmem *)(m) - 1) + + +int last_index_(m) + const char *m; +{ + const Rmem *r = CRMEM(m); + + try_magic(r); + return r->index - 1; +} + + +char *rappend_(m, data, size) + char *m; + char *data; + unsigned size; +{ + Rmem *r = RMEM(m); + char *ret; + + try_magic(r); + if (r->index < r->elts) + { + memcpy(r->mem + r->index++ * size, data, (unsigned)size); + try_magic(r); + ret = r->mem; + } + else + { + int new_elts = 2 * (r->elts ? r->elts : 1) ; + Rmem *new_r = (Rmem *)realloc((char *)r, sizeof (Rmem) + new_elts * size); + + if ( ! new_r) + { + ret = (char *)0; + } + else + { + try_magic(new_r); +#ifdef STATS + rmem_allocated += new_elts - r->elts; +#endif + new_r->mem = (char *)(new_r + 1); + memcpy(new_r->mem + new_r->index++ * size, data, (unsigned)size); + new_r->elts = new_elts; + try_magic(new_r); + ret = new_r->mem; + } + } + + return ret; +} + + +void rfree_(m) + const char *m; +{ + const Rmem *r = CRMEM(m); + + try_magic(r); +#ifdef STATS + rmem_freed += r->elts; +#endif +#ifdef DEBUG + fprintf(stderr, curr_lang[237], (char *)r); +#endif + free(r); +} + + +char *rmalloc_(nitems, size) + unsigned nitems; + unsigned size; +{ + Rmem *r; + char *ret; + + if ( ! (r = (Rmem *)malloc(sizeof (Rmem) + nitems * size))) + { + ret = (char *)0; + } + else + { +#ifdef DEBUG + fprintf(stderr, curr_lang[238], (char *)r); + if ((char *)r == foo) + { + fprintf(stderr, curr_lang[239], foo); + abort(); + } + else + { + foo = (char *)r; + fprintf(stderr, curr_lang[240], foo); + } +#endif +#ifdef STATS + rmem_allocated += nitems; +#endif + r->elts = nitems; + r->index = 0; + r->mem = (char *)(r + 1); + set_magic(r); + ret = r->mem; + } + + return ret; +} diff --git a/archie/clients/telnet/rmem.h b/archie/clients/telnet/rmem.h new file mode 100644 index 0000000..3a796f6 --- /dev/null +++ b/archie/clients/telnet/rmem.h @@ -0,0 +1,51 @@ +#ifndef RMEM_H +#define RMEM_H + +#include "ansi_compat.h" +#include "misc_ansi_defs.h" + + +#define last_index(mem) last_index_((const char *)mem) +#define rappend(mem, data, type) \ + (type *)rappend_((char *)mem, (char *)data, sizeof (type)) +#define rfree(mem) rfree_((const char *)mem) +#define rmalloc(n, type) (type *)rmalloc_(n, sizeof (type)) + + +#ifdef DEBUG +#define MAGIC 0x66666666 +#define set_magic(r) (r->m1 = r->m2 = r->m3 = r->m4 = MAGIC) +#define has_magic(r) (r->m1 == MAGIC && r->m2 == MAGIC && r->m3 == MAGIC && r->m4 == MAGIC) +#define try_magic(r) \ + do { if ( ! has_magic(r)) { fprintf(stderr, "Bad magic!\n"); abort(); } } while (0) + +typedef struct +{ + unsigned long m1; + char *mem; + unsigned long m2; + unsigned elts; + unsigned long m3; + unsigned index; + unsigned long m4; +} Rmem; + +#else + +#define set_magic(r) +#define try_magic(r) + +typedef struct +{ + char *mem; + unsigned elts; + unsigned index; +} Rmem; +#endif + +extern int last_index_ PROTO((const char *m)); +extern char *rappend_ PROTO((char *m, char *data, unsigned size)); +extern char *rmalloc_ PROTO((unsigned nitems, unsigned size)); +extern void rfree_ PROTO((const char *r)); + +#endif diff --git a/archie/clients/telnet/signals.c b/archie/clients/telnet/signals.c new file mode 100644 index 0000000..15f3b05 --- /dev/null +++ b/archie/clients/telnet/signals.c @@ -0,0 +1,218 @@ +#ifdef __STDC__ +#include +#endif +#include +#include +#include +#include +#include + +#include "ardp.h" +#include "debug.h" +#include "error.h" +#include "extern.h" +#include "lang.h" +#include "macros.h" +#include "misc.h" +#include "misc_ansi_defs.h" +#include "prosp.h" + +#include "signals.h" +#include "tellwait.h" +#include "vars.h" + +#include "protos.h" + + +/* + * Fri Apr 16 00:46:12 EDT 1993 - wheelan + * + * I've noticed weirdness with autologout when run from the command line: it + * doesn't pick up keystrokes when the user is in the pager, causing them to + * be logged out even though they haven't been idle. Typing doesn't seem to + * change the modification type of /dev/tty. + */ + + +static void child_handle PROTO((int sig)); +static void on_hup PROTO((int sig)); + + +/* + * Upon catching an alarm signal, die and take everybody with you. + */ + +void catch_alarm(sig) + int sig; +{ + const char *max_idle_time_str; + struct stat sbuf; + time_t max_idle_time; + + d4fprintf(stderr, "%s: catch_alarm: (%ld) start at %s.\n", + prog, (long)getpid(), now()); + + /* NOTE: may have to make "autologout" un-unsettable. */ + + if ((max_idle_time_str = get_var(V_AUTOLOGOUT))) + { + max_idle_time = MIN_TO_SEC(atoi(max_idle_time_str)); + } + else + { + error(A_INTERR, curr_lang[241], curr_lang[246]); + return; + } + + if (fstat(0, &sbuf) != -1) + { + time_t time_been_idle; + + time_been_idle = time((time_t *)0) - sbuf.st_atime; + d4fprintf(stderr, "%s: catch_alarm: (%ld) %ld seconds idle (%ld left, %ld max) at %s.\n", + prog, (long)getpid(), (long)time_been_idle, + (long)(max_idle_time - time_been_idle), (long)max_idle_time, now()); + if (time_been_idle < max_idle_time) + { + alarm((unsigned)(max_idle_time - time_been_idle)); + d4fprintf(stderr, + "%s: catch_alarm: (%ld) reset alarm to %ld seconds at %s.\n", + prog, (long)getpid(), + (long)(max_idle_time - time_been_idle), now()); + } + else + { + printf(curr_lang[244]); + fflush(stdout); + d4fprintf(stderr, + "%s: catch_alarm: (%ld) sending HUP to our process group at %s.\n", + prog, (long)getpid(), now()); +#if !defined(AIX) && !defined(SOLARIS) + kill(-getpgrp(0), SIGHUP); +#else + kill(-getpgrp(), SIGHUP); +#endif + } + } +} + + +/* + * This is only called from the child. + */ + +static void child_handle(sig) + int sig; +{ + char signame[32]; + + switch (sig) + { + case SIGHUP: + strcpy(signame, "HUP"); + break; + + case SIGINT: + strcpy(signame, "INT"); + break; + + case SIGQUIT: + strcpy(signame, "QUIT"); + break; + + default: + sprintf(signame, "#%d", sig); + error(A_ERR, "child_handle", "stray signal %d -- child exiting.", sig); + } + /*bug: wipes out _all_ our requests; change if we allow async. requests*/ + ardp_abort(NOREQ); + d4fprintf(stderr, "%s: child_handle: (%ld) caught %s at %s -- exiting.\n", + prog, (long)getpid(), signame, now()); + /* + * bug! This causes all sort of problems, as the default action of + * SIGUSR is to kill the process. This signal can be sent even if + * we're not using the `tell_' functions. + */ + tell_parent(getppid()); + exit(sig); +} + + +/* + * Children will call this. + */ + +void child_sigs() +{ + ppc_signal(SIGALRM, SIG_IGN); /* Just to be paranoid */ + ppc_signal(SIGINT, child_handle); + ppc_signal(SIGQUIT, child_handle); + ppc_signal(SIGPIPE, SIG_DFL); +} + + +static void on_hup(sig) + int sig; +{ + d4fprintf(stderr, "%s: on_hup: (%ld) caught HUP at %s -- exiting.\n", + prog, (long)getpid(), now()); + exit(0); +} + + +/* + * The parent will call this. + */ + +void parent_sigs() +{ + no_tell_wait(); /* Don't die on SIGUSR1 & SIGUSR2 */ + + ppc_signal(SIGALRM, catch_alarm); + + /* Ignore these */ + + ppc_signal(SIGHUP, on_hup); + ppc_signal(SIGPIPE, SIG_IGN); + ppc_signal(SIGINT, SIG_IGN); + ppc_signal(SIGQUIT, SIG_IGN); +} + + +/* + * This is taken from ppc/lib/os_indep.c. It probably ought to be renamed + * and moved into libarchie... + */ + +/* + * From Stevens' "Advanced Programming in the UNIX Environment". + * + * This will ensure we get reasonable SIGCHLD semantics. + */ +Sigfunc *ppc_signal(sig, fn) + int sig; + Sigfunc *fn; +{ + struct sigaction act, oact; + + act.sa_handler = fn; + sigemptyset(&act.sa_mask); + act.sa_flags = 0; + if (sig == SIGALRM) + { +#ifdef SA_INTERRUPT + act.sa_flags |= SA_INTERRUPT; /* SunOS */ +#endif + } + else + { +#ifdef SA_RESTART + act.sa_flags |= SA_RESTART; /* SVR4, 4.3+BSD */ +#endif + } + if (sigaction(sig, &act, &oact) < 0) + { + return SIG_ERR; + } + return oact.sa_handler; +} diff --git a/archie/clients/telnet/signals.h b/archie/clients/telnet/signals.h new file mode 100644 index 0000000..42cca46 --- /dev/null +++ b/archie/clients/telnet/signals.h @@ -0,0 +1,14 @@ +#ifndef SIGNALS_H +#define SIGNALS_H + +typedef void Sigfunc PROTO((int)); + + +extern Sigfunc *ppc_signal PROTO((int sig, Sigfunc *fn)); +extern void catch_alarm PROTO((int sig)); +extern void child_sigs PROTO((void)); +extern void ctl_c PROTO((int sig)); +extern void parent_sigs PROTO((void)); +extern void waiting PROTO((int bool)); + +#endif diff --git a/archie/clients/telnet/sock.c b/archie/clients/telnet/sock.c new file mode 100644 index 0000000..03c8ad3 --- /dev/null +++ b/archie/clients/telnet/sock.c @@ -0,0 +1,25 @@ +#include +#include + + +int main() +{ + struct stat sbuf ; + + if (fstat(0, &sbuf) == -1) + { + perror("fstat"); + exit(1); + } + + if (S_ISSOCK(sbuf.st_mode)) + { + printf("Got a socket.\n"); + } + else + { + printf("Ceci n'est pas un pipe (sockette?)\n"); + printf("st_mode = %07o\n", sbuf.st_mode); + } + exit(0); +} diff --git a/archie/clients/telnet/solaris-sig-fix.h b/archie/clients/telnet/solaris-sig-fix.h new file mode 100644 index 0000000..065b45d --- /dev/null +++ b/archie/clients/telnet/solaris-sig-fix.h @@ -0,0 +1,88 @@ +#undef __STDC__ +#if (__STDC__ - 0 == 0) || defined(_POSIX_C_SOURCE) +#if ((__STDC__ - 0 == 0) && !defined(_POSIX_C_SOURCE)) || (_POSIX_C_SOURCE > 2) +/* + * We need for the declaration of siginfo_t. + */ +#include + +#endif + +typedef struct { /* signal set type */ + unsigned long __sigbits[4]; +} sigset_t; + +typedef struct { + unsigned long __sigbits[2]; +} k_sigset_t; + +#warning sigaction is now included +struct sigaction { + int sa_flags; + union { + void (*_handler)(); +#if ((__STDC__ - 0 == 0) && !defined(_POSIX_C_SOURCE)) || (_POSIX_C_SOURCE > 2) + void (*_sigaction)(int, siginfo_t *, void *); +#endif + } _funcptr; + sigset_t sa_mask; + int sa_resv[2]; +}; +#define sa_handler _funcptr._handler +#define sa_sigaction _funcptr._sigaction + +/* this is only valid for SIGCLD */ +#define SA_NOCLDSTOP 0x00020000 /* don't send job control SIGCLD's */ +#endif + +#if (__STDC__ - 0 == 0) && !defined(_POSIX_C_SOURCE) + /* non-comformant ANSI compilation */ + +/* definitions for the sa_flags field */ +#define SA_ONSTACK 0x00000001 +#define SA_RESETHAND 0x00000002 +#define SA_RESTART 0x00000004 +#endif +#if ((__STDC__ - 0 == 0) && !defined(_POSIX_C_SOURCE)) || (_POSIX_C_SOURCE > 2) +#define SA_SIGINFO 0x00000008 +#endif +#if (__STDC__ - 0 == 0) && !defined(_POSIX_C_SOURCE) +#define SA_NODEFER 0x00000010 + +/* this is only valid for SIGCLD */ +#define SA_NOCLDWAIT 0x00010000 /* don't save zombie children */ + +/* this is only valid for SIGWAITING */ +#define SA_WAITSIG 0x00010000 /* send SIGWAITING if all lwps block */ + +/* + * use of these symbols by applications is injurious + * to binary compatibility, use _sys_nsig instead + */ +#define NSIG 44 /* valid signals range from 1 to NSIG-1 */ +#define MAXSIG 43 /* size of u_signal[], NSIG-1 <= MAXSIG */ + /* Note: when changing MAXSIG, be sure to update the */ + /* sizes of u_sigmask and u_signal in uts/adb/u.adb. */ + +#define S_SIGNAL 1 +#define S_SIGSET 2 +#define S_SIGACTION 3 +#define S_NONE 4 + +#define MINSIGSTKSZ 2048 +#define SIGSTKSZ 8192 + +#define SS_ONSTACK 0x00000001 +#define SS_DISABLE 0x00000002 + +struct sigaltstack { + char *ss_sp; + int ss_size; + int ss_flags; +}; + +typedef struct sigaltstack stack_t; + +#endif + +#define __STDC__ 1 diff --git a/archie/clients/telnet/strmap.c b/archie/clients/telnet/strmap.c new file mode 100644 index 0000000..f4b07be --- /dev/null +++ b/archie/clients/telnet/strmap.c @@ -0,0 +1,240 @@ +#ifdef __STDC__ +# include +#endif +#include +#include "lang.h" +#include "misc_ansi_defs.h" +#include "strmap.h" +#include "vars.h" + +#ifndef SOLARIS +extern int strncasecmp PROTO((const char *s1, const char *s2, int n)); +#endif +extern int strcasecmp PROTO((const char *s1, const char *s2)); + + +/* + * + * + * Internal routines + * + * + */ + +static const StrMap *find_in_from PROTO((const char *s, const StrMap *map, + int (*compare) PROTO((const char *s1, const char *s2, + int n)), + int slen)); +static const StrMap *find_in_to PROTO((const char *s, const StrMap *map, + int (*compare) PROTO((const char *s1, const char *s2, + int n)), + int slen)); +static int strcmp_ PROTO((const char *s1, const char *s2, int n)); + + +static int strcasecmp_(s1, s2, n) + const char *s1; + const char *s2; + int n; +{ + return strcasecmp(s1, s2); +} + + +static int strcmp_(s1, s2, n) + const char *s1; + const char *s2; + int n; +{ + return strcmp(s1, s2); +} + + +static const StrMap *find_in_from(s, map, compare, slen) + const char *s; + const StrMap *map; + int (*compare) PROTO((const char *s1, const char *s2, int n)); + int slen; +{ + while (map->from) + { + if (compare(s, map->from, slen) == 0) + { + return map; + } + map++; + } + return (StrMap *)0; +} + + +static const StrMap *find_in_to(s, map, compare, slen) + const char *s; + const StrMap *map; + int (*compare) PROTO((const char *s1, const char *s2, int n)); + int slen; +{ + while (map->from) + { + if (map->to && compare(s, map->to, slen) == 0) + { + return map; + } + map++; + } + return (StrMap *)0; +} + + +/* + * + * + * External routines + * + * + */ + + +/* + * If the current language is english return the `from' (english) string, + * otherwise return the `to' (second language string), falling back to the + * english value if necessary. + */ + +const char *mapLangStr(map) + const StrMap *map; +{ + if (strcmp(get_var(V_LANGUAGE), curr_lang[307]) == 0) return map->from; + else return map->to ? map->to : map->from; +} + + +const char *mapNCaseStr(s, map) + const char *s; + const StrMap *map; +{ + const StrMap *m; + + if ((m = find_in_to(s, map, strncasecmp, (int)strlen(s)))) return m->from; + else if ((m = find_in_from(s, map, strncasecmp, (int)strlen(s)))) return m->from; + else return (const char *)0; +} + + +/* #ifdef NEW -- commented out Thu Oct 14 18:09:40 EDT 1993 */ +const char *mapStrFrom(s, map) + const char *s; + const StrMap *map; +{ + const StrMap *m; + + if ((m = find_in_from(s, map, strcmp_, 0))) return m->from; + else return (const char *)0; +} + + +const char *mapStrTo(s, map) + const char *s; + const StrMap *map; +{ + const StrMap *m; + + if ((m = find_in_to(s, map, strcmp_, 0))) return m->to; + else return (const char *)0; +} + + +const char *mapNCaseStrFrom(s, map) + const char *s; + const StrMap *map; +{ + const StrMap *m; + + if ((m = find_in_from(s, map, strncasecmp, (int)strlen(s)))) return m->from; + else return (const char *)0; +} + + +const char *mapNCaseStrTo(s, map) + const char *s; + const StrMap *map; +{ + const StrMap *m; + + if ((m = find_in_to(s, map, strncasecmp, (int)strlen(s)))) return m->from; + else return (const char *)0; +} +/* #endif */ + + +const char *mapCaseStr(s, map) + const char *s; + const StrMap *map; +{ + const StrMap *m; + + if ((m = find_in_to(s, map, strcasecmp_, 0))) return m->from; + else if ((m = find_in_from(s, map, strcasecmp_, 0))) return m->from; + else return (const char *)0; +} + + +const char *mapStr(s, map) + const char *s; + const StrMap *map; +{ + const StrMap *m; + + if ((m = find_in_to(s, map, strcmp_, 0))) return m->from; + else if ((m = find_in_from(s, map, strcmp_, 0))) return m->from; + else return (const char *)0; +} + + +int mapEmpty(m) + const StrMap *m; +{ + int r = 0; + + r = m->from == (const char *)0; + r = r & m->to == (const char *)0; + return r; +} + + +const char *mapFirstStr(m) + const StrMap *m; +{ + if (m->to) return m->to; + else if (m->from) return m->from; + else return (const char *)0; +} + + +void freeStrMap(m) + StrMap *m; +{ + free(m->from); + free(m->to); + m->from = m->to = (const char *)0; +} + + +StrMap *newStrMap(s, m) /* bug: should be more general; varargs? */ + const char *s; + StrMap *m; +{ + if ( ! (m->from = strdup(s))) + { + return (StrMap *)0; + } + else if ( ! (m->to = strdup(s))) + { + free(m->from); + return (StrMap *)0; + } + else + { + return m; + } +} diff --git a/archie/clients/telnet/strmap.h b/archie/clients/telnet/strmap.h new file mode 100644 index 0000000..f9edb78 --- /dev/null +++ b/archie/clients/telnet/strmap.h @@ -0,0 +1,29 @@ +#ifndef STRMAP_h +#define STRMAP_h + +#include "ansi_compat.h" + + +typedef struct +{ + const char *from; + const char *to; +} StrMap; + + +extern StrMap *newStrMap PROTO((const char *s, StrMap *m)); /* bug: should be more general; varargs? */ +extern const char *mapFirstStr PROTO((const StrMap *m)); +extern const char *mapStr PROTO((const char *s, const StrMap *map)); +extern const char *mapNCaseStr PROTO((const char *s, const StrMap *map)); +extern void freeStrMap PROTO((StrMap *m)); +extern int mapEmpty PROTO((const StrMap *m)); + +extern const char *mapLangStr PROTO((const StrMap *map)); +/* #ifdef NEW -- commented out Thu Oct 14 18:09:03 EDT 1993 */ +extern const char *mapNCaseStrTo PROTO((const char *s, const StrMap *map)); +extern const char *mapNCaseStrFrom PROTO((const char *s, const StrMap *map)); +extern const char *mapStrTo PROTO((const char *s, const StrMap *map)); +extern const char *mapStrFrom PROTO((const char *s, const StrMap *map)); +/* #endif */ + +#endif diff --git a/archie/clients/telnet/style_lang.h b/archie/clients/telnet/style_lang.h new file mode 100644 index 0000000..3a5a1aa --- /dev/null +++ b/archie/clients/telnet/style_lang.h @@ -0,0 +1,29 @@ +#include "macros.h" +#include "misc.h" + + +#define SPIN (current_mod() != M_EMAIL && is_set(V_STATUS)) + +#define MACHINE -100 /* listing output formats */ +#define SILENT -101 +#define TERSE -102 +#define VERBOSE -103 +#define URL -104 + +static StrVal style_list[] = +{ + {"machine", MACHINE}, + {"silent", SILENT}, + {"terse", TERSE}, + {"verbose", VERBOSE}, + {"url", URL}, + + {FRENCH("ordinateur"), MACHINE}, + {FRENCH("silencieux"), SILENT}, + {FRENCH("breve"), TERSE}, + {FRENCH("verbose"), VERBOSE}, + {FRENCH("url"), URL}, + + {(const char *)0, 0} +}; + diff --git a/archie/clients/telnet/tellwait.c b/archie/clients/telnet/tellwait.c new file mode 100644 index 0000000..b955711 --- /dev/null +++ b/archie/clients/telnet/tellwait.c @@ -0,0 +1,173 @@ +/* + * Based on Stevens. + */ + +#include +#include +#include "ansi_compat.h" +#include "debug.h" +#include "error.h" +#include "extern.h" +#include "signals.h" +#include "tellwait.h" + +#include "protos.h" + +static volatile int sigflag; /* set nonzero by signal handler */ +static sigset_t newmask; +static sigset_t oldmask; +static sigset_t zeromask; + + +static void sig_usr PROTO((int signo)); + + +/* + * One signal handler for SIGUSR1 and SIGUSR2 + */ +static void sig_usr(signo) + int signo; +{ + d5fprintf(stderr, "%s (%ld): sig_usr: caught signal `%d'.\n", + prog, (long)getpid(), signo); + sigflag = 1; + return; +} + + +int no_tell_wait() +{ + int ret = 1; + + /* reset signal mask to original value */ + if (sigprocmask(SIG_SETMASK, &oldmask, (sigset_t *)0) < 0) + { + error(A_SYSERR, "wait_parent", "error resetting signal mask"); + } + if (ppc_signal(SIGUSR1, SIG_IGN) == SIG_ERR) + { + error(A_SYSERR, "tell_wait", "error ignoring SIGUSR1"); /*FFF*/ + ret = 0; + } + if (ppc_signal(SIGUSR2, SIG_IGN) == SIG_ERR) + { + error(A_SYSERR, "tell_wait", "error ignoring SIGUSR2"); /*FFF*/ + ret = 0; + } + + return ret; +} + + +int tell_wait() +{ +#ifndef PROFILE + sigflag = 0; + if (ppc_signal(SIGUSR1, sig_usr) == SIG_ERR) + { + error(A_SYSERR, "tell_wait", "error setting SIGUSR1 signal handler"); /*FFF*/ + return 0; + } + if (ppc_signal(SIGUSR2, sig_usr) == SIG_ERR) + { + error(A_SYSERR, "tell_wait", "error setting SIGUSR2 signal handler"); /*FFF*/ + return 0; + } + if (ppc_signal(SIGCHLD, sig_usr) == SIG_ERR) + { + error(A_SYSERR, "tell_wait", "error setting SIGCHLD signal handler"); /*FFF*/ + return 0; + } + + sigemptyset(&zeromask); + + sigemptyset(&newmask); + sigaddset(&newmask, SIGUSR1); + sigaddset(&newmask, SIGUSR2); + sigaddset(&newmask, SIGCHLD); + /* block SIGUSR1 and SIGUSR2, and save current signal mask */ + if (sigprocmask(SIG_BLOCK, &newmask, &oldmask) < 0) + { + error(A_SYSERR, "tell_wait", "error blocking SIGUSR1 and SIGUSR2"); + return 0; + } +#endif + return 1; + +} + + +/* + * Tell the parent to resume; called by child. + */ +void tell_parent(pid) + pid_t pid; +{ +#ifndef PROFILE + d5fprintf(stderr, "%s (%ld): tell_parent: kill(%ld, SIGUSR2).\n", + prog, (long)getpid(), (long)pid); + kill(pid, SIGUSR2); /* tell parent we're done */ +#endif +} + + +/* + * Wait for signal from parent; called by child. + */ +void wait_parent() +{ +#ifndef PROFILE + while (sigflag == 0) + { + sigsuspend(&zeromask); /* and wait for parent */ + } + + d5fprintf(stderr, "%s (%ld): wait_parent: resuming.\n", + prog, (long)getpid()); + + sigflag = 0; + /* reset signal mask to original value */ + if (sigprocmask(SIG_SETMASK, &oldmask, (sigset_t *)0) < 0) + { + error(A_SYSERR, "wait_parent", "error resetting signal mask"); + } +#endif +} + + +/* + * Tell the child to resume; called by parent. + */ +void tell_child(pid) + pid_t pid; +{ +#ifndef PROFILE + d5fprintf(stderr, "%s (%ld): tell_child: kill(%ld, SIGUSR1).\n", + prog, (long)getpid(), (long)pid); + kill(pid, SIGUSR1); /* tell child we're done */ +#endif +} + + +/* + * Wait for signal from child; called by parent. + */ +void wait_child() +{ +#ifndef PROFILE + while (sigflag == 0) + { + sigsuspend(&zeromask); /* and wait for child */ + } + + d5fprintf(stderr, "%s (%ld): wait_child: resuming.\n", + prog, (long)getpid()); + + sigflag = 0; + /* reset signal mask to original value */ + if (sigprocmask(SIG_SETMASK, &oldmask, (sigset_t *)0) < 0) + { + error(A_SYSERR, "wait_child", "error resetting signal mask"); + } +#endif +} diff --git a/archie/clients/telnet/tellwait.h b/archie/clients/telnet/tellwait.h new file mode 100644 index 0000000..a459d23 --- /dev/null +++ b/archie/clients/telnet/tellwait.h @@ -0,0 +1,15 @@ +#ifndef TELLWAIT_H +#define TELLWAIT_H + +#include +#include "ansi_compat.h" + + +extern int no_tell_wait PROTO((void)); +extern int tell_wait PROTO((void)); +extern void tell_child PROTO((pid_t pid)); +extern void tell_parent PROTO((pid_t pid)); +extern void wait_child PROTO((void)); +extern void wait_parent PROTO((void)); + +#endif diff --git a/archie/clients/telnet/terminal.c b/archie/clients/telnet/terminal.c new file mode 100644 index 0000000..38a2e27 --- /dev/null +++ b/archie/clients/telnet/terminal.c @@ -0,0 +1,424 @@ +#include +#include +#include +#include +#ifndef AIX +#include +#else +#include +#endif +#ifdef __STDC__ +# include +# ifndef TIOCGWINSZ +# include +# endif +#endif +#include "client_defs.h" +#include "debug.h" +#include "error.h" +#include "extern.h" +#include "macros.h" +#include "misc.h" +#include "misc_ansi_defs.h" +#include "terminal.h" +#include "vars.h" +#include "lang.h" + +#include "protos.h" + +static int cols = 80; +static int rows = 24; + + +/* + * + * Internal routines + * + */ + + +static const char *set_term_type PROTO((const char *term_name)); +static int set_window_size PROTO((int r, int c)); +static char *get_key_str PROTO((unsigned int ch, char *buf, int bufsize)); +static char get_key_char PROTO((char *key)); + + +static char get_key_char(key) + char *key; +{ + int len; + + ptr_check(key, char, curr_lang[249], 0); + + dequote(key); + if ((len = strlen(key)) == 0 || len > 2 || (len == 2 && *key != '^')) + { + printf(curr_lang[250], key); + return 0; + } + + if (len == 1) + { + return *key; + } + else + { + if (key[1] == '?') /* special case: DEL */ + { + return '\177'; + } + else + { + int c = CNTRL(toupper(key[1])); + + if (isascii(c) && iscntrl(c) && c != 0) + { + return c; + } + else + { + printf(curr_lang[251], key, c); + return 0; + } + } + } +} + + +static char *get_key_str(ch, buf, bufsize) + unsigned int ch; + char *buf; + int bufsize; +{ + static char bad[] = ""; + + if (bufsize < 5) + { + error(A_INTERR, curr_lang[252], curr_lang[253], curr_lang[254]); + return bad; + } + else if (ch > 255) + { + error(A_INTERR, curr_lang[252], curr_lang[255], curr_lang[256], (unsigned long)ch); + return bad; + } + else + { + if (iscntrl(ch)) + { + if (ch == '\177') strcpy(buf, curr_lang[257]); /* delete */ + else sprintf(buf, curr_lang[258], LRTNC(ch)); + } + else if (isprint(ch)) + { + buf[0] = ch; buf[1] = '\0'; + } + else + { + sprintf(buf, curr_lang[259], ch); + } + return buf; + } +} + + +static int set_window_size(r, c) + int r; + int c; +{ +#ifdef __svr4__ + /* + * Under Solaris 2.[23] the TIOCGWINSZ ioctl fails when we are started by + * telnetd, but works under rlogind. In any case, we'll just stick to + * environment variables. + */ + static char envcols[64]; + static char envlines[64]; + + sprintf(envcols, "COLUMNS=%d", c); + putenv(envcols); + cols = c; + sprintf(envlines, "LINES=%d", r); + putenv(envlines); + rows = r; + + return 1; + +#else + + struct winsize wsize; + + if (ioctl(1, TIOCGWINSZ, (caddr_t)&wsize) == -1) + { + error(A_SYSERR, curr_lang[260], curr_lang[261]); + return 0; + } + else + { + wsize.ws_row = r ? r: rows; + wsize.ws_col = c ? c: cols; + + if (ioctl(1, TIOCSWINSZ, (caddr_t)&wsize) == -1) + { + error(A_SYSERR, curr_lang[260], curr_lang[262]); + return 0; + } + else + { + rows = wsize.ws_row; + cols = wsize.ws_col; + return 1; + } + } +#endif +} + + +static const char *set_term_type(term_name) + const char *term_name; +{ + char tc_ent[TC_ENT_LEN]; + static char term_env[16 + MAX_VAR_STR_LEN]; + + ptr_check(term_name, const char, curr_lang[263], 0); + + switch (tgetent(tc_ent, term_name)) + { + case -1: + printf(curr_lang[264]); +/* term_name = curr_lang[266];*/ + return (const char *)0; + break; + + case 0: + printf(curr_lang[265], term_name); +/* term_name = curr_lang[266];*/ + return (const char *)0; + break; + + case 1: /* It worked! */ + break; + + default: + error(A_ERR, curr_lang[263], curr_lang[267]); +/* term_name = curr_lang[266];*/ + return (const char *)0; + break; + } + + strcpy(term_env, curr_lang[268]); + strcat(term_env, term_name); + + if (putenv(term_env) != 0) /* 0 means okay -- yeesh! */ + { + error(A_ERR, curr_lang[263], curr_lang[269]); + } + return term_name; +} + + +/* + * + * External routines + * + */ + +int get_cols() +{ + return cols; +} + + +int get_rows() +{ + return rows; +} + + +int init_term() +{ + char targ[MAX_VAR_STR_LEN]; + const char *term; + int c = 80; + int r = 24; +#ifndef __svr4__ + struct winsize wsize; +#endif + + if ( ! (term = getenv(curr_lang[270]))) + { + term = curr_lang[266]; + } + +#ifndef __svr4__ + /* See previous comment w.r.t. TIOCGWINSZ. */ + if (ioctl(1, TIOCGWINSZ, (caddr_t)&wsize) == -1) + { + error(A_SYSERR, curr_lang[271], curr_lang[261]); + } + + if (wsize.ws_row > 0) r = wsize.ws_row; + if (wsize.ws_col > 0) c = wsize.ws_col; +#endif + + sprintf(targ, curr_lang[272], term, r, c); + + if (we_are_suid()) + { + /* + * Ensure we use the same file/directory as the pager. + */ + static char termcap[32+MAXPATHLEN+1]; + static char terminfo[32+MAXPATHLEN+1]; + + sprintf(termcap, "TERMCAP=%s/pager/etc/termcap", homedir); + putenv(termcap); + sprintf(terminfo, "TERMINFO=%s/terminfo", homedir); + putenv(terminfo); + } + + return set_var(V_TERM, targ); +} + + +/* + * Set the terminal type to one specified by the user. Return an error if + * the terminal type is unknown to this system. + * + * Argument should have form: [<#rows> [<#cols>]] + */ + +int set_term(term) + const char *term; +{ + char cols_str[COMMAND_LEN]; + char rows_str[COMMAND_LEN]; + char term_type[INPUT_LINE_LEN]; + const char *tt; + int win_cols = 80; + int win_rows = 24; + + switch (sscanf(term, curr_lang[273], term_type, rows_str, cols_str)) + { + case 3: + /* Set the terminal type, number of rows and number of columns. */ + + if (sscanf(cols_str, curr_lang[274], &win_cols) != 1) + { + printf(curr_lang[275], cols_str); + return 0; + } + + case 2: + /* Set the terminal type and number of rows. */ + + if (sscanf(rows_str, curr_lang[274], &win_rows) != 1) + { + printf(curr_lang[276], rows_str); + return 0; + } + + case 1: + /* Set just the terminal type (handled below). */ + break; + + default: + printf(curr_lang[277]); + return 0; + } + + if ( ! (tt = set_term_type(term_type))) return 0; + + if ( ! set_window_size(win_rows, win_cols)) + { + error(A_ERR, curr_lang[278], curr_lang[279]); + return 0; + } + + printf(curr_lang[280], tt, win_rows, win_cols); + return 1; +} + + +#include "terminal_lang.h" + + +static struct termios keytab; + + +int set_tty(ac, av) + int ac; + char **av; +{ + const char *cmd; + int key_val; + + ptr_check(av, char *, curr_lang[281], 0); + + cmd = av[0]; + if (ac != 1 && ac % 2 == 0) + { + printf(curr_lang[282], cmd, cmd); + return 0; + } + + /* for now all we support is `erase' */ + +#ifdef __STDC__ + if (tcgetattr(0, &keytab) == -1) +#else + if (ioctl(0, TCGETS, &keytab) == -1) +#endif + { + error(A_SYSERR, curr_lang[281], curr_lang[283]); + return 0; + } + + if (ac == 1) /* no arguments */ + { + char kstr[5]; + + printf(curr_lang[284], + get_key_str((unsigned)keytab.c_cc[VERASE], kstr, sizeof kstr)); + return 1; + } + else + { + while (av++, --ac) + { + if ( ! strtoval(av[0], &key_val, keys)) + { + printf(curr_lang[285], av[0], cmd); + return 0; + } + else + { + char c; + + if ( ! (c = get_key_char(*++av))) + { + return 0; + } + else + { + --ac; + keytab.c_cc[key_val] = c; + } + } + } + +#ifdef __STDC__ + if (tcsetattr(0, TCSANOW, &keytab) != -1) +#else + if (ioctl(0, TCSETS, &keytab) != -1) +#endif + { + return 1; + } + else + { + error(A_SYSERR, curr_lang[281], curr_lang[286]); + return 0; + } + } +} diff --git a/archie/clients/telnet/terminal.h b/archie/clients/telnet/terminal.h new file mode 100644 index 0000000..5e4dc03 --- /dev/null +++ b/archie/clients/telnet/terminal.h @@ -0,0 +1,13 @@ +#ifndef TERMINAL_H +#define TERMINAL_H + +#include "ansi_compat.h" + + +extern int get_cols PROTO((void)); +extern int get_rows PROTO((void)); +extern int init_term PROTO((void)); +extern int set_term PROTO((const char *term)); +extern int set_tty PROTO((int ac, char **av)); + +#endif diff --git a/archie/clients/telnet/terminal_lang.h b/archie/clients/telnet/terminal_lang.h new file mode 100644 index 0000000..2b088af --- /dev/null +++ b/archie/clients/telnet/terminal_lang.h @@ -0,0 +1,8 @@ +static StrVal keys[] = +{ + { "erase", VERASE }, + + { FRENCH("efface"), VERASE}, + + { (const char *)0, 0 } +}; diff --git a/archie/clients/telnet/unixcompat.c b/archie/clients/telnet/unixcompat.c new file mode 100644 index 0000000..d89675b --- /dev/null +++ b/archie/clients/telnet/unixcompat.c @@ -0,0 +1,57 @@ +#include +#ifdef __svr4__ +# include +# include +# include +#else +#endif +#include +#include "protos.h" +#include "unixcompat.h" + +int regain_root() +{ +#ifdef __svr4__ + + return seteuid(0) != -1; + +#else + + return setreuid(geteuid(), getuid()) != -1; + +#endif +} + + +int revoke_root() +{ +#ifdef __svr4__ + + return seteuid(getuid()) != -1; + +#else + + return setreuid(geteuid(), getuid()) != -1; + +#endif +} + + +void u_sleep(usecs) + unsigned int usecs; +{ +#ifdef __svr4__ + struct pollfd dummy; + int timeout; + + if ((timeout = usecs / 1000) <= 0) + { + timeout = 1; + } + poll(&dummy, 0, timeout); + +#else + + (void)usleep(usecs); +#endif +} diff --git a/archie/clients/telnet/unixcompat.h b/archie/clients/telnet/unixcompat.h new file mode 100644 index 0000000..e1110e8 --- /dev/null +++ b/archie/clients/telnet/unixcompat.h @@ -0,0 +1,11 @@ +#ifndef UNIXCOMPAT_H +#define UNIXCOMPAT_H + +#include "ansi_compat.h" + + +extern int regain_root PROTO((void)); +extern int revoke_root PROTO((void)); +extern void u_sleep PROTO((unsigned int usecs)); + +#endif diff --git a/archie/clients/telnet/vars.c b/archie/clients/telnet/vars.c new file mode 100644 index 0000000..397263f --- /dev/null +++ b/archie/clients/telnet/vars.c @@ -0,0 +1,511 @@ +/* + Routines to handle the manipulation of archie variables. +*/ + +#ifndef AIX +#include +#endif +#include +#include +#ifdef __STDC__ +#include +#include +#endif +#include "defines.h" +#include "error.h" +#include "lang.h" +#include "misc.h" +#include "misc_ansi_defs.h" +#include "mode.h" +#include "strmap.h" +#include "vars.h" + +#include "protos.h" + +extern int set_term(); + + +#include "vars_lang.h" /* protect from string extraction */ + + +static enum var_type_e get_var_type PROTO((const char *varname)); +static int check_value PROTO((const struct var_desc_s *var, const char *value)); +static int set_var_ PROTO((struct var_desc_s *vp, + const char *var_name, const char *var_ptr)); +static int show_all_vars PROTO((void)); +static int show_var PROTO((const char *varname)); +static struct var_desc_s *find PROTO((const char *name)); + + +/* + * Check the 'value' of 'var' against a list of possible values (if such a + * list exists). + */ + +static int check_value(var, value) + const struct var_desc_s *var; + const char *value; +{ + return mapEmpty(var->valid_list) ? 1 : !! mapStr(value, var->valid_list); +} + + +/* + * Return a pointer to the variable specified by name. + */ + +static struct var_desc_s *find(name) + const char *name; +{ + struct var_desc_s *ret = 0; + struct var_desc_s *vp; + + vp = vars; + while ( ! mapEmpty(vp->name)) + { + if (mapStr(name, vp->name)) + { + ret = vp; + break; + } + vp++; + } + return ret; +} + + +/* + * If the variable is set return its value, otherwise return a NULL pointer. + # + # Return the value corresponding to the current language. + */ + +const char *get_var(name) + const char *name; +{ + struct var_desc_s *vp = find(name); + return vp ? mapFirstStr(&vp->val[0]) : (const char *)0; +} + + +/* + * Return the variable type. + */ + +static enum var_type_e get_var_type(name) + const char *name; +{ + struct var_desc_s *vp = find(name); + return vp ? vp->type : VAR_BAD_TYPE; +} + + +/* + * Check whether a variable is set. Return 1 if it is, return 0 if it is + * not set, or does not exist. + */ + +int is_set(name) + const char *name; +{ + struct var_desc_s *vp = find(name); + return vp ? vp->is_set : 0; +} + + +/* + * Really set the variable. + * + * Assumes we have a valid pointer to it. + * + * (Gotta put this first, due to static decl.) + */ + +static int set_var_(vp, var_name, var_ptr) + struct var_desc_s *vp; + const char *var_name; + const char *var_ptr; +{ + /* Do some checks to see whether the variable can be set. */ + + if ( ! (vp->modes & current_mode())) + { + printf(curr_lang[287], var_name, mode_str(current_mode())); + } + if ( ! vp->allow_chval && ! (current_mode() & vp->modes)) + { + printf(curr_lang[288], + var_name) ; + return 0 ; + } + if ( ! check_value(vp, var_ptr)) + { + printf(curr_lang[289], + var_ptr, var_name); + return 0; + } + + if (vp->doit != NOFUNC && ! (*vp->doit)(var_ptr)) + { + return 0; + } + + switch (vp->type) + { + case BOOLEAN: + vp->is_set = 1; + return 1; + + case NUMERIC: + { + int val; + + if (sscanf(var_ptr, curr_lang[274], &val) != 1) + { + printf(curr_lang[290]); + return 0; + } + + + if (val < vp->min_val || val > vp->max_val) + { + printf(curr_lang[291], vp->min_val, vp->max_val); + return 0; + } + + if (vp->is_set && vp->has_been_reset) + { + freeStrMap(vp->val); + } + + if ( ! newStrMap(var_ptr, vp->val)) + { + error(A_ERR, curr_lang[292], curr_lang[293]); + return 0; + } + else + { + if (vp->is_set) + { + vp->has_been_reset = 1; + } + vp->is_set = 1; + return 1; + } + } + + case STRING: + { + if (strlen(var_ptr) > MAX_VAR_STR_LEN) /* simple sanity check */ + { + printf(curr_lang[294], MAX_VAR_STR_LEN); + return 0; + } + + if (vp->is_set && vp->has_been_reset) + { + freeStrMap(vp->val); + } + + if ( ! newStrMap(var_ptr, vp->val)) + { + error(A_ERR, curr_lang[292], curr_lang[293]); + return 0; + } + else + { + if (vp->is_set) + { + vp->has_been_reset = 1; + } + vp->is_set = 1; + return 1; + } + } + + default: + /* This should never happen :-) */ + + error(A_INTERR, curr_lang[295], curr_lang[296]); + return 0; + } +} + + +/* + * Set the value of a variable. + * + * Second argument is always a pointer to the string representation of the + * variable, execpt in the case of BOOLEAN where it is not used. + */ + +int set_var(var_name, var_ptr) + const char *var_name; + const char *var_ptr; +{ + struct var_desc_s *vp; + + if ( ! (vp = find(var_name)) || (vp->is_hidden && ! (current_mode() & vp->modes))) + { + printf(curr_lang[297], + var_name, mode_str(current_mode())); + return 0; + } + return set_var_(vp, var_name, var_ptr); +} + + +/* + * Display all variables. + */ + +static int show_all_vars() +{ + struct var_desc_s *vp; + + for (vp = vars; ! mapEmpty(vp->name); vp++) + { + if ( ! vp->is_hidden) + { + show_var(mapFirstStr(vp->name)); + } + } + return 1; +} + + +/* + * Display a variable. + */ + +static int show_var(name) + const char *name; +{ + const char *type; + struct var_desc_s *vp; + + if ( ! (vp = find(name)) || vp->is_hidden) + { + printf(curr_lang[58], name); + return 1; + } + + if (vp->type == BOOLEAN) + { + type = curr_lang[298]; + if (vp->is_set) + { + printf(curr_lang[299], mapLangStr(&vp->name[0]), type); + } + else + { + printf(curr_lang[300], mapLangStr(&vp->name[0]), type); + } + return 1; + } + else if (vp->type == NUMERIC) + { + type = curr_lang[301]; + } + else if (vp->type == STRING) + { + type = curr_lang[302]; + } + else + { + error(A_INTERR, curr_lang[303], curr_lang[304], + mapLangStr(&vp->name[0])); + return 0; + } + + if (vp->is_set) + { + printf(curr_lang[305], + mapLangStr(&vp->name[0]), type, mapLangStr(&vp->val[0])); + } + else + { + printf(curr_lang[300], mapLangStr(&vp->name[0]), type); + } + return 1; +} + + +/* + * Unset a variable. + */ + +int unset_var(name) + const char *name; +{ + struct var_desc_s *vp; + + if ( ! (vp = find(name)) || (vp->is_hidden && ! (current_mode() & vp->modes))) + { + printf(curr_lang[297], name, mode_str(current_mode())); + return 0; + } + + if ( ! vp->allow_unset) + { + printf(curr_lang[306], + mapFirstStr(&vp->name[0])); + } + else + { + if (vp->is_set) + { + vp->is_set = VAR_UNSET; + if (vp->undoit != NOFUNC) + { + (*vp->undoit)(); + } + if (vp->type != BOOLEAN && vp->has_been_reset) + { + freeStrMap(vp->val); + } + } + } + return 1; +} + + +int change_lang(s) + const char *s; +{ + char hdir[MAX_PATH_LEN]; + + head(get_var(V_HELP_DIR), hdir, sizeof hdir); + strcat(hdir, curr_lang[98]); + strcat(hdir, s); + + if (access(hdir, R_OK | F_OK) != -1) + { +#ifdef UQAM + if (strcmp(s, curr_lang[307]) == 0) curr_lang = english; + else if (strcmp(s, curr_lang[308]) == 0) curr_lang = french; + else + { + printf(curr_lang[309], s); + } +#endif + + return set_var(V_HELP_DIR, hdir); + } + else + { + printf(curr_lang[310], s); + return 0; + } +} + + +int set_it(ac, av) + int ac; + char **av; +{ + enum var_type_e vt; + + if (ac < 2) + { + printf(curr_lang[53], av[0]); + return 0; + } + + switch (vt = get_var_type(av[1])) + { + case BOOLEAN: + if (ac > 2) + { + printf(curr_lang[54]); + return 0; + } + return set_var(av[1], (const char *)0); + + case NUMERIC: + if (ac != 3) + { + printf(curr_lang[55]); + return 0; + } + else + { + return set_var(av[1], av[2]); + } + break; + + case STRING: + if (ac == 2) + { + printf(curr_lang[56]); + return 0; + } + else + { + char var_val[256]; + int i; + + var_val[0] = '\0'; + for(i = 2; i < ac; i++) + { + strcat(var_val, curr_lang[57]); + strcat(var_val, av[i]); + } + return set_var(av[1], var_val + 1); /*bug: kludge*/ + } + + case VAR_BAD_TYPE: + printf(curr_lang[58], av[1]); + return 0; + + default: + error(A_INTERR, curr_lang[59], curr_lang[60], vt); + return 0; + } +} + + +/* + * Print the value of a variable (or all variables). + */ + +int show_it(ac, av) + int ac; + char **av; +{ + if (ac == 1) + { + return show_all_vars(); + } + else + { + while (--ac) + { + if ( ! show_var(*++av)) + { + return 0; + } + } + } + return 1; +} + + +/* + * unset a variable. + */ + +int unset_it(ac, av) + int ac; + char **av; +{ + if (ac == 2) + { + return unset_var(av[1]); + } + else + { + printf(curr_lang[46], av[0]); + return 0; + } +} diff --git a/archie/clients/telnet/vars.h b/archie/clients/telnet/vars.h new file mode 100644 index 0000000..693d5c7 --- /dev/null +++ b/archie/clients/telnet/vars.h @@ -0,0 +1,83 @@ +#ifndef VARS_H +#define VARS_H + +#include "ansi_compat.h" + + +/* + A variable name (as opposed to value) must fit in an array of this length. +*/ + +#define MAX_VAR_NAME_LEN 64 +#define MAX_VAR_STR_LEN 256 + +#define BAD_TYPE 10 + +/* + Names for variables. +*/ + +#define V_AUTOLOGOUT "autologout" +#ifdef MULTIPLE_COLLECTIONS +# define V_COLLECTIONS "collections" +#endif +#define V_COMPRESS "compress" +#define V_DEBUG "debug" +#define V_EMAIL_HELP_FILE "email_help_file" +#define V_ENCODE "encode" +#define V_HELP_DIR "help_dir" +#define V_LANGUAGE "language" +#define V_MAILTO "mailto" +#define V_MAIL_FROM "mail_from" +#define V_MAIL_HOST "mail_host" +#define V_MAIL_SERVICE "mail_service" +#define V_MAN_ASCII_FILE "man_ascii_file" +#define V_MAN_ROFF_FILE "man_roff_file" +#define V_MATCH_DOMAIN "match_domain" +#define V_MATCH_PATH "match_path" +#define V_MAX_SPLIT_SIZE "max_split_size" +#ifdef MULTIPLE_COLLECTIONS +# define V_MAXDOCS "maxdocs" +# define V_MAXHDRS "maxhdrs" +#endif +#define V_MAXHITS "maxhits" +#define V_MAXHITSPM "maxhitspm" +#define V_MAXMATCH "maxmatch" +#define V_MOTD_FILE "motd_file" +#define V_NICENESS "niceness" +#define V_OUTPUT_FORMAT "output_format" +#define V_PAGER "pager" +#define V_PAGER_HELP_OPTS "pager_help_opts" +#define V_PAGER_OPTS "pager_opts" +#define V_PAGER_PATH "pager_path" +#define V_PROMPT "prompt" +#define V_SEARCH "search" +#define V_SERVER "server" +#define V_SERVERS_FILE "servers_file" +#define V_SORTBY "sortby" +#define V_STATUS "status" +#define V_TMPDIR "tmpdir" +#define V_TERM "term" +#define V_WHATIS_FILE "whatis_file" + +enum var_type_e +{ + VAR_BAD_TYPE = BAD_TYPE, + BOOLEAN, + NUMERIC, + STRING +}; + + +extern int change_lang PROTO((const char *s)); + +extern const char *get_var PROTO((const char *varname)); +extern int is_set PROTO((const char *varname)); +extern int set_var PROTO((const char *var_name, const char *var_ptr)); +extern int unset_var PROTO((const char *varname)); + +extern int set_it PROTO((int ac, char **av)); +extern int show_it PROTO((int ac, char **av)); +extern int unset_it PROTO((int ac, char **av)); + +#endif diff --git a/archie/clients/telnet/vars_lang.h b/archie/clients/telnet/vars_lang.h new file mode 100644 index 0000000..0cfd4ed --- /dev/null +++ b/archie/clients/telnet/vars_lang.h @@ -0,0 +1,556 @@ +#include +#include "debug.h" +#include "terminal.h" +#include "vars.h" +#include "macros.h" +#include "strmap.h" + + +#define ALLOW 1 +#define DISALLOW 0 +#define HIDDEN 1 +#define NOFUNC ((int (*)())0) +#define NOLIST {(char *)0} +#define ENDMAP {(const char *)0, (const char *)0} +#define NOMAP {ENDMAP} +#define VAR_SET 1 +#define VAR_UNSET 0 +#define VISIBLE 0 + + +/* + * 'max_val' and 'min_val' only have meaning for variables of NUMERIC type. + * They contain the largest and smallest values that variable may have. + */ + +struct var_desc_s +{ + const StrMap name[2]; + enum var_type_e type; + int is_set; + int allow_chval; /* can we change its value? (applies to set & unset vars) */ + int allow_unset; + int has_been_reset; /* initially 0; 1 after first change of value (for free()ing) */ + int is_hidden; /* show will not display when set */ + int modes; + + /* + The string representation of the value only has meaning for variables of + NUMERIC and STRING type. + */ + + StrMap val[2]; + + /* + These are pointers to functions returning int. If 'doit' is non-null it + is performed when the variable is set. If 'undoit' is non-null it is + performed when the variable is unset. 'doit' takes one argument, the + string representation of the value to be set, while 'undoit' takes no + arguments. + */ + + int (*const doit)(); /* one argument, the value as a string */ + int (*const undoit)(); /* this is getting out of hand */ + + /* + The following two values only have meaning for variables of NUMERIC type. + */ + + const int min_val; + const int max_val; + + /* + The following only has meaning for variables of STRING type. + + A null terminated list of values that the variable may have. If the + pointer itself is null, then the variable may take any value. + */ + + const StrMap valid_list[16]; +}; + + +static struct var_desc_s vars[] = +{ + { + { + {V_AUTOLOGOUT, FRENCH("sortie_automatique")}, + ENDMAP + }, + NUMERIC, VAR_SET, ALLOW, DISALLOW, VAR_UNSET, VISIBLE, M_ALL, + { + {"60"}, + ENDMAP + }, + NOFUNC, NOFUNC, 1, 300, NOMAP + }, +#ifdef MULTIPLE_COLLECTIONS + { + { + {V_COLLECTIONS, FRENCH("collectes")}, + ENDMAP + }, + STRING, VAR_UNSET, ALLOW, ALLOW, VAR_UNSET, VISIBLE, M_ALL, NOMAP, NOFUNC, NOFUNC, 0, 0, NOMAP + }, +#endif + { + { + {V_COMPRESS, FRENCH("condenser")}, + ENDMAP + }, + STRING, VAR_SET, ALLOW, ALLOW, VAR_UNSET, VISIBLE, M_ALL, + { + {"none", FRENCH("aucun")}, + ENDMAP + }, + NOFUNC, NOFUNC, 0, 0, + { + {"compress"}, + {"none", FRENCH("aucun")}, + ENDMAP + } + }, + { + { + {V_DEBUG, FRENCH("debogage")}, + ENDMAP + }, + NUMERIC, VAR_UNSET, ALLOW, DISALLOW, VAR_UNSET, HIDDEN, M_ALL, + { + {"0"}, + ENDMAP + }, + set_debug, unset_debug, 0, INT_MAX, NOMAP + }, + { + {{V_EMAIL_HELP_FILE}, ENDMAP}, + STRING, VAR_SET, DISALLOW, DISALLOW, VAR_UNSET, HIDDEN, M_SYS_RC, + { + {"etc/email.help"}, + ENDMAP + }, + NOFUNC, NOFUNC, + 0, 0, NOMAP + }, + { + { + {V_ENCODE, FRENCH("encodage")}, + ENDMAP + }, + STRING, VAR_SET, ALLOW, ALLOW, VAR_UNSET, VISIBLE, M_ALL, + { + {"none", FRENCH("aucun")}, + ENDMAP + }, + NOFUNC, NOFUNC, 0, 0, + { + {"none", FRENCH("aucun")}, + {"uuencode"}, + ENDMAP + } + }, +#ifdef MULTI_LING + { + {{V_HELP_DIR}, ENDMAP}, + STRING, VAR_SET, DISALLOW, DISALLOW, VAR_UNSET, HIDDEN, M_ALL, + { + {"help/francais"}, + ENDMAP + }, + NOFUNC, NOFUNC, 0, 0, + NOMAP + }, +#else + { + {{V_HELP_DIR}, ENDMAP}, + STRING, VAR_SET, DISALLOW, DISALLOW, VAR_UNSET, HIDDEN, M_ALL, + { + {"help/english"}, + ENDMAP + }, + NOFUNC, NOFUNC, 0, 0, + NOMAP + }, +#endif +#ifdef MULTI_LING + { + { + {V_LANGUAGE, FRENCH("langue")}, + ENDMAP + }, + STRING, VAR_SET, ALLOW, ALLOW, VAR_UNSET, VISIBLE, M_ALL, + { + {"francais"}, + ENDMAP + }, + change_lang, NOFUNC, 0, 0, + { + {"francais"}, + {"english"}, + ENDMAP + } + }, +#else + { + { + {V_LANGUAGE}, + ENDMAP + }, + STRING, VAR_SET, ALLOW, ALLOW, VAR_UNSET, VISIBLE, M_ALL, + { + {"english"}, + ENDMAP + }, + change_lang, NOFUNC, 0, 0, + { +#if 0 + {"english"}, +#endif + ENDMAP + } + }, +#endif + { + {{V_MAIL_FROM}, ENDMAP}, + STRING, VAR_SET, DISALLOW, DISALLOW, VAR_UNSET, HIDDEN, M_SYS_RC, + { + {"(Archie Server) archie-errors", FRENCH("(Serveur archie) archie-errors")}, + ENDMAP + }, + NOFUNC, NOFUNC, 0, 0, NOMAP + }, + { + {{V_MAIL_HOST}, ENDMAP}, + STRING, VAR_SET, DISALLOW, DISALLOW, VAR_UNSET, HIDDEN, M_SYS_RC, + { + {"localhost"}, + ENDMAP + }, + NOFUNC, NOFUNC, 0, 0, + NOMAP + }, + { + {{V_MAIL_SERVICE}, ENDMAP}, + STRING, VAR_SET, DISALLOW, DISALLOW, VAR_UNSET, HIDDEN, M_SYS_RC, + { + {"archiemail"}, + ENDMAP + }, + NOFUNC, NOFUNC, 0, 0, + NOMAP + }, + { + { + {V_MAILTO, FRENCH("adresse")}, + ENDMAP + }, + STRING, VAR_UNSET, ALLOW, ALLOW, VAR_UNSET, VISIBLE, M_EIU, NOMAP, NOFUNC, NOFUNC, 0, 0, + NOMAP + }, + { + {{V_MAN_ASCII_FILE}, ENDMAP}, + STRING, VAR_SET, DISALLOW, DISALLOW, VAR_UNSET, HIDDEN, M_SYS_RC, + { + {"etc/manpage.ascii"}, + ENDMAP + }, + NOFUNC, NOFUNC, 0, 0, NOMAP + }, + { + {{V_MAN_ROFF_FILE}, ENDMAP}, + STRING, VAR_SET, DISALLOW, DISALLOW, VAR_UNSET, HIDDEN, M_SYS_RC, + { + {"etc/manpage.roff"}, + ENDMAP + }, + NOFUNC, NOFUNC, + 0, 0, NOMAP + }, + { + { + {V_MATCH_DOMAIN, FRENCH("match_domain")}, + ENDMAP + }, + STRING, VAR_UNSET, ALLOW, ALLOW, VAR_UNSET, VISIBLE, M_ALL, NOMAP, NOFUNC, NOFUNC, 0, 0, + NOMAP + }, + { + { + {V_MATCH_PATH, FRENCH("match_path")}, + ENDMAP + }, + STRING, VAR_UNSET, ALLOW, ALLOW, VAR_UNSET, VISIBLE, M_ALL, NOMAP, NOFUNC, NOFUNC, 0, 0, + NOMAP + }, + { + {{V_MAX_SPLIT_SIZE}, ENDMAP}, + NUMERIC, VAR_SET, ALLOW, DISALLOW, VAR_UNSET, VISIBLE, M_ALL, + { + {"51200"}, + ENDMAP + }, + NOFUNC, NOFUNC, 1024, + INT_MAX, NOMAP + }, +#ifdef MULTIPLE_COLLECTIONS + { /* WAIS */ + { + {V_MAXDOCS, FRENCH("maxdocs")}, + ENDMAP + }, + NUMERIC, VAR_SET, ALLOW, DISALLOW, VAR_UNSET, VISIBLE, M_ALL, + { + {"10"}, + ENDMAP + }, + NOFUNC, NOFUNC, 0, 1000, NOMAP + }, + { /* WAIS */ + { + {V_MAXHDRS, FRENCH("maxhdrs")}, + ENDMAP + }, + NUMERIC, VAR_SET, ALLOW, DISALLOW, VAR_UNSET, VISIBLE, M_ALL, + { + {"1000"}, + ENDMAP + }, + NOFUNC, NOFUNC, 0, 1000, NOMAP + }, +#endif + { /* archie */ + { + {V_MAXHITS, FRENCH("maxhits")}, /*bug: xlation?*/ + ENDMAP + }, + NUMERIC, VAR_SET, ALLOW, DISALLOW, VAR_UNSET, VISIBLE, M_ALL, + { + {"100"}, + ENDMAP + }, + NOFUNC, NOFUNC, 0, 1000, NOMAP + }, + { /* archie */ + { + {V_MAXHITSPM, FRENCH("maxhitspm")}, /*bug: xlation?*/ + ENDMAP + }, + NUMERIC, VAR_SET, ALLOW, DISALLOW, VAR_UNSET, VISIBLE, M_ALL, + { + {"100"}, + ENDMAP + }, + NOFUNC, NOFUNC, 0, 1000, NOMAP + }, + { /* archie */ + { + {V_MAXMATCH, FRENCH("maxmatch")}, /*bug: xlation?*/ + ENDMAP + }, + NUMERIC, VAR_SET, ALLOW, DISALLOW, VAR_UNSET, VISIBLE, M_ALL, + { + {"100"}, + ENDMAP + }, + NOFUNC, NOFUNC, 0, 1000, NOMAP + }, +#if 1 + { + {{V_MOTD_FILE}, ENDMAP}, + STRING, VAR_SET, DISALLOW, DISALLOW, VAR_UNSET, HIDDEN, M_SYS_RC, + { + {"etc/motd.telnet"}, + ENDMAP + }, + NOFUNC, NOFUNC, 0, 0, + NOMAP + }, +#endif + { + {{V_NICENESS}, ENDMAP}, + NUMERIC, VAR_SET, ALLOW, DISALLOW, VAR_UNSET, HIDDEN, M_SYS_RC, + { + {"4"}, + ENDMAP + }, + NOFUNC, NOFUNC, 19, -20, NOMAP + }, + { + { + {V_OUTPUT_FORMAT, FRENCH("format_des_resultats")}, + ENDMAP + }, + STRING, VAR_SET, ALLOW, DISALLOW, VAR_UNSET, VISIBLE, M_ALL, + { + {"verbose", FRENCH("verbeux")}, + ENDMAP + }, + NOFUNC, NOFUNC, 0, 0, + { + {"machine", FRENCH("ordinateur")}, + {"silent", FRENCH("silencieux")}, + {"terse", FRENCH("breve")}, + {"verbose", FRENCH("verbeux")}, + {"url",FRENCH("url")}, + ENDMAP + } + }, + { + { + {V_PAGER, FRENCH("paginer")}, + ENDMAP + }, + BOOLEAN, VAR_UNSET, ALLOW, ALLOW, VAR_UNSET, VISIBLE, M_ALL, NOMAP, NOFUNC, NOFUNC, 0, 0, + NOMAP + }, + { + {{V_PAGER_HELP_OPTS}, ENDMAP}, + STRING, VAR_SET, ALLOW, ALLOW, VAR_UNSET, HIDDEN, M_ALL, + { + {"-c"}, + ENDMAP + }, + NOFUNC, NOFUNC, 0, 0, NOMAP + }, + { + {{V_PAGER_OPTS}, ENDMAP}, + STRING, VAR_SET, ALLOW, ALLOW, VAR_UNSET, HIDDEN, M_ALL, + { + {"-c"}, + ENDMAP + }, + NOFUNC, NOFUNC, 0, 0, NOMAP + }, + { + {{V_PAGER_PATH}, ENDMAP}, + STRING, VAR_SET, DISALLOW, DISALLOW, VAR_UNSET, HIDDEN, M_ALL, + { + {"less"}, + ENDMAP + }, + NOFUNC, NOFUNC, 0, 0, NOMAP + }, + { + {{V_PROMPT}, ENDMAP}, + STRING, VAR_SET, DISALLOW, DISALLOW, VAR_UNSET, HIDDEN, M_ALL, + { + {"archie> "}, + ENDMAP + }, + NOFUNC, NOFUNC, 0, 0, NOMAP + }, + { + { + {V_SEARCH, FRENCH("chercher")}, + ENDMAP + }, + STRING, VAR_SET, ALLOW, DISALLOW, VAR_UNSET, VISIBLE, M_ALL, + { + {"exact"}, + ENDMAP + }, + NOFUNC, NOFUNC, 0, 0, + { + {"exact", FRENCH("exact")}, + {"regex", FRENCH("regex")}, + {"sub", FRENCH("sub")}, + {"subcase", FRENCH("subcase")}, + ENDMAP + } + }, + { + {{V_SERVER, FRENCH("serveur")}, ENDMAP}, + STRING, VAR_SET, ALLOW, DISALLOW, VAR_UNSET, VISIBLE, M_ALL, + { + {"localhost"}, + ENDMAP + }, + NOFUNC, NOFUNC, 0, 0, NOMAP + }, + { + {{V_SERVERS_FILE}, ENDMAP}, + STRING, VAR_SET, DISALLOW, DISALLOW, VAR_UNSET, HIDDEN, M_SYS_RC, + { + {"etc/serverlist"}, + ENDMAP + }, + NOFUNC, NOFUNC, 0, 0, + NOMAP + }, + { + { + {V_SORTBY, FRENCH("trier_par")}, + ENDMAP + }, + STRING, VAR_SET, ALLOW, DISALLOW, VAR_UNSET, VISIBLE, M_ALL, + { + {"none", FRENCH("aucun")}, + ENDMAP + }, + NOFUNC, NOFUNC, 0, 0, + { + {"filename", FRENCH("nom_du_fichier")}, + {"hostname", FRENCH("nom_d'hote")}, + {"none", FRENCH("aucun")}, + {"size", FRENCH("taille")}, + {"time", FRENCH("temps")}, + {"rfilename", FRENCH("inv_nom_du_fichier")}, + {"rhostname", FRENCH("inv_nom_d'hote")}, + {"rnothing", FRENCH("inv_aucun")}, + {"rsize", FRENCH("inv_taille")}, + {"rtime", FRENCH("inv_temps")}, /*bug: xlation?*/ + ENDMAP + } + }, + { + { + {V_STATUS, FRENCH("statut")}, + ENDMAP + }, + BOOLEAN, VAR_SET, ALLOW, ALLOW, VAR_UNSET, VISIBLE, M_ALL, NOMAP, NOFUNC, NOFUNC, 0, 0, + NOMAP + }, + { + { + {V_TERM}, + ENDMAP + }, + STRING, VAR_SET, ALLOW, DISALLOW, VAR_UNSET, VISIBLE, M_ALL, + { + {"dumb 24 80"}, + ENDMAP + }, + set_term, NOFUNC, 0, 0, + NOMAP + }, + { + { + {V_TMPDIR}, + ENDMAP + }, + STRING, VAR_SET, ALLOW, DISALLOW, VAR_UNSET, HIDDEN, M_ALL, + { + {"db/tmp"}, /* so as to use ~archie/db/tmp whether suid or not */ + ENDMAP + }, + NOFUNC, NOFUNC, 0, 0, NOMAP + }, + { + {{V_WHATIS_FILE}, ENDMAP}, + STRING, VAR_SET, DISALLOW, DISALLOW, VAR_UNSET, HIDDEN, M_SYS_RC, + { + {"etc/whatis"}, + ENDMAP + }, + NOFUNC, NOFUNC, 0, 0, + NOMAP + }, + + /* End of the list */ + + { + NOMAP, + VAR_BAD_TYPE, VAR_UNSET, ALLOW, ALLOW, VAR_UNSET, HIDDEN, M_NONE, NOMAP, NOFUNC, NOFUNC, + 0, 0, NOMAP + } +}; diff --git a/archie/clients/telnet/version.c b/archie/clients/telnet/version.c new file mode 100644 index 0000000..ec606fa --- /dev/null +++ b/archie/clients/telnet/version.c @@ -0,0 +1,2 @@ +#include "ansi_compat.h" +#include "version_lang.h" diff --git a/archie/clients/telnet/version.h b/archie/clients/telnet/version.h new file mode 100644 index 0000000..3b432af --- /dev/null +++ b/archie/clients/telnet/version.h @@ -0,0 +1,6 @@ +#ifndef VERSION_H +#define VERSION_H + +extern const char version[]; + +#endif diff --git a/archie/clients/telnet/version_lang.h b/archie/clients/telnet/version_lang.h new file mode 100644 index 0000000..4bde1f6 --- /dev/null +++ b/archie/clients/telnet/version_lang.h @@ -0,0 +1 @@ +const char version[] = VERSION; diff --git a/archie/clients/telnet/whatis.c b/archie/clients/telnet/whatis.c new file mode 100644 index 0000000..014e2b0 --- /dev/null +++ b/archie/clients/telnet/whatis.c @@ -0,0 +1,204 @@ +#include +#include +#ifdef MMAP +#include +#endif +#include +#include +#include +#include +#include "alarm.h" +#include "ansi_compat.h" +#include "client_defs.h" +#include "client_structs.h" +/*#include "database.h"*/ +#include "defines.h" +#include "error.h" +#include "extern.h" +#include "fork_wait.h" +#include "lang.h" +#include "macros.h" +#include "misc.h" +#include "misc_ansi_defs.h" +#include "mode.h" +#include "pager.h" +#include "prosp.h" +#include "style_lang.h" +#include "terminal.h" +#include "vars.h" +#include "whatis.h" + +#include "protos.h" + +static int get_whatis_list PROTO((FILE *ofp, const char *srch_str, int nsrchs, int scr_width)); + + +/* + * Search through the "whatis" database and find the requested substring + */ + +static int get_whatis_list(ofp, srch_str, nsrchs, scr_width) + FILE *ofp; + const char *srch_str; + int nsrchs; + int scr_width; +{ +#ifdef P5_WHATIS + SpinStart spin; + int email = current_mode() == M_EMAIL; + int ret = 0; + struct aquery arq; + + aq_init(&arq); + arq.host = get_var(V_SERVER); + arq.string = srch_str; + arq.query_type = AQ_WHATIS; + arq.flags = AQ_NOSORT; + + /*bug: we should fork_me() for this */ + if (archie_query(&arq, spin()) != PSUCCESS) + { + perrmesg((char *)0, 0, (char *)0); + } + else + { + VLINK r = arq.results; + int ostyle = VERBOSE; + + if ( ! r) /*bug: check no matches => r == 0*/ + { + fputs(curr_lang[115], nsrchs == 1 ? stdout : ofp); + } + else + { + strtoval(get_var(V_OUTPUT_FORMAT), &ostyle, style_list); + + fputs(curr_lang[28], ofp); + for (; r; r = r->next) + { + fprint_whatis_item(ofp, r, ostyle); + } + + ret = 1; + /* bug: should free up VLINK structs here? */ + vllfree(arq.results); + } + } + + return ret; + +#else + + FILE *what_fp; + char des_line[MAX_STRING_LEN]; + int found = 0; + + ptr_check(ofp, FILE, curr_lang[311], 0); + ptr_check(srch_str, const char, curr_lang[311], 0); + + if ( ! (what_fp = fopen(get_var(V_WHATIS_FILE), curr_lang[44]))) + { + error(A_SYSERR, curr_lang[311], curr_lang[312], + get_var(V_WHATIS_FILE)); + return 0; + } + + while (fgets(des_line, sizeof(des_line), what_fp)) + { + initskip(srch_str, (int)strlen(srch_str), 1); + if (strfind(des_line, (int)strlen(des_line))) + { + char *end; + char *start; + char *ws; + + found = 1; + + /* + * Knock off any leading or trailing white space. + */ + nuke_newline(des_line); + bracketstr(des_line, (const char **)&start, (const char **)&end); /* sigh */ + *(end + 1) = '\0'; + + ws = strpbrk(start, "\t"); + if ( ! ws) + { + fputs(start, ofp); fputs(curr_lang[28], ofp); + } + else + { + char c = *ws; + char *nw; /* next word */ + + nw = ws + strspn(ws, WHITE_SPACE); + *ws = '\0'; + if (nw != ws) /* there was more after the white space */ + { + char pfix[INPUT_LINE_LEN]; + + sprintf(pfix, "%-25s ", start); + fmtprintf(ofp, pfix, nw, get_cols()); + } + else + { + fputs(start, ofp); fputs(curr_lang[28], ofp); + } + *ws = c; + } + } + } + + if ( ! found) + { + printf(curr_lang[314], srch_str); + } + + return found; +#endif +} + + +int whatis_it(ac, av, ofp) + int ac; + char **av; + FILE *ofp; +{ + int ret = 0; + + ptr_check(av, char *, curr_lang[49], 0); + ptr_check(ofp, FILE, curr_lang[49], 0); + + if (ac != 2) + { + printf(curr_lang[46], av[0]); + return 0; + } + + mode_truncate_fp(ofp); + /*bug: this should take multiple strings*/ +#ifdef P5_WHATIS + ret = get_whatis_list(ofp, av[1], 1, get_cols()); +#else + switch (fork_me(0, &ret)) + { + case (enum forkme_e)INTERNAL_ERROR: + break; + + case CHILD: + ret = get_whatis_list(ofp, av[1], 1, get_cols()); + fork_return(ret); + break; + + case PARENT: + set_alarm(); + break; + + default: + error(A_INTERR, curr_lang[49], curr_lang[48]); + break; + } +#endif + + return ret; +} diff --git a/archie/clients/telnet/whatis.h b/archie/clients/telnet/whatis.h new file mode 100644 index 0000000..575be31 --- /dev/null +++ b/archie/clients/telnet/whatis.h @@ -0,0 +1,9 @@ +#ifndef WHATIS_H +#define WHATIS_H + +#include "ansi_compat.h" + + +extern int whatis_it PROTO((int ac, char **av, FILE *ofp)); + +#endif diff --git a/archie/control/.gitignore b/archie/control/.gitignore new file mode 100644 index 0000000..f3c7a7c --- /dev/null +++ b/archie/control/.gitignore @@ -0,0 +1 @@ +Makefile diff --git a/archie/control/AIX-2/.gitignore b/archie/control/AIX-2/.gitignore new file mode 100644 index 0000000..f3c7a7c --- /dev/null +++ b/archie/control/AIX-2/.gitignore @@ -0,0 +1 @@ +Makefile diff --git a/archie/control/AIX-2/Makefile.in b/archie/control/AIX-2/Makefile.in new file mode 100755 index 0000000..221761b --- /dev/null +++ b/archie/control/AIX-2/Makefile.in @@ -0,0 +1,12 @@ +# +# Use GNU's fixed header files. +# +SYS_DEFS = -DAIX +SENT_FLAGS = -ffixed-%g2 -ffixed-%g3 -ffixed-%g4 +SYS_LIBS = -L${BERKDB_ROOT}/${SYSTYPE} -ldb + +include ../Makefile.pre + +include ../Makefile.post + +# DO NOT DELETE THIS LINE -- make depend depends on it diff --git a/archie/control/Makefile.post b/archie/control/Makefile.post new file mode 100755 index 0000000..4557ae2 --- /dev/null +++ b/archie/control/Makefile.post @@ -0,0 +1,20 @@ +# +# Control module. +# + +all: $(EXES) + +include $(ARCHIE_ROOT)/Makefile.post + +arcontrol: $(OBJS) \ + $(ANONFTP_MODULE)/lib/$(SYSTYPE)/libanonftp.a \ + $(LIBARCHIE_MODULE)/$(SYSTYPE)/libarchie.a \ + $(STRIDX_MODULE)/$(SYSTYPE)/libarchstridx.a \ + $(HOSTDB_MODULE)/$(SYSTYPE)/libhostdb.a \ + $(PATRIE_MODULE)/$(SYSTYPE)/libpatrie.a \ + $(STARTDB_MODULE)/$(SYSTYPE)/libstartdb.a \ + $(WEBINDEX_MODULE)/lib/$(SYSTYPE)/libwebindex.a + $(CC) $(CFLAGS) -o $@ $(OBJS) $(MOD_LIBS) $(SYS_LIBS) + +clean: + rm -f *.o $(EXES) core diff --git a/archie/control/Makefile.pre b/archie/control/Makefile.pre new file mode 100755 index 0000000..a58b345 --- /dev/null +++ b/archie/control/Makefile.pre @@ -0,0 +1,36 @@ +# +# Control module. +# + +#MOD_CFLAGS = -ansi -pedantic -pipe +MOD_DEBUG = -g3 +MOD_WARN = -Wall -Wtraditional -Wshadow -Wpointer-arith -Wcast-align \ + -Wstrict-prototypes -Wnested-externs +MOD_INCS = -I$(INCLUDE_MODULE) -I$(PATRIE_MODULE) -I$(STRIDX_MODULE) -I. +MOD_LIBS = \ + -L$(HOSTDB_MODULE)/$(SYSTYPE) -lhostdb \ + -L$(STARTDB_MODULE)/$(SYSTYPE) -lstartdb \ + -L$(LIBARCHIE_MODULE)/$(SYSTYPE) -larchie \ + -L$(WEBINDEX_MODULE)/lib/$(SYSTYPE) -lwebindex \ + -L$(ANONFTP_MODULE)/lib/$(SYSTYPE) -lanonftp \ + -L$(STRIDX_MODULE)/$(SYSTYPE) -larchstridx \ + -L$(PATRIE_MODULE)/$(SYSTYPE) -lpatrie + + +include $(ARCHIE_ROOT)/Makefile.pre + + +INCS = \ + control.h \ + lang_control.h + +SRCS = \ + lang_control.c \ + main.c + +OBJS = \ + lang_control.o \ + main.o + +EXES = \ + arcontrol diff --git a/archie/control/SunOS-4.1.4/.gitignore b/archie/control/SunOS-4.1.4/.gitignore new file mode 100644 index 0000000..f3c7a7c --- /dev/null +++ b/archie/control/SunOS-4.1.4/.gitignore @@ -0,0 +1 @@ +Makefile diff --git a/archie/control/SunOS-4.1.4/Makefile.in b/archie/control/SunOS-4.1.4/Makefile.in new file mode 100755 index 0000000..6aa0c69 --- /dev/null +++ b/archie/control/SunOS-4.1.4/Makefile.in @@ -0,0 +1,11 @@ +# +# Use GNU's fixed header files. +# +SYS_DEFS = -D__USE_FIXED_PROTOTYPES__ -DSUNOS +SENT_FLAGS = -ffixed-%g2 -ffixed-%g3 -ffixed-%g4 +SYS_LIBS = -lresolv -L${BERKDB_ROOT}/${SYSTYPE} -ldb + +include ../Makefile.pre +include ../Makefile.post + +# DO NOT DELETE THIS LINE -- make depend depends on it diff --git a/archie/control/SunOS-5.4/.gitignore b/archie/control/SunOS-5.4/.gitignore new file mode 100644 index 0000000..f3c7a7c --- /dev/null +++ b/archie/control/SunOS-5.4/.gitignore @@ -0,0 +1 @@ +Makefile diff --git a/archie/control/SunOS-5.4/Makefile.in b/archie/control/SunOS-5.4/Makefile.in new file mode 100755 index 0000000..c2b0e01 --- /dev/null +++ b/archie/control/SunOS-5.4/Makefile.in @@ -0,0 +1,11 @@ +# +# Use GNU's fixed header files. +# +SYS_DEFS = -D__USE_FIXED_PROTOTYPES__ -DSOLARIS +SENT_FLAGS = -ffixed-%g2 -ffixed-%g3 -ffixed-%g4 +SYS_LIBS = -lnsl -lsocket -lresolv -L${BERKDB_ROOT}/${SYSTYPE} -ldb + +include ../Makefile.pre +include ../Makefile.post + +# DO NOT DELETE THIS LINE -- make depend depends on it diff --git a/archie/control/SunOS-5.6 b/archie/control/SunOS-5.6 new file mode 120000 index 0000000..7b4e044 --- /dev/null +++ b/archie/control/SunOS-5.6 @@ -0,0 +1 @@ +SunOS-5.4 \ No newline at end of file diff --git a/archie/control/control.h b/archie/control/control.h new file mode 100644 index 0000000..e00577e --- /dev/null +++ b/archie/control/control.h @@ -0,0 +1,45 @@ +#ifndef _CONTROL_H_ +#define _CONTROL_H_ + +#include +#include "host_db.h" + +#define NONE_MAN 0 +#define RETRIEVE_MAN 1 +#define PARSE_MAN 2 +#define UPDATE_MAN 3 +#define PARTIAL_MAN 4 + +#define CNTL_DONT_WAIT 1 +#define CNTL_WAIT 2 + +#define DEFAULT_MAX_COUNT 30 + + +#define DEFAULT_TIMEOUT 10 * 60 /* 10 Minutes */ +#define DEFAULT_SLEEP_PERIOD 5 /* 5 seconds */ + +#define MAX_FAIL 2 + +#ifndef POST_PROCESS_PGM +#define POST_PROCESS_PGM "archie_postprocess" +#endif + +#define PROCESS_STOP_FILE "process.stop" + +typedef struct{ + access_methods_t dbname; + hostname_t primary_hostname; + pathname_t input; + pathname_t output; + pathname_t proc_prog; + int pid; +} retlist_t; + +extern status_t preprocess_file PROTO((char *, char **, retlist_t *, int, int)); +extern status_t cntl_function PROTO((retlist_t *, int, int, int, int, int, int, int)); +extern host_status_t cntl_check_hostdb PROTO((file_info_t *,file_info_t *,file_info_t *,header_t *, hostdb_t *, int,int)); +extern status_t write_hostdb_failure PROTO((file_info_t *,file_info_t *,header_t *,int,int)); + + +#endif diff --git a/archie/control/lang_control.c b/archie/control/lang_control.c new file mode 100644 index 0000000..257a631 --- /dev/null +++ b/archie/control/lang_control.c @@ -0,0 +1,70 @@ +char* ARCONTROL_001 = "Error while trying to set master database directory"; +char* ARCONTROL_002 = "Error while trying to set host database directory"; +char* ARCONTROL_003 = "Unknown control function"; +char* ARCONTROL_004 = "Can't get list of files to process"; +char* ARCONTROL_005 = "Can't allocate space for internal list"; +char* ARCONTROL_006 = "Can't properly preprocess input files"; +char* ARCONTROL_007 = "Error while trying to perform control actions"; +char* ARCONTROL_008 = "Error while trying to free internal list"; +char* ARCONTROL_009 = "No files found for processing"; + +/* preprocess_file */ + +char* PREPROCESS_FILE_001 = "Can't open input file %s"; +char* PREPROCESS_FILE_002 = "Can't read header of %s"; +char* PREPROCESS_FILE_003 = "Error while trying to open host database"; +char* PREPROCESS_FILE_004 = "Error with %s: %s"; +char* PREPROCESS_FILE_005 = "Can't write failure record to host databases"; +char* PREPROCESS_FILE_006 = "Can't unlink() failure input %s"; +char* PREPROCESS_FILE_007 = "Can't get temporary name for file %s. Ignoring"; +char* PREPROCESS_FILE_008 = "Can't open temp file %s"; +char* PREPROCESS_FILE_009 = "Unknown format for %s. Ignoring"; +char* PREPROCESS_FILE_010 = "Unknown control function %d. Aborting."; +char* PREPROCESS_FILE_011 = "Failure writing header. Ignoring %s"; +char* PREPROCESS_FILE_012 = "Can't execl() preprocess program %s"; +char* PREPROCESS_FILE_013 = "Can't dup2() input file"; +char* PREPROCESS_FILE_014 = "Can't dup2() output file"; +char* PREPROCESS_FILE_015 = "Can't vfork() preprocess program %s"; +char* PREPROCESS_FILE_016 = "Error while in wait() for preprocess program %s"; +char* PREPROCESS_FILE_017 = "Preprocess program %s exited abnormally with signal %u"; +char* PREPROCESS_FILE_018 = "Preprocess program %s terminated abnormally with signal %u"; +char* PREPROCESS_FILE_019 = "Can't unlink() original input data file %s"; +char* PREPROCESS_FILE_020 = "Can't close %s"; +char* PREPROCESS_FILE_021 = "Can't rename temporary file %s to %s"; +char* PREPROCESS_FILE_022 = "Can't rename delete header file from %s to %s"; +char* PREPROCESS_FILE_023 = "Can't unlink input file %s"; +char* PREPROCESS_FILE_024 = "Can't unlink() temporary data file %s"; +char* PREPROCESS_FILE_025 = "Can't rename invalid data file %s to %s"; +char* PREPROCESS_FILE_026 = "Can't fstat() file %s" ; +char* PREPROCESS_FILE_027 = "File %s is empty. Ignoring"; + +char* CNTL_CHECK_HOSTDB_001= "Host %s: %s"; +char* CNTL_CHECK_HOSTDB_002= "Error trying to insert new host %s into primary database"; +char* CNTL_CHECK_HOSTDB_003= "Error trying to insert new host %s into primary database"; +char* CNTL_CHECK_HOSTDB_004= "Host %s cannot be resolved. Host unknown."; + + +char* CNTL_FUNCTION_001 = "Unknown function type: %d"; +char* CNTL_FUNCTION_002 = "Can't execl() program %s for %s database"; +char* CNTL_FUNCTION_003 = "Can't vfork() program %s"; +char* CNTL_FUNCTION_004 = "Error while in wait() for program %s"; +char* CNTL_FUNCTION_005 = "Program %s exited with value %u"; +char* CNTL_FUNCTION_006 = "Program %s terminated abnormally with signal %u"; +char* CNTL_FUNCTION_007 = "Can't unlink() orginal input data file %s"; +char* CNTL_FUNCTION_008 = "Unknown control function"; +char* CNTL_FUNCTION_009 = "Can't kill child %d"; +char* CNTL_FUNCTION_010 = "Timeout or terminate signal: %s %s. Terminated"; +char* CNTL_FUNCTION_011 = "Can't open input file %s for error header"; +char* CNTL_FUNCTION_012 = "Can't open output file %s for error header"; +char* CNTL_FUNCTION_013 = "Error while trying to read header of input file %s"; +char* CNTL_FUNCTION_014 = "Can't unlink input file %s"; +char* CNTL_FUNCTION_015 = "wait() exited abnormally. Continuing"; +char* CNTL_FUNCTION_016 = "Can't find child with pid %d in retlist table!"; +char* CNTL_FUNCTION_017 = "Program %s (%d) exited with value %d"; +char* CNTL_FUNCTION_018 = "Program %s (%d) terminated abnormally with signal %d"; +char* CNTL_FUNCTION_019 = "Running %s on %s"; +char* CNTL_FUNCTION_020 = "Can't malloc space for argument list"; + +char* WRITE_HOSTDB_FAILURE_001 = "%s does not exist in database. Shouldn't happen"; +char* WRITE_HOSTDB_FAILURE_002 = "Can't write failure to primary host database for %s"; +char* WRITE_HOSTDB_FAILURE_003 = "Can't update hostaux rec for %s"; diff --git a/archie/control/lang_control.h b/archie/control/lang_control.h new file mode 100644 index 0000000..3495b66 --- /dev/null +++ b/archie/control/lang_control.h @@ -0,0 +1,73 @@ +extern char* ARCONTROL_001 ; +extern char* ARCONTROL_002 ; +extern char* ARCONTROL_003 ; +extern char* ARCONTROL_004 ; +extern char* ARCONTROL_005 ; +extern char* ARCONTROL_006 ; +extern char* ARCONTROL_007 ; +extern char* ARCONTROL_008 ; +extern char* ARCONTROL_009 ; + +/* preprocess_file */ + +extern char* PREPROCESS_FILE_001 ; +extern char* PREPROCESS_FILE_002 ; +extern char* PREPROCESS_FILE_003 ; +extern char* PREPROCESS_FILE_004 ; +extern char* PREPROCESS_FILE_005 ; +extern char* PREPROCESS_FILE_006 ; +extern char* PREPROCESS_FILE_007 ; +extern char* PREPROCESS_FILE_008 ; +extern char* PREPROCESS_FILE_009 ; +extern char* PREPROCESS_FILE_010 ; +extern char* PREPROCESS_FILE_011 ; +extern char* PREPROCESS_FILE_012 ; +extern char* PREPROCESS_FILE_013 ; +extern char* PREPROCESS_FILE_014 ; +extern char* PREPROCESS_FILE_015 ; +extern char* PREPROCESS_FILE_016 ; +extern char* PREPROCESS_FILE_017 ; +extern char* PREPROCESS_FILE_018 ; +extern char* PREPROCESS_FILE_019 ; +extern char* PREPROCESS_FILE_020 ; +extern char* PREPROCESS_FILE_021 ; +extern char* PREPROCESS_FILE_022 ; +extern char* PREPROCESS_FILE_023 ; +extern char* PREPROCESS_FILE_024 ; +extern char* PREPROCESS_FILE_025 ; +extern char* PREPROCESS_FILE_026 ; +extern char* PREPROCESS_FILE_027 ; + +extern char* CNTL_CHECK_HOSTDB_001; +extern char* CNTL_CHECK_HOSTDB_002; +extern char* CNTL_CHECK_HOSTDB_003; +extern char* CNTL_CHECK_HOSTDB_004; + +extern char* CNTL_FUNCTION_001 ; +extern char* CNTL_FUNCTION_002 ; +extern char* CNTL_FUNCTION_003 ; +extern char* CNTL_FUNCTION_004 ; +extern char* CNTL_FUNCTION_005 ; +extern char* CNTL_FUNCTION_006 ; +extern char* CNTL_FUNCTION_007 ; +extern char* CNTL_FUNCTION_008 ; +extern char* CNTL_FUNCTION_009 ; +extern char* CNTL_FUNCTION_010 ; +extern char* CNTL_FUNCTION_011 ; +extern char* CNTL_FUNCTION_012 ; +extern char* CNTL_FUNCTION_013 ; +extern char* CNTL_FUNCTION_014 ; +extern char* CNTL_FUNCTION_015 ; +extern char* CNTL_FUNCTION_016 ; +extern char* CNTL_FUNCTION_017 ; +extern char* CNTL_FUNCTION_018 ; +extern char* CNTL_FUNCTION_019 ; +extern char* CNTL_FUNCTION_020 ; + + + +extern char* SIG_HANDLE_001 ; + +extern char* WRITE_HOSTDB_FAILURE_001 ; +extern char* WRITE_HOSTDB_FAILURE_002 ; +extern char* WRITE_HOSTDB_FAILURE_003 ; diff --git a/archie/control/main.c b/archie/control/main.c new file mode 100644 index 0000000..70ea075 --- /dev/null +++ b/archie/control/main.c @@ -0,0 +1,1668 @@ +/* + * This file is copyright Bunyip Information Systems Inc., 1994. This file + * may not be reproduced, copied or transmitted by any means mechanical or + * electronic without the express written consent of Bunyip Information + * Systems Inc. + */ + + +#include +#include +#include +#include +#include +#if !defined(AIX) && !defined(SOLARIS) +#include +#endif +#include +#include +#include +#include +#include +#include +#include "typedef.h" +#include "db_files.h" +#include "host_db.h" +#include "hinfo.h" +#include "header.h" +#include "error.h" +#include "control.h" +#include "lang_control.h" +#include "archie_dbm.h" +#include "archie_strings.h" +#include "files.h" +#include "master.h" +#include "archie_mail.h" +#include "protos.h" +#include "db_ops.h" +#include "patrie.h" +#include "archstridx.h" + + +/* arcontrol: main controlling program for the archie system + + + argv, argc are used. + + + Parameters: -H Mandatory. + -w + -M + -h + -l (write to log file, default) + -I + -L + -v (verbose) + -m (write mail) + -c (max count) + -T [passed to retrieval function] + -U (actively uncompress) [passed to retrieval function] + -n (leave data in orginal form) [passed to retrieval function] + -Z (pickup ls-lR.Z or ls-lR files) [passed to retrieval function] + +*/ + + +int signal_set = 0; /* For timeout alarm */ + +int verbose = 0; /* verbose mode */ + +int num_retr = 100; +int minidxsize = 0; +int force = 0; + +int send_mail = 0; /* send mail */ +char *prog; +pathname_t temp_dir; + +int main(argc, argv) + int argc; + char *argv[]; + +{ + extern int opterr; + extern char *optarg; + +#if 0 +#ifdef __STDC__ + + extern int getopt(int, char **, char *); + +#else + + extern int getopt(); + +#endif +#endif + + char **cmdline_ptr; + int cmdline_args; + + int option; + pathname_t master_database_dir; + pathname_t host_database_dir; + + pathname_t tmp_dir; + + pathname_t logfile; + + char **file_list; + char *suffix; + + int retr_timeout = DEFAULT_TIMEOUT; + int retr_sleep_period = DEFAULT_SLEEP_PERIOD; + + int maxcount = 0; + + retlist_t *retlist; + + int function = NONE_MAN; + + int pickup_lslR = 0; + + int count = 0; + + int logging = 0; + + int post_process = 0; + + int compress_flag = 1; /* Actively compress resulting retreived info == 1 + Actively uncompress == -1 + Do nothing == 0 */ + + host_database_dir[0] = '\0'; + master_database_dir[0] = '\0'; + + tmp_dir[0] = logfile[0] = '\0'; + + /* disable error messages of getopt */ + + opterr = 0; + + cmdline_ptr = argv + 1; + cmdline_args = argc - 1; + + prog = argv[0]; + + minidxsize = 0; + + while((option = (int) getopt(argc, argv, "h:M:t:I:rpuPL:T:m:vlUN:nZPS:F")) != EOF){ + + switch(option){ + + /* master database directory */ + + case 'F': + force = 1; + cmdline_ptr++; + cmdline_args++; + break; + + case 'M': + strcpy(master_database_dir,optarg); + cmdline_ptr += 2; + cmdline_args -= 2; + break; + + /* logfile name */ + + case 'L': + strcpy(logfile, optarg); + logging = 1; + cmdline_ptr += 2; + cmdline_args -= 2; + break; + + /* post process not advertized for now */ + + case 'E': + post_process = 1; + cmdline_ptr ++; + cmdline_args --; + break; + + /* retrieve timeout */ + + case 'T': + retr_timeout = atoi(optarg) * 60; + cmdline_ptr += 2; + cmdline_args -= 2; + break; + + /* Retrieve sleep period */ + case 'S': + retr_sleep_period = atoi(optarg); + cmdline_ptr += 2; + cmdline_args -= 2; + break; + + + /* Actively uncompress retrieved information */ + + case 'U': + compress_flag = -1; + cmdline_ptr ++; + cmdline_args --; + break; + + /* pickup ls-lR.Z files */ + + case 'Z': + pickup_lslR = 1; + cmdline_ptr ++; + cmdline_args --; + break; + + /* host database directory */ + + case 'h': + strcpy(host_database_dir,optarg); + cmdline_ptr += 2; + cmdline_args -= 2; + break; + + /* log output, default file */ + + case 'l': + logging = 1; + cmdline_ptr++; + cmdline_args--; + break; + + /* maximum number of entries to process */ + + case 'm': + maxcount = atoi(optarg); + cmdline_ptr += 2; + cmdline_args -= 2; + break; + + + /* leave data in original format */ + case 'N': + num_retr = atoi(optarg); + cmdline_ptr += 2; + cmdline_args -= 2; + break; + + case 'n': + compress_flag = 0; + cmdline_ptr++; + cmdline_args--; + break; + + /* invoke in partial mode */ + + case 'P': + function = PARTIAL_MAN; + cmdline_ptr++; + cmdline_args--; + break; + + /* invoke in parse mode */ + + case 'p': + function = PARSE_MAN; + cmdline_ptr++; + cmdline_args--; + break; + + /* invoke in retrieve mode */ + + case 'r': + function = RETRIEVE_MAN; + cmdline_ptr++; + cmdline_args--; + break; + + /* temporary directory name */ + + case 't': + strcpy(tmp_dir,optarg); + cmdline_ptr += 2; + cmdline_args -= 2; + break; + + /* minimum index size */ + + case 'I': + minidxsize = atoi(optarg); + cmdline_ptr += 2; + cmdline_args -= 2; + break; + + /* invoke in update mode */ + + case 'u': + function = UPDATE_MAN; + cmdline_ptr++; + cmdline_args--; + break; + + /* verbose mode */ + + case 'v': + verbose = 1; + cmdline_ptr++; + cmdline_args--; + break; + + default: + error(A_ERR,"arcontrol","Unknown option '%s'\nUsage: arcontrol -H -w -M -h -l -L -I -v -m -c -T [passed to retrieval function] -U [passed to retrieval function] -S [Web retrieval] -n [passed to retrieval function] -Z [passed to retrieval function] ", *cmdline_ptr); + exit(A_OK); + } + } + + if(function == NONE_MAN){ + error(A_ERR,"arcontrol","Option required 'r', 'p', 'P', or 'u'"); + exit(ERROR); + } + + + /* set up logs */ + + if(logging){ + if(logfile[0] == '\0'){ + if(open_alog((char *) NULL, A_INFO, tail(argv[0])) == ERROR) + exit(ERROR); + } + else{ + if(open_alog(logfile, A_INFO, tail(argv[0])) == ERROR) + exit(ERROR); + } + } + + if(set_master_db_dir(master_database_dir) == (char *) NULL){ + + /* "Error while trying to set master database directory" */ + + error(A_ERR,"arcontrol", ARCONTROL_001); + exit(ERROR); + } + + + + if(set_host_db_dir(host_database_dir) == (char *) NULL){ + + /* "Error while trying to set host database directory" */ + + error(A_ERR,"arcontrol", ARCONTROL_002); + exit(ERROR); + } + + + /* setup default tmp directory if not given */ + + if(tmp_dir[0] == '\0') + sprintf(tmp_dir,"%s/%s",get_master_db_dir(), DEFAULT_TMP_DIR); + + strcpy(temp_dir,tmp_dir); + + if((function == RETRIEVE_MAN) && (maxcount == 0)) + maxcount = DEFAULT_MAX_COUNT; + + + if(post_process && (function != UPDATE_MAN)) + post_process = 0; + + /* determine the input function */ + + switch(function){ + + case UPDATE_MAN: + suffix = SUFFIX_UPDATE; + break; + + case PARSE_MAN: + suffix = SUFFIX_PARSE; + break; + + case RETRIEVE_MAN: + suffix = SUFFIX_RETR; + break; + + case PARTIAL_MAN: + suffix = SUFFIX_PARTIAL_UPDATE; + break; + + default: + error(A_INTERR,"arcontrol", ARCONTROL_003); + exit(ERROR); + break; + } + + if(get_file_list(tmp_dir, &file_list, suffix, &count) == ERROR){ + + /* "Can't get list of files to process" */ + + error(A_ERR,"arcontrol", ARCONTROL_004); + exit(ERROR); + } + + /* no files to process */ + + if(count == 0){ + + if(verbose){ + + /* "No files found for processing" */ + + error(A_INFO, "arcontrol", ARCONTROL_009); + } + + exit(A_OK); + } + + if((retlist = (retlist_t *) malloc(count * sizeof(retlist_t))) == (retlist_t *) NULL){ + + /* "Can't allocate space for internal list" */ + + error(A_SYSERR,"arcontrol", ARCONTROL_005); + exit(ERROR); + } + + if(preprocess_file(tmp_dir, file_list, retlist, maxcount, function) == ERROR){ + + /* "Can't properly preprocess input files" */ + + error(A_ERR,"arcontrol", ARCONTROL_006); + exit(ERROR); + } + + if(cntl_function(retlist,function, retr_timeout, retr_sleep_period, logging, compress_flag, pickup_lslR, post_process) == ERROR){ + + /* "Error while trying to perform control actions" */ + + error(A_ERR,"arcontrol", ARCONTROL_007); + exit(ERROR); + } + +#if !defined(__STDC__) && !defined(AIX) + + if(free(retlist) == -1){ + + /* "Error while trying to free internal list" */ + + error(A_WARN, "arcontrol", ARCONTROL_008); + } +#else + + free(retlist); + +#endif + + if(logging) + close_alog(); + + exit(A_OK); + return(A_OK); +} + + +/* + * preprocess_file: perform actions necessary to make sure that input files + * are correct format for actual processing + */ + + +status_t preprocess_file(tmp_dir, file_list, retlist, maxcount, function) + char *tmp_dir; /* tmp directory name */ + char **file_list; /* list of input files */ + retlist_t *retlist; /* internal list */ + int maxcount; /* maximum number of files to be processed */ + int function; /* function being performed */ +{ +#ifdef __STDC__ + + extern time_t time(time_t *); + +#else + + extern time_t time(); + extern int rename(); + +#endif + + char **ptr; + pathname_t filen; + header_t header_rec; + u32 offset; + char *str; + int status, result; + flags_t flags = 0, control_flags = 0; + int count; + struct stat statbuf; + pathname_t stopfile; + + char *process_pgm = (char *) NULL; + pathname_t process_name; + + file_info_t *tmp_file = create_finfo(); + file_info_t *input_file = create_finfo(); + + file_info_t *hostbyaddr = create_finfo(); + file_info_t *hostdb = create_finfo(); + file_info_t *domaindb = create_finfo(); + file_info_t *hostaux_db = create_finfo(); + + + ptr_check(tmp_dir, char, "preprocess_file", ERROR); + ptr_check(file_list, char*, "preprocess_file", ERROR); + ptr_check(retlist, retlist_t, "preprocess_file", ERROR); + + if(open_host_dbs(hostbyaddr, hostdb, domaindb, hostaux_db, O_RDWR) != A_OK){ + /* "Error while trying to open host database" */ + + error(A_ERR,"preprocess_file", PREPROCESS_FILE_003); + return(ERROR); + } + + /* if we're not retrieving and maxcount is zero then process + as many files as we have */ + + if((function != RETRIEVE_MAN) && (maxcount == 0)) + maxcount = INT_MAX; + + /* for all given files */ + + sprintf(stopfile, "%s/%s/%s", get_archie_home(), DEFAULT_ETC_DIR, PROCESS_STOP_FILE); + + for(count = 0, ptr = file_list; (*ptr != (char *) NULL) && (count < maxcount) ; ptr++){ + + if(access(stopfile, R_OK | F_OK) != -1){ + + write_mail(MAIL_HOST_SUCCESS,"Execution terminated because of stopfile at data file %s", *ptr); + exit(A_OK); + } + + sprintf(filen, "%s/%s", tmp_dir, *ptr); + strcpy(input_file -> filename, filen); + + if(open_file(input_file, O_RDONLY) == ERROR){ + + /* "Can't open input file %s" */ + + error(A_ERR,"preprocess_file",PREPROCESS_FILE_001, input_file -> filename); + continue; + } + + + if(fstat(fileno(input_file -> fp_or_dbm.fp), &statbuf) == -1){ + + /* "Can't fstat() file %s" */ + + error(A_ERR, "preprocess_file", PREPROCESS_FILE_026, input_file -> filename); + continue; + } + + if(statbuf.st_size == 0){ + + /* "File %s is empty. Ignoring" */ + + error(A_ERR, "preprocess_file", PREPROCESS_FILE_027, input_file -> filename); + + close_file(input_file); + unlink(input_file -> filename); + continue; + } + + + if(read_header(input_file -> fp_or_dbm.fp, &header_rec, &offset, 0, 1) == ERROR){ + + /* "Can't read header of %s" */ + + error(A_ERR,"preprocess_file",PREPROCESS_FILE_002, input_file -> filename); + + continue; + } + + /* don't retrieve header files which are delete records */ + + if((function == RETRIEVE_MAN) && + ((header_rec.current_status == DEL_BY_ADMIN) || (header_rec.current_status == DEL_BY_ARCHIE))){ + pathname_t tmp_string; + + sprintf(tmp_string, "%s/%s-%s%s", tmp_dir, header_rec.primary_hostname, header_rec.access_methods, SUFFIX_UPDATE); + + if(rename(input_file -> filename, tmp_string) == -1){ + + /* "Can't rename delete header file from %s to %s" */ + + error(A_SYSERR, "preprocess_file", PREPROCESS_FILE_022, input_file -> filename, tmp_string); + } + + close_file(input_file); + continue; + } + + + str = get_tmp_filename(tmp_dir); + + if(str){ + strcpy(tmp_file -> filename, str); + free(str); + } + else{ + + /* "Can't get temporary name for file %s. Ignoring" */ + + error(A_INTERR,"preprocess_file",PREPROCESS_FILE_007, input_file -> filename); + continue; + } + + if(open_file(tmp_file, O_WRONLY) == ERROR){ + + /* "Can't open temp file %s" */ + + error(A_ERR,"preprocess_file",PREPROCESS_FILE_008, tmp_file -> filename); + continue; + } + + switch(header_rec.format){ + + case FRAW: + + process_pgm = CAT_PGM; + + break; + + case FCOMPRESS_LZ: + + process_pgm = UNCOMPRESS_PGM; + + break; + + case FCOMPRESS_GZIP: + + if ( get_option_path( "UNCOMPRESS", "GZIP", process_name) == ERROR ) { + return ERROR; + } + process_pgm = process_name; + break; + + default: + + /* "Unknown format for %s. Ignoring" */ + + error(A_INTERR,"preprocess_files", PREPROCESS_FILE_009, input_file -> filename); + header_rec.update_status = FAIL; + break; + } + + header_rec.format = FRAW; + + + if(header_rec.update_status == FAIL){ + + switch(function){ + + case PARSE_MAN: + + header_rec.parse_time = (date_time_t) time((time_t *) NULL); + HDR_SET_PARSE_TIME(header_rec.header_flags); + break; + + case RETRIEVE_MAN: + header_rec.retrieve_time = (date_time_t) time((time_t *) NULL); + HDR_SET_RETRIEVE_TIME(header_rec.header_flags); + break; + + case UPDATE_MAN: + { + hostname_t hostptr; + access_methods_t dbname; + AR_DNS *dns_ent; + hostdb_t orig_hostdb, new_hostdb; + hostdb_aux_t orig_hostaux_db, new_hostaux_db; + char newtmp[2*1024], oldtmp[2*1024]; + int j; + index_t ind; + + ind=0; + + strcpy( hostptr, header_rec.primary_hostname ); + strcpy( dbname, header_rec.access_methods ); + + if(get_dbm_entry(hostptr, strlen(hostptr) + 1, + &orig_hostdb, hostdb) == ERROR){ + + /* "Can't find %s in primary host database" */ + + error(A_ERR, "arcontrol", "Can't find %s in primary host database", hostptr); + goto failure; + } + + if((dns_ent = ar_open_dns_name(header_rec.preferred_hostname, + DNS_EXTERN_ONLY, hostdb )) == (AR_DNS *) NULL){ + error(A_ERR,"arcontrol","unknown preferred name"); + goto failure; + }else{ + +#ifdef SOLARIS + if((cmp_dns_name(orig_hostdb.primary_hostname, dns_ent) == ERROR) && + (cmp_dns_name(header_rec.preferred_hostname, dns_ent) == ERROR)) +#else + if(cmp_dns_name(orig_hostdb.primary_hostname, dns_ent) == ERROR) +#endif + { + /* preferred name %s doesn't map back to primary name %s but instead to %s */ + error(A_INTERR, "arcontrol","preferred name %s doesn't map back to primary name %s but instead to %s" , + header_rec.preferred_hostname, + orig_hostdb.primary_hostname, + get_dns_primary_name(dns_ent)); + + /* make a new copy of the hostdb record */ + if(get_dbm_entry(hostptr, strlen(hostptr) + 1, + &new_hostdb , hostdb) == ERROR){ + + /* "Can't find %s in primary host database" */ + + error(A_ERR, "arcontrol","Can't find %s in primary host database" , hostptr); + goto failure; + } + + /* find the new primary name */ + + strcpy(new_hostdb.primary_hostname, get_dns_primary_name(dns_ent)); + + /* Check if this primary name is in the site already */ + if(get_dbm_entry(new_hostdb.primary_hostname, + strlen(new_hostdb.primary_hostname) + 1, + &new_hostdb , hostdb) != ERROR){ + error(A_ERR, "arcontrol", "The new primary name %s is also in the database, can't reintroduce it", + new_hostdb.primary_hostname); + goto failure; + }else if(put_dbm_entry(new_hostdb.primary_hostname, + strlen(new_hostdb.primary_hostname) + 1, + &new_hostdb, sizeof(hostdb_t) , hostdb, TRUE) == ERROR){ + /* "Can't find %s in primary host database" */ + error(A_ERR, "arcontrol", "Can't find %s in primary host database", + new_hostdb.primary_hostname); + goto failure; + } + + find_hostaux_last(orig_hostdb.primary_hostname, + dbname, &ind, hostaux_db); + + for( j=0; j filename); + + close_file(tmp_file); + unlink(tmp_file -> filename); + continue; + break; + } + case PARTIAL_MAN: + break; + + default: + + /* "Unknown control function %d. Aborting." */ + + error(A_INTERR,"preprocess_file",PREPROCESS_FILE_010, function); + break; + } + + goto fail_handle; + } + + + if(write_header(tmp_file -> fp_or_dbm.fp, &header_rec, (u32 *) NULL, 0,0) == ERROR){ + + /* "Failure writing header. Ignoring %s" */ + + error(A_ERR,"preprocess_file", PREPROCESS_FILE_011, header_rec.primary_hostname); + continue; + } + + /* So that all processes don't start up too quickly */ + + sleep(1); + + if((result = fork()) == 0){ + + + if(dup2(fileno(input_file -> fp_or_dbm.fp), 0) == -1){ + + /* "Can't dup2() input file" */ + + error(A_SYSERR, "preprocess_file", PREPROCESS_FILE_013); + exit(ERROR); + } + + if(dup2(fileno(tmp_file -> fp_or_dbm.fp), 1) == -1){ + + /* "Can't dup2() output file" */ + + error(A_SYSERR, "preprocess_file", PREPROCESS_FILE_014); + exit(ERROR); + } + + execl(process_pgm, process_pgm, (char *) NULL); + + /* "Can't execl() preprocess program %s" */ + + error(A_SYSERR, PREPROCESS_FILE_012, process_pgm); + exit(ERROR); + } + + + if(result == -1){ + + /* "Can't vfork() preprocess program %s" */ + + error(A_SYSERR,"preprocess_file", PREPROCESS_FILE_015, process_pgm); + goto fail_handle; + } + + + if(wait(&status) == -1){ + + /* "Error while in wait() for preprocess program %s" */ + + error(A_ERR,"preprocess_file",PREPROCESS_FILE_017, process_pgm); + goto fail_handle; + } + + if(WIFEXITED(status) && WEXITSTATUS(status)){ + + /* "Program %s exited with value %d" */ + + error(A_ERR,"preprocess_file",PREPROCESS_FILE_017, process_pgm, WEXITSTATUS(status)); + goto fail_handle; + } + + if(WIFSIGNALED(status)){ + + /* "Preprocess program %s terminated abnormally with signal %d" */ + + error(A_ERR,"preprocess_file", PREPROCESS_FILE_018, process_pgm, WTERMSIG(status)); + goto fail_handle; + + } + + + fail_handle: + + /* Using filenames as basis for naming. This is a stupid + thing to do... has to be fixed */ + + if(header_rec.update_status != FAIL) + sprintf(filen,"%s%s", input_file -> filename, TMP_SUFFIX); + else{ + int finished; + + /* Generate a "random" handle */ + + srand(time((time_t *) NULL)); + + for(finished = 0; !finished;){ + + sprintf(filen,"%s/%s-%s_%d%s", tmp_dir, header_rec.primary_hostname, header_rec.access_methods, rand() % 100, function == PARSE_MAN ? SUFFIX_UPDATE : SUFFIX_PARSE); + + if(access(filen, R_OK | F_OK) == -1) + finished = 1; + } + + write_error_header(tmp_file, &header_rec); + + } + + if(close_file(input_file) == ERROR){ + + /* "Can't close %s" */ + + error(A_ERR,"preprocess_file", PREPROCESS_FILE_020, filen); + } + + if((tmp_file -> fp_or_dbm.fp != (FILE *) NULL) && (close_file(tmp_file) == ERROR)){ + + /* "Can't close %s" */ + + error(A_ERR,"preprocess_file", PREPROCESS_FILE_020, tmp_file -> filename); + } + + + if(rename(tmp_file -> filename, filen) == -1){ + + /* "Can't rename temporary file %s to %s" */ + + error(A_SYSERR,"preprocess_file", PREPROCESS_FILE_021, tmp_file -> filename, *ptr); + } + + + if(unlink(input_file -> filename) == -1){ + + /* "Can't unlink() original input data file %s" */ + + error(A_SYSERR, "preprocess_file", PREPROCESS_FILE_019, input_file -> filename); + } + + if(header_rec.update_status == FAIL) + continue; + + strcpy(retlist[count].dbname, header_rec.access_methods); + strcpy(retlist[count].input, filen); + strcpy(retlist[count].primary_hostname, header_rec.primary_hostname); + count++; + } + + retlist[count].dbname[0] = '\0'; + destroy_finfo(input_file); + destroy_finfo(tmp_file); + + close_host_dbs(hostbyaddr, hostdb, domaindb, hostaux_db); + + destroy_finfo(hostbyaddr); + destroy_finfo(hostdb); + destroy_finfo(domaindb); + destroy_finfo(hostaux_db); + + + return(A_OK); +} + +/* + * cntl_check_hostdb: verfy the host being processed + */ + + +host_status_t cntl_check_hostdb(hostbyaddr, hostdb, hostaux_db, header_rec, hdb_rec, flags, control_flags) + file_info_t *hostbyaddr; /* host address cache */ + file_info_t *hostdb; /* primary host database */ + file_info_t *hostaux_db; /* auxiliary host database */ + header_t *header_rec; /* header record */ + hostdb_t *hdb_rec; /* returned primary host database record */ + flags_t flags; + flags_t control_flags; + +{ + hostdb_t hostdb_rec; + hostbyaddr_t hostbyaddr_rec; + host_status_t host_status = 0; + + + ptr_check(hostbyaddr, file_info_t, "cntl_check_hostdb", HOST_PTR_NULL); + ptr_check(hostdb, file_info_t, "cntl_check_hostdb", HOST_PTR_NULL); + ptr_check(hostaux_db, file_info_t, "cntl_check_hostdb", HOST_PTR_NULL); + ptr_check(header_rec, header_t, "cntl_check_hostdb", HOST_PTR_NULL); + ptr_check(hdb_rec, hostdb_t, "cntl_check_hostdb", HOST_PTR_NULL); + + + make_hostdb_from_header(header_rec, &hostdb_rec, flags); + + if((host_status = check_new_hentry(hostbyaddr, hostdb, &hostdb_rec, hostaux_db, NULL, flags, control_flags) != HOST_OK)){ + + if((host_status = check_old_hentry(hostbyaddr, hostdb, &hostdb_rec, hostaux_db, NULL, flags, control_flags)) != HOST_OK){ + + /* "Host %s: %s" */ + + error(A_ERR, "cntl_check_hostdb", CNTL_CHECK_HOSTDB_001, hostdb_rec.primary_hostname, get_host_error(host_status)); + *hdb_rec = hostdb_rec; + return(host_status); + } + + *hdb_rec = hostdb_rec; + } + else{ + + /* Host is new */ + + /* Just add the host, no auxiliary information */ + + hostdb_rec.access_methods[0] = '\0'; + + if(host_status != HOST_UNKNOWN){ + + if(put_dbm_entry(hostdb_rec.primary_hostname, strlen(hostdb_rec.primary_hostname) + 1, &hostdb_rec, sizeof(hostdb_t), hostdb, FALSE) != A_OK){ + + /* "Error trying to insert new host %s into primary database" */ + + error(A_ERR, "cntl_check_hostdb", CNTL_CHECK_HOSTDB_002, hostdb_rec.primary_hostname); + return(HOST_INS_FAIL); + } + + hostbyaddr_rec.primary_ipaddr = hostdb_rec.primary_ipaddr; + strcpy(hostbyaddr_rec.primary_hostname, hostdb_rec.primary_hostname); + + if(put_dbm_entry(&hostbyaddr_rec.primary_ipaddr, sizeof(ip_addr_t), &hostbyaddr_rec, sizeof(hostbyaddr_t), hostbyaddr, FALSE) == ERROR){ + + /* "Error trying to insert new host %s into host address cache" */ + + error(A_ERR, "cntl_check_hostdb", CNTL_CHECK_HOSTDB_003); + return(HOST_PADDR_FAIL); + } + + write_mail(MAIL_HOST_ADD, "%s", hostdb_rec.primary_hostname); + } + else{ + + /* "Host %s cannot be resolved. Host unknown." */ + + error(A_ERR, "cntl_check_hostdb", CNTL_CHECK_HOSTDB_004, header_rec -> primary_hostname); + return(HOST_UNKNOWN); + } + } + + return(HOST_OK); +} + +/* + * retlist_cmp: compare process ids (pid's) in the retlist type + */ + + +int retlist_cmp(a, b) + retlist_t *a; + retlist_t *b; + +{ + if(a -> pid > b -> pid) + return(1); + else if(a -> pid < b -> pid) + return(-1); + else + return(0); +} + +/* + * cntl_function: perform the action for which the program was called + */ + + +status_t cntl_function(retlist, function, retr_timeout, retr_sleep_period, logging, compress_flag, pickup_lslR, post_process) + retlist_t *retlist; + int function; + int retr_timeout, retr_sleep_period; + int logging; + int compress_flag; + int pickup_lslR; + int post_process; +{ + retlist_t *ptr; + header_t header_rec; + pathname_t process_pgm; + pathname_t output_template; + int result, status; + file_info_t *input_file = create_finfo(); + pathname_t files_database_dir; + pathname_t wfiles_database_dir; + char **arglist, dbs[80]; /* need to think of what size to give it */ +/* struct arch_stridx_handle *strhan;*/ +/* char *dbdir; */ +/* index_t d; */ +/* char s[1] = "0"; */ + char *tstr; + int waitstate = CNTL_WAIT; + int count; + int i; + pathname_t time_str; + pathname_t sleep_str; + pathname_t stopfile; + char minsize[256]; + char num_retr_str[256]; + + files_database_dir[0] = wfiles_database_dir[0] = dbs[0] = '\0'; + + ptr_check(retlist, retlist_t, "cntl_function", ERROR); + + sprintf(stopfile, "%s/%s/%s", get_archie_home(), DEFAULT_ETC_DIR, PROCESS_STOP_FILE); + + for(count = 0, ptr = retlist; ptr -> dbname[0] != '\0'; ptr++){ + + /* Check to see if a file, ~archie/etc/update.stop exists, + if so, exit without error */ + + if(access(stopfile, R_OK | F_OK) != -1){ + + write_mail(MAIL_HOST_SUCCESS,"Execution terminated because of stopfile at %s %s", ptr -> primary_hostname, ptr -> dbname); + exit(A_OK); + } + + strcpy(input_file -> filename, ptr -> input); + + /* Run the appropriate program on this information */ + + switch(function){ + + case UPDATE_MAN: + + tstr = UPDATE_PREFIX; + waitstate = CNTL_WAIT; + break; + + case RETRIEVE_MAN: + + tstr = RETRIEVE_PREFIX; + waitstate = CNTL_DONT_WAIT; + minidxsize = 0; + break; + + case PARSE_MAN: + + tstr = PARSE_PREFIX; + waitstate = CNTL_WAIT; + minidxsize = 0; + break; + + case PARTIAL_MAN: + tstr = PARTIAL_PREFIX; + waitstate = CNTL_WAIT; + minidxsize = 0; + break; + + default: + + /* "Unknown function type: %d" */ + + error(A_INTERR,"cntl_function", CNTL_FUNCTION_001, function); + break; + } + + + sprintf(process_pgm,"%s/%s/%s%s",get_archie_home(),DEFAULT_BIN_DIR, tstr, ptr -> dbname); + + sprintf(output_template,"%s/%s-%s", temp_dir, ptr -> primary_hostname, ptr -> dbname); + + if((arglist = (char **) malloc(MAX_NO_PARAMS * sizeof(char *))) == (char **) NULL){ + + /* "Can't malloc space for argument list" */ + + error(A_SYSERR, "cntl_function", CNTL_FUNCTION_020); + return(ERROR); + } + + /* set up argument list */ + + i = 0; + arglist[i++] = process_pgm; + + arglist[i++] = "-M"; + arglist[i++] = get_master_db_dir(); + + arglist[i++] = "-h"; + arglist[i++] = get_host_db_dir(); + + arglist[i++] = "-i"; + arglist[i++] = input_file -> filename; + + arglist[i++] = "-o"; + arglist[i++] = output_template; + + arglist[i++] = "-t"; + arglist[i++] = temp_dir; + + if (function == RETRIEVE_MAN && strcasecmp(ptr->dbname,"webindex") == 0 ) { + arglist[i++] = "-N"; + sprintf(num_retr_str,"%d",num_retr); + arglist[i++] = num_retr_str; + } + + if( minidxsize != 0 ){ + arglist[i++] = "-I"; + sprintf(minsize,"%d",minidxsize); + arglist[i++] = minsize; + } + + if(logging){ + + arglist[i++] = "-L"; + arglist[i++] = get_archie_logname(); + } + + if(verbose) + arglist[i++] = "-v"; + + if(function == RETRIEVE_MAN){ + + sprintf(time_str, "%d", retr_timeout/60); + + arglist[i++] = "-T"; + arglist[i++] = time_str; + + sprintf(sleep_str, "%d", retr_sleep_period); + + arglist[i++] = "-S"; + arglist[i++] = sleep_str; + + if ( force ) { + arglist[i++] = "-F"; + } + + if(compress_flag == -1) + arglist[i++] = "-U"; + else if (compress_flag == 0) + arglist[i++] = "-n"; + + if(pickup_lslR == 1) + arglist[i++] = "-Z"; + + } + + arglist[i] = (char *) NULL; + + /* "Running %s on %s" */ + + if(verbose){ + int j; + char holds[1024]; + char thold[1024]; + + error(A_INFO, "cntl_function", CNTL_FUNCTION_019, tail(process_pgm), tail(output_template)); + + holds[0] = '\0'; + + for(j = 1; j < i; j++){ + + sprintf(thold, " %s", arglist[j]); + strcat(holds, thold); + } + + error(A_INFO, "cntl_function", "Calling %s %s", process_pgm, holds); + } + + + + /* So you don't kill the machine */ + + sleep(1); + + if((result = fork()) == 0){ + + /* Set the master db directory to be the same as this process + and turn logging on and turn off standalone */ + + execv(process_pgm, arglist); + + /* "Can't execl() program %s for %s database" */ + + error(A_SYSERR, "cntl_function", CNTL_FUNCTION_002, process_pgm, header_rec.access_methods); + exit(ERROR); + } + + if(arglist) + free(arglist); + + if(result == -1){ + + /* "Can't vfork() program %s" */ + + error(A_SYSERR,"cntl_function", CNTL_FUNCTION_003, tail(process_pgm)); + return(ERROR); + } + + + if(waitstate == CNTL_WAIT){ + int fail = 0; + + if(wait(&status) == -1){ + + /* "Error while in wait() for program %s" */ + + error(A_SYSERR,"cntl_function",CNTL_FUNCTION_004, tail(process_pgm)); + fail = 1; + } + + if(WIFEXITED(status) && WEXITSTATUS(status)){ + + /* "Program %s exited with value %u" */ + + error(A_ERR,"cntl_function",CNTL_FUNCTION_005, tail(process_pgm), WEXITSTATUS(status)); + fail = 1; + } + + + if(WIFSIGNALED(status)){ + + write_mail(MAIL_HOST_FAIL,"Program %s aborted with signal %d for %s %s", tail(process_pgm), WTERMSIG(status), ptr -> primary_hostname, ptr -> dbname); + + /* "Program %s terminated abnormally with signal %u" */ + + error(A_ERR,"cntl_function",CNTL_FUNCTION_006, tail(process_pgm), WTERMSIG(status)); + fail = 1; + } + + + if(fail == 0){ + if(function == UPDATE_MAN){ + write_mail(MAIL_HOST_SUCCESS,"%s %s", ptr -> primary_hostname, ptr -> dbname); + + /* Here we keep track of the different databases + * that have been updated + */ + + if( !strstr(dbs,ptr -> dbname) ) + strcat(dbs,ptr->dbname); + } + } + else{ + + if(function == UPDATE_MAN) + write_mail(MAIL_HOST_FAIL,"%s %s update failed", ptr -> primary_hostname, ptr -> dbname); + else if(function == PARSE_MAN) + write_mail(MAIL_PARSE_FAIL,"%s %s parse failed", ptr -> primary_hostname, ptr -> dbname); + } + } + else{ + ptr -> pid = result; + strcpy(ptr -> proc_prog, tail(process_pgm)); + strcpy(ptr -> output, output_template); + count++; + } + } + + + if(waitstate == CNTL_DONT_WAIT){ + pid_t waitid; + int i; + + /* sort by pid */ + + qsort((char *) retlist, count, sizeof(retlist_t), retlist_cmp); + + for(i = count;i != 0; i--){ + retlist_t curr_ret_rec; + + waitid = wait(&status); + + /* wait for children to exit */ + + if(waitid == -1){ + + /* "wait() exited abnormally. Continuing" */ + + error(A_SYSERR,"cntl_function", CNTL_FUNCTION_015); + continue; + } + + curr_ret_rec.pid = waitid; + + if((ptr = (retlist_t *) bsearch ((char *) &curr_ret_rec, (char *) retlist, count, sizeof (retlist_t), retlist_cmp)) == (retlist_t *) NULL){ + + /* "Can't find child with pid %d in retlist table!" */ + + error(A_INTERR,"cntl_function",CNTL_FUNCTION_016, waitid); + continue; + } + + if(WIFEXITED(status) && WEXITSTATUS(status)){ + + /* "Program %s (%d) exited with value %d" */ + + /* Note: mail will be written from retrieval program */ + + error(A_ERR,"cntl_function", CNTL_FUNCTION_017, ptr -> proc_prog, ptr -> pid, WEXITSTATUS(status)); + + continue; + } + + if(WIFSIGNALED(status)){ + + /* "Program %s (%d) terminated abnormally with signal %d" */ + + error(A_ERR,"cntl_function",CNTL_FUNCTION_018, ptr -> proc_prog, ptr -> pid, WTERMSIG(status)); + continue; + } + + ptr -> pid = 0; + + qsort((char *) retlist, count, sizeof(retlist_t), retlist_cmp); + + } + } + + if(!post_process) + return(A_OK); + + /* Do post processing */ + + sprintf(process_pgm,"%s/%s/%s",get_archie_home(),DEFAULT_BIN_DIR, POST_PROCESS_PGM); + + /* If the post processing program does not exist then ignore rest */ + + if((access(process_pgm, R_OK | X_OK | F_OK) != -1) && (function == UPDATE_MAN)){ + pid_t waitid; + + if((arglist = (char **) malloc(MAX_NO_PARAMS * sizeof(char *))) == (char **) NULL){ + + /* "Can't malloc space for argument list" */ + + error(A_SYSERR, "cntl_function", CNTL_FUNCTION_020); + return(ERROR); + } + + /* set up argument list */ + + i = 0; + arglist[i++] = process_pgm; + + arglist[i++] = "-M"; + arglist[i++] = get_master_db_dir(); + + arglist[i++] = "-h"; + arglist[i++] = get_host_db_dir(); + + if(logging){ + + arglist[i++] = "-L"; + arglist[i++] = get_archie_logname(); + } + + if(verbose) + arglist[i++] = "-v"; + + arglist[i] = (char *) NULL; + + /* "Running %s on %s" */ + + if(verbose){ + int j; + char holds[1024]; + char thold[1024]; + + error(A_INFO, "cntl_function", CNTL_FUNCTION_019, tail(process_pgm), tail(output_template)); + + holds[0] = '\0'; + + for(j = 1; j < i; j++){ + + sprintf(thold, " %s", arglist[j]); + strcat(holds, thold); + } + + error(A_INFO, "cntl_function", "Calling %s %s", process_pgm, holds); + } + + + if((result = fork()) == 0){ + + execv(process_pgm, arglist); + + /* "Can't execl() program %s for %s database" */ + + error(A_SYSERR, "cntl_function", CNTL_FUNCTION_002, process_pgm, header_rec.access_methods); + exit(ERROR); + } + + if(arglist) + free(arglist); + + if(result == -1){ + + /* "Can't vfork() program %s" */ + + error(A_SYSERR,"cntl_function", CNTL_FUNCTION_003, tail(process_pgm)); + return(ERROR); + } + + waitid = wait(&status); + + /* wait for children to exit */ + + if(waitid == -1){ + + /* "wait() exited abnormally. Continuing" */ + + error(A_SYSERR,"cntl_function", CNTL_FUNCTION_015); + } + + if(WIFEXITED(status) && WEXITSTATUS(status)){ + + /* "Program %s (%d) exited with value %d" */ + + error(A_ERR,"cntl_function", CNTL_FUNCTION_017, process_pgm , waitid, WEXITSTATUS(status)); + + } + + if(WIFSIGNALED(status)){ + + /* "Program %s (%d) terminated abnormally with signal %d" */ + + error(A_ERR,"cntl_function",CNTL_FUNCTION_018, process_pgm, waitid, WTERMSIG(status)); + } + } + + return(A_OK); +} + +/* + * write_hostdb_failure: host an error entry into the primary and auxiliary + * host databases + */ + + + +status_t write_hostdb_failure(hostdb, hostaux_db, header_rec, flags, control_flags) + file_info_t *hostdb; /* primary host database */ + file_info_t *hostaux_db; /* auxiliary host database */ + header_t *header_rec; /* header record */ + flags_t flags; + flags_t control_flags; +{ +#if 0 +#ifdef __STDC__ + + extern int strcasecmp(char *, char *); + extern time_t time(time_t *); + +#else + + extern int strcasecmp(); + extern time_t time(); + +#endif +#endif + + hostdb_aux_t hostaux_rec; + hostdb_t hostdb_rec; + access_methods_t haux_name; + pathname_t tmp_string; + int finished; + index_t index; + + + ptr_check(hostdb, file_info_t, "write_hostdb_failure", ERROR); + ptr_check(hostaux_db, file_info_t, "write_hostdb_failure", ERROR); + ptr_check(header_rec, header_t, "write_hostdb_failure", ERROR); + + + + + memset(&hostaux_rec, '\0', sizeof(hostdb_aux_t)); + + /* Don't really care if the record is there or not */ + + + if ( get_hostaux_ent(header_rec -> primary_hostname, + header_rec -> access_methods, &index, + header_rec -> preferred_hostname, + header_rec -> access_command, + &hostaux_rec, hostaux_db ) == ERROR ) { + /* + if(get_dbm_entry(haux_name, strlen(haux_name) + 1, &hostaux_rec, hostaux_db) == ERROR){ + */ + char **alist; + char **aptr; + + if(get_dbm_entry(header_rec -> primary_hostname, strlen(header_rec -> primary_hostname) + 1, &hostdb_rec, hostdb) == ERROR){ + +#if 0 + /* "%s does not exist in database. Shouldn't happen" */ + + error(A_INTERR,"write_hostdb_failure",WRITE_HOSTDB_FAILURE_001, header_rec -> primary_hostname); +#endif + return(A_OK); + } + + alist = str_sep(hostdb_rec.access_methods, NET_DELIM_CHAR); + + for(finished = 0, aptr = alist; *aptr != (char *) NULL;){ + + if(strcasecmp(*aptr, header_rec -> access_methods) == 0){ + finished = 1; + break; + } + + aptr++; + } + + if(!finished){ + *aptr = (char *) strdup(header_rec -> access_methods); + + sprintf(hostdb_rec.access_methods, "%s", *alist); + + aptr = alist + 1; + + while(*aptr != (char *) NULL){ + + sprintf(tmp_string, ":%s",*aptr); + strcat(hostdb_rec.access_methods, tmp_string); + aptr++; + + } + + if(put_dbm_entry(hostdb_rec.primary_hostname, strlen(hostdb_rec.primary_hostname) + 1, &hostdb_rec, sizeof(hostdb_t), hostdb, TRUE) != A_OK){ + + /* "Can't write failure to primary host database for %s" */ + + error(A_ERR, "write_hostdb_failure", WRITE_HOSTDB_FAILURE_002, hostdb_rec.primary_hostname); + return(ERROR); + } + } + + if(alist) + free_opts(alist); + } + + header_rec -> update_time = (date_time_t) time((time_t *) NULL); + HDR_SET_UPDATE_TIME(header_rec -> header_flags); + + header_rec -> current_status = INACTIVE; + HDR_SET_CURRENT_STATUS(header_rec -> header_flags); + + make_hostaux_from_header(header_rec, &hostaux_rec, flags); + + set_aux_origin(hostaux_rec, header_rec -> access_methods, -1); + + hostaux_rec.fail_count++; + + if(hostaux_rec.fail_count > MAX_FAIL) + header_rec -> current_status = DEL_BY_ARCHIE; + + sprintf(haux_name,"%s.%s.%d", header_rec -> primary_hostname, header_rec -> access_methods,index); + + if(put_dbm_entry(haux_name, strlen(haux_name) + 1, &hostaux_rec, sizeof(hostdb_aux_t), hostaux_db, TRUE) == ERROR){ + + /* "Can't update hostaux rec for %s" */ + + error(A_INTERR,"write_hostdb_failure", WRITE_HOSTDB_FAILURE_003, haux_name); + return(ERROR); + } + + return(A_OK); +} + + + + diff --git a/archie/doc/.gitignore b/archie/doc/.gitignore new file mode 100644 index 0000000..f3c7a7c --- /dev/null +++ b/archie/doc/.gitignore @@ -0,0 +1 @@ +Makefile diff --git a/archie/doc/Makefile.in b/archie/doc/Makefile.in new file mode 100755 index 0000000..bfa0f55 --- /dev/null +++ b/archie/doc/Makefile.in @@ -0,0 +1,7 @@ +# +# doc +# + +# nothing to do, yet. +all_clean all_depend all_newsys clean depend newsys: + : diff --git a/archie/doc/TODO b/archie/doc/TODO new file mode 100644 index 0000000..3495de3 --- /dev/null +++ b/archie/doc/TODO @@ -0,0 +1,86 @@ + +TODO +---- + +List of things that need to be done for the real release.. + + + +AIX +--- + +* - Compile everything on AIX ... + Need to access titanic.cs.mcgill.ca .. + Talk to Luc... + +* - CVS + +Search +------ + + - Handle OR and AND operators on the search (Problem with states) + +* - Handle Excerpts / Keywords + +* - Stack of sites + + - Accents (must figure out encoding) + +* -New page + + +Patrie +------ + + + - Handle 16 bits heights (variable heights ..) + (wait to see if we have problem with size ) + +* - Handle hash instead of dbm files for the + unindexed portion of strings in append mode. + +* - Regular Expressions + + +Exchange +-------- + + - Handle excerpt files for the exchange of webindex + + - Exchange extern urls ?? + + - Handle partial exchanges + + + +FTP +--- + +* - Need a program(s) that will find all ftp site on the net. + + Program can get list of sites from the netstat info that + we have on services. + + For each one it should find if the anonymous ftp site + is running there... + + Build a list of unique sites and figure out if they belong + to the same department according to the name + i.e. a.b.c and d.b.c would belong to the same one + + + This is a one shot deal .. not production code.. + + - Script to send mail to a bunch of ftp administrators... + + Given the list, of above, create a script that can send + email to all the administrators of the list. + + We will use this to inform that we plan to index them .. + they may decide to not be indexed in which case the + return address should go to a mailing list.. + + + + + diff --git a/archie/doc/beta b/archie/doc/beta new file mode 100644 index 0000000..6c9c571 --- /dev/null +++ b/archie/doc/beta @@ -0,0 +1,86 @@ + + + + Archie 3.5 Beta + --------------- + + + +New in this release: +-------------------- + + +- Lock files are now created in ~archie/db/locks + +- the ``-t'' switch on arcontrol creates the new files and work files + in the specified temp directory and not in ~archie/db/tmp + +- New module (webindex) with the databse in ~archie/db/webindex_db + +- New database structure and search engine + + The files Stridx.* in db/anonftp_db or in db/webindex_db + correspond to the new search engine. + + The site files have now a new internal structure and have their + filenames in the format ip_addr:port + For anonftp, the port is always 21 whereas for webindex + the ports may be different. + + In order to speed the searches, an index of the searchable strings + is used. This index is not built every time a `arcontrol -u' is run. + A separate program db_build is used for this. + +- Webindex + + Archie still works on a site by site basis. New sites/urls found + along the way are stored in the ~archie/db/webindex_db/exturls_db.* + database. The program `extern_urls' can be used to add sites to + the hostdb database so that Archie can index them. + +- cgi-bin scripts for accessing the Archie database through + the Web. + +- A much better domain filter for anonftp than before !! + + The file ~archie/etc/domain.order contains the order of the domains + + domains list on the same line are equivalent. + domain lines are ordered as they appear .. i.e. domains in line i + appear before in line j <==> i < j + + e.g. + com:edu + fr:de + + .com and .edu sites will appear before .fr and .de sites in the + results. + + + +Currently working on: +--------------------- + +- Rewrite of the cgi-bin front-end to be more flexible. + +- Archie Help page + +- Regular Expressions with the new search engine. + +- New set of manpages and documentation. + + +Currently testing: +------------------ + +- dirsv with the new database technology. + + +Known Problems: +--------------- + +- arexchange of webindex will not work 100% + it will not transfer .excerpt files... we still need to figure out + how much infromation is gathered first by the indexers... + + diff --git a/archie/doc/install b/archie/doc/install new file mode 100644 index 0000000..231ebf0 --- /dev/null +++ b/archie/doc/install @@ -0,0 +1,121 @@ + + Archie 3.5 Beta Installation Procedure + -------------------------------------- + + + + + +1- Get the distribution files from the archie-3.5-beta directory + on the ftp.bunyip.com in your account. + + +2- Untar the archie-3.5-beta-install.tar + + +3- Run ./unwrap as super user and follow the instructions + + +At this point you will have all the distribution installed on your system. +The configuration of the system is done as per the Archie 3.3 manual ! + + +The following are a list of modifications that are introduced in +Archie 3.5 + +Please do not hesitate to contact us if you have questions +(archie-group@bunyip.com) + + + +New database structure +---------------------- + + - Site files have filename in the format ip_addr:port + + - The files Stridx.* in the different database directories + correspond to the new index structure. + + - The index is build according to the content of the strings file. + + - New strings can be added to the strings file without rebuilding + the index... The unindexed portion will be searched by the search + with a different manner. As long as the unindexed portion of the + strings file is small, the overall efficiency will not be affected. + + +Construction of the indexes +--------------------------- + + - The index must be explicitly constructed. It is not + constructed everytime ``arcontrol -u'' is run. + + - The program ~archie/bin/db_build will build the index. + The parameter of db_build are + + -f : force reconstruction + -v : verbose + -d database : construct only the specified database + + Note that if the -f flag is not used and the portion of added + new strings not yet indexed is less than 1 Megabyte the index + will not be reconstructed. + + - With time, one would expect that the strings file does not + grow very fast hence rebuilding the index should be done less often. + + + +Web Index +--------- + + + - Indexing the web follows the same scheme as for anonymous ftp + sites. Retrievals are done on a site by site basis. + + - New sites can be added to the system with the use of + ``host_manage''. + The name of the database entry is ``webindex''. + You can specify a specific port and prefix path also. + For a same primary host, you can create multiple `webindex' + database entries with different ``port'' numbers. (Use TAB-3) + + - The crawling can be done in a very controlled fashion. While + processing a site, external urls are stored in a separate + databse. In order to incorporate those new sites in the hostdb + database, you need to run the program extern_urls. + + - The options to the program extern_urls are + + -n number : specify the max number of sites to add + -i : interactive .. asks for y/n before adding site + -d domain_list : list of domains (: separated) + -v : verbose + -l : log + + + + - The webindex extracts portions of text from the different URLs + that are used when returning results to the users. They are + stored in excerpt files that have filename format + + site_file_format.excerpt + + +CGI- Interface +-------------- + + - The file ~archie/cgi/archie.html contains the search form. + It must be edited to reflect your Web server configuration. + The changes that need to be made are in the first 4 lines, + the value of the action and the value of VALUE. + + The cgi program is actually ~archie/cgi/bin/interact .. + + You should make the appropriate links on your system so + that the server actually uses the program interact. + + + + + \ No newline at end of file diff --git a/archie/doc/mail b/archie/doc/mail new file mode 100644 index 0000000..386e2fa --- /dev/null +++ b/archie/doc/mail @@ -0,0 +1,130 @@ + + + +Hello + + Finally, the day has come for the release of an Archie pre-beta +version. You will find below the list of new features. + + + This release does not include all of the components of the Archie +system. The main missing component is the Prospero server (dirsrv). +Nonetheless all of the Archie functionality is present in this +distribution. This will allow us to perform some more tests on the remaining +parts of the system. + + + Those of you interested in being a beta-tester for this release +should contact me, appropriate accounts will be setup and extra documentation +will be given. Beta testers with accessible spare machines would be greatly +appreciated in order to not disrupt the exist Archie and facilitate the +test phase. Of course, we will, in our daily support, give priority to the +beta testers. + + +Thank you, + + + -Sandro Mazzucato + and the Archie team + + + + +=========================================================================== + + + + Archie 3.5 Beta + --------------- + + + + +New in this release: +==================== + +Here are the major added components to the system with some +of the key points involved in each one of them. + + +- Support for a new database module (webindex) + - retrieval of HTML pages through http protocol + - Keyword extraction + - Controlled crawling of the WWW + - Site by site basis + - Content extraction + - configurable stoplist (keyword exclusion) + +- New database structure + - More reliable structure. + - NOTE: Cannot used this version with the database of Archie 3.3 + +- New search engine + - Based on a paged tree structured index + - Faster searches + - Less memory required + - More disk space for construction of the index + +- New search interface + - cgi-bin compliant interface + + +- A better domain filter for anonftp + - results can be pre-configured to return in a certain order + (e.g. ftp sites close to the server first) + - configurable on a server basis + + + + +Fixed bugs +========== + + +- the ``-t'' switch on arcontrol creates the new files and work files + in the specified temp directory and not in ~archie/db/tmp + + +- Lock files are now created in ~archie/db/locks + + +- host_manage can handle multiple preffered hostnames for a site + + + +Currently working on: +===================== + +- Rewrite of the cgi-bin front-end to be more flexible. + +- Archie Help page + +- Regular Expressions with the new search engine. + +- New set of manpages and documentation. + +- Additional type of searches + + + + + +Currently testing: +================== + +- dirsrv with the new database technology. + + + + +Known Problems: +=============== + +- arexchange of webindex will not fully functional + it will not transfer .excerpt files. We still need to experiment + with indexing of the Web and see what is involved with + exchanges of data. + + + diff --git a/archie/doc/man/anonftp_parser_output.5 b/archie/doc/man/anonftp_parser_output.5 new file mode 100644 index 0000000..6eb8d34 --- /dev/null +++ b/archie/doc/man/anonftp_parser_output.5 @@ -0,0 +1,85 @@ +.\" Copyright (c) 1992,1994,1996 Bunyip Information Systems Inc. +.\" All rights reserved. +.\" +.\" Archie 3.5 +.\" August 1996 +.\" +.\" @(#)anonftp_parser_output.5 +.\" +.TH ANONFTP_PARSER_OUTPUT 5 "August 1996" + +.SH SYNOPSIS +.B anonftp_parser_output +\- description of the output of the Archie anonymous FTP listing parsers +for the anonftp catalog +.SH DESCRIPTION +.PP +Currently all anonymous FTP listings in the Archie system are parsed from +the Operating System specific format in to a common Archie-defined parser +output format. This allows the system to have standard database +structures, and updating routines without having to worry abou the +individual characteristics of each operating system. This format is +described below. One of the underlying assumptions is that the file +system of the listing being parsed has a tree-like structure with the +concepts of internal nodes (directories) and leaves (files). + +The parser output corresponding to a particular listing consists of a +sequence of variable length records, one record per file in the listing. +This is composed of a fixed "core" component followed by a variable +length string. + +The core is composed of records with fields: + + + +where + +.TP +.B +Is and unsigned 32 bit quantity containing the size of the file. +.TP +.B +An unsigned 32 bit quantity. It's value is interpreted as seconds UTC +(GMT) since Jan 1, 1970. The actual quantity that it represents varies +between operating systems, but it is typically the creation or last +modification time for the file in question. +.TP +.B + +Unsigned 32 bit quantity. It is the record number of the parent directory +in the current file. A value of zero signifies that the parent directory +is the root. +.TP +.B + +Unsigned 32 bit. The record number of the first child of this directory. +It is zero if the current record describes a directory which has no +children. It is undefined for regular files. +.TP +.B +Unsigned 16 bit. Contains a bit vector for the permission field values +in an operating-system dependent fashion. +.TP +.B +Unsigned 16 bit. A bit vector of particular attributes of the entry. +Currently if the entry is a directory, bit 1 is set. If it is a link, bit +2 is set. +.LP + +The rest of the record consists of an unsigned 16 bit quantity containing +the length of the string (in bytes) in the record. This value is always +rounded up to the next multiple of 4. The final element is a variable +length byte sequence containing the string itself. This is always padded +up to the next 4-byte boundary. +.SH "SEE ALSO" +.BR parse_anonftp_* (n), +.BR net_anonftp (n), +Archie System Manual +.SH AUTHOR +Bunyip Information Systems. +.br +Montr\o"\'e"al, Qu\o"\'e"bec, Canada + +.sp +Archie is a registered trademark of Bunyip Information Systems Inc., Canada, +1990. diff --git a/archie/doc/man/archie.n b/archie/doc/man/archie.n new file mode 100644 index 0000000..371a1e9 --- /dev/null +++ b/archie/doc/man/archie.n @@ -0,0 +1,1172 @@ +.\" Copyright (c) 1994, 1996 Bunyip Information Systems Inc. +.\" All rights reserved. +.\" +.\" Archie 3.5 +.\" August 1996 +.\" +.\" @(#)archie.n +.\" +.TH ARCHIE N "August 1996" +.SH NAME +archie \- Internet archive server listing service +.SH SYNOPSIS +.B archie +.SH DESCRIPTION +This manual page describes Version 3 of the Archie system. This Internet +information service allows the user to query a catalog containing a list of +files which are available on hosts connected to the Internet. Software located +through this service can be obtained by means of +.IR ftp (1); +for hosts with access to BITNET/NetNorth/EARN, +it can be obtained by electronic mail through the Princeton +.BR bitftp (1L) +service. Send mail to +.sp +.in +2in +bitftp@pucc.princeton.edu +.in 0 +.LP +Other Internet users who are not directly connected may use the services +of various ftp-by-mail servers including +.sp +.in +2in +ftpmail@decwrl.dec.com +.in 0 +.LP +Some Archie systems track archive sites globally, others only track the +archive sites in their country, region or continent, in order to reduce the +load on trans-oceanic links. There are a number of Archie hosts serving +different continental user communities. The +.B servers +command will list the most +up-to-date information on +Archie servers worldwide. +.sp +.ta +3n; +25n +\fBarchie.au\fP Australia +.br +\fBarchie.edvz.uni-linz.ac.at\fP Austria +.br +\fBarchie.univie.ac.at\fP Austria +.br +\fBarchie.cs.mcgill.ca\fP Canada +.br +.br +\fBarchie.funet.fi\fP Finland +.br +\fBarchie.univ-rennes1.fr\fP France +.br +\fBarchie.th-darmstadt.de\fP Germany +.br +\fBarchie.ac.il\fP Israel +.br +\fBarchie.unipi.it\fP Italy +.br +\fBarchie.wide.ad.jp\fP Japan +.br +\fBarchie.hana.nm.kr\fP Korea +.br +\fBarchie.sogang.ac.kr\fP Korea +.br +\fBarchie.uninett.no\fP Norway +.br +\fBarchie.rediris.es\fP Spain +.br +\fBarchie.luth.se\fP Sweden +.br +\fBarchie.switch.ch\fP Switzerland +.br +\fBarchie.ncu.edu.tw\fP Taiwan +.br +\fBarchie.doc.ic.ac.uk\fP United Kingdom +.br +\fBarchie.hensa.ac.uk\fP United Kingdom +.br +\fBarchie.unl.edu\fP USA (NE) +.br +\fBarchie.internic.net\fP USA (NJ) +.br +\fBarchie.rutgers.edu\fP USA (NJ) +.br +\fBarchie.ans.net\fP USA (NY) +.br +\fBarchie.sura.net\fP USA (MD) +.ta +.br +.LP +Archie can be accessed interactively, via electronic mail or +through Archie client programs available widely on the Internet. +.sp +.SS "Using the Interactive (telnet) Interface" +.sp +In order to use the interactive system you should use the +following procedure: +.TP +1) +\fBtelnet\fP to the Archie system closest to you. Do not use \fBftp\fP +for this, it will not work. +.TP +2) +Login as user +.BR archie +(no capital letters); no password is required. The system should print a +banner message and status report before presenting you with the command +prompt. Some newer operating systems will prompt for a password. Just hit the +return key and continue. +.TP +3) +Type \fBhelp\fP for complete information on the system. +.LP +For full details, +refer to the section entitled +.SM "ARCHIE COMMANDS" +which appears below. +.sp +.SS "Using the Electronic Mail Interface" +.sp +In order to use the email interface, send requests to: +.IP +\fCarchie@\fP\fI\fP +.LP +where \fI\fP is one of the hosts listed above, or one returned +by the \fBservers\fP command. Send the word ``help'' in a message to obtain +a list of available commands and features. This is a completely automated +interface, acting without human intervention. +.LP +For full details, +refer to the section entitled +.SM "ARCHIE COMMANDS" +which appears below. +.SS "Using the Archie clients" +.sp +The source code as well as machine executables for a variety of Archie +client programs can be obtained via anonymous +.BR ftp (1) +from many of the Archie +server hosts listed above. They are usually stored in the +.B archie/clients +or +.B pub/archie/clients +directories. These clients communicate, via the \fIProspero\fP distributed +file system protocol, with Archie servers, which perform the specified queries +and return the results to the user. Currently there are UNIX and VMS command +line, curses and X window clients as well as Mac and PC Windows versions. For +more information on \fIProspero\fP send your queries to +info-prospero-request@isi.edu +.sp +.SS "Communicating with the Database Administrators" +Mail to Archie administrators at a particular Archie server should be sent to +the address +.IP +\fCarchie\(emadmin@\fP\fI\fP +.LP +where \fI\fP is one of the hosts listed above. +.sp +To send mail to the implementors of the Archie system, please send mail to +.IP +\fCarchie\(emgroup@bunyip.com\fP +.LP +The Archie server system is a product of Bunyip Information Systems. +.sp +Requests for additions to the set of hosts surveyed for the catalog, or other +administrative matters, should be sent to: +.IP +\fCarchie\(emadmin@bunyip.com\fP +.SH "ARCHIE COMMANDS" +In version 3 of the Archie system the telnet and email clients accept a common +set of commands. Additionally, there are specialized commands specfic to the +particular interfaces. See +.SM "THE INTERACTIVE INTERFACE" +and +.SM "THE EMAIL INTERFACE" +sections below for a list of these commands. +.sp +Note that some Archie server sites may disable some of the commands for +reasons particular to their site. As well, some sites limit the number of +concurrent interactive (telnet) sessions to better utilize limited resources. +.SS "Commands" +Arguments to commands shown in square brackets (`[]') are optional; all others +are mandatory. +.TP +.BI find " " +.TP +.BI prog " " +This command produces a list of files matching the pattern \fI\fP. +The \fI\fP may be interpreted as a simple substring, a case sensitive +substring, an exact string or a regular expression, depending on the value of +the \fBsearch\fP variable. The output normally contains such information as +the file name that was matched, the directory path leading to it, the site +containing it and the time at which that site was last updated. The format of +the output can be selected through the \fBoutput_format\fP variable. The +results are sorted according to the value of the \fBsortby\fP variable, and +are limited in number by the \fBmaxhits\fP variable. +.sp +\fBprog\fP is identical to +.BR find . +It is included for backward compatibility with older versions of the system. +.TP +.BR help \ [\fI\fP\ [\fI\fP]\ ...] +Invoke the help system and present help on the specified topic. A list of +words is considered to be one topic, not a list of individual topics. Thus, +.RS +.IP +\fChelp set maxhits\fP +.RE +.IP +requests help on the subtopic \fImaxhits\fP of topic \fIset\fP, not on two +separate topics. After help is presented, the user is placed in the help +system at the deepest level containing subtopics. +.sp +For example, after typing +.RS +.IP +\fChelp set maxhits\fP +.RE +.IP +and being shown the information for that topic, the user is placed at the +level \fIset\fP in the help hierarchy. +.TP +.BR list " [\fI\fP]" +Produce a list of sites whose contents are contained in the Archie +catalog. With no argument all the sites are listed. If given, the +\fI\fP argument is interpreted as a regular expression (see +.SM "REGULAR EXPRESSIONS" +below) against which to match site names: only those names matching are +printed. The format of the output can be selected through the +\fBoutput_format\fP variable. +.IP +Note that the numerical (IP) address associated with a site name was valid at +the last time the site was updated in the Archie catalog but may have been +changed subsequently. Furthermore, the listed IP address is the primary +address as listed in the Domain Name System (secondary addresses are not +stored). For example, +.RS +.IP +\fClist\fP +.RE +.IP +lists all sites in the catalog, while +.RS +.IP +\fClist \e.de$\fP +.RE +.IP +lists all German sites. +.TP +.BI mail "

" +Mail the result of the last command that produced output (e.g. \fBfind\fP, +\fBlist\fP) to \fI
\fP. This must be a vaid email address. +.TP +.BR manpage " [ roff | ascii ]" +Display the Archie manual page (this file). The optional arguments specify the +format of the returned document. `roff' specifies UNIX +.BR troff (1) +format, while `ascii' specifies plain, preformatted ASCII output. With +no arguments it defaults to `ascii'. +.TP +.B domains +Asks the current server for the list of the Archie \fIpseudo-domains\fP that +it supports. See the entry for the \fBmatch_domain\fP variable below. This +command takes no arguments. For example, +.RS +.IP +\fCdomains\fP +.RE +.IP +requests the list of pseudo-domains from the server. The result looks (in +part) something like this: +.RS +.sp +.nf +africa Africa za +anzac OZ & New Zealand au:nz +asia Asia kr:hk:sg:jp:cn:my:tw:in +centralamerica Central America sv:gt:hn +easteurope Eastern Europe bg:hu:pl:cs:ro:si:hr +mideast Middle East eg:.il:kw:sa +northamerica North America usa:ca:mx +scandinavia Scandinavia no:dk:se:fi:ee:is +southamerica South American ar:bo:br:cl:co:cr:cu:ec:pe +usa United States edu:com:mil:gov:us +westeurope Western Europe westeurope1:westeurope2 +world The World world1:world2 +.fi +.sp +.RE +.IP +The first column gives the names of pseduo-domains supported by the +server. The second gives the ``natural language'' description of the +pseudo-domain and the third column is the actual definitions of those +domains. Here, the "asia" domain is comprised of the Domain Name System +country codes for Korea (`kr'), Hong Kong (`hk'), Singapore (`sg'), +etc. Pseudo-domains may also be constructed from other pseudo-domains: thus +one component of the the `northamerica' domain is itself constructed from the +`usa' pseudo-domain. +.TP +.B motd +Re-display the `message of the day', which is normally printed when the user +initially logs on to the client (in the case of the interactive interface) or +at the start of the returned message (in the email interface). +.TP +.B servers +Display a list of all publicly accessible Archie servers worldwide. The names +of the hosts, their IP addresses and geographical locations are listed. +.TP +.BR set " \fI\fP [\fI\fP]" +Set the specified variable. Variables are used to control various aspects of +the way Archie operates; the interpretation of pattern arguments, the format +of output from various commands, etc. See the section below on variables for +a description of each one, as well as the entries for +.B unset +and +.BR show . +.TP +.BR show " [\fI\fP ...]" +Without any argument, display the status of all the user-settable variables, +including such information as its type (boolean, numeric or string), whether +or not it is set, and its current value (if its type requires a value). +Otherwise, show the status of each of the specified arguments. +.IP +Example: +.RS +.IP +\fCshow maxhits\fP +.RE +.TP +.BI site " " +This command is currently unimplemented under version 3 of the Archie system. +.TP +.BI unset " " +Remove any value associated with the specified variable. This may cause +counter-intuitive behavior in some cases; for example, if \fBmaxhits\fP is not +defined by the user, the \fBfind\fP command will print the internal default +number of matches rather than an unlimited number of matches. +.TP +.B version +Print the current version of the client. +.SS "Variable Types" +The behavior of Archie can be modified by certain variables, the values of +which may be changed using the \fBset\fP command, or removed entirely by the +\fBunset\fP command. There are three variable types: +.TP 15 +.B boolean +(Set or unset) +.TP +.B numeric +(Integer within a defined range) +.TP +.B string +(String of characters which may or may not be restricted). +.sp +If the value of a string variable must contain leading or trailing spaces then +it should be quoted. Two ways to quote text are to surround it with a pair of +double quotes (`"'), or to precede individual characters with a backslash (`\e'). +(A double quote, or a backslash may itself be quoted by preceding it by a +backslash.) The resulting value is that of the string with the quotes +stripped off. +.sp +.SS "Numeric Variables" +.TP +.B maxhits +Allow the \fBfind\fP command to generate at most the specified number of +matches. The permissible range is from 0 to 1000, with a default value of +100. For example, +.RS +.IP +\fCset maxhits 100\fP +.RE +.IP +halts \fBfind\fP after a total of 100 matches have been found. +.TP +.B maxhitspm +Across all the anonymous FTP archives on the Internet (and even on one single +anonymous FTP archive) many files will have the same name. For example, if you +search for a very common filename like `README' you can get hundreds, even +thousands of matches. You can limit the number of files with the same name +through this variable. For example, +.RS +.IP +\fCset maxhitspm 100\fP +.RE +.IP +tells the system to list only 100 files with the same name. Note that the +overall maximum number of files returned is still controlled by the +\fBmaxhits\fP variable. +.TP +.B maxmatch +This variable will limit the number filenames returned. For example, if +maxmatch is set to 2 and you perform a substring search for the string `etc', +and the catalog contains filenames `etca', `betc' and `detc' only the +filenames `etca' and `betc' will be returned. However, depending on the values +of maxhitspm and maxhits you will get back a number of actual files with those +names. +.IP +Example: +.RS +.IP +\fCset maxmatch 20\fP +.RE +.IP +.TP +.B max_split_size +Approximate maximum size, in bytes, of a file to be mailed to the user. Any +output larger than this will be split into pieces of about this size. This +can be set by the user, in the range 1024 to ~2Gb, with a default of 51200 +bytes. +.SS "String Variables" +.TP +.B compress +The kind of data compression the user can specify when mailing back output. +Currently allowed values are `none' and `compress' (standard UNIX +.BR compress (1), +with a default of `none'. +.TP +.B encode +The type of post-compression encoding the user can specify when mailing back +output. Currently allowed values are `none' and `uuencode', with a +default of `none'. Note that this variable is ignored unless compression +is enabled (via the \fBcompress\fP variable). +.TP +.B language +Allows the user to specify the language in which help, etc. is presented. +Currently the default value is `english'. +.TP +.B mailto +If the \fBmail\fP command is issued with no arguments, mail the output of the +last command to the address specified by this string variable. Initially this +variable is unset. +.IP +Example: +.RS +.IP +\fCset mailto user@frobozz.com\fP +.RE +.IP +Conventional Internet addressing styles are understood. BITNET sites should +use the convention: +.RS +.IP +\fCuser@sitename.bitnet\fP +.RE +.IP +UUCP addresses can be specified as +.RS +.IP +\fCuser@sitename.uucp\fP +.RE +.TP +.B match_domain +This variable allows users to restrict the scope of their search based upon +the Fully Qualified Domain Names (FQDN) of the anonymous FTP sites being +searched. In this way, the user can specify a colon-separated list of domain +names which all returned sites must match. Each component in the list is +taken as the \fIrightmost\fP part of the FQDN. For example, +.RS +.IP +\fCset match_domain ca:internic.net:harvard.edu\fP +.RE +.IP +means that the names of all returned sites must end in `ca' (Canada), +`internic.net' (sites in the Internet NIC) or `harvard.edu' (sites at +Harvard University). + +While these are all real domain names, listing all possible combinations for +say, the USA, would quickly become tedious (and if you think that is bad, try +listing all the countries on the Internet in Europe). To aid in this problem, +the Archie system has the concept of \fIpseudo-domains\fP to allow users to +use a shorthand notation when using this facility. These pseudo-domains are +defined on a server-by-server basis, and you can use the \fIdomains\fP +command to query your current server for its list of predefined +pseudo-domains. + +A pseudo-domain is a list of real DNS domain names and/or a list of other +pseudo-domains. For example, the Archie administrator on the server could +define the pseudo-domain +.RS +.IP +\fCusa\fP +.sp +to be +.sp +\fCedu:mil:com:gov:us\fP +.RE +.IP +If this definition existed on the server, then you could +.RS +.IP +\fCset match_domain usa\fP +.RE +.IP +which would be the same as saying +.RS +.IP +\fCset match_domain edu:mil:com:gov:us\fP +.RE +.IP +In addition, the server administrator may define +.RS +.IP +\fCnorthamerica\fP +.sp +to be +.sp +\fCusa:ca:mx\fP +.RE +.IP +meaning that `northamerica' is composed of the pseudo-domain `usa' and +the real domains `ca' (Canada) and `mx' (Mexico). This process can be +repeated for 20 levels (more than sufficient for any naming scheme). By using +the \fBdomains\fP command you can determine which pseudo-domains your current +server supports. +.TP +.B match_path +Sometimes you only would like your search (using the \fBfind\fP command) to +look for files or directories with a certain set of names in their full path. + +For example, many anonymous FTP site administrators will put software packages +for the MacIntosh in a path containing the name `mac' or `macintosh'. Another +example is when a document exists in several formats and you are only looking +for the PostScript version. You can guess that the file may end in `.ps' or it +may be in a directory called `ps' or `PostScript'. + +This is usually guesswork, but is is useful to have the Archie system only +look for files or directories with particular components in their path name. + +This variable allows you to do this. The arguments are a colon-separated list +of possible path name components. In the last example above, saying +.RS +.IP +\fCset match_path ps:postscript\fP +.RE +.IP +will restrict the search only to match those files or directories which have +the strings `ps' or `postscript' in their path. + +The comparison is \fIalways\fP case-insensitive (regardless of the value of +the \fBmatch\fP variable) and there is a logical OR connecting the components +so that the above statement says: ``find only files which have `ps' OR +`postscript' in their path''. If either component matches then the condition +is satisfied. +.TP +.B output_format +Select the way the output of find and list is displayed. It is user settable, +with valid values of `machine' (machine readable format), `terse' and +`verbose', with a default of `verbose'. +.TP +.B search +The type of search done by the \fBfind\fP (or \fBprog\fP) command. It is user +settable with a range of `exact', `regex', `sub', `subcase', +`exact_regex', `exact_sub' and `exact_subcase', with a default of +`sub'. (The `exact_\fI\fP' types cause it to try `exact' first, then +fall back to type \fI\fP if no matches are found). The values have the +following meanings: +.RS +.TP +.B exact +Exact match (the fastest method). A match occurs if the file (or directory) +name in the catalog corresponds \fIexactly\fP to the user-specified substring +(including case). +.IP +For example, this type of search could be used to locate all files called +`xlock.tar.Z'. +.TP +.B regex +Allow user-specified (search) strings to take the form of +.BR ed (1) +regular expressions. +.IP +Note: unless specifically anchored to the beginning (with `^') or end +(with `$') of a line, +.BR ed (1) +regular expressions (effectively) have `.*' prepended and appended to them. +For example, it is not necessary to type +.RS +.IP +\fCfind .*xnlock.*\fP +.RE +.IP +because +.RS +.IP +\fCfind xnlock\fP +.RE +.IP +suffices. In this instance, the +.B regex +match is equivalent to a simple substring match. Those unfamiliar with +regular expressions should refer to the section entitled +.SM "REGULAR EXPRESSIONS" +which appears below. +.TP +.B sub +Substring (case insensitive). A match occurs if the file (or directory) name +in the catalog contains the user-specified substring, without regard to case. +For example, the pattern +.RS +.IP +\fCis\fP +.RE +.IP +matches any of the following: +.RS +.IP +\fCislington +.br +this +.br +poison\fP +.RE +.TP +.B subcase +Substring (case sensitive). As above, but case is significant. For example, +the pattern +.RS +.IP +\fCTeX\fP +.RE +.IP +will match +.RS +.IP +\fCLaTeX\fP +.RE +.IP +but neither of the following: +.RS +.IP +\fCLatex +.br +TExTroff\fP +.RE +.TP +.B server +the Prospero server to which the client connects when \fBfind\fP or \fBlist\fP +commands are invoked. It is user settable, with a default value of +`localhost'. +.TP +.B sortby +Set the method of sorting to be applied to output from the \fBfind\fP command. +Typing the keyboard interrupt character (generally Cntl-C on UNIX hosts) +aborts a search. This will also dequeue the request from the server. Unlike +previous versions of the Archie system, version 3 does not allow partial +results. The output phase may be aborted by typing the abort character a +second time. The five permitted methods (and their associated reverse orders) +are: +.RS +.TP +.B none +Unsorted (default; no reverse order, although +.B rnone +is accepted) +.TP +.B filename +Sort files and directories by name, using lexical order (reverse order: +.BR rfilename ) +.TP +.B hostname +Sort on the archive host name, in lexical order (reverse order: +.BR rhostname ) +.TP +.B size +Sort by size, largest files and directories first (reverse order: +.BR rsize ) +.TP +.B time +Sort by modification time, with the most recent file and directory names first +(reverse order: +.BR rtime ) +.RE +.SH "THE INTERACTIVE (TELNET) INTERFACE" +The interactive interface accepts the following commands and variables in +addtion to those listed above. +.SS Commands +.TP +.BR stty " [[\fI