logfile
if (logfile || f_foreground) {
if (logfile)
if (logfile) {
logp = log_open(250, logfile);
errx(1, "ERROR: failed to open log file %s.", logfile);
if (logfile != NULL)
racoon_free(logfile);
logfile = racoon_strdup(file);
STRDUP_FATAL(logfile);
static char *logfile = NULL;
static void logfile(void);
logfile();
char logfile[] = _PATH_LOG;
extern char logfile[], loginname[], logname[], lastmonst[];
if (lappend(logfile) < 0) { /* append to file */
if (lcreat(logfile) < 0) { /* and can't create new
chmod(logfile, 0660);
if (lopen(logfile) < 0) {
lprintf("Can't locate log file <%s>\n", logfile);
lprintf("Can't stat log file <%s>\n", logfile);
static FILE *logfile;
logfile = fopen(SNAKE_PATH_LOGFILE, "a");
if (logfile == NULL) {
if (logfile != NULL) {
fprintf(logfile, "%s $%d %dx%d %s %s",
fflush(logfile);
char logfile[MAXPATHLEN]; /* Path to log file */
if (strcmp(log.logfile, argv[i]) == 0)
(void)strlcpy(log->logfile, *ap++, sizeof(log->logfile));
if (log->logfile[0] != '/')
PRHDRINFO(("\n%s <%d%s>: ", log->logfile, log->numhist,
if (stat(log->logfile, &sb) < 0) {
if (stat(log->logfile, &sb))
err(EXIT_FAILURE, "%s", log->logfile);
err(EXIT_FAILURE, "%s", log->logfile);
(void)strlcpy(tmp, log->logfile, sizeof(tmp));
log->logfile, log->numhist - 1);
snprintf(file1, sizeof(file1), "%s.%d", log->logfile, i);
snprintf(file1, sizeof(file1), "%s.%d%s", log->logfile,
snprintf(file2, sizeof(file2), "%s.%d%s", log->logfile,
PRINFO(("rm -f %s\n", log->logfile));
if (unlink(log->logfile))
err(EXIT_FAILURE, "%s", log->logfile);
(void)snprintf(file1, sizeof(file1), "%s.0", log->logfile);
PRINFO(("mv %s %s\n", log->logfile, file1));
if (rename(log->logfile, file1))
err(EXIT_FAILURE, "%s", log->logfile);
PRINFO(("chmod %o %s\n", log->mode, log->logfile));
if (chmod(log->logfile, log->mode))
err(EXIT_FAILURE, "%s", log->logfile);
snprintf(file1, sizeof(file1), "%s.0", log->logfile);
PRINFO(("(read line format of %s)\n", log->logfile));
if ((fd = fopen(log->logfile, "r")) == NULL)
PRINFO(("(append rotation notice to %s)\n", log->logfile));
if ((fd = fopen(log->logfile, "at")) == NULL)
err(EXIT_FAILURE, "%s", log->logfile);
if ((fd = creat(log->logfile, log->mode)) < 0)
err(EXIT_FAILURE, "%s", log->logfile);
err(EXIT_FAILURE, "%s", log->logfile);
const char *logfile =
logfile = optarg;
len = strlen(logfile);
if (len > 0 && logfile[len - 1] == 'x')
dolastlogx(logfile, argc, argv);
dolastlog(logfile, argc, argv);
dolastlog(const char *logfile, int argc, char **argv)
FILE *fp = fopen(logfile, "r");
err(1, "%s", logfile);
dolastlogx(const char *logfile, int argc, char **argv)
DB *db = dbopen(logfile, O_RDONLY|O_SHLOCK, 0, DB_HASH, NULL);
err(1, "%s", logfile);
err(1, "%s", logfile);
err(1, "%s", logfile);