Get dc(1) to build
This commit is contained in:
parent
6fcea8b76c
commit
7aafee75c8
|
@ -0,0 +1 @@
|
||||||
|
dc/dc
|
|
@ -0,0 +1,19 @@
|
||||||
|
Copyright (c) 2021 nortti
|
||||||
|
|
||||||
|
This software is provided 'as-is', without any express or implied
|
||||||
|
warranty. In no event will the authors be held liable for any damages
|
||||||
|
arising from the use of this software.
|
||||||
|
|
||||||
|
Permission is granted to anyone to use this software for any purpose,
|
||||||
|
including commercial applications, and to alter it and redistribute
|
||||||
|
it freely, subject to the following restrictions:
|
||||||
|
|
||||||
|
1. The origin of this software must not be misrepresented; you must not
|
||||||
|
claim that you wrote the original software. If you use this software
|
||||||
|
in a product, an acknowledgment in the product documentation would be
|
||||||
|
appreciated but is not required.
|
||||||
|
|
||||||
|
2. Altered source versions must be plainly marked as such, and must not be
|
||||||
|
misrepresented as being the original software.
|
||||||
|
|
||||||
|
3. This notice may not be removed or altered from any source distribution.
|
|
@ -0,0 +1,36 @@
|
||||||
|
DESTDIR ?=
|
||||||
|
PREFIX ?= /usr/local
|
||||||
|
EXEC_PREFIX ?= $(PREFIX)
|
||||||
|
BINDIR ?= $(EXEC_PREFIX)/bin
|
||||||
|
LIBEXECDIR ?= $(EXEC_PREFIX)/libexec
|
||||||
|
DATAROOTDIR ?= $(PREFIX)/share
|
||||||
|
MANDIR ?= $(DATAROOTDIR)/man
|
||||||
|
|
||||||
|
BINS := dc/dc
|
||||||
|
MAN1S := dc/dc.1
|
||||||
|
|
||||||
|
.SUFFIXES:
|
||||||
|
.SUFFIXES: .c .o
|
||||||
|
|
||||||
|
.PHONY: all install uninstall clean distclean
|
||||||
|
|
||||||
|
all: $(BINS)
|
||||||
|
|
||||||
|
dc/dc: dc/dc.c dc/dc.h
|
||||||
|
$(CC) -o $@ $(CFLAGS) $(CPPFLAGS) $< $(LDFLAGS)
|
||||||
|
|
||||||
|
.c.o:
|
||||||
|
$(CC) -c $(CFLAGS) $(CPPFLAGS) -o $@ $<
|
||||||
|
|
||||||
|
install: $(BINS) $(MAN1S)
|
||||||
|
install -D -m 755 -t '$(DESTDIR)$(BINDIR)' $(BINS)
|
||||||
|
install -D -m 644 -t '$(DESTDIR)$(MANDIR)/man1' $(MAN1S)
|
||||||
|
|
||||||
|
uninstall:
|
||||||
|
cd $(DESTDIR)$(BINDIR) && rm $(BINS)
|
||||||
|
cd $(DESTDIR)$(MANDIR)/man1 && rm $(MAN1S)
|
||||||
|
|
||||||
|
clean:
|
||||||
|
rm -f $(BINS)
|
||||||
|
|
||||||
|
distclean: clean
|
|
@ -3,3 +3,5 @@ dc.c is derived from 4.4BSD. See LICENSE.bsd
|
||||||
|
|
||||||
Additionally, the files have been modified by Gunnar Ritter. See
|
Additionally, the files have been modified by Gunnar Ritter. See
|
||||||
LICENSE.gritter
|
LICENSE.gritter
|
||||||
|
|
||||||
|
dc.c has been modified by nortti. See LICENSE.nortti
|
||||||
|
|
5
dc/dc.c
5
dc/dc.c
|
@ -43,13 +43,14 @@
|
||||||
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
/* Sccsid @(#)dc.c 1.21 (gritter) 12/25/06> */
|
/* Sccsid @(#)dc.c 1.21 (gritter) 12/25/06> */
|
||||||
|
/* Modified by nortti, 2021 */
|
||||||
|
|
||||||
|
#define _XOPEN_SOURCE 500
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/wait.h>
|
#include <sys/wait.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
#include "sigset.h"
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <inttypes.h>
|
#include <inttypes.h>
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
|
@ -1669,7 +1670,7 @@ command(void){
|
||||||
}
|
}
|
||||||
*sl = 0;
|
*sl = 0;
|
||||||
if((pid = fork()) == 0){
|
if((pid = fork()) == 0){
|
||||||
execl(SHELL,"sh","-c",line,NULL);
|
execl("/bin/sh","sh","-c",line,NULL);
|
||||||
exit(0100);
|
exit(0100);
|
||||||
}
|
}
|
||||||
savint = sigset(SIGINT, SIG_IGN);
|
savint = sigset(SIGINT, SIG_IGN);
|
||||||
|
|
Loading…
Reference in New Issue