Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
Please login to access the resource
openSUSE:Evergreen:11.2:Test
unifdef
unifdef-codecleanup.diff
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File unifdef-codecleanup.diff of Package unifdef
--- unifdef.c +++ unifdef.c @@ -35,13 +35,13 @@ */ #ifndef lint -static char copyright[] = +static char __attribute__((used)) copyright[] = "@(#) Copyright (c) 1985, 1993\n\ The Regents of the University of California. All rights reserved.\n"; #endif /* not lint */ #ifndef lint -static char sccsid[] = "@(#)unifdef.c 8.1 (Berkeley) 6/6/93"; +static char __attribute__((used) )sccsid[] = "@(#)unifdef.c 8.1 (Berkeley) 6/6/93"; #endif /* not lint */ /* @@ -59,6 +59,8 @@ #include <stdio.h> #include <ctype.h> +#include <stdlib.h> +#include <string.h> #define BSS FILE *input; @@ -90,19 +92,21 @@ #define QUOTE_NONE 0 #define QUOTE_SINGLE 1 #define QUOTE_DOUBLE 2 + char inquote BSS; /* inside single or double quotes */ int exitstat BSS; -char *skipcomment (); -char *skipquote (); +char *skipcomment (char *); +char *skipquote (char *, int); +int findsym (char *); +void prname (void); +void pfile (void); -main (argc, argv) -int argc; -char **argv; +int main (int argc, char **argv) { char **curarg; - register char *cp; - register char *cp1; + char *cp; + char *cp1; char ignorethis; progname = argv[0][0] ? argv[0] : "unifdef"; @@ -120,7 +124,7 @@ ) && cp1[1] != '\0' ) { - register int symind; + int symind; if ((symind = findsym (&cp1[1])) < 0) { if (nsyms >= MAXSYMS) { @@ -190,7 +194,7 @@ #define LT_ELSE 5 /* #else */ #define LT_ENDIF 6 /* #endif */ #define LT_LEOF 7 /* end of file */ -extern Linetype checkline (); +Linetype checkline(int *); typedef int Reject_level; Reject_level reject BSS; /* 0 or 1: pass thru; 1 or 2: ignore comments */ @@ -224,22 +228,26 @@ #define IN_IF 1 #define IN_ELSE 2 -pfile () +int doif (int, int, Reject_level, int); + +void pfile (void) { reject = REJ_NO; (void) doif (-1, IN_NONE, reject, 0); return; } +void flushline (Bool); +int error (int, int, int); + int -doif (thissym, inif, prevreject, depth) -register int thissym; /* index of the symbol who was last ifdef'ed */ -int inif; /* YES or NO we are inside an ifdef */ -Reject_level prevreject;/* previous value of reject */ -int depth; /* depth of ifdef's */ +doif ( int thissym, /* index of the symbol who was last ifdef'ed */ + int inif, /* YES or NO we are inside an ifdef */ + Reject_level prevreject, /* previous value of reject */ + int depth) /* depth of ifdef's */ { - register Linetype lineval; - register Reject_level thisreject; + Linetype lineval; + Reject_level thisreject; int doret; /* tmp return value of doif */ int cursym; /* index of the symbol returned by checkline */ int stline; /* line number when called this time */ @@ -339,12 +347,13 @@ #define MAXLINE 256 char tline[MAXLINE] BSS; +int getlin (char *, int, FILE *, int); + Linetype -checkline (cursym) -int *cursym; /* if LT_TRUE or LT_FALSE returned, set this to sym index */ +checkline (int *cursym) /* if LT_TRUE or LT_FALSE returned, set this to sym index */ { - register char *cp; - register char *symp; + char *cp; + char *symp; char *scp; Linetype retval; # define KWSIZE 8 @@ -424,8 +433,7 @@ * position that is not whitespace. */ char * -skipcomment (cp) -register char *cp; +skipcomment (char *cp) { if (incomment) goto inside; @@ -466,16 +474,15 @@ * position that is not whitespace. */ char * -skipquote (cp, type) -register char *cp; -register int type; +skipquote (char *cp, int type) { - register char qchar; + char qchar; qchar = type == QUOTE_SINGLE ? '\'' : '"'; if (inquote == type) goto inside; + for (;; cp++) { if (*cp != qchar) return cp; @@ -501,13 +508,12 @@ * else return -1. */ int -findsym (str) -char *str; +findsym (char *str) { - register char *cp; - register char *symp; - register int symind; - register char chr; + char *cp; + char *symp; + int symind; + char chr; for (symind = 0; symind < nsyms; ++symind) { if (insym[symind] == SYM_INACTIVE) { @@ -529,15 +535,11 @@ * and (if compiled in) treats form-feed as an end-of-line */ int -getlin (line, maxline, inp, expandtabs) -register char *line; -int maxline; -FILE *inp; -int expandtabs; +getlin ( char *line, int maxline, FILE *inp, int expandtabs) { int tmp; - register int num; - register int chr; + int num; + int chr; #ifdef FFSPECIAL static char havechar = NO; /* have leftover char from last time */ static char svchar BSS; @@ -600,32 +602,31 @@ return num; } -flushline (keep) -Bool keep; +void flushline (Bool keep) { if ((keep && reject != REJ_YES) ^ complement) { - register char *line = tline; - register FILE *out = stdout; - register char chr; + char *line = tline; + FILE *out = stdout; + char chr; - while (chr = *line++) + while ((chr = *line++)) putc (chr, out); } else if (lnblank) + putc ('\n', stdout); return; } -prname () +void prname (void) { fprintf (stderr, "%s: ", progname); return; } int -error (err, line, depth) -int err; /* type of error & index into error string array */ -int line; /* line number */ -int depth; /* how many ifdefs we are inside */ +error (int err, /* type of error & index into error string array */ + int line, /* line number */ + int depth) /* how many ifdefs we are inside */ { if (err == END_ERR) return err;
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor