forked from KolibriOS/kolibrios
Backy: update by JohnXenox
git-svn-id: svn://kolibrios.org@7942 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
97e06fdb45
commit
0339c3b1d7
Binary file not shown.
@ -1,38 +1,46 @@
|
|||||||
|
|
||||||
|
/*
|
||||||
|
* Backy_lib.h
|
||||||
|
* Author: JohnXenox aka Aleksandr Igorevich.
|
||||||
|
*/
|
||||||
|
|
||||||
#ifndef __jxl_Date_get_h__
|
#ifndef __jxl_Date_get_h__
|
||||||
#define __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 <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
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)
|
static inline int32_t saveFile(uint32_t nbytes, uint8_t *data, uint32_t enc, uint8_t *path)
|
||||||
{
|
{
|
||||||
int32_t val;
|
int32_t val;
|
||||||
@ -64,5 +72,33 @@ static inline int32_t saveFile(uint32_t nbytes, uint8_t *data, uint32_t enc, uin
|
|||||||
return val;
|
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
|
#endif
|
||||||
|
@ -1,14 +1,17 @@
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
Author: JohnXenox.
|
* Author: JohnXenox aka Aleksandr Igorevich.
|
||||||
Description: The program for backing up a file.
|
*
|
||||||
|
* 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 <conio.h>
|
||||||
|
//#include <stdio.h>
|
||||||
#include <stdio.h>
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
@ -144,10 +147,14 @@ int main(int argc, char** argv)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
//con_init_console_dll_param(-1, 23, -1, 23, "Backy");
|
//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 Name: Backy");
|
||||||
printf("\n Date: %s", CREATION_DATE);
|
printf("\n Date: %s", CREATION_DATE);
|
||||||
printf("\n Description: The programme for backing up a file.\n");
|
printf("\n Description: The programme for backing up a file.\n");
|
||||||
|
|
||||||
printf("\n Author: JohnXenox\n");
|
printf("\n Author: JohnXenox\n");
|
||||||
|
|
||||||
printf("\n Usage: backy <path1> <-o path2>\n");
|
printf("\n Usage: backy <path1> <-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)
|
if (num[1] == 0)
|
||||||
{
|
{
|
||||||
@ -254,7 +261,7 @@ int main(int argc, char** argv)
|
|||||||
if (i == 2)
|
if (i == 2)
|
||||||
dta = &seconds;
|
dta = &seconds;
|
||||||
|
|
||||||
itoa(*dta, num, 16);
|
itoab(*dta, num, 16);
|
||||||
|
|
||||||
if (num[1] == 0)
|
if (num[1] == 0)
|
||||||
{
|
{
|
||||||
|
Binary file not shown.
Before Width: | Height: | Size: 6.4 KiB After Width: | Height: | Size: 6.4 KiB |
16
programs/develop/backy/History.txt
Normal file
16
programs/develop/backy/History.txt
Normal file
@ -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.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
22
programs/develop/backy/Readme-en.txt
Normal file
22
programs/develop/backy/Readme-en.txt
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
Backy (release date 2020.05.17)
|
||||||
|
|
||||||
|
Backy is a programme for backing up a file.
|
||||||
|
|
||||||
|
Usage: backy <path1> <-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.
|
||||||
|
//--------------------------------------//
|
||||||
|
|
21
programs/develop/backy/Readme-ru.txt
Normal file
21
programs/develop/backy/Readme-ru.txt
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
Backy (дата выпуска 2020.05.17)
|
||||||
|
|
||||||
|
Backy - это программа для создания резервной копии файла.
|
||||||
|
|
||||||
|
Использование: backy <path1> <-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.
|
||||||
|
//--------------------------------------//
|
Loading…
Reference in New Issue
Block a user