aboutsummaryrefslogtreecommitdiffstats
path: root/util.c
Commit message (Collapse)AuthorAgeFilesLines
* From Sebastien Tandel:Stephen Fisher2007-02-131-0/+1
| | | | | | | | | | | Create two new files (ws_strsplit.[ch]) that use GTK2 code to override the buggy g_strsplit() function when compiling for GTK1. Include this work-around function (ws_strsplit) in libwireshark.def. Add notes on usage to README.developer. Include epan/ws_strsplit.h in all files that use g_strsplit(). svn path=/trunk/; revision=20804
* When parsing DISPLAY, mirror what __X11TransConnectDisplay() does - andGuy Harris2007-01-241-17/+141
| | | | | | | | | handle the case where the "host name" begins with "/", as some platforms might allow the pathname of a UNIX domain socket to be given in DISPLAY. Fix indentation of a comment. svn path=/trunk/; revision=20548
* Use SESSIONNAME instead of CLIENTNAME to try to detect RDP sessions.Gerald Combs2006-09-151-4/+16
| | | | | | | | | Look for a string that starts with "rdp". This should take care of cases where a default capture filter is set needlessly. Update the docs accordingly. svn path=/trunk/; revision=19236
* name changeRonnie Sahlberg2006-05-211-2/+2
| | | | svn path=/trunk/; revision=18197
* Move create_tempfile() to tempfile.c out of util.c. This means dumpcapGuy Harris2006-02-121-121/+0
| | | | | | | | | no longer needs util.c, so it no longer includes routines that use host_ip_af(), so it no longer needs to define its own host_ip_af(). That also means dumpcap.c no longer needs to include <sys/socket.h>. svn path=/trunk/; revision=17278
* If "CLIENTNAME" is set (which indicates that we're using RDP) useGerald Combs2005-12-161-4/+2
| | | | | | | | | | | | "not tcp port 3389" instead of "not ip host $CLIENTNAME", since it seems to be more reliable. Make sure we remove dumpcap.obj when we clean. This also tests the content-type "text/plain; charset=utf-8" for commit messages. Maybe Stig B's name will show up correctly now. svn path=/trunk/; revision=16826
* Clear up const vs. non-const warnings.Guy Harris2005-12-071-1/+1
| | | | svn path=/trunk/; revision=16717
* as mkstemp makes trouble and is only used once in util.c, move definition ↵Ulf Lamping2005-11-071-0/+9
| | | | | | | | from file_util.h to util.c for now this hopefully fixes the mkstemp problem svn path=/trunk/; revision=16406
* replace *a lot* of file related calls by their GLib counterparts. This is ↵Ulf Lamping2005-11-061-16/+3
| | | | | | | | | | | | 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
* various code cleanup:Ulf Lamping2005-08-081-5/+1
| | | | | | | | | -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
* "setup_tmpdir()" either returns the const string passed to it, or itGuy Harris2005-08-061-7/+7
| | | | | | | | | | | | | | | | | | returns a malloced string that's supposed to persist as long as Ethereal is running. Make it return "const char *", and return either the former pointer or the result of mallocation, so we don't end up using the same variable for a const pointer and a non-const pointer. Make the variables to which its result is assigned const pointers as well. "strlen()" returns size_t; make a argument to which its result is assigned a size_t. Just out of paranoia, check for a zero-length string passed to "setup_tmpdir()". svn path=/trunk/; revision=15247
* Last set of char -> const char trivial warning fixes.Jörg Mayer2005-08-061-2/+2
| | | | svn path=/trunk/; revision=15244
* Add a "get_addr_name()" routine that takes an "address *" and attemptsGuy Harris2004-12-301-0/+1
| | | | | | | | | | | to resolve it to a name. Fix up some const-pointer-to-non-const-pointer, and function-pointer-to-void-*, conversions. Fix some comments. svn path=/trunk/; revision=12863
* Use _WIN32 rather than WIN32 to determine if we're compiling on Win32;Guy Harris2004-09-111-3/+3
| | | | | | according to Gisle Vanem, WIN32 isn't a built-in in MSVC, but _WIN32 is. svn path=/trunk/; revision=11972
* Move the base-64 routines to "epan/base64.c".Guy Harris2004-09-101-33/+0
| | | | svn path=/trunk/; revision=11960
* Move the stuff to handle ASCII <-> EBCDIC conversions toGuy Harris2004-09-101-113/+0
| | | | | | | "epan/charsets.c"; other character set translation code should perhaps go there as well. svn path=/trunk/; revision=11958
* From Albert Chin: rename resolv.{ch} to addr_resolv.{ch}, so that anGuy Harris2004-08-061-1/+1
| | | | | | | include of <resolv.h> in any system header file gets the system <resolv.h> (needed for builds on Tru64 with GTK+ 1.2[.x]). svn path=/trunk/; revision=11615
* Set the svn:eol-style property on all text files to "native", so thatGuy Harris2004-07-181-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. svn path=/trunk/; revision=11400
* Fix automagically generated filters in case of remote login via IPv6.Jörg Mayer2004-06-251-10/+12
| | | | | | This fix was picked from the source rpm of Suse 9.1. svn path=/trunk/; revision=11234
* Fix the other place where we construct temporary path names to useGuy Harris2004-05-221-4/+4
| | | | | | | G_DIR_SEPARATOR and G_DIR_SEPARATOR_S, to get rid of one more horse-frightening pathname. svn path=/trunk/; revision=10955
* As noted by Thomas Anders, the Heimdal libroken library has a base64_decode()Olivier Biot2004-05-101-2/+2
| | | | | | | | | function with a different signature than the one defined in util.c/util.h. For this reason, we need to rename our base64_decode() routine. The routine is now called epan_base64_decode(). svn path=/trunk/; revision=10840
* Don't automatically set a capture filter if DISPLAY or REMOTEHOST areGerald Combs2004-03-121-5/+12
| | | | | | "localhost" or "127.0.0.1". svn path=/trunk/; revision=10365
* Use G_DIR_SEPARATOR_S rather than "/" as the pathname separator whenGuy Harris2004-02-071-2/+2
| | | | | | | constructing the pathname of a temporary file, so as not to frighten the horses when they see an error message for a temporary capture file. svn path=/trunk/; revision=10002
* Rename DISSECTOR_HELPER_{SRC,OBJECTS} toGuy Harris2004-01-111-302/+1
| | | | | | | | | | | | | | | | DISSECTOR_SUPPORT_{SRC,OBJECTS}. Add some additional files, required by dissectors, to those lists. Extract the stuff to get version information strings for libraries and the OS, which is *not* needed by dissectors, from "util.c", which contains routines that *are* needed by dissectors, and put it into a separate file. Make "dftest" link only with the dissector support stuff, not with all of the Ethereal common files. svn path=/trunk/; revision=9645
* removed some MSVC warnings (moved pcap.h before glib.h)Ulf Lamping2003-12-211-5/+5
| | | | svn path=/trunk/; revision=9393
* From Olivier BiotGilbert Ramirez2003-12-061-1/+35
| | | | | | | | | | | New "matches" operater in display filter language. Uses PCRE. If a "matches" operator is found in a dfilter while libpcre has not been used to build the binary, then an exception is thrown after using dfilter_fail() to set an apporporiate error message. svn path=/trunk/; revision=9182
* Don't automatically fill in a capture filter if CLIENTNAME is set toGerald Combs2003-12-011-3/+5
| | | | | | "Console". svn path=/trunk/; revision=9130
* Check the environment variables SSH_CONNECTION, SSH_CLIENT, REMOTEHOST,Gerald Combs2003-11-181-1/+50
| | | | | | | | | DISPLAY, and CLIENTNAME (in that order). If any of them are set, create a capture filter that excludes their traffic and set it as the default. The longer filters should be efficient without being overly long; they may need some tweaking. svn path=/trunk/; revision=8994
* From Gisle Vanem:Gerald Combs2003-11-021-8/+8
| | | | | | | | | | | | | | | | | | * 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
* Include <windows.h> so that OSVERSIONINFO and the like are defined onGuy Harris2003-10-311-1/+11
| | | | | | Windows. svn path=/trunk/; revision=8841
* Get the version number of the libpcap/WinPcap with which we're runningGuy Harris2003-10-101-46/+5
| | | | | | with "pcap_lib_version()", if available. svn path=/trunk/; revision=8656
* From Gisle Vanem: MingW declares "rint()" in <math.h> and defines it inGuy Harris2003-08-181-2/+4
| | | | | | a library, and declares "mode_t" in <sys/types.h>. svn path=/trunk/; revision=8185
* From smhuang [AT] pcs.csie.nctu.edu.tw: fix a "g_string_append()" call.Guy Harris2003-07-111-2/+2
| | | | svn path=/trunk/; revision=8014
* Fixes to get it to compile on Win32.Guy Harris2003-06-131-8/+6
| | | | svn path=/trunk/; revision=7878
* On Win32, say "without WinPcap" rather than "without libpcap" (althoughGuy Harris2003-06-131-1/+5
| | | | | | | | it's unlikely that somebody would build without WinPcap - they'd currently have to manually tweak config.h.win32; we can do the same trick there that we do with ADNS). svn path=/trunk/; revision=7877
* Do run-time word-wrapping on the "Compiled with" message, rather thanGuy Harris2003-06-131-14/+78
| | | | | | | | | | wiring the line boundaries in. On Win32, say "with WinPcap" rather than "with libpcap", and report both on whether we were compiled with WinPcap and whether we were able to load WinPcap. svn path=/trunk/; revision=7876
* Put in a missing comma.Guy Harris2003-06-131-2/+2
| | | | svn path=/trunk/; revision=7869
* Add ADNS to the "Compiled with" list. Wrap at the SNMP library part sinceGerald Combs2003-05-261-4/+10
| | | | | | the line was getting long. svn path=/trunk/; revision=7747
* Move the base64_decode() function somewhere where other dissectors canTim Potter2003-05-231-1/+34
| | | | | | use it. svn path=/trunk/; revision=7723
* Change the version messages to put the "compiled with" stuff on aGuy Harris2003-03-121-10/+19
| | | | | | | separate line, and to put the "running with" info on a separate line from that, to make the output narrower. svn path=/trunk/; revision=7344
* If we have <windows.h>, we need to include it to declare OSVERSIONINFO.Guy Harris2003-03-081-4/+8
| | | | | | | | | | | | | Fix some typos. Put the build number after the "szCSDVersion" value; on NT, that makes it show up as "Windows {NT x.y,2000,XP,etc.} Service Pack N, build N", and on OT, it might make it show up as "Windows {95,98,Me} X, build N", where "X" might be "A" or "B" or something such as that. (We might want to omit the space before "szCSDVersion" on Windows OT - I think the "right" name might be something like "Windows 95B", but I'm not sure.) svn path=/trunk/; revision=7324
* Put the code to get version numbers of various libraries with whichGuy Harris2003-03-081-1/+223
| | | | | | | | | Ethereal/Tethereal was linked into a common routine, and use that in both Ethereal and Tethereal. Add to that routine code to get OS version information. svn path=/trunk/; revision=7320
* Removed trailing whitespaces from .h and .c files using theJörg Mayer2002-08-281-6/+6
| | | | | | | winapi_cleanup tool written by Patrik Stridvall for the wine project. svn path=/trunk/; revision=6117
* Replace the types from sys/types.h and netinet/in.h by their glib.hJörg Mayer2002-08-021-5/+1
| | | | | | | | equivalents for the toplevel directory. The removal of winsock2.h will hopefully not cause any problems under MSVC++, as those files using struct timeval still include wtap.h, which still includes winsock2.h. svn path=/trunk/; revision=5932
* More static-ization. In util.c, I commented out the ASCII-to-EBCDICGilbert Ramirez2002-04-081-1/+3
| | | | | | functions, until that time that we need them. svn path=/trunk/; revision=5130
* Wrap calls to "pcap_datalink()" in a routine that attempts to compensateGuy Harris2001-11-091-302/+2
| | | | | | | | | | | | | | for AIX 5.x's non-standard libpcap, where "pcap_datalink()" doesn't return DLT_ values, it returns RFC 1573 ifType values. Put that wrapper, and the routine to get the interface list, in a separate file, for packet-capture utility routines, so not everybody who includes "util.h" needs to include <pcap.h>. Fix up the Wiretap hack for dealing with said incompatibility to use the correct ifType value for Token Ring. svn path=/trunk/; revision=4184
* Fix the rest of the signed/unsigned comparison warnings.Gilbert Ramirez2001-10-261-2/+2
| | | | svn path=/trunk/; revision=4088
* On Windows, use the directory in which the binary resides as theGuy Harris2001-08-211-48/+2
| | | | | | | | | | | | | | | | | | | | | | 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. svn path=/trunk/; revision=3858
* "get_home_dir()", in "epan/filesystem.c", usesGuy Harris2001-04-021-92/+1
| | | | | | | | | | | | | "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. svn path=/trunk/; revision=3241
* Throw in a cast to squelch a complaint from Visual C++ 6.0.Guy Harris2001-03-221-2/+2
| | | | svn path=/trunk/; revision=3157