File: utils.c

package info (click to toggle)
squizz 0.99d%2Bdfsg-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye
  • size: 6,784 kB
  • sloc: sh: 4,825; ansic: 2,640; lex: 1,992; yacc: 1,650; makefile: 127
file content (28 lines) | stat: -rw-r--r-- 503 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
/* utils.c - Sequence generic utilities functions */

#ifdef HAVE_CONFIG_H
# include <config.h>
#endif

#include <stdlib.h>
#include <string.h>

#include "utils.h"


/* Generic sequence name fixing */
char *sequence_fixnam(const char *nam) {
  const char *tmp;
  char *p, *new;

  tmp = (nam == NULL) ? "unknown" : nam;
  if ((new = strdup(tmp)) == NULL) {
    return NULL; }

  /* Relplace all spaces characters */
  p = new;
  while (*p) {
    if (*p == ' ') { *p = '_'; }
    p++; }

  return new; }