~gpanders/iboot

d4a7167f79eb671448a76a3fc10289c7cbefb502 — Gregory Anders 4 months ago 493125b
Use #define instead of string literals

This works better with Zig's C importing.
2 files changed, 5 insertions(+), 5 deletions(-)

M config.def.h
M iboot.zig
M config.def.h => config.def.h +3 -3
@@ 1,3 1,3 @@
static const char ADDRESS[]  = "192.168.1.254";
static const short PORT      = 80;
static const char PASSWORD[] = "";
#define ADDRESS  "192.168.1.254"
#define PORT     80
#define PASSWORD ""

M iboot.zig => iboot.zig +2 -2
@@ 26,12 26,12 @@ pub fn main() anyerror!void {
    else
        usage();

    const addr = try std.net.Address.resolveIp(std.mem.span(config.ADDRESS), config.PORT);
    const addr = try std.net.Address.resolveIp(config.ADDRESS, config.PORT);
    const sock = try std.net.tcpConnectToAddress(addr);

    // 4 extra bytes for the two escape characters, the action character, and
    // the carriage return
    comptime var size = std.mem.span(config.PASSWORD).len + 4;
    comptime var size = config.PASSWORD.len + 4;
    var buf: [size]u8 = undefined;
    _ = try std.fmt.bufPrint(&buf, "\x1b{s}\x1b{c}\r", .{
        config.PASSWORD,