| @@ -11,27 +11,27 @@ | | | @@ -11,27 +11,27 @@ |
11 | * specified in the README file that comes with the CVS source distribution. | | 11 | * specified in the README file that comes with the CVS source distribution. |
12 | * | | 12 | * |
13 | * "import" checks in the vendor release located in the current directory into | | 13 | * "import" checks in the vendor release located in the current directory into |
14 | * the CVS source repository. The CVS vendor branch support is utilized. | | 14 | * the CVS source repository. The CVS vendor branch support is utilized. |
15 | * | | 15 | * |
16 | * At least three arguments are expected to follow the options: | | 16 | * At least three arguments are expected to follow the options: |
17 | * repository Where the source belongs relative to the CVSROOT | | 17 | * repository Where the source belongs relative to the CVSROOT |
18 | * VendorTag Vendor's major tag | | 18 | * VendorTag Vendor's major tag |
19 | * VendorReleTag Tag for this particular release | | 19 | * VendorReleTag Tag for this particular release |
20 | * | | 20 | * |
21 | * Additional arguments specify more Vendor Release Tags. | | 21 | * Additional arguments specify more Vendor Release Tags. |
22 | */ | | 22 | */ |
23 | #include <sys/cdefs.h> | | 23 | #include <sys/cdefs.h> |
24 | __RCSID("$NetBSD: import.c,v 1.6 2016/05/17 14:00:09 christos Exp $"); | | 24 | __RCSID("$NetBSD: import.c,v 1.7 2016/05/30 17:49:51 christos Exp $"); |
25 | | | 25 | |
26 | #include "cvs.h" | | 26 | #include "cvs.h" |
27 | #include "lstat.h" | | 27 | #include "lstat.h" |
28 | #include "save-cwd.h" | | 28 | #include "save-cwd.h" |
29 | | | 29 | |
30 | static char *get_comment (const char *user); | | 30 | static char *get_comment (const char *user); |
31 | static int add_rev (char *message, RCSNode *rcs, char *vfile, | | 31 | static int add_rev (char *message, RCSNode *rcs, char *vfile, |
32 | char *vers); | | 32 | char *vers); |
33 | static int add_tags (RCSNode *rcs, char *vfile, char *vtag, int targc, | | 33 | static int add_tags (RCSNode *rcs, char *vfile, char *vtag, int targc, |
34 | char *targv[]); | | 34 | char *targv[]); |
35 | static int import_descend (char *message, char *vtag, int targc, char *targv[]); | | 35 | static int import_descend (char *message, char *vtag, int targc, char *targv[]); |
36 | static int import_descend_dir (char *message, char *dir, char *vtag, | | 36 | static int import_descend_dir (char *message, char *dir, char *vtag, |
37 | int targc, char *targv[]); | | 37 | int targc, char *targv[]); |
| @@ -1399,61 +1399,61 @@ add_rcs_file (const char *message, const | | | @@ -1399,61 +1399,61 @@ add_rcs_file (const char *message, const |
1399 | goto write_error; | | 1399 | goto write_error; |
1400 | } | | 1400 | } |
1401 | | | 1401 | |
1402 | if (add_vhead != NULL) | | 1402 | if (add_vhead != NULL) |
1403 | { | | 1403 | { |
1404 | if (fprintf (fprcs, "\012%s\012", add_vhead) < 0 || | | 1404 | if (fprintf (fprcs, "\012%s\012", add_vhead) < 0 || |
1405 | fprintf (fprcs, "log\012@") < 0) | | 1405 | fprintf (fprcs, "log\012@") < 0) |
1406 | goto write_error; | | 1406 | goto write_error; |
1407 | if (add_vbranch != NULL) | | 1407 | if (add_vbranch != NULL) |
1408 | { | | 1408 | { |
1409 | /* We are going to put the log message in the revision on the | | 1409 | /* We are going to put the log message in the revision on the |
1410 | branch. So putting it here too seems kind of redundant, I | | 1410 | branch. So putting it here too seems kind of redundant, I |
1411 | guess (and that is what CVS has always done, anyway). */ | | 1411 | guess (and that is what CVS has always done, anyway). */ |
1412 | if (fprintf (fprcs, "Initial revision") < 0) | | 1412 | if (fprintf (fprcs, "Initial revision\n") < 0) |
1413 | goto write_error; | | 1413 | goto write_error; |
1414 | } | | 1414 | } |
1415 | else | | 1415 | else |
1416 | { | | 1416 | { |
1417 | if (expand_at_signs (message, (off_t) strlen (message), fprcs) < 0) | | 1417 | if (expand_at_signs (message, (off_t) strlen (message), fprcs) < 0) |
1418 | goto write_error; | | 1418 | goto write_error; |
1419 | } | | 1419 | } |
1420 | if (fprintf (fprcs, "\012@\012") < 0 || | | 1420 | if (fprintf (fprcs, "@\012") < 0 || |
1421 | fprintf (fprcs, "text\012@") < 0) | | 1421 | fprintf (fprcs, "text\012@") < 0) |
1422 | { | | 1422 | { |
1423 | goto write_error; | | 1423 | goto write_error; |
1424 | } | | 1424 | } |
1425 | | | 1425 | |
1426 | /* Now copy over the contents of the file, expanding at signs. | | 1426 | /* Now copy over the contents of the file, expanding at signs. |
1427 | * If config->preserve_perms is set, do this only for regular files. | | 1427 | * If config->preserve_perms is set, do this only for regular files. |
1428 | */ | | 1428 | */ |
1429 | if (!do_killnew) | | 1429 | if (!do_killnew) |
1430 | { | | 1430 | { |
1431 | /* Now copy over the contents of the file, expanding at signs, | | 1431 | /* Now copy over the contents of the file, expanding at signs, |
1432 | if not done as part of do_killnew handling above. */ | | 1432 | if not done as part of do_killnew handling above. */ |
1433 | if (expand_and_copy_contents (fprcs, file_type, user, fpuser)) | | 1433 | if (expand_and_copy_contents (fprcs, file_type, user, fpuser)) |
1434 | goto write_error; | | 1434 | goto write_error; |
1435 | } | | 1435 | } |
1436 | | | 1436 | |
1437 | if (fprintf (fprcs, "@\012\012") < 0) | | 1437 | if (fprintf (fprcs, "@\012\012") < 0) |
1438 | goto write_error; | | 1438 | goto write_error; |
1439 | | | 1439 | |
1440 | if (add_vbranch != NULL) | | 1440 | if (add_vbranch != NULL) |
1441 | { | | 1441 | { |
1442 | if (fprintf (fprcs, "\012%s.1\012", add_vbranch) < 0 || | | 1442 | if (fprintf (fprcs, "\012%s.1\012", add_vbranch) < 0 || |
1443 | fprintf (fprcs, "log\012@") < 0 || | | 1443 | fprintf (fprcs, "log\012@") < 0 || |
1444 | expand_at_signs (message, | | 1444 | expand_at_signs (message, |
1445 | (off_t) strlen (message), fprcs) < 0 || | | 1445 | (off_t) strlen (message), fprcs) < 0 || |
1446 | fprintf (fprcs, "\012@\012text\012") < 0 || | | 1446 | fprintf (fprcs, "@\012text\012") < 0 || |
1447 | fprintf (fprcs, "@@\012") < 0) | | 1447 | fprintf (fprcs, "@@\012") < 0) |
1448 | goto write_error; | | 1448 | goto write_error; |
1449 | } | | 1449 | } |
1450 | } | | 1450 | } |
1451 | | | 1451 | |
1452 | if (fclose (fprcs) == EOF) | | 1452 | if (fclose (fprcs) == EOF) |
1453 | { | | 1453 | { |
1454 | ierrno = errno; | | 1454 | ierrno = errno; |
1455 | goto write_error_noclose; | | 1455 | goto write_error_noclose; |
1456 | } | | 1456 | } |
1457 | /* Close fpuser only if we opened it to begin with. */ | | 1457 | /* Close fpuser only if we opened it to begin with. */ |
1458 | if (fpuser != NULL) | | 1458 | if (fpuser != NULL) |
1459 | { | | 1459 | { |