~arivigo/scalc-devel

Remove leading spaces v1 SUPERSEDED

Sebastian LaVine: 1
 Remove leading spaces

 7 files changed, 50 insertions(+), 50 deletions(-)
Export patchset (mbox)
How do I use this?

Copy & paste the following snippet into your terminal to import this patchset into git:

curl -s https://lists.sr.ht/~arivigo/scalc-devel/patches/23308/mbox | git am -3
Learn more about email & git
View this thread in the archives

[PATCH] Remove leading spaces Export this patch

---
 LICENSE   | 14 +++++++-------
 README.md | 34 +++++++++++++++++-----------------
 config.mk |  4 ++--
 op.c      |  6 +++---
 scalc.1   | 38 +++++++++++++++++++-------------------
 scalc.c   |  2 +-
 stack.c   |  2 +-
 7 files changed, 50 insertions(+), 50 deletions(-)

diff --git a/LICENSE b/LICENSE
index 0c7032c..063ef65 100644
--- a/LICENSE
+++ b/LICENSE
@@ -3,17 +3,17 @@ Copyright 2021 Ariadna Vigo <arivigodr@gmail.com>
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies 
of the Software, and to permit persons to whom the Software is furnished to do 
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
of the Software, and to permit persons to whom the Software is furnished to do
so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
diff --git a/README.md b/README.md
index 323668f..a71e0d0 100644
--- a/README.md
+++ b/README.md
@@ -1,9 +1,9 @@
# scalc - Simple calculator 
# scalc - Simple calculator

scalc is a very simple stack-based calculator that aims to be small, flexible, 
scalc is a very simple stack-based calculator that aims to be small, flexible,
and extensible.

**This software is still in a very early stage of development. Expect many 
**This software is still in a very early stage of development. Expect many
changes in the near future!**

## Build
@@ -21,17 +21,17 @@ $ make

Customize the build process by changing ``config.mk`` to suit your needs.

User configuration is performed by modifying ``config.h``. A set of defaults is 
User configuration is performed by modifying ``config.h``. A set of defaults is
provided in ``config.def.h``.

### Extending scalc

Unlike other extension systems you may find elsewhere, scalc adheres to a 
dwm-inspired[^1] way of extending itself: via source code. You may add new 
functions by following the instructions in the ``op.c`` source file, but in a 
nutshell you define your operations as unary or binary functions returning a 
double and register them into the ``op_defs`` array, specifying the information 
that is required. Don't hesitate sending a patch if you wanna share your 
Unlike other extension systems you may find elsewhere, scalc adheres to a
dwm-inspired[^1] way of extending itself: via source code. You may add new
functions by following the instructions in the ``op.c`` source file, but in a
nutshell you define your operations as unary or binary functions returning a
double and register them into the ``op_defs`` array, specifying the information
that is required. Don't hesitate sending a patch if you wanna share your
function!

[^1]: https://dwm.suckless.org/
@@ -44,21 +44,21 @@ You may install scalc by running the following command as root:
# make install
```

This will install the binary under ``$PREFIX/bin``, as defined by your 
environment, or ``/usr/local/bin`` by default. The Makefile supports the 
This will install the binary under ``$PREFIX/bin``, as defined by your
environment, or ``/usr/local/bin`` by default. The Makefile supports the
``$DESTDIR`` variable as well.

## Contributing

All contributions are welcome! If you wish to send in patches, ideas, or report 
a bug, you may do so by sending an email to the 
All contributions are welcome! If you wish to send in patches, ideas, or report
a bug, you may do so by sending an email to the
[scalc-devel](https://lists.sr.ht/~arivigo/scalc-devel) mailing list.

If interested in getting some news from the project, you may also want to 
subscribe to the low-volume 
If interested in getting some news from the project, you may also want to
subscribe to the low-volume
[scalc-announce](https://lists.sr.ht/~arivigo/scalc-announce) mailing list!

## License

scalc is published under an MIT/X11/Expat-type License. See ``LICENSE`` file 
scalc is published under an MIT/X11/Expat-type License. See ``LICENSE`` file
for copyright and license details.
diff --git a/config.mk b/config.mk
index 3a802f4..f740e71 100644
--- a/config.mk
+++ b/config.mk
@@ -12,8 +12,8 @@ LIBS = -lm

# Flags
CPPFLAGS = -DVERSION=\"${VERSION}\" -D_POSIX_C_SOURCE=200809L
#CFLAGS = -g -std=c99 -Wpedantic -Wall -Wextra 
CFLAGS = -std=c99 -Wpedantic -Wall -Wextra 
#CFLAGS = -g -std=c99 -Wpedantic -Wall -Wextra
CFLAGS = -std=c99 -Wpedantic -Wall -Wextra
LDFLAGS =

# Compiler and linker
diff --git a/op.c b/op.c
index 86cb16a..743c739 100644
--- a/op.c
+++ b/op.c
@@ -13,9 +13,9 @@
 * EXTENDING OP.C:
 *
 * All mathematical operations take the form of a unary or binary function
 * (one double argument or two double arguments, respectively), always 
 * returning a double as a result. All functions are to be defined static, 
 * unless they're defined in an external library (e.g. log() and sqrt(), from 
 * (one double argument or two double arguments, respectively), always
 * returning a double as a result. All functions are to be defined static,
 * unless they're defined in an external library (e.g. log() and sqrt(), from
 * libm).
 *
 * Mathematical constants are defined as 0-ary functions.
diff --git a/scalc.1 b/scalc.1
index 990124b..3d58b66 100644
--- a/scalc.1
+++ b/scalc.1
@@ -8,23 +8,23 @@ scalc \- Simple calculator
.RB [ \-v ]
.SH DESCRIPTION
.PP
.B scalc 
is a very simple stack-based calculator 
.B scalc
is a very simple stack-based calculator
that aims to be small, flexible, and extensible.
.PP
.B scalc 
.B scalc
reads RPN expressions from standard input.
Results are provided in double-precision floats to stdout. 
Results are provided in double-precision floats to stdout.
.PP
Currently supported mathematical functions include 
basic arithmetic operations, square roots, and natural logarithms. 
Currently supported mathematical functions include
basic arithmetic operations, square roots, and natural logarithms.
All functions are defined in the
.I op.c
module in the source tree.
.SS Commands
.B scalc 
accepts some commands, 
listed here for convenience, 
.B scalc
accepts some commands,
listed here for convenience,
which modify scalc's behavior during a session:
.TP
.B :d
@@ -43,7 +43,7 @@ List all available mathematical operations.
Shows the last element in the stack.
.TP
.B :q
Quits 
Quits
.B scalc.
.TP
.BI :sav " reg"
@@ -55,22 +55,22 @@ Saves the value on the top of the stack to register
Swaps the last two elements in the stack.
.SS Memory registers
.B scalc
offers memory registers, 
offers memory registers,
labeled A-J (uppercase),
where values can be stored to and retrieved from.
These registers can be used wherever a numerical value is allowed,
e.g. in operations, stack operations, etc.
To retrieve a value from a specific register, 
just type in the label of the desired register. 
To retrieve a value from a specific register,
just type in the label of the desired register.
To store values in them refer to the
.B :sav
command above.
.SS Extending scalc math functions
.PP
.B scalc 
can be easily extended with new mathematical functions by adding them to the 
.B scalc
can be easily extended with new mathematical functions by adding them to the
.I op.c
source file. 
source file.
The source file itself includes detailed instructions on how to do so.
.SH OPTIONS
.TP
@@ -78,7 +78,7 @@ The source file itself includes detailed instructions on how to do so.
Show version information and exit.
.SH EXAMPLES
.PP
The following example showcases basic operation with 
The following example showcases basic operation with
.B scalc.
.PP
Default interactive mode:
@@ -86,7 +86,7 @@ Default interactive mode:
.nf
.RS
.RB $ " scalc"
.br 
.br
.RB > " 2 3 + 9 / 15 /"
.br
0.037037
@@ -121,4 +121,4 @@ Reading from a pipeline:
.RE
.fi
.SH SEE ALSO
.BR bc (1), dc (1) 
\ No newline at end of file
.BR bc (1), dc (1)
\ No newline at end of file
diff --git a/scalc.c b/scalc.c
index 0f9696f..6977602 100644
--- a/scalc.c
+++ b/scalc.c
@@ -288,7 +288,7 @@ main(int argc, char *argv[])
			continue;

		if (expr[0] == ':')
			run_cmd(&stack, expr); 
			run_cmd(&stack, expr);
		else
			eval_math(expr, &stack);
	}
diff --git a/stack.c b/stack.c
index 4f20b6f..c9fa9da 100644
--- a/stack.c
+++ b/stack.c
@@ -78,7 +78,7 @@ stack_dup(Stack *stack)
	if (stack_push(stack, dup) < 0)
		return -1;

	return 0; 
	return 0;
}

int
-- 
2.32.0
Thanks for the patch. Just a very simple fix: your patch removes 
*trailing* spaces, not leading spaces. Could you change the commit
message to reflect that? If I did it using --amend, I'd be generating 
an entirely new commit and that would break your history.

-- 
Ariadna Vigo
Web: <https://ariadnavigo.xyz>
PGP: 0xA3B1324836A669BD