1 /****************************************************************************
2 * Copyright 2018-2022,2023 Thomas E. Dickey *
3 * Copyright 1998-2016,2017 Free Software Foundation, Inc. *
5 * Permission is hereby granted, free of charge, to any person obtaining a *
6 * copy of this software and associated documentation files (the *
7 * "Software"), to deal in the Software without restriction, including *
8 * without limitation the rights to use, copy, modify, merge, publish, *
9 * distribute, distribute with modifications, sublicense, and/or sell *
10 * copies of the Software, and to permit persons to whom the Software is *
11 * furnished to do so, subject to the following conditions: *
13 * The above copyright notice and this permission notice shall be included *
14 * in all copies or substantial portions of the Software. *
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS *
17 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF *
18 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. *
19 * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, *
20 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR *
21 * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR *
22 * THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
24 * Except as contained in this notice, the name(s) of the above copyright *
25 * holders shall not be used in advertising or otherwise to promote the *
26 * sale, use or other dealings in this Software without prior written *
28 ****************************************************************************/
30 /****************************************************************************
31 * Author: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995 *
32 * and: Eric S. Raymond <esr@snark.thyrsus.com> *
33 * and: Thomas E. Dickey 1996-on *
34 ****************************************************************************/
37 * write_entry.c -- write a terminfo structure onto the file system
40 #include <curses.priv.h>
41 #include <hashed_db.h>
45 MODULE_ID("$Id: write_entry.c,v 1.126 2023/04/29 20:30:57 tom Exp $")
48 #define TRACE_OUT(p) DEBUG(2, p)
49 #define TRACE_NUM(n) if (VALID_NUMERIC(Numbers[n])) { \
50 TRACE_OUT(("put Numbers[%u]=%d", (unsigned) (n), Numbers[n])); }
52 #define TRACE_OUT(p) /*nothing */
53 #define TRACE_NUM(n) /* nothing */
57 * FIXME: special case to work around Cygwin bug in link(), which updates
58 * the target file's timestamp.
60 #if HAVE_LINK && !USE_SYMLINKS && !MIXEDCASE_FILENAMES && defined(__CYGWIN__)
61 #define LINK_TOUCHES 1
63 #define LINK_TOUCHES 0
66 static int total_written;
67 static int total_parts;
68 static int total_size;
70 static int make_db_root(const char *);
74 write_file(char *filename, TERMTYPE2 *tp)
76 char buffer[MAX_ENTRY_SIZE];
77 unsigned limit = sizeof(buffer);
80 if (_nc_write_object(tp, buffer, &offset, limit) == ERR) {
81 _nc_warning("entry is larger than %u bytes", limit);
83 FILE *fp = ((_nc_access(filename, W_OK) == 0)
84 ? safe_fopen(filename, BIN_W)
90 _nc_syserr_abort("cannot open %s/%s", _nc_tic_dir(0), filename);
93 actual = fwrite(buffer, sizeof(char), (size_t) offset, fp);
94 if (actual != offset) {
95 int myerr = ferror(fp) ? errno : 0;
97 _nc_syserr_abort("error writing %s/%s: %s",
102 _nc_syserr_abort("error writing %s/%s: %u bytes vs actual %lu",
106 (unsigned long) actual);
110 DEBUG(1, ("Created %s", filename));
116 * Check for access rights to destination directories
117 * Create any directories which don't exist.
119 * Note: there's no reason to return the result of make_db_root(), since
120 * this function is called only in instances where that has to succeed.
123 check_writeable(int code)
125 static const char dirnames[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
126 static bool verified[sizeof(dirnames)];
128 char dir[sizeof(LEAF_FMT)];
131 if (code == 0 || (s = (strchr) (dirnames, code)) == 0)
132 _nc_err_abort("Illegal terminfo subdirectory \"" LEAF_FMT "\"", code);
134 if (verified[s - dirnames])
137 _nc_SPRINTF(dir, _nc_SLIMIT(sizeof(dir)) LEAF_FMT, code);
138 if (make_db_root(dir) < 0) {
139 _nc_err_abort("%s/%s: permission denied", _nc_tic_dir(0), dir);
142 verified[s - dirnames] = TRUE;
144 #endif /* !USE_HASHED_DB */
147 make_db_path(char *dst, const char *src, size_t limit)
150 const char *top = _nc_tic_dir(0);
152 if (src == top || _nc_is_abs_path(src)) {
153 if (strlen(src) + 1 <= limit) {
154 _nc_STRCPY(dst, src, limit);
158 if ((strlen(top) + strlen(src) + 6) <= limit) {
159 _nc_SPRINTF(dst, _nc_SLIMIT(limit) "%s/%s", top, src);
165 static const char suffix[] = DBM_SUFFIX;
166 size_t have = strlen(dst);
167 size_t need = strlen(suffix);
168 if (have > need && strcmp(dst + (int) (have - need), suffix)) {
169 if (have + need <= limit) {
170 _nc_STRCAT(dst, suffix, limit);
174 } else if (_nc_is_dir_path(dst)) {
183 * Make a database-root if it doesn't exist.
186 make_db_root(const char *path)
189 char fullpath[PATH_MAX];
191 if ((rc = make_db_path(fullpath, path, sizeof(fullpath))) == 0) {
195 if ((capdbp = _nc_db_open(fullpath, TRUE)) == NULL) {
197 } else if (_nc_db_close(capdbp) < 0) {
203 if ((rc = stat(path, &statbuf)) == -1) {
209 } else if (_nc_access(path, R_OK | W_OK | X_OK) < 0) {
210 rc = -1; /* permission denied */
211 } else if (!(S_ISDIR(statbuf.st_mode))) {
212 rc = -1; /* not a directory */
220 * Set the write directory for compiled entries.
223 _nc_set_writedir(const char *dir)
225 const char *destination;
226 char actual[PATH_MAX];
228 if (dir == 0 && use_terminfo_vars())
229 dir = getenv("TERMINFO");
232 (void) _nc_tic_dir(dir);
234 destination = _nc_tic_dir(0);
235 if (make_db_root(destination) < 0) {
236 char *home = _nc_home_terminfo();
240 if (make_db_root(destination) < 0)
241 _nc_err_abort("%s: permission denied (errno %d)",
247 * Note: because of this code, this logic should be exercised
248 * *once only* per run.
251 make_db_path(actual, destination, sizeof(actual));
253 if (chdir(_nc_tic_dir(destination)) < 0
254 || getcwd(actual, sizeof(actual)) == 0)
255 _nc_err_abort("%s: not a directory", destination);
257 _nc_keep_tic_dir(actual);
261 * Save the compiled version of a description in the filesystem.
263 * make a copy of the name-list
264 * break it up into first-name and all-but-last-name
266 * write object information to first-name
268 * for each name in all-but-last-name
271 * Using 'time()' to obtain a reference for file timestamps is unreliable,
272 * e.g., with NFS, because the filesystem may have a different time
273 * reference. We check for pre-existence of links by latching the first
274 * timestamp from a file that we create.
276 * The _nc_warning() calls will report a correct line number only if
277 * _nc_curr_line is properly set before the write_entry() call.
281 _nc_write_entry(TERMTYPE2 *const tp)
285 char buffer[MAX_ENTRY_SIZE + 1];
286 unsigned limit = sizeof(buffer);
289 #else /* !USE_HASHED_DB */
292 char filename[PATH_MAX];
293 char linkname[PATH_MAX];
295 char symlinkname[PATH_MAX];
300 #endif /* USE_SYMLINKS */
302 unsigned limit2 = sizeof(filename) - (2 + LEAF_LEN);
305 static int call_count;
306 static time_t start_time; /* time at start of writes */
308 #endif /* USE_HASHED_DB */
310 char name_list[MAX_TERMINFO_LENGTH];
311 char *first_name, *other_names;
313 char *term_names = tp->term_names;
314 size_t name_size = strlen(term_names);
316 if (name_size == 0) {
317 _nc_syserr_abort("no terminal name found.");
318 } else if (name_size >= sizeof(name_list) - 1) {
319 _nc_syserr_abort("terminal name too long: %s", term_names);
322 _nc_STRCPY(name_list, term_names, sizeof(name_list));
323 DEBUG(7, ("Name list = '%s'", name_list));
325 first_name = name_list;
327 ptr = &name_list[name_size - 1];
328 other_names = ptr + 1;
330 while (ptr > name_list && *ptr != '|')
333 if (ptr != name_list) {
336 for (ptr = name_list; *ptr != '\0' && *ptr != '|'; ptr++)
343 other_names = ptr + 1;
347 DEBUG(7, ("First name = '%s'", first_name));
348 DEBUG(7, ("Other names = '%s'", other_names));
350 _nc_set_type(first_name);
353 if (_nc_write_object(tp, buffer + 1, &offset, limit - 1) != ERR) {
354 DB *capdb = _nc_db_open(_nc_tic_dir(0), TRUE);
360 memset(&key, 0, sizeof(key));
361 key.data = term_names;
362 key.size = name_size;
364 memset(&data, 0, sizeof(data));
366 data.size = offset + 1;
368 _nc_db_put(capdb, &key, &data);
372 key.data = name_list;
373 key.size = strlen(name_list);
375 _nc_STRCPY(buffer + 1,
378 data.size = name_size + 1;
380 total_size += data.size;
382 _nc_db_put(capdb, &key, &data);
384 while (*other_names != '\0') {
386 assert(ptr < buffer + sizeof(buffer) - 1);
387 while (*other_names != '|' && *other_names != '\0')
390 if (*other_names != '\0')
391 *(other_names++) = '\0';
394 key.size = strlen(ptr);
396 total_size += data.size;
398 _nc_db_put(capdb, &key, &data);
402 #else /* !USE_HASHED_DB */
403 if (call_count++ == 0) {
407 if (strlen(first_name) >= limit2) {
408 _nc_warning("terminal name too long.");
409 saved = first_name[limit2];
410 first_name[limit2] = '\0';
413 _nc_SPRINTF(filename, _nc_SLIMIT(sizeof(filename))
414 LEAF_FMT "/%.*s", UChar(first_name[0]),
415 (int) (sizeof(filename) - (LEAF_LEN + 2)),
419 first_name[limit2] = saved;
422 * Has this primary name been written since the first call to
423 * write_entry()? If so, the newer write will step on the older,
426 if (start_time > 0 &&
427 stat(filename, &statbuf) >= 0
428 && statbuf.st_mtime >= start_time) {
429 #if HAVE_LINK && !USE_SYMLINKS
431 * If the file has more than one link, the reason for the previous
432 * write could be that the current primary name used to be an alias for
433 * the previous entry. In that case, unlink the file so that we will
434 * not modify the previous entry as we write this one.
436 if (statbuf.st_nlink > 1) {
437 _nc_warning("name redefined.");
440 _nc_warning("name multiply defined.");
443 _nc_warning("name multiply defined.");
447 check_writeable(first_name[0]);
448 write_file(filename, tp);
450 if (start_time == 0) {
451 if (stat(filename, &statbuf) == -1
452 || (start_time = statbuf.st_mtime) == 0) {
453 _nc_syserr_abort("error obtaining time from %s/%s",
454 _nc_tic_dir(0), filename);
457 while (*other_names != '\0') {
459 while (*other_names != '|' && *other_names != '\0')
462 if (*other_names != '\0')
463 *(other_names++) = '\0';
465 if (strlen(ptr) > sizeof(linkname) - (2 + LEAF_LEN)) {
466 _nc_warning("terminal alias %s too long.", ptr);
469 if (strchr(ptr, '/') != 0) {
470 _nc_warning("cannot link alias %s.", ptr);
474 check_writeable(ptr[0]);
475 _nc_SPRINTF(linkname, _nc_SLIMIT(sizeof(linkname))
476 LEAF_FMT "/%.*s", ptr[0],
477 (int) sizeof(linkname) - (2 + LEAF_LEN), ptr);
479 if (strcmp(filename, linkname) == 0) {
480 _nc_warning("self-synonym ignored");
483 else if (stat(linkname, &statbuf) >= 0 &&
484 statbuf.st_mtime < start_time) {
485 _nc_warning("alias %s multiply defined.", ptr);
488 else if (_nc_access(linkname, W_OK) == 0)
493 #define MY_SIZE sizeof(symlinkname) - 1
494 if (first_name[0] == linkname[0]) {
495 _nc_STRNCPY(symlinkname, first_name, MY_SIZE);
497 _nc_STRCPY(symlinkname, "../", sizeof(symlinkname));
498 _nc_STRNCPY(symlinkname + 3, filename, MY_SIZE - 3);
500 symlinkname[MY_SIZE] = '\0';
501 #endif /* USE_SYMLINKS */
503 code = remove(linkname);
505 code = unlink(linkname);
507 if (code != 0 && errno == ENOENT)
510 if (symlink(symlinkname, linkname) < 0)
512 if (link(filename, linkname) < 0)
513 #endif /* USE_SYMLINKS */
516 * If there wasn't anything there, and we cannot
517 * link to the target because it is the same as the
518 * target, then the source must be on a filesystem
519 * that uses caseless filenames, such as Win32, etc.
521 if (code == 0 && errno == EEXIST)
522 _nc_warning("can't link %s to %s", filename, linkname);
523 else if (code == 0 && (errno == EPERM || errno == ENOENT))
524 write_file(linkname, tp);
526 #if MIXEDCASE_FILENAMES
527 _nc_syserr_abort("cannot link %s to %s", filename, linkname);
529 _nc_warning("cannot link %s to %s (errno=%d)", filename,
534 DEBUG(1, ("Linked %s", linkname));
537 #else /* just make copies */
538 write_file(linkname, tp);
539 #endif /* HAVE_LINK */
541 #endif /* USE_HASHED_DB */
545 fake_write(char *dst,
552 size_t have = (limit - *offset);
558 memcpy(dst + *offset, src, want);
559 *offset += (unsigned) want;
563 return (want / size);
566 #define Write(buf, size, count) fake_write(buffer, offset, (size_t) limit, (char *) buf, (size_t) count, (size_t) size)
568 #undef LITTLE_ENDIAN /* BSD/OS defines this as a feature macro */
569 #define HI(x) ((x) / 256)
570 #define LO(x) ((x) % 256)
571 #define LITTLE_ENDIAN(p, x) (p)[0] = (unsigned char)LO(x), \
572 (p)[1] = (unsigned char)HI(x)
574 #define WRITE_STRING(str) (Write(str, sizeof(char), strlen(str) + 1) == strlen(str) + 1)
577 compute_offsets(char **Strings, size_t strmax, short *offsets)
582 for (i = 0; i < strmax; i++) {
583 if (Strings[i] == ABSENT_STRING) {
585 } else if (Strings[i] == CANCELLED_STRING) {
588 offsets[i] = (short) nextfree;
589 nextfree += (int) strlen(Strings[i]) + 1;
590 TRACE_OUT(("put Strings[%d]=%s(%d)", (int) i,
591 _nc_visbuf(Strings[i]), (int) nextfree));
598 convert_shorts(unsigned char *buf, short *Numbers, size_t count)
601 for (i = 0; i < count; i++) {
602 if (Numbers[i] == ABSENT_NUMERIC) { /* HI/LO won't work */
603 buf[2 * i] = buf[2 * i + 1] = 0377;
604 } else if (Numbers[i] == CANCELLED_NUMERIC) { /* HI/LO won't work */
606 buf[2 * i + 1] = 0377;
608 LITTLE_ENDIAN(buf + 2 * i, Numbers[i]);
609 TRACE_OUT(("put Numbers[%u]=%d", (unsigned) i, Numbers[i]));
615 #if NCURSES_EXT_NUMBERS
617 convert_16bit(unsigned char *buf, NCURSES_INT2 *Numbers, size_t count)
620 size_t size = SIZEOF_SHORT;
621 for (i = 0; i < count; i++) {
622 unsigned value = (unsigned) Numbers[i];
624 for (j = 0; j < size; ++j) {
625 *buf++ = value & 0xff;
633 convert_32bit(unsigned char *buf, NCURSES_INT2 *Numbers, size_t count)
636 size_t size = SIZEOF_INT2;
637 for (i = 0; i < count; i++) {
638 unsigned value = (unsigned) Numbers[i];
640 for (j = 0; j < size; ++j) {
641 *buf++ = value & 0xff;
649 #define even_boundary(value) \
650 ((value) % 2 != 0 && Write(&zero, sizeof(char), 1) != 1)
654 extended_Booleans(TERMTYPE2 *tp)
659 for (i = 0; i < tp->ext_Booleans; ++i) {
660 if (tp->Booleans[BOOLCOUNT + i] == TRUE)
667 extended_Numbers(TERMTYPE2 *tp)
672 for (i = 0; i < tp->ext_Numbers; ++i) {
673 if (tp->Numbers[NUMCOUNT + i] != ABSENT_NUMERIC)
680 extended_Strings(TERMTYPE2 *tp)
682 unsigned short result = 0;
685 for (i = 0; i < tp->ext_Strings; ++i) {
686 if (tp->Strings[STRCOUNT + i] != ABSENT_STRING)
687 result = (unsigned short) (i + 1);
693 * _nc_align_termtype() will extend entries that are referenced in a use=
694 * clause - discard the unneeded data.
697 extended_object(TERMTYPE2 *tp)
701 if (_nc_user_definable) {
702 result = ((extended_Booleans(tp)
703 + extended_Numbers(tp)
704 + extended_Strings(tp)) != 0);
711 _nc_write_object(TERMTYPE2 *tp, char *buffer, unsigned *offset, unsigned limit)
714 size_t namelen, boolmax, nummax, strmax, numlen;
718 short offsets[MAX_ENTRY_SIZE / 2];
719 unsigned char buf[MAX_ENTRY_SIZE];
720 unsigned last_bool = BOOLWRITE;
721 unsigned last_num = NUMWRITE;
722 unsigned last_str = STRWRITE;
723 #if NCURSES_EXT_NUMBERS
724 bool need_ints = FALSE;
725 size_t (*convert_numbers) (unsigned char *, NCURSES_INT2 *, size_t);
727 #define convert_numbers convert_shorts
732 * Normally we limit the list of values to exclude the "obsolete"
733 * capabilities. However, if we are accepting extended names, add
734 * these as well, since they are used for supporting translation
737 if (_nc_user_definable) {
738 last_bool = BOOLCOUNT;
744 namelist = tp->term_names;
745 namelen = strlen(namelist) + 1;
748 for (i = 0; i < last_bool; i++) {
749 if (tp->Booleans[i] == TRUE) {
755 for (i = 0; i < last_num; i++) {
756 if (tp->Numbers[i] != ABSENT_NUMERIC) {
758 #if NCURSES_EXT_NUMBERS
759 if (tp->Numbers[i] > MAX_OF_TYPE(NCURSES_COLOR_T)) {
767 for (i = 0; i < last_str; i++) {
768 if (tp->Strings[i] != ABSENT_STRING)
772 nextfree = compute_offsets(tp->Strings, strmax, offsets);
774 /* fill in the header */
775 #if NCURSES_EXT_NUMBERS
777 convert_numbers = convert_32bit;
778 LITTLE_ENDIAN(buf, MAGIC2);
780 convert_numbers = convert_16bit;
781 LITTLE_ENDIAN(buf, MAGIC);
784 LITTLE_ENDIAN(buf, MAGIC);
786 LITTLE_ENDIAN(buf + 2, min(namelen, MAX_NAME_SIZE + 1));
787 LITTLE_ENDIAN(buf + 4, boolmax);
788 LITTLE_ENDIAN(buf + 6, nummax);
789 LITTLE_ENDIAN(buf + 8, strmax);
790 LITTLE_ENDIAN(buf + 10, nextfree);
792 /* write out the header */
793 TRACE_OUT(("Header of %s @%d", namelist, *offset));
794 if (Write(buf, 12, 1) != 1
795 || Write(namelist, sizeof(char), namelen) != namelen) {
799 for (i = 0; i < boolmax; i++) {
800 if (tp->Booleans[i] == TRUE) {
806 if (Write(buf, sizeof(char), boolmax) != boolmax) {
810 if (even_boundary(namelen + boolmax)) {
814 TRACE_OUT(("Numerics begin at %04x", *offset));
817 numlen = convert_numbers(buf, tp->Numbers, nummax);
818 if (Write(buf, numlen, nummax) != nummax) {
822 TRACE_OUT(("String offsets begin at %04x", *offset));
824 /* the string offsets */
825 convert_shorts(buf, offsets, strmax);
826 if (Write(buf, SIZEOF_SHORT, strmax) != strmax) {
830 TRACE_OUT(("String table begins at %04x", *offset));
833 for (i = 0; i < strmax; i++) {
834 if (VALID_STRING(tp->Strings[i])) {
835 if (!WRITE_STRING(tp->Strings[i])) {
842 if (extended_object(tp)) {
843 unsigned ext_total = (unsigned) NUM_EXT_NAMES(tp);
844 unsigned ext_usage = ext_total;
846 if (even_boundary(nextfree)) {
850 nextfree = compute_offsets(tp->Strings + STRCOUNT,
851 (size_t) tp->ext_Strings,
853 TRACE_OUT(("after extended string capabilities, nextfree=%d", nextfree));
855 if (tp->ext_Strings >= SIZEOF(offsets)) {
859 nextfree += compute_offsets(tp->ext_Names,
861 offsets + tp->ext_Strings);
862 TRACE_OUT(("after extended capnames, nextfree=%d", nextfree));
863 strmax = tp->ext_Strings + ext_total;
864 for (i = 0; i < tp->ext_Strings; ++i) {
865 if (VALID_STRING(tp->Strings[i + STRCOUNT])) {
869 TRACE_OUT(("will write %u/%lu strings", ext_usage, (unsigned long) strmax));
872 * Write the extended header
874 LITTLE_ENDIAN(buf + 0, tp->ext_Booleans);
875 LITTLE_ENDIAN(buf + 2, tp->ext_Numbers);
876 LITTLE_ENDIAN(buf + 4, tp->ext_Strings);
877 LITTLE_ENDIAN(buf + 6, ext_usage);
878 LITTLE_ENDIAN(buf + 8, nextfree);
879 TRACE_OUT(("WRITE extended-header @%d", *offset));
880 if (Write(buf, 10, 1) != 1) {
884 TRACE_OUT(("WRITE %d booleans @%d", tp->ext_Booleans, *offset));
886 && Write(tp->Booleans + BOOLCOUNT, sizeof(char),
887 tp->ext_Booleans) != tp->ext_Booleans) {
891 if (even_boundary(tp->ext_Booleans)) {
895 TRACE_OUT(("WRITE %d numbers @%d", tp->ext_Numbers, *offset));
896 if (tp->ext_Numbers) {
897 numlen = convert_numbers(buf, tp->Numbers + NUMCOUNT, (size_t) tp->ext_Numbers);
898 if (Write(buf, numlen, tp->ext_Numbers) != tp->ext_Numbers) {
904 * Convert the offsets for the ext_Strings and ext_Names tables,
907 convert_shorts(buf, offsets, strmax);
908 TRACE_OUT(("WRITE offsets @%d", *offset));
909 if (Write(buf, SIZEOF_SHORT, strmax) != strmax) {
914 * Write the string table after the offset tables so we do not
915 * have to do anything about alignment.
917 for (i = 0; i < tp->ext_Strings; i++) {
918 if (VALID_STRING(tp->Strings[i + STRCOUNT])) {
919 TRACE_OUT(("WRITE ext_Strings[%d]=%s", (int) i,
920 _nc_visbuf(tp->Strings[i + STRCOUNT])));
921 if (!WRITE_STRING(tp->Strings[i + STRCOUNT])) {
928 * Write the extended names
930 for (i = 0; i < ext_total; i++) {
931 TRACE_OUT(("WRITE ext_Names[%d]=%s", (int) i, tp->ext_Names[i]));
932 if (!WRITE_STRING(tp->ext_Names[i])) {
938 #endif /* NCURSES_XNAMES */
942 total_size = total_size + (int) (*offset + 1);
947 * Returns the total number of entries written by this process
950 _nc_tic_written(void)
952 TR(TRACE_DATABASE, ("_nc_tic_written %d entries, %d parts, %d size",
953 total_written, total_parts, total_size));
954 return total_written;