Deleted Added
full compact
fmt.c (4347) fmt.c (6971)
1/*-
2 * Copyright (c) 1992, 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

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

25 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31 * SUCH DAMAGE.
32 *
1/*-
2 * Copyright (c) 1992, 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

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

25 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31 * SUCH DAMAGE.
32 *
33 * $Id: fmt.c,v 1.3 1994/09/24 02:56:43 davidg Exp $
33 * $Id: fmt.c,v 1.4 1994/11/10 23:25:12 ats Exp $
34 */
35
36#ifndef lint
37static char sccsid[] = "@(#)fmt.c 8.4 (Berkeley) 4/15/94";
38#endif /* not lint */
39
40#include <sys/param.h>
41#include <sys/syslimits.h>

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

70 for (p = argv; (src = *p++) != 0; ) {
71 if (*src == 0)
72 continue;
73 strvis(dst, src, VIS_NL | VIS_CSTYLE);
74 while (*dst)
75 dst++;
76 *dst++ = ' ';
77 }
34 */
35
36#ifndef lint
37static char sccsid[] = "@(#)fmt.c 8.4 (Berkeley) 4/15/94";
38#endif /* not lint */
39
40#include <sys/param.h>
41#include <sys/syslimits.h>

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

70 for (p = argv; (src = *p++) != 0; ) {
71 if (*src == 0)
72 continue;
73 strvis(dst, src, VIS_NL | VIS_CSTYLE);
74 while (*dst)
75 dst++;
76 *dst++ = ' ';
77 }
78 /* Chop off trailing space */
79 if (dst != buf)
80 dst--;
78 *dst = '\0';
79 return (buf);
80}
81
82static char *
83cmdpart(arg0)
84 char *arg0;
85{

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

104 len = maxlen + 3;
105 } else {
106 ap = shquote(argv);
107 len = strlen(ap) + maxlen + 4;
108 }
109 if ((cp = malloc(len)) == NULL)
110 return (NULL);
111 if (ap == NULL)
81 *dst = '\0';
82 return (buf);
83}
84
85static char *
86cmdpart(arg0)
87 char *arg0;
88{

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

107 len = maxlen + 3;
108 } else {
109 ap = shquote(argv);
110 len = strlen(ap) + maxlen + 4;
111 }
112 if ((cp = malloc(len)) == NULL)
113 return (NULL);
114 if (ap == NULL)
112 sprintf(cp, "(%.*s)", maxlen, cmd);
115 sprintf(cp, " (%.*s)", maxlen, cmd);
113 else if (strncmp(cmdpart(argv[0]), cmd, maxlen) != 0)
116 else if (strncmp(cmdpart(argv[0]), cmd, maxlen) != 0)
114 sprintf(cp, "%s(%.*s)", ap, maxlen, cmd);
117 sprintf(cp, "%s (%.*s)", ap, maxlen, cmd);
115 else
116 (void) strcpy(cp, ap);
117 return (cp);
118}
118 else
119 (void) strcpy(cp, ap);
120 return (cp);
121}