Narthex

Modular dictionary generator
git clone git@git.mcdim.xyz:/var/www/git/Narthex.git
Log | Files | Refs | README | LICENSE

commit 5dfded810812dacd7a81969b4328a0758f6ef813
parent c1a783e568d634ca4830cbd87b2a1962eb3f3068
Author: Michael Constantine Dimopoulos <mk@mcdim.xyz>
Date:   Wed, 27 Oct 2021 20:25:58 +0000

Updated ncom

Diffstat:
Mcom/ncom.1 | 2+-
Mcom/ncom.c | 70+++++++++++++++++++++++++++++++++++++++++-----------------------------
2 files changed, 42 insertions(+), 30 deletions(-)

diff --git a/com/ncom.1 b/com/ncom.1 @@ -1,6 +1,6 @@ .\" Manpage for ncom -.TH man 8 "26 Jul 2021" "1.0" "ncom manual page" +.TH man 8 "26 Jul 2021" "1.1.1" "ncom manual page" .SH NAME ncom \- Narthex combinator .SH SYNOPSIS diff --git a/com/ncom.c b/com/ncom.c @@ -1,24 +1,33 @@ /* - * ncom - Narthex combinator (?) + * ncom - Narthex combinator * - * By Michael Constantine Dimopoulos - * https://mcdim.xyz <mk@mcdim.xyz> + * By Michael Constantine Dimopoulos https://mcdim.xyz <mk@mcdim.xyz> * License: GNU GPL v3 * - * ncom iterates over stdin and after - * printing the dictionary as is, it will - * print it again but will also append - * every line of stdin to each iteration - * creating, that way, a list of combi- - * nations (pairs) of the lines. + * ncom iterates over stdin and after printing the dictionary as is, it + * will print it again but will also append every line of stdin to each + * iteration creating, that way, a list of combinations (pairs) of + * the lines. * - * By default, it will append when the - * base is the same as the appended part - * (i.e wordword), but that can be - * switched off with the -b flag. It - * can also use other separators, such - * as a hyphen or a dot, all with their - * own flags. + * By default, it will append when the * base is the same as the + * appended part (i.e wordword), but that can be * switched off with the + * -b flag. It can also use other separators, such * as a hyphen or a + * dot, all with their own flags. + * + * * * * * * * * + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. * */ @@ -28,11 +37,11 @@ #include <unistd.h> #include <ctype.h> -#define VERSION "v1.1" +#define VERSION "v1.1.1" #define BUFFER_SIZE 256 static void -help(char * exename) +help(char *exename) { printf( "ncom - Narthex combinator %s\n" "By Michael Constantine Dimopoulos <mk@mcdim.xyz>\n\n" @@ -50,8 +59,8 @@ help(char * exename) exit(EXIT_SUCCESS); } -static void -die(char * str) +static inline void +die(char *str) { printf("%s\n", str); exit(EXIT_SUCCESS); @@ -105,22 +114,23 @@ static void print_only(FILE *f) { char buffer[BUFFER_SIZE]; - while(fgets(buffer, sizeof(buffer), f) != NULL) { + while (fgets(buffer, sizeof(buffer), f) != NULL) { printf("%s", buffer); } } void -main(int argc, char * argv[]) +main(int argc, char *argv[]) { - int d=0, u=0, m=0, b=0, n=1; + int d, u, m, b, n; + d = u = m = b = n; char *cvalue = NULL; int index; int c; opterr = 0; - while ( (c = getopt(argc, argv, "duuumnvbhh:")) != -1 ) + while ((c = getopt(argc, argv, "dumnvbh")) != -1 ) switch (c) { case 'v': die(VERSION); @@ -142,14 +152,16 @@ main(int argc, char * argv[]) b=1; break; case '?': - /*fprintf (stderr, "Unknown option `%c`\n", c); - exit(EXIT_FAILURE);*/ + /*fprintf (stderr, "Unknown option `%c`\n", c);*/ + exit(EXIT_FAILURE); break; } - /* for troubleshooting: */ - /* printf("d:%i\nm:%i\nu:%i\n", d, m, u); */ - FILE * f2, * f3; + /* for troubleshooting: + * printf("d:%i\nm:%i\nu:%i\n", d, m, u); + */ + + FILE *f2, *f3; f2 = save_stdin(stdin); rewind(f2); f3 = save_stdin(f2);