Re: Revert "Many Pages: Remove references to C89"

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Oskari,

On 3/15/23 13:30, Alejandro Colomar wrote:
> stdc89()
> {
>     grep "[[:alpha:]] \**\b$1([[:alnum:]*,. ]*);" /path/to/c89-draft.txt \
>     | sort \
>     | uniq;
> }

I found a bug.  I was missing '_' in identifier names.  So it didn't
match memcpy(3), which uses size_t.  Also, I found some spurious match,
so added a '$' anchor after the ';'.


stdc89()
{
    grep "[[:alpha:]] \**\b$1([[:alnum:]*,._ ]*);" /path/to/c89-draft.txt \
    | sort \
    | uniq;
}


This function finds 136 declarations in C89.  I'm not sure if that's
all of them.  Is anyone missing any?

Cheers,

Alex


$ stdc89 '[[:alpha:]][[:alnum:]]\+' | wc -l
136
$ stdc89 '[[:alpha:]][[:alnum:]]\+'
         FILE *fopen(const char *filename, const char *mode);
         FILE *tmpfile(void);
         char *asctime(const struct tm *timeptr);
         char *ctime(const time_t *timer);
         char *fgets(char *s, int n, FILE *stream);
         char *getenv(const char *name);
         char *gets(char *s);
         char *setlocale(int category, const char *locale);
         char *strcat(char *s1, const char *s2);
         char *strchr(const char *s, int c);
         char *strcpy(char *s1, const char *s2);
         char *strerror(int errnum);
         char *strncat(char *s1, const char *s2, size_t n);
         char *strncpy(char *s1, const char *s2, size_t n);
         char *strpbrk(const char *s1, const char *s2);
         char *strrchr(const char *s, int c);
         char *strstr(const char *s1, const char *s2);
         char *strtok(char *s1, const char *s2);
         char *tmpnam(char *s);
         clock_t clock(void);
         div_t div(int numer, int denom);
         double acos(double x);
         double asin(double x);
         double atan(double x);
         double atan2(double y, double x);
         double atof(const char *nptr);
         double ceil(double x);
         double cos(double x);
         double cosh(double x);
         double difftime(time_t time1, time_t time0);
         double exp(double x);
         double fabs(double x);
         double floor(double x);
         double fmod(double x, double y);
         double frexp(double value, int *exp);
         double ldexp(double x, int exp);
         double log(double x);
         double log10(double x);
         double modf(double value, double *iptr);
         double pow(double x, double y);
         double sin(double x);
         double sinh(double x);
         double sqrt(double x);
         double strtod(const char *nptr, char **endptr);
         double tan(double x);
         double tanh(double x);
         extern int atoi(const char *);
         extern void *alloc();
         int abs(int j);
         int atoi(const char *nptr);
         int fclose(FILE *stream);
         int feof(FILE *stream);
         int ferror(FILE *stream);
         int fflush(FILE *stream);
         int fgetc(FILE *stream);
         int fgetpos(FILE *stream, fpos_t *pos);
         int fprintf(FILE *stream, const char *format, ...);
         int fputc(int c, FILE *stream);
         int fputs(const char *s, FILE *stream);
         int fscanf(FILE *stream, const char *format, ...);
         int fseek(FILE *stream, long int offset, int whence);
         int fsetpos(FILE *stream, const fpos_t *pos);
         int getc(FILE *stream);
         int getchar(void);
         int isalnum(int c);
         int isalpha(int c);
         int iscntrl(int c);
         int isdigit(int c);
         int isgraph(int c);
         int islower(int c);
         int isprint(int c);
         int ispunct(int c);
         int isspace(int c);
         int isupper(int c);
         int isxdigit(int c);
         int mblen(const char *s, size_t n);
         int mbtowc(wchar_t *pwc, const char *s, size_t n);
         int memcmp(const void *s1, const void *s2, size_t n);
         int printf(const char *format, ...);
         int putc(int c, FILE *stream);
         int putchar(int c);
         int puts(const char *s);
         int raise(int sig);
         int rand(void);
         int remove(const char *filename);
         int rename(const char *old, const char *new);
         int scanf(const char *format, ...);
         int setjmp(jmp_buf env);
         int setvbuf(FILE *stream, char *buf, int mode, size_t size);
         int sprintf(char *s, const char *format, ...);
         int sscanf(const char *s, const char *format, ...);
         int strcmp(const char *s1, const char *s2);
         int strcoll(const char *s1, const char *s2);
         int strncmp(const char *s1, const char *s2, size_t n);
         int system(const char *string);
         int tolower(int c);
         int toupper(int c);
         int ungetc(int c, FILE *stream);
         int vfprintf(FILE *stream, const char *format, va_list arg);
         int vprintf(const char *format, va_list arg);
         int vsprintf(char *s, const char *format, va_list arg);
         int wctomb(char *s, wchar_t wchar);
         ldiv_t ldiv(long int numer, long int denom);
         long int atol(const char *nptr);
         long int ftell(FILE *stream);
         long int labs(long int j);
         long int strtol(const char *nptr, char **endptr, int base);
         size_t mbstowcs(wchar_t *pwcs, const char *s, size_t n);
         size_t strcspn(const char *s1, const char *s2);
         size_t strlen(const char *s);
         size_t strspn(const char *s1, const char *s2);
         size_t strxfrm(char *s1, const char *s2, size_t n);
         size_t wcstombs(char *s, const wchar_t *pwcs, size_t n);
         struct lconv *localeconv(void);
         struct tm *gmtime(const time_t *timer);
         struct tm *localtime(const time_t *timer);
         time_t mktime(struct tm *timeptr);
         time_t time(time_t *timer);
         void *calloc(size_t nmemb, size_t size);
         void *malloc(size_t size);
         void *memchr(const void *s, int c, size_t n);
         void *memcpy(void *s1, const void *s2, size_t n);
         void *memmove(void *s1, const void *s2, size_t n);
         void *memset(void *s, int c, size_t n);
         void *realloc(void *ptr, size_t size);
         void abort(void);
         void assert(int expression);
         void clearerr(FILE *stream);
         void exit(int status);
         void f1(int, ...);
         void free(void *ptr);
         void longjmp(jmp_buf env, int val);
         void perror(const char *s);
         void rewind(FILE *stream);
         void setbuf(FILE *stream, char *buf);
         void srand(unsigned int seed);


-- 
<http://www.alejandro-colomar.es/>
GPG key fingerprint: A9348594CE31283A826FBDD8D57633D441E25BB5

Attachment: OpenPGP_signature
Description: OpenPGP digital signature


[Index of Archives]     [Kernel Documentation]     [Netdev]     [Linux Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux