1 /****************************************************************************
2 * Copyright 2018-2023,2024 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.132 2024/04/20 17:58:51 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);
133 } else if (!verified[s - dirnames]) {
134 _nc_SPRINTF(dir, _nc_SLIMIT(sizeof(dir)) LEAF_FMT, code);
135 if (make_db_root(dir) < 0) {
136 _nc_err_abort("%s/%s: permission denied", _nc_tic_dir(NULL), dir);
138 verified[s - dirnames] = TRUE;
142 #endif /* !USE_HASHED_DB */
145 make_db_path(char *dst, const char *src, size_t limit)
148 const char *top = _nc_tic_dir(NULL);
150 if (src == top || _nc_is_abs_path(src)) {
151 if (strlen(src) + 1 <= limit) {
152 _nc_STRCPY(dst, src, limit);
156 if ((strlen(top) + strlen(src) + 6) <= limit) {
157 _nc_SPRINTF(dst, _nc_SLIMIT(limit) "%s/%s", top, src);
163 static const char suffix[] = DBM_SUFFIX;
164 size_t have = strlen(dst);
165 size_t need = strlen(suffix);
166 if (have > need && strcmp(dst + (int) (have - need), suffix)) {
167 if (have + need <= limit) {
168 _nc_STRCAT(dst, suffix, limit);
172 } else if (_nc_is_dir_path(dst)) {
181 * Make a database-root if it doesn't exist.
184 make_db_root(const char *path)
187 char fullpath[PATH_MAX];
189 if ((rc = make_db_path(fullpath, path, sizeof(fullpath))) == 0) {
193 if ((capdbp = _nc_db_open(fullpath, TRUE)) == NULL) {
195 } else if (_nc_db_close(capdbp) < 0) {
201 if ((rc = stat(path, &statbuf)) == -1) {
207 } else if (_nc_access(path, R_OK | W_OK | X_OK) < 0) {
208 rc = -1; /* permission denied */
209 } else if (!(S_ISDIR(statbuf.st_mode))) {
210 rc = -1; /* not a directory */
218 * Set the write directory for compiled entries.
221 _nc_set_writedir(const char *dir)
223 const char *destination;
224 char actual[PATH_MAX];
225 bool specific = (dir != NULL);
227 if (!specific && use_terminfo_vars())
228 dir = getenv("TERMINFO");
231 (void) _nc_tic_dir(dir);
233 destination = _nc_tic_dir(NULL);
234 if (make_db_root(destination) < 0) {
235 bool success = FALSE;
238 char *home = _nc_home_terminfo();
242 if (make_db_root(destination) == 0)
247 _nc_err_abort("%s: permission denied (errno %d)",
253 * Note: because of this code, this logic should be exercised
254 * *once only* per run.
257 make_db_path(actual, destination, sizeof(actual));
259 if (chdir(_nc_tic_dir(destination)) < 0
260 || getcwd(actual, sizeof(actual)) == NULL)
261 _nc_err_abort("%s: not a directory", destination);
263 _nc_keep_tic_dir(actual);
267 * Save the compiled version of a description in the filesystem.
269 * make a copy of the name-list
270 * break it up into first-name and all-but-last-name
272 * write object information to first-name
274 * for each name in all-but-last-name
277 * Using 'time()' to obtain a reference for file timestamps is unreliable,
278 * e.g., with NFS, because the filesystem may have a different time
279 * reference. We check for pre-existence of links by latching the first
280 * timestamp from a file that we create.
282 * The _nc_warning() calls will report a correct line number only if
283 * _nc_curr_line is properly set before the write_entry() call.
287 _nc_write_entry(TERMTYPE2 *const tp)
291 char buffer[MAX_ENTRY_SIZE + 1];
292 unsigned limit = sizeof(buffer);
295 #else /* !USE_HASHED_DB */
298 char filename[PATH_MAX];
299 char linkname[PATH_MAX];
301 char symlinkname[PATH_MAX];
306 #endif /* USE_SYMLINKS */
308 unsigned limit2 = sizeof(filename) - (2 + LEAF_LEN);
311 static int call_count;
312 static time_t start_time; /* time at start of writes */
314 #endif /* USE_HASHED_DB */
316 char name_list[MAX_TERMINFO_LENGTH];
317 char *first_name, *other_names;
319 char *term_names = tp->term_names;
320 size_t name_size = strlen(term_names);
322 if (name_size == 0) {
323 _nc_syserr_abort("no terminal name found.");
324 } else if (name_size >= sizeof(name_list) - 1) {
325 _nc_syserr_abort("terminal name too long: %s", term_names);
328 _nc_STRCPY(name_list, term_names, sizeof(name_list));
329 DEBUG(7, ("Name list = '%s'", name_list));
331 first_name = name_list;
333 ptr = &name_list[name_size - 1];
334 other_names = ptr + 1;
336 while (ptr > name_list && *ptr != '|')
339 if (ptr != name_list) {
342 for (ptr = name_list; *ptr != '\0' && *ptr != '|'; ptr++) {
350 other_names = ptr + 1;
354 DEBUG(7, ("First name = '%s'", first_name));
355 DEBUG(7, ("Other names = '%s'", other_names));
357 _nc_set_type(first_name);
360 if (_nc_write_object(tp, buffer + 1, &offset, limit - 1) != ERR) {
361 DB *capdb = _nc_db_open(_nc_tic_dir(NULL), TRUE);
367 memset(&key, 0, sizeof(key));
368 key.data = term_names;
369 key.size = name_size;
371 memset(&data, 0, sizeof(data));
373 data.size = offset + 1;
375 _nc_db_put(capdb, &key, &data);
379 key.data = name_list;
380 key.size = strlen(name_list);
382 _nc_STRCPY(buffer + 1,
385 data.size = name_size + 1;
387 total_size += (int) data.size;
389 _nc_db_put(capdb, &key, &data);
391 while (*other_names != '\0') {
393 assert(ptr < buffer + sizeof(buffer) - 1);
394 while (*other_names != '|' && *other_names != '\0')
397 if (*other_names != '\0')
398 *(other_names++) = '\0';
401 key.size = strlen(ptr);
403 total_size += (int) data.size;
405 _nc_db_put(capdb, &key, &data);
409 #else /* !USE_HASHED_DB */
410 if (call_count++ == 0) {
414 if (strlen(first_name) >= limit2) {
415 _nc_warning("terminal name too long.");
416 saved = first_name[limit2];
417 first_name[limit2] = '\0';
420 _nc_SPRINTF(filename, _nc_SLIMIT(sizeof(filename))
421 LEAF_FMT "/%.*s", UChar(first_name[0]),
422 (int) (sizeof(filename) - (LEAF_LEN + 2)),
426 first_name[limit2] = saved;
429 * Has this primary name been written since the first call to
430 * write_entry()? If so, the newer write will step on the older,
433 if (start_time > 0 &&
434 stat(filename, &statbuf) >= 0
435 && statbuf.st_mtime >= start_time) {
436 #if HAVE_LINK && !USE_SYMLINKS
438 * If the file has more than one link, the reason for the previous
439 * write could be that the current primary name used to be an alias for
440 * the previous entry. In that case, unlink the file so that we will
441 * not modify the previous entry as we write this one.
443 if (statbuf.st_nlink > 1) {
444 _nc_warning("name redefined.");
447 _nc_warning("name multiply defined.");
450 _nc_warning("name multiply defined.");
454 check_writeable(first_name[0]);
455 write_file(filename, tp);
457 if (start_time == 0) {
458 if (stat(filename, &statbuf) == -1
459 || (start_time = statbuf.st_mtime) == 0) {
460 _nc_syserr_abort("error obtaining time from %s/%s",
461 _nc_tic_dir(NULL), filename);
464 while (*other_names != '\0') {
466 while (*other_names != '|' && *other_names != '\0')
469 if (*other_names != '\0')
470 *(other_names++) = '\0';
472 if (strlen(ptr) > sizeof(linkname) - (2 + LEAF_LEN)) {
473 _nc_warning("terminal alias %s too long.", ptr);
476 if (strchr(ptr, '/') != NULL) {
477 _nc_warning("cannot link alias %s.", ptr);
481 check_writeable(ptr[0]);
482 _nc_SPRINTF(linkname, _nc_SLIMIT(sizeof(linkname))
483 LEAF_FMT "/%.*s", ptr[0],
484 (int) sizeof(linkname) - (2 + LEAF_LEN), ptr);
486 if (strcmp(filename, linkname) == 0) {
487 _nc_warning("self-synonym ignored");
490 else if (stat(linkname, &statbuf) >= 0 &&
491 statbuf.st_mtime < start_time) {
492 _nc_warning("alias %s multiply defined.", ptr);
495 else if (_nc_access(linkname, W_OK) == 0)
500 #define MY_SIZE sizeof(symlinkname) - 1
501 if (first_name[0] == linkname[0]) {
502 _nc_STRNCPY(symlinkname, first_name, MY_SIZE);
504 _nc_STRCPY(symlinkname, "../", sizeof(symlinkname));
505 _nc_STRNCPY(symlinkname + 3, filename, MY_SIZE - 3);
507 symlinkname[MY_SIZE] = '\0';
508 #endif /* USE_SYMLINKS */
510 code = remove(linkname);
512 code = unlink(linkname);
514 if (code != 0 && errno == ENOENT)
517 if (symlink(symlinkname, linkname) < 0)
519 if (link(filename, linkname) < 0)
520 #endif /* USE_SYMLINKS */
523 * If there wasn't anything there, and we cannot
524 * link to the target because it is the same as the
525 * target, then the source must be on a filesystem
526 * that uses caseless filenames, such as Win32, etc.
528 if (code == 0 && errno == EEXIST)
529 _nc_warning("can't link %s to %s", filename, linkname);
530 else if (code == 0 && (errno == EPERM || errno == ENOENT))
531 write_file(linkname, tp);
533 #if MIXEDCASE_FILENAMES
534 _nc_syserr_abort("cannot link %s to %s", filename, linkname);
536 _nc_warning("cannot link %s to %s (errno=%d)", filename,
541 DEBUG(1, ("Linked %s", linkname));
544 #else /* just make copies */
545 write_file(linkname, tp);
546 #endif /* HAVE_LINK */
548 #endif /* USE_HASHED_DB */
552 fake_write(char *dst,
559 size_t have = (limit - *offset);
565 memcpy(dst + *offset, src, want);
566 *offset += (unsigned) want;
570 return (want / size);
573 #define Write(buf, size, count) fake_write(buffer, offset, (size_t) limit, (char *) buf, (size_t) count, (size_t) size)
575 #undef LITTLE_ENDIAN /* BSD/OS defines this as a feature macro */
576 #define HI(x) ((x) / 256)
577 #define LO(x) ((x) % 256)
578 #define LITTLE_ENDIAN(p, x) (p)[0] = (unsigned char)LO(x), \
579 (p)[1] = (unsigned char)HI(x)
581 #define WRITE_STRING(str) (Write(str, sizeof(char), strlen(str) + 1) == strlen(str) + 1)
584 compute_offsets(char **Strings, size_t strmax, short *offsets)
589 for (i = 0; i < strmax; i++) {
590 if (Strings[i] == ABSENT_STRING) {
592 } else if (Strings[i] == CANCELLED_STRING) {
595 offsets[i] = (short) nextfree;
596 nextfree += (int) strlen(Strings[i]) + 1;
597 TRACE_OUT(("put Strings[%d]=%s(%d)", (int) i,
598 _nc_visbuf(Strings[i]), (int) nextfree));
605 convert_shorts(unsigned char *buf, short *Numbers, size_t count)
608 for (i = 0; i < count; i++) {
609 if (Numbers[i] == ABSENT_NUMERIC) { /* HI/LO won't work */
610 buf[2 * i] = buf[2 * i + 1] = 0377;
611 } else if (Numbers[i] == CANCELLED_NUMERIC) { /* HI/LO won't work */
613 buf[2 * i + 1] = 0377;
615 LITTLE_ENDIAN(buf + 2 * i, Numbers[i]);
616 TRACE_OUT(("put Numbers[%u]=%d", (unsigned) i, Numbers[i]));
622 #if NCURSES_EXT_NUMBERS
624 convert_16bit(unsigned char *buf, NCURSES_INT2 *Numbers, size_t count)
627 size_t size = SIZEOF_SHORT;
628 for (i = 0; i < count; i++) {
629 unsigned value = (unsigned) Numbers[i];
631 for (j = 0; j < size; ++j) {
632 *buf++ = value & 0xff;
640 convert_32bit(unsigned char *buf, NCURSES_INT2 *Numbers, size_t count)
643 size_t size = SIZEOF_INT2;
644 for (i = 0; i < count; i++) {
645 unsigned value = (unsigned) Numbers[i];
647 for (j = 0; j < size; ++j) {
648 *buf++ = value & 0xff;
656 #define even_boundary(value) \
657 ((value) % 2 != 0 && Write(&zero, sizeof(char), 1) != 1)
661 extended_Booleans(TERMTYPE2 *tp)
666 for (i = 0; i < tp->ext_Booleans; ++i) {
667 if (tp->Booleans[BOOLCOUNT + i] == TRUE)
674 extended_Numbers(TERMTYPE2 *tp)
679 for (i = 0; i < tp->ext_Numbers; ++i) {
680 if (tp->Numbers[NUMCOUNT + i] != ABSENT_NUMERIC)
687 extended_Strings(TERMTYPE2 *tp)
689 unsigned short result = 0;
692 for (i = 0; i < tp->ext_Strings; ++i) {
693 if (tp->Strings[STRCOUNT + i] != ABSENT_STRING)
694 result = (unsigned short) (i + 1);
700 * _nc_align_termtype() will extend entries that are referenced in a use=
701 * clause - discard the unneeded data.
704 extended_object(TERMTYPE2 *tp)
708 if (_nc_user_definable) {
709 result = ((extended_Booleans(tp)
710 + extended_Numbers(tp)
711 + extended_Strings(tp)) != 0);
718 _nc_write_object(TERMTYPE2 *tp, char *buffer, unsigned *offset, unsigned limit)
721 size_t namelen, boolmax, nummax, strmax, numlen;
725 short offsets[MAX_ENTRY_SIZE / 2];
726 unsigned char buf[MAX_ENTRY_SIZE];
727 unsigned last_bool = BOOLWRITE;
728 unsigned last_num = NUMWRITE;
729 unsigned last_str = STRWRITE;
730 #if NCURSES_EXT_NUMBERS
731 bool need_ints = FALSE;
732 size_t (*convert_numbers) (unsigned char *, NCURSES_INT2 *, size_t);
734 #define convert_numbers convert_shorts
739 * Normally we limit the list of values to exclude the "obsolete"
740 * capabilities. However, if we are accepting extended names, add
741 * these as well, since they are used for supporting translation
744 if (_nc_user_definable) {
745 last_bool = BOOLCOUNT;
751 namelist = tp->term_names;
752 namelen = strlen(namelist) + 1;
755 for (i = 0; i < last_bool; i++) {
756 if (tp->Booleans[i] == TRUE) {
762 for (i = 0; i < last_num; i++) {
763 if (tp->Numbers[i] != ABSENT_NUMERIC) {
765 #if NCURSES_EXT_NUMBERS
766 if (tp->Numbers[i] > MAX_OF_TYPE(NCURSES_COLOR_T)) {
774 for (i = 0; i < last_str; i++) {
775 if (tp->Strings[i] != ABSENT_STRING)
779 nextfree = compute_offsets(tp->Strings, strmax, offsets);
781 /* fill in the header */
782 #if NCURSES_EXT_NUMBERS
784 convert_numbers = convert_32bit;
785 LITTLE_ENDIAN(buf, MAGIC2);
787 convert_numbers = convert_16bit;
788 LITTLE_ENDIAN(buf, MAGIC);
791 LITTLE_ENDIAN(buf, MAGIC);
793 namelen = Min(namelen, MAX_NAME_SIZE + 1);
794 LITTLE_ENDIAN(buf + 2, namelen);
795 LITTLE_ENDIAN(buf + 4, boolmax);
796 LITTLE_ENDIAN(buf + 6, nummax);
797 LITTLE_ENDIAN(buf + 8, strmax);
798 LITTLE_ENDIAN(buf + 10, nextfree);
800 /* write out the header */
801 TRACE_OUT(("Header of %s @%d", namelist, *offset));
802 if (Write(buf, 12, 1) != 1
803 || Write(namelist, sizeof(char), namelen) != namelen) {
807 for (i = 0; i < boolmax; i++) {
808 if (tp->Booleans[i] == TRUE) {
814 if (Write(buf, sizeof(char), boolmax) != boolmax) {
818 if (even_boundary(namelen + boolmax)) {
822 TRACE_OUT(("Numerics begin at %04x", *offset));
825 numlen = convert_numbers(buf, tp->Numbers, nummax);
826 if (Write(buf, numlen, nummax) != nummax) {
830 TRACE_OUT(("String offsets begin at %04x", *offset));
832 /* the string offsets */
833 convert_shorts(buf, offsets, strmax);
834 if (Write(buf, SIZEOF_SHORT, strmax) != strmax) {
838 TRACE_OUT(("String table begins at %04x", *offset));
841 for (i = 0; i < strmax; i++) {
842 if (VALID_STRING(tp->Strings[i])) {
843 if (!WRITE_STRING(tp->Strings[i])) {
850 if (extended_object(tp)) {
851 unsigned ext_total = (unsigned) NUM_EXT_NAMES(tp);
852 unsigned ext_usage = ext_total;
854 if (even_boundary(nextfree)) {
858 nextfree = compute_offsets(tp->Strings + STRCOUNT,
859 (size_t) tp->ext_Strings,
861 TRACE_OUT(("after extended string capabilities, nextfree=%d", nextfree));
863 if (tp->ext_Strings >= SIZEOF(offsets)) {
867 nextfree += compute_offsets(tp->ext_Names,
869 offsets + tp->ext_Strings);
870 TRACE_OUT(("after extended capnames, nextfree=%d", nextfree));
871 strmax = tp->ext_Strings + ext_total;
872 for (i = 0; i < tp->ext_Strings; ++i) {
873 if (VALID_STRING(tp->Strings[i + STRCOUNT])) {
877 TRACE_OUT(("will write %u/%lu strings", ext_usage, (unsigned long) strmax));
880 * Write the extended header
882 LITTLE_ENDIAN(buf + 0, tp->ext_Booleans);
883 LITTLE_ENDIAN(buf + 2, tp->ext_Numbers);
884 LITTLE_ENDIAN(buf + 4, tp->ext_Strings);
885 LITTLE_ENDIAN(buf + 6, ext_usage);
886 LITTLE_ENDIAN(buf + 8, nextfree);
887 TRACE_OUT(("WRITE extended-header @%d", *offset));
888 if (Write(buf, 10, 1) != 1) {
892 TRACE_OUT(("WRITE %d booleans @%d", tp->ext_Booleans, *offset));
894 && Write(tp->Booleans + BOOLCOUNT, sizeof(char),
895 tp->ext_Booleans) != tp->ext_Booleans) {
899 if (even_boundary(tp->ext_Booleans)) {
903 TRACE_OUT(("WRITE %d numbers @%d", tp->ext_Numbers, *offset));
904 if (tp->ext_Numbers) {
905 numlen = convert_numbers(buf, tp->Numbers + NUMCOUNT, (size_t) tp->ext_Numbers);
906 if (Write(buf, numlen, tp->ext_Numbers) != tp->ext_Numbers) {
912 * Convert the offsets for the ext_Strings and ext_Names tables,
915 convert_shorts(buf, offsets, strmax);
916 TRACE_OUT(("WRITE offsets @%d", *offset));
917 if (Write(buf, SIZEOF_SHORT, strmax) != strmax) {
922 * Write the string table after the offset tables so we do not
923 * have to do anything about alignment.
925 for (i = 0; i < tp->ext_Strings; i++) {
926 if (VALID_STRING(tp->Strings[i + STRCOUNT])) {
927 TRACE_OUT(("WRITE ext_Strings[%d]=%s", (int) i,
928 _nc_visbuf(tp->Strings[i + STRCOUNT])));
929 if (!WRITE_STRING(tp->Strings[i + STRCOUNT])) {
936 * Write the extended names
938 for (i = 0; i < ext_total; i++) {
939 TRACE_OUT(("WRITE ext_Names[%d]=%s", (int) i, tp->ext_Names[i]));
940 if (!WRITE_STRING(tp->ext_Names[i])) {
946 #endif /* NCURSES_XNAMES */
950 total_size = total_size + (int) (*offset + 1);
955 * Returns the total number of entries written by this process
958 _nc_tic_written(void)
960 TR(TRACE_DATABASE, ("_nc_tic_written %d entries, %d parts, %d size",
961 total_written, total_parts, total_size));
962 return total_written;