Commit Graph

606 Commits (83ecf2683382b11562ab4d4ec10c971b655950f2)

Author SHA1 Message Date
Leah Rowe 4ac0bc8d3e blobutil/download: minor code cleanup
Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-05-18 11:41:56 +01:00
Leah Rowe 9fb489ac3e modify: clean up duplicated code
Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-05-18 11:24:08 +01:00
Leah Rowe f7f3aef17e modify: cleaner coding style
main() on top

top-down logic

reduced indentation

Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-05-18 11:14:49 +01:00
Leah Rowe 34df727c98 build: cleaner coding style
main() on top

top-down logic

reduced indentation

Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-05-18 10:49:47 +01:00
Leah Rowe 1a062bb628 build: reduce code to less than 80 chars per line
Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-05-18 10:21:54 +01:00
Leah Rowe a212a5bec8 blobutil: exit 1 if a called script fails
Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-05-18 10:11:32 +01:00
Leah Rowe e62215718c blobutil: cleaner coding style
reduced indentation

main() on top

top-down logic

Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-05-18 10:09:57 +01:00
Leah Rowe c08e3258cb .gitcheck: exit 1 if unsupported argument given
Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-05-18 09:55:40 +01:00
Leah Rowe c51225577b .gitcheck: use subshells where appropriate
Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-05-18 09:49:26 +01:00
Leah Rowe dd8fb524df .gitcheck: re-add redirection to /dev/null
Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-05-18 09:47:44 +01:00
Leah Rowe 82c4d7b280 .gitcheck clean: clean coreboot directories too
Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-05-18 09:44:11 +01:00
Leah Rowe 0f3c3ca600 .gitcheck: reduce indentation level for loop
Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-05-18 09:42:06 +01:00
Leah Rowe ecd7f1d11e .gitcheck: move logic out of main()
Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-05-18 09:41:00 +01:00
Leah Rowe 829bc02bf2 .gitcheck: *actually* check coreboot directories 2023-05-18 09:38:20 +01:00
Leah Rowe 52bc07bc84 .gitcheck: improved coding style
main() on top

top-down order of logic

Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-05-18 09:35:26 +01:00
Leah Rowe 83235fb96b .gitcheck: check argv when running gitcheck-clean
Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-05-18 09:25:25 +01:00
Leah Rowe 6ce77652c6 .gitcheck: actually *run* gitcheck-clean
Run() is called, but without argument.

This patch fixes that.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-05-18 09:23:23 +01:00
Leah Rowe 8782bff8ef download: code cleanup
Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-05-18 09:18:42 +01:00
Leah Rowe a232f9c575 download: check for non-existent script in loop
Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-05-18 09:16:50 +01:00
Leah Rowe b4f1804e48 download script: bugfix: gitcheck clean didn't run
the "placeholder" git credentials were not being
wiped, which sometimes overwrites the user's git
credentials permanently, when working on lbmk

(permanently, until manually reset by the user)

Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-05-18 09:12:27 +01:00
Leah Rowe 62c88dfb6e download script: improved coding style
introduce main()

cleaned up the if/else block

Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-05-18 09:11:59 +01:00
Leah Rowe 5b59490928 util/spkmodem_recv: Use pledge but only on OpenBSD
It will only be used on OpenBSD. Other operating
systems will behave in the same way.

Pledge is feature specific to OpenBSD that
restricts system operations, for security:

https://man.openbsd.org/pledge.2

Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-05-16 23:11:35 +01:00
Leah Rowe 25241ae222 util/spkmodem_recv: Add -u flag (no line buffer)
printf outputs to stdout, which is line buffered
by default.

Adding a -u option to disable buffering.

Exit when a non-support flag is given, but adhere
to current behaviour when no flag is given.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-05-16 23:11:35 +01:00
Leah Rowe 01fdfa3ab6 util/spkmodem_recv: Tidy up global variables
They do not need to be initialised zero, because
global variables are always zero by default,
unless set differently by the programmer.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-05-16 23:11:35 +01:00
Leah Rowe 50b35939de util/spkmodem_recv: Make pulse variable global
Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-05-16 23:11:35 +01:00
Leah Rowe 14190de9e8 util/spkmodem_recv: Use parentheses on comparisons
Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-05-16 23:11:35 +01:00
Leah Rowe c0f2bf3077 util/spkmodem_recv: Move global variable: pulse
It is only used by a single function.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-05-16 23:11:35 +01:00
Leah Rowe 5d03598b99 util/spkmodem_recv: Purge unused global: amplitude
Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-05-16 23:11:35 +01:00
Leah Rowe 63e43819b3 util/spkmodem_recv: Remove unused variable: pos
Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-05-16 23:11:35 +01:00
Leah Rowe a0abcb9f53 util/spkmodem_recv: Re-order functions for clarity
print_char() is referenced last, so declare it last.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-05-16 23:11:35 +01:00
Leah Rowe 93cc664254 util/spkmodem_recv: Handle output in new function
Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-05-16 23:11:35 +01:00
Leah Rowe 27866e65fb util/spkmodem_recv: Re-order prototypes
Put them in the same order as declared.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-05-16 23:11:35 +01:00
Leah Rowe 8b851258e2 util/spkmodem_recv: Rename functions for clarity
Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-05-16 23:11:35 +01:00
Leah Rowe 6c1bf756d3 util/spkmodem_recv: Return errno in main
This is a good general practise, to catch errors.

Any errors found can then be handled in code.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-05-16 23:11:35 +01:00
Leah Rowe c23806e1f6 util/spkmodem_recv: Use correct printf specifier
Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-05-16 23:11:35 +01:00
Leah Rowe 0cc23b2363 util/spkmodem_recv: Add error handling
There was literally no error handling before.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-05-16 23:11:35 +01:00
Leah Rowe 179323819b util/spkmodem_recv: Move logic out of main
Main should only be a skeletal structure.

Actual logic should always be handled externally.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-05-16 23:11:35 +01:00
Leah Rowe 3d55429443 util/spkmodem_recv: Rename variable for clarity
Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-05-16 23:11:35 +01:00
Leah Rowe 697ae5e2ca util/spkmodem_recv: Remove use of static keyword
It is entirely superfluous in this program.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-05-16 23:11:35 +01:00
Leah Rowe 2c12e70cfe util/spkmodem_recv: Rename variable for clarity
Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-05-16 23:11:35 +01:00
Leah Rowe 5b6f5cb06b util/spkmodem_recv: Remove space in function calls
Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-05-16 23:11:35 +01:00
Leah Rowe abc5cfd38c util/spkmodem_recv: Say frame in English
Source code should be written in English.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-05-16 23:11:35 +01:00
Leah Rowe e286470432 util/spkmodem_recv: Top-down logic (main on top)
Add the appropriate prototype.

Top-down function order is easier to read.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-05-16 23:11:35 +01:00
Leah Rowe 3722c1e67a util/spkmodem_recv: simplified pulse check
Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-05-16 23:11:35 +01:00
Leah Rowe 88683b767b util/spkmodem_recv: Define argc/argv in main
Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-05-16 23:11:35 +01:00
Leah Rowe 83b34e2f48 util/spkmodem_recv: Reduced indentation in loop
Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-05-16 23:11:35 +01:00
Leah Rowe 22633e0dc0 util/spkmodem_recv: Use tabs for indentation
The GNU indentation style is hard to read.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-05-16 23:11:35 +01:00
Leah Rowe 9152d0f939 util/spkmodem_recv: Add clean to the Makefile
Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-05-16 23:11:35 +01:00
Leah Rowe 754410f2af util/spkmodem_recv: Define CC in the Makefile
Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-05-16 23:11:35 +01:00
Leah Rowe f2887e9b45 util/spkmodem_recv: Add strict CFLAGS
Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-05-16 23:11:35 +01:00