st

fork of suckless's simple terminal
Index Commits Files Refs README LICENSE
commit 1987ae4bacf58c588bbc967434be4e39125c37f9
parent 16f373e36cb2ef0512ac8a281cc18132b2b14b98
Author: Anselm R Garbe <garbeam@gmail.com>
Date:   Tue, 20 May 2008 10:03:59 +0100

added some new files for the initial rewrite of st from scratch

Diffstat:
ALICENSE | 22++++++++++++++++++++++
AMakefile | 60++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Aconfig.mk | 33+++++++++++++++++++++++++++++++++
Ast.c | 11+++++++++++
Astd.c | 4++++
5 files changed, 130 insertions(+), 0 deletions(-)
diff --git a/LICENSE b/LICENSE
@@ -0,0 +1,22 @@
+MIT/X Consortium License
+
+© 2007-2008 Anselm R Garbe <garbeam at gmail dot com>
+© 2007-2008 Matthias Christian Ott <ott at enolink dot de>
+
+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
@@ -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
@@ -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
@@ -0,0 +1,11 @@
+/* See LICENSE file for copyright and license details. */
+#include <stdio.h>
+
+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
@@ -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 */