/****************************************************************************
- * Copyright (c) 1998-2013,2014 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2014,2015 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the *
#define TRACE_OUT(p) /*nothing */
#endif
-MODULE_ID("$Id: write_entry.c,v 1.92 2014/11/01 14:47:00 tom Exp $")
+MODULE_ID("$Id: write_entry.c,v 1.95 2016/09/10 20:22:42 tom Exp $")
static int total_written;
static int make_db_root(const char *);
-static int write_object(TERMTYPE *, char *, unsigned *, unsigned);
#if !USE_HASHED_DB
static void
}
DEBUG(1, ("Created %s", filename));
- if (write_object(tp, buffer, &offset, limit) == ERR
+ if (_nc_write_object(tp, buffer, &offset, limit) == ERR
|| fwrite(buffer, sizeof(char), (size_t) offset, fp) != offset) {
_nc_syserr_abort("error writing %s/%s", _nc_tic_dir(0), filename);
}
_nc_set_type(first_name);
#if USE_HASHED_DB
- if (write_object(tp, buffer + 1, &offset, limit - 1) != ERR) {
+ if (_nc_write_object(tp, buffer + 1, &offset, limit - 1) != ERR) {
DB *capdb = _nc_db_open(_nc_tic_dir(0), TRUE);
DBT key, data;
{
int code;
#if USE_SYMLINKS
- if (first_name[0] == linkname[0])
- strncpy(symlinkname, first_name, sizeof(symlinkname) - 1);
- else {
- _nc_STRCPY(symlinkname, "../", sizeof(suymlinkname));
- strncat(symlinkname, filename, sizeof(symlinkname) - 4);
+#define MY_SIZE sizeof(symlinkname) - 1
+ if (first_name[0] == linkname[0]) {
+ _nc_STRNCPY(symlinkname, first_name, MY_SIZE);
+ } else {
+ _nc_STRCPY(symlinkname, "../", sizeof(symlinkname));
+ _nc_STRNCPY(symlinkname + 3, first_name, MY_SIZE - 3);
}
- symlinkname[sizeof(symlinkname) - 1] = '\0';
+ symlinkname[MY_SIZE] = '\0';
#endif /* USE_SYMLINKS */
#if HAVE_REMOVE
code = remove(linkname);
}
#endif
-static int
-write_object(TERMTYPE *tp, char *buffer, unsigned *offset, unsigned limit)
+NCURSES_EXPORT(int)
+_nc_write_object(TERMTYPE *tp, char *buffer, unsigned *offset, unsigned limit)
{
char *namelist;
size_t namelen, boolmax, nummax, strmax;