File lib/queue.c

Functions for controlling the queue. This includes, viewing, popping, pushing, chopping, and other fun stuff.


Included Files


Global Variable PROCNAME

char PROCNAME[128]
Included from include/ubs.h

Global Variable CUR_TIME

struct tm* CUR_TIME
Included from include/ubs.h

Global Variable GLOBAL

ubs_table GLOBAL
Included from include/ubs.h

Global Variable LOGLEVEL

int LOGLEVEL
Included from include/ubs.h

Global Function queue_chop()

Removes the top line in the queue

void queue_chop ( void )
Prototyped in: include/ubs.h
Calls: log_error_msg()lib/logging.c
  fclose(), feof(), fgets(), fopen(), fprintf(), rand(), rename(), snprintf(), ubs_table_data()


Global Function queue_init()

Initializes the queue, by zero'ing it out

void queue_init ( void )
Prototyped in: include/ubs.h
Calls: log_error_msg()lib/logging.c
  fclose(), fopen(), ubs_table_data()


Global Function queue_length()

Returns the number of files in the queue

int queue_length ( void )

int queue_length
Returns number of files in the queue, or -1 if the queue can't be opened.
Prototyped in: include/ubs.h
Calls: log_error_msg()lib/logging.c
  fclose(), fgets(), fopen(), ubs_table_data()

Global Function queue_pop()

Grabs the first line from the queue, but does not remove this line from the queue file

void queue_pop ( char* str )

char* str
A character array where the first line in the queue will be stored
Prototyped in: include/ubs.h
Calls: log_error_msg()lib/logging.c
  fclose(), fgets(), fopen(), ubs_table_data()

Global Function queue_prepush()

Works like push, but adds the string to the very front of the queue rather than the end.

int queue_prepush ( char* filename )

int queue_prepush
Returns OK on success, NO_FILE if the queue can't be opened
char* filename
The string to be added to the queue
Prototyped in: include/ubs.h
Calls: log_error_msg()lib/logging.c
  fclose(), fgets(), fopen(), fprintf(), rand(), rename(), snprintf(), ubs_table_data()

Global Function queue_push()

Adds a line to the end of the queue

int queue_push ( char* filename )

int queue_push
Returns OK on success, NO_FILE if the queue can't be opened
char* filename
The string to be added to the queue
Prototyped in: include/ubs.h
Calls: log_error_msg()lib/logging.c
  fclose(), fopen(), fprintf(), ubs_table_data()