jcs
/amend
/amendments
/151
*: err -> panic
jcs made amendment 151 about 1 year ago
--- diffreg.c Thu Mar 21 10:45:02 2024
+++ diffreg.c Mon Mar 25 16:04:57 2024
@@ -889,7 +889,7 @@ preadline(int fd, size_t rlen, off_t off)
pos = lseek(fd, 0, SEEK_CUR);
lseek(fd, off, SEEK_SET);
if ((nr = read(fd, line, rlen)) == -1)
- err(2, "preadline");
+ panic("preadline");
lseek(fd, pos, SEEK_SET);
if (nr > 0 && line[nr-1] == '\r')
nr--;
@@ -1100,7 +1100,7 @@ fetch(long *f, int a, int b, FILE *lb, int ch, int old
if ((c = getc(lb)) == EOF) {
if (diff_format == D_EDIT || diff_format == D_REVERSE ||
diff_format == D_NREVERSE)
- warnx("No newline at end of file");
+ warn("No newline at end of file");
else
diff_output("\r\\ No newline at end of "
"file\r");
--- editor.c Fri Feb 16 14:02:33 2024
+++ editor.c Mon Mar 25 15:55:04 2024
@@ -78,7 +78,7 @@ editor_init(struct browser *browser, struct repo_amend
editor->win = NewWindow(0L, &bounds, CtoPstr(title), false,
noGrowDocProc, (WindowPtr)-1L, true, 0);
if (!editor)
- err(1, "Can't create editor window");
+ panic("Can't create editor window");
SetPort(editor->win);
/* author */
--- patch.c Mon Feb 6 10:44:24 2023
+++ patch.c Wed Oct 2 12:17:50 2024
@@ -17,6 +17,7 @@
#include <stdio.h>
#include <string.h>
+#include "amend.h"
#include "patch.h"
#include "util.h"
@@ -38,7 +39,7 @@ short
patch_open_source_file(struct repo *repo, char *filename)
{
short error, ret, i;
- Str255 pfilename;
+ Str32 pfilename;
for (i = 0; i < repo->nfiles; i++) {
if (strcmp(repo->files[i]->filename, filename) != 0)
@@ -53,12 +54,12 @@ patch_open_source_file(struct repo *repo, char *filena
error = Create(pfilename, repo->bile->vrefnum,
repo->files[i]->creator, repo->files[i]->type);
if (error && error != dupFNErr)
- err(1, "Failed to create %s: %d", filename, error);
+ panic("Failed to create %s: %d", filename, error);
error = FSOpen(pfilename, repo->bile->vrefnum, &ret);
}
if (error)
- err(1, "Failed to open %s: %d", filename, error);
+ panic("Failed to open %s: %d", filename, error);
return ret;
}
@@ -70,17 +71,17 @@ short
patch_open_temp_dest_file(struct repo *repo, char *filename)
{
short error, ret;
- char tmpfile[256];
+ char tmpfile[32];
snprintf(tmpfile, sizeof(tmpfile), "%s.tmp", filename);
CtoPstr(tmpfile);
error = Create(tmpfile, repo->bile->vrefnum, AMEND_CREATOR, 'TEXT');
if (error && error != dupFNErr)
- err(1, "Failed to create %s: %d", PtoCstr(tmpfile), error);
+ panic("Failed to create %s: %d", PtoCstr(tmpfile), error);
error = FSOpen(tmpfile, repo->bile->vrefnum, &ret);
if (error)
- err(1, "Failed to open %s: %d", PtoCstr(tmpfile), error);
+ panic("Failed to open %s: %d", PtoCstr(tmpfile), error);
return ret;
}
@@ -99,11 +100,11 @@ patch_process(struct repo *repo, Str255 filename, shor
error = FSOpen(filename, vrefnum, &patch_frefnum);
if (error)
- err(1, "Failed to open patch %s: %d", PtoCstr(filename), error);
+ panic("Failed to open patch %s: %d", PtoCstr(filename), error);
error = GetEOF(patch_frefnum, &patch_size);
if (error)
- err(1, "Failed to get size of patch %s: %d", PtoCstr(filename),
+ panic("Failed to get size of patch %s: %d", PtoCstr(filename),
error);
patch_state = PATCH_STATE_HEADER_FROM;
@@ -182,7 +183,7 @@ patch_process(struct repo *repo, Str255 filename, shor
break;
}
default:
- err(1, "Invalid patch state %d", patch_state);
+ panic("Invalid patch state %d", patch_state);
}
}