diff options
author | Takashi Iwai <tiwai@suse.de> | 2001-07-11 14:18:38 +0000 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2001-07-11 14:18:38 +0000 |
commit | f1c0e964dd524ffa063def3633e09a4db6a71e30 (patch) | |
tree | a534c5cbf391375edec600eac18128fb45ef0e4f | |
parent | 75cac98f769cd78eeab35fe7fffc2170092f533e (diff) |
Improved parse_address to accept the string without a port number
-rw-r--r-- | src/seq/seqmid.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/src/seq/seqmid.c b/src/seq/seqmid.c index a1a6d0d8..a3bf89e5 100644 --- a/src/seq/seqmid.c +++ b/src/seq/seqmid.c @@ -324,13 +324,18 @@ int snd_seq_parse_address(snd_seq_t *seq, snd_seq_addr_t *addr, const char *arg) { char *p; int client, port; + int len; assert(seq && addr && arg); - if ((p = strpbrk(arg, ":.")) == NULL) - return -EINVAL; - if ((port = atoi(p + 1)) < 0) - return -EINVAL; + if ((p = strpbrk(arg, ":.")) != NULL) { + if ((port = atoi(p + 1)) < 0) + return -EINVAL; + len = (int)(p - arg); /* length of client name */ + } else { + port = 0; + len = strlen(arg); + } addr->port = port; if (isdigit(*arg)) { client = atoi(arg); @@ -343,7 +348,6 @@ int snd_seq_parse_address(snd_seq_t *seq, snd_seq_addr_t *addr, const char *arg) int len; *p = 0; - len = (int)(p - arg); /* length of client name */ if (len <= 0) return -EINVAL; cinfo.client = -1; |