Changeset 2adaf1d


Ignore:
Timestamp:
Oct 11, 2002, 3:44:22 PM (18 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
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • ChangeLog

    r88736cb r2adaf1d  
    1111          segfault
    1212        Fixed some typos in the intro doc
     13        Removed old zlog functions from zephyr.c
     14        Implemented the dump command
     15        New startup message
    1316       
    14171.2.5
  • commands.c

    r486688f r2adaf1d  
    169169              "and displays them.\n"),
    170170
     171  OWLCMD_ARGS("dump", owl_command_dump, OWL_CTX_ANY,
     172              "dump messages to a file",
     173              "dump <filename>",
     174              "Dump messages in current view to the named file."),
     175
    171176  OWLCMD_ARGS("smartzpunt", owl_command_smartzpunt, OWL_CTX_INTERACTIVE,
    172177              "creates a zpunt based on the current message",
     
    779784  sprintf(buff, "Owl version %s", OWL_VERSION_STRING);
    780785  owl_function_makemsg(buff);
     786}
     787
     788char *owl_command_dump(int argc, char **argv, char *buff) {
     789  if (argc!=2) {
     790    owl_function_makemsg("usage: dump <filename>");
     791    return(NULL);
     792  }
     793
     794  owl_function_dump(argv[1]);
     795  return(NULL);
    781796}
    782797
  • 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}
  • zephyr.c

    rbde7714 r2adaf1d  
    173173  }
    174174  return(0);
    175 }
    176 
    177 
    178 void zlog_in() {
    179   int ret;
    180 
    181   ret=ZSetLocation(EXPOSE_NETVIS);
    182   /* do something on failure */
    183 }
    184 
    185 void zlog_out() {
    186   int ret;
    187 
    188   ret=ZUnsetLocation();
    189   /* do something on failure */
    190175}
    191176
Note: See TracChangeset for help on using the changeset viewer.