aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--INSTALL2
-rw-r--r--fbtools.c6
-rw-r--r--mk/Autoconf.mk9
-rw-r--r--mk/Compile.mk2
-rw-r--r--mk/Maintainer.mk2
-rw-r--r--mk/Variables.mk8
-rw-r--r--parseconfig.c80
-rw-r--r--parseconfig.h35
-rw-r--r--sane.c2
9 files changed, 72 insertions, 74 deletions
diff --git a/INSTALL b/INSTALL
index 0d1ba36..8f99186 100644
--- a/INSTALL
+++ b/INSTALL
@@ -56,4 +56,4 @@ Have fun,
Gerd
--
-Gerd Knorr <kraxel@bytesex.org>
+Gerd Hoffmann <kraxel@suse.de>
diff --git a/fbtools.c b/fbtools.c
index a5d4815..563df90 100644
--- a/fbtools.c
+++ b/fbtools.c
@@ -323,6 +323,7 @@ fb_init(char *device, char *mode, int vt)
{
char fbdev[16];
struct vt_stat vts;
+ unsigned long page_mask;
dev_init();
tty = 0;
@@ -424,15 +425,14 @@ fb_init(char *device, char *mode, int vt)
goto err;
}
#endif
- fb_mem_offset = (unsigned long)(fb_fix.smem_start) & (~PAGE_MASK);
+ page_mask = getpagesize()-1;
+ fb_mem_offset = (unsigned long)(fb_fix.smem_start) & (~page_mask);
fb_mem = mmap(NULL,fb_fix.smem_len+fb_mem_offset,
PROT_READ|PROT_WRITE,MAP_SHARED,fb,0);
if (-1L == (long)fb_mem) {
perror("mmap");
goto err;
}
-// fprintf(stderr,"fb_mem = %p\n",fb_mem);
-
/* move viewport to upper left corner */
if (fb_var.xoffset != 0 || fb_var.yoffset != 0) {
fb_var.xoffset = 0;
diff --git a/mk/Autoconf.mk b/mk/Autoconf.mk
index 4d25d21..aea4900 100644
--- a/mk/Autoconf.mk
+++ b/mk/Autoconf.mk
@@ -1,7 +1,7 @@
#
# simple autoconf system for GNU make
#
-# (c) 2002-2004 Gerd Knorr <kraxel@bytesex.org>
+# (c) 2002-2006 Gerd Hoffmann <kraxel@suse.de>
#
# credits for creating this one go to the autotools people because
# they managed it to annoy lots of developers and users (including
@@ -110,6 +110,13 @@ ac_resdir = $(shell \
echo "/etc/X11" || echo "/usr/X11R6/lib/X11");\
$(call ac_fini))
+# check if package is installed, via pkg-config
+# args: pkg name
+ac_pkg_config = $(shell \
+ $(call ac_init,for $(1) (using pkg-config));\
+ $(call ac_b_cmd, pkg-config $(1));\
+ $(call ac_fini))
+
########################################################################
# build Make.config
diff --git a/mk/Compile.mk b/mk/Compile.mk
index 49dddbf..da14d58 100644
--- a/mk/Compile.mk
+++ b/mk/Compile.mk
@@ -1,7 +1,7 @@
#
# some rules to compile stuff ...
#
-# (c) 2002-2004 Gerd Knorr <kraxel@bytesex.org>
+# (c) 2002-2006 Gerd Hoffmann <kraxel@suse.de>
#
# main features:
# * autodependencies via "cpp -MD"
diff --git a/mk/Maintainer.mk b/mk/Maintainer.mk
index 5bf9480..62f02d6 100644
--- a/mk/Maintainer.mk
+++ b/mk/Maintainer.mk
@@ -1,7 +1,7 @@
# just some maintainer stuff for me ...
########################################################################
-make-sync-dir = $(HOME)/src/gnu-make
+make-sync-dir = $(HOME)/projects/gnu-makefiles
.PHONY: sync
sync:: distclean
diff --git a/mk/Variables.mk b/mk/Variables.mk
index 930f824..69486f3 100644
--- a/mk/Variables.mk
+++ b/mk/Variables.mk
@@ -29,9 +29,11 @@ INSTALL_DATA := $(INSTALL) -m 644
INSTALL_DIR := $(INSTALL) -d
# cflags
-CFLAGS ?= -g -O2
-CFLAGS += -Wall -Wmissing-prototypes -Wstrict-prototypes \
- -Wpointer-arith -Wunused
+CFLAGS ?= -g -O2
+CXXFLAGS ?= $(CFLAGS)
+CFLAGS += -Wall -Wmissing-prototypes -Wstrict-prototypes \
+ -Wpointer-arith -Wunused
+CXXFLAGS += -Wall -Wpointer-arith -Wunused
# add /usr/local to the search path if something is in there ...
ifneq ($(wildcard /usr/local/include/*.h),)
diff --git a/parseconfig.c b/parseconfig.c
index 60847c3..2ae403e 100644
--- a/parseconfig.c
+++ b/parseconfig.c
@@ -3,6 +3,8 @@
*
*/
+#include "config.h"
+
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -13,6 +15,7 @@
#include <sys/types.h>
#include "list.h"
+#include "misc.h"
#include "parseconfig.h"
struct cfg_entry {
@@ -38,23 +41,6 @@ struct cfg_domain {
LIST_HEAD(domains);
/* ------------------------------------------------------------------------ */
-/* prehistoric libc ;) */
-
-#ifndef HAVE_STRCASESTR
-char* strcasestr(char *haystack, char *needle)
-{
- int hlen = strlen(haystack);
- int nlen = strlen(needle);
- int offset;
-
- for (offset = 0; offset <= hlen - nlen; offset++)
- if (0 == strncasecmp(haystack+offset,needle,nlen))
- return haystack+offset;
- return NULL;
-}
-#endif
-
-/* ------------------------------------------------------------------------ */
/* internal stuff */
static struct cfg_domain *d_last;
@@ -270,10 +256,14 @@ cfg_set_str(char *dname, char *sname, char *ename, const char *value)
{
struct cfg_domain *domain = NULL;
struct cfg_section *section = NULL;
-
- domain = cfg_get_domain(dname);
- section = cfg_get_section(domain,sname);
- cfg_set_entry(section,ename,value);
+
+ if (NULL == value) {
+ cfg_del_entry(dname, sname, ename);
+ } else {
+ domain = cfg_get_domain(dname);
+ section = cfg_get_section(domain,sname);
+ cfg_set_entry(section,ename,value);
+ }
}
void
@@ -451,41 +441,41 @@ cfg_parse_cmdline(int *argc, char **argv, struct cfg_cmdline *opt)
}
void
-cfg_help_cmdline(struct cfg_cmdline *opt, int w1, int w2, int w3)
+cfg_help_cmdline(FILE *fp, struct cfg_cmdline *opt, int w1, int w2, int w3)
{
char *val;
int o,len;
for (o = 0; opt[o].cmdline != NULL; o++) {
- fprintf(stderr,"%*s",w1,"");
+ fprintf(fp,"%*s",w1,"");
if (opt[o].letter) {
- fprintf(stderr,"-%c ",opt[o].letter);
+ fprintf(fp,"-%c ",opt[o].letter);
} else {
- fprintf(stderr," ");
+ fprintf(fp," ");
}
if (opt[o].yesno) {
- len = fprintf(stderr,"-(no)%s ",opt[o].cmdline);
+ len = fprintf(fp,"-(no)%s ",opt[o].cmdline);
} else if (opt[o].needsarg) {
- len = fprintf(stderr,"-%s <arg> ",opt[o].cmdline);
+ len = fprintf(fp,"-%s <arg> ",opt[o].cmdline);
} else {
- len = fprintf(stderr,"-%s ",opt[o].cmdline);
+ len = fprintf(fp,"-%s ",opt[o].cmdline);
}
if (len < w2)
- fprintf(stderr,"%*s",w2-len,"");
+ fprintf(fp,"%*s",w2-len,"");
- len = fprintf(stderr,"%s ",opt[o].desc);
+ len = fprintf(fp,"%s ",opt[o].desc);
if (w3) {
if (len < w3)
- fprintf(stderr,"%*s",w3-len,"");
+ fprintf(fp,"%*s",w3-len,"");
val = cfg_get_str(opt[o].option.domain,
opt[o].option.section,
opt[o].option.entry);
if (val)
- fprintf(stderr,"[%s]",val);
+ fprintf(fp,"[%s]",val);
}
- fprintf(stderr,"\n");
+ fprintf(fp,"\n");
}
}
@@ -637,7 +627,7 @@ cfg_sections_prev(char *dname, char *current)
return section->name;
}
-int cfg_sections_count(char *dname)
+unsigned int cfg_sections_count(char *dname)
{
struct list_head *item;
struct cfg_domain *domain;
@@ -736,7 +726,7 @@ cfg_entries_prev(char *dname, char *sname, char *current)
return entry->name;
}
-int cfg_entries_count(char *dname, char *sname)
+unsigned int cfg_entries_count(char *dname, char *sname)
{
struct list_head *item;
struct cfg_section *section;
@@ -812,8 +802,8 @@ cfg_get_str(char *dname, char *sname, char *ename)
return entry->value;
}
-int
-cfg_get_int(char *dname, char *sname, char *ename, int def)
+unsigned int
+cfg_get_int(char *dname, char *sname, char *ename, unsigned int def)
{
char *val;
@@ -823,8 +813,8 @@ cfg_get_int(char *dname, char *sname, char *ename, int def)
return atoi(val);
}
-int
-cfg_get_signed_int(char *dname, char *sname, char *ename, unsigned int def)
+signed int
+cfg_get_signed_int(char *dname, char *sname, char *ename, signed int def)
{
char *val;
@@ -865,7 +855,7 @@ cfg_get_bool(char *dname, char *sname, char *ename, int def)
/* ------------------------------------------------------------------------ */
/* get/set flags */
-int cfg_get_sflags(char *dname, char *sname)
+unsigned int cfg_get_sflags(char *dname, char *sname)
{
struct cfg_section *section;
@@ -875,7 +865,7 @@ int cfg_get_sflags(char *dname, char *sname)
return section->flags;
}
-int cfg_get_eflags(char *dname, char *sname, char *ename)
+unsigned int cfg_get_eflags(char *dname, char *sname, char *ename)
{
struct cfg_entry *entry;
@@ -885,8 +875,8 @@ int cfg_get_eflags(char *dname, char *sname, char *ename)
return entry->flags;
}
-int cfg_set_sflags(char *dname, char *sname,
- unsigned int mask, unsigned int bits)
+unsigned int cfg_set_sflags(char *dname, char *sname,
+ unsigned int mask, unsigned int bits)
{
struct cfg_section *section;
@@ -898,8 +888,8 @@ int cfg_set_sflags(char *dname, char *sname,
return section->flags;
}
-int cfg_set_eflags(char *dname, char *sname, char *ename,
- unsigned int mask, unsigned int bits)
+unsigned int cfg_set_eflags(char *dname, char *sname, char *ename,
+ unsigned int mask, unsigned int bits)
{
struct cfg_entry *entry;
diff --git a/parseconfig.h b/parseconfig.h
index 2908d9a..12fd5a7 100644
--- a/parseconfig.h
+++ b/parseconfig.h
@@ -18,14 +18,15 @@ struct cfg_cmdline {
int yesno:1;
};
void cfg_parse_cmdline(int *argc, char **argv, struct cfg_cmdline *opt);
-void cfg_help_cmdline(struct cfg_cmdline *opt, int w1, int w2, int w3);
+void cfg_help_cmdline(FILE *fp, struct cfg_cmdline *opt, int w1, int w2, int w3);
/* file I/O */
int cfg_parse_file(char *dname, char *filename);
int cfg_write_file(char *dname, char *filename);
/* update */
-void cfg_set_str(char *dname, char *sname, char *ename, const char *value);
+void cfg_set_str(char *dname, char *sname, char *ename,
+ const char *value);
void cfg_set_int(char *dname, char *sname, char *ename, int value);
void cfg_set_bool(char *dname, char *sname, char *ename, int value);
@@ -36,14 +37,14 @@ void cfg_del_entry(char *dname, char *sname, char *ename);
char* cfg_sections_first(char *dname);
char* cfg_sections_next(char *dname, char *current);
char* cfg_sections_prev(char *dname, char *current);
-int cfg_sections_count(char *dname);
char* cfg_sections_index(char *dname, int i);
+unsigned int cfg_sections_count(char *dname);
char* cfg_entries_first(char *dname, char *sname);
char* cfg_entries_next(char *dname, char *sname, char *current);
char* cfg_entries_prev(char *dname, char *sname, char *current);
-int cfg_entries_count(char *dname, char *sname);
char* cfg_entries_index(char *dname, char *sname, int i);
+unsigned int cfg_entries_count(char *dname, char *sname);
#define cfg_sections_for_each(dname, item) \
for (item = cfg_sections_first(dname); NULL != item; \
@@ -53,18 +54,16 @@ char* cfg_search(char *dname, char *sname, char *ename, char *value);
/* read */
char* cfg_get_str(char *dname, char *sname, char *ename);
-int cfg_get_int(char *dname, char *sname, char *ename,
- int def);
-int cfg_get_signed_int(char *dname, char *sname, char *ename,
- unsigned int def);
-float cfg_get_float(char *dname, char *sname, char *ename,
- float def);
-int cfg_get_bool(char *dname, char *sname, char *ename,
- int def);
+unsigned int cfg_get_int(char *dname, char *sname,
+ char *ename, unsigned int def);
+signed int cfg_get_signed_int(char *dname, char *sname,
+ char *ename, signed int def);
+float cfg_get_float(char *dname, char *sname, char *ename, float def);
+int cfg_get_bool(char *dname, char *sname, char *ename, int def);
-int cfg_get_sflags(char *dname, char *sname);
-int cfg_get_eflags(char *dname, char *sname, char *ename);
-int cfg_set_sflags(char *dname, char *sname,
- unsigned int mask, unsigned int bits);
-int cfg_set_eflags(char *dname, char *sname, char *ename,
- unsigned int mask, unsigned int bits);
+unsigned int cfg_get_sflags(char *dname, char *sname);
+unsigned int cfg_get_eflags(char *dname, char *sname, char *ename);
+unsigned int cfg_set_sflags(char *dname, char *sname,
+ unsigned int mask, unsigned int bits);
+unsigned int cfg_set_eflags(char *dname, char *sname, char *ename,
+ unsigned int mask, unsigned int bits);
diff --git a/sane.c b/sane.c
index 585ac1c..911134d 100644
--- a/sane.c
+++ b/sane.c
@@ -37,7 +37,7 @@ build_menu(Widget widget, XtPointer clientdata, XtPointer call_data)
XtNnumChildren,&nchildren,
NULL);
wlist = malloc(sizeof(Widget*)*nchildren);
- memcpy(list,children,sizeof(Widget*)*nchildren);
+ memcpy(wlist,children,sizeof(Widget*)*nchildren);
for (i = 0; i < nchildren; i++)
XtDestroyWidget(wlist[i]);
free(wlist);