diff options
Diffstat (limited to 'test/demo.cxx')
-rw-r--r-- | test/demo.cxx | 32 |
1 files changed, 20 insertions, 12 deletions
diff --git a/test/demo.cxx b/test/demo.cxx index 5dda349..6821ac6 100644 --- a/test/demo.cxx +++ b/test/demo.cxx @@ -1,9 +1,9 @@ // -// "$Id: demo.cxx,v 1.8.2.5.2.9 2004/04/11 04:39:01 easysw Exp $" +// "$Id: demo.cxx 4723 2005-12-30 10:13:17Z matt $" // // Main demo program for the Fast Light Tool Kit (FLTK). // -// Copyright 1998-2004 by Bill Spitzak and others. +// Copyright 1998-2005 by Bill Spitzak and others. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Library General Public @@ -20,7 +20,9 @@ // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 // USA. // -// Please report all bugs and problems to "fltk-bugs@fltk.org". +// Please report all bugs and problems on the following page: +// +// http://www.fltk.org/str.php // #include <stdio.h> @@ -28,6 +30,10 @@ #include <stdlib.h> #if defined(WIN32) && !defined(__CYGWIN__) # include <direct.h> +// Visual C++ 2005 incorrectly displays a warning about the use of POSIX APIs +// on Windows, which is supposed to be POSIX compliant... +# define chdir _chdir +# define putenv _putenv #else # include <unistd.h> #endif @@ -158,7 +164,7 @@ int numb2but(int inumb, int maxnumb) /* Pushing and Popping menus */ char stack[64][32]; -char stsize = 0; +int stsize = 0; void push_menu(const char* nnn) /* Pushes a menu to be visible */ @@ -176,7 +182,8 @@ void push_menu(const char* nnn) if (menus[men].icommand[i][0] != '@') but[bn]->tooltip(menus[men].icommand[i]); else but[bn]->tooltip(0); } - strcpy(stack[stsize],nnn); + if (stack[stsize]!=nnn) + strcpy(stack[stsize],nnn); stsize++; } @@ -249,8 +256,8 @@ void dobut(Fl_Widget *, long arg) CreateProcess(NULL, command, NULL, NULL, FALSE, NORMAL_PRIORITY_CLASS, NULL, NULL, &suInfo, &prInfo); - delete command; - delete copy_of_icommand; + delete[] command; + delete[] copy_of_icommand; #else // NON WIN32 systems. @@ -260,7 +267,7 @@ void dobut(Fl_Widget *, long arg) sprintf(command, "./%s &", menus[men].icommand[bn]); system(command); - delete command; + delete[] command; #endif // WIN32 } } @@ -313,7 +320,7 @@ int load_the_menu(const char* fname) } int main(int argc, char **argv) { - putenv("FLTK_DOCDIR=../documentation"); + putenv((char *)"FLTK_DOCDIR=../documentation"); create_the_forms(); char buf[256]; strcpy(buf, argv[0]); @@ -326,11 +333,12 @@ int main(int argc, char **argv) { const char *fname = buf; int i = 0; if (!Fl::args(argc,argv,i) || i < argc-1) - Fl::fatal("Usage: %s <switches> <menufile>\n%s",Fl::help); + Fl::fatal("Usage: %s <switches> <menufile>\n%s",argv[0],Fl::help); if (i < argc) fname = argv[i]; if (!load_the_menu(fname)) Fl::fatal("Can't open %s",fname); - strcpy(buf,fname); + if (buf!=fname) + strcpy(buf,fname); const char *c = fl_filename_name(buf); if (c > buf) {buf[c-buf] = 0; chdir(buf);} push_menu("@main"); @@ -340,6 +348,6 @@ int main(int argc, char **argv) { } // -// End of "$Id: demo.cxx,v 1.8.2.5.2.9 2004/04/11 04:39:01 easysw Exp $". +// End of "$Id: demo.cxx 4723 2005-12-30 10:13:17Z matt $". // |