Deleted Added
sdiff udiff text old ( 43625 ) new ( 68887 )
full compact
1/*
2 * Copyright (c) 1987, 1993, 1994
3 * The Regents of the University of California. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 26 unchanged lines hidden (view full) ---

35static const char copyright[] =
36"@(#) Copyright (c) 1987, 1993, 1994\n\
37 The Regents of the University of California. All rights reserved.\n";
38#endif /* not lint */
39
40#ifndef lint
41#if 0
42static char sccsid[] = "@(#)split.c 8.2 (Berkeley) 4/16/94";
43#endif
44#endif /* not lint */
45
46#include <sys/param.h>
47#include <sys/types.h>
48
49#include <ctype.h>
50#include <err.h>
51#include <fcntl.h>
52#include <stdio.h>
53#include <stdlib.h>
54#include <string.h>
55#include <unistd.h>
56#include <regex.h>
57#include <sysexits.h>
58
59#define DEFLINE 1000 /* Default num lines per file. */
60
61long bytecnt; /* Byte count to split on. */
62long numlines; /* Line count to split on. */
63int file_open; /* If a file open. */
64int ifd = -1, ofd = -1; /* Input/output file descriptors. */
65char bfr[MAXBSIZE]; /* I/O buffer. */
66char fname[MAXPATHLEN]; /* File name prefix. */
67regex_t rgx;
68int pflag;
69

--- 31 unchanged lines hidden (view full) ---

101 }
102 break;
103 case '-': /* Undocumented: historic stdin flag. */
104 if (ifd != -1)
105 usage();
106 ifd = 0;
107 break;
108 case 'b': /* Byte count. */
109 if ((bytecnt = strtol(optarg, &ep, 10)) <= 0 ||
110 (*ep != '\0' && *ep != 'k' && *ep != 'm'))
111 errx(EX_USAGE,
112 "%s: illegal byte count", optarg);
113 if (*ep == 'k')
114 bytecnt *= 1024;
115 else if (*ep == 'm')
116 bytecnt *= 1048576;
117 break;

--- 49 unchanged lines hidden (view full) ---

167
168/*
169 * split1 --
170 * Split the input by bytes.
171 */
172void
173split1()
174{
175 long bcnt;
176 int dist, len;
177 char *C;
178
179 for (bcnt = 0;;)
180 switch ((len = read(ifd, bfr, MAXBSIZE))) {
181 case 0:
182 exit(0);
183 case -1:
184 err(EX_IOERR, "read");

--- 131 unchanged lines hidden ---