Branch: Tag:

2000-08-29

2000-08-29 13:33:46 by Fredrik Noring <noring@nocrew.org>

The prompt now (optionally) uses bold characters.

Rev: server/bin/create_configif.pike:1.25

1:   /* -  * $Id: create_configif.pike,v 1.24 2000/08/29 12:01:05 noring Exp $ +  * $Id: create_configif.pike,v 1.25 2000/08/29 13:33:46 noring Exp $    *    * Create an initial administration interface server.    */
37:    signal(signum("SIGINT"));    }    -  string read(mixed ... args) +  private string safe_value(string r)    { -  string r = ::read(@args); -  +     if(!r)    {    /* C-d? */    werror("\nTerminal closed, exit.\n");    destruct(this_object()); -  exit(0); +  exit(1);    }       return r;    }    -  string edit(mixed ... args) +  string read(mixed ... args)    { -  string r = ::edit(@args); +  return safe_value(::read(@args)); +  }    -  if(!r) +  string edit(mixed ... args)    { -  /* C-d? */ -  werror("\nTerminal closed, exit.\n"); -  destruct(this_object()); -  exit(0); +  return safe_value(::edit(@args));    }    -  return r; -  } -  +     void create(mixed ... args)    {    signal(signum("SIGINT"), trap_signal);
77:   string read_string(Readline rl, string prompt, string|void def,    string|void batch)   { -  string res = batch || rl->read( prompt+(def? " ["+def+"]":"")+": " ); +  string res = batch || rl->edit(def || "", prompt+": ", ({ "bold" }));    if( def && !strlen(res-" ") )    res = def;    return res;
208:    write("\n");    } while(!strlen(password) || (password != passwd2));    write("\n"); -  } while( strlen( passwd2 = read_string(rl, "Ok?", "y", batch->ok ) ) && passwd2[0]=='n' ); +  } while( strlen( passwd2 = read_string(rl, "Ok? (y/n)", "y", batch->ok ) ) && passwd2[0]=='n' );       if( !admin )    {
221:    write(" contact update servers at Roxen Internet Software over the Internet.\n\n");    write(" Do you want to enable this?\n\n");    } -  if(!(strlen( passwd2 = read_string(rl, "Ok?", "y", batch->update ) ) && passwd2[0]=='n' )) +  if(!(strlen( passwd2 = read_string(rl, "Ok? (y/n)", "y", batch->update ) ) && passwd2[0]=='n' ))    {    use_update_system=1;    if(!batch->community_user) {