229 parse_line(char *line, char *fname, char *type, char *size, char *mode,
230 char *acl, char *mtime, char *uid, char *gid, char *contents, char *devnode,
231 char *dest)
232 {
233 int pos, line_len;
234
235 line_len = strlen(line);
236 pos = 0;
237
238 get_token(line, &pos, line_len, fname, PATH_MAX);
239 get_token(line, &pos, line_len, type, TYPE_SIZE);
240 get_token(line, &pos, line_len, size, MISC_SIZE);
241 get_token(line, &pos, line_len, mode, MISC_SIZE);
242 get_token(line, &pos, line_len, acl, ACL_SIZE);
243 get_token(line, &pos, line_len, mtime, MISC_SIZE);
244 get_token(line, &pos, line_len, uid, MISC_SIZE);
245 get_token(line, &pos, line_len, gid, MISC_SIZE);
246
247 /* Reset these fields... */
248
249 *contents = NULL;
250 *devnode = '\0';
251 *dest = '\0';
252
253 /* Handle filetypes which have a last field..... */
254 if (type[0] == 'F')
255 get_token(line, &pos, line_len, contents, PATH_MAX);
256 else if ((type[0] == 'B') || (type[0] == 'C'))
257 get_token(line, &pos, line_len, devnode, PATH_MAX);
258 else if (type[0] == 'L')
259 get_token(line, &pos, line_len, dest, PATH_MAX);
260 }
261
262 static void
263 get_token(char *line, int *curr_pos, int line_len, char *buf, int buf_size)
264 {
265 int cnt = 0;
266
267 while (isspace(line[*curr_pos]) && (*curr_pos < line_len))
268 (*curr_pos)++;
269
|
229 parse_line(char *line, char *fname, char *type, char *size, char *mode,
230 char *acl, char *mtime, char *uid, char *gid, char *contents, char *devnode,
231 char *dest)
232 {
233 int pos, line_len;
234
235 line_len = strlen(line);
236 pos = 0;
237
238 get_token(line, &pos, line_len, fname, PATH_MAX);
239 get_token(line, &pos, line_len, type, TYPE_SIZE);
240 get_token(line, &pos, line_len, size, MISC_SIZE);
241 get_token(line, &pos, line_len, mode, MISC_SIZE);
242 get_token(line, &pos, line_len, acl, ACL_SIZE);
243 get_token(line, &pos, line_len, mtime, MISC_SIZE);
244 get_token(line, &pos, line_len, uid, MISC_SIZE);
245 get_token(line, &pos, line_len, gid, MISC_SIZE);
246
247 /* Reset these fields... */
248
249 *contents = '\0';
250 *devnode = '\0';
251 *dest = '\0';
252
253 /* Handle filetypes which have a last field..... */
254 if (type[0] == 'F')
255 get_token(line, &pos, line_len, contents, PATH_MAX);
256 else if ((type[0] == 'B') || (type[0] == 'C'))
257 get_token(line, &pos, line_len, devnode, PATH_MAX);
258 else if (type[0] == 'L')
259 get_token(line, &pos, line_len, dest, PATH_MAX);
260 }
261
262 static void
263 get_token(char *line, int *curr_pos, int line_len, char *buf, int buf_size)
264 {
265 int cnt = 0;
266
267 while (isspace(line[*curr_pos]) && (*curr_pos < line_len))
268 (*curr_pos)++;
269
|