Changeset 61e79a9


Ignore:
Timestamp:
Sep 2, 2002, 12:10:37 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:
5145235
Parents:
c01e477
Message:
The tty variable now controls the zephyr location tty name
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • ChangeLog

    rc01e477 r61e79a9  
    1818        Moved zsig generation to the zwrite object
    1919        Print the zsig used for outgoing messages
    20         Started changes to tty variables *** NOT DONE ***
     20        The tty variable now controls the zephyr location tty name
    2121       
    22221.2.2
  • global.c

    rc01e477 r61e79a9  
    6363  strcpy(g->buffercommand, "");
    6464
     65 
    6566  owl_global_set_config_format(g, 0);
    6667  owl_global_set_userclue(g, OWL_USERCLUE_NONE);
     
    381382}
    382383
    383 /* tty (not fully implemented yet) */
    384 
    385 void owl_global_set_tty_old(owl_global *g, char *tty) {
    386   if (tty) {
    387     strcpy(g->thistty, tty);
    388   } else if (getenv("DISPLAY")) {
    389     strcpy(g->thistty, getenv("DISPLAY"));
    390   } else if (ttyname(fileno(stdout))) {
    391     strcpy(g->thistty, ttyname(fileno(stdout)));
    392     if (!strncmp(g->thistty, "/dev/", 5)) {
    393       strcpy(g->thistty, g->thistty+5);
    394     }
    395   } else {
    396     strcpy(g->thistty, "unknown");
    397   }
    398    
    399 #ifdef HAVE_LIBZEPHYR_ZINITLOCATIONINFO
    400   ZInitLocationInfo(g->thishost, g->thistty);
    401 #endif
    402 }
    403 
    404 
    405384/* debug */
    406385
     
    427406  /* print something nicer later */   
    428407  sprintf(buff, "%i seconds", (int) diff);
     408}
     409
     410char *owl_global_get_hostname(owl_global *g) {
     411  return(g->thishost);
    429412}
    430413
  • owl.c

    r4b464a4 r61e79a9  
    132132  if (debug) owl_global_set_debug_on(&g);
    133133  owl_global_set_startupargs(&g, argcsave, argvsave);
    134   owl_global_set_tty(&g, tty);
    135134  owl_context_set_readconfig(owl_global_get_context(&g));
     135  if (tty) {
     136    owl_global_set_tty(&g, tty);
     137  } else {
     138    owl_global_set_tty(&g, owl_util_get_default_tty());
     139  }
    136140
    137141  /* setup the default filters */
  • owl.h

    r56330ff r61e79a9  
    368368  int typwinactive;
    369369  char thishost[LINE];
    370   char thistty[LINE];
    371370  char homedir[LINE];
    372371  int direction;
  • util.c

    r4b464a4 r61e79a9  
    494494}
    495495
     496char *owl_util_get_default_tty() {
     497  /* call must free the return */
     498  char *out;
     499
     500  if (getenv("DISPLAY")) {
     501    out=owl_strdup(getenv("DISPLAY"));
     502  } else if (ttyname(fileno(stdout))) {
     503    out=strdup(ttyname(fileno(stdout)));
     504    if (!strncmp(out, "/dev/", 5)) {
     505      owl_free(out);
     506      out=strdup(ttyname(fileno(stdout)+5));
     507    }
     508  } else {
     509    out=strdup("unknown");
     510  }
     511  return(out);
     512}
     513
     514
    496515void owl_hack_animate() {
    497516  owl_messagelist *ml;
  • variable.c

    rc01e477 r61e79a9  
    311311
    312312int owl_variable_tty_set(owl_variable *v, void *newval) {
    313   owl_function_makemsg("This is a test.");
     313  ZInitLocationInfo(owl_global_get_hostname(&g), newval);
    314314  return(owl_variable_string_set_default(v, newval));
    315315}
Note: See TracChangeset for help on using the changeset viewer.