summaryrefslogtreecommitdiff
path: root/libc
diff options
context:
space:
mode:
authorEric Andersen <andersen@codepoet.org>2000-10-09 20:06:30 +0000
committerEric Andersen <andersen@codepoet.org>2000-10-09 20:06:30 +0000
commitc1fe19d4c1db610692365472a90f4661e48449c1 (patch)
treed0b0219ffca3c4c4256f55c4aea4513e43d6aecd /libc
parent9efafb8bbc7408b04643dcd53825d971577b4d9d (diff)
Bug ugly formatting update
Diffstat (limited to 'libc')
-rw-r--r--libc/inet/.indent.pro33
-rw-r--r--libc/inet/Makefile10
-rw-r--r--libc/inet/addr.c108
-rw-r--r--libc/inet/resolv.c552
-rw-r--r--libc/inet/rpc/auth_none.c57
-rw-r--r--libc/inet/rpc/auth_unix.c126
-rw-r--r--libc/inet/rpc/authunix_prot.c22
-rw-r--r--libc/inet/rpc/bindresvport.c12
-rw-r--r--libc/inet/rpc/clnt_generic.c19
-rw-r--r--libc/inet/rpc/clnt_perror.c218
-rw-r--r--libc/inet/rpc/clnt_raw.c106
-rw-r--r--libc/inet/rpc/clnt_simple.c39
-rw-r--r--libc/inet/rpc/clnt_tcp.c234
-rw-r--r--libc/inet/rpc/clnt_udp.c261
-rw-r--r--libc/inet/rpc/get_myaddress.c22
-rw-r--r--libc/inet/rpc/getrpcent.c74
-rw-r--r--libc/inet/rpc/getrpcport.c6
-rw-r--r--libc/inet/rpc/pmap_clnt.c40
-rw-r--r--libc/inet/rpc/pmap_getmaps.c20
-rw-r--r--libc/inet/rpc/pmap_getport.c26
-rw-r--r--libc/inet/rpc/pmap_prot.c17
-rw-r--r--libc/inet/rpc/pmap_prot2.c26
-rw-r--r--libc/inet/rpc/pmap_rmt.c212
-rw-r--r--libc/inet/rpc/rpc_callmsg.c74
-rw-r--r--libc/inet/rpc/rpc_commondata.c3
-rw-r--r--libc/inet/rpc/rpc_dtablesize.c6
-rw-r--r--libc/inet/rpc/rpc_prot.c124
-rw-r--r--libc/inet/rpc/svc.c301
-rw-r--r--libc/inet/rpc/svc_auth.c33
-rw-r--r--libc/inet/rpc/svc_auth_unix.c39
-rw-r--r--libc/inet/rpc/svc_raw.c81
-rw-r--r--libc/inet/rpc/svc_run.c13
-rw-r--r--libc/inet/rpc/svc_simple.c51
-rw-r--r--libc/inet/rpc/svc_tcp.c219
-rw-r--r--libc/inet/rpc/svc_udp.c229
-rw-r--r--libc/inet/rpc/xdr.c198
-rw-r--r--libc/inet/rpc/xdr_array.c52
-rw-r--r--libc/inet/rpc/xdr_float.c154
-rw-r--r--libc/inet/rpc/xdr_mem.c101
-rw-r--r--libc/inet/rpc/xdr_rec.c312
-rw-r--r--libc/inet/rpc/xdr_reference.c37
-rw-r--r--libc/inet/rpc/xdr_stdio.c132
-rw-r--r--libc/misc/regex/.indent.pro33
-rw-r--r--libc/misc/regex/Makefile11
-rw-r--r--libc/misc/regex/rx.c11347
-rw-r--r--libc/misc/time/.indent.pro33
-rw-r--r--libc/misc/time/Makefile11
-rw-r--r--libc/misc/time/asc_conv.c68
-rw-r--r--libc/misc/time/asctime.c14
-rw-r--r--libc/misc/time/asctime_r.c14
-rw-r--r--libc/misc/time/ctime.c35
-rw-r--r--libc/misc/time/ctime_r.c35
-rw-r--r--libc/misc/time/gmtime.c12
-rw-r--r--libc/misc/time/gmtime_r.c12
-rw-r--r--libc/misc/time/localtime.c21
-rw-r--r--libc/misc/time/localtime_r.c21
-rw-r--r--libc/misc/time/mktime.c314
-rw-r--r--libc/misc/time/tm_conv.c207
-rw-r--r--libc/pwd_grp/Makefile10
-rw-r--r--libc/stdio/.indent.pro33
-rw-r--r--libc/stdio/Makefile11
-rw-r--r--libc/stdio/printf.c610
-rw-r--r--libc/stdio/scanf.c827
-rw-r--r--libc/stdio/stdio.c1330
-rw-r--r--libc/stdlib/.indent.pro33
-rw-r--r--libc/stdlib/Makefile11
-rw-r--r--libc/stdlib/atexit.c108
-rw-r--r--libc/stdlib/bsearch.c56
-rw-r--r--libc/stdlib/getenv.c32
-rw-r--r--libc/stdlib/malloc-simple/.indent.pro33
-rw-r--r--libc/stdlib/malloc-simple/Makefile46
-rw-r--r--libc/stdlib/malloc-simple/alloc.c106
-rw-r--r--libc/stdlib/malloc/Makefile17
-rw-r--r--libc/stdlib/malloc/alloc.c48
-rw-r--r--libc/stdlib/mkstemp.c28
-rw-r--r--libc/stdlib/mktemp.c24
-rw-r--r--libc/stdlib/putenv.c103
-rw-r--r--libc/stdlib/qsort.c225
-rw-r--r--libc/stdlib/rand.c24
-rw-r--r--libc/stdlib/realpath.c30
-rw-r--r--libc/stdlib/setenv.c122
-rw-r--r--libc/stdlib/strtod.c113
-rw-r--r--libc/stdlib/system.c80
-rw-r--r--libc/string/Makefile11
-rw-r--r--libc/sysdeps/linux/common/Makefile9
-rw-r--r--libc/sysdeps/linux/i386/Makefile17
-rw-r--r--libc/sysdeps/linux/i386/clone.S11
-rw-r--r--libc/termios/.indent.pro33
-rw-r--r--libc/termios/Makefile11
-rw-r--r--libc/termios/termios.c294
-rw-r--r--libc/termios/ttyname.c66
91 files changed, 10556 insertions, 10543 deletions
diff --git a/libc/inet/.indent.pro b/libc/inet/.indent.pro
new file mode 100644
index 000000000..492ecf1c7
--- /dev/null
+++ b/libc/inet/.indent.pro
@@ -0,0 +1,33 @@
+--blank-lines-after-declarations
+--blank-lines-after-procedures
+--break-before-boolean-operator
+--no-blank-lines-after-commas
+--braces-on-if-line
+--braces-on-struct-decl-line
+--comment-indentation25
+--declaration-comment-column25
+--no-comment-delimiters-on-blank-lines
+--cuddle-else
+--continuation-indentation4
+--case-indentation0
+--else-endif-column33
+--space-after-cast
+--line-comments-indentation0
+--declaration-indentation1
+--dont-format-first-column-comments
+--dont-format-comments
+--honour-newlines
+--indent-level4
+/* changed from 0 to 4 */
+--parameter-indentation4
+--line-length78 /* changed from 75 */
+--continue-at-parentheses
+--no-space-after-function-call-names
+--dont-break-procedure-type
+--dont-star-comments
+--leave-optional-blank-lines
+--dont-space-special-semicolon
+--tab-size4
+/* additions by Mark */
+--case-brace-indentation0
+--leave-preprocessor-space
diff --git a/libc/inet/Makefile b/libc/inet/Makefile
index 519501180..07d84d6eb 100644
--- a/libc/inet/Makefile
+++ b/libc/inet/Makefile
@@ -33,11 +33,13 @@ MOBJ2=encodeh.o decodeh.o encoded.o decoded.o lengthd.o encodeq.o \
formquery.o dnslookup.o resolveaddress.o resolvemailbox.o \
opennameservers.o closenameservers.o resolvename.o gethostbyname.o\
gethostbyaddr.o
+OBJS=$(MOBJ) $(MOBJ2)
+all: $(OBJS) $(LIBC)
-all: $(MOBJ) $(MOBJ2) $(LIBC)
+$(LIBC): ar-target
-$(LIBC): $(MOBJ) $(MOBJ2)
- $(AR) $(ARFLAGS) $(LIBC) $(MOBJ) $(MOBJ2)
+ar-target: $(OBJS)
+ $(AR) $(ARFLAGS) $(LIBC) $(OBJS)
$(MOBJ): $(MSRC)
$(CC) $(CFLAGS) -DL_$* $< -c -o $*.o
@@ -45,6 +47,8 @@ $(MOBJ): $(MSRC)
$(MOBJ2): $(MSRC2)
$(CC) $(CFLAGS) -DL_$* $< -c -o $*.o
+$(OBJS): Makefile
+
clean:
rm -f *.[oa] *~ core
diff --git a/libc/inet/addr.c b/libc/inet/addr.c
index dcdd06cd4..142363ccc 100644
--- a/libc/inet/addr.c
+++ b/libc/inet/addr.c
@@ -10,77 +10,75 @@
int inet_aton(const char *cp, struct in_addr *inp);
#ifdef L_inet_aton
-int
-inet_aton(cp, inp)
+int inet_aton(cp, inp)
const char *cp;
struct in_addr *inp;
{
- unsigned long addr;
- int value;
- int part;
-
- if (!inp)
- return 0;
-
- addr = 0;
- for (part=1;part<=4;part++) {
-
- if (!isdigit(*cp))
- return 0;
-
- value = 0;
- while (isdigit(*cp)) {
- value *= 10;
- value += *cp++ - '0';
- if (value > 255)
- return 0;
- }
-
- if (*cp++ != ((part == 4) ? '\0' : '.'))
- return 0;
-
- addr <<= 8;
- addr |= value;
- }
-
- inp->s_addr = htonl(addr);
-
- return 1;
+ unsigned long addr;
+ int value;
+ int part;
+
+ if (!inp)
+ return 0;
+
+ addr = 0;
+ for (part = 1; part <= 4; part++) {
+
+ if (!isdigit(*cp))
+ return 0;
+
+ value = 0;
+ while (isdigit(*cp)) {
+ value *= 10;
+ value += *cp++ - '0';
+ if (value > 255)
+ return 0;
+ }
+
+ if (*cp++ != ((part == 4) ? '\0' : '.'))
+ return 0;
+
+ addr <<= 8;
+ addr |= value;
+ }
+
+ inp->s_addr = htonl(addr);
+
+ return 1;
}
#endif
#ifdef L_inet_addr
-unsigned long
-inet_addr(cp)
+unsigned long inet_addr(cp)
const char *cp;
{
- struct in_addr a;
- if (!inet_aton(cp, &a))
- return -1;
- else
- return a.s_addr;
+ struct in_addr a;
+
+ if (!inet_aton(cp, &a))
+ return -1;
+ else
+ return a.s_addr;
}
#endif
#ifdef L_inet_ntoa
-extern char * itoa(int);
+extern char *itoa(int);
-char *
-inet_ntoa(in)
+char *inet_ntoa(in)
struct in_addr in;
{
- static char buf[18];
- unsigned long addr = ntohl(in.s_addr);
-
- strcpy(buf, itoa((addr >> 24) & 0xff));
- strcat(buf, ".");
- strcat(buf, itoa((addr >> 16) & 0xff));
- strcat(buf, ".");
- strcat(buf, itoa((addr >> 8) & 0xff));
- strcat(buf, ".");
- strcat(buf, itoa(addr & 0xff));
-
- return buf;
+ static char buf[18];
+ unsigned long addr = ntohl(in.s_addr);
+
+ strcpy(buf, itoa((addr >> 24) & 0xff));
+ strcat(buf, ".");
+ strcat(buf, itoa((addr >> 16) & 0xff));
+ strcat(buf, ".");
+ strcat(buf, itoa((addr >> 8) & 0xff));
+ strcat(buf, ".");
+ strcat(buf, itoa(addr & 0xff));
+
+ return buf;
}
#endif
diff --git a/libc/inet/resolv.c b/libc/inet/resolv.c
index 27daaf4d6..ae23064bb 100644
--- a/libc/inet/resolv.c
+++ b/libc/inet/resolv.c
@@ -31,10 +31,10 @@
#define DPRINTF(X,args...) printf(X,args...)
#else
#define DPRINTF(X,args...)
-#endif /* DEBUG */
+#endif /* DEBUG */
#ifdef L_encodeh
-int encode_header(struct resolv_header * h, unsigned char * dest, int maxlen)
+int encode_header(struct resolv_header *h, unsigned char *dest, int maxlen)
{
if (maxlen < 12)
return -1;
@@ -42,12 +42,9 @@ int encode_header(struct resolv_header * h, unsigned char * dest, int maxlen)
dest[0] = (h->id & 0xff00) >> 8;
dest[1] = (h->id & 0x00ff) >> 0;
dest[2] = (h->qr ? 0x80 : 0) |
- ((h->opcode & 0x0f) << 3) |
- (h->aa ? 0x04 : 0) |
- (h->tc ? 0x02 : 0) |
- (h->rd ? 0x01 : 0);
- dest[3] = (h->ra ? 0x80 : 0) |
- (h->rcode & 0x0f);
+ ((h->opcode & 0x0f) << 3) |
+ (h->aa ? 0x04 : 0) | (h->tc ? 0x02 : 0) | (h->rd ? 0x01 : 0);
+ dest[3] = (h->ra ? 0x80 : 0) | (h->rcode & 0x0f);
dest[4] = (h->qdcount & 0xff00) >> 8;
dest[5] = (h->qdcount & 0x00ff) >> 0;
dest[6] = (h->ancount & 0xff00) >> 8;
@@ -56,13 +53,13 @@ int encode_header(struct resolv_header * h, unsigned char * dest, int maxlen)
dest[9] = (h->nscount & 0x00ff) >> 0;
dest[10] = (h->arcount & 0xff00) >> 8;
dest[11] = (h->arcount & 0x00ff) >> 0;
-
+
return 12;
}
#endif
#ifdef L_decodeh
-int decode_header(unsigned char * data, struct resolv_header * h)
+int decode_header(unsigned char *data, struct resolv_header *h)
{
h->id = (data[0] << 8) | data[1];
h->qr = (data[2] & 0x80) ? 1 : 0;
@@ -76,7 +73,7 @@ int decode_header(unsigned char * data, struct resolv_header * h)
h->ancount = (data[6] << 8) | data[7];
h->nscount = (data[8] << 8) | data[9];
h->arcount = (data[10] << 8) | data[11];
-
+
return 12;
}
#endif
@@ -85,33 +82,33 @@ int decode_header(unsigned char * data, struct resolv_header * h)
/* Encode a dotted string into nameserver transport-level encoding.
This routine is fairly dumb, and doesn't attempt to compress
the data */
-
-int encode_dotted(const char * dotted, unsigned char * dest, int maxlen)
+
+int encode_dotted(const char *dotted, unsigned char *dest, int maxlen)
{
- int used=0;
+ int used = 0;
- while(dotted && *dotted) {
- char * c = strchr(dotted, '.');
+ while (dotted && *dotted) {
+ char *c = strchr(dotted, '.');
int l = c ? c - dotted : strlen(dotted);
-
- if (l >= (maxlen-used-1))
+
+ if (l >= (maxlen - used - 1))
return -1;
-
+
dest[used++] = l;
- memcpy(dest+used, dotted, l);
+ memcpy(dest + used, dotted, l);
used += l;
-
+
if (c)
- dotted = c+1;
+ dotted = c + 1;
else
break;
}
-
+
if (maxlen < 1)
return -1;
-
+
dest[used++] = 0;
-
+
return used;
}
#endif
@@ -120,19 +117,19 @@ int encode_dotted(const char * dotted, unsigned char * dest, int maxlen)
/* Decode a dotted string from nameserver transport-level encoding.
This routine understands compressed data. */
-int decode_dotted(const unsigned char * data, int offset,
- char * dest, int maxlen)
+int decode_dotted(const unsigned char *data, int offset,
+ char *dest, int maxlen)
{
int l;
- int measure=1;
+ int measure = 1;
int total = 0;
- int used=0;
-
+ int used = 0;
+
if (!data)
return -1;
-
- while ((measure && total++), (l=data[offset++])) {
-
+
+ while ((measure && total++), (l = data[offset++])) {
+
if ((l & 0xc0) == (0xc0)) {
if (measure)
total++;
@@ -141,80 +138,80 @@ int decode_dotted(const unsigned char * data, int offset,
measure = 0;
continue;
}
-
- if ((used+l+1) >= maxlen)
+
+ if ((used + l + 1) >= maxlen)
return -1;
-
- memcpy(dest+used, data+offset, l);
+
+ memcpy(dest + used, data + offset, l);
offset += l;
used += l;
if (measure)
total += l;
-
+
if (data[offset] != 0)
dest[used++] = '.';
else
dest[used++] = '\0';
}
-
+
DPRINTF("Total decode len = %d\n", total);
-
+
return total;
}
#endif
#ifdef L_lengthd
-int length_dotted(const unsigned char * data, int offset)
+int length_dotted(const unsigned char *data, int offset)
{
int orig_offset = offset;
int l;
-
+
if (!data)
return -1;
-
- while ((l=data[offset++])) {
-
+
+ while ((l = data[offset++])) {
+
if ((l & 0xc0) == (0xc0)) {
offset++;
break;
}
-
+
offset += l;
}
-
- return offset-orig_offset;
+
+ return offset - orig_offset;
}
#endif
#ifdef L_encodeq
-int encode_question(struct resolv_question * q,
- unsigned char * dest, int maxlen)
+int encode_question(struct resolv_question *q,
+ unsigned char *dest, int maxlen)
{
int i;
i = encode_dotted(q->dotted, dest, maxlen);
if (i < 0)
return i;
-
+
dest += i;
maxlen -= i;
-
+
if (maxlen < 4)
return -1;
-
+
dest[0] = (q->qtype & 0xff00) >> 8;
dest[1] = (q->qtype & 0x00ff) >> 0;
dest[2] = (q->qclass & 0xff00) >> 8;
dest[3] = (q->qclass & 0x00ff) >> 0;
-
- return i+4;
+
+ return i + 4;
}