diff --git a/programs/develop/backy/Backy b/programs/develop/backy/Backy index ac95db75ba..8df17a4185 100644 Binary files a/programs/develop/backy/Backy and b/programs/develop/backy/Backy differ diff --git a/programs/develop/backy/Backy-lib.h b/programs/develop/backy/Backy-lib.h index 23b030251a..537d063f27 100644 --- a/programs/develop/backy/Backy-lib.h +++ b/programs/develop/backy/Backy-lib.h @@ -1,38 +1,46 @@ +/* + * Backy_lib.h + * Author: JohnXenox aka Aleksandr Igorevich. + */ + #ifndef __jxl_Date_get_h__ #define __jxl_Date_get_h__ +#ifdef ___TINY_C___ + +typedef unsigned int uint32_t; +typedef unsigned char uint8_t; +typedef unsigned short int uint16_t; +typedef unsigned long long uint64_t; +typedef char int8_t; +typedef short int int16_t; +typedef int int32_t; +typedef long long int64_t; + +static inline int32_t saveFile(uint32_t nbytes, uint8_t *data, uint32_t enc, uint8_t *path) +{ + int32_t val; + + uint8_t dt[28]; // basic information structure. + + (uint32_t) dt[0] = 2; // subfunction number. + (uint32_t) dt[4] = 0; // reserved. + (uint32_t) dt[8] = 0; // reserved. + (uint32_t) dt[12] = nbytes; // number of bytes to write. + (uint8_t *) dt[16] = data; // pointer to data. + (uint32_t) dt[20] = enc; // string encoding (0 = default, 1 = cp866, 2 = UTF-16LE, 3 = UTF-8). + (uint8_t *) dt[24] = path; // pointer to path. + + __asm__ __volatile__("int $0x40":"=a"(val):"a"(80), "b"(&dt)); + + return val; +} + +#else + #include -static inline uint32_t getDate(void) -{ - uint32_t date; - __asm__ __volatile__("int $0x40":"=a"(date):"a"(29)); - return date; -} - - - -static inline uint32_t getTime(void) -{ - uint32_t time; - __asm__ __volatile__("int $0x40":"=a"(time):"a"(3)); - return time; -} - - - -static inline void *openFile(uint32_t *length, const uint8_t *path) -{ - uint8_t *fd; - - __asm__ __volatile__ ("int $0x40":"=a"(fd), "=d"(*length):"a" (68), "b"(27),"c"(path)); - - return fd; -} - - - static inline int32_t saveFile(uint32_t nbytes, uint8_t *data, uint32_t enc, uint8_t *path) { int32_t val; @@ -64,5 +72,33 @@ static inline int32_t saveFile(uint32_t nbytes, uint8_t *data, uint32_t enc, uin return val; } +#endif + +static inline uint32_t getDate(void) +{ + uint32_t date; + __asm__ __volatile__("int $0x40":"=a"(date):"a"(29)); + return date; +} + + + +static inline uint32_t getTime(void) +{ + uint32_t time; + __asm__ __volatile__("int $0x40":"=a"(time):"a"(3)); + return time; +} + + + +static inline void *openFile(uint32_t *length, const uint8_t *path) +{ + uint8_t *fd; + + __asm__ __volatile__ ("int $0x40":"=a"(fd), "=d"(*length):"a" (68), "b"(27),"c"(path)); + + return fd; +} #endif diff --git a/programs/develop/backy/Backy.c b/programs/develop/backy/Backy.c index 08ff93acff..0a02ae5e55 100644 --- a/programs/develop/backy/Backy.c +++ b/programs/develop/backy/Backy.c @@ -1,14 +1,17 @@ /* - Author: JohnXenox. - Description: The program for backing up a file. + * Author: JohnXenox aka Aleksandr Igorevich. + * + * Programme name: Backy + * Description: The programme for backing up a file. + * + * Works from command line, only! + */ - Works from command line, only! -*/ +#define CREATION_DATE "2020.05.17" -#define CREATION_DATE "2020.05.07" - -#include +#include +//#include #include #include @@ -144,10 +147,14 @@ int main(int argc, char** argv) else { //con_init_console_dll_param(-1, 23, -1, 23, "Backy"); + if (con_init_console_dll()) return 1; // init fail + + printf("Useful info!"); printf("\n Name: Backy"); printf("\n Date: %s", CREATION_DATE); printf("\n Description: The programme for backing up a file.\n"); + printf("\n Author: JohnXenox\n"); printf("\n Usage: backy <-o path2>\n"); @@ -212,7 +219,7 @@ int main(int argc, char** argv) } - itoa(*dta, num, 16); + itoab(*dta, num, 16); if (num[1] == 0) { @@ -254,7 +261,7 @@ int main(int argc, char** argv) if (i == 2) dta = &seconds; - itoa(*dta, num, 16); + itoab(*dta, num, 16); if (num[1] == 0) { diff --git a/programs/develop/backy/Backy.png b/programs/develop/backy/Backy.png index 635353c1b6..f9015d3400 100644 Binary files a/programs/develop/backy/Backy.png and b/programs/develop/backy/Backy.png differ diff --git a/programs/develop/backy/History.txt b/programs/develop/backy/History.txt new file mode 100644 index 0000000000..568c3d8aa0 --- /dev/null +++ b/programs/develop/backy/History.txt @@ -0,0 +1,16 @@ +History: + +Backy 2020.05.17 + Code optimization. + +Backy 2020.05.05 + Changed an output file name. + +Backy 2020.04.27 + First release. + + + + + + diff --git a/programs/develop/backy/Readme-en.txt b/programs/develop/backy/Readme-en.txt new file mode 100644 index 0000000000..00fddc5944 --- /dev/null +++ b/programs/develop/backy/Readme-en.txt @@ -0,0 +1,22 @@ +Backy (release date 2020.05.17) + +Backy is a programme for backing up a file. + +Usage: backy <-o path2> + path1 - path to a file to be backuped. + -o path2 - path to the output directory without the name of a file. + +Examples: + backy test.c + backy test.c -o /tmp0/1/ + backy /hd0/1/test.c + backy /hd0/1/test.c -o /tmp0/1/ + +//--------------------------------------// + The programme: + - Compiled with KTCC compiler. + - Written in KolibriOS NB svn7768. + - Designed and written by JohnXenox + aka Aleksandr Igorevich. +//--------------------------------------// + diff --git a/programs/develop/backy/Readme-ru.txt b/programs/develop/backy/Readme-ru.txt new file mode 100644 index 0000000000..f40ab9433c --- /dev/null +++ b/programs/develop/backy/Readme-ru.txt @@ -0,0 +1,21 @@ +Backy (дата выпуска 2020.05.17) + +Backy - это программа для создания резервной копии файла. + +Использование: backy <-o path2> + path1 - путь к файлу, который надо скопировать. + -o path2 - путь к директории, в которую будет скопирована резервная копия файла. + +Примеры: + backy test.c + backy test.c -o /tmp0/1/ + backy /hd0/1/test.c + backy /hd0/1/test.c -o /tmp0/1/ + +//--------------------------------------// + The programme: + - Compiled with KTCC compiler. + - Written in KolibriOS NB svn7768. + - Designed and written by JohnXenox + aka Aleksandr Igorevich. +//--------------------------------------//