wmgeneral, wmsun: Use threadsafe functions.

This commit is contained in:
Doug Torrance 2015-06-14 17:04:48 -05:00 committed by Carlos R. Mafra
parent d8688d16d9
commit e46ebfcb20
14 changed files with 32 additions and 28 deletions

View file

@ -124,13 +124,13 @@ void parse_rcfile(const char *filename, rckeys *keys) {
char temp[128];
while (fgets(temp, 128, fp)) {
char *q;
char *q, *saveptr;
char *tokens = " :\t\n";
int key;
key = 0;
q = strdup(temp);
q = strtok(q, tokens);
q = strtok_r(q, tokens, &saveptr);
if(!q)
continue;
while (key >= 0 && keys[key].label) {

View file

@ -124,13 +124,13 @@ void parse_rcfile(const char *filename, rckeys *keys) {
char temp[128];
while (fgets(temp, 128, fp)) {
char *q;
char *q, *saveptr;
char *tokens = " :\t\n";
int key;
key = 0;
q = strdup(temp);
q = strtok(q, tokens);
q = strtok_r(q, tokens, &saveptr);
if(!q)
continue;
while (key >= 0 && keys[key].label) {

View file

@ -124,13 +124,13 @@ void parse_rcfile(const char *filename, rckeys *keys) {
char temp[128];
while (fgets(temp, 128, fp)) {
char *q;
char *q, *saveptr;
char *tokens = " :\t\n";
int key;
key = 0;
q = strdup(temp);
q = strtok(q, tokens);
q = strtok_r(q, tokens, &saveptr);
if(!q)
continue;
while (key >= 0 && keys[key].label) {

View file

@ -124,13 +124,13 @@ void parse_rcfile(const char *filename, rckeys *keys) {
char temp[128];
while (fgets(temp, 128, fp)) {
char *q;
char *q, *saveptr;
char *tokens = " :\t\n";
int key;
key = 0;
q = strdup(temp);
q = strtok(q, tokens);
q = strtok_r(q, tokens, &saveptr);
if(!q)
continue;
while (key >= 0 && keys[key].label) {

View file

@ -124,13 +124,13 @@ void parse_rcfile(const char *filename, rckeys *keys) {
char temp[128];
while (fgets(temp, 128, fp)) {
char *q;
char *q, *saveptr;
char *tokens = " :\t\n";
int key;
key = 0;
q = strdup(temp);
q = strtok(q, tokens);
q = strtok_r(q, tokens, &saveptr);
if(!q)
continue;
while (key >= 0 && keys[key].label) {

View file

@ -124,13 +124,13 @@ void parse_rcfile(const char *filename, rckeys *keys) {
char temp[128];
while (fgets(temp, 128, fp)) {
char *q;
char *q, *saveptr;
char *tokens = " :\t\n";
int key;
key = 0;
q = strdup(temp);
q = strtok(q, tokens);
q = strtok_r(q, tokens, &saveptr);
if(!q)
continue;
while (key >= 0 && keys[key].label) {

View file

@ -124,13 +124,13 @@ void parse_rcfile(const char *filename, rckeys *keys) {
char temp[128];
while (fgets(temp, 128, fp)) {
char *q;
char *q, *saveptr;
char *tokens = " :\t\n";
int key;
key = 0;
q = strdup(temp);
q = strtok(q, tokens);
q = strtok_r(q, tokens, &saveptr);
if(!q)
continue;
while (key >= 0 && keys[key].label) {

View file

@ -124,13 +124,13 @@ void parse_rcfile(const char *filename, rckeys *keys) {
char temp[128];
while (fgets(temp, 128, fp)) {
char *q;
char *q, *saveptr;
char *tokens = " :\t\n";
int key;
key = 0;
q = strdup(temp);
q = strtok(q, tokens);
q = strtok_r(q, tokens, &saveptr);
if(!q)
continue;
while (key >= 0 && keys[key].label) {

View file

@ -124,13 +124,13 @@ void parse_rcfile(const char *filename, rckeys *keys) {
char temp[128];
while (fgets(temp, 128, fp)) {
char *q;
char *q, *saveptr;
char *tokens = " :\t\n";
int key;
key = 0;
q = strdup(temp);
q = strtok(q, tokens);
q = strtok_r(q, tokens, &saveptr);
if(!q)
continue;
while (key >= 0 && keys[key].label) {

View file

@ -124,13 +124,13 @@ void parse_rcfile(const char *filename, rckeys *keys) {
char temp[128];
while (fgets(temp, 128, fp)) {
char *q;
char *q, *saveptr;
char *tokens = " :\t\n";
int key;
key = 0;
q = strdup(temp);
q = strtok(q, tokens);
q = strtok_r(q, tokens, &saveptr);
if(!q)
continue;
while (key >= 0 && keys[key].label) {

View file

@ -69,6 +69,7 @@
/*
* Includes
*/
#define _POSIX_C_SOURCE 1
#include <stdio.h>
#include <math.h>
#include <unistd.h>
@ -177,12 +178,14 @@ int main(int argc, char *argv[]) {
*
*/
if (n>nMAX){
struct tm result;
n = 0;
nMAX = 1000;
CurrentGMTTime = time(CurrentTime); GMTTime = gmtime(&CurrentGMTTime);
CurrentGMTTime = time(CurrentTime);
GMTTime = gmtime_r(&CurrentGMTTime, &result);
DayOfMonth = GMTTime->tm_mday;
UT = GMTTime->tm_hour + GMTTime->tm_min/60.0 + GMTTime->tm_sec/3600.0;
@ -190,7 +193,8 @@ int main(int argc, char *argv[]) {
Month = GMTTime->tm_mon+1;
CurrentLocalTime = CurrentGMTTime; LocalTime = localtime(&CurrentLocalTime);
CurrentLocalTime = CurrentGMTTime;
LocalTime = localtime_r(&CurrentLocalTime, &result);
LocalDayOfMonth = LocalTime->tm_mday;
if ((OldLocalDayOfMonth != LocalDayOfMonth)||(Flag)){

View file

@ -124,13 +124,13 @@ void parse_rcfile(const char *filename, rckeys *keys) {
char temp[128];
while (fgets(temp, 128, fp)) {
char *q;
char *q, *saveptr;
char *tokens = " :\t\n";
int key;
key = 0;
q = strdup(temp);
q = strtok(q, tokens);
q = strtok_r(q, tokens, &saveptr);
if(!q)
continue;
while (key >= 0 && keys[key].label) {

View file

@ -124,13 +124,13 @@ void parse_rcfile(const char *filename, rckeys *keys) {
char temp[128];
while (fgets(temp, 128, fp)) {
char *q;
char *q, *saveptr;
char *tokens = " :\t\n";
int key;
key = 0;
q = strdup(temp);
q = strtok(q, tokens);
q = strtok_r(q, tokens, &saveptr);
if(!q)
continue;
while (key >= 0 && keys[key].label) {

View file

@ -124,13 +124,13 @@ void parse_rcfile(const char *filename, rckeys *keys) {
char temp[128];
while (fgets(temp, 128, fp)) {
char *q;
char *q, *saveptr;
char *tokens = " :\t\n";
int key;
key = 0;
q = strdup(temp);
q = strtok(q, tokens);
q = strtok_r(q, tokens, &saveptr);
if(!q)
continue;
while (key >= 0 && keys[key].label) {