IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jan 4, 2006, 10:00:28 PM (21 years ago)
Author:
eugene
Message:

fixes for skyregion, generate

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Ohana/src/opihi/lib.shell/startup.c

    r4689 r5900  
    11# include "opihi.h"
    22
    3 /* program-independent initialization */
    4 void startup (int argc, char **argv) {
     3/* program-independent initialization
     4 * these steps do not depend on the opihi implementation
     5 * (ie, the supplied commands or data structures)
     6 */
    57
    6   long A, B;
    7    
    8   signal (SIGINT, SIG_IGN);
     8void general_init (int argc, char **argv) {
    99
    1010  /* init srand for rnd numbers elsewhere */
     11  long A, B;
    1112  A = time(NULL);
    1213  for (B = 0; A == time(NULL); B++);
    1314  srand48(B);
    1415 
    15   if (0) {
    16     /* fix the history list to remove the timestamp */
    17     char *c;
    18     int i;
    19     HIST_ENTRY **entry;
    20    
    21     entry = history_list ();
    22     if (entry != (HIST_ENTRY **) NULL) {
    23       for (i = 0; entry[i]; i++) {
    24         if ((strlen (entry[i][0].line) > 19) &&
    25             (entry[i][0].line[2] == '/') &&
    26             (entry[i][0].line[5] == '/') &&
    27             (entry[i][0].line[11] == ':') &&
    28             (entry[i][0].line[14] == ':') &&
    29             (entry[i][0].line[17] == ':')) {
    30           c = entry[i][0].line + 19;
    31           memmove (entry[i][0].line, c, strlen(c) + 1);
    32         }
    33       }
    34     }
     16  /* set signals */
     17  signal (SIGINT, SIG_IGN);
     18
     19  /* load config data (.ptolemyrc) */
     20  if (!ConfigInit (&argc, argv)) {
     21    fprintf (stderr, "can't find config file. some functions will be unavailable\n");
    3522  }
    36  
    37   {
     23
     24  return;
     25}
     26
     27void startup (int argc, char **argv) {
    3828   
    3929    int i, N, status, ONLY_INPUT, LOAD_RC;
     
    5747  */
    5848
    59     if (!ConfigInit (&argc, argv)) {
    60       fprintf (stderr, "can't find config file. some functions will be unavailable\n");
     49
     50
     51  /* check history file permission */
     52  {
     53    FILE *f;
     54    char *opihi_history;
     55
     56    opihi_history = get_variable ("RCFILE");
     57    f = fopen (opihi_history, "a");
     58    if (f == NULL) /* no current history file here */
     59      fprintf (stderr, "can't save history.\n");
     60    else
     61      fclose (f);
     62    stifle_history (200);
     63    read_history (opihi_history);
     64  }
     65
     66  if (0) {
     67    /* fix the history list to remove the timestamp */
     68    char *c;
     69    int i;
     70    HIST_ENTRY **entry;
     71   
     72    entry = history_list ();
     73    if (entry != (HIST_ENTRY **) NULL) {
     74      for (i = 0; entry[i]; i++) {
     75        if ((strlen (entry[i][0].line) > 19) &&
     76            (entry[i][0].line[2] == '/') &&
     77            (entry[i][0].line[5] == '/') &&
     78            (entry[i][0].line[11] == ':') &&
     79            (entry[i][0].line[14] == ':') &&
     80            (entry[i][0].line[17] == ':')) {
     81          c = entry[i][0].line + 19;
     82          memmove (entry[i][0].line, c, strlen(c) + 1);
     83        }
     84      }
    6185    }
    6286
Note: See TracChangeset for help on using the changeset viewer.