version 1.22, 2009/10/27 23:59:43 |
version 1.23, 2009/12/22 19:47:02 |
|
|
void |
void |
order(union f_handle infile, |
order(union f_handle infile, |
int (*get)(int, union f_handle, int, RECHEADER *, u_char *, struct field *), |
int (*get)(int, union f_handle, int, RECHEADER *, u_char *, struct field *), |
struct field *ftbl) |
struct field *ftbl, |
|
int c_warn) |
{ |
{ |
u_char *crec_end, *prec_end, *trec_end; |
u_char *crec_end, *prec_end, *trec_end; |
int c; |
int c; |
|
|
while (get(-1, infile, 1, crec, crec_end, ftbl) == 0) { |
while (get(-1, infile, 1, crec, crec_end, ftbl) == 0) { |
if (0 < (c = cmp(prec, crec))) { |
if (0 < (c = cmp(prec, crec))) { |
crec->data[crec->length-1] = 0; |
crec->data[crec->length-1] = 0; |
errx(1, "found disorder: %s", |
if (c_warn) |
crec->data+crec->offset); |
errx(1, "found disorder: %s", |
|
crec->data+crec->offset); |
|
else |
|
exit(1); |
} |
} |
if (UNIQUE && !c) { |
if (UNIQUE && !c) { |
crec->data[crec->length-1] = 0; |
crec->data[crec->length-1] = 0; |
errx(1, "found non-uniqueness: %s", |
if (c_warn) |
crec->data+crec->offset); |
errx(1, "found non-uniqueness: %s", |
|
crec->data+crec->offset); |
|
else |
|
exit(1); |
} |
} |
/* Swap pointers so that this record is on place |
/* Swap pointers so that this record is on place |
* pointed to by prec and new record is read to place |
* pointed to by prec and new record is read to place |