Quick Search:

Mode

Context

Displaying 3 lines of context. None | Less | More | Full

Other Diffs

Ignore

Blank Lines Whitespace: Expand:

Diff

1.273
 
1.274
 
MAIN:plunky:20140606130437
 
cc.c
_>240240 int getsuf(char *);
 241241 char *getsufp(char *s);
 242242 int main(int, char *[]);
<>243 -void error(char *, ...);
244243 void errorx(int, char *, ...);
 245244 int cunlink(char *);
 246245 void exandrm(char *);
 247246 void dexit(int);
 248247 void idexit(int);
 249248 char *gettmp(void);
<>250 -void aerror(char *);
251249 void oerror(char *);
 252250 char *argnxt(char *, char *);
 253251 char *nxtopt(char *o);
     
 !
10341032         dexit(1);
 10351033 }
 10361034 
<>1037 -static void
 1038 -ccerror(char *s, va_list ap)
 1039 -{
 1040 -        vfprintf(Eflag ? stderr : stdout, s, ap);
 1041 -        putc('\n', Eflag? stderr : stdout);
 1042 -}
 1043 -
10441035 /*
<>1045 - * complain a bit.
  1036+ * complain and exit.
10461037  */
 10471038 void
<>1048 -error(char *s, ...)
 1049 -{
 1050 -        va_list ap;
 1051 -
 1052 -        va_start(ap, s);
 1053 -        ccerror(s, ap);
 1054 -        va_end(ap);
 1055 -        dexit(1);
 1056 -}
 1057 -
 1058 -/*
 1059 - * complain a bit and then exit.
 1060 - */
 1061 -void
10621039 errorx(int eval, char *s, ...)
 10631040 {
 10641041         va_list ap;
 10651042 
 10661043         va_start(ap, s);
<>1067 -        ccerror(s, ap);
  1044+        fputs("error: ", stderr);
  1045+        vfprintf(stderr, s, ap);
  1046+        putc('\n', stderr);
10681047         va_end(ap);
 10691048         dexit(eval);
 10701049 }
     
 !
12881267                 &si,
 12891268                 &pi);
 12901269 
<>1291 -        if (!ok) {
 1292 -                fprintf(stderr, "Can't find %s\n", STRLIST_FIRST(l)->value);
 1293 -                return 100;
 1294 -        }
  1270+        if (!ok)
  1271+                errorx(100, "Can't find %s\n", STRLIST_FIRST(l)->value);
12951272 
 12961273         WaitForSingleObject(pi.hProcess, INFINITE);
 12971274         GetExitCodeProcess(pi.hProcess, &exitCode);
     
 !
13281305                 (void)result;
 13291306                 _exit(127);
 13301307         case -1:
<>1331 -                error("fork failed");
  1308+                errorx(1, "fork failed");
13321309         default:
 13331310                 while (waitpid(child, &result, 0) == -1 && errno == EINTR)
 13341311                         /* nothing */(void)0;
 13351312                 result = WEXITSTATUS(result);
 13361313                 if (result)
<>1337 -                        error("%s terminated with status %d", argv[0], result);
  1314+                        errorx(1, "%s terminated with status %d", argv[0], result);
13381315                 while (argc-- > 0)
 13391316                         free(argv[argc]);
 13401317                 free(argv);
     
 !
13951372         char *sfn = xstrdup("/tmp/ctm.XXXXXX");
 13961373         int fd = -1;
 13971374 
<>1398 -        if ((fd = mkstemp(sfn)) == -1) {
 1399 -                fprintf(stderr, "%s: %s\n", sfn, strerror(errno));
 1400 -                dexit(8);
 1401 -        }
  1375+        if ((fd = mkstemp(sfn)) == -1)
  1376+                errorx(8, "%s: %s\n", sfn, strerror(errno));
14021377         close(fd);
 14031378         return sfn;
 14041379 }
     
 !
14341409         }
 14351410 }
 14361411 
<>1437 -
14381412 void
 14391413 oerror(char *s)
 14401414 {
<>1441 -        fprintf(stderr, "error: unknown option '%s'\n", s);
 1442 -        dexit(8);
  1415+        errorx(8, "unknown option '%s'", s);
14431416 }
 14441417 
<>1445 -void
 1446 -aerror(char *s)
 1447 -{
 1448 -        fprintf(stderr, "error: missing argument to '%s'\n", s);
 1449 -        dexit(8);
 1450 -}
 1451 -
14521418 /*
 14531419  * See if m matches the beginning of string str, if it does return the
 14541420  * remaining of str, otherwise NULL.
     
 !
14751441                         return &lav[0][l];
 14761442         }
 14771443         if (lac == 0)
<>1478 -                aerror(o);
  1444+                errorx(8, "missing argument to '%s'", o);
<_14791445         lav++;
 14801446         lac--;
 14811447         return lav[0];
FishEye: Open Source License registered to PCC.
Your maintenance has expired. You can renew your license at http://www.atlassian.com/fisheye/renew
Atlassian FishEye, CVS analysis. (Version:1.6.3 Build:build-336 2008-11-04) - Administration - Page generated 2014-10-30 19:12 +0100