Commit Graph

71 Commits

Author SHA1 Message Date
Guy Harris a3d3282e64 Have init_progfile_dir() also check whether
WIRESHARK_RUN_FROM_BUILD_DIRECTORY is set and, if so and we weren't run
with special privileges, set the running_in_build_directory_flag.  Have
it do the same if it finds ".libs" in the pathname of the program and we
weren't run with special privileges, as that means it was probably run
from the libtool wrapper script and presumably thus isn't an installed
binary.

This means that get_credential_info() has to be called before
init_progfile_dir().

Clean up some indentation.

svn path=/trunk/; revision=21866
2007-05-21 20:31:45 +00:00
Stephen Fisher 46b8669566 Fix a bunch more warnings. Add -Werror when using --with-warnings-as-errors
under gcc to tools/lemon, plugins/mate and epan/


svn path=/trunk/; revision=21204
2007-03-26 06:10:52 +00:00
Guy Harris 2e8fa7557e Include <ctype.h> to define "isspace()".
Clean up indentation.

svn path=/trunk/; revision=21028
2007-03-14 18:22:28 +00:00
Ulf Lamping 7366ae37a0 as requested by "John T. Haller" for PortableApps.com:
add new WS command line option -P to be able to change some of the path settings

this is experimental, please report bugs

svn path=/trunk/; revision=21022
2007-03-14 02:55:54 +00:00
Stephen Fisher a68006f995 Add a description for errno EINVAL (Invalid Argument) to
file_open_error_message().  In this context, the error means
that an invalid filename was specified.


svn path=/trunk/; revision=20958
2007-03-02 21:17:44 +00:00
Graeme Lunt 4ea1d12df8 Update to get_persdatafile_dir() to choose a default directory on the U3 device that Wireshark is being run from.
The U3 Deployment Guide recommends a sub-directory of U3_DEVICE_DOCUMENT_PATH, so the u3util creates a "My Captures" sub-directory to use as the personal data file directory.


svn path=/trunk/; revision=20441
2007-01-15 19:11:29 +00:00
Ulf Lamping e31d777279 fix a warning
svn path=/trunk/; revision=20436
2007-01-15 04:22:10 +00:00
Ulf Lamping d131445196 SHGetFolderPath is not available on MSVC 6 without a Platform SDK, use SHGetSpecialFolderPath instead
svn path=/trunk/; revision=20435
2007-01-15 03:53:20 +00:00
Ulf Lamping 47aaf7d9b7 on my way to fix #301:
add a function get_persdatafile_dir() that will return the users personal default data dir Win32:"My Documents" UNIX:"" (for the current dir)

svn path=/trunk/; revision=20431
2007-01-14 22:25:22 +00:00
Ulf Lamping 2cbce84d41 Win32: MSVC > 6 doesn't work well with Unicode filenames!
fix this, by providing required functions in the new file file_util.c - it's mostly copied from GLib (g_open alike - that take UTF8 as filename format but don't use msvcrt.dll V6 for this as the glib files do) 

"link" to these functions in file_util.h: #define eth_open eth_stdio_open

revert changes (from SVN 20282) throughout the code related to these file functions which were introduced with the first tries of MSVC 2005 ...

Hopefully I've done everything right with the new file_util.c ...

svn path=/trunk/; revision=20402
2007-01-12 03:05:28 +00:00
Ulf Lamping 894f6cd603 from Laurent Rabret:
I posted a patch about 1.5 years ago for the formerly Ethereal to successfully compiled with Visual > 6. I have always successfully used this patched Ethereal/Wireshark compiled with VS 2003 and have just checked when compiled with Visual C++ 2005 Express

svn path=/trunk/; revision=20282
2007-01-03 02:50:22 +00:00
Guy Harris 44c0624bd9 Add a WIRESHARK_RUN_FROM_BUILD_DIRECTORY environment variable on UN*X;
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.

svn path=/trunk/; revision=20261
2007-01-02 06:49:40 +00:00
Gerald Combs 30619416b9 Add missing files from last commit. Fix an #include.
svn path=/trunk/; revision=19293
2006-09-22 22:34:54 +00:00
Guy Harris e7135c63bb Clean up indentation, etc.
svn path=/trunk/; revision=19116
2006-09-02 06:39:09 +00:00
Graeme Lunt 14be5e2bcc U3 packaging, utility and Wireshark modifications that allows Wireshark to be run from a U3 USB device.
For more details see packaging/u3/win32/README.txt


svn path=/trunk/; revision=19046
2006-08-26 17:55:21 +00:00
Gerald Combs 8958bab6de Tethereal/tethereal -> TShark/tshark.
svn path=/trunk/; revision=18268
2006-05-31 17:38:42 +00:00
Gerald Combs b15974d094 libethereal -> libwireshark. idl2eth -> idl2wrs. There are a _lot_ of
changes here.  It compiles OK on OS X, but hasn't been tested anywhere else.

svn path=/trunk/; revision=18260
2006-05-31 00:23:01 +00:00
Anders Broman 996d4db495 Ethereal->Wireshark
svn path=/trunk/; revision=18234
2006-05-28 19:49:07 +00:00
Ronnie Sahlberg 6075ec39fb ethereal->wireshark
svn path=/trunk/; revision=18207
2006-05-22 08:21:22 +00:00
Ronnie Sahlberg 89f022b12b name change
svn path=/trunk/; revision=18197
2006-05-21 05:12:17 +00:00
Guy Harris 635ae7e19a As suggested by Jim Prince, pass the right argument to "getcwd()" - the
buffer argument is a mallocated buffer, so sizeof doesn't return its
size, it returns the size of the pointer to the buffer.  Fixes bug 907.

svn path=/trunk/; revision=18186
2006-05-18 12:01:33 +00:00
Guy Harris 098facb0f7 It's g_strdup_printf(), not g_sprintf_alloc().
Declare "error", and properly terminate a string.

svn path=/trunk/; revision=18054
2006-05-01 08:09:39 +00:00
Guy Harris 0dfbc73cbe Handle the case where we *can't* determine the pathname in which to find
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.

svn path=/trunk/; revision=18051
2006-05-01 06:51:14 +00:00
Gerald Combs f31a402f6b Include tchar.h only if we're running Windows. Fixup whitespace.
svn path=/trunk/; revision=17537
2006-03-08 22:13:21 +00:00
Gerald Combs 9406c5db24 Use Unicode for all native Win32 calls. Unicode Windows applications
use UTF-16 internally and GTK+ 2.x uses UTF-8, which means we have to
do a lots of conversions.

Add utf_8to16() and utf_16to8 convenience functions to strutil.c.

svn path=/trunk/; revision=17534
2006-03-08 20:55:32 +00:00
Guy Harris 94c71f063d Fix the loop that checks $PATH for the binary to actually step from one
element of the path to the next element.

svn path=/trunk/; revision=17298
2006-02-14 09:08:12 +00:00
Guy Harris b8136fbfa9 Add a routine to attempt to get the absolute pathname of the executable
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.

svn path=/trunk/; revision=17267
2006-02-12 03:15:29 +00:00
Guy Harris 6382f1d4bb Fix up some comments.
svn path=/trunk/; revision=17214
2006-02-08 03:25:22 +00:00
Guy Harris 4d86160203 Clean up the comments for files_identical(), and fix up the UNIX
implementation to check whether the stat calls succeed and to check not
only that the files have the same inumber but that they also are on the
same file system.

svn path=/trunk/; revision=17213
2006-02-08 02:06:09 +00:00
Luis Ontanon 007796b156 Make file_exists() work on macosx (and other unices)
svn path=/trunk/; revision=17211
2006-02-08 00:06:38 +00:00
Ulf Lamping a9f4ae4f99 fix #648:
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.


svn path=/trunk/; revision=17024
2006-01-12 22:32:29 +00:00
Guy Harris db9fba20b4 Use <wiretap/file_util.h> to include "file_util.h"; otherwise, the
include fails as we don't do -Iwiretap.

If we have it, include <sys/stat.h> in epan/filesystem.c - we need it
for stat() and the macros and structures it uses.

svn path=/trunk/; revision=16410
2005-11-07 02:47:09 +00:00
Ulf Lamping c3187174bf replace *a lot* of file related calls by their GLib counterparts. This is necessary for the switch to GTK 2.6 (at least on WIN32).
to do this, I've added file_util.h to wiretap (would file_compat.h be a better name?), and provide compat_macros like eth_open() instead of open(). While at it, move other file related things there, like #include <io.h>, definition of O_BINARY and alike, so it's all in one place.

deleted related things from config.h.win32

As of these massive changes, I'm almost certain that this will break the Unix build. I'll keep an eye on the buildbot so hopefully everything is working again soon.

svn path=/trunk/; revision=16403
2005-11-06 22:43:25 +00:00
Ulf Lamping 0dc9fb3d4a various code cleanup:
-use g_snprintf instead of sprintf and snprintf
-use g_strdup_printf where appropriate
-remove #include "snprintf.h" (as only g_snprintf should be used)
-replace some more alloc/realloc/calloc/free with their glib pendants

svn path=/trunk/; revision=15264
2005-08-08 18:50:39 +00:00
Jörg Mayer 30a8557868 More 'char*' -> 'const char*' changes to fix warnings.
svn path=/trunk/; revision=15015
2005-07-23 11:41:25 +00:00
Ulf Lamping dc223932b8 another try to fix the unix build
svn path=/trunk/; revision=14063
2005-04-12 23:48:47 +00:00
Ulf Lamping 6cacb84377 bugfix for unix builds, remove leftover things from function move
svn path=/trunk/; revision=14062
2005-04-12 23:12:37 +00:00
Ulf Lamping 6e38159c25 add functions file_exists and file_identical to filesystem.c (coming from file.c)
svn path=/trunk/; revision=14057
2005-04-12 21:12:19 +00:00
Guy Harris 6e622fd24e "gtk_entry_get_text()" returns a "const char *" - assign the result to
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.

svn path=/trunk/; revision=12881
2004-12-31 00:26:36 +00:00
Guy Harris f1deabed56 Make the tone of the error messages a bit less formal, by using
contractions.  (Safari does, at least when you're trying to open a file
to which you don't have read access.)

svn path=/trunk/; revision=12852
2004-12-29 01:08:20 +00:00
Guy Harris f23f4ecf04 Use _WIN32 rather than WIN32 to determine if we're compiling on Win32;
according to Gisle Vanem, WIN32 isn't a built-in in MSVC, but _WIN32 is.

svn path=/trunk/; revision=11972
2004-09-11 23:03:36 +00:00
Guy Harris 8a8b883450 Set the svn:eol-style property on all text files to "native", so that
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.

svn path=/trunk/; revision=11400
2004-07-18 00:24:25 +00:00
Guy Harris d8d91ff347 As with "cf_open_error_message()"/"file_open_error_message()", so with
"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.

svn path=/trunk/; revision=9823
2004-01-24 02:01:44 +00:00
Guy Harris 46848f0a9e Add a new "file_open_error_message()" routine in "epan/filesystem.c", to
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".

svn path=/trunk/; revision=9821
2004-01-24 01:44:29 +00:00
Guy Harris d2db02c521 Use "g_get_tmp_dir()" to get the pathname of the temporary file
directory.

svn path=/trunk/; revision=8872
2003-11-03 22:32:36 +00:00
Gerald Combs 5903ff03a3 Make get_tempfile_path() work like get_datafile_path(), which removes
a dependency on PATH_MAX (which apparently isn't defined under Windows).

svn path=/trunk/; revision=8862
2003-11-03 02:41:07 +00:00
Gerald Combs 031db8b9c8 From Gisle Vanem:
* 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.

svn path=/trunk/; revision=8859
2003-11-02 23:12:35 +00:00
Guy Harris 7bfaf8caf3 From Graeme Hewson:
Don't crash if "-z" is used on the command line when a live
	capture is being done (e.g., with "-k -S" - in that case,
	"cfile.filename" is null when the window is created), just don't
	display the file name in the title.

	Don't set the title of a non-existent window - create the window
	first.

svn path=/trunk/; revision=8472
2003-09-15 19:05:01 +00:00
Guy Harris e1647e4504 From Richard Urwin:
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.

svn path=/trunk/; revision=7677
2003-05-15 07:44:54 +00:00
Guy Harris 9f3902270e Put in a comment about the "to what code does the configuration file
directory belong" issue.

svn path=/trunk/; revision=7370
2003-03-26 00:34:27 +00:00