Stock Control System
Loading...
Searching...
No Matches
main.c File Reference
#include <errno.h>
#include <limits.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "Pool.h"
#include "Product.h"
Include dependency graph for main.c:

Go to the source code of this file.

Enumerations

enum  MenuOption { MENU_INVALID , MENU_MANAGE_STOCK , MENU_GENERATE_REPORT , MENU_QUIT }
 

Functions

static enum MenuOption get_menu_selection ()
 
static size_t get_input_line (char *const buffer, const size_t buffer_size, FILE *const stream)
 
static unsigned int convert_to_uint (const char *const buffer, bool *error)
 
static int convert_to_sint (const char *const buffer, bool *error)
 
static void manage_stock (const struct Pool *const pool)
 
static void generate_reports (const struct Pool *const pool)
 
static int load_inventory (FILE *const stock_file, struct Pool *const pool)
 
static FILE * open_stock_file (const char *const filename)
 
static void save_inventory (FILE *const datafile, const struct Pool *const pool)
 
int main (const int argc, const char **const argv)
 

Enumeration Type Documentation

◆ MenuOption

enum MenuOption
Enumerator
MENU_INVALID 
MENU_MANAGE_STOCK 
MENU_GENERATE_REPORT 
MENU_QUIT 

Definition at line 11 of file main.c.

Function Documentation

◆ convert_to_sint()

static int convert_to_sint ( const char *const  buffer,
bool *  error 
)
static

Definition at line 95 of file main.c.

◆ convert_to_uint()

static unsigned int convert_to_uint ( const char *const  buffer,
bool *  error 
)
static

Definition at line 80 of file main.c.

◆ generate_reports()

static void generate_reports ( const struct Pool *const  pool)
static

Definition at line 166 of file main.c.

◆ get_input_line()

static size_t get_input_line ( char *const  buffer,
const size_t  buffer_size,
FILE *const  stream 
)
static

Definition at line 55 of file main.c.

◆ get_menu_selection()

static enum MenuOption get_menu_selection ( )
static

Definition at line 19 of file main.c.

◆ load_inventory()

static int load_inventory ( FILE *const  stock_file,
struct Pool *const  pool 
)
static

Definition at line 184 of file main.c.

◆ main()

int main ( const int  argc,
const char **const  argv 
)

Definition at line 249 of file main.c.

◆ manage_stock()

static void manage_stock ( const struct Pool *const  pool)
static

Definition at line 110 of file main.c.

◆ open_stock_file()

static FILE * open_stock_file ( const char *const  filename)
static

Definition at line 220 of file main.c.

◆ save_inventory()

static void save_inventory ( FILE *const  datafile,
const struct Pool *const  pool 
)
static

Definition at line 243 of file main.c.