Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion docs/src/man/man1/halcmd.1.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,10 @@ requested component with a call to *dlopen(3)*.
_arrow_ can be "`=>`", "`<=`", "`<=>`", or omitted. *halcmd* ignores
arrows, but they can be useful in command files to document the
direction of data flow. Arrows should not be used on the command line
since the shell might try to interpret them. Fails if either _pinname_
since the shell might try to interpret them. An arrow is only an arrow
when spaces separate it from the names: "`lube-pump=>`" is a signal
name, and *halcmd* warns about a name that starts or ends with an
arrow. Fails if either _pinname_
or _signame_ does not exist, or if they are not the same type type.
*linksp* _signame_ [_arrow_] _pinname_::
(OBSOLETE - use *net* instead) (_link_ __s__ignal to __p__in) Works
Expand Down
12 changes: 12 additions & 0 deletions src/hal/utils/halcmd.c
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,14 @@ static int count_args(const char **argv) {
return i;
}

/* "lube-pump=>" or "=>io.relay": an arrow written without a space */
static int has_attached_arrow(const char *arg) {
size_t len = strlen(arg);
if(len < 3) return 0;
return !strncmp(arg, "<=", 2) || !strncmp(arg, "=>", 2) ||
!strcmp(arg + len - 2, "<=") || !strcmp(arg + len - 2, "=>");
}

#define ARG(i) (argc > i ? argv[i] : NULL)
#define REST(i) (argc > i ? argv + i : argv + argc)

Expand Down Expand Up @@ -338,6 +346,10 @@ static int parse_cmd1(const char **argv) {
!strcmp(argv[s], "<=>")) {
continue;
} else {
if(has_attached_arrow(argv[s]))
halcmd_warning("'%s' has an arrow attached, it is taken"
" as part of the name; put a space between the name"
" and the arrow\n", argv[s]);
argv[d++] = argv[s];
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/hal/utils/halcmd_commands.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2517,7 +2517,7 @@ int do_help_cmd(const char *command)
printf("linksp signame [arrow] pinname\n");
printf(" Links pin 'pinname' to signal 'signame'. Both forms do\n");
printf(" the same thing. Use whichever makes sense. The optional\n");
printf(" 'arrow' can be '==>', '<==', or '<=>' and is ignored. It\n");
printf(" 'arrow' can be '=>', '<=', or '<=>' and is ignored. It\n");
printf(" can be used in files to show the direction of data flow,\n");
printf(" but don't use arrows on the command line.\n");
} else if(strcmp(command, "net") == 0) {
Expand Down