Changeset 3172 for trunk/src/kmk/kmkbuiltin/append.c
- Timestamp:
- Mar 21, 2018, 3:21:23 PM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/kmk/kmkbuiltin/append.c
r3171 r3172 45 45 #ifdef HAVE_ALLOCA_H 46 46 # include <alloca.h> 47 #endif 48 #if !defined(kmk_builtin_append) && defined(KBUILD_OS_WINDOWS) && defined(CONFIG_NEW_WIN_CHILDREN) 49 # include "../w32/winchildren.h" 47 50 #endif 48 51 #include "err.h" … … 169 172 * Appends text to a textfile, creating the textfile if necessary. 170 173 */ 171 int kmk_builtin_append(int argc, char **argv, char **envp) 174 #ifndef kmk_builtin_append 175 int kmk_builtin_append(int argc, char **argv, char **envp, struct child *pChild, pid_t *pPidSpawned) 176 #else 177 int main(int argc, char **argv, char **envp) 178 #endif 172 179 { 180 #if defined(KBUILD_OS_WINDOWS) || defined(KBUILD_OS_OS2) 181 static const char s_szNewLine[] = "\r\n"; 182 #else 183 static const char s_szNewLine[] = "\n"; 184 #endif 185 KMKBUILTINAPPENDBUF OutBuf = { NULL, 0, 0, 0 }; 173 186 const char *pszFilename; 174 187 int rc = 88; … … 184 197 int fLookForInserts = 0; 185 198 #endif 186 #if defined(KBUILD_OS_WINDOWS) || defined(KBUILD_OS_OS2)187 static const char s_szNewLine[] = "\r\n";188 #else189 static const char s_szNewLine[] = "\n";190 #endif191 KMKBUILTINAPPENDBUF OutBuf = { NULL, 0, 0, 0 };192 199 193 200 g_progname = argv[0]; … … 409 416 * Write the buffer (unless we ran out of heap already). 410 417 */ 418 #if !defined(kmk_builtin_append) && defined(KBUILD_OS_WINDOWS) && defined(CONFIG_NEW_WIN_CHILDREN) 419 if (!OutBuf.fOutOfMemory) 420 { 421 rc = MkWinChildCreateAppend(pszFilename, &OutBuf.pszBuf, OutBuf.offBuf, fTruncate, pChild, pPidSpawned); 422 if (rc != 0) 423 rc = errx(rc, "MkWinChildCreateAppend failed: %u", rc); 424 if (OutBuf.pszBuf) 425 free(OutBuf.pszBuf); 426 } 427 else 428 #endif 411 429 if (!OutBuf.fOutOfMemory) 412 430 {
Note:
See TracChangeset
for help on using the changeset viewer.