Pcomm A Unix Telecommunication Program Things to do first: 1) Figure out what files you need. There is a shell archive called "Unixpc.shar" that contains additional (and replacement) files for users of the AT&T Unix PC 7300/3b1. 2) Create a default directory where the Pcomm support files will go. A good location might be /usr/local/lib/pcomm. 3) Copy (and rename to change the upper case 'P' to lower case) the four sample support files Pcomm.dial_dir, Pcomm.extrnl, Pcomm.modem, and Pcomm.param to the default directory. The files should *not* have write permission to all. Please remember these are just sample files... 4) Copy (and rename to change the upper case letters to lower case) the on-line manual pages Pcomm.1, Waitfor.1, Matches.1, and Modem_break.1 to the proper /usr/man directory. For those without access to nroff, I've included the output files called Pcomm.out, Waitfor.out, Matches.out, and Modem_break.ou in the last shell archive. 5) Print the Pcomm Reference Manual. The Doc.nr file is the nroff input which should be run thru tbl and the "me" macro package, as in: tbl Doc.nr | nroff -me -Twhatever | lp For those without access to nroff, I've included the output file called Doc.out in the last shell archive. How to configure Pcomm: 1) Edit the "config.h" file to suit your system's needs and your personal taste. Sites running HoneyDanBer (HDB) UUCP should pay particular attention to the LOCK_DIR, ASCII_PID, and SETUGID definitions. The definitions in config.h are: BSD Define if you're using a Berkeley flavor of Unix. You will have to edit the Makefile in several places. UNIXPC If defined, use the dial(3) routines specific to the AT&T Unix PC 7300/3b1. Useful only if the On Board Modem (OBM) is to be used. OLDCURSES If defined, use the older version of curses(3). (uses termcap in lieu of terminfo). SHAREDMEM If defined, keeps the virtual screen area in shared memory rather than in a file. NOPROMOTE If defined, do not promote missing video attributes to standout. Normally, curses(3) attempts to compensate for missing attributes. SETUGID If defined, extra precautions are taken before opening files or doing a shell escape to restore the real UID/GID. Useful if Pcomm is installed as a set-user-id or get-group-id program. HDB programs often are set-user-id to uucp. LOG_CALLS If defined, Pcomm will keep an administrative log of all calls. The log contains the name of the person making the call, the phone number, and a date/time stamp. Useful for verifying long distance phone bills. LOGFILE The path to the log file (if LOG_CALLS is defined). It should have write permission to all or be writeable under set-user/group-id conditions. LIMIT_LD If defined, Pcomm will limit long distance (toll) calls to a privileged group. The file "admin.c" may require tweaking to detect long distance numbers. GROUP_NAME The name of the group that is allowed to make long distance calls (if LIMIT_LD is defined). LPR The path to the line printer program (this is not the name of the device). LPRINT The path to the "pretty" line printer program. Typically a program that performs a "pr | lp" function. If none exist, use "pr | lp". DEFAULT_DIR The path to the directory that contains the default Pcomm support files. LOCK_DIR The path to the directory where the UUCP lock files are found. On HDB systems this could be /usr/spool/locks or /usr/spool/uucp. ASCII_PID If defined, the lock files will contain an ASCII encoded process id (PID). On HDB systems this is the default. XENIX_LOCKS If defined, the last letter of the device name is folded to lower case when creating the lock file. Newer version of XENIX may require this. SVR4_LOCKS If defined, the new UUCP lockfile format introduced in SVR4 will be used. KEEP_PORT If defined, the port will be kept open between dialing attempts to save time. Some systems may require the modem to be closed and reopened every time. XMC_BROKE Does the status line scroll up when using "magic cookie" terminals? Some Pyramid and AT&T systems may require this to be defined. Find a magic cookie terminal (a Wyse 50 for example), and see what happens. WGETCH_BROKE Does the alarm() system call work correctly with the wgetch() function? Some Masscomp systems will require this to be defined. Symptom: the initial screen doesn't go away by itself after 5 seconds. CLIST_SIZ The size of the serial port character buffer. The default is 64. INPUT_BUF The size of the input buffer (should be about the same size as CLIST_SIZ). The default is 64. OUTPUT_BUF The size of the output buffer (should be about one half INPUT_BUF). The default is 32. Systems without dedicated I/O processors may require a very small INPUT_BUF value to avoid the problem of a "choppy" display. MEMMOVE The name of the memory copy routine (if none, then use "#undef MEMMOVE"). The default is "memmove", although quite a few versions of "memcpy" will work (if they correctly handle target and source overlap). SETUID_BROKE Does your version of Unix allow you to flip-flop back and forth between the real and effective user (or group) ID? Some Masscomp systems will require this to be set. 2) Edit the Makefile. There are provisions in the Makefile to include getcwd(3) and getopt(3) routines if they are missing from your system. You may want to customize the CFLAGS, LDFLAGS, and BIN assignments to suit your needs. If compiling under Berkeley Unix, you will have to edit the Makefile on the following lines: #for old curses(3) or Berkeley systems CURSES = -lcurses -ltermcap TERMLIB = -ltermcap #CURSES = -lcurses #TERMLIB = -lcurses #for System V or Berkeley worlds BSD = -DBSD TTY = tty_ucb.o #BSD = #TTY = tty_att.o All the defaults in config.h assume a AT&T flavor of Unix, sorry about that... 3) Compile pcomm and pcomm_input. Type "make". The "make install" option will attempt to copy "pcomm" and "pcomm_input" into the BIN directory given in the Makefile. However, those sites running HDB UUCP software may require that you to change the mode of "pcomm" to be set-user-id to uucp. DO NOT CHANGE THE SET-UID/GID BITS ON THE "pcomm_input" PROGRAM. Three external programs (waitfor, matches, and modem_break) are included in the distribution to help in creating auto-login shell scripts. 4) Update the sample modem/TTY database. I know I'm asking the impossible, but... Read section 3 and the Appendices of the Doc file first, then run Pcomm to update the modem/TTY database by using the TTY Setup and the Modem Setup menues. You will need to know: o The types and number of modems available for dial out o The TTY ports attached to the modems o The range of baud rates at which the modems operate o How to initialize the modems to suit Pcomm's needs o How to make the modems dial During this step, you will need write permission on the support files in the default directory. RESIST THE TEMPTATION TO EDIT THE SUPPORT FILES DIRECTLY. Portability considerations: 1) Pcomm makes use of the bold, blinking and standout video attributes. My concept of "standout" and "reverse" might be different than yours (I like "standout" to be a brighter version of "reverse"). Some very old versions of curses will ignore the standout mode if you're on a magic cookie terminal. 2) The "port.c" file has a place where you can include your own routine to toggle the getty process on a port (if required). 3) If you compile Pcomm with LOG_CALLS defined, you'll have to look at the code in "admin.c" to see if the long distance detection routine is correct for your site. 4) Compilers that adhere to the ANSI C Standard will complain at the declarations of perror(), malloc(), fread(), fwrite(), etc. There is a "typedef SIG_TYPE" in the config.h file to help silence the compiler's warning messages about the signal() return value. Notes for Sun users... There are several problems that apparently only surface with SunOS. Here are some notes to help out. 1) Pcomm was really designed to work in an AT&T world. If you compile the code with the /usr/5bin/cc compiler, you'll end up with a better product. To do so, you'll need to use default config.h parameters (undef OLDCURSES and undef BSD) plus the default Makefile parameters (CURSES, TERMLIB, and TTY). 2) Patch #5 introduced a new pre-processor definition in dial.c called USLEEP. SunOS no longer supports the AT&T version of the times() system call, so usleep() should be used to generate the delay. 3) Some Sun users report that their version of curses (perhaps limited to the sys5 version?) has a bug that henders the quick transition between the "curses mode" and "terminal mode". If you have troubles with Pcomm getting out-of-sync after a file transfer here is hack to bludgeon the code into submission. I have no idea why this works... change line 53 in terminal.c: while (1) { read(0, &c, 1); c &= 0x7f; to read: while (1) { c = getch(); c &= 0x7f; Please don't use this unless you're having a problem! Note for some 4.2BSD and Ultrix 1.2 systems: Apparently, there is a bug in the /usr/include/curses.h file on some systems that does not define the nl() and nonl() macros correctly. If this is the case with your system, edit /usr/include/curses.h to include the following: #undef nl #undef nonl #define nl() (_tty.sg_flags |= CRMOD,_pfast = _rawmode,stty(_tty_ch, &_tty)) #define nonl() (_tty.sg_flags &= ~CRMOD, _pfast = TRUE, stty(_tty_ch, &_tty)) Emmet P. Gray US Army, HQ III Corps & Fort Hood ...!uunet!uiucuxc!fthood!egray Attn: AFZF-DE-ENV fthood!egray@uxc.cso.uiuc.edu Directorate of Engineering & Housing Environmental Management Office Fort Hood, TX 76544-5057