flamer@omsvax.UUCP (08/15/83)
/* Program: nwrite. * Author: Jim Earenluindil Trethewey. * Version: 2.08 (VAX edition). * Index: CSD246. * Date: 27-Apr-1983. * Last-edit: 08-Jul-1983. * Language: C. * Ppn: /rl2/cs414/trethewe. * For: CS 416, Operating Systems III, Toshi Minoura. * Oregon State University, Corvallis, Oregon. * * This is a UNIX multi-user interprocess communications (IPC) program. * * This module, nwrite.h, contains major data declarations. * */ float version = 2.08; char as_of [] = "08-Jul-1983"; #include <ctype.h> #include <errno.h> #include <sys/ioctl.h> #include <signal.h> #include <sgtty.h> #include <sys/types.h> #include <sys/stat.h> #include <stdio.h> #include <time.h> #include <utmp.h> #ifndef myname #include <ident.h> #endif #define CTRL(x) ('x' & 037) #define SPACE ' ' #define ESCAPE CTRL([) #define TILDE '~' #define BEEP CTRL(G) #define CRLF '\n' #define ERASE "\b \b" #define YES 1 #define NO 0 #define S_OWRITE 0000002 #define TTY 0 #define f_EOF 0 #define MODE 0600 #define MAX_FILES 20 /* * The following entries are system dependant: change as needed. */ char h_conv [] = "/tmp/nwrite.conv%d"; char h_temp [] = "/tmp/nwrite.XXXXXX"; char h_mfd [] = "/tmp/nwrite.master"; char h_tty [] = "/dev/"; char h_utmp [] = "/etc/utmp"; char sh [] = "/bin/sh"; /* * Global declarations. */ struct mct { int conversation; char person [12]; char location [12]; char time_on [26]; }; struct mct_node { struct mct record; struct mct_node *next; }; struct mct mfd; struct mct_node *t_o_s, *ptr, *ptr_1, *ptr_2; struct ltchars old_ltchars, new_ltchars; short old_lmodes, new_lmodes; struct sgttyb old_tty, new_tty; struct stat stat_buf; struct utmp ubuf; FILE *fopen(), *popen(), *fclose(); FILE *f_conv, *f_mail, *f_master, *f_otty, *f_pager, *f_tty, *f_utmp; FILE *out_file [MAX_FILES]; int isatty(), stat(); int ctrl_pipe [2]; int can_call, column, conversation, done, echo, found_conversation; int logged_on, match_tty, n, name_match, reader, was_found, writing; int n_open_files; int timed_out; extern sigset (), alarm (); extern add_mfrec (), analyze (), ascii_time (); extern back_up (), call_up (), choose_conversation (); extern close_talk_files (), delete_mfrec (); extern enter_conference (), eval_input (), force (), get_line (), hang_up (); extern help (), help_text (), id_me (), init_tty_context (); extern load_mfd (), lookup_callee_on_system (), mfd_search (), open_master (); extern open_talk_files (), over (), P (), page_confirm (); extern parse_request (), please_no (), position (), print_header (), quit (); extern read_master (), read_pipe (), receive_message (), restore_tty_context (); extern ring_ring (), save_tty_context (), send_message (), set_up (); extern shell_escape (), show_char (), store_mfd (), text_process (); extern tilde_escape (), time_out (), toggle_echo (), trapse_list (); extern V (), who (), write_master (), write_pipe (); int debug = NO; unsigned dead_man = 15; char **environ; char *ctime(), *getlogin(), *rindex(), *ttyname(); char *malloc (), *getenv (), *mktemp (); char ch; char callee [12]; char current_time [26]; char his_tty [12]; char line [132]; char message [132]; char my_devtty [50]; char tmp_file [50]; char f_devtty [50]; char my_name [12]; char my_tty [12]; char lead_in; char pattern [] = "-e"; /* * Compile this program with the following commands: * * cc nwrite.c -ljobs (note that nwrite.h better be handy) * mv a.out nwrite * chmod u+s nwrite */