mirror of https://github.com/lindes/ttyload.git
Don't need ascftime, we've already converted to using strftime, as it
should have been in the first place, I suspect... so getting rid of old cruft related to that.
This commit is contained in:
parent
cfe7ba5339
commit
1571acae74
2
Makefile
2
Makefile
|
@ -11,7 +11,7 @@ LDFLAGS = `./ldflags`
|
|||
|
||||
OBJS = arch/${ARCH}/getload.o \
|
||||
arch/${ARCH}/terminfo.o \
|
||||
arch/default/homebrews.o
|
||||
${NULL}
|
||||
|
||||
# this is what I use most places...
|
||||
CC=gcc -pedantic -Wall
|
||||
|
|
|
@ -1,4 +0,0 @@
|
|||
/* This file contains platform settings for Linux */
|
||||
|
||||
/* at least my Linux box doesn't have ascftime, so we've got to fall back to asctime() */
|
||||
#undef HAVE_ASCFTIME
|
|
@ -1,53 +0,0 @@
|
|||
/* some function replacements for platforms that don't have the
|
||||
* real things... *sigh* */
|
||||
|
||||
#include <string.h>
|
||||
#include <time.h>
|
||||
#include <stdio.h>
|
||||
|
||||
|
||||
/**********************/
|
||||
/***** ascftime() *****/
|
||||
/**********************/
|
||||
|
||||
#ifndef HAVE_ASCFTIME
|
||||
|
||||
/* our own version of ascftime, since Linux (and others?)
|
||||
* doesn't (don't) seem to have it. For now, this is done in a
|
||||
* very klugey way, and it will certainly need to be re-written
|
||||
* (to be useful, anyway) if and when there ever become new
|
||||
* format strings used by our caller(s). */
|
||||
|
||||
int ascftime(char *s, const char *format, const struct tm *timeptr)
|
||||
{
|
||||
int ret;
|
||||
|
||||
/* if we don't have arguments, bail now. */
|
||||
if(!s || !format || !timeptr)
|
||||
{
|
||||
return(0);
|
||||
}
|
||||
|
||||
*s = '\0';
|
||||
|
||||
if(strncmp(format, "^%H:%M", 6) == 0)
|
||||
{
|
||||
ret = sprintf(s, "^%02d:%02d",
|
||||
timeptr->tm_hour, timeptr->tm_min);
|
||||
}
|
||||
else if(strncmp(format, "%T", 2) == 0)
|
||||
{
|
||||
ret = sprintf(s, "^%02d:%02d:%02d",
|
||||
timeptr->tm_hour, timeptr->tm_min, timeptr->tm_sec);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* indicate failure, since we don't have generic
|
||||
* compliance for any old format: */
|
||||
ret = 0;
|
||||
}
|
||||
|
||||
return(ret);
|
||||
}
|
||||
|
||||
#endif /* HAVE_ASCFTIME */
|
|
@ -1,4 +0,0 @@
|
|||
/* This file contains default platform settings */
|
||||
|
||||
/* do we have ascftime()? */
|
||||
#define HAVE_ASCFTIME
|
Loading…
Reference in New Issue