Commit 40458b2c authored by Seblu's avatar Seblu
Browse files

new history system (no history classes)

history can now be save in file and load from file
options load environ
error class are now used
some fixes
parent d93c109b
Loading
Loading
Loading
Loading
+2 −2
Changes for slc/trunk/Makefile.am: 2 added lines, 2 removed lines.
Original line number Diff line number Diff line
@@ -6,8 +6,8 @@ slc_SOURCES= src/slc.hh \
		src/options.hh		\
		src/screen.hh		\
		src/screen.cc		\
		src/history.hh		\
		src/history.cc
		src/error.hh		\
		src/error.cc

CLEANFILES= *~ '\#*' .*.swp .*~

+1 −2
Changes for slc/trunk/TODO: 1 added line, 2 removed lines.
Original line number Diff line number Diff line
Gestion du redimensionnements
Gestion de plus de touche
sauvegarde de l'history dans un fichier
Tout le reste...
−31

File deleted.

−26

File deleted.

+15 −6
Changes for slc/trunk/src/options.cc: 15 added lines, 6 removed lines.
Original line number Diff line number Diff line
@@ -2,9 +2,12 @@
#include "options.hh"

#include <getopt.h>
#include <stdlib.h>

Options::Options() {
  port = 18136;
  history_size = 100;
  history_file = (string) getenv("HOME") + "/.slc_history";
}

void Options::usage(const char *name, ostream &out) const {
@@ -56,10 +59,16 @@ Options &Options::load(int argc, char *argv[]) {
  return *this;
}

ostream &operator<< (ostream &s, const Options &o) {
  return s << "server: " << o.server << std::endl
	   << "port: " << o.port << std::endl
	   << "host login: " << o.login << std::endl
	   << "host pass: " << o.pass << std::endl;
}
Options &Options::loadenv() {
  const char *senv;

  // Get history path
  if ((senv = getenv("SLC_HISTORY_FILE")) != 0 && *senv != 0)
    history_file = senv;

  // Get history size
  if ((senv = getenv("SLC_HISTORY_SIZE")) != 0 && *senv != 0)
    history_size = atoi(senv);

  return *this;
}
Loading