Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "mpasswdsort.h"
- #include <errno.h>
- #include <stdio.h>
- #include <stdlib.h>
- #include <string.h>
- void parse(FILE *stream, llist list)
- {
- char *ret, buff[MAX_BUFF_SIZE];
- while ((ret = fgets(buff, MAX_BUFF_SIZE, stream))) {
- if (ferror(stream) || !ret) {
- fprintf(stderr, strerror(errno));
- }
- char *s = buff;
- /*
- * username:password:UID:GID:GECOS:directory:shell
- * 1-32 : :>1 : >1
- */
- printf("%s", s);
- for (int i = 0; i < 6; i++) {
- char *sep = strchr(s, ':');
- *sep = '\0';
- char name[1024];
- strcpy(name, s);
- printf("%s\n", name);
- s = sep + 1;
- }
- printf("%s", s);
- }
- list = list;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement