Skip to content

Commit

Permalink
Now sends name to iRODS server. Small configuration changes.
Browse files Browse the repository at this point in the history
  • Loading branch information
whitwham committed Jan 8, 2016
1 parent b08572e commit 34b5dbd
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 4 deletions.
5 changes: 3 additions & 2 deletions configure.ac
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
dnl -*- Autoconf -*-
AC_COPYRIGHT([
Copyright (c) 2015 Genome Research Ltd.
Copyright (c) 2015, 2016 Genome Research Ltd.
Author: Andrew Whitwham <[email protected]>
This file is part of tears.
Expand All @@ -19,7 +19,7 @@ this program. If not, see <http://www.gnu.org/licenses>])
dnl Process this file with autoconf to produce a configure script.

AC_PREREQ([2.68])
AC_INIT([tears], [1.0], [[email protected]])
AC_INIT([tears], [1.1], [[email protected]])

AM_INIT_AUTOMAKE([-Wall -Werror foreign])

Expand Down Expand Up @@ -109,6 +109,7 @@ AC_RUN_IFELSE(
[AC_MSG_ERROR([test iRODS program failed with IRODS_HOME=${IRODS_HOME}])])

AC_CONFIG_SRCDIR([tears.c])
AC_CONFIG_HEADERS([tears_config.h])
AC_CONFIG_FILES([Makefile])
AC_OUTPUT

22 changes: 20 additions & 2 deletions tears.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2015 Genome Research Ltd.
* Copyright (c) 2015, 2016 Genome Research Ltd.
*
* Author: Andrew Whitwham <[email protected]>
*
Expand Down Expand Up @@ -27,6 +27,7 @@
*
*/

#include "tears_config.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
Expand All @@ -42,7 +43,8 @@ void usage_and_exit(char *pname, int exit_code) {
fprintf(stderr, "\t-b bytes\tread/write buffer (default %d)\n", DEFAULT_BUFFER_SIZE);
fprintf(stderr, "\t-v\t\tverbose mode\n");
fprintf(stderr, "\t-d\t\tuse default server\n");
fprintf(stderr, "\t-h\t\tprint this help\n");
fprintf(stderr, "\t-h\t\tprint this help\n\n");
fprintf(stderr, "Version: %s Author: %s\n", PACKAGE_STRING, PACKAGE_BUGREPORT );
exit(exit_code);
}

Expand Down Expand Up @@ -200,6 +202,7 @@ int main (int argc, char **argv) {
int status;
char *obj_name = NULL;
char *buffer;
char *prog_name;
size_t buf_size = DEFAULT_BUFFER_SIZE;
int verbose = 0;
int opt;
Expand Down Expand Up @@ -251,6 +254,21 @@ int main (int argc, char **argv) {
error_and_exit(conn, "Error: unable to set buffer to size %ld\n", buf_size);
}

// set the client name so iRODS knows what program is connecting to it
prog_name = strrchr(argv[0], '/');

if (!prog_name) {
prog_name = argv[0];
} else {
prog_name++; // don't want the actual '/'
}

if (verbose) {
fprintf(stderr, "Setting client name to: %s\n", prog_name);
}

setenv(SP_OPTION, prog_name, 1);

// lets get the irods environment
if ((status = getRodsEnv(&irods_env)) < 0) {
error_and_exit(conn, "Error: getRodsEnv failed with status %d\n", status);
Expand Down

0 comments on commit 34b5dbd

Please sign in to comment.