Deleted Added
full compact
fmt.c (36049) fmt.c (37027)
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

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

31 * SUCH DAMAGE.
32 */
33
34#ifndef lint
35#if 0
36static char sccsid[] = "@(#)fmt.c 8.4 (Berkeley) 4/15/94";
37#endif
38static const char rcsid[] =
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

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

31 * SUCH DAMAGE.
32 */
33
34#ifndef lint
35#if 0
36static char sccsid[] = "@(#)fmt.c 8.4 (Berkeley) 4/15/94";
37#endif
38static const char rcsid[] =
39 "$Id$";
39 "$Id: fmt.c,v 1.11 1998/05/15 06:29:15 charnier Exp $";
40#endif /* not lint */
41
42#include <sys/param.h>
43#include <sys/syslimits.h>
44#include <sys/time.h>
45#include <sys/resource.h>
46#include <stdio.h>
47#include <stdlib.h>
48#include <string.h>
40#endif /* not lint */
41
42#include <sys/param.h>
43#include <sys/syslimits.h>
44#include <sys/time.h>
45#include <sys/resource.h>
46#include <stdio.h>
47#include <stdlib.h>
48#include <string.h>
49#include <unistd.h>
49#include <vis.h>
50#include "ps.h"
51
52static char *cmdpart __P((char *));
53static char *shquote __P((char **));
54
55/*
56 * XXX
57 * This is a stub until marc does the real one.
58 */
59static char *
60shquote(argv)
61 char **argv;
62{
50#include <vis.h>
51#include "ps.h"
52
53static char *cmdpart __P((char *));
54static char *shquote __P((char **));
55
56/*
57 * XXX
58 * This is a stub until marc does the real one.
59 */
60static char *
61shquote(argv)
62 char **argv;
63{
64 long arg_max;
63 char **p, *dst, *src;
65 char **p, *dst, *src;
64 static char buf[4*ARG_MAX]; /* XXX */
66 static char *buf = NULL;
65
67
68 if (buf == NULL) {
69 if ((arg_max = sysconf(_SC_ARG_MAX)) == -1)
70 errx(1, "sysconf _SC_ARG_MAX failed");
71 if ((buf = malloc((4 * arg_max) + 1)) == NULL)
72 errx(1, "malloc failed");
73 }
74
66 if (*argv == 0) {
67 buf[0] = 0;
68 return (buf);
69 }
70 dst = buf;
71 for (p = argv; (src = *p++) != 0; ) {
72 if (*src == 0)
73 continue;

--- 49 unchanged lines hidden ---
75 if (*argv == 0) {
76 buf[0] = 0;
77 return (buf);
78 }
79 dst = buf;
80 for (p = argv; (src = *p++) != 0; ) {
81 if (*src == 0)
82 continue;

--- 49 unchanged lines hidden ---