4 * $Id: util.h,v 1.22 2000/10/11 07:35:00 guy Exp $
6 * Ethereal - Network traffic analyzer
7 * By Gerald Combs <gerald@zing.org>
8 * Copyright 1998 Gerald Combs
11 * This program is free software; you can redistribute it and/or
12 * modify it under the terms of the GNU General Public License
13 * as published by the Free Software Foundation; either version 2
14 * of the License, or (at your option) any later version.
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the Free Software
23 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
31 #endif /* __cplusplus */
34 * Given a pathname, return:
36 * the errno, if an attempt to "stat()" the file fails;
38 * EISDIR, if the attempt succeeded and the file turned out
41 * 0, if the attempt succeeded and the file turned out not
44 int test_for_directory(const char *);
47 * Given a pathname, return a pointer to the last pathname separator
48 * character in the pathname, or NULL if the pathname contains no
51 char *find_last_pathname_separator(char *);
54 * Given a pathname, return the last component.
56 char *get_basename(char *);
59 * Given a pathname, return a string containing everything but the
60 * last component. NOTE: this overwrites the pathname handed into
63 char *get_dirname(char *);
65 int create_tempfile(char *, int, const char *);
67 /* Returns the user's home directory, via the HOME environment
68 * variable, or a default directory if HOME is not set */
69 const char* get_home_dir(void);
72 * Collect command-line arguments as a string consisting of the arguments,
73 * separated by spaces.
75 char *get_args_as_string(int argc, char **argv, int optind);
77 void ASCII_to_EBCDIC(guint8 *buf, guint bytes);
78 guint8 ASCII_to_EBCDIC1(guint8 c);
79 void EBCDIC_to_ASCII(guint8 *buf, guint bytes);
80 guint8 EBCDIC_to_ASCII1(guint8 c);
84 GList *get_interface_list(int *err, char *err_str);
86 /* Error values from "get_interface_list()". */
87 #define CANT_GET_INTERFACE_LIST 0 /* error getting list */
88 #define NO_INTERFACES_FOUND 1 /* list is empty */
90 void free_interface_list(GList *if_list);
94 /* Compute the difference between two seconds/microseconds time stamps. */
95 void compute_timestamp_diff(gint *, gint *, guint32, guint32, guint32, guint32);
99 #endif /* __cplusplus */
101 #endif /* __UTIL_H__ */