-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathprint_help.c
More file actions
88 lines (65 loc) · 1.21 KB
/
print_help.c
File metadata and controls
88 lines (65 loc) · 1.21 KB
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
#include "main.h"
/**
* _puts - Prints a string to the standard output stream
* @str: The string to print
*
* Return: Void
*/
void _puts(char *str)
{
size_t len;
len = _strlen(str);
if (write(STDOUT_FILENO, str, len) == -1)
perror("error writing");
}
/**
* _pute - Prints a string to the standard error stream
* @str: The string to print
*
* Return: Void
*/
void _pute(char *str)
{
size_t len;
len = _strlen(str);
if (write(STDERR_FILENO, str, len) == -1)
perror("error writing");
}
/**
* _putchar - writes the character c to stdout
* @c: The character to print
* Return: On success 1.
* On error, -1 is returned, and errno is set appropriately.
*/
void _putchar(char c)
{
write(1, &c, 1);
}
/**
* print_args - prints tokens.
* @args: argument vector
* Return: void
*/
void print_args(char **args)
{
int i;
for (i = 0; args[i]; i++)
printf("args_print: %s\n", args[i]);
}
/**
* print_list - function that prints all the elements of a listint_t list
* @h: node pointer to a linked list
* Return: number of nodes
*/
size_t print_list(list_t *h)
{
list_t *head = h;
size_t count = 0;
while (head != NULL)
{
printf("%s\n", head->dir);
head = head->next;
count++;
}
return (count);
}