26 char *
p = strrchr(filename,
'/');
27 return p ? (
p+1) : filename;
33 int len = strlen(filename);
34 char *
p = filename + len - 1;
36 while (*
p != c && i-- >=0)
p--;
39 copy = (
char*)malloc(
sizeof(
char)*i);
40 strncpy(copy,filename,i-1);
43 copy = (
char*)malloc(
sizeof(
char)*(len+1));
44 strcpy(copy,filename);
51 char **strs = (
char **)malloc(
sizeof(
char *)*n);
57 for(i = 0; i < n; i++)
59 strs[i] = va_arg(args,
char *);
60 taille += strlen(strs[i]);
65 char *the_concat = (
char *)malloc(
sizeof(
char)*taille);
68 for(i = 0; i < n; i++)
69 strcat(the_concat, strs[i]);
82 vsnprintf(
msgbuf, 10000, msg, args);
87 #define INIT_MSG_LEN 100 104 if (fgetpos (f, &pos)) {
105 printf (
"Error getting position\n");
107 if ((s->
string = fgets (s->
c, l, f)) == NULL) {
110 if (strlen(s->
string)<(l-1)) {
114 if (fsetpos (f, &pos)) {
115 printf (
"Error setting position\n");
118 if ((s->
c = (
char*) realloc (s->
c, s->
length)) == NULL) {
119 fprintf (stderr,
"Oops, out of RAM\n");
134 if ((s->
c = (
char*) realloc (s->
c, s->
length)) == NULL) {
135 fprintf (stderr,
"Oops, out of RAM\n");
168 if (c==NULL)
return NULL;
169 r =
AllocM (
char, (strlen(c)+1));
char * strRemoveSuffix(char *filename, char c)
Returns a fresh copy of the name of a file without suffix.
char * string
This is the string.
char * string_copy(char *c)
copies a string
StringBuffer * NewStringBuffer(int length)
Make a new stringbuffer.
Some simple functions for string operations.
static char msgbuf[10000]
StringBuffer * SetStringBufferLength(StringBuffer *s, unsigned int l)
Scalar length(const Quaternion &q)
unsigned int length
This is the buffer length.
char * c
This is the buffer.
char * strConcat(int n,...)
Returns the concatenation n strings.
char * strBaseName(char *filename)
Returns the name of a file without leading pathname.
void FreeStringBuffer(StringBuffer **s)
Given a pointer to a stringbuffer pointer, free it and clear it.
StringBuffer * read_string(FILE *f, StringBuffer *s)
Reads a string dynamically.
The StringBuffer structure stores buffers of strings.
void message(const char *msg,...)
Prints a message.