---
name: "ms_splitsrcname"
section: "3"
platform: "linux"
package: "libmseed-doc"
version: "2.19.8-1"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/ms_splitsrcname"
---

# ms\_splitsrcname(3)

Split source names into the SEED naming nomenclature.

## NAME

ms\_splitsrcname - Split source names into the SEED naming nomenclature.

## SYNOPSIS

```
#include <libmseed.h>
char  *ms_splitsrcname ( char *srcname, char *net, char * sta,
                         char * loc, char *chan, char *qual );
```

## DESCRIPTION

The **ms\_splitsrcname** routine parses SEED channel naming components from a source name string in the following format:

```
"NET_STA_LOC_CHAN[_QUAL]"
```

The first four components are required to uniquely identify a SEED channel, generally these are always present in a *srcname*.  The Quality code is normally optional in a source name.

The arguments for the first four components (net, sta, loc & chan) are treated as strings but the quality code (qual) is treated as a pointer to a single character.

Memory for the requested component strings must already be allocated. If a component pointer is NULL it will not be parsed from the string.

Source names in the expected format are created, for example, by the **[ms\_recsrcname(3)](/ms_recsrcname/3.md)**, **[msr\_srcname(3)](/msr_srcname/3.md) and [mst\_srcname(3)](/mst_srcname/3.md)** **routines.**

## LOCATION IDS AND SPACES

**The source name should never include spaces.  The fixed format nature** **of SEED data records leads to blank or unused location IDs represented** **by spaces, in a source name such blank location IDs should be** **collapsed to nothing in the resulting sources names.  A blank location** **ID is parsed from a source name as an empty string (not two spaces).**

## EXAMPLES

**This usage will result in net="IU", sta="ANMO", loc="00",** **chan="BHZ" and qual will remain unchanged (because it was not** **contained in the input srcname):**

```
ms_splitsrcname("IU_ANMO_00_BHZ", net, sta, loc, chan, qual);
```

**This usage will limit the parsing to only the network and station** **components with net="IU", sta="ANMO":**

```
ms_splitsrcname("IU_ANMO_00_BHZ", net, sta, NULL, NULL, NULL);
```

**The following usage illustrates a blank location ID and included** **quality code:**

```
ms_splitsrcname("IU_ANMO__BHZ_Q", net, sta, loc, chan, qual);
```

**The result is:**

```
net = "IU"
sta = "ANMO"
loc = ""
chan = "BHZ"
qual = 'Q'
```

## RETURN VALUES

**Return 0 on success and -1 on error.**

## SEE ALSO

**[ms\_recsrcname(3)](/ms_recsrcname/3.md), [msr\_srcname(3)](/msr_srcname/3.md) and [mst\_srcname(3)](/mst_srcname/3.md).**

## AUTHOR

```
Chad Trabant
IRIS Data Management Center
```
