Hello, all. Here I send an indicative patch as to which parts of brltty
don't even compile in GRUB. Additionally the files options.c and async.c
were excluded for now. Currently missing symbols:
missing async.c (it probably has to be mostly rewritten for GRUB):
asyncRelativeAlarm
No exit, so no atexit either:
atexit in braille_core is not defined
Missing shared loading wrappers:
findSharedSymbol in braille_core is not defined
loadSharedObject in braille_core is not defined
unloadSharedObject in braille_core is not defined
GRUB has no getopt, instead options are preparsed by GRUB, a bit similar
to argp:
processOptions in braille_core is not defined
GRUB has two possible clock sources: pretty exact one from arbitrary
point in the past or daytime with precision of seconds but no datetime
with precision up to milliseconds:
gettimeofday in braille_core is not defined
Misc:
usbForgetDevices in braille_core is not defined
Parts #if 0-out'ed due to:
-Lack of users (well there is a auth subsystem but there is no concept
"running under user")
-No float/double
-No exit
-No signals
-No writing support
-No freopen
-No cwd concept
-No pipes
-No executables
Other changes:
- Other directory organisation
- GRUB has no "access". Best way to check that file exists is try to
open it. So I changed "check-open" into "open-check"
-Add missing const qualifiers
-Fix format security
--
Regards
Vladimir 'φ-coder/phcoder' Serbinenko
diff -ur /home/phcoder/repos/brltty/Programs/auth.c grub-core/braille/brltty/Programs/auth.c
--- /home/phcoder/repos/brltty/Programs/auth.c 2012-03-15 14:54:22.122970000 +0100
+++ grub-core/braille/brltty/Programs/auth.c 2012-03-17 01:35:51.042626849 +0100
@@ -25,7 +25,10 @@
#if defined(__MINGW32__)
#include <ws2tcpip.h>
-#elif defined(__MSDOS__)
+#elif !defined (HAVE_USERS)
+
+#define uid_t int
+#define gid_t int
#else /* Unix */
#include <sys/socket.h>
@@ -629,7 +632,7 @@
void
formatAddress (char *buffer, int bufferSize, const void *address, int addressSize) {
-#ifdef __MSDOS__
+#if !defined (HAVE_USERS)
snprintf(buffer, bufferSize, "unknown");
#else /* __MSDOS__ */
const struct sockaddr *sa = address;
Only in /home/phcoder/repos/brltty/Programs: auth.o
diff -ur /home/phcoder/repos/brltty/Programs/beeper.c grub-core/braille/brltty/Programs/beeper.c
--- /home/phcoder/repos/brltty/Programs/beeper.c 2012-03-15 14:54:22.122970000 +0100
+++ grub-core/braille/brltty/Programs/beeper.c 2012-03-17 01:36:22.662627570 +0100
@@ -55,6 +55,7 @@
return 1;
}
+#ifndef HAVE_FLOAT
if (asynchronousBeep((int)noteFrequencies[note], duration*4)) {
accurateDelay(duration);
stopBeep();
@@ -68,6 +69,7 @@
}
return synchronousBeep((int)noteFrequencies[note], duration);
+#endif
}
static int
diff -ur /home/phcoder/repos/brltty/Programs/brltty.c grub-core/braille/brltty/Programs/brltty.c
--- /home/phcoder/repos/brltty/Programs/brltty.c 2012-03-15 14:54:22.122970000 +0100
+++ grub-core/braille/brltty/Programs/brltty.c 2012-03-22 16:33:03.434717144 +0100
@@ -133,6 +133,7 @@
closeLogFile();
}
+#ifdef HAVE_EXIT
static void
handleSignal (int number, void (*handler) (int)) {
#ifdef HAVE_SIGACTION
@@ -154,6 +155,7 @@
testProgramTermination (void) {
if (terminationSignal) exit(0);
}
+#endif
static void
terminationHandler (int signalNumber) {
@@ -1143,6 +1145,7 @@
atexit(exitLog);
openSystemLog();
+#ifdef HAVE_SIGNALS
#ifdef SIGPIPE
/* We install SIGPIPE handler before startup() so that drivers which
* use pipes can't cause program termination (the call to message() in
@@ -1154,6 +1157,7 @@
/* Install the program termination handler. */
handleSignal(SIGTERM, terminationHandler);
handleSignal(SIGINT, terminationHandler);
+#endif
/* Setup everything required on startup */
startup(argc, argv);
@@ -1173,7 +1177,9 @@
int command;
+#ifdef HAVE_EXIT
testProgramTermination();
+#endif
command = restartRequired? BRL_CMD_RESTARTBRL: readBrailleCommand(&brl, getScreenCommandContext());
@@ -2058,7 +2064,7 @@
int column, row;
if (getCharacterCoordinates(arg, &column, &row, 0, 0)) {
- static char *colours[] = {
+ static const char *colours[] = {
strtext("black"),
strtext("blue"),
strtext("green"),
@@ -2273,7 +2279,9 @@
brlttyUpdate (void) {
if (!brlttyPrepare()) return 0;
+#ifdef HAVE_EXIT
testProgramTermination();
+#endif
closeTuneDevice(0);
checkRoutingStatus(ROUTING_DONE, 0);
@@ -2842,7 +2850,9 @@
if (flags & MSG_WAITKEY) {
while (1) {
int command = readCommand(KTB_CTX_WAITING);
+#ifdef HAVE_EXIT
testProgramTermination();
+#endif
if (command == EOF) {
drainBrailleOutput(&brl, updateInterval);
closeTuneDevice(0);
@@ -2855,7 +2865,9 @@
for (i=0; i<messageDelay; i+=updateInterval) {
int command;
+#ifdef HAVE_EXIT
testProgramTermination();
+#endif
drainBrailleOutput(&brl, updateInterval);
command = readCommand(KTB_CTX_WAITING);
diff -ur /home/phcoder/repos/brltty/Programs/cmds.auto.h grub-core/braille/brltty/Programs/cmds.auto.h
--- /home/phcoder/repos/brltty/Programs/cmds.auto.h 2010-11-19 06:05:00.690134950 +0100
+++ grub-core/braille/brltty/Programs/cmds.auto.h 2012-03-16 21:32:44.294294016 +0100
@@ -517,6 +517,7 @@
.description = "bring cursor to character"
}
,
+#if 0
{
.name = "CUTBEGIN",
.code = BRL_BLK_CUTBEGIN,
@@ -545,6 +546,7 @@
.description = "linear cut to character"
}
,
+#endif
{
.name = "SWITCHVT",
.code = BRL_BLK_SWITCHVT,
@@ -621,6 +623,7 @@
.description = "go down to nearest line with different character"
}
,
+#if 0
{
.name = "COPYCHARS",
.code = BRL_BLK_COPYCHARS,
@@ -635,6 +638,7 @@
.description = "append characters to cut buffer"
}
,
+#endif
{
.name = "PASSKEY",
.code = BRL_BLK_PASSKEY,
Only in grub-core/braille/brltty/Programs: cmds.auto.h~
diff -ur /home/phcoder/repos/brltty/Programs/config.c grub-core/braille/brltty/Programs/config.c
--- /home/phcoder/repos/brltty/Programs/config.c 2012-03-15 14:54:22.122970000 +0100
+++ grub-core/braille/brltty/Programs/config.c 2012-03-22 17:05:18.286761292 +0100
@@ -124,9 +124,9 @@
static char *oldPreferencesFile = NULL;
static int oldPreferencesEnabled = 1;
-static char *opt_tablesDirectory;
-static char *opt_textTable;
-static char *opt_attributesTable;
+static const char *opt_tablesDirectory;
+static const char *opt_textTable;
+static const char *opt_attributesTable;
#ifdef ENABLE_CONTRACTED_BRAILLE
static char *opt_contractionTable;
@@ -871,10 +871,11 @@
char *path = makePreferencesFilePath(opt_preferencesFile);
if (path) {
- if (testPath(path)) {
- oldPreferencesEnabled = 0;
- if (loadPreferencesFile(path)) ok = 1;
- }
+ if (loadPreferencesFile(path))
+ {
+ ok = 1;
+ oldPreferencesEnabled = 0;
+ }
free(path);
}
@@ -2070,7 +2071,7 @@
void
restartBrailleDriver (void) {
stopBrailleDriver();
- logMessage(LOG_INFO, gettext("reinitializing braille driver"));
+ logMessage(LOG_INFO, "%s", gettext("reinitializing braille driver"));
tryBrailleDriver();
}
@@ -2360,16 +2361,21 @@
static void
exitPidFile (void) {
+#ifdef HAVE_WRITE
unlink(opt_pidFile);
+#endif
}
static int tryPidFile (ProcessIdentifier pid);
static void
retryPidFile (void *data) {
+#ifdef HAVE_WRITE
tryPidFile(0);
+#endif
}
+#ifdef HAVE_WRITE
static int
tryPidFile (ProcessIdentifier pid) {
int created = createPidFile(opt_pidFile, pid);
@@ -2386,6 +2392,7 @@
return created;
}
+#endif
#if defined(__MINGW32__)
static void
@@ -2456,7 +2463,7 @@
free(variableName);
}
-#elif defined(__MSDOS__)
+#elif defined(__MSDOS__) || !defined (HAVE_WRITE)
#else /* Unix */
static void
@@ -2608,7 +2615,7 @@
identifySpeechDrivers(1);
#endif /* ENABLE_SPEECH_SUPPORT */
- exit(0);
+ return;
}
#ifdef __MINGW32__
@@ -2625,7 +2632,12 @@
stop = 1;
}
- if (stop) exit(0);
+ if (stop)
+#ifdef HAVE_EXIT
+ exit (0);
+#else
+ return;
+#endif
}
#endif /* __MINGW32__ */
@@ -2635,33 +2647,11 @@
&& !isWindowsService
#endif
) {
- background();
}
- tryPidFile(0);
if (!opt_noDaemon) {
setPrintOff();
- {
- const char *nullDevice = "/dev/null";
-
- if (!freopen(nullDevice, "r", stdin)) {
- logSystemError("freopen[stdin]");
- }
-
- if (!freopen(nullDevice, "a", stdout)) {
- logSystemError("freopen[stdout]");
- }
-
- if (opt_standardError) {
- fflush(stderr);
- } else {
- if (!freopen(nullDevice, "a", stderr)) {
- logSystemError("freopen[stderr]");
- }
- }
- }
-
#ifdef __MINGW32__
{
HANDLE h = CreateFile("NUL", GENERIC_READ|GENERIC_WRITE,
@@ -2693,16 +2683,6 @@
atexit(exitTunes);
suppressTuneDeviceOpenErrors();
- {
- char *directory;
- if ((directory = getWorkingDirectory())) {
- logMessage(LOG_INFO, "%s: %s", gettext("Working Directory"), directory);
- free(directory);
- } else {
- logMessage(LOG_ERR, "%s: %s", gettext("cannot determine working directory"), strerror(errno));
- }
- }
-
logMessage(LOG_INFO, "%s: %s", gettext("Writable Directory"), opt_writableDirectory);
writableDirectory = opt_writableDirectory;
@@ -2809,7 +2789,11 @@
/* The device(s) the braille display might be connected to. */
if (!*opt_brailleDevice) {
logMessage(LOG_ERR, gettext("braille device not specified"));
+#ifdef HAVE_EXIT
exit(4);
+#else
+ return;
+#endif
}
brailleDevices = splitString(opt_brailleDevice, ',', NULL);
@@ -2841,5 +2825,7 @@
}
#endif /* ENABLE_SPEECH_SUPPORT */
+#ifdef HAVE_EXIT
if (opt_verify) exit(0);
+#endif
}
diff -ur /home/phcoder/repos/brltty/Programs/ctb_translate.c grub-core/braille/brltty/Programs/ctb_translate.c
--- /home/phcoder/repos/brltty/Programs/ctb_translate.c 2012-03-15 14:54:22.122970000 +0100
+++ grub-core/braille/brltty/Programs/ctb_translate.c 2012-03-17 00:38:25.406548228 +0100
@@ -1441,6 +1441,7 @@
static int
contractTextExternally (void) {
+#ifdef HAVE_PIPES
setOffset();
while (++src < srcmax) clearOffset();
@@ -1453,6 +1454,7 @@
}
stopContractionCommand(table);
+#endif
return 0;
}
diff -ur /home/phcoder/repos/brltty/Programs/datafile.c grub-core/braille/brltty/Programs/datafile.c
--- /home/phcoder/repos/brltty/Programs/datafile.c 2012-03-15 14:54:22.122970000 +0100
+++ grub-core/braille/brltty/Programs/datafile.c 2012-03-18 01:57:29.294448631 +0100
@@ -74,7 +74,7 @@
}
void
-reportDataError (DataFile *file, char *format, ...) {
+reportDataError (DataFile *file, const char *format, ...) {
char message[0X100];
{
diff -ur /home/phcoder/repos/brltty/Programs/datafile.h grub-core/braille/brltty/Programs/datafile.h
--- /home/phcoder/repos/brltty/Programs/datafile.h 2012-03-15 14:54:22.122970000 +0100
+++ grub-core/braille/brltty/Programs/datafile.h 2012-03-18 01:57:53.194449176 +0100
@@ -33,7 +33,7 @@
typedef int DataProcessor (DataFile *file, void *data);
extern int processDataFile (const char *name, DataProcessor processor, void *data);
-extern void reportDataError (DataFile *file, char *format, ...) PRINTF(2, 3);
+extern void reportDataError (DataFile *file, const char *format, ...) PRINTF(2, 3);
extern int processDataStream (
Queue *variables,
Only in /home/phcoder/repos/brltty/Programs: datafile.o
diff -ur /home/phcoder/repos/brltty/Programs/device.c grub-core/braille/brltty/Programs/device.c
--- /home/phcoder/repos/brltty/Programs/device.c 2012-03-15 14:54:22.122970000 +0100
+++ grub-core/braille/brltty/Programs/device.c 2012-03-16 16:02:48.720992618 +0100
@@ -29,6 +29,7 @@
#include "file.h"
#include "misc.h"
+#if 0
int
getConsole (void) {
static int console = -1;
@@ -151,6 +152,8 @@
return device;
}
+#endif
+
int
isQualifiedDevice (const char **identifier, const char *qualifier) {
size_t count = strcspn(*identifier, ":");
Only in /home/phcoder/repos/brltty/Programs: device.o
Only in /home/phcoder/repos/brltty/Programs: driver.o
Only in /home/phcoder/repos/brltty/Programs: drivers.o
diff -ur /home/phcoder/repos/brltty/Programs/file.c grub-core/braille/brltty/Programs/file.c
--- /home/phcoder/repos/brltty/Programs/file.c 2012-03-15 14:54:22.122970000 +0100
+++ grub-core/braille/brltty/Programs/file.c 2012-03-22 17:03:22.386758650 +0100
@@ -149,6 +149,8 @@
return joinStrings(strings, count);
}
+#if 0
+
int
testPath (const char *path) {
return access(path, F_OK) != -1;
@@ -176,7 +178,7 @@
}
if (mkdir(path
-#ifndef __MINGW32__
+#if 0
,S_IRWXU|S_IRGRP|S_IXGRP|S_IROTH|S_IXOTH
#endif /* __MINGW32__ */
) != -1) {
@@ -190,14 +192,17 @@
return 0;
}
+#endif
const char *writableDirectory = NULL;
const char *
getWritableDirectory (void) {
+#if 0
if (writableDirectory && *writableDirectory)
if (ensureDirectory(writableDirectory))
return writableDirectory;
+#endif
return NULL;
}
@@ -209,6 +214,7 @@
return NULL;
}
+#if 0
char *
getWorkingDirectory (void) {
size_t size = 0X80;
@@ -254,43 +260,28 @@
return strdup(path);
}
-const char *
-getOverrideDirectory (void) {
- static const char *directory = NULL;
-
- if (!directory) {
- static const char subdirectory[] = "." PACKAGE_NAME;
-
- {
- char *homeDirectory = getHomeDirectory();
+#endif
- if (homeDirectory) {
- directory = makePath(homeDirectory, subdirectory);
- free(homeDirectory);
- if (directory) goto gotDirectory;
- }
- }
-
- {
- char *workingDirectory = getWorkingDirectory();
+#include <grub/env.h>
- if (workingDirectory) {
- directory = makePath(workingDirectory, subdirectory);
- free(workingDirectory);
- if (directory) goto gotDirectory;
- }
- }
-
- directory = "";
- logMessage(LOG_WARNING, "no override directory");
- goto ready;
-
- gotDirectory:
- logMessage(LOG_INFO, "Override Directory: %s", directory);
- }
-
-ready:
- return *directory? directory: NULL;
+const char *
+getOverrideDirectory (void) {
+ static char *directory = NULL;
+ const char *prefix;
+ char *ptr;
+
+ if (directory)
+ return directory;
+
+ prefix = grub_env_get ("prefix");
+ if (!prefix)
+ return NULL;
+ directory = malloc (grub_strlen (prefix) + sizeof ("/brltty"));
+ if (!directory)
+ return NULL;
+ ptr = stpcpy (directory, prefix);
+ grub_memcpy (ptr, "/brltty", sizeof ("/brltty"));
+ return directory;
}
FILE *
@@ -298,7 +289,7 @@
FILE *file = fopen(path, mode);
if (file) {
- logMessage(LOG_DEBUG, "file opened: %s fd=%d", path, fileno(file));
+ logMessage(LOG_DEBUG, "file opened: %s fd=%p", path, file);
} else {
logMessage((optional && (errno == ENOENT))? LOG_DEBUG: LOG_ERR,
"cannot open file: %s: %s", path, strerror(errno));
@@ -317,13 +308,13 @@
if (!overrideDirectory) {
overridePath = NULL;
} else if ((overridePath = makePath(overrideDirectory, name))) {
- if (testPath(overridePath)) {
- file = openFile(overridePath, mode, optional);
+ file = openFile(overridePath, mode, optional);
+ if (file)
goto done;
- }
}
if (!(file = openFile(path, mode, optional))) {
+#if 0
if ((*mode == 'w') || (*mode == 'a')) {
if (errno == ENOENT) {
char *directory = getPathDirectory(path);
@@ -346,6 +337,7 @@
}
}
}
+#endif
}
done:
diff -ur /home/phcoder/repos/brltty/Programs/io_misc.c grub-core/braille/brltty/Programs/io_misc.c
--- /home/phcoder/repos/brltty/Programs/io_misc.c 2012-03-15 14:54:22.122970000 +0100
+++ grub-core/braille/brltty/Programs/io_misc.c 2012-03-18 01:49:28.214437653 +0100
@@ -40,6 +40,7 @@
static int
awaitFileDescriptor (int fileDescriptor, int milliseconds, int output) {
+#if 0
#ifdef __MSDOS__
int left = milliseconds * 1000;
#endif /* __MSDOS__ */
@@ -114,6 +115,7 @@
errno = EAGAIN;
return 0;
}
+#endif
}
int
@@ -127,6 +129,7 @@
void *buffer, size_t *offset, size_t count,
int initialTimeout, int subsequentTimeout
) {
+#if 0
#ifdef __MSDOS__
int tried = 0;
goto noInput;
@@ -176,6 +179,7 @@
*offset += amount;
count -= amount;
}
+#endif
return 1;
}
@@ -195,6 +199,7 @@
return awaitFileDescriptor(fileDescriptor, milliseconds, 1);
}
+#ifdef HAVE_WRITE
ssize_t
writeData (int fileDescriptor, const void *buffer, size_t size) {
const unsigned char *address = buffer;
@@ -233,6 +238,7 @@
return address - start;
}
}
+#endif
int
changeOpenFlags (int fileDescriptor, int flagsToClear, int flagsToSet) {
diff -ur /home/phcoder/repos/brltty/Programs/lock.c grub-core/braille/brltty/Programs/lock.c
--- /home/phcoder/repos/brltty/Programs/lock.c 2012-03-15 14:54:22.122970000 +0100
+++ grub-core/braille/brltty/Programs/lock.c 2012-03-16 21:14:16.762268744 +0100
@@ -23,7 +23,7 @@
#ifdef __MINGW32__
#include "win_pthread.h"
-#elif defined(__MSDOS__)
+#elif defined(__MSDOS__) || 1
#else /* posix threads */
#include <pthread.h>
@@ -31,7 +31,7 @@
#include "lock.h"
-#ifdef __MSDOS__
+#if defined (__MSDOS__) || 1
LockDescriptor *
newLockDescriptor (void) {
return NULL;
diff -ur /home/phcoder/repos/brltty/Programs/menu.c grub-core/braille/brltty/Programs/menu.c
--- /home/phcoder/repos/brltty/Programs/menu.c 2012-03-15 14:54:22.122970000 +0100
+++ grub-core/braille/brltty/Programs/menu.c 2012-03-22 13:35:28.106474016 +0100
@@ -331,6 +331,7 @@
files->paths[files->count] = NULL;
index = files->count;
+#if 0
{
#ifdef HAVE_FCHDIR
int originalDirectory = open(".", O_RDONLY);
@@ -405,6 +406,7 @@
#endif /* HAVE_FCHDIR */
}
}
+#endif
qsort(&files->paths[index], files->count-index, sizeof(*files->paths), qsortCompare_fileNames);
if (files->none) files->paths[--index] = "";
Only in /home/phcoder/repos/brltty/Programs: midi.o
diff -ur /home/phcoder/repos/brltty/Programs/misc.c grub-core/braille/brltty/Programs/misc.c
--- /home/phcoder/repos/brltty/Programs/misc.c 2012-03-15 14:54:22.122970000 +0100
+++ grub-core/braille/brltty/Programs/misc.c 2012-03-17 01:44:55.070639260 +0100
@@ -27,7 +27,9 @@
static void
noMemory (void) {
logMessage(LOG_CRIT, "insufficient memory: %s", strerror(errno));
+#ifdef HAVE_EXIT
exit(3);
+#endif
}
void *
Only in /home/phcoder/repos/brltty/Programs: misc.o
Only in /home/phcoder/repos/brltty/Programs: mount.o
diff -ur /home/phcoder/repos/brltty/Programs/notes.h grub-core/braille/brltty/Programs/notes.h
--- /home/phcoder/repos/brltty/Programs/notes.h 2012-03-15 14:54:22.122970000 +0100
+++ grub-core/braille/brltty/Programs/notes.h 2012-03-16 16:37:54.641040671 +0100
@@ -37,7 +37,9 @@
extern const NoteMethods midiMethods;
extern const NoteMethods fmMethods;
+#if 0
extern const float noteFrequencies[];
+#endif
extern const unsigned int noteCount;
#ifdef __cplusplus
Only in /home/phcoder/repos/brltty/Programs: options.o
diff -ur /home/phcoder/repos/brltty/Programs/parse.c grub-core/braille/brltty/Programs/parse.c
--- /home/phcoder/repos/brltty/Programs/parse.c 2012-03-15 14:54:22.122970000 +0100
+++ grub-core/braille/brltty/Programs/parse.c 2012-03-22 17:06:26.414762849 +0100
@@ -27,7 +27,6 @@
char **
splitString (const char *string, char delimiter, int *count) {
char **array = NULL;
-
if (string) {
while (1) {
const char *start = string;
@@ -130,6 +129,7 @@
return 0;
}
+#ifdef HAVE_FLOAT
int
isFloat (float *value, const char *string) {
if (*string) {
@@ -142,6 +142,7 @@
}
return 0;
}
+#endif
int
isLogLevel (int *level, const char *string) {
@@ -183,6 +184,8 @@
return 1;
}
+#ifdef HAVE_FLOAT
+
int
validateFloat (float *value, const char *string, const float *minimum, const float *maximum) {
if (*string) {
@@ -195,6 +198,8 @@
return 1;
}
+#endif
+
int
validateChoice (unsigned int *value, const char *string, const char *const *choices) {
int length = strlen(string);
@@ -324,7 +329,8 @@
}
void
-logParameters (const char *const *names, char **values, char *description) {
+logParameters (const char *const *names, char **values,
+ const char *description) {
if (names && values) {
while (*names) {
logMessage(LOG_INFO, "%s: %s=%s", description, *names, *values);
diff -ur /home/phcoder/repos/brltty/Programs/parse.h grub-core/braille/brltty/Programs/parse.h
--- /home/phcoder/repos/brltty/Programs/parse.h 2012-03-15 14:54:22.122970000 +0100
+++ grub-core/braille/brltty/Programs/parse.h 2012-03-22 17:06:19.962762698 +0100
@@ -31,18 +31,24 @@
extern int isInteger (int *value, const char *string);
extern int isUnsignedInteger (unsigned int *value, const char *string);
+#ifdef HAVE_FLOAT
extern int isFloat (float *value, const char *string);
+#endif
extern int isLogLevel (int *level, const char *string);
extern int validateInteger (int *value, const char *string, const int *minimum, const int *maximum);
+#ifdef HAVE_FLOAT
extern int validateFloat (float *value, const char *string, const float *minimum, const float *maximum);
+#endif
extern int validateChoice (unsigned int *value, const char *string, const char *const *choices);
extern int validateFlag (unsigned int *value, const char *string, const char *on, const char *off);
extern int validateOnOff (unsigned int *value, const char *string);
extern int validateYesNo (unsigned int *value, const char *string);
extern char **getParameters (const char *const *names, const char *qualifier, const char *parameters);
-extern void logParameters (const char *const *names, char **values, char *description);
+void
+logParameters (const char *const *names, char **values,
+ const char *description);
#ifdef __cplusplus
}
Only in /home/phcoder/repos/brltty/Programs: parse.o
Only in /home/phcoder/repos/brltty/Programs: pcm.o
diff -ur /home/phcoder/repos/brltty/Programs/pid.h grub-core/braille/brltty/Programs/pid.h
--- /home/phcoder/repos/brltty/Programs/pid.h 2012-03-15 14:54:22.122970000 +0100
+++ grub-core/braille/brltty/Programs/pid.h 2012-03-16 19:18:01.246109585 +0100
@@ -28,7 +28,7 @@
#define PRIpid "lu"
#define SCNpid "lu"
-#elif defined(__MSDOS__)
+#elif defined(__MSDOS__) || 1
typedef int ProcessIdentifier;
#define PRIpid "d"
#define SCNpid "d"
Only in /home/phcoder/repos/brltty/Programs: pid.o
diff -ur /home/phcoder/repos/brltty/Programs/prefs.c grub-core/braille/brltty/Programs/prefs.c
--- /home/phcoder/repos/brltty/Programs/prefs.c 2012-03-15 14:54:22.122970000 +0100
+++ grub-core/braille/brltty/Programs/prefs.c 2012-03-22 16:08:07.586683014 +0100
@@ -437,8 +437,12 @@
char *
makePreferencesFilePath (const char *name) {
+#ifdef HAVE_WRITE
if (!name) name = PREFERENCES_FILE;
return makePath(STATE_DIRECTORY, name);
+#else
+ return NULL;
+#endif
}
static int
Only in grub-core/braille/brltty/Programs: #program.c#
diff -ur /home/phcoder/repos/brltty/Programs/program.c grub-core/braille/brltty/Programs/program.c
--- /home/phcoder/repos/brltty/Programs/program.c 2012-03-15 14:54:22.122970000 +0100
+++ grub-core/braille/brltty/Programs/program.c 2012-03-18 20:46:08.924344645 +0100
@@ -55,6 +55,7 @@
#endif /* ENABLE_I18N_SUPPORT */
}
+#ifdef HAVE_EXECUTABLES
static char *
testProgram (const char *directory, const char *name) {
char *path;
@@ -92,6 +93,7 @@
return path;
}
+#endif
void
prepareProgram (int argumentCount, char **argumentVector) {
@@ -101,6 +103,7 @@
prepareLocale();
+#ifdef HAVE_EXECUTABLES
if (!(programPath = getProgramPath())) programPath = argumentVector[0];
if (!isExplicitPath(programPath)) {
@@ -122,19 +125,14 @@
}
}
#endif /* defined(HAVE_REALPATH) && defined(PATH_MAX) */
-
- if (!isAbsolutePath(programPath)) {
- char *directory;
-
- if ((directory = getWorkingDirectory())) {
- char *path;
- if ((path = makePath(directory, programPath))) programPath = path;
- free(directory);
- }
- }
}
programName = locatePathName(programPath);
+#else
+ programName = "brltty";
+ programPath = "brltty";
+#endif
+
setLogPrefix(programName);
}
@@ -150,6 +148,7 @@
fixInstallPaths (char **const *paths) {
static const char *programDirectory = NULL;
+#ifdef HAVE_EXECUTABLES
if (!programDirectory) {
if (!(programDirectory = getPathDirectory(programPath))) {
logMessage(LOG_WARNING, gettext("cannot determine program directory"));
@@ -172,6 +171,7 @@
paths += 1;
}
+#endif
}
void
@@ -182,6 +182,7 @@
int
createPidFile (const char *path, ProcessIdentifier pid) {
+#ifdef HAVE_FILE_WRITE
if (!pid) pid = getProcessIdentifier();
if (path && *path) {
@@ -274,6 +275,7 @@
break;
}
}
+#endif
return 0;
}
diff -ur /home/phcoder/repos/brltty/Programs/routing.c grub-core/braille/brltty/Programs/routing.c
--- /home/phcoder/repos/brltty/Programs/routing.c 2012-03-15 14:54:22.122970000 +0100
+++ grub-core/braille/brltty/Programs/routing.c 2012-03-16 19:55:47.198161281 +0100
@@ -52,7 +52,9 @@
} RoutingResult;
typedef struct {
+#if 0
sigset_t signalMask;
+#endif
int screenNumber;
int screenRows;
diff -ur /home/phcoder/repos/brltty/Programs/spk.h grub-core/braille/brltty/Programs/spk.h
--- /home/phcoder/repos/brltty/Programs/spk.h 2012-03-15 14:54:22.122970000 +0100
+++ grub-core/braille/brltty/Programs/spk.h 2012-03-15 15:13:29.539622630 +0100
@@ -39,15 +39,21 @@
extern void setSpeechVolume (SpeechSynthesizer *spk, int setting, int say);
extern unsigned int getIntegerSpeechVolume (unsigned char setting, unsigned int normal);
+#ifdef HAVE_FLOAT
extern float getFloatSpeechVolume (unsigned char setting);
+#endif
extern void setSpeechRate (SpeechSynthesizer *spk, int setting, int say);
extern unsigned int getIntegerSpeechRate (unsigned char setting, unsigned int normal);
+#ifdef HAVE_FLOAT
extern float getFloatSpeechRate (unsigned char setting);
+#endif
extern void setSpeechPitch (SpeechSynthesizer *spk, int setting, int say);
extern unsigned int getIntegerSpeechPitch (unsigned char setting, unsigned int normal);
+#ifdef HAVE_FLOAT
extern float getFloatSpeechPitch (unsigned char setting);
+#endif
extern void setSpeechPunctuation (SpeechSynthesizer *spk, SpeechPunctuation setting, int say);
diff -ur /home/phcoder/repos/brltty/Programs/timing.c grub-core/braille/brltty/Programs/timing.c
--- /home/phcoder/repos/brltty/Programs/timing.c 2012-03-15 14:54:22.122970000 +0100
+++ grub-core/braille/brltty/Programs/timing.c 2012-03-17 01:50:15.582646574 +0100
@@ -33,7 +33,9 @@
void
approximateDelay (int milliseconds) {
if (milliseconds > 0) {
-#if defined(__MINGW32__)
+#if 1
+ grub_millisleep (milliseconds);
+#elif defined(__MINGW32__)
Sleep(milliseconds);
#elif defined(__MSDOS__)
tsr_usleep(milliseconds*1000);
@@ -60,6 +62,9 @@
void
accurateDelay (int milliseconds) {
+#if 1
+ grub_millisleep (milliseconds);
+#else
static int tickLength = 0;
struct timeval start;
@@ -89,6 +94,7 @@
tsr_usleep(1);
#endif /* __MSDOS__ */
}
+#endif
}
int
diff -ur /home/phcoder/repos/brltty/Programs/tunes.c grub-core/braille/brltty/Programs/tunes.c
--- /home/phcoder/repos/brltty/Programs/tunes.c 2012-03-15 14:54:22.122970000 +0100
+++ grub-core/braille/brltty/Programs/tunes.c 2012-03-16 16:38:06.369040938 +0100
@@ -302,6 +302,7 @@
NULL, 0, elements_routing_failed
};
+#if 0
const float noteFrequencies[] = {
/* 0 -5C */ 8.176,
/* 1 -5C# */ 8.662,
@@ -433,6 +434,7 @@
/* 127 +5G */ 12543.854
};
const unsigned int noteCount = ARRAY_COUNT(noteFrequencies);
+#endif
static const NoteMethods *noteMethods = NULL;
static NoteDevice *noteDevice = NULL;
_______________________________________________
This message was sent via the BRLTTY mailing list.
To post a message, send an e-mail to: [email protected]
For general information, go to: http://mielke.cc/mailman/listinfo/brltty