Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #ifndef SHELL
- #define SHELL
- #define MAXLINE 100 /* maximum input line length */
- #include <stdio.h>
- #include <stdlib.h>
- #include <unistd.h>
- #include <string.h>
- #include <sys/wait.h>
- #include <sys/types.h>
- #include <sys/stat.h>
- extern char **environ;
- int _getline(char line[], int maxline);
- void exe(char str[], int size);
- #endif
- /**
- * _getline - read a line
- * @s: storage line into s
- * @lim: MAXLINE
- * Return: length
- */
- int _getline(char s[], int lim)
- {
- int c, i;
- for (i = 0; i < (lim - 1) && (c = getchar()) != EOF; ++i)
- {
- if (c == '\n')
- {
- s[i] = 0;
- return (i);
- }
- s[i] = c;
- }
- return (i);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement