udftools

- Main Page
- Classes
- Files

- File List
- File Members

All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Macros | Enumerations | Functions | Variables
utils.c File Reference
`#include "config.h"`
`#include "utils.h"`
`#include <stdio.h>`
`#include <stdarg.h>`
Include dependency graph for utils.c:

Go to the source code of this file.

## Macros
#define | ANSI_COLOR_RED "\x1b[31m"
#define | ANSI_COLOR_GREEN "\x1b[32m"
#define | ANSI_COLOR_YELLOW "\x1b[33m"
#define | ANSI_COLOR_BLUE "\x1b[34m"
#define | ANSI_COLOR_MAGENTA "\x1b[35m"
#define | ANSI_COLOR_CYAN "\x1b[36m"
#define | ANSI_COLOR_RESET "\x1b[0m"
#define | EOL ""

## Enumerations
enum | message_type { show = 0, message, important, warning, error, faterr, debug }

## Functions
void | read_tag (tag id)
| Support function for printing basic tag information. More...
int | print_disc (struct udf_disc *disc)
| Support function printing VDS, AVDP and LVID. More...
int | prompt (const char *format,...)
| Simple prompt printing out message and accepting y/Y/n/N. Anything else restarts prompt. More...
void | logger (message_type type, char *color, const char *format, va_list arg)
| Internall logger function producing printing to stdout. More...
void | dbg (const char *format,...)
| Debug output. More...
void | dwarn (const char *format,...)
| Debug warning output. More...
void | note (const char *format,...)
| Note output. More...
void | msg (const char *format,...)
| Message output. More...
void | imp (const char *format,...)
| Important message output. More...
void | warn (const char *format,...)
| Warning output. More...
void | err (const char *format,...)
| Error output. More...
void | fatal (const char *format,...)
| Fatal Error output. More...
char * | verbosity_level_str (verbosity_e lvl)
| Verbosity level to string. More...
void | print_metadata_sequence (vds_sequence_t *seq)
| Prints metadata error sequence. More...

## Variables
typedef | __attribute__
verbosity_e | verbosity

## Macro Definition Documentation

#define ANSI_COLOR_BLUE "\x1b[34m"

Definition at line 32 of file utils.c.

#define ANSI_COLOR_CYAN "\x1b[36m"

Definition at line 34 of file utils.c.

#define ANSI_COLOR_GREEN "\x1b[32m"

Definition at line 30 of file utils.c.

#define ANSI_COLOR_MAGENTA "\x1b[35m"

Definition at line 33 of file utils.c.

#define ANSI_COLOR_RED "\x1b[31m"

Definition at line 29 of file utils.c.

#define ANSI_COLOR_RESET "\x1b[0m"

Definition at line 35 of file utils.c.

#define ANSI_COLOR_YELLOW "\x1b[33m"

Definition at line 31 of file utils.c.

#define EOL ""

Definition at line 37 of file utils.c.

## Enumeration Type Documentation

enum message_type

Enumerator
show |
message |
important |
warning |
error |
faterr |
debug |

Definition at line 39 of file utils.c.

## Function Documentation

void dbg | ( | const char * | format,
|  |  | ...
| ) |  |

Debug output.

Prefix: **[DBG]**
Color: default
Output: stdout

Parameters

  [in] | *format | string to print

Definition at line 296 of file utils.c.

void dwarn | ( | const char * | format,
|  |  | ...
| ) |  |

Debug warning output.

Prefix: **[DBG]**
Color: yellow
Output: stdout

Parameters

  [in] | *format | string to print

Definition at line 312 of file utils.c.

void err | ( | const char * | format,
|  |  | ...
| ) |  |

Error output.

Prefix: **[ERR]**
Color: Red
Output: stderr

Parameters

  [in] | *format | string to print

Definition at line 392 of file utils.c.

void fatal | ( | const char * | format,
|  |  | ...
| ) |  |

Fatal Error output.

Prefix: **[FATAL]**
Color: Red Output: stderr

Parameters

  [in] | *format | string to print

Definition at line 408 of file utils.c.

void imp | ( | const char * | format,
|  |  | ...
| ) |  |

Important message output.

Prefix: —
Color: Green
Output: stdout

Parameters

  [in] | *format | string to print

Definition at line 360 of file utils.c.

void logger | ( | message_type | type,
|  | char * | color,
|  | const char * | format,
|  | va_list | arg
| ) |  |

Internall logger function producing printing to stdout.

Parameters

  [in] | type | mesage types are debug, message, important, warning, error, faterr
  [in] | *color | color ASCII formating string
  [in] | *format | message to print
  [in] | arg | aguments to message

Definition at line 222 of file utils.c.

void msg | ( | const char * | format,
|  |  | ...
| ) |  |

Message output.

Prefix: —
Color: default
Output: stdout

Parameters

  [in] | *format | string to print

Definition at line 344 of file utils.c.

void note | ( | const char * | format,
|  |  | ...
| ) |  |

Note output.

Prefix: —
Color: default
Output: stdout

Parameters

  [in] | *format | string to print

Definition at line 328 of file utils.c.

int print_disc | ( | struct udf_disc * | disc | ) |

Support function printing VDS, AVDP and LVID.

Parameters

  [in] | *disc | UDF disc

Definition at line 102 of file utils.c.

void print_metadata_sequence | ( | vds_sequence_t * | seq | ) |

Prints metadata error sequence.

Parameters

  [in] | *seq | VDS sequence

Definition at line 440 of file utils.c.

int prompt | ( | const char * | format,
|  |  | ...
| ) |  |

Simple prompt printing out message and accepting y/Y/n/N. Anything else restarts prompt.

Parameters

  [in] | *format | formatting string with params for vprintf()

Returns
  0 if n/N
  1 if y/Y
  -1 if CRLF
  -128 prompt failed

Definition at line 184 of file utils.c.

void read_tag | ( | tag | id | ) |

Support function for printing basic tag information.

Parameters

  [in] | id | tag identifier

Definition at line 56 of file utils.c.

char* verbosity_level_str | ( | verbosity_e | lvl | ) |

Verbosity level to string.

Returns
  constant char array

Definition at line 420 of file utils.c.

void warn | ( | const char * | format,
|  |  | ...
| ) |  |

Warning output.

Prefix: **[WARN]**
Color: Yellow
Output: stdout

Parameters

  [in] | *format | string to print

Definition at line 376 of file utils.c.

## Variable Documentation

typedef __attribute__

verbosity_e verbosity

Definition at line 49 of file utils.c.