| str.c (c15bc2c4e28c0c71b84e49a4bd7131bc0529bce0) | str.c (e0ffd71f47fcc4029f6759c19bf7e02dd09d54e9) |
|---|---|
| 1 2/* 3 We define the string operations here. The reason we just do not use 4 the standard string routines in the PETSc code is that on some machines 5 they are broken or have the wrong prototypes. 6 7*/ 8#include <petscsys.h> /*I "petscsys.h" I*/ --- 427 unchanged lines hidden (view full) --- 436} 437 438/*@C 439 PetscStrlcat - Concatenates a string onto a given string, up to a given length 440 441 Not Collective 442 443 Input Parameters: | 1 2/* 3 We define the string operations here. The reason we just do not use 4 the standard string routines in the PETSc code is that on some machines 5 they are broken or have the wrong prototypes. 6 7*/ 8#include <petscsys.h> /*I "petscsys.h" I*/ --- 427 unchanged lines hidden (view full) --- 436} 437 438/*@C 439 PetscStrlcat - Concatenates a string onto a given string, up to a given length 440 441 Not Collective 442 443 Input Parameters: |
| 444+ s - pointer to string to be added to end | 444+ s - pointer to string to be added to at end |
| 445. t - string to be added to 446- n - length of the original allocated string 447 448 Level: intermediate 449 450 Notes: 451 Not for use in Fortran 452 --- 8 unchanged lines hidden (view full) --- 461@*/ 462PetscErrorCode PetscStrlcat(char s[],const char t[],size_t n) 463{ 464 size_t len; 465 PetscErrorCode ierr; 466 467 PetscFunctionBegin; 468 if (t && !n) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_ARG_SIZ,"String buffer length must be positive"); | 445. t - string to be added to 446- n - length of the original allocated string 447 448 Level: intermediate 449 450 Notes: 451 Not for use in Fortran 452 --- 8 unchanged lines hidden (view full) --- 461@*/ 462PetscErrorCode PetscStrlcat(char s[],const char t[],size_t n) 463{ 464 size_t len; 465 PetscErrorCode ierr; 466 467 PetscFunctionBegin; 468 if (t && !n) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_ARG_SIZ,"String buffer length must be positive"); |
| 469 if (!t) PetscFunctionReturn(0); |
|
| 469 ierr = PetscStrlen(t,&len);CHKERRQ(ierr); 470 strncat(s,t,n - len); 471 s[n-1] = 0; 472 PetscFunctionReturn(0); 473} 474 475/* 476 Only to be used with PetscCheck__FUNCT__()! --- 800 unchanged lines hidden --- | 470 ierr = PetscStrlen(t,&len);CHKERRQ(ierr); 471 strncat(s,t,n - len); 472 s[n-1] = 0; 473 PetscFunctionReturn(0); 474} 475 476/* 477 Only to be used with PetscCheck__FUNCT__()! --- 800 unchanged lines hidden --- |