File ml_press.c

NAME: mail_press
DESCRIPTION This procedure processes a 'press' or 'broadcast' command. It parses the rest of the command line (if any), checks the validity of the command, and if valid then sets the appropriate flags so that the main command parser will interpret the following lines as a press message (to be either sent or ignored, as necessary).
Press commands can have up to three types of options: a colour (white or grey), a partial delivery list (either players to send the message to, or players not to send the message to), and a 'fake' option (fake the message as a broadcast, fake it as going to certain players, fake it as not going to certain players, or override a default fake broadcast). None of these options can be specified more than once.
REVISION HISTORY DATE NAME REASON ----------- ------------ --------------------------------------------------- ?? ??? 1987 K.Lowe Original development. 10 Mar 1993 Positron Tell Master the truth about the source and desti- nation(s) of the press/broadcast message. 31 Mar 1994 C.Marcus,Jr. Complete redesign/rewrite, to allow 'press to m' to always work no matter what press settings are. 28 Apr 1994 C.Marcus,Jr. Always include the sender's address in press to Master. 23 May 1994 C.Marcus,Jr. Correct parsing of press options.
INTERFACE DEFINITION Calling Sequence: mail_press(s, need_opts);
Inputs: s := Pointer to command line, following 'press' or 'broadcast' keyword need_opts := TRUE if options must be specified, FALSE if options are optional (sorry about that wording!)
Outputs: broadcast (global) := TRUE if command is good, else FALSE broad_part (global) := TRUE if press is only to some players, FALSE if press is to everybody broad_allbut (global) := TRUE if partial list is list of players to *not* receive message, FALSE if partial list is players to receive message broad_read (global) := TRUE if message is to be read and sent, else FALSE broad_skip (global) := TRUE if message is to be read and discarded, else FALSE broad_list (global) := List of power letters to which message is to be sent (broad_allbut = FALSE) or not sent (broad_allbut = TRUE)
ALGORITHM [Note: global return variables were initialized when broadcast files were opened, and do not need to be initialized here.]
Initialize local flags as necessary. Parse the command line options, if any, setting local flags only. Validate command options against game flags. If command is valid, write press header to broadcast and/or master's broad- cast file(s). Set global return variables according to validity of local flags.


Included Files


Preprocessor definitions

#define is_observer( x )

Global Variable predict

int predict
Visible in:  assign.c
   common.c
   dip.h
   diplog.c
   functions.h
   global.c
   jm.c
   ma_build.c
   ma_build_basic.c
   ma_expenses.c
   ma_famplag.c
   ma_movement.c
   ma_porder.c
   ma_retreat.c
   ma_stats.c
   machlib.c
   mfprintf.c
   ml_press.c
   ml_short.c
   ml_signon.h
   params.c
   po_condition.c
   po_errmsg.c
   po_get.c
   po_mastrpt.c
   st_bid.c
   st_build.c
   st_movement.c
   st_porder.c
   st_retreat.c
   st_setup.c
   st_status.c
   tm_xpress.c
   variant.c
Used in: bidout()st_bid.c
  buildout()st_build.c
  expout()ma_expenses.c
  ma_buildout()ma_build.c
  ma_moveout()ma_movement.c
  ma_retreatout()ma_retreat.c
  moveout()st_movement.c
  retreatout()st_retreat.c

Global Variable signedon

int signedon
Included from mail.h
Visible in:  ma_famplag.c
   ma_porder.c
   ma_stats.c
   mfprintf.c
   ml_press.c
   ml_short.c
   params.c
   st_porder.c
   tm_xpress.c
Used in: params()params.c

Global Variable i_am_really_master

int i_am_really_master
Included from mail.h
Visible in:  ma_famplag.c
   ma_porder.c
   ma_stats.c
   mfprintf.c
   ml_press.c
   ml_short.c
   params.c
   st_porder.c
   tm_xpress.c

Global Variable i_am_really_jk

int i_am_really_jk
Included from mail.h
Visible in:  ma_famplag.c
   ma_porder.c
   ma_stats.c
   mfprintf.c
   ml_press.c
   ml_short.c
   params.c
   st_porder.c
   tm_xpress.c

Global Variable starting

int starting
Included from mail.h
Visible in:  ma_famplag.c
   ma_porder.c
   ma_stats.c
   mfprintf.c
   ml_press.c
   ml_short.c
   params.c
   st_porder.c
   tm_xpress.c

Global Variable player

int player
Included from mail.h
Visible in:  ma_famplag.c
   ma_porder.c
   ma_stats.c
   mfprintf.c
   ml_press.c
   ml_short.c
   params.c
   st_porder.c
   tm_xpress.c
Used in: delete_entry()tm_xpress.c
  list_entries()tm_xpress.c
  mail_press()ml_press.c
  new_diary_entry()tm_xpress.c
  params()params.c
  process_diary()tm_xpress.c
  process_ppress()tm_xpress.c
  read_entry()tm_xpress.c

Global Variable listflg

int listflg
Included from mail.h
Visible in:  ma_famplag.c
   ma_porder.c
   ma_stats.c
   mfprintf.c
   ml_press.c
   ml_short.c
   params.c
   st_porder.c
   tm_xpress.c

Global Variable broadcast

int broadcast
Included from mail.h
Visible in:  ma_famplag.c
   ma_porder.c
   ma_stats.c
   mfprintf.c
   ml_press.c
   ml_short.c
   params.c
   st_porder.c
   tm_xpress.c
Used in: mail_press()ml_press.c
  ownership()st_porder.c
  victory()ma_porder.c

Global Variable broadcast_master_only

int broadcast_master_only
Included from mail.h
Visible in:  ma_famplag.c
   ma_porder.c
   ma_stats.c
   mfprintf.c
   ml_press.c
   ml_short.c
   params.c
   st_porder.c
   tm_xpress.c
Used in: process_diary()tm_xpress.c
  process_ppress()tm_xpress.c

Global Variable broad_part

int broad_part
Included from mail.h
Visible in:  ma_famplag.c
   ma_porder.c
   ma_stats.c
   mfprintf.c
   ml_press.c
   ml_short.c
   params.c
   st_porder.c
   tm_xpress.c
Used in: mail_press()ml_press.c

Global Variable broadcast_absence_adjust

int broadcast_absence_adjust
Included from mail.h
Visible in:  ma_famplag.c
   ma_porder.c
   ma_stats.c
   mfprintf.c
   ml_press.c
   ml_short.c
   params.c
   st_porder.c
   tm_xpress.c

Global Variable broad_list

char broad_list[36+1]
Included from mail.h
Visible in:  ma_famplag.c
   ma_porder.c
   ma_stats.c
   mfprintf.c
   ml_press.c
   ml_short.c
   params.c
   st_porder.c
   tm_xpress.c
Used in: mail_press()ml_press.c

Global Variable broad_allbut

int broad_allbut
Included from mail.h
Visible in:  ma_famplag.c
   ma_porder.c
   ma_stats.c
   mfprintf.c
   ml_press.c
   ml_short.c
   params.c
   st_porder.c
   tm_xpress.c
Used in: mail_press()ml_press.c

Global Variable broad_read

int broad_read
Included from mail.h
Visible in:  ma_famplag.c
   ma_porder.c
   ma_stats.c
   mfprintf.c
   ml_press.c
   ml_short.c
   params.c
   st_porder.c
   tm_xpress.c
Used in: mail_press()ml_press.c

Global Variable broad_skip

int broad_skip
Included from mail.h
Visible in:  ma_famplag.c
   ma_porder.c
   ma_stats.c
   mfprintf.c
   ml_press.c
   ml_short.c
   params.c
   st_porder.c
   tm_xpress.c
Used in: mail_press()ml_press.c

Global Variable broad_signon

int broad_signon
Included from mail.h
Visible in:  ma_famplag.c
   ma_porder.c
   ma_stats.c
   mfprintf.c
   ml_press.c
   ml_short.c
   params.c
   st_porder.c
   tm_xpress.c

Global Variable broad_params

int broad_params
Included from mail.h
Visible in:  ma_famplag.c
   ma_porder.c
   ma_stats.c
   mfprintf.c
   ml_press.c
   ml_short.c
   params.c
   st_porder.c
   tm_xpress.c
Used in: params()params.c

Global Variable read_phase

int read_phase
Included from mail.h
Visible in:  ma_famplag.c
   ma_porder.c
   ma_stats.c
   mfprintf.c
   ml_press.c
   ml_short.c
   params.c
   st_porder.c
   tm_xpress.c

Global Variable moreaddr

int moreaddr
Included from mail.h
Visible in:  ma_famplag.c
   ma_porder.c
   ma_stats.c
   mfprintf.c
   ml_press.c
   ml_short.c
   params.c
   st_porder.c
   tm_xpress.c

Global Variable create

int create
Included from mail.h
Visible in:  ma_famplag.c
   ma_porder.c
   ma_stats.c
   mfprintf.c
   ml_press.c
   ml_short.c
   params.c
   st_porder.c
   tm_xpress.c

Global Variable msg_header_done

int msg_header_done
Included from mail.h
Visible in:  ma_famplag.c
   ma_porder.c
   ma_stats.c
   mfprintf.c
   ml_press.c
   ml_short.c
   params.c
   st_porder.c
   tm_xpress.c

Global Variable baddr

char baddr[80]
Included from mail.h
Visible in:  ma_famplag.c
   ma_porder.c
   ma_stats.c
   mfprintf.c
   ml_press.c
   ml_short.c
   params.c
   st_porder.c
   tm_xpress.c

Global Variable raddr

char raddr[80]
Included from mail.h
Visible in:  ma_famplag.c
   ma_porder.c
   ma_stats.c
   mfprintf.c
   ml_press.c
   ml_short.c
   params.c
   st_porder.c
   tm_xpress.c
Used in: mail_press()ml_press.c
  process_ppress()tm_xpress.c

Global Variable xaddr

char* xaddr
Included from mail.h
Visible in:  ma_famplag.c
   ma_porder.c
   ma_stats.c
   mfprintf.c
   ml_press.c
   ml_short.c
   params.c
   st_porder.c
   tm_xpress.c

Global Variable someone

char* someone
Included from mail.h
Visible in:  ma_famplag.c
   ma_porder.c
   ma_stats.c
   mfprintf.c
   ml_press.c
   ml_short.c
   params.c
   st_porder.c
   tm_xpress.c

Global Variable somepower

char* somepower
Included from mail.h
Visible in:  ma_famplag.c
   ma_porder.c
   ma_stats.c
   mfprintf.c
   ml_press.c
   ml_short.c
   params.c
   st_porder.c
   tm_xpress.c

Global Variable name

char name[20]
Included from mail.h
Visible in:  ma_famplag.c
   ma_porder.c
   ma_stats.c
   mfprintf.c
   ml_press.c
   ml_short.c
   params.c
   st_porder.c
   tm_xpress.c

Global Variable master_press

int master_press
Included from mail.h
Visible in:  ma_famplag.c
   ma_porder.c
   ma_stats.c
   mfprintf.c
   ml_press.c
   ml_short.c
   params.c
   st_porder.c
   tm_xpress.c
Used in: mail_press()ml_press.c

Global Variable master_only_press

int master_only_press
Included from mail.h
Visible in:  ma_famplag.c
   ma_porder.c
   ma_stats.c
   mfprintf.c
   ml_press.c
   ml_short.c
   params.c
   st_porder.c
   tm_xpress.c
Used in: mail_press()ml_press.c

Global Variable ppress_read

int ppress_read
Included from mail.h
Visible in:  ma_famplag.c
   ma_porder.c
   ma_stats.c
   mfprintf.c
   ml_press.c
   ml_short.c
   params.c
   st_porder.c
   tm_xpress.c
Used in: process_ppress()tm_xpress.c

Global Variable ppress_skip

int ppress_skip
Included from mail.h
Visible in:  ma_famplag.c
   ma_porder.c
   ma_stats.c
   mfprintf.c
   ml_press.c
   ml_short.c
   params.c
   st_porder.c
   tm_xpress.c
Used in: process_ppress()tm_xpress.c

Global Variable ppress_done

int ppress_done
Included from mail.h
Visible in:  ma_famplag.c
   ma_porder.c
   ma_stats.c
   mfprintf.c
   ml_press.c
   ml_short.c
   params.c
   st_porder.c
   tm_xpress.c

Global Variable diary_read

int diary_read
Included from mail.h
Visible in:  ma_famplag.c
   ma_porder.c
   ma_stats.c
   mfprintf.c
   ml_press.c
   ml_short.c
   params.c
   st_porder.c
   tm_xpress.c
Used in: new_diary_entry()tm_xpress.c

Global Variable diary_skip

int diary_skip
Included from mail.h
Visible in:  ma_famplag.c
   ma_porder.c
   ma_stats.c
   mfprintf.c
   ml_press.c
   ml_short.c
   params.c
   st_porder.c
   tm_xpress.c
Used in: new_diary_entry()tm_xpress.c
  process_diary()tm_xpress.c

Global Variable diary_done

int diary_done
Included from mail.h
Visible in:  ma_famplag.c
   ma_porder.c
   ma_stats.c
   mfprintf.c
   ml_press.c
   ml_short.c
   params.c
   st_porder.c
   tm_xpress.c

Global Variable Mfile

char Mfile[40]
Included from mail.h
Visible in:  ma_famplag.c
   ma_porder.c
   ma_stats.c
   mfprintf.c
   ml_press.c
   ml_short.c
   params.c
   st_porder.c
   tm_xpress.c

Global Variable Tfile

char Tfile[40]
Included from mail.h
Visible in:  ma_famplag.c
   ma_porder.c
   ma_stats.c
   mfprintf.c
   ml_press.c
   ml_short.c
   params.c
   st_porder.c
   tm_xpress.c

Global Variable mail_bfp

FILE* mail_bfp
Included from mail.h
Visible in:  ma_famplag.c
   ma_porder.c
   ma_stats.c
   mfprintf.c
   ml_press.c
   ml_short.c
   params.c
   st_porder.c
   tm_xpress.c
Used in: mail_press()ml_press.c
  victory()ma_porder.c

Global Variable mail_mbfp

FILE* mail_mbfp
Included from mail.h
Visible in:  ma_famplag.c
   ma_porder.c
   ma_stats.c
   mfprintf.c
   ml_press.c
   ml_short.c
   params.c
   st_porder.c
   tm_xpress.c
Used in: mail_press()ml_press.c
  mfprintf()mfprintf.c
  process_ppress()tm_xpress.c

Global Variable mail_mfp

FILE* mail_mfp
Included from mail.h
Visible in:  ma_famplag.c
   ma_porder.c
   ma_stats.c
   mfprintf.c
   ml_press.c
   ml_short.c
   params.c
   st_porder.c
   tm_xpress.c

Global Variable mail_nfp

FILE* mail_nfp
Included from mail.h
Visible in:  ma_famplag.c
   ma_porder.c
   ma_stats.c
   mfprintf.c
   ml_press.c
   ml_short.c
   params.c
   st_porder.c
   tm_xpress.c

Global Variable mail_ofp

FILE* mail_ofp
Included from mail.h
Visible in:  ma_famplag.c
   ma_porder.c
   ma_stats.c
   mfprintf.c
   ml_press.c
   ml_short.c
   params.c
   st_porder.c
   tm_xpress.c

Global Variable mail_qfp

FILE* mail_qfp
Included from mail.h
Visible in:  ma_famplag.c
   ma_porder.c
   ma_stats.c
   mfprintf.c
   ml_press.c
   ml_short.c
   params.c
   st_porder.c
   tm_xpress.c

Global Variable mail_ifp

FILE* mail_ifp
Included from mail.h
Visible in:  ma_famplag.c
   ma_porder.c
   ma_stats.c
   mfprintf.c
   ml_press.c
   ml_short.c
   params.c
   st_porder.c
   tm_xpress.c

Global Variable mail_pfp

FILE* mail_pfp
Included from mail.h
Visible in:  ma_famplag.c
   ma_porder.c
   ma_stats.c
   mfprintf.c
   ml_press.c
   ml_short.c
   params.c
   st_porder.c
   tm_xpress.c

Global Variable mail_tfp

FILE* mail_tfp
Included from mail.h
Visible in:  ma_famplag.c
   ma_porder.c
   ma_stats.c
   mfprintf.c
   ml_press.c
   ml_short.c
   params.c
   st_porder.c
   tm_xpress.c

Global Variable mail_ppfp

FILE* mail_ppfp
Included from mail.h
Visible in:  ma_famplag.c
   ma_porder.c
   ma_stats.c
   mfprintf.c
   ml_press.c
   ml_short.c
   params.c
   st_porder.c
   tm_xpress.c
Used in: process_ppress()tm_xpress.c

Global Variable diaryfp

FILE* diaryfp
Included from mail.h
Visible in:  ma_famplag.c
   ma_porder.c
   ma_stats.c
   mfprintf.c
   ml_press.c
   ml_short.c
   params.c
   st_porder.c
   tm_xpress.c
Used in: new_diary_entry()tm_xpress.c

Global Variable mail_bfile

char mail_bfile[20]
Included from mail.h
Visible in:  ma_famplag.c
   ma_porder.c
   ma_stats.c
   mfprintf.c
   ml_press.c
   ml_short.c
   params.c
   st_porder.c
   tm_xpress.c

Global Variable mail_mbfile

char mail_mbfile[20]
Included from mail.h
Visible in:  ma_famplag.c
   ma_porder.c
   ma_stats.c
   mfprintf.c
   ml_press.c
   ml_short.c
   params.c
   st_porder.c
   tm_xpress.c

Global Variable mail_rfile

char* mail_rfile
Included from mail.h
Visible in:  ma_famplag.c
   ma_porder.c
   ma_stats.c
   mfprintf.c
   ml_press.c
   ml_short.c
   params.c
   st_porder.c
   tm_xpress.c

External Variables

errorflag
extern int errorflag

Local Variables

options
static char* options[]
Used in: mail_press()

values
static int values[]
Used in: mail_press()


Global Function list_powers()

void list_powers ( char* line, char* list )
Prototyped in: functions.h
Calls: power(), strcat()
Called by: mail_press()ml_press.c
References Variables: powersvariant.c

Global Function mail_press()

void mail_press ( char* s, int need_opts )
Prototyped in: functions.h
Calls: IsAdjacent()ml_press.c
  diptime()diptime.c
  list_powers()ml_press.c
  parse_powers()ml_press.c
  print_line()ml_press.c
  config(), fprintf(), lookfor(), power(), sprintf(), strcat(), strcpy(), toupper()
References Variables: broad_allbutml_press.c
  broad_listml_press.c
  broad_partml_press.c
  broad_readml_press.c
  broad_skipml_press.c
  broadcastml_press.c
  dipentglobal.c
  mail_bfpml_press.c
  mail_mbfpml_press.c
  master_only_pressml_press.c
  master_pressml_press.c
  optionsml_press.c
  playerml_press.c
  powersvariant.c
  raddrml_press.c
  rfpglobal.c
  subjectlineglobal.c
  valuesml_press.c
  errorflag

Global Function parse_powers()

int parse_powers ( char** s, char* list, size_t size, int* count, int put_output )
Prototyped in: functions.h
Calls: fprintf(), memset(), power()
Called by: ProcessShSegment()ml_short.c
  mail_press()ml_press.c
References Variables: rfpglobal.c

Local Function IsAdjacent()

static int IsAdjacent ( int asking_power, int other_power )
Prototyped in: ml_press.c
Calls: valid_move()common.c
  gamein(), po_init()
Called by: mail_press()ml_press.c
References Variables: dipentglobal.c
  nunitglobal.c
  unitglobal.c

Local Function print_line()

static void print_line ( FILE* outf, char* line )
Prototyped in: ml_press.c
Calls: atoi(), config(), fprintf(), strlen()
Called by: mail_press()ml_press.c