Add -g option to fltk-config.

Fix NULL filename bug in fl_file_chooser().


git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@2103 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
Michael R Sweet 2002-04-24 12:14:57 +00:00
parent 8d187b30e5
commit c90c981570
4 changed files with 36 additions and 14 deletions

View File

@ -1,5 +1,9 @@
CHANGES IN FLTK 1.1.0rc1
- fl_file_chooser() could cause a segfault when passed a
NULL filename parameter in some situations.
- Added a "-g" option to fltk-config to support quick
compiling with debugging enabled.
- Fixed redraw problem with Fl_Input and anti-aliased
text.
- Added threading support for MacOS X and Darwin.

View File

@ -1,4 +1,4 @@
.TH fltk-config 1 "Fast Light Tool Kit" "6 January 2002"
.TH fltk-config 1 "Fast Light Tool Kit" "24 April 2002"
.SH NAME
fltk-config \- script to get information about the installed version of fltk.
.sp
@ -9,7 +9,7 @@ fltk-config [ --prefix
.I [=DIR]
] [ --version ] [ --api-version ] [ --use-gl ] [ --use-images ] [ --use-glut ]
[ --cflags ] [ --cxxflags ] [ --ldflags ] [ --ldstaticflags ] [ --libs ]
[ --compile
[ -g ] [ --compile
.I program.cxx
] [ --post
.I program
@ -38,6 +38,11 @@ files that use FLTK.
Compiles the source file \fIprogram.cxx\fR into \fIprogram\fR.
This option implies "--post \fIprogram\fR".
.TP 5
-g
.br
Enables debugging information when compiling with the \fI--compile\fR
option.
.TP 5
--ldflags
.br
Displays the linker options to use when linking a FLTK

View File

@ -1,6 +1,6 @@
#! /bin/sh
#
# "$Id: fltk-config.in,v 1.12.2.9 2002/03/25 21:39:01 easysw Exp $"
# "$Id: fltk-config.in,v 1.12.2.10 2002/04/24 12:14:57 easysw Exp $"
#
# FLTK configuration utility.
#
@ -85,6 +85,7 @@ Options telling what information we request:
[--libs] return FLTK libraries full path for dependencies
Option to compile and link an application:
[-g] compile the program with debugging information
[--compile program.cxx]
[--post program]
"
@ -97,6 +98,7 @@ fi
no_plugins=no
compile=
post=
debug=
# Parse command line options
while test $# -gt 0
@ -153,6 +155,9 @@ do
--libs)
echo_libs=yes
;;
-g)
debug=-g
;;
--compile)
compile=$2
post=$2
@ -230,8 +235,8 @@ if test -n "$compile"; then
post=$prog
echo $CXX $CXXFLAGS -o $prog $compile $LDSTATIC
$CXX $CXXFLAGS -o $prog $compile $LDSTATIC
echo $CXX $CXXFLAGS $debug -o $prog $compile $LDSTATIC
$CXX $CXXFLAGS $debug -o $prog $compile $LDSTATIC
fi
if test -n "$post" -a "$POSTBUILD" != ":"; then

View File

@ -1,5 +1,5 @@
//
// "$Id: fl_file_dir.cxx,v 1.1.2.7 2002/03/25 21:08:42 easysw Exp $"
// "$Id: fl_file_dir.cxx,v 1.1.2.8 2002/04/24 12:14:57 easysw Exp $"
//
// File chooser widget for the Fast Light Tool Kit (FLTK).
//
@ -55,16 +55,24 @@ char* fl_file_chooser(const char* message, const char* pat, const char* fname)
} else {
if (!fname || !*fname) {
if (fc->filter() != pat && (!pat || !fc->filter() ||
strcmp(pat, fc->filter()))) {
strcmp(pat, fc->filter())) && fc->value()) {
// if pattern is different, remove name but leave old directory:
char* p = (char *)fc->value();
const char* q = fl_filename_name(p);
int i;
strncpy(retname, fc->value(), sizeof(retname) - 1);
retname[sizeof(retname) - 1] = '\0';
if (q == NULL) i = 0;
else i = strlen(q);
char *p = strrchr(retname, '/');
p[i] = 0;
if (p) {
// If the filename is "/foo", then the directory will be "/", not
// ""...
if (p == retname)
retname[1] = '\0';
else
*p = '\0';
}
// Set the directory...
fc->directory(retname);
}
}
else
@ -119,5 +127,5 @@ char* fl_dir_chooser(const char* message, const char* fname)
//
// End of "$Id: fl_file_dir.cxx,v 1.1.2.7 2002/03/25 21:08:42 easysw Exp $".
// End of "$Id: fl_file_dir.cxx,v 1.1.2.8 2002/04/24 12:14:57 easysw Exp $".
//