GithubHelp home page GithubHelp logo

pipeseroni / pipes.c Goto Github PK

View Code? Open in Web Editor NEW
40.0 4.0 5.0 260 KB

Small application to mimic the "pipes" screensaver in a terminal window.

Home Page: https://pipeseroni.github.io/

License: GNU General Public License v3.0

C 94.12% Makefile 2.27% M4 3.61%
c terminal-screensaver pipes-sh pipeseroni

pipes.c's People

Contributors

foggalong avatar livibetter avatar plgruener avatar stefansm avatar travispaul avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

pipes.c's Issues

Any key to exit

Right know, if I'm not mistaken, only Ctrl+C can normally exit Snakes.

It would be nice that we can press any key to quit.

Error compiling cpipes.c, strncpy error

Hello, I'm getting a problem while compiling:

gcc (GCC) 8.2.1 20180831

src/cpipes.c:135:5: エラー: ‘strncpy’ specified bound 66 equals destination size [-Werror=stringop-truncation]
     strncpy(inbuf, selected_chars, CHAR_BUF_SZ);
     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~```

I would recommend making inbuf (and utf8buf) larger by 1 so you definitely get the null terminator in there.

Name of binrary and/or the project

The #3 makes me think about the installed binary, snake might conflict with others, a search with "snake" on Portage File List (an installed files search engine for Gentoo Portage) showed two potential conflicts:

  • dev-lang/nwcc: /usr/nwcc/bin/snake
  • games-misc/bsd-games: /usr/games/bin/snake

Never heard of nwcc, but bsd-games is enough. Another quick search for "snakes" returned zero results. It is not a filepath conflict, but PATH search issue.

And if we are going to submit this to package directory, this would have to be fixed, even this might be allowed as long as no one else is installed at /usr/bin/snake, although we might need to install under /usr/games depending on the rules of the directory.

I can see a few solutions:

  • Rename the binary/source to snakes?
  • Prefix/append some extra string to snake for the binary?
  • Rename entirely?
  • Others?

Split C and Perl

@OneLastTry maybe we should split them, create another repository for snakes.pl?

Remove snakes.pl from commits and forced update, and extract it and LICENSE for its own repository. Since currently we have no GitHub forks, it could be a good time to do it if we want to.

Do you think this is a good idea?

If you think so, I'd hope you'd take on this, and take the chance to update README after the extraction completed.

Properly support locales with charsets other than UTF-8

Right now, source-encoded (i.e. UTF-8) pipe characters are written directly to the terminal without any character encoding. If the user's terminal uses an encoding other than UTF-8, this will fail in more or less interesting ways. A more robust approach would be to use iconv to correctly generate characters in the users's locale.

Release: cannot find iconv, incorrect character in configure script

checking for library containing iconv... no configure: error: "iconv is required for locale conversion"
pipes.c on  master [⇡]
✦ ❯ ./configure
checking for a BSD-compatible install... /data/data/com.termux/files/usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /data/data/com.termux/files/usr/bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking whether make supports the include directive... yes (GNU style)
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking whether gcc understands -c and -o together... yes
checking dependency style of gcc... gcc3
checking for ar... ar
checking the archiver (ar) interface... ar
checking for ranlib... ranlib
checking for a sed that does not truncate output... /data/data/com.termux/files/usr/bin/sed
checking for gcc option to accept ISO C99... none needed
checking for pkg-config... /data/data/com.termux/files/usr/bin/pkg-config
checking pkg-config is at least version 0.9.0... yes
checking for ncursesw via pkg-config... yes
checking for working ncursesw/curses.h... yes
checking for working ncursesw.h... no
checking for working ncurses.h... yes
checking for init_extended_color(0, 0, 0, 0)... yes
checking for alloc_pair(0, 0)... yes
checking whether C compiler accepts -Werror=unknown-warning-option... yes
checking whether C compiler accepts -Wno-suggest-attribute=format... yes
checking whether C compiler accepts -fno-strict-aliasing... yes
checking whether C compiler accepts -Wall... yes
checking whether C compiler accepts -Wextra... yes
checking whether C compiler accepts -Wundef... yes
checking whether C compiler accepts -Wwrite-strings... yes
checking whether C compiler accepts -Wpointer-arith... yes
checking whether C compiler accepts -Wmissing-declarations... yes
checking whether C compiler accepts -Wredundant-decls... yes
checking whether C compiler accepts -Wno-unused-parameter... yes
checking whether C compiler accepts -Wno-missing-field-initializers... yes
checking whether C compiler accepts -Wformat=2... yes
checking whether C compiler accepts -Wcast-align... yes
checking whether C compiler accepts -Wformat-nonliteral... yes
checking whether C compiler accepts -Wformat-security... yes
checking whether C compiler accepts -Wsign-compare... yes
checking whether C compiler accepts -Wstrict-aliasing... yes
checking whether C compiler accepts -Wshadow... yes
checking whether C compiler accepts -Winline... yes
checking whether C compiler accepts -Wpacked... yes
checking whether C compiler accepts -Wmissing-format-attribute... yes
checking whether C compiler accepts -Wmissing-noreturn... yes
checking whether C compiler accepts -Winit-self... yes
checking whether C compiler accepts -Wredundant-decls... (cached) yes
checking whether C compiler accepts -Wmissing-include-dirs... yes
checking whether C compiler accepts -Wunused-but-set-variable... yes
checking whether C compiler accepts -Warray-bounds... yes
checking whether C compiler accepts -Wreturn-type... yes
checking whether C compiler accepts -Wswitch-enum... yes
checking whether C compiler accepts -Wswitch-default... yes
checking whether C compiler accepts -Wduplicated-cond... no
checking whether C compiler accepts -Wduplicated-branches... no
checking whether C compiler accepts -Wlogical-op... no
checking whether C compiler accepts -Wrestrict... no
checking whether C compiler accepts -Wnull-dereference... yes
checking whether C compiler accepts -Wdouble-promotion... yes
checking whether C compiler accepts -Wnested-externs... yes
checking whether C compiler accepts -Wmissing-prototypes... yes
checking whether C compiler accepts -Wstrict-prototypes... yes
checking whether C compiler accepts -Wdeclaration-after-statement... yes
checking whether C compiler accepts -Wimplicit-function-declaration... yes
checking whether C compiler accepts -Wold-style-definition... yes
checking whether C compiler accepts -Wjump-misses-init... no
checking whether C compiler accepts -Wno-error=unused-parameter... yes
checking whether C compiler accepts -Wno-error=missing-field-initializers... yes
checking whether C compiler accepts -Werror=unknown-warning-option... (cached) yes
checking whether the linker accepts -Wl,--as-needed... yes
checking whether the linker accepts -Wl,--as-needed... yes
checking whether the linker accepts -Wl,-z,relro... yes
checking whether the linker accepts -Wl,-z,relro... yes
checking whether the linker accepts -Wl,-z,now... yes
checking whether the linker accepts -Wl,-z,now... yes
checking whether the linker accepts -Wl,-z,noexecstack... yes
checking whether the linker accepts -Wl,-z,noexecstack... yes
checking whether the linker accepts -Wl,--no-as-needed... yes
checking whether the linker accepts -Wl,--fatal-warnings... yes
checking whether the linker accepts -Wl,-fatal_warnings... no
checking whether the linker accepts -Wl,--no-as-needed... yes
./configure: 7076: %SED: not found
checking for library containing iconv... no
configure: error: "iconv is required for locale conversion"

pipes.c on  master [⇡]
✦ ❯ pkg search iconv
Checking availability of current mirror: ok
Sorting...
Full Text Search...
iconv/stable,now 1.16-3 aarch64 [installed]
  Utility converting between different character encodings

libiconv/stable,now 1.16-3 aarch64 [installed]
  An implementation of iconv()

libiconv-static/stable,now 1.16-3 aarch64 [installed]
  Static libraries for libiconv

The %SED error goes away when I replace the % with a $ in configure, but there's something wrong with the iconv error, as I've got iconv, libiconv, and libiconv-static installed. Build environment is Termux.

This is in a git branch because I extracted the release into my repo, autoconf-archive is unavailable in termux, so I can't generate the config myself anyways.

Add Travis CI?

To ensure any PR can be compiled without issues.

Few notes:

  • Turn on -Werror, so the build would fail on a single warning.
  • Wishlist:
    • Also do CC=clang.
    • We can also add OS X, although I don't think the Makefile can work as it uses pkg-config and I don't know how that will go on Mac.

Thoughts and takers, if @StefansM approves this.

Support all colours in the terminal

At the moment, we use COLORS (i.e. the max available) colours, but don't actually initialise any to anything beyond the default values. We should take advantage of all available colours (the max. number of colours should be configurable). An HSL to RGB converter will let us pick colours that look good on a dark (or light) background and span the colours nicely.

Following from that, the background colour for the pipes should be configurable and default to the colour used by terminal (i.e. call the ncurses extension use_default_colors and default passing -1 to init_pair). If the background is dark, the default pipe colours should be light and vice-versa.

Cant install pipes.c

When i run

autoreconf -i
./configure && make && make install

I get this error:

./configure: line 4631: syntax error near unexpected token `dash-version'
./configure: line 4631: `AX_IS_RELEASE(dash-version)'

Handle `SIGWINCH`

If the size of the terminal emulator changes, the application should update accordingly.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.