aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorB. Watson <yalhcru@gmail.com>2019-04-14 16:45:26 -0400
committerB. Watson <yalhcru@gmail.com>2019-04-14 16:45:26 -0400
commit0d5965212dc9956dd7f08fbeea1cd6603c575837 (patch)
tree7b06793d280262eb96bd31e03d7bf23e15e34d1b /src
parenta2324680cd3ca1b82ec6eda214edc56b57bf19b5 (diff)
downloadfujichat-0d5965212dc9956dd7f08fbeea1cd6603c575837.tar.gz
add git revision to binaries, change some defaults
Diffstat (limited to 'src')
-rw-r--r--src/Makefile8
-rw-r--r--src/clear_rts.c25
-rw-r--r--src/fujichat.atrbin92176 -> 92176 bytes
-rw-r--r--src/fujichat.c51
-rw-r--r--src/fujichat.h12
-rw-r--r--src/fujiconf.c2
-rw-r--r--src/fujimenu.c2
-rw-r--r--src/fujitest.atrbin92176 -> 92176 bytes
-rwxr-xr-xsrc/start_slip.sh3
9 files changed, 72 insertions, 31 deletions
diff --git a/src/Makefile b/src/Makefile
index 5efd335..0afccdf 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -2,10 +2,14 @@
# Copyright (c) 2019, B. Watson.
# All rights reserved. See doc/LICENSE.txt for legalese.
+# If we're working from a git tree, embed the revision and date
+# into the binary.
+GITREV=$(shell sh ./gitrev)
+
CC = cl65
AR = ar65
APPS = telnet resolv
-CFLAGS = -t atari -I../uip/uip -I. -O
+CFLAGS = -t atari -I../uip/uip -I. -O -DGITREV=\"$(GITREV)\"
# Default target: build all the binaries.
all: fujichat.xex fujiconf.xex aexec.xex fujimenu.xex makeauto.xex about.xex loadmkau.xex loadmenu.xex keybuf.o
@@ -69,4 +73,4 @@ keybuftest.xex: keybuftest.c keybuf.o
# native, not Atari!
clear_rts: clear_rts.c
- cc -o clear_rts clear_rts.c
+ gcc -O2 -Wall -o clear_rts clear_rts.c
diff --git a/src/clear_rts.c b/src/clear_rts.c
index 52da3f5..c50a9fc 100644
--- a/src/clear_rts.c
+++ b/src/clear_rts.c
@@ -1,9 +1,9 @@
/* Compile with:
- gcc -o toggle_rts toggle_rts.c
+ gcc -o clear_rts clear_rts.c
Change PORT if necessary.
*/
-#define PORT "/dev/ttyS0"
+#define PORT "/dev/ttyUSB0"
#include <sys/types.h>
#include <sys/stat.h>
@@ -16,8 +16,14 @@
#include <sys/ioctl.h>
#include <linux/serial.h>
-int main() {
+int main(int argc, char **argv) {
int fd, status;
+ char *port;
+
+ if(argc == 2)
+ port = argv[1];
+ else
+ port = PORT;
fd = open(PORT, O_RDWR);
if(fd < 0) {
@@ -25,18 +31,21 @@ int main() {
return 1;
}
- // fprintf(stderr, "ioctl(fd, TIOCMGET, &status);\n");
ioctl(fd, TIOCMGET, &status);
+
+ /* This always says it was on. Opening the port sets it? */
/*
+ fprintf(stderr, "%s: RTS was ", port);
if(status & TIOCM_RTS) {
- fprintf(stderr, "RTS set\n");
+ fputs("on", stderr);
} else {
- fprintf(stderr, "RTS clear\n");
+ fputs("already off", stderr);
}
+ fputc('\n', stderr);
*/
+
status &= ~TIOCM_RTS;
ioctl(fd, TIOCMSET, &status);
- // fprintf(stderr, "ioctl(fd, TIOCMSET, &status);\n");
- fprintf(stderr, "RTS forced off (Tucker SIO2PC)\n");
+ fprintf(stderr, "%s: RTS forced off (Tucker SIO2PC)\n", port);
return 0;
}
diff --git a/src/fujichat.atr b/src/fujichat.atr
index e5142cd..64a634d 100644
--- a/src/fujichat.atr
+++ b/src/fujichat.atr
Binary files differ
diff --git a/src/fujichat.c b/src/fujichat.c
index f4dfb17..b63d017 100644
--- a/src/fujichat.c
+++ b/src/fujichat.c
@@ -699,12 +699,12 @@ void do_server_msg() {
if( (numeric = atoi(cmd)) ) {
switch(numeric) {
case 332: // topic
- printf("> Topic: %s", arg);
+ printf("> Topic: %s\n", arg);
return;
break;
case 333: // topic nick
- printf("> Topic set by %s", arg);
+ printf("> Topic set by %s\n", arg);
return;
break;
@@ -724,6 +724,7 @@ void do_server_msg() {
printf("> Joining %s\n", channel);
send_server_cmd("JOIN", channel);
joined_channel = 1;
+ return;
}
break;
@@ -771,12 +772,23 @@ char incoming_ctcp(char *nick, char *msg) {
return 0;
}
+void maybe_eol(void) {
+ /* only print an EOL if we're not in column 0 already */
+ if(PEEK(0x55)) fuji_putchar(A_EOL);
+}
+
/* Handler for text received from the server, responsible for
formatting. TODO: part/join/quit aren't handled correctly. */
void do_msg() {
char *nick = output_buf, *cmd = output_buf, *chan = NULL, *msg = NULL;
char *bang = NULL;
+ /* remove EOL from buffer, so we can conditionally decide whether
+ or not to print it, based on the cursor column. If we're in
+ column 0 after printing the msg, we don't need an EOL (it just
+ causes a blank line) */
+ output_buf[output_buf_len--] = '\0';
+
while(*cmd != ' ') {
if(*cmd == '!') {
bang = cmd;
@@ -800,7 +812,7 @@ void do_msg() {
++chan;
msg = chan;
- if(*msg != A_EOL) {
+ if(*msg) {
while(*msg && *msg != ' ')
++msg;
if(*msg) {
@@ -823,18 +835,15 @@ void do_msg() {
if(memcmp(msg, "\x01" "ACTION ", 8) == 0) {
nick++;
*bang = '\0';
- output_buf[output_buf_len - 2] = A_EOL;
- output_buf[output_buf_len - 1] = '\0';
+ output_buf[output_buf_len-1] = '\0';
printf("* %s %s", nick, msg + 8);
+ maybe_eol();
#ifdef FEAT_NICK_COMPLETE
add_to_nick_list(nick);
#endif
} else {
- /* get rid of ending EOL */
- output_buf[output_buf_len - 1] = '\0';
printf("%s %s", nick, msg);
- /* only print an EOL if we're not in column 0 already */
- if(PEEK(0x55)) fuji_putchar(A_EOL);
+ maybe_eol();
#ifdef FEAT_NICK_COMPLETE
nick++;
bang[0] = '\0';
@@ -846,11 +855,12 @@ void do_msg() {
if(memcmp(msg, "\x01" "PING ", 6) == 0) {
nick++;
bang[0] = '\0';
- output_buf[output_buf_len - 2] = '\0';
+ output_buf[output_buf_len - 1] = '\0';
serv_msg_buf_len = sprintf(serv_msg_buf, "NOTICE %s :\x01PING %s\x01%c",
nick, msg + 6, 0x0a);
send_serv_msg_buf();
- printf("* CTCP PING from %s\n", nick);
+ printf("* CTCP PING from %s", nick);
+ maybe_eol();
} else if(memcmp(msg, "\x01" "VERSION\x01", 9) == 0) {
nick++;
*bang = '\0';
@@ -859,9 +869,11 @@ void do_msg() {
"an Atari %s\x01%c",
nick, os_version, 0x0a);
send_serv_msg_buf();
- printf("* CTCP VERSION from %s\n", nick);
+ printf("* CTCP VERSION from %s", nick);
+ maybe_eol();
} else {
printf("-> %s %s", nick, msg);
+ maybe_eol();
if(config->ui_flags & UIFLAG_MSGBELL)
bell();
bang[0] = '\0';
@@ -873,14 +885,17 @@ void do_msg() {
} else if((strcmp(cmd, "NOTICE") == 0) && msg[0] == '\x01') {
nick++;
*bang = '\0';
- if(!incoming_ctcp(nick, msg+1))
- printf("* CTCP reply from %s: %s", nick, msg+1); // still has A_EOL
+ if(!incoming_ctcp(nick, msg+1)) {
+ printf("* CTCP reply from %s: %s", nick, msg+1);
+ maybe_eol();
+ }
} else {
if(*msg) {
printf("%s %s %s %s", nick, cmd, chan, msg);
} else {
printf("%s %s %s", nick, cmd, chan);
}
+ maybe_eol();
}
fflush(stdout);
@@ -968,7 +983,7 @@ void redraw_user_buffer() {
/* Another uIP app callback. This decides whether or not we've received
a complete message from the server (which may be split into multiple
packets, and may end in the middle of a packet) */
-void telnet_newdata(struct telnet_state *s, char *data, u16_t len) {
+void telnet_newdata(struct telnet_state *, char *data, u16_t len) {
u16_t tlen = len;
char c, *t = data, buf_done = 0;
@@ -1081,7 +1096,7 @@ void add_to_nick_list(char *nick) {
void nick_completion(void) {
static char term[NICKLEN+1];
- static char result[NICKLEN+1];
+ // static char result[NICKLEN+1];
int len = 0;
int i;
char *start = input_buf + input_buf_len;
@@ -1105,9 +1120,13 @@ void nick_completion(void) {
input_buf_len += strlen(nick_list[i]);
del_user_buffer();
redraw_user_buffer();
+ return;
}
}
+ input_buf_len += len;
+ del_user_buffer();
+ redraw_user_buffer();
}
#endif
diff --git a/src/fujichat.h b/src/fujichat.h
index b85a980..daedf32 100644
--- a/src/fujichat.h
+++ b/src/fujichat.h
@@ -9,13 +9,21 @@
/* inverse video version, used for local prompts: */
#define SELF_INV "\xc6\xf5\xea\xe9\xc3\xe8\xe1\xf4"
+/* git revision, if available */
+#ifndef GITREV
+# ifdef RELEASE
+# define GITREV "RELEASE"
+# else
+# define GITREV "NOGIT"
+# endif
+#endif
+
#define VERSION "0.5_pre4"
-#define BANNER SELF_INV " v" VERSION
+#define BANNER SELF_INV " v" VERSION "-" GITREV
#define VERSION_REPLY SELF " v" VERSION
#define DEFAULT_NICK SELF
-// #define CONF_SIGNATURE "\x03\x0e"
#define CONF_SIGNATURE_LO 0x03
#define CONF_SIGNATURE_HI 0x0e
#define CONF_VERSION 5
diff --git a/src/fujiconf.c b/src/fujiconf.c
index cde1b97..62464f0 100644
--- a/src/fujiconf.c
+++ b/src/fujiconf.c
@@ -327,7 +327,7 @@ void main(void) {
disable_break();
putchar(125);
- puts(BANNER " Setup\n");
+ puts(BANNER "\n\nSetup Menu\n");
get_config();
if(!config_is_valid())
diff --git a/src/fujimenu.c b/src/fujimenu.c
index 58037d5..1dc1464 100644
--- a/src/fujimenu.c
+++ b/src/fujimenu.c
@@ -30,7 +30,7 @@ void main(void) {
disable_break();
- puts("\x7d" BANNER " Main Menu\n");
+ puts("\x7d" BANNER "\n\nMain Menu\n");
have_conf = get_config();
if(!have_conf)
diff --git a/src/fujitest.atr b/src/fujitest.atr
index f13b001..c0ea9ff 100644
--- a/src/fujitest.atr
+++ b/src/fujitest.atr
Binary files differ
diff --git a/src/start_slip.sh b/src/start_slip.sh
index ffb2a08..2574839 100755
--- a/src/start_slip.sh
+++ b/src/start_slip.sh
@@ -3,7 +3,7 @@
# Configurable stuff. You only ever need to change the IP addresses
# if your LAN already uses 192.168.0.0/24.
-TTY=/dev/ttyUSB0 # serial port to use
+TTY=/dev/ttyS2 # serial port to use
BAUD=9600 # must match baud rate in fujichat.cfg on the Atari
LOCAL_IP=192.168.0.1 # SLIP IP address for Linux ("peer") host
REMOTE_IP=192.168.0.2 # SLIP IP address for Atari host
@@ -20,6 +20,7 @@ DUMP_PACKETS=yes # Run tcpdump on sl0 interface?
#SLATTACH=a8_slattach # slattach binary (possibly patched). if not set,
# search $PATH for a8_slattach, then fall back to
# regular slattach.
+SLATTACH=slattach
#MASQ_IFACE=eth1 # if NATing, our main (LAM or internet) interface
# (if not set, detect automagically)