Skip to content

Commit

Permalink
Merge /bin/sh from current with cbsdsh; DHCP argument support for jco…
Browse files Browse the repository at this point in the history
…nfig; imgpart: switch compress method to xz(1), with thread support; Execute with lower prio; Populate basedir via filelist: WIP; zfs_snapsrc options for ZFS-based system in [jbx]create; Update DFLYBSD to 4.4; imghelper: show available modules for specified jail; add sharedfs flags; fixes zfs/hammer feat variable;
  • Loading branch information
olevole committed Jan 13, 2016
1 parent 7bb54bc commit 9a92c71
Show file tree
Hide file tree
Showing 102 changed files with 2,978 additions and 3,429 deletions.
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright (c) 2014,2015 Oleg Ginzburg
Copyright (c) 2014,2015,2016 Oleg Ginzburg
All rights reserved.

Redistribution and use in source and binary forms, with or without modification,
Expand Down
1 change: 1 addition & 0 deletions ObsoleteFiles
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,5 @@ etc/defaults/vm-freebsd-FreeBSD-x64-10.0.conf
etc/defaults/vm-freebsd-FreeBSD-i386-10.0.conf
etc/defaults/vm-other-maversics.conf
etc/defaults/vm-linux-ArchLinux-x86-2015.09.01.conf
etc/defaults/vm-dflybsd-x86-4.2.conf
"
5 changes: 1 addition & 4 deletions README.DragonflyBSD
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
To get CBSD work in DFLYBSD platform, you need to install extra packages:

pkg install sysrc
pkg install libelf
pkg install libxo
% pkg ins sysrc libelf libxo

Also please get next files from the bsdconfig distribution:

Expand All @@ -13,4 +11,3 @@ Also please get next files from the bsdconfig distribution:
/usr/share/bsdconfig/strings.subr
/usr/share/bsdconfig/struct.subr
/usr/share/bsdconfig/variable.subr

10 changes: 5 additions & 5 deletions bin/cbsdsh/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ INSTALLFLAGS= -S -m 500
SHSRCS= about.c alias.c arith_yacc.c arith_yylex.c cbsdhistory.c cbsd_fwatch.c cbsd_pwait.c cd.c echo.c \
error.c eval.c exec.c expand.c histedit.c input.c jobs.c kill.c main.c memalloc.c miscbltin.c \
mystring.c options.c output.c parser.c printf.c redir.c show.c sqlcmd.c spawn_task.c \
test.c trap.c var.c
test.c trap.c var.c jail.c

# WITH_LUA
#SHSRCS+= cbsdlua.c
Expand All @@ -20,9 +20,9 @@ WITHOUT_MAN= yes
NOMAN= yes

DPADD= ${LIBEDIT} ${LIBTERMCAP}
LDADD= -ledit -ltermcap -lsqlite3 -pthread
LDADD= -ledit -ltermcap -lsqlite3 -pthread -ljail

CFLAGS+=-DSHELL -I. -I${.CURDIR} -DCBSD -I/usr/local/include -L/usr/local/lib
CFLAGS+=-DSHELL -I. -I${.CURDIR} -DCBSD -I/usr/local/include -L/usr/lib -L/usr/local/lib

# WITH LUA
#CFLAGS+=-I/usr/local/include/lua52 -l lua-5.2 -DLUA
Expand Down Expand Up @@ -54,8 +54,8 @@ mknodes: mknodes.o
mksyntax: mksyntax.o

.ORDER: nodes.c nodes.h
nodes.c nodes.h: mknodes nodetypes-cbsd nodes.c.pat
./mknodes ${.CURDIR}/nodetypes-cbsd ${.CURDIR}/nodes.c.pat
nodes.c nodes.h: mknodes nodetypes nodes.c.pat
./mknodes ${.CURDIR}/nodetypes ${.CURDIR}/nodes.c.pat

.ORDER: syntax.c syntax.h
syntax.c syntax.h: mksyntax
Expand Down
2 changes: 1 addition & 1 deletion bin/cbsdsh/about.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// For identification of correct CBSD shell only
#include "output.h"

#define VERSION "10.2.1a"
#define VERSION "10.2.1c"

int
aboutcmd(int argc, char **argv)
Expand Down
55 changes: 8 additions & 47 deletions bin/cbsdsh/alias.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ static char sccsid[] = "@(#)alias.c 8.3 (Berkeley) 5/4/95";
#endif
#endif /* not lint */
#include <sys/cdefs.h>
__FBSDID("$FreeBSD: head/bin/sh/alias.c 254849 2013-08-25 11:42:53Z jilles $");
__FBSDID("$FreeBSD: head/bin/sh/alias.c 284779 2015-06-24 20:51:48Z jilles $");

#include <stdlib.h>
#include "shell.h"
Expand Down Expand Up @@ -68,18 +68,7 @@ setalias(const char *name, const char *val)
if (equal(name, ap->name)) {
INTOFF;
ckfree(ap->val);
/* See HACK below. */
#ifdef notyet
ap->val = savestr(val);
#else
{
size_t len = strlen(val);
ap->val = ckmalloc(len + 2);
memcpy(ap->val, val, len);
ap->val[len] = ' ';
ap->val[len+1] = '\0';
}
#endif
INTON;
return;
}
Expand All @@ -88,34 +77,7 @@ setalias(const char *name, const char *val)
INTOFF;
ap = ckmalloc(sizeof (struct alias));
ap->name = savestr(name);
/*
* XXX - HACK: in order that the parser will not finish reading the
* alias value off the input before processing the next alias, we
* dummy up an extra space at the end of the alias. This is a crock
* and should be re-thought. The idea (if you feel inclined to help)
* is to avoid alias recursions. The mechanism used is: when
* expanding an alias, the value of the alias is pushed back on the
* input as a string and a pointer to the alias is stored with the
* string. The alias is marked as being in use. When the input
* routine finishes reading the string, it marks the alias not
* in use. The problem is synchronization with the parser. Since
* it reads ahead, the alias is marked not in use before the
* resulting token(s) is next checked for further alias sub. The
* H A C K is that we add a little fluff after the alias value
* so that the string will not be exhausted. This is a good
* idea ------- ***NOT***
*/
#ifdef notyet
ap->val = savestr(val);
#else /* hack */
{
size_t len = strlen(val);
ap->val = ckmalloc(len + 2);
memcpy(ap->val, val, len);
ap->val[len] = ' '; /* fluff */
ap->val[len+1] = '\0';
}
#endif
ap->flag = 0;
ap->next = *app;
*app = ap;
Expand Down Expand Up @@ -207,14 +169,8 @@ comparealiases(const void *p1, const void *p2)
static void
printalias(const struct alias *a)
{
char *p;

out1fmt("%s=", a->name);
/* Don't print the space added above. */
p = a->val + strlen(a->val) - 1;
*p = '\0';
out1qstr(a->val);
*p = ' ';
out1c('\n');
}

Expand All @@ -224,16 +180,21 @@ printaliases(void)
int i, j;
struct alias **sorted, *ap;

INTOFF;
sorted = ckmalloc(aliases * sizeof(*sorted));
j = 0;
for (i = 0; i < ATABSIZE; i++)
for (ap = atab[i]; ap; ap = ap->next)
if (*ap->name != '\0')
sorted[j++] = ap;
qsort(sorted, aliases, sizeof(*sorted), comparealiases);
for (i = 0; i < aliases; i++)
for (i = 0; i < aliases; i++) {
printalias(sorted[i]);
if (int_pending())
break;
}
ckfree(sorted);
INTON;
}

int
Expand Down Expand Up @@ -287,7 +248,7 @@ hashalias(const char *p)
{
unsigned int hashval;

hashval = *p << 4;
hashval = (unsigned char)*p << 4;
while (*p)
hashval+= *p++;
return &atab[hashval % ATABSIZE];
Expand Down
6 changes: 3 additions & 3 deletions bin/cbsdsh/arith_yacc.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
*/

#include <sys/cdefs.h>
__FBSDID("$FreeBSD: head/bin/sh/arith_yacc.c 230530 2012-01-25 08:42:19Z charnier $");
__FBSDID("$FreeBSD: head/bin/sh/arith_yacc.c 270246 2014-08-20 20:15:43Z jilles $");

#include <limits.h>
#include <errno.h>
Expand Down Expand Up @@ -139,9 +139,9 @@ static arith_t do_binop(int op, arith_t a, arith_t b)
case ARITH_SUB:
return (uintmax_t)a - (uintmax_t)b;
case ARITH_LSHIFT:
return a << b;
return (uintmax_t)a << (b & (sizeof(uintmax_t) * CHAR_BIT - 1));
case ARITH_RSHIFT:
return a >> b;
return a >> (b & (sizeof(uintmax_t) * CHAR_BIT - 1));
case ARITH_LT:
return a < b;
case ARITH_LE:
Expand Down
4 changes: 3 additions & 1 deletion bin/cbsdsh/arith_yacc.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $FreeBSD: head/bin/sh/arith_yacc.h 218466 2011-02-08 23:18:06Z jilles $
* $FreeBSD: head/bin/sh/arith_yacc.h 279503 2015-03-01 21:46:55Z jilles $
*/

#define ARITH_ASS 1
Expand Down Expand Up @@ -81,6 +81,8 @@
#define ARITH_QMARK 37
#define ARITH_COLON 38

extern const char *arith_buf;

union yystype {
arith_t val;
char *name;
Expand Down
4 changes: 1 addition & 3 deletions bin/cbsdsh/arith_yylex.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
*/

#include <sys/cdefs.h>
__FBSDID("$FreeBSD: head/bin/sh/arith_yylex.c 254806 2013-08-24 20:06:00Z jilles $");
__FBSDID("$FreeBSD: head/bin/sh/arith_yylex.c 279503 2015-03-01 21:46:55Z jilles $");

#include <inttypes.h>
#include <stdlib.h>
Expand All @@ -50,8 +50,6 @@ __FBSDID("$FreeBSD: head/bin/sh/arith_yylex.c 254806 2013-08-24 20:06:00Z jilles
#error Arithmetic tokens are out of order.
#endif

extern const char *arith_buf;

int
yylex(void)
{
Expand Down
6 changes: 3 additions & 3 deletions bin/cbsdsh/bltin/bltin.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
* SUCH DAMAGE.
*
* @(#)bltin.h 8.2 (Berkeley) 5/4/95
* $FreeBSD: head/bin/sh/bltin/bltin.h 223060 2011-06-13 21:03:27Z jilles $
* $FreeBSD: head/bin/sh/bltin/bltin.h 279503 2015-03-01 21:46:55Z jilles $
*/

/*
Expand All @@ -42,6 +42,7 @@
#include "../shell.h"
#include "../mystring.h"
#ifdef SHELL
#include "../error.h"
#include "../output.h"
#include "builtins.h"
#define FILE struct output
Expand Down Expand Up @@ -73,7 +74,6 @@
#include <unistd.h>

pointer stalloc(int);
void error(const char *, ...) __printf0like(1, 2);
pid_t getjobpgrp(char *);
int killjob(const char *, int);

extern char *commandname;
5 changes: 3 additions & 2 deletions bin/cbsdsh/builtins.def
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
# SUCH DAMAGE.
#
# @(#)builtins.def 8.4 (Berkeley) 5/4/95
# $FreeBSD: head/bin/sh/builtins.def 222386 2011-05-27 20:53:07Z jilles $
# $FreeBSD: head/bin/sh/builtins.def 288430 2015-09-30 21:32:29Z jilles $

#
# This file lists all the builtin commands. The first column is the name
Expand Down Expand Up @@ -65,6 +65,7 @@ exportcmd -s export -s readonly
#exprcmd expr
falsecmd false
fgcmd -j fg
freebsd_wordexpcmd freebsd_wordexp
getoptscmd getopts
hashcmd hash
histcmd -h fc
Expand Down Expand Up @@ -104,5 +105,5 @@ update_idlecmd update_idle
#cbsdluacmd cbsdlua
#cbsdlua_loadcmd cbsdlua_load
#cbsdlua_funccmd cbsdlua_func
cbsdjlscmd cbsdjls
#cbsd_xocmd cbsd_xo

Loading

0 comments on commit 9a92c71

Please sign in to comment.