From ceed291c84116cc9a2a3fd0137d6e713570457f8 Mon Sep 17 00:00:00 2001 From: fherrero <fherrero@iri.upc.edu> Date: Wed, 20 Feb 2019 10:36:39 +0100 Subject: [PATCH] Add topic/service/action name check for invalid slash '/' characters, which created invalid function and variable names. --- add_action_server_client.sh | 7 ++++++- add_service_server_client.sh | 7 ++++++- add_topic_publisher_subscriber.sh | 7 ++++++- 3 files changed, 18 insertions(+), 3 deletions(-) diff --git a/add_action_server_client.sh b/add_action_server_client.sh index c98ff87..ed0cf7b 100755 --- a/add_action_server_client.sh +++ b/add_action_server_client.sh @@ -40,7 +40,12 @@ do ros_pkg=$OPTARG ;; a) - action_name=$OPTARG + if echo "$OPTARG" | grep -q "/"; then + kill_exit "ERROR: argument -$OPTION can't contain slash '/' characters" + exit + else + action_name=$OPTARG + fi ;; m) action_file=$OPTARG diff --git a/add_service_server_client.sh b/add_service_server_client.sh index d8321b6..ee94f42 100755 --- a/add_service_server_client.sh +++ b/add_service_server_client.sh @@ -40,7 +40,12 @@ do ros_pkg=$OPTARG ;; s) - service_name=$OPTARG + if echo "$OPTARG" | grep -q "/"; then + kill_exit "ERROR: argument -$OPTION can't contain slash '/' characters" + exit + else + service_name=$OPTARG + fi ;; m) srv_file=$OPTARG diff --git a/add_topic_publisher_subscriber.sh b/add_topic_publisher_subscriber.sh index e89e5fd..5a06140 100755 --- a/add_topic_publisher_subscriber.sh +++ b/add_topic_publisher_subscriber.sh @@ -41,7 +41,12 @@ do ros_pkg=$OPTARG ;; t) - topic_name=$OPTARG + if echo "$OPTARG" | grep -q "/"; then + kill_exit "ERROR: argument -$OPTION can't contain slash '/' characters" + exit + else + topic_name=$OPTARG + fi ;; m) msg_file=$OPTARG -- GitLab