comm.c revision 7c478bd95313f5f23a4c958a745db2134aa03244
/*
* 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 2004 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
/* All Rights Reserved */
#pragma ident "%Z%%M% %I% %E% SMI"
/*
* process common lines of two files
*/
#include <locale.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
static int compare(char *, char *);
static void usage(void);
static void wr(char *, int);
{ \
exit(0); \
} \
}
static int one;
static int two;
static int three;
static int is_c_locale;
int
{
int l = 1;
int c; /* used for getopt() */
#if !defined(TEXT_DOMAIN) /* Should be defined by cc -D */
#endif
(void) textdomain(TEXT_DOMAIN);
gettext("Query of LC_COLLATE category failed\n"));
exit(4);
}
switch (c) {
case '1':
if (!one) {
one = 1;
}
break;
case '2':
if (!two) {
two = 1;
}
break;
case '3':
three = 1;
break;
default:
usage();
}
if (argc != 2)
usage();
for (;;) {
case 0:
continue;
case 1:
continue;
case 2:
continue;
/*
* case "3" means lines are equal in collation,
* but not identical (not very likely)
*/
case 3:
continue;
}
}
/* NOTREACHED */
return (0);
}
static int
char *buf;
{
register int i, j;
i = j = 0;
*buf = (char)j;
*buf = '\0';
return (0);
}
i++;
buf++;
}
return (-1);
}
static void
char *str;
int n;
{
switch (n) {
case 1:
if (one)
return;
break;
case 2:
if (two)
return;
break;
case 3:
if (three)
return;
}
}
static void
char *lbuf;
int n;
{
do {
exit(0);
}
static int
compare(a, b)
char *a, *b;
{
int ret;
ra = a - 1;
rb = b - 1;
if (*ra == '\0')
return (0);
/* For "C" locale, just compare bytes */
if (is_c_locale) {
return (1);
return (2);
}
/* For other locales, call locale-sensitive compare routine */
else {
}
}
static FILE *
openfil(s)
char *s;
{
FILE *b;
if (s[0] == '-' && s[1] == 0)
b = stdin;
perror(s);
exit(2);
}
return (b);
}
static void
usage()
{
exit(2);
}