Skip to content

Commit

Permalink
Comment position (#6)
Browse files Browse the repository at this point in the history
* linkedlist_finished

* fineshed_hashtable

* added missing function from to shell.h

* modification to shell.h

* comment_position

* modification to shell.h
  • Loading branch information
h01nait authored May 21, 2023
1 parent 9ac6a9a commit c654697
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
24 changes: 24 additions & 0 deletions _get_comment_position.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#include "shell.h"

/**
* _get_comment_position - function that returns the
* position of the # or the length of the line
* if # not found
*
* @line: string to lookup in
* Return: (integer) position of the #
* or the length if not found
*/
int _get_comment_position(const char *line)
{
int i;

for (i = 0; line[i] != '\0'; i++)
{
if (line[i] == '#')
{
return (i);
}
}
return (i);
}
1 change: 1 addition & 0 deletions shell.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,4 +64,5 @@ char *_get_value(const map_t *map, const char *key);
void _clear_entry(void *data);
void _clear_map(map_t *map);
list_t *_get_keys(const map_t *map);
int _get_comment_position(const char *line);
#endif

0 comments on commit c654697

Please sign in to comment.