patches for Linux from Aldy Hernandez

This commit is contained in:
Sean C. Rhea
2006-11-30 17:10:48 +00:00
parent 8b367600e6
commit 3fafc7bbfa
5 changed files with 17 additions and 10 deletions

View File

@@ -19,9 +19,10 @@
#
CC=gcc
CFLAGS=-g -W -Wall -Werror -ansi -pedantic
CFLAGS=-g -W -Wall -Werror -ansi -pedantic -std=c99
CMDS=ptdl ptpk ptunpk cpint
LIBS=../lib/libgc.a
LIBRARIES=-lm
INCLUDES=-I../lib
all: $(CMDS)
@@ -34,16 +35,16 @@ clean:
$(CC) -c $(CFLAGS) $(INCLUDES) $<
cpint: cpint.o $(LIBS)
$(CXX) -o $@ $^
$(CXX) -o $@ $^ $(LIBRARIES)
ptdl: ptdl.o $(LIBS)
$(CC) -o $@ $^
$(CC) -o $@ $^ $(LIBRARIES)
ptunpk: ptunpk.o $(LIBS)
$(CC) -o $@ $^
$(CC) -o $@ $^ $(LIBRARIES)
ptpk: ptpk.o $(LIBS)
$(CC) -o $@ $^
$(CC) -o $@ $^ $(LIBRARIES)
ptdl.o: ../lib/pt.h
ptunpk.o: ../lib/pt.h

View File

@@ -25,7 +25,6 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include "pt.h"
void
@@ -116,9 +115,11 @@ pt_pack(FILE *in, FILE *out, int wheel_sz_mm, int rec_int)
hr = atoi(line + rider_pmatch[10].rm_so);
interval = atoi(line + rider_pmatch[11].rm_so);
if (mins - last_mins - 0.021 > 1.0 / 60.0) {
struct tm *tm_p;
inc_time = start_time + round((mins - 0.021000001) * 60.0);
if (!localtime_r(&inc_time, &inc_tm))
assert(0);
tm_p = localtime(&inc_time);
assert(tm_p);
inc_tm = *tm_p;
pt_pack_time(buf, &inc_tm);
pt_write_data(out, buf);
pt_pack_config(buf, interval, rec_int, wheel_sz_mm);

View File

@@ -19,7 +19,7 @@
#
CC=gcc
CFLAGS=-g -W -Wall -Werror -ansi -pedantic
CFLAGS=-g -W -Wall -Werror -ansi -pedantic -std=c99
LIBTOOL=libtool
all: libgc.a
@@ -31,3 +31,5 @@ clean:
libgc.a: pt.o cpint.o
$(LIBTOOL) -static -o $@ $^
pt.o: pt.h

View File

@@ -120,6 +120,7 @@ cpi_files_to_update(const char *dir)
assert(0);
dirp = opendir(dir);
assert(dirp);
while ((dp = readdir(dirp)) != NULL) {
int nmatch = 7;
regmatch_t *pmatch = (regmatch_t*) calloc(nmatch, sizeof(regmatch_t));
@@ -302,6 +303,7 @@ combine_cpi_files(const char *dir, double *bests[], int *bestlen)
*bests = calloc(*bestlen, sizeof(double));
inname = malloc(strlen(dir) + 25);
dirp = opendir(dir);
assert(dirp);
while ((dp = readdir(dirp)) != NULL) {
if (strcmp(".cpi", dp->d_name + dp->d_namlen - 4) == 0) {
sprintf(inname, "%s/%s", dir, dp->d_name);

View File

@@ -23,7 +23,8 @@
#include <stdio.h>
#include <unistd.h>
#include <time.h>
#include <sys/time.h>
#include <getopt.h>
#define PT_DEBUG_NONE 0
#define PT_DEBUG_MAX 1