17c478bd9Sstevel@tonic-gate /*
27c478bd9Sstevel@tonic-gate * CDDL HEADER START
37c478bd9Sstevel@tonic-gate *
47c478bd9Sstevel@tonic-gate * The contents of this file are subject to the terms of the
57c478bd9Sstevel@tonic-gate * Common Development and Distribution License, Version 1.0 only
67c478bd9Sstevel@tonic-gate * (the "License"). You may not use this file except in compliance
77c478bd9Sstevel@tonic-gate * with the License.
87c478bd9Sstevel@tonic-gate *
97c478bd9Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
107c478bd9Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing.
117c478bd9Sstevel@tonic-gate * See the License for the specific language governing permissions
127c478bd9Sstevel@tonic-gate * and limitations under the License.
137c478bd9Sstevel@tonic-gate *
147c478bd9Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each
157c478bd9Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
167c478bd9Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the
177c478bd9Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying
187c478bd9Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner]
197c478bd9Sstevel@tonic-gate *
207c478bd9Sstevel@tonic-gate * CDDL HEADER END
217c478bd9Sstevel@tonic-gate */
22*4fce32e1Smuffin
23*4fce32e1Smuffin /*
24*4fce32e1Smuffin * Copyright 1999 Sun Microsystems, Inc. All rights reserved.
25*4fce32e1Smuffin * Use is subject to license terms.
26*4fce32e1Smuffin */
27*4fce32e1Smuffin
287c478bd9Sstevel@tonic-gate /* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
297c478bd9Sstevel@tonic-gate /* All Rights Reserved */
307c478bd9Sstevel@tonic-gate
317c478bd9Sstevel@tonic-gate #include <stdio.h>
327c478bd9Sstevel@tonic-gate #include <sys/types.h>
337c478bd9Sstevel@tonic-gate #include <sys/statvfs.h>
347c478bd9Sstevel@tonic-gate #include <locale.h>
357c478bd9Sstevel@tonic-gate #include <malloc.h>
367c478bd9Sstevel@tonic-gate #include <string.h>
377c478bd9Sstevel@tonic-gate #include <sys/param.h>
387c478bd9Sstevel@tonic-gate #include <stdlib.h>
397c478bd9Sstevel@tonic-gate #include <wchar.h>
407c478bd9Sstevel@tonic-gate #include <widec.h>
417c478bd9Sstevel@tonic-gate #include <ctype.h>
427c478bd9Sstevel@tonic-gate #include <errno.h>
437c478bd9Sstevel@tonic-gate
447c478bd9Sstevel@tonic-gate
457c478bd9Sstevel@tonic-gate #define DEFAULT_LINES 1000
467c478bd9Sstevel@tonic-gate #define ONE_K 1024
477c478bd9Sstevel@tonic-gate #define ONE_M ONE_K*ONE_K
487c478bd9Sstevel@tonic-gate #ifndef TRUE
497c478bd9Sstevel@tonic-gate #define TRUE 1
507c478bd9Sstevel@tonic-gate #define FALSE 0
517c478bd9Sstevel@tonic-gate #endif
527c478bd9Sstevel@tonic-gate
537c478bd9Sstevel@tonic-gate
547c478bd9Sstevel@tonic-gate static void Usage();
557c478bd9Sstevel@tonic-gate static void next_file_name();
567c478bd9Sstevel@tonic-gate
577c478bd9Sstevel@tonic-gate
587c478bd9Sstevel@tonic-gate static char *progname;
597c478bd9Sstevel@tonic-gate static int suffix_length = 2;
607c478bd9Sstevel@tonic-gate
61*4fce32e1Smuffin int
main(int argc,char ** argv)627c478bd9Sstevel@tonic-gate main(int argc, char **argv)
637c478bd9Sstevel@tonic-gate {
647c478bd9Sstevel@tonic-gate long long line_count = 0;
657c478bd9Sstevel@tonic-gate long long byte_count = 0;
667c478bd9Sstevel@tonic-gate long long out;
677c478bd9Sstevel@tonic-gate char *fname = NULL;
687c478bd9Sstevel@tonic-gate char head[MAXPATHLEN];
697c478bd9Sstevel@tonic-gate char *output_file_name;
707c478bd9Sstevel@tonic-gate char *tail;
717c478bd9Sstevel@tonic-gate char *last;
727c478bd9Sstevel@tonic-gate FILE *in_file = NULL;
737c478bd9Sstevel@tonic-gate FILE *out_file = (FILE *)NULL;
747c478bd9Sstevel@tonic-gate int i;
757c478bd9Sstevel@tonic-gate int c;
767c478bd9Sstevel@tonic-gate wint_t wc;
777c478bd9Sstevel@tonic-gate int output_file_open;
787c478bd9Sstevel@tonic-gate struct statvfs stbuf;
797c478bd9Sstevel@tonic-gate int opt;
807c478bd9Sstevel@tonic-gate int non_standard_line_count = FALSE;
817c478bd9Sstevel@tonic-gate
827c478bd9Sstevel@tonic-gate
837c478bd9Sstevel@tonic-gate (void) setlocale(LC_ALL, "");
847c478bd9Sstevel@tonic-gate #if !defined(TEXT_DOMAIN) /* Should be defined by cc -D */
857c478bd9Sstevel@tonic-gate #define TEXT_DOMAIN "SYS_TEST" /* Use this only if it weren't */
867c478bd9Sstevel@tonic-gate #endif
877c478bd9Sstevel@tonic-gate (void) textdomain(TEXT_DOMAIN);
887c478bd9Sstevel@tonic-gate
897c478bd9Sstevel@tonic-gate progname = argv[0];
907c478bd9Sstevel@tonic-gate
917c478bd9Sstevel@tonic-gate /* check for explicit stdin "-" option */
927c478bd9Sstevel@tonic-gate for (i = 1; i < argc; i++) {
937c478bd9Sstevel@tonic-gate if (strcmp(argv[i], "-") == 0) {
947c478bd9Sstevel@tonic-gate in_file = stdin;
957c478bd9Sstevel@tonic-gate while (i < argc) {
967c478bd9Sstevel@tonic-gate argv[i] = argv[i + 1];
977c478bd9Sstevel@tonic-gate
987c478bd9Sstevel@tonic-gate /* a "-" before "--" is an error */
997c478bd9Sstevel@tonic-gate if ((argv[i] != NULL) &&
1007c478bd9Sstevel@tonic-gate (strcmp(argv[i], "--") == 0)) {
1017c478bd9Sstevel@tonic-gate Usage();
1027c478bd9Sstevel@tonic-gate }
1037c478bd9Sstevel@tonic-gate i++;
1047c478bd9Sstevel@tonic-gate }
1057c478bd9Sstevel@tonic-gate argc--;
1067c478bd9Sstevel@tonic-gate }
1077c478bd9Sstevel@tonic-gate }
1087c478bd9Sstevel@tonic-gate
1097c478bd9Sstevel@tonic-gate /* check for non-standard "-line-count" option */
1107c478bd9Sstevel@tonic-gate for (i = 1; i < argc; i++) {
1117c478bd9Sstevel@tonic-gate if (strcmp(argv[i], "--") == 0)
1127c478bd9Sstevel@tonic-gate break;
1137c478bd9Sstevel@tonic-gate
1147c478bd9Sstevel@tonic-gate if ((argv[i][0] == '-') && isdigit(argv[i][1])) {
1157c478bd9Sstevel@tonic-gate if (strlen(&argv[i][1]) !=
1167c478bd9Sstevel@tonic-gate strspn(&argv[i][1], "0123456789")) {
1177c478bd9Sstevel@tonic-gate (void) fprintf(stderr, gettext(
1187c478bd9Sstevel@tonic-gate "%s: Badly formed number\n"), progname);
1197c478bd9Sstevel@tonic-gate Usage();
1207c478bd9Sstevel@tonic-gate }
1217c478bd9Sstevel@tonic-gate
1227c478bd9Sstevel@tonic-gate line_count = (long long) strtoll(&argv[i][1],
1237c478bd9Sstevel@tonic-gate (char **)NULL, 10);
1247c478bd9Sstevel@tonic-gate
1257c478bd9Sstevel@tonic-gate non_standard_line_count = TRUE;
1267c478bd9Sstevel@tonic-gate while (i < argc) {
1277c478bd9Sstevel@tonic-gate argv[i] = argv[i + 1];
1287c478bd9Sstevel@tonic-gate i++;
1297c478bd9Sstevel@tonic-gate }
1307c478bd9Sstevel@tonic-gate argc--;
1317c478bd9Sstevel@tonic-gate }
1327c478bd9Sstevel@tonic-gate }
1337c478bd9Sstevel@tonic-gate
1347c478bd9Sstevel@tonic-gate /* get options */
1357c478bd9Sstevel@tonic-gate while ((opt = getopt(argc, argv, "a:b:l:")) != EOF) {
1367c478bd9Sstevel@tonic-gate switch (opt) {
1377c478bd9Sstevel@tonic-gate case 'a':
1387c478bd9Sstevel@tonic-gate if (strcmp(optarg, "--") == 0) {
1397c478bd9Sstevel@tonic-gate Usage();
1407c478bd9Sstevel@tonic-gate }
1417c478bd9Sstevel@tonic-gate suffix_length = (long long) strtoll(optarg,
1427c478bd9Sstevel@tonic-gate (char **)NULL, 10);
1437c478bd9Sstevel@tonic-gate if (suffix_length <= 0) {
1447c478bd9Sstevel@tonic-gate (void) fprintf(stderr, gettext(
1457c478bd9Sstevel@tonic-gate "%s: Invalid \"-a %s\" option\n"),
1467c478bd9Sstevel@tonic-gate progname, optarg);
1477c478bd9Sstevel@tonic-gate Usage();
1487c478bd9Sstevel@tonic-gate }
1497c478bd9Sstevel@tonic-gate break;
1507c478bd9Sstevel@tonic-gate
1517c478bd9Sstevel@tonic-gate case 'b':
1527c478bd9Sstevel@tonic-gate if (strcmp(optarg, "--") == 0) {
1537c478bd9Sstevel@tonic-gate Usage();
1547c478bd9Sstevel@tonic-gate }
1557c478bd9Sstevel@tonic-gate byte_count = (long long) strtoll(optarg,
1567c478bd9Sstevel@tonic-gate (char **)NULL, 10);
1577c478bd9Sstevel@tonic-gate if (*(optarg + strspn(optarg, "0123456789")) == 'k')
1587c478bd9Sstevel@tonic-gate byte_count *= ONE_K;
1597c478bd9Sstevel@tonic-gate if (*(optarg + strspn(optarg, "0123456789")) == 'm')
1607c478bd9Sstevel@tonic-gate byte_count *= ONE_M;
1617c478bd9Sstevel@tonic-gate break;
1627c478bd9Sstevel@tonic-gate
1637c478bd9Sstevel@tonic-gate case 'l':
1647c478bd9Sstevel@tonic-gate if (strcmp(optarg, "--") == 0) {
1657c478bd9Sstevel@tonic-gate Usage();
1667c478bd9Sstevel@tonic-gate }
1677c478bd9Sstevel@tonic-gate if (non_standard_line_count == TRUE) {
1687c478bd9Sstevel@tonic-gate Usage();
1697c478bd9Sstevel@tonic-gate }
1707c478bd9Sstevel@tonic-gate line_count = (long long) strtoll(optarg,
1717c478bd9Sstevel@tonic-gate (char **)NULL, 10);
1727c478bd9Sstevel@tonic-gate break;
1737c478bd9Sstevel@tonic-gate
1747c478bd9Sstevel@tonic-gate default:
1757c478bd9Sstevel@tonic-gate Usage();
1767c478bd9Sstevel@tonic-gate }
1777c478bd9Sstevel@tonic-gate }
1787c478bd9Sstevel@tonic-gate
1797c478bd9Sstevel@tonic-gate /* get input file */
1807c478bd9Sstevel@tonic-gate if ((in_file == NULL) && (optind < argc)) {
1817c478bd9Sstevel@tonic-gate if ((in_file = fopen(argv[optind++], "r")) == NULL) {
1827c478bd9Sstevel@tonic-gate (void) perror("split");
1837c478bd9Sstevel@tonic-gate return (1);
1847c478bd9Sstevel@tonic-gate }
1857c478bd9Sstevel@tonic-gate }
1867c478bd9Sstevel@tonic-gate if (in_file == NULL) {
1877c478bd9Sstevel@tonic-gate in_file = stdin;
1887c478bd9Sstevel@tonic-gate }
1897c478bd9Sstevel@tonic-gate
1907c478bd9Sstevel@tonic-gate /* get output file name */
1917c478bd9Sstevel@tonic-gate if (optind < argc) {
1927c478bd9Sstevel@tonic-gate output_file_name = argv[optind];
1937c478bd9Sstevel@tonic-gate if ((tail = strrchr(output_file_name, '/')) == NULL) {
1947c478bd9Sstevel@tonic-gate tail = output_file_name;
1957c478bd9Sstevel@tonic-gate (void) getcwd(head, sizeof (head));
1967c478bd9Sstevel@tonic-gate } else {
1977c478bd9Sstevel@tonic-gate tail++;
1987c478bd9Sstevel@tonic-gate (void) strcpy(head, output_file_name);
1997c478bd9Sstevel@tonic-gate last = strrchr(head, '/');
2007c478bd9Sstevel@tonic-gate *++last = '\0';
2017c478bd9Sstevel@tonic-gate }
2027c478bd9Sstevel@tonic-gate
2037c478bd9Sstevel@tonic-gate if (statvfs(head, &stbuf) < 0) {
2047c478bd9Sstevel@tonic-gate perror(head);
2057c478bd9Sstevel@tonic-gate return (1);
2067c478bd9Sstevel@tonic-gate }
2077c478bd9Sstevel@tonic-gate
2087c478bd9Sstevel@tonic-gate if (strlen(tail) > (stbuf.f_namemax - suffix_length)) {
2097c478bd9Sstevel@tonic-gate (void) fprintf(stderr, gettext(
2107c478bd9Sstevel@tonic-gate "%s: More than %d characters in file name\n"),
2117c478bd9Sstevel@tonic-gate progname, stbuf.f_namemax - suffix_length);
2127c478bd9Sstevel@tonic-gate Usage();
2137c478bd9Sstevel@tonic-gate }
2147c478bd9Sstevel@tonic-gate } else
2157c478bd9Sstevel@tonic-gate output_file_name = "x";
2167c478bd9Sstevel@tonic-gate
2177c478bd9Sstevel@tonic-gate /* check options */
2187c478bd9Sstevel@tonic-gate if (((int)strlen(output_file_name) + suffix_length) > FILENAME_MAX) {
2197c478bd9Sstevel@tonic-gate (void) fprintf(stderr, gettext(
2207c478bd9Sstevel@tonic-gate "%s: Output file name too long\n"), progname);
2217c478bd9Sstevel@tonic-gate return (1);
2227c478bd9Sstevel@tonic-gate }
2237c478bd9Sstevel@tonic-gate
2247c478bd9Sstevel@tonic-gate if (line_count && byte_count) {
2257c478bd9Sstevel@tonic-gate Usage();
2267c478bd9Sstevel@tonic-gate }
2277c478bd9Sstevel@tonic-gate
2287c478bd9Sstevel@tonic-gate /* use default line count if none specified */
2297c478bd9Sstevel@tonic-gate if (line_count == 0) {
2307c478bd9Sstevel@tonic-gate line_count = DEFAULT_LINES;
2317c478bd9Sstevel@tonic-gate }
2327c478bd9Sstevel@tonic-gate
2337c478bd9Sstevel@tonic-gate /*
2347c478bd9Sstevel@tonic-gate * allocate buffer for the filenames we'll construct; it must be
2357c478bd9Sstevel@tonic-gate * big enough to hold the name in 'output_file_name' + an n-char
2367c478bd9Sstevel@tonic-gate * suffix + NULL terminator
2377c478bd9Sstevel@tonic-gate */
2387c478bd9Sstevel@tonic-gate if ((fname = (char *)malloc(strlen(output_file_name) +
2397c478bd9Sstevel@tonic-gate suffix_length + 1)) == NULL) {
2407c478bd9Sstevel@tonic-gate (void) perror("split");
2417c478bd9Sstevel@tonic-gate return (1);
2427c478bd9Sstevel@tonic-gate }
2437c478bd9Sstevel@tonic-gate
2447c478bd9Sstevel@tonic-gate /* build first output file name */
2457c478bd9Sstevel@tonic-gate for (i = 0; output_file_name[i]; i++) {
2467c478bd9Sstevel@tonic-gate fname[i] = output_file_name[i];
2477c478bd9Sstevel@tonic-gate }
2487c478bd9Sstevel@tonic-gate while (i < (int)strlen(output_file_name) + suffix_length) {
2497c478bd9Sstevel@tonic-gate fname[i++] = 'a';
2507c478bd9Sstevel@tonic-gate }
2517c478bd9Sstevel@tonic-gate if (suffix_length)
2527c478bd9Sstevel@tonic-gate fname[i - 1] = 'a' - 1;
2537c478bd9Sstevel@tonic-gate fname[i] = '\0';
2547c478bd9Sstevel@tonic-gate
2557c478bd9Sstevel@tonic-gate for (; ; ) {
2567c478bd9Sstevel@tonic-gate output_file_open = FALSE;
2577c478bd9Sstevel@tonic-gate if (byte_count) {
2587c478bd9Sstevel@tonic-gate for (out = 0; out < byte_count; out++) {
2597c478bd9Sstevel@tonic-gate errno = 0;
2607c478bd9Sstevel@tonic-gate c = getc(in_file);
2617c478bd9Sstevel@tonic-gate if (c == EOF) {
2627c478bd9Sstevel@tonic-gate if (errno != 0) {
2637c478bd9Sstevel@tonic-gate int lerrno = errno;
2647c478bd9Sstevel@tonic-gate (void) fprintf(stderr, gettext(
2657c478bd9Sstevel@tonic-gate "%s: Read error at file offset %lld: %s, "
2667c478bd9Sstevel@tonic-gate "aborting split\n"),
2677c478bd9Sstevel@tonic-gate progname, ftello(in_file),
2687c478bd9Sstevel@tonic-gate strerror(lerrno));
2697c478bd9Sstevel@tonic-gate if (output_file_open == TRUE)
2707c478bd9Sstevel@tonic-gate (void) fclose(out_file);
2717c478bd9Sstevel@tonic-gate free(fname);
2727c478bd9Sstevel@tonic-gate return (1);
2737c478bd9Sstevel@tonic-gate }
2747c478bd9Sstevel@tonic-gate if (output_file_open == TRUE)
2757c478bd9Sstevel@tonic-gate (void) fclose(out_file);
2767c478bd9Sstevel@tonic-gate free(fname);
2777c478bd9Sstevel@tonic-gate return (0);
2787c478bd9Sstevel@tonic-gate }
2797c478bd9Sstevel@tonic-gate if (output_file_open == FALSE) {
2807c478bd9Sstevel@tonic-gate next_file_name(fname);
2817c478bd9Sstevel@tonic-gate if ((out_file = fopen(fname, "w")) == NULL) {
2827c478bd9Sstevel@tonic-gate (void) perror("split");
2837c478bd9Sstevel@tonic-gate free(fname);
2847c478bd9Sstevel@tonic-gate return (1);
2857c478bd9Sstevel@tonic-gate }
2867c478bd9Sstevel@tonic-gate output_file_open = TRUE;
2877c478bd9Sstevel@tonic-gate }
2887c478bd9Sstevel@tonic-gate if (putc(c, out_file) == EOF) {
2897c478bd9Sstevel@tonic-gate perror("split");
2907c478bd9Sstevel@tonic-gate if (output_file_open == TRUE)
2917c478bd9Sstevel@tonic-gate (void) fclose(out_file);
2927c478bd9Sstevel@tonic-gate free(fname);
2937c478bd9Sstevel@tonic-gate return (1);
2947c478bd9Sstevel@tonic-gate }
2957c478bd9Sstevel@tonic-gate }
2967c478bd9Sstevel@tonic-gate } else {
2977c478bd9Sstevel@tonic-gate for (out = 0; out < line_count; out++) {
2987c478bd9Sstevel@tonic-gate do {
2997c478bd9Sstevel@tonic-gate errno = 0;
3007c478bd9Sstevel@tonic-gate wc = getwc(in_file);
3017c478bd9Sstevel@tonic-gate if (wc == WEOF) {
3027c478bd9Sstevel@tonic-gate if (errno != 0) {
3037c478bd9Sstevel@tonic-gate if (errno == EILSEQ) {
3047c478bd9Sstevel@tonic-gate (void) fprintf(stderr, gettext(
3057c478bd9Sstevel@tonic-gate "%s: Invalid multibyte sequence "
3067c478bd9Sstevel@tonic-gate "encountered at file offset %lld, "
3077c478bd9Sstevel@tonic-gate "aborting split\n"),
3087c478bd9Sstevel@tonic-gate progname, ftello(in_file));
3097c478bd9Sstevel@tonic-gate } else {
3107c478bd9Sstevel@tonic-gate (void) perror("split");
3117c478bd9Sstevel@tonic-gate }
3127c478bd9Sstevel@tonic-gate if (output_file_open == TRUE)
3137c478bd9Sstevel@tonic-gate (void) fclose(out_file);
3147c478bd9Sstevel@tonic-gate free(fname);
3157c478bd9Sstevel@tonic-gate return (1);
3167c478bd9Sstevel@tonic-gate }
3177c478bd9Sstevel@tonic-gate if (output_file_open == TRUE)
3187c478bd9Sstevel@tonic-gate (void) fclose(out_file);
3197c478bd9Sstevel@tonic-gate free(fname);
3207c478bd9Sstevel@tonic-gate return (0);
3217c478bd9Sstevel@tonic-gate }
3227c478bd9Sstevel@tonic-gate if (output_file_open == FALSE) {
3237c478bd9Sstevel@tonic-gate next_file_name(fname);
3247c478bd9Sstevel@tonic-gate if ((out_file = fopen(fname, "w")) == NULL) {
3257c478bd9Sstevel@tonic-gate (void) perror("split");
3267c478bd9Sstevel@tonic-gate free(fname);
3277c478bd9Sstevel@tonic-gate return (1);
3287c478bd9Sstevel@tonic-gate }
3297c478bd9Sstevel@tonic-gate output_file_open = TRUE;
3307c478bd9Sstevel@tonic-gate }
3317c478bd9Sstevel@tonic-gate if (putwc(wc, out_file) == WEOF) {
3327c478bd9Sstevel@tonic-gate (void) perror("split");
3337c478bd9Sstevel@tonic-gate if (output_file_open == TRUE)
3347c478bd9Sstevel@tonic-gate (void) fclose(out_file);
3357c478bd9Sstevel@tonic-gate free(fname);
3367c478bd9Sstevel@tonic-gate return (1);
3377c478bd9Sstevel@tonic-gate }
3387c478bd9Sstevel@tonic-gate } while (wc != '\n');
3397c478bd9Sstevel@tonic-gate }
3407c478bd9Sstevel@tonic-gate }
3417c478bd9Sstevel@tonic-gate if (output_file_open == TRUE)
3427c478bd9Sstevel@tonic-gate (void) fclose(out_file);
3437c478bd9Sstevel@tonic-gate }
3447c478bd9Sstevel@tonic-gate
3457c478bd9Sstevel@tonic-gate /*NOTREACHED*/
3467c478bd9Sstevel@tonic-gate }
3477c478bd9Sstevel@tonic-gate
3487c478bd9Sstevel@tonic-gate
3497c478bd9Sstevel@tonic-gate static void
next_file_name(char * name)3507c478bd9Sstevel@tonic-gate next_file_name(char *name)
3517c478bd9Sstevel@tonic-gate {
3527c478bd9Sstevel@tonic-gate int i;
3537c478bd9Sstevel@tonic-gate
3547c478bd9Sstevel@tonic-gate i = strlen(name) - 1;
3557c478bd9Sstevel@tonic-gate
3567c478bd9Sstevel@tonic-gate while (i >= (int)(strlen(name) - suffix_length)) {
3577c478bd9Sstevel@tonic-gate if (++name[i] <= 'z')
3587c478bd9Sstevel@tonic-gate return;
3597c478bd9Sstevel@tonic-gate name[i--] = 'a';
3607c478bd9Sstevel@tonic-gate }
3617c478bd9Sstevel@tonic-gate (void) fprintf(stderr, gettext(
3627c478bd9Sstevel@tonic-gate "%s: Exhausted output file names, aborting split\n"),
3637c478bd9Sstevel@tonic-gate progname);
3647c478bd9Sstevel@tonic-gate exit(1);
3657c478bd9Sstevel@tonic-gate }
3667c478bd9Sstevel@tonic-gate
3677c478bd9Sstevel@tonic-gate
3687c478bd9Sstevel@tonic-gate static void
Usage()3697c478bd9Sstevel@tonic-gate Usage()
3707c478bd9Sstevel@tonic-gate {
3717c478bd9Sstevel@tonic-gate (void) fprintf(stderr, gettext(
3727c478bd9Sstevel@tonic-gate "Usage: %s [-l #] [-a #] [file [name]]\n"
3737c478bd9Sstevel@tonic-gate " %s [-b #[k|m]] [-a #] [file [name]]\n"
3747c478bd9Sstevel@tonic-gate " %s [-#] [-a #] [file [name]]\n"),
3757c478bd9Sstevel@tonic-gate progname, progname, progname);
3767c478bd9Sstevel@tonic-gate exit(1);
3777c478bd9Sstevel@tonic-gate }
378