add changes to sqlite_ex and some new files

This commit is contained in:
2025-02-27 21:56:12 +02:00
parent 37f9a3d138
commit 547e562f69
6 changed files with 159 additions and 7 deletions

27
cat_v1.c Normal file
View File

@ -0,0 +1,27 @@
#include <stdio.h>
void filecopy(FILE *, FILE *);
int main(int argc, char *argv[]) {
FILE *file_p;
if (argc == 1)
filecopy(stdin, stdout);
else
while (--argc > 0)
if ((file_p = fopen(*++argv, "r")) == NULL) {
printf("cat: can't open: %s\n", *argv);
return 1;
} else {
filecopy(file_p, stdout);
fclose(file_p);
}
return 0;
}
void filecopy(FILE* in_file_p, FILE* out_file_p) {
int ch;
while((ch = getc(in_file_p)) != EOF)
putc(ch, out_file_p);
}