eval.c (201366) | eval.c (201431) |
---|---|
1/*- 2 * Copyright (c) 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 --- 22 unchanged lines hidden (view full) --- 31 */ 32 33#ifndef lint 34#if 0 35static char sccsid[] = "@(#)eval.c 8.9 (Berkeley) 6/8/95"; 36#endif 37#endif /* not lint */ 38#include <sys/cdefs.h> | 1/*- 2 * Copyright (c) 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 --- 22 unchanged lines hidden (view full) --- 31 */ 32 33#ifndef lint 34#if 0 35static char sccsid[] = "@(#)eval.c 8.9 (Berkeley) 6/8/95"; 36#endif 37#endif /* not lint */ 38#include <sys/cdefs.h> |
39__FBSDID("$FreeBSD: head/bin/sh/eval.c 201366 2010-01-01 18:17:46Z jilles $"); | 39__FBSDID("$FreeBSD: head/bin/sh/eval.c 201431 2010-01-03 15:01:38Z jilles $"); |
40 41#include <paths.h> 42#include <signal.h> 43#include <stdlib.h> 44#include <unistd.h> 45#include <sys/resource.h> 46#include <sys/wait.h> /* For WIFSIGNALED(status) */ 47#include <errno.h> --- 669 unchanged lines hidden (view full) --- 717 /* implement the bltin builtin here */ 718 if (cmdentry.cmdtype == CMDBUILTIN && cmdentry.u.index == BLTINCMD) { 719 for (;;) { 720 argv++; 721 if (--argc == 0) 722 break; 723 if ((cmdentry.u.index = find_builtin(*argv, 724 &cmdentry.special)) < 0) { | 40 41#include <paths.h> 42#include <signal.h> 43#include <stdlib.h> 44#include <unistd.h> 45#include <sys/resource.h> 46#include <sys/wait.h> /* For WIFSIGNALED(status) */ 47#include <errno.h> --- 669 unchanged lines hidden (view full) --- 717 /* implement the bltin builtin here */ 718 if (cmdentry.cmdtype == CMDBUILTIN && cmdentry.u.index == BLTINCMD) { 719 for (;;) { 720 argv++; 721 if (--argc == 0) 722 break; 723 if ((cmdentry.u.index = find_builtin(*argv, 724 &cmdentry.special)) < 0) { |
725 out2fmt_flush("%s: not found\n", *argv); 726 exitstatus = 127; 727 return; | 725 cmdentry.u.index = BLTINCMD; 726 argv--; 727 argc++; 728 break; |
728 } 729 if (cmdentry.u.index != BLTINCMD) 730 break; 731 } 732 } 733 } 734 735 /* Fork off a child process if necessary. */ --- 203 unchanged lines hidden (view full) --- 939 940 941/* 942 * Builtin commands. Builtin commands whose functions are closely 943 * tied to evaluation are implemented here. 944 */ 945 946/* | 729 } 730 if (cmdentry.u.index != BLTINCMD) 731 break; 732 } 733 } 734 } 735 736 /* Fork off a child process if necessary. */ --- 203 unchanged lines hidden (view full) --- 940 941 942/* 943 * Builtin commands. Builtin commands whose functions are closely 944 * tied to evaluation are implemented here. 945 */ 946 947/* |
947 * No command given, or a bltin command with no arguments. | 948 * No command given, a bltin command with no arguments, or a bltin command 949 * with an invalid name. |
948 */ 949 950int | 950 */ 951 952int |
951bltincmd(int argc __unused, char **argv __unused) | 953bltincmd(int argc, char **argv) |
952{ | 954{ |
955 if (argc > 1) { 956 out2fmt_flush("%s: not found\n", argv[1]); 957 return 127; 958 } |
|
953 /* 954 * Preserve exitstatus of a previous possible redirection 955 * as POSIX mandates 956 */ 957 return exitstatus; 958} 959 960 --- 163 unchanged lines hidden --- | 959 /* 960 * Preserve exitstatus of a previous possible redirection 961 * as POSIX mandates 962 */ 963 return exitstatus; 964} 965 966 --- 163 unchanged lines hidden --- |