IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Oct 15, 2005, 2:41:53 PM (21 years ago)
Author:
eugene
Message:

cursor now returns a string for key

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Ohana/src/opihi/cmd.data/cursor.c

    r2843 r5349  
    33int cursor (int argc, char **argv) {
    44
    5   char buffer[40], string[20], key;
     5  char buffer[40], string[20], key[20], keyname[20];
    66  int i, N, Nsource, Source, IsImage;
    77  double X, Y, R, D, Z;
     
    4949  Z = -1.0;
    5050  for (i = 0; ((i < N) || (N == 0)) && !interrupt; i++) {
    51     bzero (buffer, 20);
    52     read (Source, buffer, 32);
    53     buffer[32] = 0;
    54     sscanf (buffer, "%c %lf %lf", &key, &X, &Y);
    55 
    56     sprintf (string, "X%1c", key);
     51    bzero (buffer, 40);
     52    read (Source, buffer, 40);
     53    buffer[39] = 0;
     54    sscanf (buffer, "%s %lf %lf", key, &X, &Y);
     55    if (ispunct(key[0])) {
     56      strcpy (keyname, "_");
     57    } else {
     58      strcpy (keyname, key);
     59    }
     60    sprintf (string, "X%s", keyname);
    5761    set_variable (string, X);
    58     sprintf (string, "Y%1c", key);
     62    sprintf (string, "Y%s", keyname);
    5963    set_variable (string, Y);
    60     sprintf (string, "%c", key);
    61     set_str_variable ("KEY", string);
     64    set_str_variable ("KEY", key);
    6265   
    6366    if (IsImage && (buf != NULL))
     
    6669    if (!IsImage) {
    6770      XY_to_RD (&R, &D, X, Y, &graphmode.coords);
    68       sprintf (string, "R%1c", key);
     71      sprintf (string, "R%s", keyname);
    6972      set_variable (string, R);
    70       sprintf (string, "D%1c", key);
     73      sprintf (string, "D%s", keyname);
    7174      set_variable (string, D);
    7275    }
     
    7477    /* I still don't like this, but I have to decide which to print... */
    7578    if (IsImage) {
    76       fprintf (GetOutfile(), "%c %f %f  %f\n", key, X, Y, Z);
     79      fprintf (GetOutfile(), "%s %f %f  %f\n", key, X, Y, Z);
    7780    } else {
    78       fprintf (GetOutfile(), "%c %f %f\n", key, X, Y);
     81      fprintf (GetOutfile(), "%s %f %f\n", key, X, Y);
    7982    }
    8083
    81     if ((key == 'q') || (key == 'Q')) {
     84    if (!strcasecmp (key, "Q")) {
    8285      signal (SIGINT, (void *) oldsignal);
    8386      write (Source, "NCUR", 4); /* ask Source to stop looking for the keystrokes */
Note: See TracChangeset for help on using the changeset viewer.