-#if ENABLE_FEATURE_ADDUSER_TO_GROUP
-static void add_user_to_group(char **args,
- const char *path,
- FILE* FAST_FUNC (*fopen_func)(const char *fileName, const char *mode))
-{
- char *line;
- int len = strlen(args[1]);
- llist_t *plist = NULL;
- FILE *group_file;
-
- group_file = fopen_func(path, "r");
-
- if (!group_file) return;
-
- while ((line = xmalloc_fgetline(group_file)) != NULL) {
- /* Find the group */
- if (!strncmp(line, args[1], len)
- && line[len] == ':'
- ) {
- /* Add the new user */
- line = xasprintf("%s%s%s", line,
- last_char_is(line, ':') ? "" : ",",
- args[0]);
- }
- llist_add_to_end(&plist, line);
- }
-
- if (ENABLE_FEATURE_CLEAN_UP) {
- fclose(group_file);
- group_file = fopen_func(path, "w");
- while ((line = llist_pop(&plist))) {
- if (group_file)
- fprintf(group_file, "%s\n", line);
- free(line);
- }
- if (group_file)
- fclose(group_file);
- } else {
- group_file = fopen_func(path, "w");
- if (group_file)
- while ((line = llist_pop(&plist)))
- fprintf(group_file, "%s\n", line);
- }
-}
+#if ENABLE_FEATURE_ADDGROUP_LONG_OPTIONS
+static const char addgroup_longopts[] ALIGN1 =
+ "gid\0" Required_argument "g"
+ "system\0" No_argument "S"
+ ;