mirror of
https://github.com/depp/syncfiles.git
synced 2025-01-20 07:31:38 +00:00
Copy C++ files with SyncFiles
GitOrigin-RevId: e1b21d525476815ba8b10780eb2e69b57264a212
This commit is contained in:
parent
c058e68d93
commit
a6ad0d0a96
10
README.md
10
README.md
@ -8,7 +8,7 @@ SyncFiles is a tool for MPW (Macintosh Programmer’s Workshop) which synchroniz
|
||||
|
||||
- Sets the modification timestamp of the destination file to match the timestamp of the source file.
|
||||
|
||||
- Only synchronizes files which match hard-coded patterns: copies the Makefile and any files matching `*.c`, `*.h`, or `*.r`.
|
||||
- Only synchronizes files which match hard-coded patterns.
|
||||
|
||||
- Converts files to UTF-8 and LF line endings for Unix systems; converts to Mac OS Roman and CR line endings for Macintosh systems.
|
||||
|
||||
@ -18,6 +18,14 @@ SyncFiles is a tool for MPW (Macintosh Programmer’s Workshop) which synchroniz
|
||||
|
||||
There is a hard-coded maximum file size of 64 KiB.
|
||||
|
||||
## File Patterns
|
||||
|
||||
Copies files named Makefile, and files with the following extensions:
|
||||
|
||||
- C: `.c` `.h`
|
||||
|
||||
- C++: `.cc` `.cp` `.cpp` `.cxx` `.hh` `.hpp` `.hxx`
|
||||
|
||||
## Usage
|
||||
|
||||
Operates in push or pull mode. The tool runs from inside the classic Macintosh environment, so the “push” mode copies from Macintosh to Unix, and the “pull” mode copies from Unix to Macintosh. It is assumed that the Macintosh directory is on a normal disk volume.
|
||||
|
24
sync.c
24
sync.c
@ -124,6 +124,7 @@ static int filter_name(const unsigned char *name) {
|
||||
int len, i, stem;
|
||||
const unsigned char *ext;
|
||||
char temp[32];
|
||||
unsigned char c0, c1, c2;
|
||||
|
||||
if (EqualString(name, "\pmakefile", false, true)) {
|
||||
return 1;
|
||||
@ -139,7 +140,28 @@ static int filter_name(const unsigned char *name) {
|
||||
ext = name + stem + 1;
|
||||
switch (len - stem) {
|
||||
case 1:
|
||||
if (ext[0] == 'c' || ext[0] == 'h' || ext[0] == 'r') {
|
||||
// .c .h .r
|
||||
c0 = ext[0];
|
||||
if (c0 == 'c' || c0 == 'h' || c0 == 'r') {
|
||||
return 1;
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
// .cc .cp .hh
|
||||
c0 = ext[0];
|
||||
c1 = ext[1];
|
||||
if (c0 == 'c' && (c1 == 'c' || c1 == 'p') ||
|
||||
c0 == 'h' && c1 == 'h') {
|
||||
return 1;
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
// .cpp .hpp .cxx .hxx
|
||||
c0 = ext[0];
|
||||
c1 = ext[1];
|
||||
c2 = ext[2];
|
||||
if ((c0 == 'c' || c0 == 'h') &&
|
||||
(c1 == 'p' && c2 == 'p' || c1 == 'x' && c2 == 'x')) {
|
||||
return 1;
|
||||
}
|
||||
break;
|
||||
|
Loading…
x
Reference in New Issue
Block a user