summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorWayne Davison <wayned@samba.org>2006-04-25 20:23:34 +0000
committerWayne Davison <wayned@samba.org>2006-04-25 20:23:34 +0000
commit0f78b81511be65d8fe21af1e6ac674f9e80ac29d (patch)
tree94c0e2c6ede275cc4374e8f2a5286f8ea8a6cdba /lib
parentd051056f921f465c487a85f9fa29a2324332bc4b (diff)
downloadrsync-0f78b81511be65d8fe21af1e6ac674f9e80ac29d.tar.gz
rsync-0f78b81511be65d8fe21af1e6ac674f9e80ac29d.tar.bz2
rsync-0f78b81511be65d8fe21af1e6ac674f9e80ac29d.zip
- Updated the address for the FSF in the opening comment.
- Standardized the format of the opening comment, including adding a brief description of what's in the file for those that lacked it. - Added some missing copyright lines. - Some minor whitespace tweaks (in a few of the files).
Diffstat (limited to 'lib')
-rw-r--r--lib/compat.c53
-rw-r--r--lib/mdfour.c45
-rw-r--r--lib/mdfour.h43
-rw-r--r--lib/permstring.c80
4 files changed, 108 insertions, 113 deletions
diff --git a/lib/compat.c b/lib/compat.c
index 5b7a2696..944a23e2 100644
--- a/lib/compat.c
+++ b/lib/compat.c
@@ -1,34 +1,27 @@
-/*
- Copyright (C) Andrew Tridgell 1998
- Copyright (C) 2002 by Martin Pool
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-*/
-
-/**
- * @file compat.c
+/*
+ * Reimplementations of standard functions for platforms that don't have them.
*
- * Reimplementations of standard functions for platforms that don't
- * have them.
- **/
-
-
+ * Copyright (C) 1998 Andrew Tridgell
+ * Copyright (C) 2002 Martin Pool
+ * Copyright (C) 2004, 2005, 2006 Wayne Davison
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
#include "rsync.h"
-
#ifndef HAVE_STRDUP
char *strdup(char *s)
{
@@ -86,7 +79,7 @@
/**
* Find the first ocurrence in @p s of any character in @p accept.
*
- * Derived from glibc
+ * Derived from glibc
**/
char *strpbrk(const char *s, const char *accept)
{
@@ -105,7 +98,7 @@
#ifndef HAVE_STRLCPY
/**
- * Like strncpy but does not 0 fill the buffer and always null
+ * Like strncpy but does not 0 fill the buffer and always null
* terminates.
*
* @param bufsize is the size of the destination buffer.
@@ -128,7 +121,7 @@
#ifndef HAVE_STRLCAT
/**
- * Like strncat() but does not 0 fill the buffer and always null
+ * Like strncat() but does not 0 fill the buffer and always null
* terminates.
*
* @param bufsize length of the buffer, which should be one more than
diff --git a/lib/mdfour.c b/lib/mdfour.c
index 38123c67..d231a3ed 100644
--- a/lib/mdfour.c
+++ b/lib/mdfour.c
@@ -1,30 +1,31 @@
/*
- Unix SMB/Netbios implementation.
- Version 1.9.
- a implementation of MD4 designed for use in the SMB authentication protocol
- Copyright (C) Andrew Tridgell 1997-1998.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-*/
+ * Unix SMB/Netbios implementation.
+ * Version 1.9.
+ * An implementation of MD4 designed for use in the SMB authentication protocol.
+ *
+ * Copyright (C) 1997-1998 Andrew Tridgell
+ * Copyright (C) 2005 Wayne Davison
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
#include "rsync.h"
/* NOTE: This code makes no attempt to be fast!
-
- It assumes that a int is at least 32 bits long
-*/
+ *
+ * It assumes that a int is at least 32 bits long. */
static struct mdfour *m;
diff --git a/lib/mdfour.h b/lib/mdfour.h
index b0f3176f..e24bfb32 100644
--- a/lib/mdfour.h
+++ b/lib/mdfour.h
@@ -1,23 +1,24 @@
/*
- Unix SMB/Netbios implementation.
- Version 1.9.
- a implementation of MD4 designed for use in the SMB authentication protocol
- Copyright (C) Andrew Tridgell 1997-1998.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-*/
+ * Unix SMB/Netbios implementation.
+ * Version 1.9.
+ * An implementation of MD4 designed for use in the SMB authentication protocol.
+ *
+ * Copyright (C) 1997-1998 Andrew Tridgell
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
struct mdfour {
uint32 A, B, C, D;
@@ -29,7 +30,3 @@ void mdfour_begin(struct mdfour *md);
void mdfour_update(struct mdfour *md, unsigned char *in, uint32 n);
void mdfour_result(struct mdfour *md, unsigned char *out);
void mdfour(unsigned char *out, unsigned char *in, int n);
-
-
-
-
diff --git a/lib/permstring.c b/lib/permstring.c
index 3834b7a1..c1747926 100644
--- a/lib/permstring.c
+++ b/lib/permstring.c
@@ -1,40 +1,40 @@
-/*
- Copyright (C) Andrew Tridgell 1996
- Copyright (C) Paul Mackerras 1996
- Copyright (C) 2001 by Martin Pool <mbp@samba.org>
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-*/
+/*
+ * A single utility routine.
+ *
+ * Copyright (C) 1996 Andrew Tridgell
+ * Copyright (C) 1996 Paul Mackerras
+ * Copyright (C) 2001 Martin Pool <mbp@samba.org>
+ * Copyright (C) 2003, 2006 Wayne Davison
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
#include "rsync.h"
-/**
- * Produce a string representation of Unix mode bits like that used by
- * ls(1).
- *
- * @param buf buffer of at least 11 characters
- **/
+/* Produce a string representation of Unix mode bits like that used by ls(1).
+ * The "buf" buffer must be at least 11 characters. */
void permstring(char *perms, mode_t mode)
{
static const char *perm_map = "rwxrwxrwx";
int i;
strcpy(perms, "----------");
-
- for (i=0;i<9;i++) {
- if (mode & (1<<i)) perms[9-i] = perm_map[8-i];
+
+ for (i = 0; i < 9; i++) {
+ if (mode & (1 << i))
+ perms[9-i] = perm_map[8-i];
}
/* Handle setuid/sticky bits. You might think the indices are
@@ -45,18 +45,22 @@ void permstring(char *perms, mode_t mode)
if (mode & S_ISGID)
perms[6] = (mode & S_IXGRP) ? 's' : 'S';
-
+
#ifdef S_ISVTX
if (mode & S_ISVTX)
perms[9] = (mode & S_IXOTH) ? 't' : 'T';
#endif
-
- if (S_ISLNK(mode)) perms[0] = 'l';
- if (S_ISDIR(mode)) perms[0] = 'd';
- if (S_ISBLK(mode)) perms[0] = 'b';
- if (S_ISCHR(mode)) perms[0] = 'c';
- if (S_ISSOCK(mode)) perms[0] = 's';
- if (S_ISFIFO(mode)) perms[0] = 'p';
-}
-
+ if (S_ISDIR(mode))
+ perms[0] = 'd';
+ else if (S_ISLNK(mode))
+ perms[0] = 'l';
+ else if (S_ISBLK(mode))
+ perms[0] = 'b';
+ else if (S_ISCHR(mode))
+ perms[0] = 'c';
+ else if (S_ISSOCK(mode))
+ perms[0] = 's';
+ else if (S_ISFIFO(mode))
+ perms[0] = 'p';
+}