rpms/bogl/devel bogl-0.1.18-1.1.rh.patch, NONE, 1.1 bogl-0.1.18-1.1.sigchld.patch, NONE, 1.1 .cvsignore, 1.3, 1.4 bogl.spec, 1.14, 1.15 sources, 1.3, 1.4 bogl-0.1.18-rh.patch, 1.3, NONE
fedora-cvs-commits at redhat.com
fedora-cvs-commits at redhat.com
Tue Sep 20 00:32:32 UTC 2005
Author: mitr
Update of /cvs/dist/rpms/bogl/devel
In directory cvs.devel.redhat.com:/tmp/cvs-serv23513
Modified Files:
.cvsignore bogl.spec sources
Added Files:
bogl-0.1.18-1.1.rh.patch bogl-0.1.18-1.1.sigchld.patch
Removed Files:
bogl-0.1.18-rh.patch
Log Message:
* Tue Sep 20 2005 Miloslav Trmac <mitr at redhat.com> - 0:0.1.18-9
- Update to bogl-0.1.18-1.1
- Don't ship unused ucs fonts in the SRPM
- Remove obsolete URL: (#168673)
bogl-0.1.18-1.1.rh.patch:
Makefile | 92 +++++++++++++++++++++++++++++----
bdftobogl.c | 5 +
bogl-bgf.c | 160 ++++++++++++++++++++++++++++++++++++++++++++--------------
bogl-bgf.h | 2
bogl-term.c | 58 +++++++++++++++------
bogl-term.h | 3 -
bogl.c | 14 +++++
bogl.h | 8 --
bterm-diet.c | 7 ++
bterm.c | 60 +++++++++++++++++++--
reduce-font.c | 40 +++++++++++++-
11 files changed, 369 insertions(+), 80 deletions(-)
--- NEW FILE bogl-0.1.18-1.1.rh.patch ---
--- bogl-0.1.18/bogl.c.rh 2004-05-06 04:57:06.000000000 +0200
+++ bogl-0.1.18/bogl.c 2005-09-20 02:04:10.000000000 +0200
@@ -53,6 +53,11 @@
#include "bogl-pcfb.h"
#include "bogl-tcfb.h"
#endif
+
+#if DIET
+#include "wlite/wlite_wchar.h"
+#endif
+
/* BOGL main code. */
@@ -197,8 +202,10 @@
ioctl (fb, FBIOGETCMAP, &cmap);
}
+#ifndef DIET
if (!status)
atexit (bogl_done);
+#endif
status = 2;
return 1;
@@ -284,6 +291,11 @@
close (tty);
close (fb);
}
+
+void bogl_close(void) {
+ close (tty);
+ close (fb);
+}
/* Keyboard interface. */
@@ -621,9 +633,11 @@
if (error)
return 0;
+#ifndef DIET
va_start (args, format);
vasprintf (&error, format, args);
va_end (args);
+#endif
return 0;
}
--- bogl-0.1.18/bdftobogl.c.rh 2004-03-08 05:39:59.000000000 +0100
+++ bogl-0.1.18/bdftobogl.c 2005-09-20 02:04:10.000000000 +0200
@@ -24,9 +24,14 @@
#include <string.h>
#include <unistd.h>
#include <wctype.h>
+#include <limits.h>
#include "bogl.h"
#include "bogl-font.h"
+#ifdef DIET
+#include "wlite/wlite_wchar.h"
+#endif
+
static void print_glyph (u_int32_t *content, int height, int w);
static int bogl_write_font(int fd, struct bogl_font *font);
--- /dev/null 2005-09-19 19:18:38.056820176 +0200
+++ bogl-0.1.18/bterm-diet.c 2005-09-20 02:04:10.000000000 +0200
@@ -0,0 +1,7 @@
+extern int bterm_main(int argc, char **argv);
+
+int main(int argc, char **argv)
+{
+ bterm_main(argc, argv);
+}
+
--- bogl-0.1.18/bogl.h.rh 2004-05-06 04:57:06.000000000 +0200
+++ bogl-0.1.18/bogl.h 2005-09-20 02:04:10.000000000 +0200
@@ -22,12 +22,7 @@
#include <stdlib.h>
#include <sys/types.h>
-/* As a temporary measure, we do this here rather than in config.h,
- which would probably make more sense. */
-#include <limits.h>
-#ifndef MB_LEN_MAX
-#define MB_LEN_MAX 6 /* for UTF-8 */
-#endif
+#include "wlite/wlite_wchar.h"
/* Proportional font structure definition. */
struct bogl_font
@@ -73,6 +68,7 @@
/* Generic routines. */
int bogl_init (void);
void bogl_done (void);
+void bogl_close (void);
const char *bogl_error (void);
void bogl_gray_scale (int make_gray);
--- bogl-0.1.18/bogl-bgf.c.rh 2001-12-01 18:04:42.000000000 +0100
+++ bogl-0.1.18/bogl-bgf.c 2005-09-20 02:04:10.000000000 +0200
@@ -1,44 +1,130 @@
-#include <fcntl.h>
+#include <errno.h>
+#include <stddef.h>
+#include <stdio.h>
+#include <stdlib.h>
#include <string.h>
-#include <sys/mman.h>
-#include <sys/stat.h>
-#include <sys/types.h>
-#include <unistd.h>
+#include <zlib.h>
+#include <stdint.h>
+#include "bogl-bgf.h"
#include "bogl.h"
-#include "bogl-font.h"
-struct bogl_font *bogl_mmap_font(char *file)
-{
- int fd;
- struct stat buf;
- void *f;
- struct bogl_font *font;
-
- fd = open(file, O_RDONLY);
- if (fd == -1)
- return 0;
-
- if (fstat(fd, &buf))
- return 0;
-
- f = mmap(0, buf.st_size, PROT_READ, MAP_SHARED, fd, 0);
- if (f == (void *)-1)
- return 0;
-
- if (memcmp("BGF1", f, 4))
- return 0;
-
- font = (struct bogl_font *)malloc(sizeof(struct bogl_font));
- if (!font)
- return 0;
-
- memcpy(font, f + 4, sizeof(*font));
- font->name = ((void *)font->name - (void *)0) + f;
- font->offset = ((void *)font->offset - (void *)0) + f;
- font->index = ((void *)font->index - (void *)0) + f;
- font->content = ((void *)font->content - (void *)0) + f;
+#define FONT_SIGNATURE "BGF1"
- return font;
+static size_t get_gz_file_size(const char *path) {
+ size_t size = 0;
+ unsigned char buffer[4] = { 0 };
+ FILE *stream = NULL;
+
+ stream = fopen(path, "rb");
+ if (stream == NULL) {
+ perror(path);
+ return -1;
+ }
+ if (fread(buffer, sizeof(char), 2, stream) != 2) {
+ if (ferror(stream)) {
+ perror(path);
+ return -1;
+ }
+ }
+ if (memcmp(buffer, "\037\213", 2) == 0) {
+ uint32_t isize = 0;
+
+ if (fseek(stream, -4L, SEEK_END) == EOF) {
+ perror(path);
+ return -1;
+ }
+ if (fread(buffer, sizeof(char), (size_t) 4, stream) != 4) {
+ if (ferror(stream)) {
+ perror(path);
+ return -1;
+ }
+ else {
+ fprintf(stderr, "%s: invalid gzip file\n", path);
+ return -1;
+ }
+ }
+ isize = buffer[0];
+ isize |= buffer[1] << 8;
+ isize |= buffer[2] << 16;
+ isize |= buffer[3] << 24;
+
+ /* FIXME: ISIZE is not a reliable indicator of size for files >4GB.
+ * On the other hand, if you have a font >4GB, you've got issues.
+ */
+ size = (size_t) isize;
+ }
+ else {
+ if (fseek(stream, 0L, SEEK_END) == EOF) {
+ perror(path);
+ return -1;
+ }
+ if ((int) (size = (size_t) ftell(stream)) == EOF) {
+ perror(path);
+ return -1;
+ }
+ }
+ if (fclose(stream) == EOF) {
+ perror(path);
+ return -1;
+ }
+ return size;
+}
+
+struct bogl_font *bogl_load_font(const char *path) {
+ size_t size;
+ int errnum;
+ gzFile file;
+ void *bgf;
+ struct bogl_font *font;
+
+ size = (size_t) get_gz_file_size(path);
+ if (size == (size_t) -1)
+ return NULL;
+ if ((bgf = malloc(size)) == NULL) {
+ perror(path);
+ return NULL;
+ }
+ file = gzopen(path, "rb");
+ if (file == NULL) {
+ if (errno == 0) {
+ errno = ENOMEM; // if 0 then zlib error == Z_MEM_ERROR
+ }
+ perror(path);
+ return NULL;
+ }
+ if (gzread(file, bgf, size) == -1) {
+ const char *msg = gzerror(file, &errnum);
+
+ if (errnum == Z_ERRNO) {
+ msg = strerror(errno);
+ }
+ fprintf(stderr, "%s: %s\n", path, msg);
+ return NULL;
+ }
+ if (gzclose(file) < 0) {
+ const char *msg = gzerror(file, &errnum);
+
+ if (errnum == Z_ERRNO) {
+ msg = strerror(errno);
+ }
+ fprintf(stderr, "%s: %s\n", path, msg);
+ return NULL;
+ }
+ if (memcmp(FONT_SIGNATURE, bgf, strlen(FONT_SIGNATURE)) != 0) {
+ fprintf(stderr, "%s: not a BGF font\n", path);
+ return NULL;
+ }
+ font = (struct bogl_font *) malloc(sizeof(struct bogl_font));
+ if (font == NULL) {
+ perror(path);
+ return NULL;
+ }
+ memcpy(font, bgf + strlen(FONT_SIGNATURE), sizeof(struct bogl_font));
+ font->name = bgf + (ptrdiff_t) font->name;
+ font->offset = bgf + (ptrdiff_t) font->offset;
+ font->index = bgf + (ptrdiff_t) font->index;
+ font->content = bgf + (ptrdiff_t) font->content;
+ return font;
}
--- bogl-0.1.18/bogl-term.c.rh 2003-11-05 05:38:22.000000000 +0100
+++ bogl-0.1.18/bogl-term.c 2005-09-20 02:05:57.000000000 +0200
@@ -24,6 +24,10 @@
* described by the terminfo source in "bterm.ti".
*/
+#include <limits.h>
+#include <string.h>
+#include <unistd.h>
+
#include "bogl.h"
#include "bogl-term.h"
@@ -50,8 +54,9 @@
term->xsize = bogl_xres / term->xstep;
term->ysize = bogl_yres / term->ystep;
term->xpos = 0, term->ypos = 0;
- term->fg = term->def_fg = 0;
- term->bg = term->def_bg = 7;
+ /* make default colors like newt tools and bsod! */
+ term->fg = term->def_fg = 7; // foreground = white
+ term->bg = term->def_bg = 4; // background = blue
term->rev = 0;
term->state = 0;
term->cur_visible = 1;
@@ -308,12 +313,14 @@
int i, j, w, txp, f, b, use_acs, x, y;
char buf[MB_LEN_MAX];
+ /* thunk the multibyte state var to the initial setting for the
+ * sake of glibc.
+ */
+ memset(&term->ps, 0, sizeof(term->ps));
+
k = 0;
while (1)
{
- s += k;
- n -= k;
-
/* The n <= 0 check was originally only necessary because of a bug
(?) in glibc 2.2.3, as opposed to libiconv. glibc will
successfully convert a zero-length string. It is also the only
@@ -323,24 +330,30 @@
if (n <= 0)
break;
- k = mbrtowc (&wc, s, n, &term->ps);
+ /* queue up the characters and flush immediately when we're out
+ * of input or we have a valid character. catches cases where a utf-8
+ * sequence has been split between two buffered reads
+ */
+ while (term->utfn < sizeof(term->utf) && n-- > 0) {
+ term->utf[term->utfn++] = *s++;
+ k = mbrtowc (&wc, term->utf, term->utfn, &term->ps);
+ if (k != (size_t) -2) {
+ term->utfn = 0;
+ break;
+ }
+ }
/* If we fail to write a character, skip forward one byte and continue.
There's not much we can do to recover, but it's better than discarding
the whole line. */
- if (k == (size_t) -1)
- {
+ if (k == (size_t) -1) {
+ k = mbrtowc (NULL, NULL, 0, &term->ps);
k = 1;
- /* The mbrtowc documentation suggests that we could use mbrtowc
- to reset term->ps, but that doesn't work in practice; ps is in
- an undefined state which appears to be the illegal state to make
- the reset call in. Use memset. */
- memset (&term->ps, 0, sizeof (term->ps));
continue;
}
else if (k == (size_t) -2)
{
- /* Incomplete character, so we exit and wait for more to arrive. */
+ k = 0;
break;
}
@@ -353,6 +366,21 @@
if (wc == 0) /* 0 has a special meaning in term->screen[] */
continue;
+ if (wc == 7) { /* bell=^G: flash screen by XORing it twice */
+ for (i = 0; i < term->xsize * term->ysize; i++) {
+ term->screenfg[i] = term->screenfg[i] ^ 0x7;
+ term->screenbg[i] = term->screenbg[i] ^ 0x7;
+ }
+ bogl_term_redraw(term);
+ usleep(100000); // pause 1/10th of a second
+ for (i = 0; i < term->xsize * term->ysize; i++) {
+ term->screenfg[i] = term->screenfg[i] ^ 0x7;
+ term->screenbg[i] = term->screenbg[i] ^ 0x7;
+ }
+ bogl_term_redraw(term);
+ continue;
+ }
+
if (wc == 8)
{ /* cub1=^H */
if (term->xpos)
@@ -661,7 +689,7 @@
/* At this point, if we can not decode a character because of ACS,
replace it with a space to minimize graphical corruption. */
- if ((w = wcwidth (wc)) < 0)
+ if (wc < 0 || wc > 0xFFFF || (w = wcwidth (wc)) < 0)
{
if (use_acs)
{
--- bogl-0.1.18/bogl-term.h.rh 2003-11-05 04:01:47.000000000 +0100
+++ bogl-0.1.18/bogl-term.h 2005-09-20 02:04:10.000000000 +0200
@@ -2,7 +2,7 @@
#ifndef bogl_term_h
#define bogl_term_h
-#include <wchar.h>
+#include "wlite/wlite_wchar.h"
struct bogl_term {
const struct bogl_font *font;
@@ -24,6 +24,7 @@
wchar_t **cchars; /* combining chars in cell, or 0 */
int yorig; /* increment this to scroll */
int acs;
+ char utf[6]; size_t utfn;
};
struct bogl_term *bogl_term_new(struct bogl_font *font);
--- bogl-0.1.18/reduce-font.c.rh 2001-12-01 18:04:42.000000000 +0100
+++ bogl-0.1.18/reduce-font.c 2005-09-20 02:04:10.000000000 +0200
@@ -42,12 +42,31 @@
printf (": %d\n", l);
}
+char *
+cat_line(char *sofar, const char *line) {
+ char *buf;
+ size_t length;
+
+ length = sofar == NULL ? 0 : strlen(sofar);
+ length += strlen(line);
+ length++;
+ buf = sofar == NULL
+ ? calloc(length, sizeof(char))
+ : realloc(sofar, sizeof(char) * length);
+ if (buf == NULL) {
+ perror(NULL);
+ exit(EXIT_FAILURE);
+ }
+ return strcat(buf, line);
+}
+
int
main (int argc, char **argv)
{
FILE *font;
char *buffer = NULL;
char *locale = setlocale (LC_CTYPE, "");
+ char *onebdffmtchar = NULL;
int error = 0;
if (locale == NULL) {
@@ -152,14 +171,29 @@
if (!header)
{
if (strncmp (buf, "STARTCHAR ", 10) == 0)
+ {
+ if (onebdffmtchar != NULL)
+ {
+ free(onebdffmtchar);
+ onebdffmtchar = NULL;
+ }
+
+ }
+ onebdffmtchar = cat_line(onebdffmtchar, buf);
+
+ if (strncmp (buf, "ENCODING ", 9) == 0)
{
- wc = strtol (buf + 12, NULL, 16);
+ wc = strtol (buf + 9, NULL, 10);
docopy = used[wc / 32] & (1 << (wc % 32));
}
+ else if (strncmp (buf, "ENDCHAR", 7) == 0)
+ {
+ if (docopy)
+ fputs (onebdffmtchar, stdout);
+ docopy = 0;
+ }
- if (docopy)
- fprintf (stdout, buf);
}
}
--- bogl-0.1.18/Makefile.rh 2003-10-05 19:47:03.000000000 +0200
+++ bogl-0.1.18/Makefile 2005-09-20 02:04:10.000000000 +0200
@@ -4,12 +4,23 @@
SONAME = libbogl.so.0
SHARED_LIB = libbogl.so.0.1
+libdir = /usr/lib
+
+#architecture := $(shell dpkg-architecture -qDEB_BUILD_GNU_CPU)
+architecture := $(patsubst i%86,i386,$(shell uname -m))
+
+ifeq ($(architecture), none)
+USEDIET := 1
+DIETCC = diet gcc
+else
+USEDIET := 0
+DIETCC = gcc
+endif
+
CFLAGS = -O2 -g -D_GNU_SOURCE
WARNCFLAGS += -Wall -D_GNU_SOURCE
ALLCFLAGS = $(CFLAGS) $(WARNCFLAGS) $(FBCFLAGS)
-architecture := $(shell dpkg-architecture -qDEB_BUILD_GNU_CPU)
-
LIBOBJECTS = $(LIBBOGLOBJECTS) $(LIBBOMLOBJECTS) $(LIBBOWLOBJECTS) \
$(LIBRSRCOBJECTS)
LIBBOGLOBJECTS = bogl.o bogl-font.o
@@ -17,6 +28,19 @@
LIBBOWLOBJECTS = bowl.o symbol.o
LIBRSRCOBJECTS = helvB10.o helvB12.o helvR10.o timBI18.o tux75.o
+LIBBTERM = libbterm.a
+LIBBTERMOBJECTS = bterm-lib.o bogl-term.o bogl-bgf.o
+
+ifeq ($(USEDIET), 1)
+LIBBTERMDIET = libbtermdiet.a
+LIBBTERMDOBJS = $(patsubst %.o,%.do,$(LIBBTERMOBJECTS))
+
+LIBBOGLDIET = libbogldiet.a
+LIBBOGLDOBJS = $(patsubst %.o,%.do,$(LIBOBJECTS))
+
+BTERMDIET = bterm-diet
+endif
+
SOURCES_DEP = arrow.c bdftobogl.c bogl-cfb.c bogl-cfb.h bogl-cfb8.c \
bogl-cfb8.h bogl-font.c bogl-font.h bogl-pcfb.c bogl-pcfb.h \
bogl-tcfb.c bogl-tcfb.h bogl-test.c bogl.c bogl.h boglP.h boml.c \
@@ -38,7 +62,7 @@
GENERATED = helvB10.c helvB12.c helvR10.c timBI18.c tux75.c
# libutf8/libutf8_plug.so unifont-reduced.bgf
-all: depend $(SHARED_LIB) $(LIB) bterm bdftobogl reduce-font
+all: depend subdirs $(SHARED_LIB) $(LIB) bterm bdftobogl reduce-font $(LIBBTERM) $(LIBBTERMDIET) $(LIBBOGLDIET) $(BTERMDIET)
%.lo: %.c
$(CC) $(ALLCFLAGS) -o $@ -fPIC -c $<
@@ -46,6 +70,16 @@
%.o: %.c
$(CC) $(ALLCFLAGS) -o $@ -c $<
+subdirs:
+ cd wlite;\
+ make SMALL=1 CC="$(DIETCC)"
+ifeq ($(USEDIET), 1)
+ cd wlite;\
+ mv libwlite.a libwlitediet.a;\
+ make distclean;\
+ make SMALL=1 CC="gcc"
+endif
+
$(SHARED_LIB): $(OBJECTS:%.o=%.lo)
$(CC) -shared -Wl,-soname,$(SONAME) -o $(SHARED_LIB) $(OBJECTS:%.o=%.lo)
@@ -68,9 +102,36 @@
reduce-font: reduce-font.c
+bterm-lib.o: bterm.c
+ $(CC) $(ALLCFLAGS) -o $@ -c -Dmain=bterm_main $<
+
+bterm-lib.do: bterm.c
+ diet $(CC) $(ALLCFLAGS) -DDIET -o $@ -c -Dmain=bterm_main $<
+
+ifeq ($(architecture), i386)
+ DFBCFLAGS := -DBOGL_VGA16_FB=1 -DDIET
+else
+ DFBCFLAGS := $(FBCFLAGS) -DDIET
+endif
+
+%.do: %.c
+ diet $(CC) $(DFBCFLAGS) -c $(CFLAGS) -o $@ $<
+
+$(LIBBTERM): $(LIBBTERMOBJECTS)
+ rm -f $@
+ ar rcs $@ $^
+
+$(LIBBTERMDIET): $(LIBBTERMDOBJS)
+ rm -f $@
+ ar rcs $@ $^
+
$(LIB): $(OBJECTS)
- rm -f $(LIB)
- ar rcs $(LIB) $(OBJECTS)
+ rm -f $@
+ ar rcs $@ $^
+
+$(LIBBOGLDIET): $(LIBBOGLDOBJS)
+ rm -f $@
+ ar rcs $@ $^
bogl-test: $(LIB) bogl-test.c tux75.o
$(CC) $(ALLCFLAGS) -o bogl-test bogl-test.c tux75.o $(LIB)
@@ -79,9 +140,14 @@
$(CC) -DSTANDALONE_TEST $(ALLCFLAGS) bowl-boxes.c $(LIBOBJECTS) -o bowl-boxes
bterm: $(LIB) bterm.o bogl-term.o bogl-bgf.o
- $(CC) $+ $(LIB) -o bterm
+ $(CC) $+ $(LIB) -lz -o bterm wlite/libwlite.a
+
+bterm-diet: $(LIBBOGLDIET) $(LIBBTERMDIET) bterm-diet.c
+ diet $(CC) -g bterm-diet.c $(LIBBTERMDIET) $(LIBBOGLDIET) wlite/libwlite.a -lz -o $@
bdftobogl: $(LIBBOGLOBJECTS)
+ $(CC) $(ALLCFLAGS) -o $@ bdftobogl.c $^ wlite/libwlite.a
+
%.c: %.bdf bdftobogl
./bdftobogl $< > $@
@@ -98,9 +164,11 @@
rm -rf reduce-font bterm bdftobogl pngtobogl *.o $(GENERATED) *-test lang.h tmp.*.c bowl-boxes $(LIB) unifont-reduced.bgf unifont-reduced.bdf
rm -f $(OBJECTS:%.o=%.lo) $(SHARED_LIB)
rm -f .depend
+ cd wlite; make clean
distclean: clean
rm -f $(LIB) .depend *~ .nfs*
+ cd wlite; make distclean
force:
@@ -108,12 +176,14 @@
include .depend
endif
+INSTLIBS = $(LIB) $(LIBBTERM) $(LIBBTERMDIET) $(LIBBOGLDIET)
+
install: all
- install -d $(DESTDIR)/usr/lib $(DESTDIR)/usr/include/bogl $(DESTDIR)/usr/bin
- install -m644 $(SHARED_LIB) $(DESTDIR)/usr/lib/$(SHARED_LIB)
- ln -s $(SHARED_LIB) $(DESTDIR)/usr/lib/$(DEVLINK)
- ln -s $(SHARED_LIB) $(DESTDIR)/usr/lib/$(SONAME)
- install -m644 $(LIB) $(DESTDIR)/usr/lib/$(LIB)
+ install -d $(DESTDIR)/$(libdir) $(DESTDIR)/usr/include/bogl $(DESTDIR)/usr/bin
+ install -m644 $(SHARED_LIB) $(DESTDIR)/$(libdir)/$(SHARED_LIB)
+ ln -sf $(SHARED_LIB) $(DESTDIR)/$(libdir)/$(DEVLINK)
+ ln -sf $(SHARED_LIB) $(DESTDIR)/$(libdir)/$(SONAME)
+ install -m644 $(INSTLIBS) $(DESTDIR)/$(libdir)
install -m644 *.h $(DESTDIR)/usr/include/bogl
install -m755 bdftobogl mergebdf bterm pngtobogl reduce-font $(DESTDIR)/usr/bin
install -d $(DESTDIR)/usr/share/terminfo
--- bogl-0.1.18/bogl-bgf.h.rh 2001-12-01 18:04:42.000000000 +0100
+++ bogl-0.1.18/bogl-bgf.h 2005-09-20 02:04:10.000000000 +0200
@@ -1,2 +1,2 @@
-struct bogl_font *bogl_mmap_font(char *file);
+struct bogl_font *bogl_load_font(const char *file);
--- bogl-0.1.18/bterm.c.rh 2005-09-20 02:04:10.000000000 +0200
+++ bogl-0.1.18/bterm.c 2005-09-20 02:04:10.000000000 +0200
@@ -64,6 +64,7 @@
static int child_pid = 0;
static struct termios ttysave;
+static int spawn = 0;
/* This first tries the modern Unix98 way of getting a pty, followed by the
* old-fashioned BSD way in case that fails. */
@@ -127,6 +128,9 @@
if (child_pid != 0 && waitpid(child_pid, &status, WNOHANG) > 0) {
child_pid = 0;
/* Reset ownership and permissions of ttyfd device? */
+#ifdef DIET
+ bogl_done();
+#endif
tcsetattr(0, TCSAFLUSH, &ttysave);
if (WIFEXITED (status))
exit(WEXITSTATUS (status));
@@ -139,6 +143,42 @@
signal(SIGCHLD, sigchld);
}
+/* return 0 if parent, 1 if child */
+int spawn_child(int ptyfd, int ttyfd)
+{
+ fflush(stdout);
+ child_pid = fork();
+ if (child_pid) {
+ /* Change ownership and permissions of ttyfd device! */
+ signal(SIGCHLD, sigchld);
+ return 0;
+ }
+ setenv("TERM", "bterm", 1);
+
+ sleep(1);
+ close(ptyfd);
+
+ dup2(ttyfd, 0);
+ dup2(ttyfd, 1);
+ dup2(ttyfd, 2);
+
+ bogl_close();
+
+ if (ttyfd > 2)
+ close(ttyfd);
+
+ setgid(getgid());
+ setuid(getuid());
+
+ setsid();
+ if (ioctl(0, TIOCSCTTY, (char *)0)) {
+ perror("Unable to set a new controlling tty: ");
+ }
+
+ return 1;
+}
+
+
void spawn_shell(int ptyfd, int ttyfd, const char *command)
{
fflush(stdout);
@@ -179,14 +219,14 @@
ioctl(ttyfd, TIOCSWINSZ, &win);
}
-static char *font_name;
+static char *font_name = "/usr/lib/bogl/font.bgf.gz";
static struct bogl_term *term;
void reload_font(int sig)
{
struct bogl_font *font;
- font = bogl_mmap_font (font_name);
+ font = bogl_load_font (font_name);
if (font == NULL)
{
fprintf(stderr, "Bad font\n");
@@ -231,6 +271,10 @@
o = argv[i][1];
break;
+ case 's':
+ spawn = 1;
+ break;
+
default:
printf ("unknown option: %c\n", argv[i][1]);
}
@@ -260,7 +304,7 @@
return 1;
}
- if ((font = bogl_mmap_font(font_name)) == NULL) {
+ if ((font = bogl_load_font(font_name)) == NULL) {
fprintf(stderr, "Bad font\n");
return 1;
}
@@ -274,7 +318,7 @@
term = bogl_term_new(font);
if (!term)
- exit(1);
+ return 1;
bogl_set_palette(0, 16, palette);
@@ -285,7 +329,11 @@
exit(1);
}
- spawn_shell(ptyfd, ttyfd, command == NULL ? "/bin/sh" : command);
+ if (spawn) {
+ if (spawn_child(ptyfd, ttyfd))
+ return 0;
+ } else
+ spawn_shell(ptyfd, ttyfd, command == NULL ? "/bin/sh" : command);
signal(SIGHUP, reload_font);
@@ -297,7 +345,7 @@
ntio.c_cc[VTIME] = 0;
ntio.c_cflag |= CS8;
ntio.c_line = 0;
- tcsetattr(0, TCSAFLUSH, &ntio);
+ tcsetattr(0, TCSANOW, &ntio);
set_window_size(ttyfd, term->xsize, term->ysize);
bogl-0.1.18-1.1.sigchld.patch:
bterm.c | 2 +-
1 files changed, 1 insertion(+), 1 deletion(-)
--- NEW FILE bogl-0.1.18-1.1.sigchld.patch ---
--- bogl-0.1.18/bterm.c.sigchld 2005-09-20 00:44:06.000000000 +0200
+++ bogl-0.1.18/bterm.c 2005-09-20 00:46:01.000000000 +0200
@@ -124,7 +124,7 @@
void sigchld(int sig)
{
int status;
- if (waitpid(child_pid, &status, WNOHANG)) {
+ if (child_pid != 0 && waitpid(child_pid, &status, WNOHANG) > 0) {
child_pid = 0;
/* Reset ownership and permissions of ttyfd device? */
tcsetattr(0, TCSAFLUSH, &ttysave);
Index: .cvsignore
===================================================================
RCS file: /cvs/dist/rpms/bogl/devel/.cvsignore,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- .cvsignore 9 Sep 2004 03:36:29 -0000 1.3
+++ .cvsignore 20 Sep 2005 00:32:29 -0000 1.4
@@ -3,3 +3,4 @@
ucs-fonts-asian.tar.gz
ucs-fonts.tar.gz
wlite-0.8.1.tar.gz
+bogl_0.1.18-1.1.tar.gz
Index: bogl.spec
===================================================================
RCS file: /cvs/dist/rpms/bogl/devel/bogl.spec,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- bogl.spec 17 Sep 2005 22:10:59 -0000 1.14
+++ bogl.spec 20 Sep 2005 00:32:29 -0000 1.15
@@ -1,15 +1,14 @@
Summary: A terminal program for displaying Unicode on the console.
Name: bogl
Version: 0.1.18
-Release: 8
-URL: http://www.msu.edu/user/pfaffben/projects.html
-Source0: http://ftp.debian.org/debian/pool/main/b/bogl/bogl_0.1.18-1.tar.gz
+Release: 9
+# URL: used to be http://www.stanford.edu/~blp/projects.html, now none
+Source0: http://ftp.debian.org/debian/pool/main/b/bogl/bogl_0.1.18-1.1.tar.gz
Source1: wlite-0.8.1.tar.gz
-Source2: http://www.cl.cam.ac.uk/~mgk25/download/ucs-fonts.tar.gz
-Source3: http://www.cl.cam.ac.uk/~mgk25/download/ucs-fonts-asian.tar.gz
-Source4: 14x14cjk.bdf.gz
-Patch: bogl-0.1.18-rh.patch
-Patch1: bogl-0.1.9-fpic.patch
+Source2: 14x14cjk.bdf.gz
+Patch0: bogl-0.1.18-1.1.sigchld.patch
+Patch1: bogl-0.1.18-1.1.rh.patch
+Patch2: bogl-0.1.9-fpic.patch
Patch3: bogl-0.1.9-2.6fbdev.patch
Patch4: bogl-0.1.18-gcc.patch
Patch5: bogl-0.1.18-noexecstack.patch
@@ -43,22 +42,17 @@
frame buffer. It is able to display Unicode text on the console.
%prep
-%setup -q -n bogl -a 1
-%patch -p1 -b .rh
-%patch1 -p1 -b .fpic
+%setup -q -n bogl-0.1.18 -a 1
+%patch0 -p1 -b .sigchld
+%patch1 -p1 -b .rh
+%patch2 -p1 -b .fpic
%patch3 -p1 -b .26fbdev
%patch4 -p1 -b .gcc
%patch5 -p1 -b .noexecstack
-mkdir -p fonts
-cd fonts
-tar zxf %{SOURCE2}
-tar zxf %{SOURCE3}
-
%build
make CFLAGS="$RPM_OPT_FLAGS"
-#./mergebdf fonts/9x18.bdf fonts/18x18ja.bdf > font.bdf
-gunzip -c %{SOURCE4} > font.bdf
+gunzip -c %{SOURCE2} > font.bdf
./bdftobogl -b font.bdf > font.bgf
%install
@@ -106,6 +100,11 @@
/usr/lib/bogl
%changelog
+* Tue Sep 20 2005 Miloslav Trmac <mitr at redhat.com> - 0:0.1.18-9
+- Update to bogl-0.1.18-1.1
+- Don't ship unused ucs fonts in the SRPM
+- Remove obsolete URL: (#168673)
+
* Sun Sep 18 2005 Miloslav Trmac <mitr at redhat.com> - 0:0.1.18-8
- Ship wlite and Unicode data licenses, and Changelog
Index: sources
===================================================================
RCS file: /cvs/dist/rpms/bogl/devel/sources,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- sources 9 Sep 2004 03:36:29 -0000 1.3
+++ sources 20 Sep 2005 00:32:29 -0000 1.4
@@ -1,5 +1,3 @@
c08ab351a43a91632127f509aadc6797 14x14cjk.bdf.gz
-9658700ed196eb1789c12aca0a095cb5 bogl_0.1.18-1.tar.gz
-cbad2d5e91bab16acf1a92f2814b3f1e ucs-fonts-asian.tar.gz
-aab1451c94ca7848df495b09a48df4b0 ucs-fonts.tar.gz
03a2faa33978e88ea2b9ff4679b8f2df wlite-0.8.1.tar.gz
+181cfe5d863249e7724e33da5b3407ea bogl_0.1.18-1.1.tar.gz
--- bogl-0.1.18-rh.patch DELETED ---
More information about the fedora-cvs-commits
mailing list