瀏覽代碼

Logging system updates and file IO...

master
父節點
當前提交
6622633a2c
共有 3 個檔案被更改,包括 26 行新增4 行删除
  1. +2
    -0
      install.sh
  2. +20
    -2
      xtandard.c
  3. +4
    -2
      xtandard.h

+ 2
- 0
install.sh 查看文件

@@ -2,6 +2,8 @@


set -xe set -xe


mkdir /usr/include/xolatile

cp xtandard.h /usr/include/xolatile/xtandard.h cp xtandard.h /usr/include/xolatile/xtandard.h
cp xtandard.c /usr/include/xolatile/xtandard.c cp xtandard.c /usr/include/xolatile/xtandard.c




+ 20
- 2
xtandard.c 查看文件

@@ -71,8 +71,8 @@ void log_in (int type, int flag, char * data) {
string_concatenate (log_notify, "\n"); string_concatenate (log_notify, "\n");
} }


void log_out (void) {
echo (log_notify);
void log_out (char * name) {
dump (name, log_notify);


log_notify = deallocate (log_notify); log_notify = deallocate (log_notify);
} }
@@ -85,6 +85,24 @@ void echo (char * data) {
out (data, string_length (data)); out (data, string_length (data));
} }


void dump (char * name, char * data) {
int file = -1;

if (name == NULL) {
echo (data);
return;
}

if (data == NULL) {
return;
}

file = file_open (name, O_RDWR | O_CREAT | O_APPEND);

file_write (file, data, string_length (data));

file = file_close (file);
}


void echo_byte (int byte) { void echo_byte (int byte) {
out ("0123456789ABCDEF" + (byte % 256) / 16, 1); out ("0123456789ABCDEF" + (byte % 256) / 16, 1);


+ 4
- 2
xtandard.h 查看文件

@@ -71,9 +71,11 @@ extern void in (void *, int);
extern void out (void *, int); extern void out (void *, int);


extern void log_in (int, int, char *); extern void log_in (int, int, char *);
extern void log_out (void);
extern void log_out (char *);

extern void echo (char *);
extern void dump (char *, char *);


extern void echo (char *);
extern void echo_byte (int); extern void echo_byte (int);


extern void fatal_failure (int, char *); extern void fatal_failure (int, char *);


Loading…
取消
儲存