main.C File Reference

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include <unistd.h>
#include <arpa/inet.h>
#include <fcntl.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <pwd.h>
#include "InfoStream.h"
#include "memusage.h"
#include "Lattice.h"
#include "ComputeMsmMsa.h"
#include "main.decl.h"
#include "main.h"
#include "main.def.h"

Go to the source code of this file.

Classes

class  main

Defines

#define TBSOFT_TRACK_MAXLEN   1024

Functions

int send_dgram (const char *host_addr, int port, const char *buf, int buflen)
int tbsoft_sendusage (const char *program, const char *versionnum, const char *platform, const char *numcpus, const char *miscinfo)

Variables

const char * namd_build_date
const char * namd_build_user
const char * namd_build_machine


Define Documentation

#define TBSOFT_TRACK_MAXLEN   1024

Copyright (c) 1995, 1996, 1997, 1998, 1999, 2000 by The Board of Trustees of the University of Illinois. All rights reserved.

Definition at line 22 of file main.C.

Referenced by tbsoft_sendusage().


Function Documentation

int send_dgram ( const char *  host_addr,
int  port,
const char *  buf,
int  buflen 
)

Definition at line 48 of file main.C.

Referenced by tbsoft_sendusage().

00048                                                                              {
00049   struct sockaddr_in addr;
00050   int sockfd;
00051 
00052 #ifndef NOHOSTNAME
00053   if ((sockfd = socket(AF_INET, SOCK_DGRAM, 0)) < 0) {
00054     return -1;
00055   } 
00056 
00057   memset(&addr, 0, sizeof(addr));
00058   addr.sin_family = AF_INET;
00059   addr.sin_port = htons(port);
00060   addr.sin_addr.s_addr = inet_addr(host_addr);
00061 
00062   sendto(sockfd, buf, buflen, 0, (struct sockaddr *)&addr, sizeof(addr));
00063 
00064   close(sockfd);
00065 #endif
00066 
00067   return 0;
00068 }                     

int tbsoft_sendusage ( const char *  program,
const char *  versionnum,
const char *  platform,
const char *  numcpus,
const char *  miscinfo 
)

Definition at line 71 of file main.C.

References endi(), iINFO(), iout, send_dgram(), and TBSOFT_TRACK_MAXLEN.

Referenced by main::main().

00075                                            {
00076 
00077 #ifndef NOHOSTNAME
00078 #ifdef TBSOFT_TRACK_HOST
00079   iout << iINFO
00080     << "Sending usage information to " << TBSOFT_TRACK_HOST
00081     << ":" << TBSOFT_TRACK_PORT << " via UDP.  Sent data is:\n";
00082 #endif
00083 
00084   char sendbuf[TBSOFT_TRACK_MAXLEN];
00085   char host[128];
00086   struct passwd *pw;
00087   char user[128];
00088 
00089   memset(sendbuf, 0, sizeof(sendbuf));
00090 
00091   gethostname(host, 128);  host[127] = 0;
00092   pw = getpwuid(getuid());
00093   if ( pw && pw->pw_name ) {
00094     strncpy(user, pw->pw_name, 127);  user[127] = 0;
00095   } else {
00096     sprintf(user,"%d",getuid());
00097   }
00098 
00099   sprintf(sendbuf, "1 %s  %s  %s  %s  %s  %s  %s", 
00100     program, versionnum, platform, numcpus, miscinfo, host, user);
00101   iout << iINFO << sendbuf << "\n" << endi;
00102 #ifdef TBSOFT_TRACK_HOST
00103   send_dgram(TBSOFT_TRACK_HOST, TBSOFT_TRACK_PORT, sendbuf, strlen(sendbuf));
00104 #endif
00105 
00106 #endif
00107   return 0;
00108 }


Variable Documentation

const char* namd_build_date

Referenced by main::main().

const char* namd_build_machine

Referenced by main::main().

const char* namd_build_user

Referenced by main::main().


Generated on Sat Nov 18 01:17:17 2017 for NAMD by  doxygen 1.4.7