diff options
author | Pali Rohár <pali.rohar@gmail.com> | 2012-08-10 10:39:39 +0200 |
---|---|---|
committer | Pali Rohár <pali.rohar@gmail.com> | 2012-08-10 10:39:39 +0200 |
commit | bc9441ddd6686643e7637454cd4b4dbfce7a0179 (patch) | |
tree | 77347ec4b141fad4ab9b54d920e75961a518dbd7 | |
parent | 6e0941a3c433ddb753a732ab71b13ddb8566e733 (diff) | |
download | 0xFFFF-bc9441ddd6686643e7637454cd4b4dbfce7a0179.tar.bz2 |
qmode: Prepair for new code
-rw-r--r-- | src/qmode.c | 35 | ||||
-rw-r--r-- | src/qmode.h | 25 |
2 files changed, 52 insertions, 8 deletions
diff --git a/src/qmode.c b/src/qmode.c index c725995..79e4de8 100644 --- a/src/qmode.c +++ b/src/qmode.c @@ -1,6 +1,7 @@ /* * 0xFFFF - Open Free Fiasco Firmware Flasher * Copyright (C) 2008 pancake <pancake@youterm.com> + * Copyright (C) 2012 Pali Rohár <pali.rohar@gmail.com> * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -16,30 +17,47 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -#include "main.h" -#include "os.h" #include <stdio.h> #include <string.h> #include <stdlib.h> #include <signal.h> + +#include <unistd.h> #include <sys/types.h> #include <sys/wait.h> #include <sys/stat.h> +#include "qmode.h" +#include "nolo.h" + +#if __linux__ || __NetBSD__ || __FreBSD__ || __OpenBSD__ || __Darwin__ || __MacOSX__ +#define HAVE_SQUEUE 1 +#else +#define HAVE_SQUEUE 0 +#endif + +#if HAVE_SQUEUE + +#include "squeue/squeue.h" +extern int qmode; +extern struct squeue_t *p; + +#endif + #if HAVE_SQUEUE struct squeue_t *q; struct squeue_t *p; -int fork_enabled = 0; -int dofork() +static int fork_enabled = 0; +static int dofork() { if (fork_enabled) return fork(); return 0; } -void process_message(char *msg) +static void process_message(char *msg) { char *str; char *arg; @@ -78,7 +96,7 @@ void process_message(char *msg) free(str); } -static void cc() +static void cc(int signum) { squeue_close(p); squeue_close(q); @@ -88,7 +106,7 @@ static void cc() exit(1); } -int queue_mode() +int queue_mode(void) { int pid = 0; char *msg; @@ -138,9 +156,10 @@ int queue_mode() return 0; } #else -int queue_mode() +int queue_mode(void) { /* dummy */ fprintf(stderr, "No HAVE_SQUEUE support\n"); + return 1; } #endif diff --git a/src/qmode.h b/src/qmode.h new file mode 100644 index 0000000..793337b --- /dev/null +++ b/src/qmode.h @@ -0,0 +1,25 @@ +/* + * 0xFFFF - Open Free Fiasco Firmware Flasher + * Copyright (C) 2008 pancake <pancake@youterm.com> + * Copyright (C) 2012 Pali Rohár <pali.rohar@gmail.com> + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +#ifndef QMODE_H +#define QMODE_H + +int queue_mode(void); + +#endif |