Defines | Functions | Variables

hacklib.c File Reference

#include "hack.h"
Include dependency graph for hacklib.c:

Defines

#define Static   static
#define TABSIZ   0x20

Functions

boolean digit (char c)
boolean letter (char c)
char highc (char c)
char lowc (char c)
char * lcase (char *s)
char * upstart (char *s)
char * mungspaces (char *bp)
char * eos (char *s)
char * strkitten (char *s, char c)
char * s_suffix (char *s) const
char * xcrypt (char *str, char *buf) const
boolean onlyspace (char *s) const
char * tabexpand (char *sbuf)
char * visctrl (char c)
const char * ordin (int n)
char * sitoa (int n)
int sgn (int n)
int rounddiv (long x, int y)
int distmin (int x0, int y0, int x1, int y1)
int dist2 (int x0, int y0, int x1, int y1)
boolean online2 (int x0, int y0, int x1, int y1)
boolean pmatch (char *patrn, char *strng) const
int strncmpi (const char *s1, const char *s2, int n)
char * strstri (char *str, const char *sub) const
boolean fuzzymatch (char *s1, char *s2, const char *ignore_chars, boolean caseblind) const
static struct tmNDECL (getlt)
void setrandom ()
static struct tmgetlt ()
int getyear ()
int getmonth ()
int getmday ()
long yyyymmdd (time_t date)
int phase_of_the_moon ()
boolean friday_13th ()
int night ()
int midnight ()
boolean towelday ()
boolean piday ()
char * get_formatted_time (time_t time, const char *fmt)
char * iso8601 (time_t date)
char * iso8601_duration (long seconds)
time_t current_epoch ()

Variables

static char buf_fmt_time [BUFSZ]
static char buf_fmt_duration [BUFSZ]

Define Documentation

#define Static   static

Referenced by s_suffix(), sitoa(), and visctrl().

#define TABSIZ   0x20

Referenced by strstri().


Function Documentation

time_t current_epoch (  )

Returns epoch time.

References time().

Referenced by getlt().

Here is the call graph for this function:

Here is the caller graph for this function:

boolean digit ( char  c )

Referenced by checkfile(), getobj(), level_tele(), parseoptions(), readobjnam(), and score_wanted().

Here is the caller graph for this function:

int dist2 ( int  x0,
int  y0,
int  x1,
int  y1 
)
int distmin ( int  x0,
int  y0,
int  x1,
int  y1 
)
char* eos ( char *  s )
boolean friday_13th (  )

References getlt(), tm::tm_mday, and tm::tm_wday.

Referenced by moveloop().

Here is the call graph for this function:

Here is the caller graph for this function:

boolean fuzzymatch ( char *  s1,
char *  s2,
const char *  ignore_chars,
boolean  caseblind 
) const

References index, and lowc().

Referenced by readobjnam(), and wishymatch().

Here is the call graph for this function:

Here is the caller graph for this function:

char* get_formatted_time ( time_t  time,
const char *  fmt 
)

Returns a date formatted by strftime. Returns current time if time is 0.

References buf_fmt_time, BUFSZ, getlt(), and localtime().

Referenced by done(), and iso8601().

Here is the call graph for this function:

Here is the caller graph for this function:

static struct tm* getlt (  ) [static, read]

References current_epoch(), and localtime().

Referenced by friday_13th(), get_formatted_time(), getmday(), getmonth(), getyear(), midnight(), night(), phase_of_the_moon(), and yyyymmdd().

Here is the call graph for this function:

Here is the caller graph for this function:

int getmday (  )

Returns current day of month (1-31)

References getlt(), and tm::tm_mday.

Referenced by piday(), and towelday().

Here is the call graph for this function:

Here is the caller graph for this function:

int getmonth (  )

Returns current month (1-12, 1 = January)

References getlt(), and tm::tm_mon.

Referenced by piday(), and towelday().

Here is the call graph for this function:

Here is the caller graph for this function:

int getyear (  )

References getlt(), and tm::tm_year.

Here is the call graph for this function:

char highc ( char  c )
char* iso8601 ( time_t  date )

Returns a iso-8601 formatted date (e.g. 2010-03-19T08:46:23+0100).

References get_formatted_time().

Referenced by dump_header_html().

Here is the call graph for this function:

Here is the caller graph for this function:

char* iso8601_duration ( long  seconds )

Returns a iso-8601 formatted duration (e.g. PThh:mm:ss).

References buf_fmt_duration.

Referenced by done().

Here is the caller graph for this function:

char* lcase ( char *  s )

Referenced by checkfile(), paranoid_yn(), and x_monnam().

Here is the caller graph for this function:

boolean letter ( char  c )

Referenced by doorganize(), help_dir(), invault(), makeplural(), and parseoptions().

Here is the caller graph for this function:

char lowc ( char  c )

Referenced by do_genocide(), do_oname(), fuzzymatch(), getpos(), parseoptions(), rhack(), strncmpi(), strstri(), and the().

Here is the caller graph for this function:

int midnight (  )

References getlt(), and tm::tm_hour.

Referenced by check_special_room(), domonnoise(), and hitmu().

Here is the call graph for this function:

Here is the caller graph for this function:

char* mungspaces ( char *  bp )

References bp, and TRUE.

Referenced by do_class_genocide(), do_genocide(), do_mname(), do_oname(), do_play_instrument(), docall(), dowrite(), invault(), parseoptions(), readobjnam(), and wc_set_window_colors().

Here is the caller graph for this function:

static struct tm* NDECL ( getlt   ) [static, read]
int night (  )

References getlt(), and tm::tm_hour.

Referenced by damageum(), domonnoise(), hitmu(), mattacku(), mdamagem(), moveloop(), tamedog(), and were_change().

Here is the call graph for this function:

Here is the caller graph for this function:

boolean online2 ( int  x0,
int  y0,
int  x1,
int  y1 
)
boolean onlyspace ( char *  s ) const

References FALSE, and TRUE.

Referenced by writeentry().

Here is the caller graph for this function:

const char* ordin ( int  n )

Referenced by enlightenment(), mshot_xname(), and topten().

Here is the caller graph for this function:

int phase_of_the_moon (  )

References getlt(), tm::tm_yday, and tm::tm_year.

Referenced by moveloop().

Here is the call graph for this function:

Here is the caller graph for this function:

boolean piday (  )

References getmday(), and getmonth().

Referenced by m_throw(), and xname().

Here is the call graph for this function:

Here is the caller graph for this function:

boolean pmatch ( char *  patrn,
char *  strng 
) const

References FALSE, and TRUE.

Referenced by checkfile().

Here is the caller graph for this function:

int rounddiv ( long  x,
int  y 
)

References m.

Referenced by doeat(), and eatcorpse().

Here is the caller graph for this function:

char* s_suffix ( char *  s ) const
void setrandom (  )

References DEV_RANDOM, srand48(), and time().

Referenced by initoptions().

Here is the call graph for this function:

Here is the caller graph for this function:

int sgn ( int  n )
char* sitoa ( int  n )

References Sprintf, and Static.

Referenced by doname_base().

Here is the caller graph for this function:

char* strkitten ( char *  s,
char  c 
)

References eos().

Referenced by ggetobj().

Here is the call graph for this function:

Here is the caller graph for this function:

int strncmpi ( const char *  s1,
const char *  s2,
int  n 
)
char* strstri ( char *  str,
const char *  sub 
) const
char* tabexpand ( char *  sbuf )

References bp, and BUFSZ.

Referenced by checkfile().

Here is the caller graph for this function:

boolean towelday (  )

References getmday(), and getmonth().

Referenced by u_init().

Here is the call graph for this function:

Here is the caller graph for this function:

char* upstart ( char *  s )

References highc().

Referenced by animate_statue(), can_twoweapon(), domove(), dotrap(), fix_worst_trouble(), mattacku(), Mb_hit(), moverock(), rndcurse(), and slip_or_trip().

Here is the call graph for this function:

Here is the caller graph for this function:

char* visctrl ( char  c )

References Static.

Referenced by getpos().

Here is the caller graph for this function:

char* xcrypt ( char *  str,
char *  buf 
) const

Referenced by deliver_by_pline(), deliver_by_window(), getrumor(), outoracle(), and qt_com_firstline().

Here is the caller graph for this function:

long yyyymmdd ( time_t  date )

References getlt(), localtime(), tm::tm_mday, tm::tm_mon, and tm::tm_year.

Referenced by paniclog(), and topten().

Here is the call graph for this function:

Here is the caller graph for this function:


Variable Documentation

char buf_fmt_duration[BUFSZ] [static]

Referenced by iso8601_duration().

char buf_fmt_time[BUFSZ] [static]

Referenced by get_formatted_time().