-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Portability improvements, cleanup, and bug fixes #36
Open
johnsonjh
wants to merge
11
commits into
PDP-10:master
Choose a base branch
from
johnsonjh:20240807/johnsonjh/portability
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
5fc3404
Portability improvements
johnsonjh cc9b175
Fix some variables that are twiddled while uninitialized.
johnsonjh e9974ef
Fix off-by-one resulting in out-of-bounds write.
johnsonjh e2f5ced
Actually suppress error when Chaosnet bridge socket is missing
johnsonjh addd9d3
Create README.md and fix various spelling errors
johnsonjh 209a7b0
Cleanup macro
johnsonjh ac001cf
Ensure file handle is valid (non-negative) before closing
johnsonjh 0fe59fd
Fix non-ANSI function declaration (put_newline)
johnsonjh 553393c
Properly detect bad ports (negative or >65535)
johnsonjh f83521c
Add *.ln (Lint), `compile_commands.json`, and `supdupd` to `.gitignore`
johnsonjh 6f7860c
Create `.gitattributes` file
johnsonjh File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
doc/ linguist-vendored |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,6 @@ | ||
*~ | ||
*.o | ||
*.ln | ||
compile_commands.json | ||
/supdup | ||
/supdupd |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
# Makefile for the supdup server and client. | ||
|
||
SHELL = /bin/sh | ||
PREFIX ?= /usr/local | ||
|
||
CC ?= cc | ||
RM ?= rm -f | ||
|
||
OS_NAME ?= $(shell uname 2> /dev/null) | ||
CFLAGS += $(shell pkg-config --cflags ncurses 2> /dev/null) | ||
NCURSES_LIBS ?= $(shell pkg-config --libs ncurses 2> /dev/null || printf '%s' "-lncurses") | ||
|
||
# AIX (needs linking libcurses *after* libncurses) | ||
ifeq ($(OS_NAME), AIX) | ||
EXTRA_LDFLAGS = -lcurses | ||
endif | ||
|
||
# Mac OS X | ||
ifeq ($(OS_NAME), Darwin) | ||
LDFLAGS += -L/opt/local/lib | ||
endif | ||
|
||
# Solaris and illumos | ||
ifeq ($(OS_NAME), SunOS) | ||
CFLAGS += -I/usr/include/ncurses | ||
EXTRA_LDFLAGS = -lnsl -lsocket | ||
endif | ||
|
||
# Haiku | ||
ifeq ($(OS_NAME), Haiku) | ||
EXTRA_LDFLAGS = -lnetwork | ||
endif | ||
|
||
# NetBSD | ||
ifeq ($(OS_NAME), NetBSD) | ||
CFLAGS += -I/usr/pkg/include -I/usr/pkg/include/ncurses | ||
LDFLAGS += -L/usr/pkg/lib | ||
endif | ||
|
||
# The server (supdupd) isn't ready for prime time. | ||
.PHONY: all | ||
all: supdup | ||
|
||
SUPDUP_OBJS = supdup.o charmap.o tcp.o chaos.o | ||
supdup: $(SUPDUP_OBJS) | ||
$(CC) $(LDFLAGS) -o $@ $(SUPDUP_OBJS) $(NCURSES_LIBS) $(EXTRA_LDFLAGS) | ||
|
||
SUPDUPD_OBJS = supdupd.o | ||
supdupd: $(SUPDUPD_OBJS) | ||
$(CC) $(LDFLAGS) -o $@ $(SUPDUPD_OBJS) | ||
|
||
.PHONY: install | ||
install: supdup | ||
install -m 0755 supdup $(PREFIX)/bin | ||
test -x supdupd && install -m 0755 supdupd $(PREFIX)/bin | ||
|
||
.PHONY: clean | ||
clean: | ||
$(RM) *.o | ||
$(RM) supdup supdupd | ||
|
||
.PHONY: distclean | ||
distclean: clean | ||
$(RM) *~ *.bak core *.core | ||
|
||
# Dependencies | ||
chaos.o: supdup.h | ||
charmap.o: charmap.h | ||
supdup.o: charmap.h | ||
supdupd.o: supdup.h | ||
tcp.o: supdup.h |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,93 @@ | ||
![](https://travis-ci.org/larsbrinkhoff/lbForth.svg?branch=master) | ||
# `supdup` | ||
|
||
## Overview | ||
|
||
* `supdup` is a client (and `supdupd` is a server) implementing the SUPDUP (*Sup*er *Dup*er TELNET) protocol, a highly efficient [TELNET](https://www.rfc-editor.org/rfc/rfc854.txt)-style remote display protocol, on UNIX-like systems. | ||
|
||
* It originated as a private protocol between the [Chaosnet](https://chaosnet.net/)-connected ITS systems at MIT to allow a user at any one of these systems to use one of the others as a display; later implementations were developed for [various platforms](https://gunkies.org/wiki/Chaosnet#Protocol_implementations). | ||
|
||
* The software supports connections over TCP/IP and Chaosnet (optionally using the [cbridge](https://github.com/bictorv/chaosnet-bridge) software). | ||
|
||
## Supported platforms | ||
|
||
* Tested operating systems: Oracle Solaris, OpenIndiana illumos, Linux/musl, Linux/glibc, IBM AIX, IBM OS/400 (PASE), Haiku, FreeBSD, OpenBSD, NetBSD, Cygwin, and Apple macOS. | ||
|
||
## Supported compilers | ||
|
||
* Tested compilers: PCC, GCC, Clang, Xcode, IBM XL C, IBM Open XL C, Oracle Studio C, NVIDIA HPC SDK C, Portland Group C, and DMD ImportC. | ||
|
||
## Building the `supdup` client | ||
|
||
### Generic UNIX | ||
|
||
* Building on generic UNIX-like systems (**Linux**, **\*BSD**, **macOS**, **Haiku**, etc.): | ||
* Install prerequisite packages: | ||
* Required: `make` (GNU), `ncurses` (libraries and headers), | ||
* Recommended: `pkg-config` | ||
* Build: `gmake` (or sometimes just `make`) | ||
[]() | ||
|
||
[]() | ||
* The usual environment variables (*e.g.* `CC`, `CFLAGS`, `LDFLAGS`, etc.) are respected, for example: | ||
* `env CC="gcc" CFLAGS="-Wall" LDFLAGS="-L/usr/local" gmake` | ||
|
||
### IBM AIX | ||
|
||
* Building on IBM AIX 7: | ||
* Install prerequisite packages: | ||
* `dnf install make ncurses-devel pkg-config` | ||
* Build with GNU GCC: | ||
* `env CC="gcc" CFLAGS="-maix64" LDFLAGS="-maix64 -Wl,-b64" gmake` | ||
* Build with IBM XL C V16: | ||
* `env CC="xlc" CFLAGS="-q64" LDFLAGS="-q64" gmake` | ||
* Build with IBM Open XL C V17: | ||
* `env CC="ibm-clang" CFLAGS="-m64" LDFLAGS="-m64" gmake` | ||
|
||
### IBM i (OS/400) | ||
|
||
* Building on PASE for IBM i (OS/400): | ||
* Install prerequisite packages: | ||
* `yum install gcc10 make-gnu ncurses-devel pkg-config` | ||
* Build with GNU GCC: | ||
* `env CC="gcc-10" CFLAGS="-maix64" LDFLAGS="-maix64 -Wl,-b64" gmake` | ||
|
||
### DMD ImportC | ||
|
||
* Building with DMD ImportC: | ||
* `dmd -betterC -c -of=supdup.o chaos.c charmap.c supdup.c tcp.c $(pkg-config --cflags-only-I ncurses)` | ||
* `cc -o supdup supdup.o $(pkg-config --libs ncurses)` | ||
|
||
## Building the `supdup` server | ||
|
||
* An *experimental* server, `supdupd`, is included. | ||
* The server component is *incomplete* (and *may not* build on all platforms). | ||
[]() | ||
|
||
[]() | ||
* To build the server on generic UNIX-like systems: | ||
* Install prerequisite packages: `make` (GNU) | ||
* Build: `gmake` (or sometimes just `make`) | ||
|
||
## Bug Reporting | ||
|
||
* To report a problem with `supdup`, use GitHub Issues: | ||
* https://github.com/PDP-10/supdup/issues/new/choose | ||
|
||
## External links | ||
|
||
### SUPDUP | ||
|
||
* [RFC 734: SUPDUP Protocol](https://www.rfc-editor.org/rfc/rfc734.txt) | ||
* [RFC 736: TELNET SUPDUP Option](https://www.rfc-editor.org/rfc/rfc736.txt) | ||
* [RFC 746: The SUPDUP Graphics Extension](https://www.rfc-editor.org/rfc/rfc746.txt) | ||
* [RFC 747: Recent Extensions to the SUPDUP Protocol](https://www.rfc-editor.org/rfc/rfc747.txt) | ||
* [RFC 749: TELNET SUPDUP-OUTPUT Option](https://www.rfc-editor.org/rfc/rfc749.txt) | ||
* [AI Memo 643: A Local Front End for Remote Editing](http://www.bitsavers.org/pdf/mit/ai/aim/AIM-643.pdf) | ||
* [AI Memo 644: The SUPDUP Protocol](http://www.bitsavers.org/pdf/mit/ai/aim/AIM-644.pdf) | ||
* [PuTTY: SUPDUP Backend](https://git.tartarus.org/?p=simon/putty.git;a=blob;f=otherbackends/supdup.c;h=6f574c9fb9c34b1307b67326038aa713c2b1d07a;hb=HEAD) | ||
|
||
### Chaosnet | ||
|
||
* [AI Memo 628: Chaosnet](http://bitsavers.org/pdf/mit/ai/AIM-628_chaosnet.pdf) | ||
* [Chaosnet Bridge](https://github.com/bictorv/chaosnet-bridge) | ||
* [Chaosnet Wiki](https://chaosnet.net/) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
#ifndef CHARMAP_H | ||
#define CHARMAP_H | ||
#if !defined(CHARMAP_H) | ||
# define CHARMAP_H | ||
|
||
typedef struct { | ||
char *name; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems this is a but superfluous? I have no opinion though ..
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, that's just GNU style (modifications via GNU Cppi tool). If you hate it, I can revert.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't see that this was resolved in the discussions. I think minor whitespace cleanup is ok, but major reformatting is not.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That change is from GNU Cppi which normalizes preprocessor indentation to GNU style - it's indenting by one space because those preprocessor directives are inside the conditional #if block.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, but we haven't adopted GNU style here. At least it hasn't been discussed and agreed on.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can revert to the previous flat style with no indentation (all preprocessor directives left justified) if it's preferred. I apologize, it's something that I (and my default editor configuration) do automatically.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh no, need to apologize! We have these reviews and discussions to hash things out.
In my view, reformatting be more nuisance than it's worth. Say, if someone patched a fork and wanted to apply it here later. It's also polite to adopt the existing code style. So that's my preference, but I'm not saying I have the final say.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, I'll still lean to the new formatting due to the (IMO, massive) readability improvements, but let me know either way.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm with @larsbrinkhoff -- one benefit of keeping formatting is that when you compare to old versions of supdup that might surface it is much much easier to find changes.
As for GNU cppi .. I personally find it ugly, and it isn't that commonly adopted in GNU.