Deleted Added
full compact
expand.c (104672) expand.c (108286)
1/*-
2 * Copyright (c) 1991, 1993
3 * The Regents of the University of California. All rights reserved.
4 *
5 * This code is derived from software contributed to Berkeley by
6 * Kenneth Almquist.
7 *
8 * Redistribution and use in source and binary forms, with or without

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

35 */
36
37#ifndef lint
38#if 0
39static char sccsid[] = "@(#)expand.c 8.5 (Berkeley) 5/15/95";
40#endif
41#endif /* not lint */
42#include <sys/cdefs.h>
1/*-
2 * Copyright (c) 1991, 1993
3 * The Regents of the University of California. All rights reserved.
4 *
5 * This code is derived from software contributed to Berkeley by
6 * Kenneth Almquist.
7 *
8 * Redistribution and use in source and binary forms, with or without

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

35 */
36
37#ifndef lint
38#if 0
39static char sccsid[] = "@(#)expand.c 8.5 (Berkeley) 5/15/95";
40#endif
41#endif /* not lint */
42#include <sys/cdefs.h>
43__FBSDID("$FreeBSD: head/bin/sh/expand.c 104672 2002-10-08 11:22:49Z tjr $");
43__FBSDID("$FreeBSD: head/bin/sh/expand.c 108286 2002-12-26 14:28:54Z tjr $");
44
45#include <sys/types.h>
46#include <sys/time.h>
47#include <sys/stat.h>
48#include <errno.h>
49#include <dirent.h>
50#include <unistd.h>
51#include <pwd.h>
52#include <stdlib.h>
53#include <limits.h>
54#include <stdio.h>
44
45#include <sys/types.h>
46#include <sys/time.h>
47#include <sys/stat.h>
48#include <errno.h>
49#include <dirent.h>
50#include <unistd.h>
51#include <pwd.h>
52#include <stdlib.h>
53#include <limits.h>
54#include <stdio.h>
55#include <string.h>
55
56/*
57 * Routines to expand arguments to commands. We have to deal with
58 * backquotes, shell variables, and file metacharacters.
59 */
60
61#include "shell.h"
62#include "main.h"

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

1516
1517 if (neg)
1518 *--p = '-';
1519
1520 while (*p)
1521 STPUTC(*p++, buf);
1522 return buf;
1523}
56
57/*
58 * Routines to expand arguments to commands. We have to deal with
59 * backquotes, shell variables, and file metacharacters.
60 */
61
62#include "shell.h"
63#include "main.h"

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

1517
1518 if (neg)
1519 *--p = '-';
1520
1521 while (*p)
1522 STPUTC(*p++, buf);
1523 return buf;
1524}
1525
1526/*
1527 * Do most of the work for wordexp(3).
1528 */
1529
1530int
1531wordexpcmd(int argc, char **argv)
1532{
1533 size_t len;
1534 int i;
1535
1536 out1fmt("%08x", argc - 1);
1537 for (i = 1, len = 0; i < argc; i++)
1538 len += strlen(argv[i]);
1539 out1fmt("%08x", (int)len);
1540 for (i = 1; i < argc; i++) {
1541 out1str(argv[i]);
1542 out1c('\0');
1543 }
1544 return (0);
1545}