Back to index

lightning-sunbird  0.9+nobinonly
Functions
hashmgr.cpp File Reference
#include "license.readme"
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include "hashmgr.hxx"

Go to the source code of this file.

Functions

void mychomp (char *s)
char * mystrdup (const char *)

Function Documentation

void mychomp ( char *  s)

Definition at line 66 of file csutil.cpp.

{
  int k = strlen(s);
  if ((k > 0) && ((*(s+k-1)=='\r') || (*(s+k-1)=='\n'))) *(s+k-1) = '\0';
  if ((k > 1) && (*(s+k-2) == '\r')) *(s+k-2) = '\0';
}
char* mystrdup ( const char *  )

Definition at line 53 of file csutil.cpp.

{
  char * d = NULL;
  if (s) {
     int sl = strlen(s);
     d = (char *) malloc(((sl+1) * sizeof(char)));
     if (d) memcpy(d,s,((sl+1)*sizeof(char)));
  }
  return d;
}