5 #include "authcmdlib.h"
18 for(i = 0; i < Nemail; i++)
21 memset(a, 0, sizeof(Acctbio));
25 ordbio(Biobuf *b, Acctbio *a)
31 while(p = Brdline(b, '\n')){
38 for(cp = p; *cp && *cp != ' ' && *cp != '\t'; cp++)
40 a->user = malloc(cp - p + 1);
41 strncpy(a->user, p, cp - p);
46 while(*p == ' ' || *p == '\t')
48 for(cp = p; *cp; cp++){
49 if(isdigit(*cp) || *cp == '<'){
50 while(cp > p && *(cp-1) != ' ' && *(cp-1) != '\t')
56 while(cp > p && (*(cp-1) == ' ' || *(cp-1) == '\t'))
58 a->name = malloc(cp - p + 1);
59 strncpy(a->name, p, cp - p);
64 for(cp = p; *cp; cp++){
69 while(cp > p && (*(cp-1) == ' ' || *(cp-1) == '\t'))
71 a->dept = malloc(cp - p + 1);
72 strncpy(a->dept, p, cp - p);
78 for(cp = p; *cp && ne < Nemail;){
84 while(*cp && *cp != '>')
88 a->email[ne] = malloc(cp - p + 1);
89 strncpy(a->email[ne], p, cp - p);
90 a->email[ne][cp-p] = 0;
99 nwrbio(Biobuf *b, Acctbio *a)
110 a->email[0] = strdup(a->user);
112 Bprint(b, "%s|%s|%s|%s|%s", a->user, a->user, a->name, a->dept, a->email[0]);
113 for(i = 1; i < Nemail; i++){
116 Bprint(b, "|%s", a->email[i]);
127 Binit(&in, 0, OREAD);
128 Binit(&out, 1, OWRITE);
129 while(ordbio(&in, &a) == 0)