# HG changeset patch # User John W. Eaton # Date 1285226133 14400 # Node ID b4ed4fe70c2c1a214b31ad325ebd59631630ab11 # Parent 92bb25c0da9e32c64b72105f67a08fec010919fa eliminate octave-bug script/program diff -r 92bb25c0da9e -r b4ed4fe70c2c ChangeLog --- a/ChangeLog Wed Sep 22 18:06:21 2010 -0400 +++ b/ChangeLog Thu Sep 23 03:15:33 2010 -0400 @@ -1,3 +1,13 @@ +2010-09-23 John W. Eaton + + * octave-bug.in, octave-bug.cc.in: Delete + * Makefile.am (EXTRA_DIST): Remove them from the list. + (bin_PROGRAMS): Remove octave-bug from the list. + (octave_bug_SOURCES, nodist_octave_bug_SOURCES): Delete variables. + (BUILT_SOURCES): Remove octave-bug.cc from the list. + (bin_SCRIPTS): Remove octave-bug from the list. + (octave-bug.cc, octave-bug): Delete rules. + 2010-09-20 John W. Eaton * bootstrap.conf (gnulib_modules): Include mktime in the list. diff -r 92bb25c0da9e -r b4ed4fe70c2c Makefile.am --- a/Makefile.am Wed Sep 22 18:06:21 2010 -0400 +++ b/Makefile.am Thu Sep 23 03:15:33 2010 -0400 @@ -57,8 +57,6 @@ mkoctfile.cc.in \ mkoctfile.in \ move-if-change \ - octave-bug.cc.in \ - octave-bug.in \ octave-config.cc.in \ octave-config.in \ octave-sh \ @@ -78,8 +76,7 @@ if AMCOND_BUILD_COMPILED_AUX_PROGRAMS bin_PROGRAMS = \ mkoctfile \ - octave-config \ - octave-bug + octave-config mkoctfile_SOURCES = nodist_mkoctfile_SOURCES = mkoctfile.cc @@ -87,20 +84,15 @@ octave_config_SOURCES = nodist_octave_config_SOURCES = octave-config.cc -octave_bug_SOURCES = -nodist_octave_bug_SOURCES = octave-bug.cc - BUILT_SOURCES = \ mkoctfile.cc \ octave-config.cc \ - octave-bug.cc \ run-octave else bin_SCRIPTS = \ mkoctfile \ octave-config \ - octave-bug \ run-octave BUILT_SOURCES = \ @@ -131,19 +123,12 @@ @echo "" if AMCOND_BUILD_COMPILED_AUX_PROGRAMS -octave-bug.cc: octave-bug.cc.in Makefile - @$(do_subst_config_vals) - octave-config.cc: octave-config.cc.in Makefile @$(do_subst_default_vals) mkoctfile.cc: mkoctfile.cc.in Makefile @$(do_subst_config_vals) else -octave-bug: octave-bug.in Makefile - @$(do_subst_config_vals) - chmod a+rx $@ - octave-config: octave-config.in Makefile @$(do_subst_default_vals) chmod a+rx $@ diff -r 92bb25c0da9e -r b4ed4fe70c2c octave-bug.cc.in --- a/octave-bug.cc.in Wed Sep 22 18:06:21 2010 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,435 +0,0 @@ -/* - -Copyright (C) 2008, 2009 Michael Goffioul - -This file is part of Octave. - -Octave is free software; you can redistribute it and/or modify it -under the terms of the GNU General Public License as published by the -Free Software Foundation; either version 3 of the License, or (at your -option) any later version. - -Octave is distributed in the hope that it will be useful, but WITHOUT -ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -for more details. - -You should have received a copy of the GNU General Public License -along with Octave; see the file COPYING. If not, see -. - -*/ - -#include -#include -#include -#include -#include - -#include -#include -#include - -using namespace std; - -static map vars; - -static void -usage (void) -{ - cerr << "usage: octave-bug [-s subject]" << endl; - exit (-1); -} - -static void -error (const string& msg) -{ - cerr << "error: " << msg << endl; - exit (-1); -} - -static void -warning (const string& msg) -{ - cerr << "warning: " << msg << endl; -} - -static string -get_env_variable (const char *name) -{ - char *value = ::getenv (name); - if (value) - return string (value); - else - return string (""); -} - -inline bool -starts_with (const string& s, const string& prefix) -{ - return (s.length () >= prefix.length () && s.find (prefix) == 0); -} - -int -main (int argc, char **argv) -{ - int arg_idx = 1; - - vars["config_optvars"] = %OCTAVE_CONF_config_opts%; - vars["VERSION"] = %OCTAVE_CONF_VERSION%; - vars["SED"] = %OCTAVE_CONF_SED%; - vars["MACHINE"] = %OCTAVE_CONF_CANONICAL_HOST_TYPE%; - vars["F77"] = %OCTAVE_CONF_F77%; - vars["FFLAGS"] = %OCTAVE_CONF_FFLAGS%; - vars["FPICFLAG"] = %OCTAVE_CONF_FPICFLAG%; - vars["FLIBS"] = %OCTAVE_CONF_FLIBS%; - vars["CPPFLAGS"] = %OCTAVE_CONF_CPPFLAGS%; - vars["INCFLAGS"] = %OCTAVE_CONF_INCFLAGS%; - vars["CC"] = %OCTAVE_CONF_CC%; - vars["CC_VERSION"] = %OCTAVE_CONF_CC_VERSION%; - vars["CFLAGS"] = %OCTAVE_CONF_CFLAGS%; - vars["CPICFLAG"] = %OCTAVE_CONF_CPICFLAG%; - vars["CXX"] = %OCTAVE_CONF_CXX%; - vars["CXX_VERSION"] = %OCTAVE_CONF_CXX_VERSION%; - vars["CXXFLAGS"] = %OCTAVE_CONF_CXXFLAGS%; - vars["CXXPICFLAG"] = %OCTAVE_CONF_CXXPICFLAG%; - vars["LD_CXX"] = %OCTAVE_CONF_LD_CXX%; - vars["LDFLAGS"] = %OCTAVE_CONF_LDFLAGS%; - vars["LIBFLAGS"] = %OCTAVE_CONF_LIBFLAGS%; - vars["RLD_FLAG"] = %OCTAVE_CONF_RLD_FLAG%; - vars["LIBS"] = %OCTAVE_CONF_LIBS%; - vars["LEXLIB"] = %OCTAVE_CONF_LEXLIB%; - - vars["AMD_CPPFLAGS"] = %OCTAVE_CONF_AMD_CPPFLAGS%; - vars["AMD_LDFLAGS"] = %OCTAVE_CONF_AMD_LDFLAGS%; - vars["AMD_LIBS"] = %OCTAVE_CONF_AMD_LIBS%; - vars["ARPACK_CPPFLAGS"] = %OCTAVE_CONF_ARPACK_CPPFLAGS%; - vars["ARPACK_LDFLAGS"] = %OCTAVE_CONF_ARPACK_LDFLAGS%; - vars["ARPACK_LIBS"] = %OCTAVE_CONF_ARPACK_LIBS%; - vars["BLAS_LIBS"] = %OCTAVE_CONF_BLAS_LIBS%; - vars["CAMD_CPPFLAGS"] = %OCTAVE_CONF_CAMD_CPPFLAGS%; - vars["CAMD_LDFLAGS"] = %OCTAVE_CONF_CAMD_LDFLAGS%; - vars["CAMD_LIBS"] = %OCTAVE_CONF_CAMD_LIBS%; - vars["CARBON_LIBS"] = %OCTAVE_CONF_CARBON_LIBS%; - vars["CCOLAMD_CPPFLAGS"] = %OCTAVE_CONF_CCOLAMD_CPPFLAGS%; - vars["CCOLAMD_LDFLAGS"] = %OCTAVE_CONF_CCOLAMD_LDFLAGS%; - vars["CCOLAMD_LIBS"] = %OCTAVE_CONF_CCOLAMD_LIBS%; - vars["CHOLMOD_CPPFLAGS"] = %OCTAVE_CONF_CHOLMOD_CPPFLAGS%; - vars["CHOLMOD_LDFLAGS"] = %OCTAVE_CONF_CHOLMOD_LDFLAGS%; - vars["CHOLMOD_LIBS"] = %OCTAVE_CONF_CHOLMOD_LIBS%; - vars["COLAMD_CPPFLAGS"] = %OCTAVE_CONF_COLAMD_CPPFLAGS%; - vars["COLAMD_LDFLAGS"] = %OCTAVE_CONF_COLAMD_LDFLAGS%; - vars["COLAMD_LIBS"] = %OCTAVE_CONF_COLAMD_LIBS%; - vars["CURL_CPPFLAGS"] = %OCTAVE_CONF_CURL_CPPFLAGS%; - vars["CURL_LDFLAGS"] = %OCTAVE_CONF_CURL_LDFLAGS%; - vars["CURL_LIBS"] = %OCTAVE_CONF_CURL_LIBS%; - vars["CXSPARSE_CPPFLAGS"] = %OCTAVE_CONF_CXSPARSE_CPPFLAGS%; - vars["CXSPARSE_LDFLAGS"] = %OCTAVE_CONF_CXSPARSE_LDFLAGS%; - vars["CXSPARSE_LIBS"] = %OCTAVE_CONF_CXSPARSE_LIBS%; - vars["DL_LIBS"] = %OCTAVE_CONF_DL_LIBS%; - vars["FFTW3_CPPFLAGS"] = %OCTAVE_CONF_FFTW3_CPPFLAGS%; - vars["FFTW3_LDFLAGS"] = %OCTAVE_CONF_FFTW3_LDFLAGS%; - vars["FFTW3_LIBS"] = %OCTAVE_CONF_FFTW3_LIBS%; - vars["FFTW3F_CPPFLAGS"] = %OCTAVE_CONF_FFTW3F_CPPFLAGS%; - vars["FFTW3F_LDFLAGS"] = %OCTAVE_CONF_FFTW3F_LDFLAGS%; - vars["FFTW3F_LIBS"] = %OCTAVE_CONF_FFTW3F_LIBS%; - vars["GRAPHICS_LIBS"] = %OCTAVE_CONF_GRAPHICS_LIBS%; - vars["GLPK_CPPFLAGS"] = %OCTAVE_CONF_GLPK_CPPFLAGS%; - vars["GLPK_LDFLAGS"] = %OCTAVE_CONF_GLPK_LDFLAGS%; - vars["GLPK_LIBS"] = %OCTAVE_CONF_GLPK_LIBS%; - vars["HDF5_CPPFLAGS"] = %OCTAVE_CONF_HDF5_CPPFLAGS%; - vars["HDF5_LDFLAGS"] = %OCTAVE_CONF_HDF5_LDFLAGS%; - vars["HDF5_LIBS"] = %OCTAVE_CONF_HDF5_LIBS%; - vars["OPENGL_LIBS"] = %OCTAVE_CONF_OPENGL_LIBS%; - vars["PTHREAD_CFLAGS"] = %OCTAVE_CONF_PTHREAD_CFLAGS%; - vars["PTHREAD_LIBS"] = %OCTAVE_CONF_PTHREAD_LIBS%; - vars["QHULL_CPPFLAGS"] = %OCTAVE_CONF_QHULL_CPPFLAGS%; - vars["QHULL_LDFLAGS"] = %OCTAVE_CONF_QHULL_LDFLAGS%; - vars["QHULL_LIBS"] = %OCTAVE_CONF_QHULL_LIBS%; - vars["QRUPDATE_CPPFLAGS"] = %OCTAVE_CONF_QRUPDATE_CPPFLAGS%; - vars["QRUPDATE_LDFLAGS"] = %OCTAVE_CONF_QRUPDATE_LDFLAGS%; - vars["QRUPDATE_LIBS"] = %OCTAVE_CONF_QRUPDATE_LIBS%; - vars["READLINE_LIBS"] = %OCTAVE_CONF_READLINE_LIBS%; - vars["REGEX_LIBS"] = %OCTAVE_CONF_REGEX_LIBS%; - vars["TERM_LIBS"] = %OCTAVE_CONF_TERM_LIBS%; - vars["UMFPACK_CPPFLAGS"] = %OCTAVE_CONF_UMFPACK_CPPFLAGS%; - vars["UMFPACK_LDFLAGS"] = %OCTAVE_CONF_UMFPACK_LDFLAGS%; - vars["UMFPACK_LIBS"] = %OCTAVE_CONF_UMFPACK_LIBS%; - vars["X11_INCFLAGS"] = %OCTAVE_CONF_X11_INCFLAGS%; - vars["X11_LIBS"] = %OCTAVE_CONF_X11_LIBS%; - vars["Z_CPPFLAGS"] = %OCTAVE_CONF_Z_CPPFLAGS%; - vars["Z_LDFLAGS"] = %OCTAVE_CONF_Z_LDFLAGS%; - vars["Z_LIBS"] = %OCTAVE_CONF_Z_LIBS%; - - vars["DEFS"] = %OCTAVE_CONF_DEFS%; - - vars["USER"] = get_env_variable ("LOGNAME"); - if (vars["USER"].empty ()) - vars["USER"] = get_env_variable ("USERNAME"); - - vars["CC_AND_VERSION"] = (vars["CC"] + ", version" + vars["CC_VERSION"]); - - vars["CXX_AND_VERSION"] = (vars["CXX"] + ", version" + vars["CXX_VERSION"]); - - // FIXME -- could be obtained from OS. - vars["UN"] = "Windows"; - - // FIXME -- the shell script also checks the minor version number, - // and if it is greater than or equal to 90, it is assumed that this - // version of Octave is a test release and bugs should go to the - // maintainers@octave.org list instead of bugs. - if (starts_with (vars["VERSION"], "ss")) - vars["BUGADDR"] = "maintainers@octave.org"; - else - vars["BUGADDR"] = "bug@octave.org"; - - vars["SUBJECT"] = "[50 character or so descriptive subject here (for reference)]"; - if (arg_idx < argc && strcmp (argv[arg_idx], "-s") == 0) - { - arg_idx++; - if (arg_idx < argc) - vars["SUBJECT"] = argv[arg_idx++]; - else - usage (); - } - - ostringstream os; - - os << "Bug report for Octave " << vars["VERSION"] << " configured for " << vars["MACHINE"] << endl; - os << endl; - os << "Description:" << endl; - os << "-----------" << endl; - os << endl; - os << " * Please replace this item with a detailed description of the" << endl; - os << " problem. Suggestions or general comments are also welcome." << endl; - os << endl; - os << "Repeat-By:" << endl; - os << "---------" << endl; - os << endl; - os << " * Please replace this item with a description of the sequence of" << endl; - os << " events that causes the problem to occur. " << endl; - os << endl; - os << "Fix:" << endl; - os << "---" << endl; - os << endl; - os << " * If possible, replace this item with a description of how to" << endl; - os << " fix the problem (if you don't have a fix for the problem, don't" << endl; - os << " include this section, but please do submit your report anyway)." << endl; - os << endl; - os << endl; - os << endl; - os << "Configuration (please do not edit this section):" << endl; - os << "-----------------------------------------------" << endl; - os << endl; - os << "uname output: " << vars["UN"] << endl; - os << "SED: " << vars["SED"] << endl; - os << "configure opts: " << vars["config_opts"] << endl; - os << "Fortran compiler: " << vars["F77"] << endl; - os << "FFLAGS: " << vars["FFLAGS"] << endl; - os << "FLIBS: " << vars["FLIBS"] << endl; - os << "CPPFLAGS: " << vars["CPPFLAGS"] << endl; - os << "INCFLAGS: " << vars["INCFLAGS"] << endl; - os << "C compiler: " << vars["CC_AND_VERSION"] << endl; - os << "CFLAGS: " << vars["CFLAGS"] << endl; - os << "CPICFLAG: " << vars["CPICFLAG"] << endl; - os << "C++ compiler: " << vars["CXX_AND_VERSION"] << endl; - os << "CXXFLAGS: " << vars["CXXFLAGS"] << endl; - os << "CXXPICFLAG: " << vars["CXXPICFLAG"] << endl; - os << "LD_CXX: " << vars["LD_CXX"] << endl; - os << "LDFLAGS: " << vars["LDFLAGS"] << endl; - os << "LIBFLAGS: " << vars["LIBFLAGS"] << endl; - os << "RLD_FLAG: " << vars["RLD_FLAG"] << endl; - os << "BLAS_LIBS: " << vars["BLAS_LIBS"] << endl; - os << "FFTW_LIBS: " << vars["FFTW_LIBS"] << endl; - os << "LEXLIB: " << vars["LEXLIB"] << endl; - os << "LIBS: " << vars["LIBS"] << endl; - os << "AMD_CPPFLAGS: " << vars["AMD_CPPFLAGS"] << endl; - os << "AMD_LDFLAGS: " << vars["AMD_LDFLAGS"] << endl; - os << "AMD_LIBS: " << vars["AMD_LIBS"] << endl; - os << "ARPACK_LIBS: " << vars["ARPACK_LIBS"] << endl; - os << "BLAS_LIBS: " << vars["BLAS_LIBS"] << endl; - os << "CAMD_CPPFLAGS: " << vars["CAMD_CPPFLAGS"] << endl; - os << "CAMD_LDFLAGS: " << vars["CAMD_LDFLAGS"] << endl; - os << "CAMD_LIBS: " << vars["CAMD_LIBS"] << endl; - os << "CARBON_LIBS: " << vars["CARBON_LIBS"] << endl; - os << "CCOLAMD_CPPFLAGS: " << vars["CCOLAMD_CPPFLAGS"] << endl; - os << "CCOLAMD_LDFLAGS: " << vars["CCOLAMD_LDFLAGS"] << endl; - os << "CCOLAMD_LIBS: " << vars["CCOLAMD_LIBS"] << endl; - os << "CHOLMOD_CPPFLAGS: " << vars["CHOLMOD_CPPFLAGS"] << endl; - os << "CHOLMOD_LDFLAGS: " << vars["CHOLMOD_LDFLAGS"] << endl; - os << "CHOLMOD_LIBS: " << vars["CHOLMOD_LIBS"] << endl; - os << "COLAMD_CPPFLAGS: " << vars["COLAMD_CPPFLAGS"] << endl; - os << "COLAMD_LDFLAGS: " << vars["COLAMD_LDFLAGS"] << endl; - os << "COLAMD_LIBS: " << vars["COLAMD_LIBS"] << endl; - os << "CURL_CPPFLAGS: " << vars["CURL_CPPFLAGS"] << endl; - os << "CURL_LDFLAGS: " << vars["CURL_LDFLAGS"] << endl; - os << "CURL_LIBS: " << vars["CURL_LIBS"] << endl; - os << "CXSPARSE_CPPFLAGS: " << vars["CXSPARSE_CPPFLAGS"] << endl; - os << "CXSPARSE_LDFLAGS: " << vars["CXSPARSE_LDFLAGS"] << endl; - os << "CXSPARSE_LIBS: " << vars["CXSPARSE_LIBS"] << endl; - os << "DL_LIBS: " << vars["DL_LIBS"] << endl; - os << "FFTW3_CPPFLAGS: " << vars["FFTW3_CPPFLAGS"] << endl; - os << "FFTW3_LDFLAGS: " << vars["FFTW3_LDFLAGS"] << endl; - os << "FFTW3_LIBS: " << vars["FFTW3_LIBS"] << endl; - os << "FFTW3F_CPPFLAGS: " << vars["FFTW3F_CPPFLAGS"] << endl; - os << "FFTW3F_LDFLAGS: " << vars["FFTW3F_LDFLAGS"] << endl; - os << "FFTW3F_LIBS: " << vars["FFTW3F_LIBS"] << endl; - os << "GRAPHICS_LIBS: " << vars["GRAPHICS_LIBS"] << endl; - os << "GLPK_CPPFLAGS: " << vars["GLPK_CPPFLAGS"] << endl; - os << "GLPK_LDFLAGS: " << vars["GLPK_LDFLAGS"] << endl; - os << "GLPK_LIBS: " << vars["GLPK_LIBS"] << endl; - os << "HDF5_CPPFLAGS: " << vars["HDF5_CPPFLAGS"] << endl; - os << "HDF5_LDFLAGS: " << vars["HDF5_LDFLAGS"] << endl; - os << "HDF5_LIBS: " << vars["HDF5_LIBS"] << endl; - os << "OPENGL_LIBS: " << vars["OPENGL_LIBS"] << endl; - os << "PTHREAD_CFLAGS: " << vars["PTHREAD_CFLAGS"] << endl; - os << "PTHREAD_LIBS: " << vars["PTHREAD_LIBS"] << endl; - os << "QHULL_CPPFLAGS: " << vars["QHULL_CPPFLAGS"] << endl; - os << "QHULL_LDFLAGS: " << vars["QHULL_LDFLAGS"] << endl; - os << "QHULL_LIBS: " << vars["QHULL_LIBS"] << endl; - os << "QRUPDATE_LIBS: " << vars["QRUPDATE_LIBS"] << endl; - os << "READLINE_LIBS: " << vars["READLINE_LIBS"] << endl; - os << "REGEX_LIBS: " << vars["REGEX_LIBS"] << endl; - os << "TERM_LIBS: " << vars["TERM_LIBS"] << endl; - os << "UMFPACK_LIBS: " << vars["UMFPACK_LIBS"] << endl; - os << "X11_INCFLAGS: " << vars["X11_INCFLAGS"] << endl; - os << "X11_LIBS: " << vars["X11_LIBS"] << endl; - os << "Z_CPPFLAGS: " << vars["Z_CPPFLAGS"] << endl; - os << "Z_LDFLAGS: " << vars["Z_LDFLAGS"] << endl; - os << "Z_LIBS: " << vars["Z_LIBS"] << endl; - os << "DEFS:" << endl << vars["DEFS"] << endl; - os << endl; - - if (arg_idx < argc) - { - os << endl; - os << "User-preferences (please do not edit this section):" << endl; - os << endl; - - ifstream is (argv[arg_idx++]); - - if (! is.fail ()) - { - string line; - - while (! is.eof ()) - { - getline (is, line); - os << line << endl; - } - } - else - { - string msg ("unable to open file for reading: "); - - msg += argv[arg_idx-1]; - warning (msg); - } - } - - string content = os.str (), msg; - - // Now go for MAPI stuff. - - HMODULE hMapi; - LHANDLE session; - LPMAPILOGON mapiLogon; - LPMAPILOGOFF mapiLogoff; - LPMAPISENDMAIL mapiSendMail; - - hMapi = LoadLibrary ("mapi32.dll"); - if (hMapi != NULL) - { - mapiLogon = (LPMAPILOGON) GetProcAddress (hMapi, "MAPILogon"); - mapiLogoff = (LPMAPILOGOFF) GetProcAddress (hMapi, "MAPILogoff"); - mapiSendMail = (LPMAPISENDMAIL) GetProcAddress (hMapi, "MAPISendMail"); - - if (mapiLogon != NULL && mapiLogoff != NULL - && mapiSendMail != NULL) - { - ULONG result = 0; - - if ((result = mapiLogon (0, "", "", MAPI_LOGON_UI, 0, &session)) == SUCCESS_SUCCESS) - { - MapiMessage mmsg; - MapiRecipDesc mrecip[2]; - - ZeroMemory (&mmsg, sizeof (mmsg)); - ZeroMemory (&mrecip, sizeof (mrecip)); - - mmsg.lpszSubject = strdup (vars["SUBJECT"].c_str ()); - mmsg.lpszNoteText = strdup (content.c_str ()); - mmsg.nRecipCount = 1; - mmsg.lpRecips = mrecip; - - mrecip[0].ulRecipClass = MAPI_TO; - mrecip[0].lpszName = "Octave"; - mrecip[0].lpszAddress = strdup (vars["BUGADDR"].c_str ()); - - if (! vars["USER"].empty ()) - { - mmsg.nRecipCount = 2; - mrecip[1].ulRecipClass = MAPI_CC; - mrecip[1].lpszName = strdup (vars["USER"].c_str ()); - } - - if ((result = mapiSendMail (session, 0, &mmsg, MAPI_DIALOG, 0)) != SUCCESS_SUCCESS - && result != MAPI_USER_ABORT) - msg = "mail not sent"; - - free (mmsg.lpszSubject); - free (mmsg.lpszNoteText); - free (mrecip[0].lpszAddress); - if (mmsg.nRecipCount > 1) - free (mrecip[1].lpszName); - - mapiLogoff (session, 0, 0, 0); - } - else - msg = "cannot logon to MAPI service"; - - if (! msg.empty ()) - { - char buf[64]; - _snprintf (buf, 63, "%08x", result); - msg += (" (result: " + string (buf) + ")"); - } - } - else - msg = "cannot find entry points in MAPI library"; - - FreeLibrary (hMapi); - } - else - msg = "unable to find MAPI service"; - - if (! msg.empty ()) - { - warning (msg); - - string tmpfile = _tempnam (NULL, "octave-"); - ofstream ofs (tmpfile.c_str ()); - - if (! ofs.fail ()) - { - ofs << content; - ofs.close (); - - warning (""); - warning ("the mail could not be sent to octave; a text editor should appear"); - warning ("with the content of the bug report; please copy it and paste it"); - warning ("manually into your mail client and send it to the following"); - warning ("address: " + vars["BUGADDR"]); - - string cmd ("notepad "); - - cmd += tmpfile; - ::system (cmd.c_str ()); - ::unlink (tmpfile.c_str ()); - } - else - error ("unable to open file for writing: " + tmpfile); - } - - return 0; -} diff -r 92bb25c0da9e -r b4ed4fe70c2c octave-bug.in --- a/octave-bug.in Wed Sep 22 18:06:21 2010 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,503 +0,0 @@ -#! /bin/sh - -# -# Copyright (C) 1994, 1995, 1996, 1997, 1998, 2000, 2001, 2002, 2004, -# 2005, 2006, 2009 John W. Eaton -# -# This file is part of Octave. -# -# Octave is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by the -# Free Software Foundation; either version 3 of the License, or (at -# your option) any later version. -# -# Octave is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# for more details. -# -# You should have received a copy of the GNU General Public License -# along with Octave; see the file COPYING. If not, see -# . - -# octave-bug - create a bug report and mail it to the bug-octave -# mailing list. -# -# Patterned after the bashbug script from bash 1.14. - -# Configuration: these variables are filled in when running make to -# compile Octave. - -config_opts=%OCTAVE_CONF_config_opts% -VERSION=%OCTAVE_CONF_VERSION% -SED=%OCTAVE_CONF_SED% -MACHINE=%OCTAVE_CONF_CANONICAL_HOST_TYPE% -F77=%OCTAVE_CONF_F77% -FFLAGS=%OCTAVE_CONF_FFLAGS% -FPICFLAG=%OCTAVE_CONF_FPICFLAG% -FLIBS=%OCTAVE_CONF_FLIBS% -CPPFLAGS=%OCTAVE_CONF_CPPFLAGS% -INCFLAGS=%OCTAVE_CONF_INCFLAGS% -CC=%OCTAVE_CONF_CC% -CC_VERSION=%OCTAVE_CONF_CC_VERSION% -CFLAGS=%OCTAVE_CONF_CFLAGS% -CPICFLAG=%OCTAVE_CONF_CPICFLAG% -CXX=%OCTAVE_CONF_CXX% -CXX_VERSION=%OCTAVE_CONF_CXX_VERSION% -CXXFLAGS=%OCTAVE_CONF_CXXFLAGS% -CXXPICFLAG=%OCTAVE_CONF_CXXPICFLAG% -LD_CXX=%OCTAVE_CONF_LD_CXX% -LDFLAGS=%OCTAVE_CONF_LDFLAGS% -LIBFLAGS=%OCTAVE_CONF_LIBFLAGS% -RLD_FLAG=%OCTAVE_CONF_RLD_FLAG% -LEXLIB=%OCTAVE_CONF_LEXLIB% -LIBS=%OCTAVE_CONF_LIBS% - -AMD_CPPFLAGS=%OCTAVE_CONF_AMD_CPPFLAGS% -AMD_LDFLAGS=%OCTAVE_CONF_AMD_LDFLAGS% -AMD_LIBS=%OCTAVE_CONF_AMD_LIBS% -ARPACK_CPPFLAGS=%OCTAVE_CONF_ARPACK_CPPFLAGS% -ARPACK_LDFLAGS=%OCTAVE_CONF_ARPACK_LDFLAGS% -ARPACK_LIBS=%OCTAVE_CONF_ARPACK_LIBS% -BLAS_LIBS=%OCTAVE_CONF_BLAS_LIBS% -CAMD_CPPFLAGS=%OCTAVE_CONF_CAMD_CPPFLAGS% -CAMD_LDFLAGS=%OCTAVE_CONF_CAMD_LDFLAGS% -CAMD_LIBS=%OCTAVE_CONF_CAMD_LIBS% -CARBON_LIBS=%OCTAVE_CONF_CARBON_LIBS% -CCOLAMD_CPPFLAGS=%OCTAVE_CONF_CCOLAMD_CPPFLAGS% -CCOLAMD_LDFLAGS=%OCTAVE_CONF_CCOLAMD_LDFLAGS% -CCOLAMD_LIBS=%OCTAVE_CONF_CCOLAMD_LIBS% -CHOLMOD_CPPFLAGS=%OCTAVE_CONF_CHOLMOD_CPPFLAGS% -CHOLMOD_LDFLAGS=%OCTAVE_CONF_CHOLMOD_LDFLAGS% -CHOLMOD_LIBS=%OCTAVE_CONF_CHOLMOD_LIBS% -COLAMD_CPPFLAGS=%OCTAVE_CONF_COLAMD_CPPFLAGS% -COLAMD_LDFLAGS=%OCTAVE_CONF_COLAMD_LDFLAGS% -COLAMD_LIBS=%OCTAVE_CONF_COLAMD_LIBS% -CURL_CPPFLAGS=%OCTAVE_CONF_CURL_CPPFLAGS% -CURL_LDFLAGS=%OCTAVE_CONF_CURL_LDFLAGS% -CURL_LIBS=%OCTAVE_CONF_CURL_LIBS% -CXSPARSE_CPPFLAGS=%OCTAVE_CONF_CXSPARSE_CPPFLAGS% -CXSPARSE_LDFLAGS=%OCTAVE_CONF_CXSPARSE_LDFLAGS% -CXSPARSE_LIBS=%OCTAVE_CONF_CXSPARSE_LIBS% -DL_LIBS=%OCTAVE_CONF_DL_LIBS% -FFTW3_CPPFLAGS=%OCTAVE_CONF_FFTW3_CPPFLAGS% -FFTW3_LDFLAGS=%OCTAVE_CONF_FFTW3_LDFLAGS% -FFTW3_LIBS=%OCTAVE_CONF_FFTW3_LIBS% -FFTW3F_CPPFLAGS=%OCTAVE_CONF_FFTW3F_CPPFLAGS% -FFTW3F_LDFLAGS=%OCTAVE_CONF_FFTW3F_LDFLAGS% -FFTW3F_LIBS=%OCTAVE_CONF_FFTW3F_LIBS% -GRAPHICS_LIBS=%OCTAVE_CONF_GRAPHICS_LIBS% -GLPK_CPPFLAGS=%OCTAVE_CONF_GLPK_CPPFLAGS% -GLPK_LDFLAGS=%OCTAVE_CONF_GLPK_LDFLAGS% -GLPK_LIBS=%OCTAVE_CONF_GLPK_LIBS% -HDF5_CPPFLAGS=%OCTAVE_CONF_HDF5_CPPFLAGS% -HDF5_LDFLAGS=%OCTAVE_CONF_HDF5_LDFLAGS% -HDF5_LIBS=%OCTAVE_CONF_HDF5_LIBS% -OPENGL_LIBS=%OCTAVE_CONF_OPENGL_LIBS% -PTHREAD_CFLAGS=%OCTAVE_CONF_PTHREAD_CFLAGS% -PTHREAD_LIBS=%OCTAVE_CONF_PTHREAD_LIBS% -QHULL_CPPFLAGS=%OCTAVE_CONF_QHULL_CPPFLAGS% -QHULL_LDFLAGS=%OCTAVE_CONF_QHULL_LDFLAGS% -QHULL_LIBS=%OCTAVE_CONF_QHULL_LIBS% -QRUPDATE_CPPFLAGS=%OCTAVE_CONF_QRUPDATE_CPPFLAGS% -QRUPDATE_LDFLAGS=%OCTAVE_CONF_QRUPDATE_LDFLAGS% -QRUPDATE_LIBS=%OCTAVE_CONF_QRUPDATE_LIBS% -READLINE_LIBS=%OCTAVE_CONF_READLINE_LIBS% -REGEX_LIBS=%OCTAVE_CONF_REGEX_LIBS% -TERM_LIBS=%OCTAVE_CONF_TERM_LIBS% -UMFPACK_CPPFLAGS=%OCTAVE_CONF_UMFPACK_CPPFLAGS% -UMFPACK_LDFLAGS=%OCTAVE_CONF_UMFPACK_LDFLAGS% -UMFPACK_LIBS=%OCTAVE_CONF_UMFPACK_LIBS% -X11_INCFLAGS=%OCTAVE_CONF_X11_INCFLAGS% -X11_LIBS=%OCTAVE_CONF_X11_LIBS% -Z_CPPFLAGS=%OCTAVE_CONF_Z_CPPFLAGS% -Z_LDFLAGS=%OCTAVE_CONF_Z_LDFLAGS% -Z_LIBS=%OCTAVE_CONF_Z_LIBS% - -DEFS=%OCTAVE_CONF_DEFS% - -: ${USER=$LOGNAME} - -CC_AND_VERSION= -if test -n "$CC_VERSION"; then - CC_AND_VERSION="$CC, version $CC_VERSION" -fi - -CXX_AND_VERSION= -if test -n "$CXX_VERSION"; then - CXX_AND_VERSION="$CXX, version $CXX_VERSION" -fi - -PATH=/bin:/usr/bin:/usr/ucb:/usr/local/bin:$PATH -export PATH - -TEMP=/tmp/octave-bug.$$ - -if [ -z "$DEFEDITOR" ] && [ -z "$EDITOR" ]; then - if [ -x /usr/bin/editor ]; then - DEFEDITOR=editor - elif [ -x /usr/local/bin/ce ]; then - DEFEDITOR=ce - elif [ -x /usr/local/bin/emacs ]; then - DEFEDITOR=emacs - elif [ -x /usr/contrib/bin/emacs ]; then - DEFEDITOR=emacs - elif [ -x /usr/bin/emacs ]; then - DEFEDITOR=emacs - elif [ -x /usr/bin/xemacs ]; then - DEFEDITOR=xemacs - elif [ -x /usr/contrib/bin/jove ]; then - DEFEDITOR=jove - elif [ -x /usr/local/bin/jove ]; then - DEFEDITOR=jove - elif [ -x /usr/bin/vi ]; then - DEFEDITOR=vi - else - echo "octave-bug: No default editor found: attempting to use vi" >&2 - DEFEDITOR=vi - fi -fi - -: ${EDITOR=$DEFEDITOR} - -if [ -z "$DEFPAGER" ] && [ -z "$PAGER" ]; then - if [ -x /usr/bin/pager ]; then - DEFPAGER=pager - elif [ -x /usr/bin/less ]; then - DEFPAGER=less - elif [ -x /bin/less ]; then - DEFPAGER=less - elif [ -x /usr/local/bin/less ]; then - DEFPAGER=less - elif [ -x /usr/bin/more ]; then - DEFPAGER=more - elif [ -x /bin/more ]; then - DEFPAGER=more - elif [ -x /usr/bin/pg ]; then - DEFPAGER=pg - elif [ -x /bin/pg ]; then - DEFPAGER=pg - else - echo "octave-bug: No default pager found: attempting to use more" >&2 - DEFPAGER=more - fi -fi - -: ${PAGER=$DEFPAGER} - -trap 'rm -f $TEMP $TEMP.x; exit 1' 1 2 3 13 15 -trap 'rm -f $TEMP $TEMP.x' 0 - -UN= -if (uname) > /dev/null 2>&1; then - UN=`uname -a` -fi - -HAVE_FMT=false -if (fmt < /dev/null) > /dev/null 2>&1; then - HAVE_FMT=true -fi - -# Check whether to use -n or \c to keep echo from printing a newline -# character. Stolen from autoconf, which borrowed the idea from dist 3.0. - -if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then - # Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu. - if (echo -n testing; echo 1,2,3) | $SED s/-n/xn/ | grep xn >/dev/null; then - echo_n= - echo_c=' -' - else - echo_n=-n - echo_c= - fi -else - echo_n= - echo_c='\c' -fi - -ss_p=`echo $VERSION | grep "^ss-"` -if test -n "$ss_p"; then - BUGADDR="maintainers@octave.org" -else - pretest_p=`echo $VERSION \ - | $SED 's,.*\.\([0-9]*\).*,\1,' \ - | grep -v '\.' \ - | grep '[0-9]'` - - if test -n "$pretest_p" && test "$pretest_p" -ge 90; then - BUGADDR="maintainers@octave.org" - else - BUGADDR="bug@octave.org" - fi -fi - -SUBJECT="[50 character or so descriptive subject here (for reference)]" -if test $# -gt 0; then - case "$1" in - -s) - shift - if test $# -gt 0; then - SUBJECT="$1" - shift - else - echo "usage: octave-bug [-s subject]" - exit 1 - fi - ;; - esac -fi - -cat > $TEMP << EOF -To: $BUGADDR -EOF -if test -n "$USER"; then -cat >> $TEMP << EOF -Cc: $USER -EOF -fi -cat >> $TEMP << EOF -Subject: $SUBJECT --------- -Bug report for Octave $VERSION configured for $MACHINE - -Description: ------------ - - * Please replace this item with a detailed description of the - problem. Suggestions or general comments are also welcome. - -Repeat-By: ---------- - - * Please replace this item with a description of the sequence of - events that causes the problem to occur. - -Fix: ---- - - * If possible, replace this item with a description of how to - fix the problem (if you don't have a fix for the problem, don't - include this section, but please do submit your report anyway). - - - -Configuration (please do not edit this section): ------------------------------------------------ - -uname output: $UN -configure opts: $config_opts -SED: $SED -Fortran compiler: $F77 -FFLAGS: $FFLAGS -FLIBS: $FLIBS -CPPFLAGS: $CPPFLAGS -INCFLAGS: $INCFLAGS -C compiler: $CC_AND_VERSION -CFLAGS: $CFLAGS -CPICFLAG: $CPICFLAG -C++ compiler: $CXX_AND_VERSION -CXXFLAGS: $CXXFLAGS -CXXPICFLAG: $CXXPICFLAG -LD_CXX: $LD_CXX -LDFLAGS: $LDFLAGS -LIBFLAGS: $LIBFLAGS -RLD_FLAG: $RLD_FLAG -LEXLIB: $LEXLIB -LIBS: $LIBS -AMD_CPPFLAGS: $AMD_CPPFLAGS -AMD_LDFLAGS: $AMD_LDFLAGS -AMD_LIBS: $AMD_LIBS -ARPACK_LIBS: $ARPACK_LIBS -BLAS_LIBS: $BLAS_LIBS -CAMD_CPPFLAGS: $CAMD_CPPFLAGS -CAMD_LDFLAGS: $CAMD_LDFLAGS -CAMD_LIBS: $CAMD_LIBS -CARBON_LIBS: $CARBON_LIBS -CCOLAMD_CPPFLAGS: $CCOLAMD_CPPFLAGS -CCOLAMD_LDFLAGS: $CCOLAMD_LDFLAGS -CCOLAMD_LIBS: $CCOLAMD_LIBS -CHOLMOD_CPPFLAGS: $CHOLMOD_CPPFLAGS -CHOLMOD_LDFLAGS: $CHOLMOD_LDFLAGS -CHOLMOD_LIBS: $CHOLMOD_LIBS -COLAMD_CPPFLAGS: $COLAMD_CPPFLAGS -COLAMD_LDFLAGS: $COLAMD_LDFLAGS -COLAMD_LIBS: $COLAMD_LIBS -CURL_CPPFLAGS: $CURL_CPPFLAGS -CURL_LDFLAGS: $CURL_LDFLAGS -CURL_LIBS: $CURL_LIBS -CXSPARSE_CPPFLAGS: $CXSPARSE_CPPFLAGS -CXSPARSE_LDFLAGS: $CXSPARSE_LDFLAGS -CXSPARSE_LIBS: $CXSPARSE_LIBS -DL_LIBS: $DL_LIBS -FFTW3_CPPFLAGS: $FFTW3_CPPFLAGS -FFTW3_LDFLAGS: $FFTW3_LDFLAGS -FFTW3_LIBS: $FFTW3_LIBS -FFTW3F_CPPFLAGS: $FFTW3F_CPPFLAGS -FFTW3F_LDFLAGS: $FFTW3F_LDFLAGS -FFTW3F_LIBS: $FFTW3F_LIBS -GRAPHICS_LIBS: $GRAPHICS_LIBS -GLPK_CPPFLAGS: $GLPK_CPPFLAGS -GLPK_LDFLAGS: $GLPK_LDFLAGS -GLPK_LIBS: $GLPK_LIBS -HDF5_CPPFLAGS: $HDF5_CPPFLAGS -HDF5_LDFLAGS: $HDF5_LDFLAGS -HDF5_LIBS: $HDF5_LIBS -OPENGL_LIBS: $OPENGL_LIBS -PTHREAD_CFLAGS: $PTHREAD_CFLAGS -PTHREAD_LIBS: $PTHREAD_LIBS -QHULL_CPPFLAGS: $QHULL_CPPFLAGS -QHULL_LDFLAGS: $QHULL_LDFLAGS -QHULL_LIBS: $QHULL_LIBS -QRUPDATE_LIBS: $QRUPDATE_LIBS -READLINE_LIBS: $READLINE_LIBS -REGEX_LIBS: $REGEX_LIBS -TERM_LIBS: $TERM_LIBS -UMFPACK_LIBS: $UMFPACK_LIBS -X11_INCFLAGS: $X11_INCFLAGS -X11_LIBS: $X11_LIBS -Z_CPPFLAGS: $Z_CPPFLAGS -Z_LDFLAGS: $Z_LDFLAGS -Z_LIBS: $Z_LIBS -DEFS: - -EOF - -if $HAVE_FMT; then - echo $DEFS | fmt | $SED 's/^/ /' >> $TEMP -else - echo $DEFS >> $TEMP -fi - -if test $# -gt 0; then - if test -f "$1"; then - cat >> $TEMP << EOF - -User-preferences (please do not edit this section): --------------------------------------------------- - -EOF - cat $1 >> $TEMP - fi -fi - -chmod u+w $TEMP -cp $TEMP $TEMP.x - -status=0 - -editing=true - -while $editing; do - if $EDITOR $TEMP; then - while $editing; do - echo $echo_n "(a)bort, (e)dit, (l)ist, (s)end? $echo_c" - read ans - case "$ans" in - a* | A*) - status=1 - editing=false - ;; - e* | E*) - break; - ;; - l* | L*) - $PAGER $TEMP - ;; - s* | S*) - editing=false - ;; - esac - done - else - echo "problems with edit -- no bug report submitted" - status=1 - editing=false - fi -done - -if test $status -eq 0; then - if cmp -s $TEMP $TEMP.x; then - echo "file not changed -- no bug report submitted" - status=1 - elif test `wc $TEMP | awk '{print $1}'` -eq 0; then - echo "empty bug report file -- not submitted" - status=1 - else - -# Try to extract the recipient address, in case the To: line in the -# message template has been changed. Also get cc: lines. - - TO_ADDR=`$SED -e '/^--------[ \t]*$/q' $TEMP | $SED -n -e 's/^[Tt][Oo]://p'` - CC_ADDR=`$SED -e '/^--------[ \t]*$/q' $TEMP | $SED -n -e 's/^[Cc][Cc]://p'` - - if test -z "$TO_ADDR"; then - echo "no valid \`To:' field found in header -- using $BUGADDR instead" - else - BUGADDR="$TO_ADDR" - fi - - BUGADDR="$BUGADDR $CC_ADDR" - - TMP_SUB=`$SED -e '/^--------[ \t]*$/q' $TEMP | $SED -n -e 's/^Subject://p'` - - if test -n "$TMP_SUB"; then - SUBJECT="$TMP_SUB" - fi - -# Delete the `--------' separator in the message. - -# Don't pretty-print this. Odd whitespace kills Ultrix AWK! - - awk 'BEGIN{in_header=1;} /^--------[ \t]*$/ { - if (in_header) { in_header=0; print ""; next; } - } { print $0; }' $TEMP > $TEMP.x - -# Now try to mail it. - - # indicate that we have not yet sent email successfully - status=11 - - if test $status -ne 0; then - ( mailx -s "$SUBJECT" $BUGADDR < $TEMP.x ) > /dev/null 2>&1 - status=$? - if test $status -ne 0; then - ( Mail -s "$SUBJECT" $BUGADDR < $TEMP.x ) > /dev/null 2>&1 - status=$? - if test $status -ne 0; then - ( /usr/ucb/mail -s "$SUBJECT" $BUGADDR < $TEMP.x ) > /dev/null 2>&1 - status=$? - # make /bin/mail our last resort -- it ignores the subject line - if test $status -ne 0; then - ( /bin/mail $BUGADDR < $TEMP.x ) > /dev/null 2>&1 - status=$? - if test $status -ne 0; then - echo "unable to send mail..." - fi - fi - fi - fi - fi - fi -fi - -if test $status -ne 0; then - dead_bug_file=$HOME/dead-octave-bug - looking_for_file=true; - n=1 - while $looking_for_file; do - if test -f "$dead_bug_file-$n"; then - n=`expr $n + 1` - else - looking_for_file=false - dead_bug_file=$dead_bug_file-$n - fi - done - echo "saving message in $dead_bug_file"; - cat $TEMP >> $dead_bug_file; - exit 1 -else - echo "bug report sent to: $TO_ADDR" - echo " cc to: $CC_ADDR" -fi - -exit $status diff -r 92bb25c0da9e -r b4ed4fe70c2c scripts/ChangeLog --- a/scripts/ChangeLog Wed Sep 22 18:06:21 2010 -0400 +++ b/scripts/ChangeLog Thu Sep 23 03:15:33 2010 -0400 @@ -1,3 +1,8 @@ +2010-09-23 John W. Eaton + + * miscellaneous/bug_report.m: Display information about how to + submit bug reports instead of creating and mailing a bug report. + 2010-09-22 Ben Abbott * plot/private/__ghostscript__.m, plot/print.m: When appending, delete diff -r 92bb25c0da9e -r b4ed4fe70c2c scripts/miscellaneous/bug_report.m --- a/scripts/miscellaneous/bug_report.m Wed Sep 22 18:06:21 2010 -0400 +++ b/scripts/miscellaneous/bug_report.m Thu Sep 23 03:15:33 2010 -0400 @@ -1,5 +1,5 @@ ## Copyright (C) 1994, 1995, 1996, 1997, 1998, 2000, 2002, 2003, 2005, -## 2007, 2008 John W. Eaton +## 2007, 2008, 2010 John W. Eaton ## ## This file is part of Octave. ## @@ -19,55 +19,28 @@ ## -*- texinfo -*- ## @deftypefn {Function File} {} bug_report () -## Have Octave create a bug report template file, invoke your favorite -## editor, and submit the report to the bug-octave mailing list when -## you are finished editing. +## Display information about how to submit bug reports for Octave. ## @end deftypefn ## Author: jwe function bug_report () - if (nargin != 0) - warning ("bug_report: ignoring extra arguments"); - endif - - printf ("Please enter a one-line description of your bug report.\n\n"); - fflush (stdout); - - subject = ""; - subject = input ("Subject: ", "s"); - - unwind_protect - - prefs = tmpnam (); - - if (! isempty (prefs)) - fid = fopen (prefs, "wt"); - if (fid > 0) - dump_prefs (fid); - fclose (fid); - endif - endif - - cmd = cstrcat ("octave-bug-", OCTAVE_VERSION); - - if (length (subject) > 0) - cmd = sprintf ("%s -s \"%s\"", cmd, subject); - endif - - if (! isempty (prefs)) - cmd = sprintf ("%s \"%s\"", cmd, prefs); - endif - - system (cmd); - - unwind_protect_cleanup - - if (! isempty (prefs)) - unlink (prefs); - endif - - end_unwind_protect + puts ("\n"); + puts (" Bug reports play an essential role in making Octave\n"); + puts (" reliable. Please use the Octave bug tracker at\n"); + puts ("\n"); + puts (" http://bugs.octave.org\n"); + puts ("\n"); + puts (" to report problems.\n"); + puts ("\n"); + puts (" Please also read the bug reporting guidelines at\n"); + puts ("\n"); + puts (" http://www.octave.org/bugs.html\n"); + puts ("\n"); + puts (" to learn how to submit useful bug reports that will\n"); + puts (" help the Octave community diagnose and fix the problem\n"); + puts (" quickly and efficiently.\n"); + puts ("\n"); endfunction