Esempio n. 1
0
int
fixInstallPath (char **path) {
  static const char *programDirectory = NULL;

  if (!programDirectory) {
    if ((programDirectory = getPathDirectory(programPath))) {
      registerProgramMemory("program-directory", &programDirectory);
    } else {
      logMessage(LOG_WARNING, gettext("cannot determine program directory"));
      programDirectory = ".";
    }

    logMessage(LOG_DEBUG, "program directory: %s", programDirectory);
  }

  {
    const char *problem = strtext("cannot fix install path");
    char *newPath = makePath(programDirectory, *path);

    if (newPath) {
      if (changeStringSetting(path, newPath)) {
        if (isAbsolutePath(*path)) {
          problem = NULL;
        } else {
          problem = strtext("install path not absolute");
        }
      }

      free(newPath);
    }

    if (problem) {
      logMessage(LOG_WARNING, "%s: %s", gettext(problem), *path);
      return 0;
    }
  }

  return 1;
}
Esempio n. 2
0
};
const unsigned int logLevelCount = ARRAY_COUNT(logLevelNames);

unsigned char systemLogLevel = LOG_NOTICE;
unsigned char stderrLogLevel = LOG_NOTICE;

typedef struct {
  const char *name;
  const char *title;
  const char *prefix;
} LogCategoryEntry;

static const LogCategoryEntry logCategoryTable[LOG_CATEGORY_COUNT] = {
  [LOG_CATEGORY_INDEX(GENERIC_INPUT)] = {
    .name = "ingio",
    .title = strtext("Generic Input"),
    .prefix = "generic input"
  },

  [LOG_CATEGORY_INDEX(INPUT_PACKETS)] = {
    .name = "inpkts",
    .title = strtext("Input Packets"),
    .prefix = "input packet"
  },

  [LOG_CATEGORY_INDEX(OUTPUT_PACKETS)] = {
    .name = "outpkts",
    .title = strtext("Output Packets"),
    .prefix = "output packet"
  },
Esempio n. 3
0
#include "ttb.h"

static char *opt_tablesDirectory;
static char *opt_inputTable;
static char *opt_outputTable;
static int opt_sixDots;
static int opt_noBaseCharacters;

static const char tableName_autoselect[] = "auto";
static const char tableName_unicode[] = "unicode";

BEGIN_OPTION_TABLE(programOptions)
  { .letter = 'T',
    .word = "tables-directory",
    .flags = OPT_Hidden | OPT_Config | OPT_Environ,
    .argument = strtext("directory"),
    .setting.string = &opt_tablesDirectory,
    .internal.setting = TABLES_DIRECTORY,
    .internal.adjust = fixInstallPath,
    .description = strtext("Path to directory for text tables.")
  },

  { .letter = 'i',
    .word = "input-table",
    .flags = OPT_Config | OPT_Environ,
    .argument = strtext("file"),
    .setting.string = &opt_inputTable,
    .internal.setting = tableName_autoselect,
    .description = strtext("Path to input text table.")
  },
Esempio n. 4
0
size_t
formatCharacterDescription (char *buffer, size_t size, int column, int row) {
  static char *const colours[] = {
    strtext("black"),
    strtext("blue"),
    strtext("green"),
    strtext("cyan"),
    strtext("red"),
    strtext("magenta"),
    strtext("brown"),
    strtext("light grey"),
    strtext("dark grey"),
    strtext("light blue"),
    strtext("light green"),
    strtext("light cyan"),
    strtext("light red"),
    strtext("light magenta"),
    strtext("yellow"),
    strtext("white")
  };

  size_t length;
  ScreenCharacter character;

  readScreen(column, row, 1, 1, &character);
  STR_BEGIN(buffer, size);

  {
    uint32_t text = character.text;

    STR_PRINTF("char %" PRIu32 " (U+%04" PRIX32 "): %s on %s",
               text, text,
               gettext(colours[character.attributes & 0X0F]),
               gettext(colours[(character.attributes & 0X70) >> 4]));
  }

  if (character.attributes & SCR_ATTR_BLINK) {
    STR_PRINTF(" %s", gettext("blink"));
  }

#ifdef HAVE_ICU
  {
    char name[0X40];
    UErrorCode error = U_ZERO_ERROR;

    u_charName(character.text, U_EXTENDED_CHAR_NAME, name, sizeof(name), &error);
    if (U_SUCCESS(error)) {
      STR_PRINTF(" [%s]", name);
    }
  }
#endif /* HAVE_ICU */

  length = STR_LENGTH;
  STR_END;
  return length;
}
Esempio n. 5
0
#include "scr.auto.h"

typedef enum {
  PARM_MESSAGE
} ScreenParameters;
#define SCRPARMS "message"

#define SCRSYMBOL noScreen
#define DRIVER_NAME NoScreen
#define DRIVER_CODE no
#define DRIVER_COMMENT "no screen support"
#define DRIVER_VERSION ""
#define DRIVER_DEVELOPERS ""
#include "scr_driver.h"

static const char defaultScreenMessage[] = strtext("no screen");
static const char *screenMessage = defaultScreenMessage;

static int
processParameters_NoScreen (char **parameters) {
  {
    const char *message = parameters[PARM_MESSAGE];

    screenMessage = (message && *message)? message: gettext(defaultScreenMessage);
  }

  return 1;
}

static int
currentVirtualTerminal_NoScreen (void) {
Esempio n. 6
0
const TuneDefinition tune_braille_off = {
  NULL, 0, elements_braille_off
};

static const TuneElement elements_command_done[] = {
  TUNE_NOTE( 40,  74),
  TUNE_REST( 30),
  TUNE_NOTE( 40,  74),
  TUNE_REST( 40),
  TUNE_NOTE(140,  74),
  TUNE_REST( 20),
  TUNE_NOTE( 50,  79),
  TUNE_STOP()
};
const TuneDefinition tune_command_done = {
  strtext("Done"), 0, elements_command_done
};

static const TuneElement elements_command_rejected[] = {
  TUNE_NOTE(100,  78),
  TUNE_STOP()
};
const TuneDefinition tune_command_rejected = {
  NULL, TUNE_TACTILE(50,BRL_DOT1|BRL_DOT2|BRL_DOT3|BRL_DOT4|BRL_DOT5|BRL_DOT6|BRL_DOT7|BRL_DOT8), elements_command_rejected
};

static const TuneElement elements_mark_set[] = {
  TUNE_NOTE( 20,  83),
  TUNE_NOTE( 15,  81),
  TUNE_NOTE( 15,  79),
  TUNE_NOTE( 25,  84),