summaryrefslogtreecommitdiff
path: root/wsutil/tempfile.h
diff options
context:
space:
mode:
authorJeff Morriss <jeff.morriss.ws@gmail.com>2013-06-26 01:14:35 +0000
committerJeff Morriss <jeff.morriss.ws@gmail.com>2013-06-26 01:14:35 +0000
commitbbf6a3766e65ebc66f06f936e530e79ec2d5b31b (patch)
tree36807307f1569f29471ae157dcc82141c422a1ad /wsutil/tempfile.h
parent3ab335948b76b1a87fd0c193050673ffd37c9a86 (diff)
downloadwireshark-bbf6a3766e65ebc66f06f936e530e79ec2d5b31b.tar.gz
Move tempfile.{h,c} into wsutil.
svn path=/trunk/; revision=50163
Diffstat (limited to 'wsutil/tempfile.h')
-rw-r--r--wsutil/tempfile.h66
1 files changed, 66 insertions, 0 deletions
diff --git a/wsutil/tempfile.h b/wsutil/tempfile.h
new file mode 100644
index 0000000000..65746704dd
--- /dev/null
+++ b/wsutil/tempfile.h
@@ -0,0 +1,66 @@
+/* tempfile.h
+ * Declarations of routines to create temporary files
+ *
+ * $Id$
+ *
+ * Wireshark - Network traffic analyzer
+ * By Gerald Combs <gerald@wireshark.org>
+ * Copyright 1998 Gerald Combs
+ *
+ * This program 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 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program 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 this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#ifndef __TEMPFILE_H__
+#define __TEMPFILE_H__
+
+#include "ws_symbol_export.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/** @file
+ * Convenience function for temporary file creation.
+ */
+
+
+/**
+ * Create a tempfile with the given prefix (e.g. "wireshark"). The path
+ * is created using g_get_tmp_dir and mkstemp.
+ *
+ * @param namebuf If not NULL, receives the full path of the temp file.
+ * Must NOT be freed.
+ * @param pfx A prefix for the temporary file.
+ * @return The file descriptor of the new tempfile, from mkstemp().
+ */
+WS_DLL_PUBLIC int create_tempfile(char **namebuf, const char *pfx);
+
+/**
+ * Create a directory with the given prefix (e.g. "wireshark"). The path
+ * is created using g_get_tmp_dir and mkdtemp.
+ *
+ * @param namebuf If not NULL, receives the full path of the temp directory.
+ * Must NOT be freed.
+ * @param pfx A prefix for the temporary directory.
+ * @return The temporary directory path on success, or NULL on failure.
+ * Must NOT be freed.
+ */
+WS_DLL_PUBLIC const char *create_tempdir(char **namebuf, const char *pfx);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* __TEMPFILE_H__ */