#ifndef SMALL
#include <string.h>
void parse_list(char **, char *);
static void
parse_unix(char **line, char *type)
{
char *tok;
int field = 0;
while ((tok = strsep(line, " \t")) != NULL) {
if (*tok == '\0')
continue;
if (field == 0)
*type = *tok;
if (field == 7) {
if (line == NULL || *line == NULL)
break;
while (**line == ' ' || **line == '\t')
(*line)++;
break;
}
field++;
}
}
static void
parse_windows(char **line, char *type)
{
char *tok;
int field = 0;
*type = '-';
while ((tok = strsep(line, " \t")) != NULL) {
if (*tok == '\0')
continue;
if (field == 2 && strcmp(tok, "<DIR>") == 0)
*type = 'd';
if (field == 2) {
if (line == NULL || *line == NULL)
break;
while (**line == ' ' || **line == '\t')
(*line)++;
break;
}
field++;
}
}
void
parse_list(char **line, char *type)
{
if (**line >= '0' && **line <= '9')
parse_windows(line, type);
else
parse_unix(line, type);
}
#endif