File: maildircreate.c

package info (click to toggle)
maildrop 0.75-2.1
  • links: PTS
  • area: main
  • in suites: potato
  • size: 2,760 kB
  • ctags: 1,588
  • sloc: cpp: 9,269; ansic: 6,018; perl: 786; sh: 467; makefile: 398
file content (37 lines) | stat: -rw-r--r-- 1,506 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
/* DSTART                                                                    */
/*                                                                           */
/*           maildrop - mail delivery agent with filtering abilities         */
/*                                                                           */
/*  Copyright 1998-1999, Double Precision Inc.                               */
/*                                                                           */
/*  This program is distributed under the terms of the GNU General Public    */
/*  License. See COPYING for additional information.                         */
/* DEND                                                                      */
#include	"maildircreate.h"
#include	<sys/types.h>
#include	<string.h>
#include	<stdio.h>
#if	HAVE_UNISTD_H
#include	<unistd.h>
#endif

#if	HAS_GETHOSTNAME
#else
extern int gethostname(const char *, size_t);
#endif

static const char rcsid[]="$Id: maildircreate.c,v 1.1 1999/08/10 23:57:46 mrsam Exp $";

int maildir_try_create(const char *h,	/* Maildir */
	const char *u,	/* Unique when creating multiple msgs by one pid */
	unsigned long n,	/* If >0, we know the size of the message */
	char **tptr,	/* On exit, filename in tmp */
	char **nptr)	/* On exit, filename in new */
{
char	hostname[256];

        hostname[0]=0;
        hostname[sizeof(hostname)-1]=0;
        gethostname(hostname, sizeof(hostname)-1);
	return (maildir_try_create_hostname(h, u, n, hostname, tptr, nptr));
}