pirutil.c - various utility functions


char *clone_string(NOTNULL(char const *src))

clone a string. Copy the characters of src into dest and return dest. Memory allocation is done by this function, keeping this function's client code simple. Please free() the memory after usage!

FILE *open_file(char const *filename, char const *mode)

Open the file filename in mode mode. If this fails, an error message is printed, and the program is terminated.

void printverbose(char *message)

Prints the specified message if the verbose flag was set

void printdebug(char *message)

Prints the specified message if the debug flag was set.

int is_op(char *id)

Return 1 if the specified id is a Parrot op, 0 otherwise.