mirror of
https://https.git.savannah.gnu.org/git/bash.git
synced 2026-07-11 14:10:49 +02:00
commit bash-20150731 snapshot
This commit is contained in:
@@ -27,12 +27,22 @@ infodir = @infodir@
|
||||
includedir = @includedir@
|
||||
|
||||
datarootdir = @datarootdir@
|
||||
loadablesdir = ${libdir}/bash
|
||||
|
||||
topdir = @top_srcdir@
|
||||
BUILD_DIR = @BUILD_DIR@
|
||||
srcdir = @srcdir@
|
||||
VPATH = @srcdir@
|
||||
|
||||
# Support an alternate destination root directory for package building
|
||||
DESTDIR =
|
||||
|
||||
INSTALL = @INSTALL@
|
||||
INSTALL_PROGRAM = @INSTALL_PROGRAM@
|
||||
INSTALL_SCRIPT = @INSTALL_SCRIPT@
|
||||
INSTALL_DATA = @INSTALL_DATA@
|
||||
INSTALLMODE= -m 0755
|
||||
|
||||
@SET_MAKE@
|
||||
CC = @CC@
|
||||
RM = rm -f
|
||||
@@ -52,6 +62,8 @@ CPPFLAGS = @CPPFLAGS@
|
||||
|
||||
BASHINCDIR = ${topdir}/include
|
||||
|
||||
SUPPORT_SRC = $(topdir)/support/
|
||||
|
||||
LIBBUILD = ${BUILD_DIR}/lib
|
||||
|
||||
INTL_LIBSRC = ${topdir}/lib/intl
|
||||
@@ -75,7 +87,7 @@ SHOBJ_XLDFLAGS = @SHOBJ_XLDFLAGS@
|
||||
SHOBJ_LIBS = @SHOBJ_LIBS@
|
||||
SHOBJ_STATUS = @SHOBJ_STATUS@
|
||||
|
||||
INC = -I. -I.. -I$(topdir) -I$(topdir)/lib -I$(topdir)/builtins \
|
||||
INC = -I. -I.. -I$(topdir) -I$(topdir)/lib -I$(topdir)/builtins -I${srcdir} \
|
||||
-I$(BASHINCDIR) -I$(BUILD_DIR) -I$(LIBBUILD) \
|
||||
-I$(BUILD_DIR)/builtins $(INTL_INC)
|
||||
|
||||
@@ -83,10 +95,10 @@ INC = -I. -I.. -I$(topdir) -I$(topdir)/lib -I$(topdir)/builtins \
|
||||
$(SHOBJ_CC) $(SHOBJ_CFLAGS) $(CCFLAGS) $(INC) -c -o $@ $<
|
||||
|
||||
|
||||
ALLPROG = print truefalse sleep pushd finfo logname basename dirname \
|
||||
ALLPROG = print truefalse sleep finfo logname basename dirname \
|
||||
tty pathchk tee head mkdir rmdir printenv id whoami \
|
||||
uname sync push ln unlink realpath strftime mypid
|
||||
OTHERPROG = necho hello cat
|
||||
OTHERPROG = necho hello cat pushd
|
||||
|
||||
all: $(SHOBJ_STATUS)
|
||||
|
||||
@@ -210,6 +222,17 @@ distclean maintainer-clean: clean
|
||||
$(RM) Makefile pushd.c
|
||||
-( cd perl && ${MAKE} ${MFLAGS} $@ )
|
||||
|
||||
installdirs:
|
||||
@${SHELL} $(SUPPORT_SRC)mkinstalldirs $(DESTDIR)$(loadablesdir)
|
||||
|
||||
install: all installdirs
|
||||
@echo installing example loadable builtins in $(DESTDIR)${loadablesdir}
|
||||
@for prog in ${ALLPROG}; do \
|
||||
echo $$prog ; \
|
||||
$(INSTALL_PROGRAM) $(INSTALLMODE) $$prog $(DESTDIR)$(loadablesdir)/$$prog ;\
|
||||
done
|
||||
|
||||
|
||||
print.o: print.c
|
||||
truefalse.o: truefalse.c
|
||||
sleep.o: sleep.c
|
||||
|
||||
@@ -31,6 +31,7 @@
|
||||
#include "shell.h"
|
||||
#include "common.h"
|
||||
|
||||
int
|
||||
basename_builtin (list)
|
||||
WORD_LIST *list;
|
||||
{
|
||||
|
||||
@@ -31,6 +31,7 @@
|
||||
#include "shell.h"
|
||||
#include "common.h"
|
||||
|
||||
int
|
||||
dirname_builtin (list)
|
||||
WORD_LIST *list;
|
||||
{
|
||||
|
||||
@@ -39,6 +39,7 @@
|
||||
#include "shell.h"
|
||||
#include "builtins.h"
|
||||
#include "common.h"
|
||||
#include "getopt.h"
|
||||
|
||||
#ifndef errno
|
||||
extern int errno;
|
||||
@@ -46,8 +47,10 @@ extern int errno;
|
||||
|
||||
extern char **make_builtin_argv ();
|
||||
|
||||
static void perms();
|
||||
static int printst();
|
||||
static int printsome();
|
||||
static void printmode();
|
||||
static int printfinfo();
|
||||
static int finfo_main();
|
||||
|
||||
@@ -192,7 +195,7 @@ int m;
|
||||
return (m & (S_IRWXU|S_IRWXG|S_IRWXO|S_ISUID|S_ISGID));
|
||||
}
|
||||
|
||||
static int
|
||||
static void
|
||||
perms(m)
|
||||
int m;
|
||||
{
|
||||
@@ -236,7 +239,7 @@ int m;
|
||||
printf ("u=%s,g=%s,o=%s", ubits, gbits, obits);
|
||||
}
|
||||
|
||||
static int
|
||||
static void
|
||||
printmode(mode)
|
||||
int mode;
|
||||
{
|
||||
@@ -262,7 +265,7 @@ int mode;
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
static int
|
||||
static int
|
||||
printst(st)
|
||||
struct stat *st;
|
||||
{
|
||||
|
||||
@@ -88,8 +88,10 @@ file_head (fp, cnt)
|
||||
break;
|
||||
}
|
||||
}
|
||||
return (EXECUTION_SUCCESS);
|
||||
}
|
||||
|
||||
int
|
||||
head_builtin (list)
|
||||
WORD_LIST *list;
|
||||
{
|
||||
|
||||
@@ -29,9 +29,7 @@
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include "builtins.h"
|
||||
#include "shell.h"
|
||||
#include "bashgetopt.h"
|
||||
#include "loadables.h"
|
||||
|
||||
/* A builtin `xxx' is normally implemented with an `xxx_builtin' function.
|
||||
If you're converting a command that uses the normal Unix argc/argv
|
||||
|
||||
@@ -50,6 +50,7 @@ typedef int unix_link_syscall_t __P((const char *, const char *));
|
||||
static unix_link_syscall_t *linkfn;
|
||||
static int dolink ();
|
||||
|
||||
int
|
||||
ln_builtin (list)
|
||||
WORD_LIST *list;
|
||||
{
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
/* loadables.h -- Include files needed by all loadable builtins */
|
||||
|
||||
/* Copyright (C) 2015 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Bash, the Bourne Again SHell.
|
||||
|
||||
Bash is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
Bash is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Bash. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef __LOADABLES_H_
|
||||
#define __LOADABLES_H_
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include "builtins.h"
|
||||
#include "shell.h"
|
||||
#include "bashgetopt.h"
|
||||
#include "common.h"
|
||||
|
||||
#endif
|
||||
@@ -35,6 +35,7 @@
|
||||
extern int errno;
|
||||
#endif
|
||||
|
||||
int
|
||||
logname_builtin (list)
|
||||
WORD_LIST *list;
|
||||
{
|
||||
|
||||
@@ -98,6 +98,7 @@ extern char *strerror ();
|
||||
|
||||
static int validate_path ();
|
||||
|
||||
int
|
||||
pathchk_builtin (list)
|
||||
WORD_LIST *list;
|
||||
{
|
||||
@@ -323,7 +324,7 @@ validate_path (path, portability)
|
||||
if (!last_elem)
|
||||
{
|
||||
exists = dir_ok (path);
|
||||
if (dir_ok == 0)
|
||||
if (exists == 0)
|
||||
{
|
||||
free (parent);
|
||||
return 1;
|
||||
@@ -370,8 +371,8 @@ validate_path (path, portability)
|
||||
free (parent);
|
||||
if (strlen (path) > path_max)
|
||||
{
|
||||
builtin_error ("path `%s' has length %d; exceeds limit of %d",
|
||||
path, strlen (path), path_max);
|
||||
builtin_error ("path `%s' has length %lu; exceeds limit of %d",
|
||||
path, (unsigned long)strlen (path), path_max);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
@@ -60,6 +60,7 @@ extern int errno;
|
||||
|
||||
extern char *sh_realpath();
|
||||
|
||||
int
|
||||
realpath_builtin(list)
|
||||
WORD_LIST *list;
|
||||
{
|
||||
|
||||
@@ -32,6 +32,7 @@
|
||||
extern int errno;
|
||||
#endif
|
||||
|
||||
int
|
||||
rmdir_builtin (list)
|
||||
WORD_LIST *list;
|
||||
{
|
||||
|
||||
@@ -28,6 +28,7 @@
|
||||
#include "shell.h"
|
||||
#include "bashgetopt.h"
|
||||
|
||||
int
|
||||
sync_builtin (list)
|
||||
WORD_LIST *list;
|
||||
{
|
||||
|
||||
@@ -60,6 +60,7 @@ extern int interrupt_immediately;
|
||||
|
||||
extern char *strerror ();
|
||||
|
||||
int
|
||||
tee_builtin (list)
|
||||
WORD_LIST *list;
|
||||
{
|
||||
|
||||
@@ -11,9 +11,7 @@
|
||||
#include <stdio.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include "builtins.h"
|
||||
#include "shell.h"
|
||||
#include "bashgetopt.h"
|
||||
#include "loadables.h"
|
||||
|
||||
#if !defined (errno)
|
||||
extern int errno;
|
||||
@@ -21,6 +19,7 @@ extern int errno;
|
||||
|
||||
extern char *strerror ();
|
||||
|
||||
int
|
||||
template_builtin (list)
|
||||
WORD_LIST *list;
|
||||
{
|
||||
|
||||
@@ -25,12 +25,14 @@
|
||||
#include "builtins.h"
|
||||
#include "common.h"
|
||||
|
||||
int
|
||||
true_builtin (list)
|
||||
WORD_LIST *list;
|
||||
{
|
||||
return EXECUTION_SUCCESS;
|
||||
}
|
||||
|
||||
int
|
||||
false_builtin (list)
|
||||
WORD_LIST *list;
|
||||
{
|
||||
|
||||
@@ -30,6 +30,7 @@
|
||||
|
||||
extern char *ttyname ();
|
||||
|
||||
int
|
||||
tty_builtin (list)
|
||||
WORD_LIST *list;
|
||||
{
|
||||
|
||||
@@ -63,6 +63,7 @@ static void uprint();
|
||||
|
||||
static int uname_flags;
|
||||
|
||||
int
|
||||
uname_builtin (list)
|
||||
WORD_LIST *list;
|
||||
{
|
||||
|
||||
@@ -38,6 +38,7 @@
|
||||
extern int errno;
|
||||
#endif
|
||||
|
||||
int
|
||||
unlink_builtin (list)
|
||||
WORD_LIST *list;
|
||||
{
|
||||
|
||||
@@ -28,6 +28,7 @@
|
||||
#include "bashgetopt.h"
|
||||
#include "common.h"
|
||||
|
||||
int
|
||||
whoami_builtin (list)
|
||||
WORD_LIST *list;
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user