Changeset 8022


Ignore:
Timestamp:
06/19/19 01:48:16 (6 months ago)
Author:
stefan
Message:

fix problems with many modules and TCP/IP

Location:
trunk/src/libsrc/util
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/libsrc/util/rw_strongmotionII.c

    r8019 r8022  
     1/* 
     2 *   THIS FILE IS UNDER RCS - DO NOT MODIFY UNLESS YOU HAVE 
     3 *   CHECKED IT OUT USING THE COMMAND CHECKOUT. 
     4 * 
     5 *    $Id$ 
     6 * 
     7 *    Revision history: 
     8 *     $Log$ 
     9 *     Revision 1.5  2004/02/13 22:55:22  dietz 
     10 *     Now both "?" and "-" are interpreted as NULL values for 
     11 *     qid and qauthor on the QID: line when reading TYPE_STRONGMOTIONII msgs 
     12 * 
     13 *     Revision 1.4  2003/06/09 19:53:50  lombard 
     14 *     Rewrote rd_strongmotionII to be more fault-tolerant and to allow reading of 
     15 *     multiple channels from a single message. 
     16 * 
     17 *     Revision 1.3  2001/06/19 17:26:02  dietz 
     18 *     Fixed wr_strongmotionII to print SM_NULL values properly (it had been 
     19 *     taking the absolute value of them by mistake) 
     20 * 
     21 *     Revision 1.2  2001/04/18 17:56:27  dietz 
     22 *     wr_strongmotionII: made sure pga,pgv,pgd are written as absolute values 
     23 * 
     24 *     Revision 1.1  2001/04/17 17:25:46  davidk 
     25 *     Initial revision 
     26 * 
     27 * 
     28 * 
     29 */ 
     30 
    131/* rw_strongmotionII.c 
    232 * 
     
    1040#include <string.h> 
    1141#include <time.h> 
    12  
    13 #include "earthworm.h" 
    14 #include "chron3.h" 
    15 #include "time_ew.h" 
    16 #include "rw_strongmotionII.h" 
     42#include <chron3.h> 
     43#include <time_ew.h> 
     44#include <rw_strongmotionII.h> 
     45#include <earthworm.h> 
    1746 
    1847#define ABS(X) (((X) >= 0) ? (X) : -(X)) 
    1948 
    2049static int   strappend( char *s1, int s1max, char *s2 ); 
     50static int   tokenlength( char *begtok, char c ); 
    2151static char *datestr24( double t, char *pbuf, int len ); 
    2252static int   addtimestr( char *buf, int buflen, double t ); 
    23  
    24 #if 0 
    25 static int   tokenlength( char *begtok, char c ); 
    26 #endif 
    2753 
    2854static char *sNullDate = "0000/00/00 00:00:00.000"; 
     
    4066#define SM_RSA  1<<6 
    4167#define SM_QID  1<<7 
    42 #define SM_AI   1<<8 
    43 #define SM_ALL (SM_SCNL | SM_TIME | SM_ALT | SM_PGA | SM_PGV | SM_PGD | SM_RSA | SM_QID | SM_AI) 
     68#define SM_ALL (SM_SCNL | SM_TIME | SM_ALT | SM_PGA | SM_PGV | SM_PGD | SM_RSA | SM_QID) 
    4469#define SM_REQ (SM_SCNL | SM_TIME) 
    4570 
     
    5883    return; 
    5984} 
     85 
     86 
    6087 
    6188/******************************************************************** 
     
    76103   char     line[SMLINE]; /* pointer to current line in msg */ 
    77104   char     *nextline;  /* working pointer into msg */ 
     105   int       nfreq; 
    78106   int       i; 
    79107   struct tm stm;       /* time structure for timestamp */ 
     
    84112 
    85113   nextline = *msgP; 
     114   nfreq = 0; 
    86115   smState = 0; 
    87116   status = 0; 
     
    626655           } 
    627656           /* End of QID line processing */ 
    628        } 
    629        else if (strcmp(token, "AI:") == 0) { 
    630            if (HAVE(SM_SCNL) ) { 
    631                token = strtok(NULL, " \n"); 
    632                if (token == NULL) { 
    633                    if (logErr)  
    634                        logit("t", "error parsing SM AI line <%s>\n", line); 
    635                    status = -1; 
    636                    goto NextLine; 
    637                } 
    638                if( sscanf( token, "%lf", &sm->ai) != 1) { 
    639                    if (logErr)  
    640                        logit("t", "error parsing AI from <%s>\n", line); 
    641                    status = -1; 
    642                    goto NextLine; 
    643                } 
    644                smState |= SM_AI; 
    645            } else { 
    646                /* still looking for SCNL line to start message */ 
    647                goto NextLine; 
    648            } 
    649            /* End of AI line processing */ 
    650657       } else { 
    651658           /* unknown line; skip it for now */ 
     
    727734   if( strappend( buf, buflen, tmp ) ) return( -1 ); 
    728735 
    729 /* Print the AI (Arias Intensity) */ 
    730    if( sm->ai != 0. ) 
    731    { 
    732      sprintf( tmp, "AI: %.6lf\n", sm->ai ); 
    733      if( strappend( buf, buflen, tmp ) ) return( -1 ); 
    734    } 
    735  
    736736   return( 0 ); 
    737737} 
     
    785785/* Print eventid & author */ 
    786786   logit("","\nQID: %s %s\n", sm->qid, sm->qauthor); 
    787  
    788 /* Print the AI (Arias Intensity) */ 
    789    if( sm->ai != 0. ) 
    790    { 
    791      logit("","AI: %.6lf\n", sm->ai ); 
    792    } 
    793787 
    794788   return; 
     
    874868 * found, tokenlength returns the length of the string.             * 
    875869 ********************************************************************/ 
    876  
    877 #if 0 
    878  
    879870int tokenlength( char *begtok, char c ) 
    880871{ 
     
    886877} 
    887878 
    888 #endif 
    889879 
    890880/* Sample TYPE_STRONGMOTION2 message (between ------): 
  • trunk/src/libsrc/util/socket_ew_common.c

    r7843 r8022  
    110110   char dupAddress[64];                            //for testing/checking IPv6 addresses 
    111111 
     112   /* SWL 2019-06-19 Seems we need to initialize the Windows system before we can get  addrinfo       * 
     113    * Shouldn't hurt anything to do it here rather than in socket_ew below, and it fixes new failures * 
     114    * in heli_ewII, ewhtmlemail, q3302ew, etc. Hopefully things'll run OK on Linux.                   */ 
     115   if (!SOCKET_SYS_INIT) 
     116           SocketSysInit(); 
     117 
    112118   // Get address(es) 
    113119   struct addrinfo *servAddr; // Holder for returned list of server addrs 
Note: See TracChangeset for help on using the changeset viewer.