Changeset 95474d7 for functions.c


Ignore:
Timestamp:
Jan 3, 2005, 10:34:02 PM (16 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:
15b34fd
Parents:
4e0f545
Message:
In load-subs: Print an error message if the file is unreadable or
doesn't exist, UNLESS load-subs is called with no arguments.  In that
case only print an error if the file exists but isn't readable.  Still
prints an error either way if zephyr reports a failure. [BZ 19]
File:
1 edited

Legend:

Unmodified
Added
Removed
  • functions.c

    r8232149 r95474d7  
    854854}
    855855
     856
     857/* Load zephyr subscriptions from the named 'file' and load zephyr's
     858 * default subscriptions as well.  An error message is printed if
     859 * 'file' can't be opened or if zephyr reports an error in
     860 * subscribing.
     861 *
     862 * If 'file' is NULL, this look for the default filename
     863 * $HOME/.zephyr.subs.  If the file can not be opened in this case
     864 * only, no error message is printed.
     865 */
    856866void owl_function_loadsubs(char *file)
    857867{
    858868  int ret, ret2;
    859 
    860   ret=owl_zephyr_loadsubs(file);
     869  char *foo;
     870
     871  if (file==NULL) {
     872    ret=owl_zephyr_loadsubs(NULL, 0);
     873  } else {
     874    ret=owl_zephyr_loadsubs(file, 1);
     875  }
    861876
    862877  /* for backwards compatibility for now */
     
    864879
    865880  if (!owl_context_is_interactive(owl_global_get_context(&g))) return;
    866   if (ret==0) {
    867     owl_function_makemsg("Subscribed to messages from file.");
     881
     882  foo=file?file:"file";
     883  if (ret==0 && ret2==0) {
     884    if (!file) {
     885      owl_function_makemsg("Subscribed to messages.");
     886    } else {
     887      owl_function_makemsg("Subscribed to messages from %s", file);
     888    }
    868889  } else if (ret==-1) {
    869     owl_function_error("Could not open file.");
     890    owl_function_error("Could not read %s", foo);
    870891  } else {
    871     owl_function_error("Error subscribing to messages from file.");
     892    owl_function_error("Error subscribing to messages");
    872893  }
    873894}
Note: See TracChangeset for help on using the changeset viewer.