Changeset 903 for trunk/src/gmakenew/commands.c
- Timestamp:
- May 23, 2007, 7:31:19 AM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/gmakenew/commands.c
r778 r903 34 34 #endif 35 35 36 extern int remote_kill PARAMS ((int id, int sig));36 int remote_kill (int id, int sig); 37 37 38 38 #ifndef HAVE_UNISTD_H 39 externint getpid ();39 int getpid (); 40 40 #endif 41 41 … … 46 46 set_file_variables (struct file *file) 47 47 { 48 struct dep *d;49 c har *at, *percent, *star, *less;48 const struct dep *d; 49 const char *at, *percent, *star, *less; 50 50 51 51 #ifndef NO_ARCHIVES … … 56 56 { 57 57 unsigned int len; 58 const char *cp; 58 59 char *p; 59 60 60 p = strchr (file->name, '('); 61 at = (char *) alloca (p - file->name + 1); 62 bcopy (file->name, at, p - file->name); 63 at[p - file->name] = '\0'; 64 len = strlen (p + 1); 65 percent = (char *) alloca (len); 66 bcopy (p + 1, percent, len - 1); 67 percent[len - 1] = '\0'; 61 cp = strchr (file->name, '('); 62 p = alloca (cp - file->name + 1); 63 memcpy (p, file->name, cp - file->name); 64 p[cp - file->name] = '\0'; 65 at = p; 66 len = strlen (cp + 1); 67 p = alloca (len); 68 memcpy (p, cp + 1, len - 1); 69 p[len - 1] = '\0'; 70 percent = p; 68 71 } 69 72 else … … 80 83 any suffix in the .SUFFIXES list stripped off for 81 84 explicit rules. We store this in the `stem' member. */ 82 register struct dep *d; 83 char *name; 85 const char *name; 84 86 unsigned int len; 85 87 … … 97 99 } 98 100 99 for (d = enter_file ( ".SUFFIXES")->deps; d != 0; d = d->next)101 for (d = enter_file (strcache_add (".SUFFIXES"))->deps; d ; d = d->next) 100 102 { 101 103 unsigned int slen = strlen (dep_name (d)); 102 104 if (len > slen && strneq (dep_name (d), name + (len - slen), slen)) 103 105 { 104 file->stem = s avestring(name, len - slen);106 file->stem = strcache_add_len (name, len - slen); 105 107 break; 106 108 } … … 139 141 { 140 142 static char *plus_value=0, *bar_value=0, *qmark_value=0; 141 static unsigned int qmark_max=0, plus_max=0, bar_max=0;143 static unsigned int plus_max=0, bar_max=0, qmark_max=0; 142 144 143 145 unsigned int qmark_len, plus_len, bar_len; … … 166 168 if (! d->ignore_mtime) 167 169 { 168 c har *c = dep_name (d);170 const char *c = dep_name (d); 169 171 170 172 #ifndef NO_ARCHIVES … … 178 180 len = strlen (c); 179 181 180 bcopy (c, cp, len);182 memcpy (cp, c, len); 181 183 cp += len; 182 184 *cp++ = FILE_LIST_SEPARATOR; … … 217 219 for (d = file->deps; d != 0; d = d->next) 218 220 { 219 c har *c = dep_name (d);221 const char *c = dep_name (d); 220 222 221 223 #ifndef NO_ARCHIVES … … 231 233 if (d->ignore_mtime) 232 234 { 233 bcopy (c, bp, len);235 memcpy (bp, c, len); 234 236 bp += len; 235 237 *bp++ = FILE_LIST_SEPARATOR; … … 237 239 else 238 240 { 239 bcopy (c, cp, len);241 memcpy (cp, c, len); 240 242 cp += len; 241 243 *cp++ = FILE_LIST_SEPARATOR; 242 244 if (d->changed) 243 245 { 244 bcopy (c, qp, len);246 memcpy (qp, c, len); 245 247 qp += len; 246 248 *qp++ = FILE_LIST_SEPARATOR; … … 271 273 chop_commands (struct commands *cmds) 272 274 { 273 registerchar *p;275 const char *p; 274 276 unsigned int nlines, idx; 275 277 char **lines; … … 286 288 287 289 nlines = 5; 288 lines = (char **)xmalloc (5 * sizeof (char *));290 lines = xmalloc (5 * sizeof (char *)); 289 291 idx = 0; 290 292 p = cmds->commands; 291 293 while (*p != '\0') 292 294 { 293 c har *end = p;295 const char *end = p; 294 296 find_end:; 295 297 end = strchr (end, '\n'); … … 299 301 { 300 302 int backslash = 1; 301 registerchar *b;303 const char *b; 302 304 for (b = end - 2; b >= p && *b == '\\'; --b) 303 305 backslash = !backslash; … … 312 314 { 313 315 nlines += 2; 314 lines = (char **) xrealloc ((char *) lines, 315 nlines * sizeof (char *)); 316 lines = xrealloc (lines, nlines * sizeof (char *)); 316 317 } 317 318 lines[idx++] = savestring (p, end - p); … … 324 325 { 325 326 nlines = idx; 326 lines = (char **) xrealloc ((char *) lines, 327 nlines * sizeof (char *)); 327 lines = xrealloc (lines, nlines * sizeof (char *)); 328 328 } 329 329 … … 332 332 333 333 cmds->any_recurse = 0; 334 cmds->lines_flags = (char *)xmalloc (nlines);334 cmds->lines_flags = xmalloc (nlines); 335 335 for (idx = 0; idx < nlines; ++idx) 336 336 { … … 382 382 execute_file_commands (struct file *file) 383 383 { 384 registerchar *p;384 const char *p; 385 385 386 386 /* Don't go through all the preparations if … … 474 474 if (sig == SIGTERM) 475 475 { 476 registerstruct child *c;476 struct child *c; 477 477 for (c = children; c != 0; c = c->next) 478 478 if (!c->remote) … … 492 492 ) 493 493 { 494 registerstruct child *c;494 struct child *c; 495 495 496 496 /* Remote children won't automatically get signals sent … … 546 546 547 547 static void 548 delete_target (struct file *file, c har *on_behalf_of)548 delete_target (struct file *file, const char *on_behalf_of) 549 549 { 550 550 struct stat st; … … 601 601 602 602 /* Delete the target file if it changed. */ 603 delete_target (child->file, (char *) 0);603 delete_target (child->file, NULL); 604 604 605 605 /* Also remove any non-precious targets listed in the `also_make' member. */ … … 614 614 615 615 void 616 print_commands ( struct commands *cmds)616 print_commands (const struct commands *cmds) 617 617 { 618 registerchar *s;618 const char *s; 619 619 620 620 fputs (_("# commands to execute"), stdout); … … 629 629 while (*s != '\0') 630 630 { 631 c har *end;631 const char *end; 632 632 633 633 while (isspace ((unsigned char)*s))
Note:
See TracChangeset
for help on using the changeset viewer.