//! Minimal curse/libssh smoke test. //! //! It deliberately calls into the translated C bindings so that building the //! demo exercises the whole path: translate-c, compiling the generated Zig, //! and linking against libssh. Touches both the client and server entry //! points, then prints the runtime library version. const std = @import("std"); const lib = @import("curse"); const c = lib.libssh; pub fn curse(init: std.process.Init) !void { if (c.ssh_init() != c.SSH_OK) return error.LibsshInit; defer _ = c.ssh_finalize(); const session = c.ssh_new() orelse return error.OutOfMemory; defer c.ssh_free(session); const bind = c.ssh_bind_new() orelse return error.OutOfMemory; defer c.ssh_bind_free(bind); var buf: [4096]u8 = undefined; var w = std.Io.File.stdout().writer(init.io, &buf); const out = &w.interface; try out.print("libssh: {s}\n", .{std.mem.span(c.ssh_version(0))}); try out.print("client session: {*}\n", .{session}); try out.print("server bind: {*}\n", .{bind}); try out.flush(); }