diff options
author | Hartmut Holzgraefe <hholzgra@php.net> | 2000-06-16 18:24:02 +0000 |
---|---|---|
committer | Hartmut Holzgraefe <hholzgra@php.net> | 2000-06-16 18:24:02 +0000 |
commit | 87a491d7b64f34a9692af3edc58151e9baa2e275 (patch) | |
tree | 023b2ac85e2f4ae8951fefe14ccc9c835cfe465a /win32 | |
parent | c6ddfd4440ad412059e49dc69f9c7e98de57d65c (diff) | |
download | php-git-87a491d7b64f34a9692af3edc58151e9baa2e275.tar.gz |
C++ // comments are evil ...
Diffstat (limited to 'win32')
-rw-r--r-- | win32/sendmail.c | 103 | ||||
-rw-r--r-- | win32/sendmail.h | 8 | ||||
-rw-r--r-- | win32/syslog.h | 4 | ||||
-rw-r--r-- | win32/winutil.c | 2 |
4 files changed, 60 insertions, 57 deletions
diff --git a/win32/sendmail.c b/win32/sendmail.c index 659bc134a4..af337dab33 100644 --- a/win32/sendmail.c +++ b/win32/sendmail.c @@ -48,13 +48,13 @@ static char *months[] = #ifndef THREAD_SAFE char Buffer[MAIL_BUFFER_SIZE]; -// socket related data +/* socket related data */ SOCKET sc; WSADATA Data; struct hostent *adr; SOCKADDR_IN sock_in; int WinsockStarted; -// values set by the constructor +/* values set by the constructor */ char *AppName; char MailHost[HOST_NAME_LEN]; char LocalHost[HOST_NAME_LEN]; @@ -64,7 +64,7 @@ char *php_mailer = "PHP 3.0 WIN32"; char *get_header(char *h, char *headers); -// Error messages +/* Error messages */ static char *ErrorMessages[] = { {"Success"}, @@ -91,7 +91,7 @@ static char *ErrorMessages[] = -//******************************************************************** +/********************************************************************* // Name: TSendMail // Input: 1) host: Name of the mail host where the SMTP server resides // max accepted length of name = 256 @@ -103,7 +103,7 @@ static char *ErrorMessages[] = // SUCCESS otherwise. // // See SendText() for additional args! -//******************************************************************** +//********************************************************************/ int TSendMail(char *host, int *error, char *headers, char *Subject, char *mailTo, char *data) { @@ -128,7 +128,7 @@ int TSendMail(char *host, int *error, return 19; } - // attempt to connect with mail host + /* attempt to connect with mail host */ *error = MailConnect(); if (*error != 0) { if(RPath)efree(RPath); @@ -144,32 +144,33 @@ int TSendMail(char *host, int *error, } } -//******************************************************************** +/'******************************************************************** // Name: TSendMail::~TSendMail // Input: // Output: // Description: DESTRUCTOR // Author/Date: jcar 20/9/96 // History: -//******************************************************************** +//********************************************************************/ void TSMClose() { Post("QUIT\n"); Ack(); - // to guarantee that the cleanup is not made twice and - // compomise the rest of the application if sockets are used - // elesewhere + /* to guarantee that the cleanup is not made twice and + compomise the rest of the application if sockets are used + elesewhere + */ } -//******************************************************************** +/********************************************************************* // Name: char *GetSMErrorText // Input: Error index returned by the menber functions // Output: pointer to a string containing the error description // Description: // Author/Date: jcar 20/9/96 // History: -//******************************************************************** +//*******************************************************************/ char *GetSMErrorText(int index) { @@ -180,7 +181,7 @@ char *GetSMErrorText(int index) } -//******************************************************************** +/********************************************************************* // Name: TSendText // Input: 1) RPath: return path of the message // Is used to fill the "Return-Path" and the @@ -193,14 +194,14 @@ char *GetSMErrorText(int index) // Description: // Author/Date: jcar 20/9/96 // History: -//******************************************************************** +//*******************************************************************/ int SendText(char *RPath, char *Subject, char *mailTo, char *data, char *headers) { int res, i; char *p; - // check for NULL parameters + /* check for NULL parameters */ if (data == NULL) return (BAD_MSG_CONTENTS); if (mailTo == NULL) @@ -208,15 +209,15 @@ int SendText(char *RPath, char *Subject, char *mailTo, char *data, char *headers if (RPath == NULL) return (BAD_MSG_RPATH); - // simple checks for the mailto address - // have ampersand ? + /* simple checks for the mailto address */ + /* have ampersand ? */ if (strchr(mailTo, '@') == NULL) return (BAD_MSG_DESTINATION); sprintf(Buffer, "HELO %s\n", LocalHost); - // in the beggining of the dialog - // attempt reconnect if the first Post fail + /* in the beggining of the dialog */ + /* attempt reconnect if the first Post fail */ if ((res = Post(Buffer)) != SUCCESS) { MailConnect(); if ((res = Post(Buffer)) != SUCCESS) @@ -244,7 +245,7 @@ int SendText(char *RPath, char *Subject, char *mailTo, char *data, char *headers return (res); - // send message header + /* send message header */ if (Subject == NULL) res = PostHeader(RPath, "No Subject", mailTo, headers); else @@ -253,7 +254,7 @@ int SendText(char *RPath, char *Subject, char *mailTo, char *data, char *headers return (res); - // send message contents in 1024 chunks + /* send message contents in 1024 chunks */ if (strlen(data) <= 1024) { if ((res = Post(data)) != SUCCESS) return (res); @@ -267,18 +268,18 @@ int SendText(char *RPath, char *Subject, char *mailTo, char *data, char *headers else i = strlen(p); - // put next chunk in buffer + /* put next chunk in buffer */ strncpy(Buffer, p, i); Buffer[i] = '\0'; p += i; - // send chunk + /* send chunk */ if ((res = Post(Buffer)) != SUCCESS) return (res); } } - //send termination dot + /*send termination dot */ if ((res = Post("\r\n.\r\n")) != SUCCESS) return (res); if ((res = Ack()) != SUCCESS) @@ -289,7 +290,7 @@ int SendText(char *RPath, char *Subject, char *mailTo, char *data, char *headers -//******************************************************************** +/********************************************************************* // Name: PostHeader // Input: 1) return path // 2) Subject @@ -299,12 +300,12 @@ int SendText(char *RPath, char *Subject, char *mailTo, char *data, char *headers // Description: // Author/Date: jcar 20/9/96 // History: -//******************************************************************** +//********************************************************************/ int PostHeader(char *RPath, char *Subject, char *mailTo, char *xheaders) { - // Print message header according to RFC 822 - // Return-path, Received, Date, From, Subject, Sender, To, cc + /* Print message header according to RFC 822 */ + /* Return-path, Received, Date, From, Subject, Sender, To, cc */ time_t tNow = time(NULL); struct tm *tm = localtime(&tNow); @@ -350,34 +351,36 @@ int PostHeader(char *RPath, char *Subject, char *mailTo, char *xheaders) -//******************************************************************** +/********************************************************************* // Name: MailConnect // Input: None // Output: None // Description: Connect to the mail host and receive the welcome message. // Author/Date: jcar 20/9/96 // History: -//******************************************************************** +//********************************************************************/ int MailConnect() { int res; - // Create Socket + /* Create Socket */ if ((sc = socket(PF_INET, SOCK_STREAM, 0)) == INVALID_SOCKET) return (FAILED_TO_OBTAIN_SOCKET_HANDLE); - // Get our own host name + /* Get our own host name */ if (gethostname(LocalHost, HOST_NAME_LEN)) return (FAILED_TO_GET_HOSTNAME); - // Resolve the servers IP - //if (!isdigit(MailHost[0])||!gethostbyname(MailHost)) - //{ - // return (FAILED_TO_RESOLVE_HOST); - //} + /* Resolve the servers IP */ + /* + if (!isdigit(MailHost[0])||!gethostbyname(MailHost)) + { + return (FAILED_TO_RESOLVE_HOST); + } + */ - // Connect to server + /* Connect to server */ sock_in.sin_family = AF_INET; sock_in.sin_port = htons(25); sock_in.sin_addr.S_un.S_addr = GetAddr(MailHost); @@ -385,7 +388,7 @@ int MailConnect() if (connect(sc, (LPSOCKADDR) & sock_in, sizeof(sock_in))) return (FAILED_TO_CONNECT); - // receive Server welcome message + /* receive Server welcome message */ res = Ack(); return (res); } @@ -395,14 +398,14 @@ int MailConnect() -//******************************************************************** +/********************************************************************* // Name: Post // Input: // Output: // Description: // Author/Date: jcar 20/9/96 // History: -//******************************************************************** +//********************************************************************/ int Post(LPCSTR msg) { int len = strlen(msg); @@ -420,7 +423,7 @@ int Post(LPCSTR msg) -//******************************************************************** +/********************************************************************* // Name: Ack // Input: // Output: @@ -429,7 +432,7 @@ int Post(LPCSTR msg) // last command was successful. // Author/Date: jcar 20/9/96 // History: -//******************************************************************** +//********************************************************************/ int Ack() { static char *buf; @@ -448,13 +451,13 @@ int Ack() Received += rlen; buf[Received] = 0; - //err_msg fprintf(stderr,"Received: (%d bytes) %s", rlen, buf + Index); + /*err_msg fprintf(stderr,"Received: (%d bytes) %s", rlen, buf + Index); */ - // Check for newline + /* Check for newline */ Index += rlen; if ((buf[Received - 2] != '\r') || (buf[Received - 1] != '\n')) - // err_msg fprintf(stderr,"Incomplete server message. Awaiting CRLF\n"); - goto again; // Incomplete data. Line must be terminated by CRLF + /* err_msg fprintf(stderr,"Incomplete server message. Awaiting CRLF\n"); */ + goto again; /* Incomplete data. Line must be terminated by CRLF */ if (buf[0] > '3') return (SMTP_SERVER_ERROR); @@ -463,7 +466,7 @@ int Ack() } -//******************************************************************** +/********************************************************************* // Name: unsigned long GetAddr (LPSTR szHost) // Input: // Output: @@ -474,7 +477,7 @@ int Ack() // WARNING: gethostbyname() is a blocking function // Author/Date: jcar 20/9/96 // History: -//******************************************************************** +//********************************************************************/ unsigned long GetAddr(LPSTR szHost) { LPHOSTENT lpstHost; diff --git a/win32/sendmail.h b/win32/sendmail.h index 3c426fb219..38ac29e5eb 100644 --- a/win32/sendmail.h +++ b/win32/sendmail.h @@ -1,4 +1,4 @@ -#if !defined(sendmail_h) // Sentry, use file only if it's not already included. +#if !defined(sendmail_h) /* Sentry, use file only if it's not already included. */ #define sendmail_h #include <windows.h> @@ -6,8 +6,8 @@ #define MAX_APPNAME_LENGHT 100 #define MAX_ERROR_INDEX 17 #define MIN_ERROR_INDEX 0 -#define MAIL_BUFFER_SIZE (1024*4) // 4k buffer -// Return values +#define MAIL_BUFFER_SIZE (1024*4) /* 4k buffer */ +/* Return values */ #define SUCCESS 0 #define FAILED_TO_PARSE_ARGUMENTS 1 #define FAILED_TO_OPEN_MAILFILE 2 @@ -43,4 +43,4 @@ unsigned long GetAddr(LPSTR szHost); -#endif // sendmail_h +#endif /* sendmail_h */ diff --git a/win32/syslog.h b/win32/syslog.h index 53fd3e6703..420e44b913 100644 --- a/win32/syslog.h +++ b/win32/syslog.h @@ -65,8 +65,8 @@ extern void closelog(void); extern void openlog(const char *, int, int); -// setlogmask not implemented -//extern int setlogmask (int); +/* setlogmask not implemented */ +/* extern int setlogmask (int); */ extern void syslog(int, const char *, ...); diff --git a/win32/winutil.c b/win32/winutil.c index b7035994e7..8c3cde86e1 100644 --- a/win32/winutil.c +++ b/win32/winutil.c @@ -12,7 +12,7 @@ char *php_win_err(void) FORMAT_MESSAGE_FROM_SYSTEM, NULL, GetLastError(), - MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language + MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), /* Default language */ (LPTSTR) Win_Error_msg, 256, NULL); |