Changeset 17 for branches/1.0/src/uni.c
- Timestamp:
- Apr 16, 2010, 4:29:34 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/1.0/src/uni.c
r16 r17 59 59 #include <process.h> 60 60 #include "UNI.h" 61 62 /* replace one string by another */ 63 char * stringReplace(char *search, char *replace, char *string) { 64 char *tempString, *searchStart; 65 int len=0; 66 // preuefe ob Such-String vorhanden ist 67 searchStart = strstr(string, search); 68 if(searchStart == NULL) { 69 return string; 70 } 71 // Speicher reservieren 72 tempString = (char*) malloc((strlen(string) + strlen(replace) - strlen(search))* sizeof(char)); 73 // temporaere Kopie anlegen 74 strcpy(tempString, string); 75 // ersten Abschnitt in String setzen 76 len = searchStart - string; 77 strncpy(string, tempString, len); 78 // zweiten Abschnitt anhaengen 79 strcat(string, replace); 80 // dritten Abschnitt anhaengen 81 len += strlen(search); 82 strcat(string, (char *)tempString+len); 83 return string; 84 } 85 61 86 62 87 /* Password encryption/decryption routines from ndpsmb.c */ … … 1037 1062 // Usage: smbspool [DEVICE_URI] job-id user title copies options [file] 1038 1063 1064 1039 1065 sprintf(j_parms,parameters); 1040 rc = spawnlp(P_WAIT,binfile,binfile,j_parms,filename,NULL); 1066 stringReplace("%file%",filename,j_parms); 1067 1068 rc = spawnlp(P_WAIT,binfile,binfile,j_parms,NULL); 1041 1069 1042 1070 while (rc != 0) … … 1050 1078 if (resp != MBID_CANCEL ) 1051 1079 { 1052 rc = spawnlp(P_WAIT,binfile,binfile,j_parms, filename,NULL);1080 rc = spawnlp(P_WAIT,binfile,binfile,j_parms,NULL); 1053 1081 } 1054 1082 else rc = 0;
Note:
See TracChangeset
for help on using the changeset viewer.