summaryrefslogtreecommitdiff
path: root/file.c
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2007-03-14 19:30:19 +0000
committerGuy Harris <guy@alum.mit.edu>2007-03-14 19:30:19 +0000
commit082282b6f400e66592006d5a1c38641f2d06cf1e (patch)
treeb0e928dfc37e0d0d13539ee488c669e550936992 /file.c
parent50bb064108bcab0a2047d2e93d081100e7fef7d2 (diff)
downloadwireshark-082282b6f400e66592006d5a1c38641f2d06cf1e.tar.gz
Don't enable "Save As" if you don't have an unsaved live capture file
and there are no formats in which the file can be saved by some means other than copying the raw data; "Save As" isn't a very useful function in that case, and that prevents us from having an empty list of formats in which the file can be saved. svn path=/trunk/; revision=21032
Diffstat (limited to 'file.c')
-rw-r--r--file.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/file.c b/file.c
index cc61a67a2a..a3de5552d0 100644
--- a/file.c
+++ b/file.c
@@ -3332,6 +3332,28 @@ save_packet(capture_file *cf _U_, frame_data *fdata,
return TRUE;
}
+/*
+ * Can this capture file be saved in any format except by copying the raw data?
+ */
+gboolean
+cf_can_save_as(capture_file *cf)
+{
+ int ft;
+
+ for (ft = 0; ft < WTAP_NUM_FILE_TYPES; ft++) {
+ /* To save a file with Wiretap, Wiretap has to handle that format,
+ and its code to handle that format must be able to write a file
+ with this file's encapsulation type. */
+ if (wtap_dump_can_open(ft) && wtap_dump_can_write_encap(ft, cf->lnk_t)) {
+ /* OK, we can write it out in this type. */
+ return TRUE;
+ }
+ }
+
+ /* No, we couldn't save it in any format. */
+ return FALSE;
+}
+
cf_status_t
cf_save(capture_file *cf, const char *fname, packet_range_t *range, guint save_format, gboolean compressed)
{