diff options
author | powwow@askgustav.com <powwow@askgustav.com> | 2019-03-18 23:05:26 (GMT) |
---|---|---|
committer | Steve Slaven <bpk@hoopajoo.net> | 2019-04-23 20:37:05 (GMT) |
commit | 304a722c426f47a461dc88c4493f800c0690b29b (patch) | |
tree | 151b974354c0c7ec4e89649a949db32f11b56442 /log.c | |
parent | 7db984561ef8fd0ff9165288324dbc81516113f0 (diff) | |
download | powwow-304a722c426f47a461dc88c4493f800c0690b29b.zip powwow-304a722c426f47a461dc88c4493f800c0690b29b.tar.gz powwow-304a722c426f47a461dc88c4493f800c0690b29b.tar.bz2 |
remove some non-ANSI C support
Diffstat (limited to 'log.c')
-rw-r--r-- | log.c | 68 |
1 files changed, 34 insertions, 34 deletions
@@ -1,7 +1,7 @@ /* * log.c -- code for #movie / #capture backbuffering * and code for reprint-on-prompt - * + * * Copyright (C) 1998 by Massimiliano Ghilardi * * This program is free software; you can redistribute it and/or modify @@ -57,7 +57,7 @@ static char *names[] = { NULL, "line", "prompt", "sleep" }; /* * flush a single buffer line */ -static void log_flushline __P1 (int,i) +static void log_flushline(int i) { if (capturefile) fprintf(capturefile, "%s%s", @@ -74,14 +74,14 @@ static void log_flushline __P1 (int,i) /* * remove the oldest (first) line from the buffer */ -static void log_clearline __P0 (void) +static void log_clearline(void) { int next; - + if (logstart == logend) return; log_flushline(logstart); - + next = (logstart + 1) % logsize; if (next == logend) datastart = dataend = logstart = logend = 0; @@ -92,7 +92,7 @@ static void log_clearline __P0 (void) /* * remove an initial SLEEP from the buffer */ -void log_clearsleep __P0 (void) +void log_clearsleep(void) { if (logstart != logend) loglist[logstart].msecs = 0; @@ -101,7 +101,7 @@ void log_clearsleep __P0 (void) /* * flush the buffer */ -void log_flush __P0 (void) +void log_flush(void) { int i = logstart; while (i != logend) { @@ -112,12 +112,12 @@ void log_flush __P0 (void) datastart = dataend = logstart = logend = 0; } -int log_getsize __P0 (void) +int log_getsize(void) { return datasize; } -static void log_reset __P0 (void) +static void log_reset(void) { if (datasize) { if (datalist) free(datalist); @@ -129,7 +129,7 @@ static void log_reset __P0 (void) } -void log_resize __P1 (int,newsize) +void log_resize(int newsize) { if (newsize && newsize < 1000) { PRINTF("#buffer size must be 0 (zero) or >= 1000\n"); @@ -138,16 +138,16 @@ void log_resize __P1 (int,newsize) if (newsize == datasize) return; - + log_flush(); log_reset(); if (newsize) { datalist = (char *)malloc(newsize); if (!datalist) { log_reset(); errmsg("malloc"); return; } - + loglist = (logentry *)malloc(newsize/16*sizeof(logentry)); if (!loglist) { log_reset(); errmsg("malloc"); return; } - + datasize = newsize; logsize = newsize / 16; } @@ -159,10 +159,10 @@ void log_resize __P1 (int,newsize) /* * add a single line to the buffer */ -static void log_writeline __P4 (char *,line, int,len, int,kind, long,msecs) +static void log_writeline(char *line, int len, int kind, long msecs) { int dst; - + if (++len >= datasize) { PRINTF("#line too long, discarded from movie/capture buffer\n"); return; @@ -170,13 +170,13 @@ static void log_writeline __P4 (char *,line, int,len, int,kind, long,msecs) while (LOGFULL || DATALEFT < len) log_clearline(); /* ok, now we know there IS enough space */ - + if (datastart >= dataend /* is == iff loglist is empty */ || datasize - dataend > len) dst = dataend; else dst = 0; - + memcpy(loglist[logend].line = datalist + dst, line, len - 1); datalist[dst + len - 1] = '\0'; @@ -185,23 +185,23 @@ static void log_writeline __P4 (char *,line, int,len, int,kind, long,msecs) if ((dataend = dst + len) == datasize) dataend = 0; - + if (++logend == logsize) logend = 0; } - + /* * write to #capture / #movie buffer */ -void log_write __P3 (char *,str, int,len, int,newline) +void log_write(char *str, int len, int newline) { char *next; long diff; int i, last = 0; - + if (!datasize && !moviefile && !capturefile) return; - + update_now(); diff = diff_vtime(&now, &movie_last); movie_last = now; @@ -222,7 +222,7 @@ void log_write __P3 (char *,str, int,len, int,newline) if (diff) fprintf(moviefile, "%s %ld\n", names[SLEEP], diff); - fprintf(moviefile, "%s %.*s\n", + fprintf(moviefile, "%s %.*s\n", names[last && !newline ? PROMPT : LINE], i, str); } if (capturefile) { @@ -260,13 +260,13 @@ static int repsize = BUFSIZE/8; /* size of circular (pointer to string) list */ /* * remove the oldest (first) line from reprintlist */ -static void reprint_clearline __P0 (void) +static void reprint_clearline(void) { int next; - + if (repstart == repend) return; - + next = (repstart + 1) % repsize; if (next == repend) reprintstart = reprintend = repstart = repend = 0; @@ -274,7 +274,7 @@ static void reprint_clearline __P0 (void) reprintstart = replist[next] - reprintlist, repstart = next; } -void reprint_clear __P0 (void) +void reprint_clear(void) { reprintstart = reprintend = repstart = repend = 0; } @@ -282,18 +282,18 @@ void reprint_clear __P0 (void) /* * add a single line to the buffer */ -void reprint_writeline __P1 (char *,line) +void reprint_writeline(char *line) { int len = strlen(line) + 1; int dst; - + if (!opt_reprint || (promptlen && prompt_status != -1)) /* * if prompt is valid, we'll never have to reprint, as we * _already_ printed the command at the right moment */ return; - + if (len >= reprintsize) { PRINTF("#line too long, discarded from prompt reprint buffer\n"); return; @@ -301,24 +301,24 @@ void reprint_writeline __P1 (char *,line) while (REPFULL || REPRINTLEFT < len) reprint_clearline(); /* ok, now we know there IS enough space */ - + if (reprintstart >= reprintend /* is == iff replist is empty */ || reprintsize - reprintend > len) dst = reprintend; else dst = 0; - + memcpy(replist[repend] = reprintlist + dst, line, len - 1); reprintlist[dst + len - 1] = '\0'; if ((reprintend = dst + len) == reprintsize) reprintend = 0; - + if (++repend == repsize) repend = 0; } -char *reprint_getline __P0 (void) +char *reprint_getline(void) { char *line = NULL; if (opt_reprint && repend != repstart) |