From a4e3e95194684e280bb5ec7d3a1fe2ccda3c59be Mon Sep 17 00:00:00 2001 From: Anselm R Garbe Date: Tue, 20 May 2008 10:03:59 +0100 Subject: [PATCH] added some new files for the initial rewrite of st from scratch --- LICENSE | 22 ++++++++++++++++++++ Makefile | 60 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ config.mk | 33 ++++++++++++++++++++++++++++++ st.c | 11 ++++++++++ std.c | 4 ++++ 5 files changed, 130 insertions(+) create mode 100644 LICENSE create mode 100644 Makefile create mode 100644 config.mk create mode 100644 st.c create mode 100644 std.c diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..5b1d694 --- /dev/null +++ b/LICENSE @@ -0,0 +1,22 @@ +MIT/X Consortium License + +© 2007-2008 Anselm R Garbe +© 2007-2008 Matthias Christian Ott + +Permission is hereby granted, free of charge, to any person obtaining a +copy of this software and associated documentation files (the "Software"), +to deal in the Software without restriction, including without limitation +the rights to use, copy, modify, merge, publish, distribute, sublicense, +and/or sell copies of the Software, and to permit persons to whom the +Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..c4d0b1a --- /dev/null +++ b/Makefile @@ -0,0 +1,60 @@ +# st - simple terminal +# See LICENSE file for copyright and license details. + +include config.mk + +SRC = st +OBJ = ${SRC:.c=.o} + +all: options st + +options: + @echo st build options: + @echo "CFLAGS = ${CFLAGS}" + @echo "LDFLAGS = ${LDFLAGS}" + @echo "CC = ${CC}" + +.c.o: + @echo CC $< + @${CC} -c ${CFLAGS} $< + +${OBJ}: config.h config.mk + +config.h: + @echo creating $@ from config.def.h + @cp config.def.h $@ + +st: ${OBJ} + @echo CC -o $@ + @${CC} -o $@ ${OBJ} ${LDFLAGS} + +clean: + @echo cleaning + @rm -f st ${OBJ} st-${VERSION}.tar.gz + +dist: clean + @echo creating dist tarball + @mkdir -p st-${VERSION} + @cp -R LICENSE Makefile README config.def.h config.mk \ + st.1 ${SRC} st-${VERSION} + @tar -cf st-${VERSION}.tar st-${VERSION} + @gzip st-${VERSION}.tar + @rm -rf st-${VERSION} + +install: all + @echo installing executable file to ${DESTDIR}${PREFIX}/bin + @mkdir -p ${DESTDIR}${PREFIX}/bin + @cp -f st ${DESTDIR}${PREFIX}/bin + @chmod 755 ${DESTDIR}${PREFIX}/bin/st + @echo installing manual page to ${DESTDIR}${MANPREFIX}/man1 + @mkdir -p ${DESTDIR}${MANPREFIX}/man1 + @sed "s/VERSION/${VERSION}/g" < st.1 > ${DESTDIR}${MANPREFIX}/man1/st.1 + @chmod 644 ${DESTDIR}${MANPREFIX}/man1/st.1 + +uninstall: + @echo removing executable file from ${DESTDIR}${PREFIX}/bin + @rm -f ${DESTDIR}${PREFIX}/bin/st + @echo removing manual page from ${DESTDIR}${MANPREFIX}/man1 + @rm -f ${DESTDIR}${MANPREFIX}/man1/st.1 + +.PHONY: all options clean dist install uninstall diff --git a/config.mk b/config.mk new file mode 100644 index 0000000..5983bcb --- /dev/null +++ b/config.mk @@ -0,0 +1,33 @@ +# st version +VERSION = 0.0 + +# Customize below to fit your system + +# paths +PREFIX = /usr/local +MANPREFIX = ${PREFIX}/share/man + +X11INC = /usr/X11R6/include +X11LIB = /usr/X11R6/lib + +# Xinerama, comment if you don't want it +XINERAMALIBS = -L${X11LIB} -lXinerama +XINERAMAFLAGS = -DXINERAMA + +# includes and libs +INCS = -I. -I/usr/include -I${X11INC} +LIBS = -L/usr/lib -lc -L${X11LIB} -lX11 ${XINERAMALIBS} + +# flags +CPPFLAGS = -DVERSION=\"${VERSION}\" ${XINERAMAFLAGS} +CFLAGS = -Os ${INCS} ${CPPFLAGS} +LDFLAGS = -s ${LIBS} +#CFLAGS = -g -std=c99 -pedantic -Wall -O2 ${INCS} ${CPPFLAGS} +#LDFLAGS = -g ${LIBS} + +# Solaris +#CFLAGS = -fast ${INCS} -DVERSION=\"${VERSION}\" +#LDFLAGS = ${LIBS} + +# compiler and linker +CC = cc diff --git a/st.c b/st.c new file mode 100644 index 0000000..33f165c --- /dev/null +++ b/st.c @@ -0,0 +1,11 @@ +/* See LICENSE file for copyright and license details. */ +#include + +int +main(int argc, char *argv[]) { + if(argc == 2 && !strcmp("-v", argv[1])) + eprint("st-"VERSION", © 2007-2008 st engineers, see LICENSE for details\n"); + else if(argc != 1) + eprint("usage: st [-v]\n"); + return 0; +} diff --git a/std.c b/std.c new file mode 100644 index 0000000..af1f2bc --- /dev/null +++ b/std.c @@ -0,0 +1,4 @@ +/* See LICENSE file for copyright and license details. */ + +/* TODO: add the necessary code into here, which is going to be fork()ed from + * st if this isn't an attach process */