Fixed some compatibility issues
This commit is contained in:
parent
31e98a1224
commit
e701b3cdc0
|
@ -2,4 +2,6 @@
|
|||
/obj
|
||||
/man
|
||||
/p7
|
||||
/p7.exe
|
||||
/p7screen
|
||||
/p7screen.exe
|
||||
|
|
3
Makefile
3
Makefile
|
@ -111,6 +111,9 @@ $(eval $(call make-binary-rule,$(bin))))
|
|||
$(call rmsg,Removing binaries.)
|
||||
$(call qcmd,$(RM) $(BINARIES:%=%*))
|
||||
|
||||
# Remake binaries
|
||||
re-bins: clean-bins all-bins
|
||||
|
||||
# Install a binary
|
||||
define make-installbinary-rule
|
||||
install-$1: $(CHECKCFG) $1$(if $(FOR_WINDOWS),.exe)
|
||||
|
|
|
@ -8,8 +8,11 @@
|
|||
/* */
|
||||
/* ************************************************************************** */
|
||||
#include "main.h"
|
||||
#include <inttypes.h>
|
||||
#include <libp7/packetio.h>
|
||||
#define info (response->ack)
|
||||
#define numformat "%" PRIuFAST32
|
||||
#define addrformat "0x%08" PRIxFAST32
|
||||
|
||||
/**
|
||||
* dump:
|
||||
|
@ -40,31 +43,33 @@ int dump(p7_handle_t *handle)
|
|||
|
||||
/* - preprogrammed ROM - */
|
||||
if (!info.preprog_rom_wiped) {
|
||||
printf("Preprogrammed ROM capacity : %luo\n", info.preprog_rom_capacity);
|
||||
printf("Preprogrammed ROM version : %02u.%02u.%02u\n",
|
||||
printf("Preprogrammed ROM capacity : " numformat "o\n",
|
||||
info.preprog_rom_capacity);
|
||||
printf("Preprogrammed ROM version : %02u.%02u.%04u\n",
|
||||
info.preprog_rom_version.major, info.preprog_rom_version.minor,
|
||||
info.preprog_rom_version.rev);
|
||||
printf("Preprogrammed ROM type : \"%s\"\n", info.preprog_rom_version.type);
|
||||
printf("Preprogrammed ROM type : \"%s\"\n",
|
||||
info.preprog_rom_version.type);
|
||||
}
|
||||
/* - ROM - */
|
||||
printf("ROM capacity : %luo\n", info.flash_rom_capacity);
|
||||
printf("ROM capacity : " numformat "o\n", info.flash_rom_capacity);
|
||||
/* - RAM - */
|
||||
printf("RAM capacity : %luo\n", info.ram_capacity);
|
||||
printf("RAM capacity : " numformat "o\n", info.ram_capacity);
|
||||
/* - Bootcode - */
|
||||
if (!info.bootcode_wiped) {
|
||||
printf("Bootcode version : %02u.%02u.%02u\n",
|
||||
info.bootcode_version.major, info.bootcode_version.minor,
|
||||
info.bootcode_version.rev);
|
||||
printf("Bootcode type : \"%s\"\n", info.bootcode_version.type);
|
||||
printf("Bootcode offset : %#08lx\n", info.bootcode_offset);
|
||||
printf("Bootcode size : %luo\n", info.bootcode_size);
|
||||
printf("Bootcode offset : " addrformat "\n", info.bootcode_offset);
|
||||
printf("Bootcode size : " numformat "o\n", info.bootcode_size);
|
||||
}
|
||||
/* - OS - */
|
||||
printf("OS version : %02u.%02u.%02u\n",
|
||||
info.os_version.major, info.os_version.minor, info.os_version.rev);
|
||||
printf("OS type : \"%s\"\n", info.os_version.type);
|
||||
printf("OS offset : %#08lx\n", info.os_offset);
|
||||
printf("OS size : %luo\n", info.os_size);
|
||||
printf("OS offset : " addrformat "\n", info.os_offset);
|
||||
printf("OS size : " numformat "o\n", info.os_size);
|
||||
/* - Miscallenous info - */
|
||||
printf("Protocol version : %01u.%02u\n",
|
||||
info.protocol_version.major, info.protocol_version.minor);
|
||||
|
|
|
@ -10,7 +10,6 @@
|
|||
#include "main.h"
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
|
||||
/* ************************************************************************** */
|
||||
/* Error messages */
|
||||
|
@ -75,19 +74,18 @@ static const char error_nospace[] =
|
|||
static int sendfile_display_initialized = 0;
|
||||
static int sendfile_confirm(void)
|
||||
{
|
||||
char line[10];
|
||||
|
||||
/* Print stuff */
|
||||
printf("It looks like the file already exists on the calculator.\n");
|
||||
printf("Overwrite ? ([n]/y) ");
|
||||
|
||||
/* Get the line */
|
||||
char *line = NULL; size_t n;
|
||||
ssize_t err = getline(&line, &n, stdin);
|
||||
if (err < 0) return (0);
|
||||
if (!fgets(line, 10, stdin))
|
||||
return (0);
|
||||
|
||||
/* Check if should overwrite */
|
||||
int overwrite = err >= 1 && !strncmp(line, "y", 1);
|
||||
free(line);
|
||||
return (overwrite);
|
||||
return (*line == 'y');
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -158,10 +156,10 @@ static void print_file_info(const char *dir, const char *name, p7uint_t size)
|
|||
memset(buf, ' ', 28);
|
||||
/* put path in buffer */
|
||||
char *b = buf;
|
||||
if (dir) b = stpcpy(b, dir), *b++ = '/';
|
||||
b = stpcpy(b, name), *b = ' ';
|
||||
if (dir) b += sprintf(b, "%s/", dir);
|
||||
b[sprintf(b, "%s", name)] = ' ';
|
||||
/* put size */
|
||||
sprintf(&buf[28], "% 10luo", size);
|
||||
sprintf(&buf[28], "%10uo", (unsigned)size);
|
||||
|
||||
/* put the string */
|
||||
puts(buf);
|
||||
|
@ -203,7 +201,7 @@ int main(int ac, char **av)
|
|||
fclose(args.local);
|
||||
if (args.menu == mn_get && args.local != stdout) {
|
||||
fclose(args.local);
|
||||
unlink(args.localpath);
|
||||
remove(args.localpath);
|
||||
}
|
||||
return (1);
|
||||
}
|
||||
|
@ -219,7 +217,6 @@ int main(int ac, char **av)
|
|||
err = p7_reqfile(handle, args.local, args.dirname, args.filename,
|
||||
args.storage, args.nicedisp && args.local != stdout
|
||||
? &sendfile_display : NULL);
|
||||
if (err) unlink(args.localpath);
|
||||
break;
|
||||
case mn_copy:
|
||||
err = p7_copyfile(handle, args.dirname, args.filename,
|
||||
|
@ -251,7 +248,7 @@ int main(int ac, char **av)
|
|||
/* close the file */
|
||||
if (args.local) fclose(args.local);
|
||||
if (args.menu == mn_get && args.local != stdout)
|
||||
unlink(args.localpath);
|
||||
remove(args.localpath);
|
||||
|
||||
/* put the error string */
|
||||
switch (err) {
|
||||
|
|
Reference in New Issue