TrafficSignal.c (c) 1993 by Frank J. Perricone. All rights reserved. MS-DOS adaptations by Daniel C. Mecklenburg Ideas provided by Gary Kimbrell, Chris Guertin, Robert Williamson Beta-testing by Chris Guertin, Gary Kimbrell This program creates traffic reports for echos, telling you who has posted, how often, how recently, and how large their posts are. This report can be sorted by last name, number of posts, average post size, or how recent the most recent post is. This program does NOT create or maintain any database; instead, it uses posts currently in your message area. You can restrict the choice of messages used to generate the report by message number range, or those written since a given date or within the last N days, or both, but you have to actually have the messages in the directory in .MSG format. So the philosophy isn't quite the same as in some other traffic report programs. But it's a useful and simple system with a very low overhead, and you can run the reports any time you like. Version 1.3 is a major change because the format of the parameters has changed significantly, because I was running out of ways to add new things. If you've used earlier versions please read the USAGE section below again. Not only are there quite a few new options, but the old ones may look different now. USAGE -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- At any time, run this program against any given area as follows: TrafficSignal [NAME] [POSTS] [SIZE] [DATE] [AFTER "date"] [LAST days] [BEGIN msg] [END msg] [FORMAT "string"] [TO filename] The MS-DOS version is the same except that the program is named TRFCSGNL and of course all the slashes are backwards. The first parameter is a pathname to the Fido message area. It should end in a colon or slash. This must be a directory containing many .MSG files. All the other parameters can occur in any order. Case is ignored, and only the first character of the keywords is checked (so you can abbreviate them to one character, or in fact to anything as long as the first character is right). If you have more than one keyword that does the same thing, only the last one has any effect. NAME, POSTS, SIZE, and DATE choose the sort order, which defaults to NAME. (If you use more than one, only the last one is used.) NAME sorts by name (last name first); POSTS by number of posts; SIZE by the average size of posts; and DATE by the date of the most recent post. (Note: the usefulness of DATE is minimal because your own posts, and those originating on your system, are almost always fresher than everyone else's due to FidoDelay(tm), but it's included for completeness and the heck of it.) AFTER and LAST set the date range of messages to be used; if you use more than one AFTER/LAST parameter, only the last one is used. AFTER is used to specify an absolute date and time, and only messages WRITTEN (that is, timestamped on the message itself, not RECEIVED here) after the given date. The date should be in Fido format, either Fido_11w format (e.g., "01 Jan 86 02:34:56" -- note the double-space in there) or Seadog format (e.g., "Tue 1 Jan 86 01:23" -- the double space only shows up here if the day is less than 10). If the date is improperly formed, weird things will happen. Be sure to enclose this in quotes because it has spaces in it. The LAST parameter is probably a lot more useful; follow it with a number of days, and it will automatically calculate the date that many days ago and use it the same as the AFTER parameter. Note that you can't specify the other end of the range, that is, posts BEFORE a given date, because I see not much point to that. Maybe if registered users ask me for it I will put it in. BEGIN and END allow you to specify a range of message numbers to use; messages outside this range are ignored. If you specify no BEGIN, 1 is used. You can not use a BEGIN of 0 or less, because bogus non-message files like User.Msg (created by DLG) will then be included (as "User" evaluates to 0). It is common to use BEGIN 2 to ignore hiwater messages (and because v1.3 allows this, I've removed the ability to ignore messages from "TrapToss" and others; only "TrafficSignal" is now ignored). If you supply no END parameter, there is no upper limit. END must of course be at least as high as BEGIN, else it will be reset so it is. FORMAT is a powerful option; I'll talk about it in a later section. TO lets you specify an output filename; otherwise, it goes to the standard output console. You could say TO PRT: to print it, or put a temporary file, or even TO SPEAK: if you have nothing better to do. :) The reason I put this in rather than just letting you use redirection is to get around a bug in TPTCron/DLGCron which causes stderr to be redirected as well. Since I'm printing all that diagnostic stuff, which shows you what's going on, to stderr, it all gets redirected into the file. You can get around this in TPTCron by spawning a new shell with the FROM parameter to run a script which does the actual task, but this is more direct. RUNNING TRAFFICSIGNAL -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- When you run it, it shows you the messages as it scans them, adding them to its list. (Any message that gets ignored because of the AFTER, LAST, BEGIN, or END parameters, or because its from-name is "TrafficSignal" or "Traffic Signal", will NOT be shown.) Then it outputs the result into a table file, to the console or the file you specified with TO. It looks something like this: TrafficSignal 1.3 (c) 1993 by Frank J. Perricone Report of echo traffic since 14 Oct 93 13:18:09, generated 13 Nov 93 13:18:09 FidoNet Num Avg Name of Participant Address Posts Size Date of Last Post =============================== =============== ===== ===== =================== Tim Luneau 1:325/1203.0 11 973 03 Nov 93 16:28:06 Ken Bridges 1:325/802.5 11 2374 08 Nov 93 05:55:16 Randy Edwards 1:325/806.0 9 1905 11 Nov 93 11:26:31 Andy Wasklewicz 1:325/111.0 7 1132 08 Nov 93 13:28:40 Andy Skelton 1:325/118.0 7 1909 08 Nov 93 16:20:16 Siobhan Perricone 1:325/611.1 5 1870 10 Nov 93 06:31:21 Jason Boyd 1:325/111.0 3 1373 21 Oct 93 12:04:55 Ben Scotch 1:325/611.0 3 2661 03 Nov 93 19:42:30 Jennifer Wilson 1:325/1203.0 3 2031 05 Nov 93 16:05:16 Frank Perricone 1:325/611.0 3 1061 12 Nov 93 10:32:14 James Pallack 1:325/101.0 2 656 10 Nov 93 02:04:00 Bill Bond 1:325/118.0 2 566 04 Nov 93 21:29:51 Bill Parker 1:325/601.0 2 1911 07 Nov 93 09:43:14 Dave Dumont 1:325/118.0 2 461 03 Nov 93 16:16:47 David Briars 1:325/118.0 1 593 20 Oct 93 19:59:00 Barry Metzler 1:325/602.0 1 700 01 Nov 93 10:54:22 Nathan Henikoff 1:325/202.0 1 1144 06 Nov 93 17:54:26 =============================== =============== ===== ===== =================== Participant Count: 17 73 1584 If you have a program that can create messages from text files, you can use it to create a message in the area itself using a script like this. (If you don't, FREQ the file FidoToolkit.lha from me, it contains such a program called FidoEnter.) .key areapath,o1,o2,o3,o4,o5,o6,o7,o8,o9 .bra { .ket } TrafficSignal {areapath} {o1} {o2} {o3} {o4} {o5} {o6} {o7} {o8} {o9} TO T:{$$} ; change the "1:325/611"s in the following to your own address FidoEnter {areapath} T:{$$} {$$} "Traffic Signal" "All" "TrafficSignal Traffic Report" ORIG 1:325/611 DEST 1:325/611 delete t:{$$} env:{$$}#? quiet If you have a DOS program that'll build a Fido message from a text file, try something like this. I'm imagining a FIDOENTR.EXE program like my FidoEnter: @ECHO OFF TRAFSGNL %1 %2 %3 %4 %5 %6 %7 %8 %9 TO C:\TRAFSGNL.RPT FIDOENTR %1 C:\TRAFSGNL.RPT "Traffic Signal" "All" "TrafficSignal Traffic Report" DEL C:\TRAFSGNL.RPT USING FORMAT =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- The FORMAT option adds a whole new realm of possibilities to the program. It came from an idea suggested by Gary Kimbrell of 1:3657/1 to whom my thanks go out. FORMAT does some of the same things that the List command's LFORMAT option does. What you do is follow FORMAT with a string kinda like this: TrafficSignal [...options...] FORMAT "execute s:foo %s %s %i %i %s" TO t:doit execute t:doit delete t:doit quiet Then your s:foo script begins with this line: .key name,fido,posts,size,lastpostdate You can now do anything you want with this info. Format it how you like: FORMAT "Dear %s at %s: you wrote %i posts averaging %i bytes, the last on %s." or you might want to send mail to everyone in the echo using a FidoEnter... .key name,fido,posts,size,lastpostdate .bra { .ket } FidoEnter mail:echos/mailboxes/ text:myletter x "The System" "{name}" "Your posts" ORIG 1:325/611 DEST {fido} PVT KILL or maybe just like above but only if they wrote more than 10 posts here: .key name,fido,posts,size,lastpostdate .bra { .ket } if {posts} GT 10 FidoEnter mail:echos/mailboxes/ text:myletter x "The System" "{name}" "Your posts" ORIG 1:325/611 DEST {fido} PVT KILL endif As you can see, the possibilities are quite broad. Gary Kimbrell is running this in his BadMsgs area to report to people that a lot of their messages are coming out bad, for instance. I'd appreciate hearing what kinds of interesting things you're doing with this. Note that you can NOT change the order the parameters. If you want to, though, it's VERY easy to just call a script which then reorders them. I could make it so that you could reorder them, but it's a lot more work for a little bit more gain. After all, only SYSOPs will be using this program, not users, and we assume SYSOPs have a modicum of technical expertise at writing scripts and stuff, or at least can ask the right people for help. SHAREWARE? =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- No, not really. I don't want your money. At least, not enough to ask for it! But I do want to hear from you. Send me a postcard of your home town, to RR 4 Box 2860, Berlin VT 05602. If you want help or assistance, call my BBS at 802-223-3257 or send netmail to 1:325/611. I regularly read the Amiga BBS-related echos like SYSOP as well as FALCON_CBCS too. As of version 1.3 there have been approximately 60 FREQs of this program total (plus how many copies went out in SKYFIDO?) and only 4 registrations. I don't think it's a lot to ask for a postcard -- even if they're not in every supermarket in your town (the usual excuse I hear). Think of it this way: there's NO WAY a postcard is going to be any harder than an international money order, and many of you are registering some of the fine software coming from countries other than your own. If all else fails I'm sure your local post office has postcards (though I'd rather have something that shows the place you live). If I don't get some better success at getting postcards maybe I'll start asking for money -- people seem to get better responses! :/ You may not rerelease a modified version of this archive without my express permission. The source code (enclosed) is written for DICE but #ifdefs (graciously provided by Daniel C. Mecklenburg) allow it to compile under Borland C as well, and it'll probably compile just about anywhere else. At least, I think so. If you want to recompile it for Platform X, just let me know, I'll probably give permission to distribute it, but ask me first. Note that it DOES use some directory-scanning routines which are not ANSI-standard, but are UNIX-standard, so very portable. (Are there ANSI-standard directory scanning functions anyway?) This program is NOT residentable, and it probably doesn't need an unusually large stack, though I always use 20000 anyway. There's a limit of 200 participants, few echos have more than that, but it should be a matter of a simple recompile to increase this limit. Thanks are due to Chris Guertin of Fat Agnus BBS for his help in getting TrafficSignal to work with DLG and cleaning up a few other problems. I forgot to put this paragraph in in time for the 1.2 distribution, but it's belonged here since then. Sorry, Chris, and thanks. Thanks also due to Gary Kimbrell of Bodega Bay BBS for his ideas on how to use this in the Bad area as an automatic diagnostic tool and his suggestions which led to the FORMAT option, as well as beta-testing v1.3 for me. v1.0: initial release v1.1: added date range and past-N-days options v1.2: worked around a few oddities of DLGMail to make this work with DLG v1.3: revamped CLI parameter parsing. Added BEGIN/END (BEGIN requested by Robert Williamson), FORMAT (requested by *registered* user Gary Kimbrell), TO (requested by beta tester Chris Guertin). Current list of registered users: Rich Wood Realpix BBS 1:209/245 Chris Guertin Fat Agnus BBS 1:225/330 (honorary as beta-tester) Peter Deane Inquestor 3:622/401 Gary Kimbrell Bodega Bay BBS 1:3657/1