Changeset 2adaf1d for functions.c


Ignore:
Timestamp:
Oct 11, 2002, 3:44:22 PM (19 years ago)
Author:
James M. Kretchmar <kretch@mit.edu>
Branches:
master, barnowl_perlaim, debian, owl, release-1.4, release-1.5, release-1.6, release-1.7, release-1.8, release-1.9
Children:
b45293f
Parents:
88736cb
Message:
Added the dump command
removed old zlog functions
File:
1 edited

Legend:

Unmodified
Added
Removed
  • functions.c

    r88736cb r2adaf1d  
    66#include <com_err.h>
    77#include <time.h>
     8#include <sys/types.h>
     9#include <sys/stat.h>
    810#include "owl.h"
    911
     
    24612463  owl_free(ourfile);
    24622464}
     2465
     2466void owl_function_dump(char *filename) {
     2467  int i, j, count;
     2468  owl_message *m;
     2469  owl_view *v;
     2470  FILE *file;
     2471  /* struct stat sbuf; */
     2472
     2473  v=owl_global_get_current_view(&g);
     2474
     2475  /* in the future make it ask yes/no */
     2476  /*
     2477  ret=stat(filename, &sbuf);
     2478  if (!ret) {
     2479    ret=owl_function_askyesno("File exists, continue? [Y/n]");
     2480    if (!ret) return;
     2481  }
     2482  */
     2483
     2484  file=fopen(filename, "w");
     2485  if (!file) {
     2486    owl_function_makemsg("Error opening file");
     2487    return;
     2488  }
     2489
     2490  count=0;
     2491  j=owl_view_get_size(v);
     2492  for (i=0; i<j; i++) {
     2493    m=owl_view_get_element(v, i);
     2494    fputs(owl_message_get_text(m), file);
     2495  }
     2496  fclose(file);
     2497}
Note: See TracChangeset for help on using the changeset viewer.