-
Notifications
You must be signed in to change notification settings - Fork 0
/
error_ops_manage.c
49 lines (45 loc) · 1.11 KB
/
error_ops_manage.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#include "monty.h"
/**
* op_push_error - function that returns error when push fails
* @line_number: line error occured
*
* Return: EXIT_FAILURE always
*/
int op_push_error(unsigned int line_number)
{
fprintf(stderr, "L%u: usage: push integer\n", line_number);
return (EXIT_FAILURE);
}
/**
* op_pop_error - function that returns error when pop fails
* @line_number: line error occured
*
* Return: EXIT_FAILURE always
*/
int op_pop_error(unsigned int line_number)
{
fprintf(stderr, "L%u: can't pop an empty stack\n", line_number);
return (EXIT_FAILURE);
}
/**
* op_add_error - function that returns error when add fails
* @line_number: line error occured
*
* Return: EXIT_FAILURE always
*/
int op_add_error(unsigned int line_number)
{
fprintf(stderr, "L%u: can't add, stack too short\n", line_number);
return (EXIT_FAILURE);
}
/**
* op_swap_error - function that returns error when swap fails
* @line_number: line error occured
*
* Return: EXIT_FAILURE always
*/
int op_swap_error(unsigned int line_number)
{
fprintf(stderr, "L%u: can't swap, stack too short\n", line_number);
return (EXIT_FAILURE);
}