aboutsummaryrefslogtreecommitdiffstats
path: root/epan/filesystem.h
AgeCommit message (Collapse)AuthorFilesLines
2009-02-15Add a routine to report write errors to the list of failure-reportingguy1-1/+13
routines handled by epan/report_err.c. Move copy_binary_file() in file.c to epan/filesystem.c, and rename it to copy_file_binary_mode() (to clarify that it *can* copy text files; arguably, *all* files are "binary" unless you're on, say, an IBM 1401 :-)). Have it use the report_err.c routines, so it works in console-mode programs. Clean up some comments while we're at it. git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@27456 f5534014-38df-0310-8fa8-9805f1628bb7
2009-02-11fix a commentulfl1-1/+1
git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@27420 f5534014-38df-0310-8fa8-9805f1628bb7
2008-08-02WIN32 ==> _WIN32wmeier1-1/+1
git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@25903 f5534014-38df-0310-8fa8-9805f1628bb7
2008-06-23Rename an argument to avoid collisions with a global variable name, asguy1-1/+1
noted by John Smith. Fix indentation. git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@25547 f5534014-38df-0310-8fa8-9805f1628bb7
2008-02-26get_datafile_path() and get_persconffile_path() return malloc'd memory. ↵morriss1-0/+6
Note that in the comments. git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@24476 f5534014-38df-0310-8fa8-9805f1628bb7
2008-01-24Always return a valid profile name from get_profile_name().stig1-0/+6
git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@24175 f5534014-38df-0310-8fa8-9805f1628bb7
2008-01-14This patch adds support for configuration profiles, which can be used tostig1-2/+53
configure and use more than one set of preferences and configuration files. This can be found in the "Configuration Profiles..." menu item from the Edit menu, or by pressing Shift-Ctrl-A. It's also possible to start wireshark and tshark with a named profile by using the "-C ProfileName" option. A new status pane in the main window will show the current profile. The configuration files currently stored in the Profiles are: - Preferences - Capture Filters - Display Filters - Coloring Rules - Disabled Protocols - User Accessible Tables The recent data are by design not added to the profile. Planned future enhancements: - make a more convenient function to switch between profiles - add a "clone profile" button to copy an existing profile - make the profiles list active and accept return as OK - save users "Decode as" in the profile - make new, clone and deletion of profiles more secure - make some of the recent values available in the profile This patch also fixes: - setting default status pane sizes - a bug setting status pane for packets when not having main lower pane. git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@24089 f5534014-38df-0310-8fa8-9805f1628bb7
2007-05-25No need to call init_plugin_dir() - it gets called, if necessary, byguy1-7/+3
get_plugin_dir(). Add checks for the success or failure of init_progfile_dir() in dftest. git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@21942 f5534014-38df-0310-8fa8-9805f1628bb7
2007-03-14as requested by "John T. Haller" for PortableApps.com:ulfl1-0/+5
add new WS command line option -P to be able to change some of the path settings this is experimental, please report bugs git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@21022 f5534014-38df-0310-8fa8-9805f1628bb7
2007-01-14on my way to fix #301:ulfl1-47/+55
add a function get_persdatafile_dir() that will return the users personal default data dir Win32:"My Documents" UNIX:"" (for the current dir) git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@20431 f5534014-38df-0310-8fa8-9805f1628bb7
2007-01-02Add a WIRESHARK_RUN_FROM_BUILD_DIRECTORY environment variable on UN*X;guy1-0/+17
if set, and if the program isn't running with additional privileges, it'll treat the directory in which the program is found as the data directory. If, on Windows, the version-number subdirectory of {data directory}\plugins doesn't exist (which is assumed to mean that the program is being run from the build directory), or if, on UN*X, WIRESHARK_RUN_FROM_BUILD_DIRECTORY is set, the plugin directory is the "plugins" subdirectory of the data directory, and all subdirectories of that directory are scanned for plugins, as the "plugins" subdirectory of the build directory contains subdirectories for the plugins; this means that if we're running from the build directory, we'll find the plugins we built in the build tree. When generating the wireshark-filter man page, run tshark with WIRESHARK_RUN_FROM_BUILD_DIRECTORY set, so it uses the plugins from the build to generate the list of filters. git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@20261 f5534014-38df-0310-8fa8-9805f1628bb7
2006-05-28Ethereal->Wiresharketxrab1-2/+2
git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@18234 f5534014-38df-0310-8fa8-9805f1628bb7
2006-05-21name changesahlberg1-2/+2
git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@18197 f5534014-38df-0310-8fa8-9805f1628bb7
2006-05-01Handle the case where we *can't* determine the pathname in which to findguy1-2/+3
programs, by reporting it with a dialog box that at least attempts to indicate what the problem is, and by giving up early on running dumpcap. git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@18051 f5534014-38df-0310-8fa8-9805f1628bb7
2006-02-12Add a routine to attempt to get the absolute pathname of the executableguy1-11/+22
file, strip off the last component to get the pathname of the directory containing the executable file, and save it for future use. On Windows, you can get that from the OS, but, on UN*X, you have to look at argv[0] and derive the absolute path from that (argv[0] is not guaranteed to be an absolute path, or even a path at all). (In addition, if you're running from the build directory, you might have to strip off a ".libs/" added to argv[0] as an artifact of the libtoolizing script.) Use that in the About dialog, and use it to construct the path of dumpcap. Don't put quotes into the path of dumpcap; you don't have to quote strings with spaces in them when handing them to execvp and, in fact, you *mustn't* quote them, as the quotes will be treated as part of the pathname. git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@17267 f5534014-38df-0310-8fa8-9805f1628bb7
2006-01-12fix #648: ulfl1-0/+7
Win32 only: reading a pathname from an environment var requires us to read it in as unicode somehow and convert it to utf8. Using _wgetenv should work under all circumstances on NT, using getenv and g_locale_to_utf8 on Windows OT is the best we can do in this case. git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@17024 f5534014-38df-0310-8fa8-9805f1628bb7
2005-07-23More 'char*' -> 'const char*' changes to fix warnings.jmayer1-2/+2
git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@15015 f5534014-38df-0310-8fa8-9805f1628bb7
2005-04-12add functions file_exists and file_identical to filesystem.c (coming from ↵ulfl1-0/+10
file.c) git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@14057 f5534014-38df-0310-8fa8-9805f1628bb7
2004-12-31"gtk_entry_get_text()" returns a "const char *" - assign the result toguy1-8/+1
one. "get_basename()" doesn't modify its argument, and its callers don't modify the substring pointed to by the result, so make it take a "const char *" as an argument and return a "const char *". "find_last_pathname_separator()" doesn't modify its argument, so make it a "const char *" - but some of its callers pass a non-"const" "char *" and modify the result, so don't make its return value a "const char *". And, as none of its callers are outside "filesystem.c", make it static. In "about_folders_page_new()", have separate variables for pathnames returned as "const char *" (which are cached by the routine that returns them, so you can't modify them - and can't free them, so get rid of the commented-out "g_free()" calls for them) and pathnames returned as "char *" (which are allocated anew for each call, and can be modified, but have to be freed). Clean up white space. git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@12881 f5534014-38df-0310-8fa8-9805f1628bb7
2004-12-11Add functions to the old and the new plugin api for the MATE Plugin.lroland1-1/+1
git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@12715 f5534014-38df-0310-8fa8-9805f1628bb7
2004-07-18Set the svn:eol-style property on all text files to "native", so thatguy1-1/+1
they have LF at the end of the line on UN*X and CR/LF on Windows; hopefully this means that if a CR/LF version is checked in on Windows, the CRs will be stripped so that they show up only when checked out on Windows, not on UN*X. git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@11400 f5534014-38df-0310-8fa8-9805f1628bb7
2004-01-24As with "cf_open_error_message()"/"file_open_error_message()", so withguy1-2/+9
"cf_write_error_message()"/"file_write_error_message()". Use "file_open_error_message()" instead of "cf_open_error_message()" in some places we missed in the previous checkin. Catch ENOSPC and EDQUOT in "file_open_error_message()". Use "file_open_error_message()" rather than "file_write_error_message()" to report errors when creating the file to which we're saving the "Follow TCP Stream" data. git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@9823 f5534014-38df-0310-8fa8-9805f1628bb7
2004-01-24Add a new "file_open_error_message()" routine in "epan/filesystem.c", toguy1-2/+7
translate UNIX errno values to a somewhat friendly message format string. Rename "file_open_error_message()" in "file.c" to "cf_open_error_message()", make "cf_open_error_message()" use the new "file_open_error_message()" for UNIX errno values, have "do_capture()" in "capture.c" use "file_open_error_message()" to report errors from "open()", and make "cf_open_error_message()" static as nothing outside "file.c" uses it. Do similar stuff in "tethereal.c". git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@9821 f5534014-38df-0310-8fa8-9805f1628bb7
2003-11-18From Tomas Kukosa: add "extern"s so that the plugin API stuff works.guy1-3/+3
git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@9006 f5534014-38df-0310-8fa8-9805f1628bb7
2003-11-02From Gisle Vanem:gerald1-1/+10
* Added a new function get_file_in_temp() to epan/filesystem.c. This because of asn1.dll plugin which had code to write to a log-file "c:\temp\ethereal.log". I feel this patch makes this safer; I don't even have a c:\temp dir. * Patched packet-asn1.c to use get_file_in_temp(). * Added some #undef to packet-snmp.c to silence gcc. * Changed "%u" -> "%lu" formats in util.c Rename get_file_in_temp() to get_tempfile_path() to match other function names. git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@8859 f5534014-38df-0310-8fa8-9805f1628bb7
2003-05-15From Richard Urwin:guy1-1/+9
add support for a system-wide color filter file; fix a bug where "read_filters()" didn't close the file handle. Use the "get_datafile_path()" routine he added to construct the pathname of the Diameter directory, the global preferences file, and the manuf file. git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@7677 f5534014-38df-0310-8fa8-9805f1628bb7
2002-08-28Removed trailing whitespaces from .h and .c files using thejmayer1-4/+4
winapi_cleanup tool written by Patrik Stridvall for the wine project. git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@6116 f5534014-38df-0310-8fa8-9805f1628bb7
2002-06-23Add a routine to "epan/filesystem.c" to test whether a file is a FIFO.guy1-1/+14
Use that in Tethereal rather than duplicating a pile of macros. Get rid of the remaining uses of "stat()" in Tethereal - none of them are necessary (they were just cut-and-pasted from Ethereal). git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@5746 f5534014-38df-0310-8fa8-9805f1628bb7
2001-10-24Have a routine that takes a file name for a personal configuration fileguy1-6/+13
and generates the path name; have it, if the file is to be opened for reading on Win32, check whether it exists and, if not, check for it in the old home directory-based configuration directory and, if so, return that path instead, so that files saved with earlier versions of Ethereal will be seen. git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@4072 f5534014-38df-0310-8fa8-9805f1628bb7
2001-10-24On Windows, put Ethereal configuration files under the "Applicationguy1-3/+4
Data\Ethereal" directory under the user's profile, as that appears to be the Windows 2000 standard. git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@4071 f5534014-38df-0310-8fa8-9805f1628bb7
2001-10-23Add a new routine to create the ".ethereal" directory for a user.guy1-1/+9
Use that routine rather than duplicating that code in the routines to write out the preference file and filter files. Use it in the code for the color filter dialog, so that the directory in question is created if necessary. As that routine returns an error indication, have the code that calls that routine put up a message box if the attempt fails. git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@4065 f5534014-38df-0310-8fa8-9805f1628bb7
2001-10-22The only reason we care about the user's home directory is that theirguy1-6/+2
".ethereal" directory is under it; get rid of "get_home_dir()", and put its code inside "get_persconffile_dir()". (The personal configuration file directory may move, on Windows, to the user's profile directory.) git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@4062 f5534014-38df-0310-8fa8-9805f1628bb7
2001-10-22Add a routine to get the directory in which personal configuration filesguy1-10/+6
reside. Use it, rather than concatenating the user's home directory and ".ethereal" in a number of files. Fix up some additional places to use G_DIR_SEPARATOR_S as the pathname separator. git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@4061 f5534014-38df-0310-8fa8-9805f1628bb7
2001-10-21Use G_DIR_SEPARATOR_S rather than "/" as a pathname separator in formatguy1-1/+18
strings used to generate pathnames. Move the definition of PF_DIR from <epan/epan.h> to <epan/filesystem.h>, so that files requiring only the definition of PF_DIR don't have to include <epan/epan.h>, and get rid of no-longer-necessary includes of <epan/epan.h>. Add a routine to get the directory for "system files" such as "/etc/ethers" - it's "/etc" on UNIX, and the datafile directory on Windows (as there's no "/etc" on Windows). Use that to construct the pathname of the ethers and ipxnet files. git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@4056 f5534014-38df-0310-8fa8-9805f1628bb7
2001-08-21On Windows, use the directory in which the binary resides as theguy1-3/+21
directory in which global data files are stored. If an installed binary is being run, that's the correct directory for them; if a build-tree binary is being run, the "manuf" file will be there, and you can put other data files there as well, if necessary. Do the same with plugins, except that, if there's no "plugins\\{version}" subdirectory of that directory, fall back on the default installation directory, so you at least have a place where you can put plugins for use by build-tree binaries. (Should we, instead, have the Windows build procedure create a subdirectory of the "plugins" source directory, with the plugin version number as its name, and copy the plugins there, so you'd use the build-tree plugin binaries?) Move "test_for_directory()" out of "util.c" and into "epan/filesystem.c", with the other file system access portability wrappers and convenience routines. Fix "util.h" not to declare it - or other routines moved to "epan/filesystem.c" a while ago. git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@3858 f5534014-38df-0310-8fa8-9805f1628bb7
2001-04-02"get_home_dir()", in "epan/filesystem.c", usesguy1-1/+20
"find_last_pathname_separator()" on Win32; move the other pathname manipulation routines from "util.c" into "epan/filesystem.c". Remove from "util.h" the declarations of routines not defined in "util.c", and put them into "epan/filesystem.h" if they're not already there. Adjust #includes to make the above work. git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@3241 f5534014-38df-0310-8fa8-9805f1628bb7
2000-12-22fix '#endif FRED' to '#endif /* FRED */'nneul1-2/+2
git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@2771 f5534014-38df-0310-8fa8-9805f1628bb7
2000-09-28More EPAN-related code movements. Get rid of usage of #include "globals.h"gram1-0/+33
and #include "util.h" from epan code. Move get_home_dir() into epan/filesystem.c as it's used by plugins.c. git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@2461 f5534014-38df-0310-8fa8-9805f1628bb7