Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!utgpu!water!watnot!watmath!clyde!rutgers!ames!ucbcad!ucbvax!hplabs!kitty!larry From: larry@kitty.UUCP Newsgroups: comp.sources.d,comp.sources.wanted Subject: Telephone/address file program source available Message-ID: <1699@kitty.UUCP> Date: Mon, 13-Apr-87 00:25:05 EST Article-I.D.: kitty.1699 Posted: Mon Apr 13 00:25:05 1987 Date-Received: Tue, 14-Apr-87 00:36:00 EST Organization: Recognition Research Corp., Clarence, NY Lines: 38 Keywords: simple "rotary file" database program in C Xref: utgpu comp.sources.d:569 comp.sources.wanted:874 The Net has been good to me as far as providing some good source programs. I figured it's about time I made some contribution. While much of my software is either proprietary or too specialized to be of any general use, I do have a few source programs which may be of interest. The first program is called rf(1L). It is a simple database program written in C which stores names, addresses, telephone numbers, and other data. It functions not unlike a "rotary file" for fast access, which is why it is called ``rf''. In its present form it will search for a record by individual name, or by organization name. Any size search string may be used as the key; command line parsing is intelligent enough such that quotes are unnecessary if the search string contains embedded whitespace. The output is displayed in a neat page-oriented fashion using curses, with a paging control where multiple matches are encountered. The database file is easily configured using any editor. The database file format is also designed so that it may be easily accessed by awk or sed for mailing list or other special applications. By setting an option flag, the program will access a system-wide database, or a private database file in the user's home directory. While the program could have been written using awk and tput, it is substantially faster using C. In keeping with the recent discussion about writing "new" UNIX functions, the increased speed is THE reason for writing it in C. Typical search and display (9,600 baud) time on a 3B2 for one record from a 30 kilobyte database file is < 2.0 seconds; this includes curses overhead - so it's pretty fast (the entire database file is always searched to detect multiple matches). The program is reasonably well commented, is intentionally written to be easily modified, and is reasonably well protected against users doing "dumb" things. The program runs on three different Sys V versions, and should probably run under BSD since it contains its own string search function and does not use getopt; the curses use is not particularly exotic. If there is enough interest, I will post it to the Net. <> Larry Lippman @ Recognition Research Corp., Clarence, New York <> UUCP: {allegra|ames|boulder|decvax|rocksanne|watmath}!sunybcs!kitty!larry <> VOICE: 716/688-1231 {hplabs|ihnp4|mtune|seismo|utzoo}!/ <> FAX: 716/741-9635 {G1,G2,G3 modes} "Have you hugged your cat today?"