Compare commits
No commits in common. "e178f4d504e97d31f4c9b210717cb81e0cb195e2" and "fd6c5b5261efd8c6d0cdec2165920c78fb937e71" have entirely different histories.
e178f4d504
...
fd6c5b5261
3 changed files with 14 additions and 80 deletions
|
@ -1,8 +1,8 @@
|
|||
#!/bin/bash
|
||||
name=$(basename "$0")
|
||||
path=$(dirname "$0")
|
||||
mapfile wayland_args < ~/.config/electron-flags.conf
|
||||
program="$(basename "$0")"
|
||||
readarray -t wayland_args < ~/.config/electron-flags.conf
|
||||
PATH="$(echo "$PATH" | sed "s|$(dirname "$(which "$program")")||g" | sed 's/^://g' | sed 's/::/:/g')"
|
||||
exec "$program" \
|
||||
"${wayland_args[@]}" \
|
||||
"$@"
|
||||
|
||||
PATH=$(echo "$PATH" | sed "s|$path||g" | sed 's/^://' | sed 's/::/:/g' | sed 's/:$//')
|
||||
|
||||
exec "$name" "${wayland_args[@]}"
|
||||
|
|
|
@ -2,9 +2,10 @@
|
|||
name="$(basename "$0")"
|
||||
qemu-system-x86_64 \
|
||||
-monitor stdio -enable-kvm \
|
||||
-cpu host -smp "$(("$(nproc)" / 2))" \
|
||||
-m 8G \
|
||||
-hda "images/${name}.qcow2" \
|
||||
-net nic \
|
||||
-cpu host -smp "$(nproc)" \
|
||||
-m 4G \
|
||||
-drive "file=images/$(basename "$0").qcow2,if=virtio" \
|
||||
-net nic -net "user,hostname=${name}" \
|
||||
-name "$name" \
|
||||
"$@"
|
||||
|
||||
|
|
|
@ -1,67 +0,0 @@
|
|||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#define println() printf("\n")
|
||||
#define printsep(sep) printf("%s\n", sep)
|
||||
|
||||
static char *separation_character_line(const char *separation_character, const unsigned short terminal_width) {
|
||||
const unsigned short line_length = terminal_width / 3;
|
||||
const size_t character_length = strlen(separation_character);
|
||||
|
||||
char *line = malloc(line_length * sizeof(char));
|
||||
|
||||
while (strlen(line) + character_length <= line_length) {
|
||||
strncat(line, separation_character, character_length);
|
||||
}
|
||||
|
||||
return line;
|
||||
}
|
||||
|
||||
static unsigned short terminal_width() {
|
||||
struct winsize w;
|
||||
ioctl(STDOUT_FILENO, TIOCGWINSZ, &w);
|
||||
return w.ws_col;
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
// Parsing arguments
|
||||
char *name;
|
||||
char *separation_character;
|
||||
|
||||
if (argc >= 2) {
|
||||
name = argv[1];
|
||||
} else {
|
||||
name = "";
|
||||
}
|
||||
|
||||
if (argc >= 3) {
|
||||
separation_character = argv[2];
|
||||
} else {
|
||||
separation_character = "=";
|
||||
}
|
||||
|
||||
// Creating a /3 terminal size character line
|
||||
char *separation_line = separation_character_line(separation_character, terminal_width());
|
||||
|
||||
// Printing the separator
|
||||
println();
|
||||
|
||||
printsep(separation_line);
|
||||
|
||||
if (name != NULL) {
|
||||
printf("\t%s\n", name);
|
||||
} else {
|
||||
println();
|
||||
}
|
||||
|
||||
printsep(separation_line);
|
||||
|
||||
// Freeing the created character line
|
||||
free(separation_line);
|
||||
|
||||
// Returning with success
|
||||
return EXIT_SUCCESS;
|
||||
}
|
Loading…
Reference in a new issue