[self setStatus:@"Bad username/password" isError:YES];
goto shutdown;
}
- /*
+
stat([[dragRegion filePath] UTF8String], &fileInfo);
- LIBSSH2_CHANNEL *channel = libssh2_scp_send(ssh, "~/tempupload.pdf", 0755, (unsigned long)fileInfo.st_size);
+ LIBSSH2_CHANNEL *channel = libssh2_scp_send(ssh, "~/__bu_print_drop__.pdf", 0755, (unsigned long)fileInfo.st_size);
if (!channel)
{
[self setStatus:@"Unable to open upload SCP session" isError:YES];
libssh2_channel_wait_closed(channel);
libssh2_channel_free(channel);
channel = NULL;
- */
- LIBSSH2_CHANNEL *channel = libssh2_channel_open_session(ssh);
+ channel = libssh2_channel_open_session(ssh);
if (!channel)
{
[self setStatus:@"Could not open SSH channel for printing" isError:YES];
// read the banner
[self readChannel:channel];
- char *cmd = "touch /u17/ugrad/rsesek/temp.foo\r\n\0";
+ // send the job to lpr
+ char *cmd = (char *)[[NSString stringWithFormat:@"touch ~/print-%@.drop\r\n\0", printer] UTF8String];
+ libssh2_channel_write(channel, cmd, sizeof(char) * strlen(cmd));
+ [self readChannel:channel];
+
+ // remove our temp file
+ cmd = "rm -f __bu_print_drop__.pdf\r\n\0";
libssh2_channel_write(channel, cmd, sizeof(char) * strlen(cmd));
[self readChannel:channel];