/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (the "License"). You may not use this file except in compliance
* with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 1998-2003 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
#include "check.h"
#ifndef DEBUG
#else /* DEBUG */
#endif /* DEBUG */
static void
{
char *line;
if (flags & CHECK_WIDE) {
/*
* +1 for null character
*/
} else {
length = L->l_data_length;
}
if (flags & CHECK_FAILURE_DISORDER) {
return;
}
}
static void
{
copy_line_rec(A, B);
}
/*
* check_if_sorted() interacts with a stream in a slightly different way than a
* simple sort or a merge operation: the check involves looking at two adjacent
* lines of the file and verifying that they are collated according to the key
* specifiers given. For files accessed via mmap(), this is simply done as the
* entirety of the file is present in the address space. For files accessed via
* stdio, regardless of locale, we must be able to guarantee that two lines are
* present in memory at once. The basic buffer code for stdio does not make
* such a guarantee, so we use stream_swap_buffer() to alternate between two
* input buffers.
*/
void
{
int r;
int swap_required;
if (SOP_EOS(cur_streamp))
/*
* We need to swap data buffers for the stream with each fetch, except
* on STREAM_MMAP (which are implicitly STREAM_SUSTAIN).
*/
if (swap_required) {
/*
* We use one half of the available memory for input, half for
* each buffer. (The other half is left unreserved, in case
* conversions to collatable form require it.)
*/
}
}
if (S->m_field_options & FIELD_REVERSE_COMPARISONS)
else
coll_flags = 0;
if (S->m_unique_lines)
FCV_REALLOC, S->m_field_separator);
if (swap_required)
while (!SOP_EOS(cur_streamp)) {
(void) SOP_FETCH(cur_streamp);
lineno++;
FCV_REALLOC, S->m_field_separator);
if (r < 0 || (r == 0 && S->m_unique_lines == 0)) {
if (swap_required)
&data_bufsize);
continue;
}
if (r > 0) {
#ifndef XPG4
(S->m_single_byte_locale ? 0 : CHECK_WIDE),
lineno);
#endif /* XPG4 */
}
if (r == 0 && S->m_unique_lines != 0) {
#ifndef XPG4
(S->m_single_byte_locale ? 0 : CHECK_WIDE),
lineno);
#endif /* XPG4 */
}
}
/*NOTREACHED*/
}