ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/repos/CCSAdmin/common.c
(Generate patch)

Comparing CCSAdmin/common.c (file contents):
Revision 562 by douglas, 2005-08-27T21:46:39-07:00 vs.
Revision 563 by douglas, 2005-08-28T01:55:06-07:00

# Line 121 | Line 121 | void putpassword(char password[_PASSWORD
121          check(write(file, password, strlen(password)), environment);
122          check(close(file), environment);
123   }
124 +
125 + void get(const char *prompt, regex_t *regex, char **string, jmp_buf environment)
126 + {
127 +        do
128 +        {
129 +                printf("%s: ", prompt);
130 +
131 +                size_t size;
132 +                char *string_ = fcheck(fgetln(stdin, &size), stdin, environment);
133 +
134 +                *string = *string ? realloc(*string, size) : malloc(size);
135 +
136 +                strlcpy(*string, string_, size);
137 +        }
138 +        while (regcheck(regexec(regex, *string, 0, NULL, 0), regex, environment));
139 + }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines