* Added -n flag to do not write to disk or flash (simulation)
* Added -S flag to specify subversion id manually while flashing or dumping * Fixed support for the last fiasco image - Skip paddings - More verbose output while parsing FIASCO headers * Initial implementation of the full direct FIASCO flasher - No need to dump manually before flashing * Some warnings and code cleanup * Fix building issue * Add HAVE_GUI directive in config.mk * Up to version 0.4
This commit is contained in:
1 parent
edac98d26e
commit
3d427bfd77
11 files changed
+134
-41
No files matched your search
@@ -1,8 +1,10 @@
|
|||||||
VERSION=0.3.9
|
VERSION=0.4.0
|
||||||
PREFIX=/usr
|
PREFIX=/usr
|
||||||
|
|
||||||
|
|
||||||
# NetBSD stuff
|
# NetBSD stuff
|
||||||
CFLAGS+=-I/usr/pkg/include
|
CFLAGS+=-I/usr/pkg/include
|
||||||
LDFLAGS+=-L/usr/pkg/lib -Wl,-R/usr/pkg/lib
|
LDFLAGS+=-L/usr/pkg/lib -Wl,-R/usr/pkg/lib
|
||||||
|
|
||||||
HAVE_USB=1
|
HAVE_USB=1
|
||||||
|
HAVE_GUI=0
|
||||||
+4
-1
@@ -1,7 +1,10 @@
|
|||||||
OBJ=logotool.o compress.o uncompress.o rgb2yuv.o
|
OBJ=logotool.o compress.o uncompress.o rgb2yuv.o
|
||||||
CFLAGS=-Wall -g
|
CFLAGS=-Wall -g
|
||||||
|
BIN=logotool
|
||||||
|
|
||||||
all: ${OBJ}
|
all: ${BIN}
|
||||||
|
|
||||||
|
${BIN}: ${OBJ}
|
||||||
${CC} ${OBJ} -o logotool
|
${CC} ${OBJ} -o logotool
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
|
|||||||
+3
-1
@@ -10,7 +10,9 @@ CFLAGS+=-pedantic -std=c99 -DHAVE_USB=${HAVE_USB}
|
|||||||
USBOBJ=../libusb/error.o ../libusb/usb.o ../libusb/descriptors.o
|
USBOBJ=../libusb/error.o ../libusb/usb.o ../libusb/descriptors.o
|
||||||
USBOBJ+=../libusb/linux.o ## XXX not portable
|
USBOBJ+=../libusb/linux.o ## XXX not portable
|
||||||
|
|
||||||
all: ${OBJ}
|
all: ${BIN}
|
||||||
|
|
||||||
|
${BIN}: ${OBJ}
|
||||||
${CC} ${LDFLAGS} -o ${BIN} ${OBJ} ${LIBS}
|
${CC} ${LDFLAGS} -o ${BIN} ${OBJ} ${LIBS}
|
||||||
|
|
||||||
allusb: ${OBJ}
|
allusb: ${OBJ}
|
||||||
|
|||||||
+33
-10
@@ -27,16 +27,17 @@
|
|||||||
#include "main.h"
|
#include "main.h"
|
||||||
#include "hash.h"
|
#include "hash.h"
|
||||||
|
|
||||||
void (*fiasco_callback)(struct header_t *header) = NULL;
|
int (*fiasco_callback)(struct header_t *header) = NULL;
|
||||||
|
|
||||||
int openfiasco(char *name)
|
int openfiasco(char *name)
|
||||||
{
|
{
|
||||||
struct header_t header;
|
struct header_t header;
|
||||||
unsigned char buf[128];
|
unsigned char buf[128];
|
||||||
unsigned char data[128];
|
unsigned char data[128];
|
||||||
|
unsigned char *pdata;
|
||||||
unsigned int namelen;
|
unsigned int namelen;
|
||||||
off_t off;
|
off_t off, here;
|
||||||
int i;
|
int i,j;
|
||||||
header.fd = open(name, O_RDONLY);
|
header.fd = open(name, O_RDONLY);
|
||||||
|
|
||||||
if (header.fd == -1) {
|
if (header.fd == -1) {
|
||||||
@@ -66,14 +67,22 @@ int openfiasco(char *name)
|
|||||||
|
|
||||||
/* walk the tree */
|
/* walk the tree */
|
||||||
while(1) {
|
while(1) {
|
||||||
|
here = lseek(header.fd, 0, SEEK_CUR);
|
||||||
if (read(header.fd, buf, 9)<9)
|
if (read(header.fd, buf, 9)<9)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
if (buf[0] != 0x54) { // 'T'
|
if (buf[0] != 0x54) { // 'T'
|
||||||
printf("unexpected header at 0x%x, found %02x %02x %02x\n",
|
/* skipping some bytes */
|
||||||
((int)lseek(header.fd, 0, SEEK_CUR))-9,
|
lseek(header.fd, -9, SEEK_CUR);
|
||||||
buf[0], buf[1], buf[2]);
|
for(i=0;buf[0]!=0x54;i++) {
|
||||||
break;
|
j = read(header.fd, buf, 1);
|
||||||
|
if (j == -1) {
|
||||||
|
printf("Cannot find next FIASCO header\n");
|
||||||
|
return close(header.fd);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
printf("Skipping %d padding bytes\n", i);
|
||||||
|
lseek(header.fd, -1, SEEK_CUR);
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
header.hash = buf[7]<<8|buf[8];
|
header.hash = buf[7]<<8|buf[8];
|
||||||
|
|
||||||
@@ -92,6 +101,7 @@ int openfiasco(char *name)
|
|||||||
break;
|
break;
|
||||||
memcpy(&header.size, buf,4);
|
memcpy(&header.size, buf,4);
|
||||||
header.size = ntohl(header.size);
|
header.size = ntohl(header.size);
|
||||||
|
printf(" offset: 0x%08x\n", (unsigned int)here);
|
||||||
printf(" size: %d bytes\n", header.size);
|
printf(" size: %d bytes\n", header.size);
|
||||||
printf(" hash: %04x\n", header.hash);
|
printf(" hash: %04x\n", header.hash);
|
||||||
//printf("BYTE: %02x %02x %02x %02x %02x\n",
|
//printf("BYTE: %02x %02x %02x %02x %02x\n",
|
||||||
@@ -104,18 +114,31 @@ int openfiasco(char *name)
|
|||||||
i = data[0];
|
i = data[0];
|
||||||
if (read(header.fd, data, i)<i)
|
if (read(header.fd, data, i)<i)
|
||||||
break;
|
break;
|
||||||
if (data[0])
|
if (data[0]) {
|
||||||
printf(" version: %s\n", data);
|
printf(" version-length: %d\n", i);
|
||||||
|
printf(" version: %s\n", data);
|
||||||
|
pdata = data;
|
||||||
|
while(pdata<data+i) {
|
||||||
|
strcat(header.name,pdata==data?"-":",");
|
||||||
|
strcat(header.name, (char*)pdata);
|
||||||
|
printf(" sub-version: %s\n", pdata);
|
||||||
|
pdata=pdata+strlen((char*)pdata)+1;
|
||||||
|
for(;*pdata=='\0'&&pdata<data+i;pdata=pdata+1);
|
||||||
|
}
|
||||||
|
}
|
||||||
strcpy(header.version, (char *)data);
|
strcpy(header.version, (char *)data);
|
||||||
if (read(header.fd, buf+8, 1)<1)
|
if (read(header.fd, buf+8, 1)<1)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
printf(" name: %s\n", header.name);
|
||||||
/* callback */
|
/* callback */
|
||||||
off = lseek(header.fd, 0, SEEK_CUR);
|
off = lseek(header.fd, 0, SEEK_CUR);
|
||||||
|
printf(" body-at: 0x%08x\n", (unsigned int)off);
|
||||||
if (fiasco_callback != NULL) {
|
if (fiasco_callback != NULL) {
|
||||||
fiasco_callback(&header);
|
fiasco_callback(&header);
|
||||||
free(header.data);
|
free(header.data);
|
||||||
continue;
|
continue;
|
||||||
|
} else {
|
||||||
}
|
}
|
||||||
// XXX dup
|
// XXX dup
|
||||||
lseek(header.fd, off, SEEK_SET);
|
lseek(header.fd, off, SEEK_SET);
|
||||||
|
|||||||
+1
-1
@@ -74,7 +74,7 @@ void check_nolo_order()
|
|||||||
check_nolo_order_failed();
|
check_nolo_order_failed();
|
||||||
}
|
}
|
||||||
|
|
||||||
void flash_image(char *filename, char *piece, char *version)
|
void flash_image(const char *filename, const char *piece, const char *version)
|
||||||
{
|
{
|
||||||
FILE *fd;
|
FILE *fd;
|
||||||
int vlen = 0;
|
int vlen = 0;
|
||||||
|
|||||||
@@ -1,6 +1,13 @@
|
|||||||
|
include ../../config.mk
|
||||||
|
|
||||||
|
ifeq (${HAVE_GUI},1)
|
||||||
all:
|
all:
|
||||||
gtkamlc --save-temps --Xcc=-I../squeue ../squeue/squeue.c ../fpid.c ../squeue/squeue.vapi gui.gtkaml extras.vapi --pkg gtk+-2.0 -o goxf
|
gtkamlc --save-temps --Xcc=-I../squeue ../squeue/squeue.c ../fpid.c ../squeue/squeue.vapi gui.gtkaml extras.vapi --pkg gtk+-2.0 -o goxf
|
||||||
|
|
||||||
test:
|
test:
|
||||||
valac --save-temps --Xcc=-I.. squeue.vapi test.vala ../squeue.c -o v
|
valac --save-temps --Xcc=-I.. squeue.vapi test.vala ../squeue.c -o v
|
||||||
valac --save-temps --Xcc=-I.. squeue.vapi client.vala ../squeue.c -o c
|
valac --save-temps --Xcc=-I.. squeue.vapi client.vala ../squeue.c -o c
|
||||||
|
else
|
||||||
|
all:
|
||||||
|
@true
|
||||||
|
endif
|
||||||
+58
-12
@@ -32,6 +32,7 @@ struct usb_dev_handle *dev = NULL;
|
|||||||
char *fiasco_image = NULL;
|
char *fiasco_image = NULL;
|
||||||
char *boot_cmdline = NULL;
|
char *boot_cmdline = NULL;
|
||||||
char *reverseto = NULL;
|
char *reverseto = NULL;
|
||||||
|
char *subverstr = NULL;
|
||||||
int rd_mode = -1;
|
int rd_mode = -1;
|
||||||
int rd_flags = -1;
|
int rd_flags = -1;
|
||||||
int usb_mode = -1;
|
int usb_mode = -1;
|
||||||
@@ -42,6 +43,7 @@ int moboreboot = 0;
|
|||||||
int unpack = 0;
|
int unpack = 0;
|
||||||
int qmode = 0;
|
int qmode = 0;
|
||||||
int info = 0;
|
int info = 0;
|
||||||
|
int nomode = 0;
|
||||||
|
|
||||||
char *modes[]={
|
char *modes[]={
|
||||||
"host",
|
"host",
|
||||||
@@ -86,6 +88,8 @@ void show_usage()
|
|||||||
printf("Local stuff:\n");
|
printf("Local stuff:\n");
|
||||||
printf(" -s [serial] serial port console (minicom like terminal)\n");
|
printf(" -s [serial] serial port console (minicom like terminal)\n");
|
||||||
printf(" -h show this help message\n");
|
printf(" -h show this help message\n");
|
||||||
|
printf(" -S [subversion] unpacks/flash pieces matching this sub-version information\n");
|
||||||
|
printf(" -n do not flash or write to disk (simulation)\n");
|
||||||
printf(" -C [/dev/mtd] check bad blocks on mtd\n");
|
printf(" -C [/dev/mtd] check bad blocks on mtd\n");
|
||||||
printf(" -e [path] dump/extract pieces to path\n");
|
printf(" -e [path] dump/extract pieces to path\n");
|
||||||
printf(" -F [fiasco] flash a fiasco firmware image\n");
|
printf(" -F [fiasco] flash a fiasco firmware image\n");
|
||||||
@@ -105,16 +109,50 @@ void show_usage()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void unpack_callback(struct header_t *header)
|
int unpack_callback(struct header_t *header)
|
||||||
{
|
{
|
||||||
FILE *fd = fopen(header->name, "wb");
|
FILE *fd;
|
||||||
|
|
||||||
|
fiasco_data_read(header);
|
||||||
|
if (subverstr) {
|
||||||
|
if (strchr(header->name, ',') != NULL) {
|
||||||
|
if (!strstr(header->name, subverstr)) {
|
||||||
|
printf("Skipping '%s' does not matches -S subversion\n",
|
||||||
|
header->name);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (nomode)
|
||||||
|
return 1;
|
||||||
|
|
||||||
|
fd = fopen(header->name, "wb");
|
||||||
if (fd == NULL) {
|
if (fd == NULL) {
|
||||||
printf("Cannot open file.\n");
|
printf("Cannot open file.\n");
|
||||||
return;
|
return 1;
|
||||||
}
|
}
|
||||||
fiasco_data_read(header);
|
|
||||||
fwrite(header->data, header->size, 1, fd);
|
fwrite(header->data, header->size, 1, fd);
|
||||||
fclose(fd);
|
fclose(fd);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int flash_callback(struct header_t *header)
|
||||||
|
{
|
||||||
|
int ret;
|
||||||
|
char *type;
|
||||||
|
|
||||||
|
ret = unpack_callback(header);
|
||||||
|
if (ret) {
|
||||||
|
printf("ignored\n");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
type = (char *)fpid_file(header->name);
|
||||||
|
printf("Flashing %s (%s)\n", header->name, type);
|
||||||
|
flash_image(header->name, type, NULL);
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void unpack_fiasco_image(char *file)
|
void unpack_fiasco_image(char *file)
|
||||||
@@ -126,21 +164,23 @@ void unpack_fiasco_image(char *file)
|
|||||||
|
|
||||||
int fiasco_flash(char *file)
|
int fiasco_flash(char *file)
|
||||||
{
|
{
|
||||||
/* TODO */
|
check_nolo_order();
|
||||||
fiasco_callback = NULL;
|
get_sw_version();
|
||||||
|
get_nolo_version();
|
||||||
|
|
||||||
|
fiasco_callback = &flash_callback;
|
||||||
openfiasco( file );
|
openfiasco( file );
|
||||||
|
|
||||||
printf("\nTODO: Implement the fiasco flashing here.\n");
|
return 0;
|
||||||
return -1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#if HAVE_USB
|
#if HAVE_USB
|
||||||
int connect_via_usb()
|
int connect_via_usb()
|
||||||
{
|
{
|
||||||
|
static char pbc[]={'/','-','\\', '|'};
|
||||||
struct usb_device_descriptor udd;
|
struct usb_device_descriptor udd;
|
||||||
struct devices it_device;
|
struct devices it_device;
|
||||||
int c = 0;
|
int c = 0;
|
||||||
static char pbc[]={'/','-','\\', '|'};
|
|
||||||
|
|
||||||
// usb_set_debug(5);
|
// usb_set_debug(5);
|
||||||
usb_init();
|
usb_init();
|
||||||
@@ -214,7 +254,7 @@ int main(int argc, char **argv)
|
|||||||
{
|
{
|
||||||
int c;
|
int c;
|
||||||
|
|
||||||
while((c = getopt(argc, argv, "QC:cp:PvVhRu:ib:U:r:e:ld:I:D:f:F:s:xH:")) != -1) {
|
while((c = getopt(argc, argv, "QC:cp:PvVhRu:ib:U:r:e:ld:I:D:f:F:s:xH:S:n")) != -1) {
|
||||||
switch(c) {
|
switch(c) {
|
||||||
case 'H':
|
case 'H':
|
||||||
printf("xorpair: %04x\n", do_hash_file(optarg));
|
printf("xorpair: %04x\n", do_hash_file(optarg));
|
||||||
@@ -227,6 +267,12 @@ int main(int argc, char **argv)
|
|||||||
case 'b':
|
case 'b':
|
||||||
boot_cmdline = optarg;
|
boot_cmdline = optarg;
|
||||||
break;
|
break;
|
||||||
|
case 'S':
|
||||||
|
subverstr = optarg;
|
||||||
|
break;
|
||||||
|
case 'n':
|
||||||
|
nomode = 1;
|
||||||
|
break;
|
||||||
case 'U':
|
case 'U':
|
||||||
usb_mode = atoi(optarg);
|
usb_mode = atoi(optarg);
|
||||||
break;
|
break;
|
||||||
@@ -321,8 +367,8 @@ int main(int argc, char **argv)
|
|||||||
{
|
{
|
||||||
|
|
||||||
printf("# The Free Fiasco Firmware Flasher v"VERSION"\n"
|
printf("# The Free Fiasco Firmware Flasher v"VERSION"\n"
|
||||||
"0xFFFF [-chilQRvVx] [-C mtd-dev] [-d vid:pid] [-D 0|1|2] [-e path] [-f flags]\n"
|
"0xFFFF [-chinlQRvVx] [-C mtd-dev] [-d vid:pid] [-D 0|1|2] [-e path] [-f flags]\n"
|
||||||
" [-F fiasco] [-H hash-file] [-I piece] [-p [piece%%]file]] [-r 0|1]\n"
|
" [-F fiasco] [-H hash-file] [-I piece] [-p [piece%%]file]] [-r 0|1] [-S subver]\n"
|
||||||
" [-s serial-dev] [-u fiasco-image] [-U 0|1] | [-P new-fiasco] [piece1] [2] ..\n");
|
" [-s serial-dev] [-u fiasco-image] [-U 0|1] | [-P new-fiasco] [piece1] [2] ..\n");
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|||||||
+8
-4
@@ -5,7 +5,6 @@
|
|||||||
#include "hash.h"
|
#include "hash.h"
|
||||||
#include "nolo.h"
|
#include "nolo.h"
|
||||||
#include "os.h"
|
#include "os.h"
|
||||||
|
|
||||||
extern char strbuf[1024];
|
extern char strbuf[1024];
|
||||||
|
|
||||||
#define _FILE_OFFSET_BITS 64
|
#define _FILE_OFFSET_BITS 64
|
||||||
@@ -16,11 +15,11 @@ struct devices;
|
|||||||
|
|
||||||
int queue_mode();
|
int queue_mode();
|
||||||
int reverse_extract_pieces(char *dir);
|
int reverse_extract_pieces(char *dir);
|
||||||
void flash_image(char *filename, char *piece, char *version);
|
void flash_image(const char *filename, const char *piece, const char *version);
|
||||||
int fiasco_read_image(char *file);
|
int fiasco_read_image(char *file);
|
||||||
void check_nolo_order();
|
void check_nolo_order();
|
||||||
extern struct usb_dev_handle *dev;
|
extern struct usb_dev_handle *dev;
|
||||||
unsigned long get_file_size(char *file);
|
unsigned long get_file_size(const char *file);
|
||||||
void progressbar(unsigned long long part, unsigned long long total);
|
void progressbar(unsigned long long part, unsigned long long total);
|
||||||
const char *fpid_file(const char *filename);
|
const char *fpid_file(const char *filename);
|
||||||
int add_piece(char *piece);
|
int add_piece(char *piece);
|
||||||
@@ -107,10 +106,15 @@ int openfiasco(char *name);
|
|||||||
int fiasco_new(const char *filename, const char *name);
|
int fiasco_new(const char *filename, const char *name);
|
||||||
void fiasco_data_read(struct header_t *header);
|
void fiasco_data_read(struct header_t *header);
|
||||||
int fiasco_add_eof(int fd);
|
int fiasco_add_eof(int fd);
|
||||||
extern void (*fiasco_callback)(struct header_t *header);
|
extern int (*fiasco_callback)(struct header_t *header);
|
||||||
int fiasco_add(int fd, const char *name, const char *file, const char *version);
|
int fiasco_add(int fd, const char *name, const char *file, const char *version);
|
||||||
int fiasco_pack(int optind, char *argv[]);
|
int fiasco_pack(int optind, char *argv[]);
|
||||||
int nanddump(char *mtddev, unsigned long start_addr, unsigned long length, char *dumpfile, int isbl, int ioob);
|
int nanddump(char *mtddev, unsigned long start_addr, unsigned long length, char *dumpfile, int isbl, int ioob);
|
||||||
|
|
||||||
|
//
|
||||||
|
int reboot_board();
|
||||||
|
int get_rd_flags();
|
||||||
|
int get_usb_mode();
|
||||||
|
int get_nolo_version();
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
+11
-9
@@ -19,7 +19,13 @@
|
|||||||
#include "main.h"
|
#include "main.h"
|
||||||
#include "os.h"
|
#include "os.h"
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <stdlib.h>
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
|
#include <sys/types.h>
|
||||||
|
#include <sys/wait.h>
|
||||||
|
#include <sys/stat.h>
|
||||||
|
|
||||||
#if HAVE_SQUEUE
|
#if HAVE_SQUEUE
|
||||||
|
|
||||||
struct squeue_t *q;
|
struct squeue_t *q;
|
||||||
@@ -43,23 +49,19 @@ void process_message(char *msg)
|
|||||||
printf("[x] (%s)\n", msg);
|
printf("[x] (%s)\n", msg);
|
||||||
str = strdup(msg);
|
str = strdup(msg);
|
||||||
arg = strchr(str, ':');
|
arg = strchr(str, ':');
|
||||||
if (c!=NULL) {
|
if (c!=0) {
|
||||||
arg[0]='\0';
|
arg[0]='\0';
|
||||||
arg = arg +1;
|
arg = arg +1;
|
||||||
if (!strcmp(str, "flash")) {
|
if (!strcmp(str, "flash")) {
|
||||||
char buf[1024];
|
const char *type = fpid_file(arg);
|
||||||
char *type = fpid_file(arg);
|
|
||||||
if (type == NULL) {
|
if (type == NULL) {
|
||||||
squeue_push2(p, "error", "Unknown piece format", 1);
|
squeue_push2(p, "error", "Unknown piece format", 1);
|
||||||
} else {
|
} else flash_image(arg, type, NULL);
|
||||||
flash_image(arg, type, NULL);
|
|
||||||
}
|
|
||||||
} else
|
} else
|
||||||
if (!strcmp(str, "reset")) {
|
if (!strcmp(str, "reset")) {
|
||||||
if (reboot_board() == 0) {
|
if (reboot_board() == 0) {
|
||||||
squeue_push2(p,"info", "Device reboots", 1);
|
squeue_push2(p,"info", "Device reboots", 1);
|
||||||
} else
|
} else squeue_push2(p,"error", "Cannot reboot device", 1);
|
||||||
squeue_push2(p,"error", "Cannot reboot device", 1);
|
|
||||||
} else
|
} else
|
||||||
if (!strcmp(str, "info")) {
|
if (!strcmp(str, "info")) {
|
||||||
get_rd_flags();
|
get_rd_flags();
|
||||||
@@ -95,7 +97,7 @@ int queue_mode()
|
|||||||
|
|
||||||
pid = dofork();
|
pid = dofork();
|
||||||
if (pid) {
|
if (pid) {
|
||||||
wait(pid);
|
wait(&pid);
|
||||||
return 0;
|
return 0;
|
||||||
} else {
|
} else {
|
||||||
p = squeue_open("/tmp/0xFFFF.1", Q_CREAT);
|
p = squeue_open("/tmp/0xFFFF.1", Q_CREAT);
|
||||||
|
|||||||
@@ -1,13 +1,17 @@
|
|||||||
#include "squeue.h"
|
#include "squeue.h"
|
||||||
|
#define _XOPEN_SOURCE 500 /* Or: #define _BSD_SOURCE */
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <sys/ipc.h>
|
#include <sys/ipc.h>
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
#include <sys/shm.h>
|
#include <sys/shm.h>
|
||||||
|
#include <sys/types.h>
|
||||||
|
#include <sys/stat.h>
|
||||||
#include <sys/mman.h>
|
#include <sys/mman.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
#include <unistd.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#define POOL_SIZE ITEM_MAX*ITEM_SIZE
|
#define POOL_SIZE ITEM_MAX*ITEM_SIZE
|
||||||
|
|||||||
+2
-2
@@ -22,7 +22,7 @@
|
|||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
unsigned long get_file_size(char *file)
|
unsigned long get_file_size(const char *file)
|
||||||
{
|
{
|
||||||
FILE *fd = fopen(file, "r");
|
FILE *fd = fopen(file, "r");
|
||||||
unsigned long len = 0;
|
unsigned long len = 0;
|
||||||
@@ -53,7 +53,7 @@ void progressbar(unsigned long long part, unsigned long long total)
|
|||||||
squeue_push2(p, "bar", msg, 0);
|
squeue_push2(p, "bar", msg, 0);
|
||||||
} else {
|
} else {
|
||||||
#endif
|
#endif
|
||||||
printf("\e[K %3d%% [", pc);
|
printf("\x1b[K %3d%% [", pc);
|
||||||
if (columns)
|
if (columns)
|
||||||
cols = atoi(columns);
|
cols = atoi(columns);
|
||||||
cols-=15;
|
cols-=15;
|
||||||
|
|||||||
Reference in new issue
Block a user