SOURCES: ncpfs-hg-commit-403.patch (NEW), ncpfs-hg-commit-404.patc...

pascalek pascalek at pld-linux.org
Fri Jun 15 23:30:59 CEST 2007


Author: pascalek                     Date: Fri Jun 15 21:30:59 2007 GMT
Module: SOURCES                       Tag: HEAD
---- Log message:
- initial revision

---- Files affected:
SOURCES:
   ncpfs-hg-commit-403.patch (NONE -> 1.1)  (NEW), ncpfs-hg-commit-404.patch (NONE -> 1.1)  (NEW), ncpfs-hg-commit-405.patch (NONE -> 1.1)  (NEW), ncpfs-hg-commit-406.patch (NONE -> 1.1)  (NEW), ncpfs-hg-commit-407.patch (NONE -> 1.1)  (NEW), ncpfs-hg-commit-408.patch (NONE -> 1.1)  (NEW), ncpfs-hg-commit-409.patch (NONE -> 1.1)  (NEW), ncpfs-hg-commit-410.patch (NONE -> 1.1)  (NEW), ncpfs-hg-commit-411.patch (NONE -> 1.1)  (NEW), ncpfs-hg-commit-412.patch (NONE -> 1.1)  (NEW), ncpfs-hg-commit-413.patch (NONE -> 1.1)  (NEW), ncpfs-hg-commit-414.patch (NONE -> 1.1)  (NEW), ncpfs-hg-commit-415.patch (NONE -> 1.1)  (NEW), ncpfs-hg-commit-416.patch (NONE -> 1.1)  (NEW), ncpfs-hg-commit-417.patch (NONE -> 1.1)  (NEW), ncpfs-hg-commit-419.patch (NONE -> 1.1)  (NEW), ncpfs-hg-commit-420.patch (NONE -> 1.1)  (NEW), ncpfs-hg-commit-421.patch (NONE -> 1.1)  (NEW), ncpfs-hg-commit-422.patch (NONE -> 1.1)  (NEW), ncpfs-hg-commit-423.patch (NONE -> 1.1)  (NEW), ncpfs-hg-commit-424.patch (
 NONE -> 1.1)  (NEW), ncpfs-hg-commit-425.patch (NONE -> 1.1)  (NEW), ncpfs-hg-commit-426.patch (NONE -> 1.1)  (NEW), ncpfs-hg-commit-427.patch (NONE -> 1.1)  (NEW), ncpfs-hg-commit-428.patch (NONE -> 1.1)  (NEW), ncpfs-hg-commit-429.patch (NONE -> 1.1)  (NEW), ncpfs-hg-commit-430.patch (NONE -> 1.1)  (NEW), ncpfs-hg-commit-431.patch (NONE -> 1.1)  (NEW), ncpfs-hg-commit-432.patch (NONE -> 1.1)  (NEW), ncpfs-hg-commit-433.patch (NONE -> 1.1)  (NEW), ncpfs-hg-commit-434.patch (NONE -> 1.1)  (NEW), ncpfs-hg-commit-435.patch (NONE -> 1.1)  (NEW), ncpfs-hg-commit-436.patch (NONE -> 1.1)  (NEW), ncpfs-hg-commit-437.patch (NONE -> 1.1)  (NEW), ncpfs-hg-commit-438.patch (NONE -> 1.1)  (NEW), ncpfs-hg-commit-439.patch (NONE -> 1.1)  (NEW), ncpfs-hg-commit-440.patch (NONE -> 1.1)  (NEW), ncpfs-hg-commit-441.patch (NONE -> 1.1)  (NEW), ncpfs-hg-commit-442.patch (NONE -> 1.1)  (NEW), ncpfs-hg-commit-443.patch (NONE -> 1.1)  (NEW), ncpfs-hg-commit-444.patch (NONE -> 1.1)  (NEW), ncpfs-hg
 -commit-445.patch (NONE -> 1.1)  (NEW), ncpfs-hg-commit-446.patch (NONE -> 1.1)  (NEW), ncpfs-hg-commit-447.patch (NONE -> 1.1)  (NEW), ncpfs-hg-commit-448.patch (NONE -> 1.1)  (NEW), ncpfs-hg-commit-449.patch (NONE -> 1.1)  (NEW), ncpfs-hg-commit-450.patch (NONE -> 1.1)  (NEW), ncpfs-hg-commit-451.patch (NONE -> 1.1)  (NEW), ncpfs-hg-commit-452.patch (NONE -> 1.1)  (NEW), ncpfs-hg-commit-453.patch (NONE -> 1.1)  (NEW), ncpfs-hg-commit-454.patch (NONE -> 1.1)  (NEW), ncpfs-hg-commit-455.patch (NONE -> 1.1)  (NEW), ncpfs-hg-commit-456.patch (NONE -> 1.1)  (NEW), ncpfs-hg-commit-457.patch (NONE -> 1.1)  (NEW), ncpfs-hg-commit-458.patch (NONE -> 1.1)  (NEW)

---- Diffs:

================================================================
Index: SOURCES/ncpfs-hg-commit-403.patch
diff -u /dev/null SOURCES/ncpfs-hg-commit-403.patch:1.1
--- /dev/null	Fri Jun 15 23:30:59 2007
+++ SOURCES/ncpfs-hg-commit-403.patch	Fri Jun 15 23:30:54 2007
@@ -0,0 +1,21 @@
+changeset:   403:08f41478a208
+user:        Petr Vandrovec <petr at vandrovec.name>
+date:        Sun Apr 10 10:36:35 2005 +0000
+files:       man/ncpmount.8
+description:
+Change charset from iso-8859-1 to iso8859-1 in ncpmount manpage.
+
+
+diff -r 722e35906cab -r 08f41478a208 man/ncpmount.8
+--- a/man/ncpmount.8	Thu Jan 27 16:35:36 2005 +0000
++++ b/man/ncpmount.8	Sun Apr 10 10:36:35 2005 +0000
+@@ -282,7 +282,7 @@ You can specify character translation ru
+ You can specify character translation rules for converting names from
+ unicode to your desktop (it works together with \fB-p\fP).
+ .I iocharset
+-is charset name, for example \fIiso-8859-1\fP.
++is charset name, for example \fIiso8859-1\fP.
+ .RE
+ 
+ .B -p
+

================================================================
Index: SOURCES/ncpfs-hg-commit-404.patch
diff -u /dev/null SOURCES/ncpfs-hg-commit-404.patch:1.1
--- /dev/null	Fri Jun 15 23:30:59 2007
+++ SOURCES/ncpfs-hg-commit-404.patch	Fri Jun 15 23:30:54 2007
@@ -0,0 +1,691 @@
+changeset:   404:fc77f4249198
+user:        Scott Bentley <bentleys at hhangus.com>
+date:        Wed May 11 20:46:55 2005 +0000
+files:       BitKeeper/etc/ignore include/ncp/ncplib.h lib/filemgmt.c lib/libncp.vers lib/ltrace/ncplib.conf util/Makefile.in util/nwlistsalvage.c util/nwsalvage.c
+description:
+Add ncp_ns_scan_salvageable_file2 and ncp_ns_salvage_file to libncp.
+Add nwlistsalvage and nwsalvage utilities.  By Scott Bentley.
+
+
+diff -r 08f41478a208 -r fc77f4249198 include/ncp/ncplib.h
+--- a/include/ncp/ncplib.h	Sun Apr 10 10:36:35 2005 +0000
++++ b/include/ncp/ncplib.h	Wed May 11 20:46:55 2005 +0000
+@@ -2,6 +2,7 @@
+     ncplib.h
+     Copyright (C) 1995, 1996 by Volker Lendecke
+     Copyright (C) 1997-2001  Petr Vandrovec
++    Copyright (C) 2005  Scott Bentley
+ 
+     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
+@@ -51,6 +52,10 @@
+ 	1.05  2001, December 12		Hans Grobler <grobh at sun.ac.za>
+ 		Added NCP_PERM_ALL, ncp_ns_delete_entry and full NET_ADDRESS_TYPE
+ 		definition.
++	
++	1.06  2005, May			Scott Bentley
++		Added ncp_ns_scan_salvageable_file2().
++		Added ncp_ns_salvage_file().
+ 
+  */
+ 
+@@ -1124,6 +1129,10 @@ ncp_ns_scan_salvageable_file(NWCONN_HAND
+ 			     const unsigned char* encpath, int pathlen,
+ 			     struct ncp_deleted_file* finfo,
+ 			     char* retname, int retname_maxlen);
++
++long
++ncp_ns_salvage_file(NWCONN_HANDLE conn, u_int8_t src_ns, const struct ncp_deleted_file* finfo,
++		const char* newfname);
+ 
+ long
+ ncp_ns_purge_file(NWCONN_HANDLE conn, const struct ncp_deleted_file* finfo);
+@@ -1341,6 +1350,17 @@ struct nw_info_struct3 {
+ 	size_t		len;
+ 	void*		data;
+ };
++
++long
++ncp_ns_scan_salvageable_file2(NWCONN_HANDLE conn, u_int8_t src_ns,
++			     int dirstyle, u_int8_t vol_num, 
++			     u_int32_t dir_base,
++			     const unsigned char* encpath, int pathlen,
++			     struct ncp_deleted_file* finfo,
++			     struct NSI_Change* dinfo,/* Defined above */
++			     u_int32_t rim,
++			     void* target, size_t sizeoftarget);
++
+ 
+ struct ncp_dos_info_rights {
+ 	u_int16_t	Grant;
+diff -r 08f41478a208 -r fc77f4249198 lib/filemgmt.c
+--- a/lib/filemgmt.c	Sun Apr 10 10:36:35 2005 +0000
++++ b/lib/filemgmt.c	Wed May 11 20:46:55 2005 +0000
+@@ -3,6 +3,7 @@
+     Copyright (C) 1995, 1996 by Volker Lendecke
+     Copyright (C) 1999-2001  Petr Vandrovec
+     Copyright (C) 1999       Roumen Petrov
++    Copyright (C) 2005       Scott Bentley
+ 
+     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
+@@ -70,6 +71,9 @@
+ 		Added NULL parameter checks.
+ 		Added checks for legal reply sizes from server.
+ 
++	1.11  2005, May			Scott Bentley
++		Added ncp_ns_scan_salvageable_file2.
++		Added ncp_ns_salvage_file.
+  */
+ 
+ #include "config.h"
+@@ -1698,6 +1702,34 @@ quit:;
+ 		memcpy(name, ncp_reply_data(conn, 0x61), namelen);
+ 		name[namelen] = 0;
+ 	}
++	ncp_unlock_conn(conn);
++	return result;
++}
++
++long
++ncp_ns_salvage_file(struct ncp_conn* conn,
++	            u_int8_t src_ns,	
++		    const struct ncp_deleted_file* finfo, 
++		    const char* newfname)
++{
++	long result;
++
++	if (!finfo) {
++		return ERR_NULL_POINTER;
++	}
++
++	ncp_init_request(conn);
++	ncp_add_byte(conn, 17); //subfunction: Recover Salvageable File
++	ncp_add_byte(conn, src_ns); //Namespace to use
++	ncp_add_byte(conn, 0);  //Reserved
++	ncp_add_dword_lh(conn, finfo->seq);//File id
++	ncp_add_dword_lh(conn, finfo->vol);//Volume id
++	ncp_add_dword_lh(conn, finfo->base);//Directory id
++	ncp_add_pstring(conn, newfname);
++	
++	//ncp_add_pstring(conn, newfname);//Not used because it has 255 char limit
++	/* fn: 87 , subfn: 17 */
++	result = ncp_request(conn, 87);
+ 	ncp_unlock_conn(conn);
+ 	return result;
+ }
+@@ -2514,6 +2546,56 @@ static NWCCODE ncp_ns_extract_file_info(
+ 				dest);
+ 	}
+ 	return NWE_BUFFER_INVALID_LEN;
++}
++
++long
++ncp_ns_scan_salvageable_file2(struct ncp_conn* conn, u_int8_t src_ns,
++			     int dirstyle, 
++			     u_int8_t vol_num, u_int32_t dir_base,
++			     const unsigned char *encpath, int pathlen,
++			     struct ncp_deleted_file* finfo,
++			     struct NSI_Change* dinfo,
++		 	     u_int32_t rim,
++			     void *target, size_t sizeoftarget)
++{
++	long result;
++	NWCCODE err;
++
++	ncp_init_request(conn);
++	ncp_add_byte(conn, 0x10);
++	ncp_add_byte(conn, src_ns);
++	ncp_add_byte(conn, 0);
++	ncp_add_dword_lh(conn, rim);
++	ncp_add_dword_lh(conn, finfo->seq);
++	result = ncp_add_handle_path2(conn, vol_num, dir_base, dirstyle, encpath, pathlen);
++	if (result) {
++		ncp_unlock_conn(conn);
++		return result;
++	}
++	result = ncp_request(conn, 0x57);
++	if (result) {
++		ncp_unlock_conn(conn);
++		return result;
++	}
++	if (conn->ncp_reply_size < 0x61) {
++		ncp_unlock_conn(conn);
++		return NWE_INVALID_NCP_PACKET_LENGTH;
++	}
++	
++	finfo->seq = ncp_reply_dword_lh(conn, 0x00);
++	finfo->vol = ncp_reply_dword_lh(conn, 0x0C);
++	finfo->base = ncp_reply_dword_lh(conn, 0x10);
++	
++	dinfo->Time = ncp_reply_word_lh(conn, 0x04);
++	dinfo->Date = ncp_reply_word_lh(conn, 0x06);
++	dinfo->ID = ncp_reply_dword_hl(conn, 0x08);
++	
++	err = ncp_ns_extract_file_info(NULL, rim, 
++			ncp_reply_data(conn, 20), conn->ncp_reply_size - 20, 
++			target, sizeoftarget);
++	
++	ncp_unlock_conn(conn);
++	return result;
+ }
+ 
+ static const size_t field_sizes[32] = {
+diff -r 08f41478a208 -r fc77f4249198 lib/libncp.vers
+--- a/lib/libncp.vers	Sun Apr 10 10:36:35 2005 +0000
++++ b/lib/libncp.vers	Wed May 11 20:46:55 2005 +0000
+@@ -617,3 +617,8 @@ NCPFS_2.2.4 {
+ NCPFS_2.2.4 {
+ 		ncp_change_job_position;
+ };
++
++NCPFS_2.2.7 {
++		ncp_ns_salvage_file;
++		ncp_ns_scan_salvageable_file2;
++};
+diff -r 08f41478a208 -r fc77f4249198 lib/ltrace/ncplib.conf
+--- a/lib/ltrace/ncplib.conf	Sun Apr 10 10:36:35 2005 +0000
++++ b/lib/ltrace/ncplib.conf	Wed May 11 20:46:55 2005 +0000
+@@ -94,6 +94,8 @@ int ncp_get_effective_dir_rights(addr, a
+ int ncp_get_effective_dir_rights(addr, addr, addr);
+ int ncp_add_trustee_set(addr, uint, uint, uint, int, addr);
+ int ncp_ns_scan_salvageable_file(addr, uint, int, uint, uint, addr, uint, addr, addr, uint);
++int ncp_ns_scan_salvageable_file2(addr, uint, int, uint, uint, addr, int, addr, addr, uint, addr, uint);
++int ncp_ns_salvage_file(addr, uint, addr, addr);
+ int ncp_ns_purge_file(addr, addr);
+ int ncp_ns_get_full_name(addr, uint, uint, int, uint, uint, addr, uint, addr, uint);
+ int ncp_get_conn_type(addr);
+diff -r 08f41478a208 -r fc77f4249198 util/Makefile.in
+--- a/util/Makefile.in	Sun Apr 10 10:36:35 2005 +0000
++++ b/util/Makefile.in	Wed May 11 20:46:55 2005 +0000
+@@ -22,7 +22,7 @@ O_USERUTILS = slist.o pqlist.o nwfsinfo.
+ 	pqstat.o nwpqjob.o nwbpcreate.o nwbprm.o nwbpvalues.o nwbpadd.o \
+ 	nwbpset.o nwgrant.o nwrevoke.o nwuserlist.o nwauth.o \
+ 	nwfstime.o nwvolinfo.o nwtrustee.o nwdir.o \
+-	nwfsctrl.o nwpjmv.o
++	nwfsctrl.o nwpjmv.o nwsalvage.o nwlistsalvage.o
+ O_SBINUTILS =
+ ifeq ($(USE_KERNEL),1)
+ O_USERUTILS += ncopy.o nwtrustee2.o nwpurge.o nwrights.o
+diff -r 08f41478a208 -r fc77f4249198 util/nwlistsalvage.c
+--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
++++ b/util/nwlistsalvage.c	Wed May 11 20:46:55 2005 +0000
+@@ -0,0 +1,302 @@
++/*
++    nwlistsalvage.c - Utility to list information about salvageagle files
++    on NetWare volumes
++    Copyright (c) 2005		Scott Bentley
++
++    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
++
++    Revision history:
++
++	0.00  2005			Scott Bentley
++		Initial revision.
++ */
++
++#include <stdlib.h>
++#include <string.h>
++#include <unistd.h>
++
++#include <ncp/nwcalls.h>
++#include <ncp/nwnet.h>
++#include <ncp/eas.h>
++
++#include "private/libintl.h"
++#define _(X) gettext(X)
++
++#ifdef N_PLAT_DOS
++#ifndef NTYPES_H
++typedef unsigned int   nuint16;
++#endif
++typedef unsigned long  nuint32;
++typedef unsigned int   nuint;
++#else
++#endif
++
++static inline size_t my_strftime(char *s, size_t max, const char *fmt, const struct tm *tm) {
++	return strftime(s, max, fmt, tm);
++}
++
++static void doID(NWCONN_HANDLE conn, nuint32 id) {
++	NWCCODE err;
++	char user[MAX_DN_BYTES];
++	nuint16 type;
++
++	if (!id) {
++		printf(_("Nobody"));
++	} else {
++#ifdef N_PLAT_DOS
++		id = ntohl(id);
++#endif
++		err = NWGetObjectName(conn, id, user, &type);
++		if (err) {
++			NWDSContextHandle ctx;
++			
++			sprintf(user, _("Unknown:N/A"));
++			err = NWDSCreateContextHandle(&ctx);
++			if (!err) {
++				NWDSAddConnection(ctx, conn);
++				err = NWDSMapIDToName(ctx, conn, id, user);
++				if (err)
++					sprintf(user, _("Unknown:<%s>"), strnwerror(err));
++				NWDSFreeContext(ctx);
++			}
++		} else {
++			switch (type) {
++				case OT_USER:       printf(_("User:"));break;
++				case OT_USER_GROUP: printf(_("Group:"));break;
++				case OT_FILE_SERVER:printf(_("FileServer:"));break;
++				default:            printf(_("Unknown(%04X):"), type);break;
++			}
++		}
++		printf("%s", user);
++	}
++}
++
++static void dodate(nuint date) {
++	static const time_t zero_time_t = 0;
++	struct tm* tm;
++	char text[100];
++	
++	tm = gmtime(&zero_time_t);
++	tm->tm_year = (date>>9)+80;
++	tm->tm_mon = ((date>>5) & 0xF) - 1;
++	tm->tm_mday = date & 0x1F;
++	tm->tm_isdst = 0;
++	my_strftime(text, sizeof(text), "%x", tm);
++	printf("%s", text);
++}
++
++static void dotime(nuint dtime) {
++	static const time_t zero_time_t = 0;
++	struct tm* tm;
++	char text[100];
++	
++	tm = gmtime(&zero_time_t);
++	tm->tm_hour = dtime >> 11;
++	tm->tm_min = (dtime >> 5) & 0x3F;
++	tm->tm_sec = (dtime << 1) & 0x3F;
++	tm->tm_isdst = 0;
++	my_strftime(text, sizeof(text), "%X", tm);
++	printf("%s", text);
++}
++
++static void dodatesTimesID(NWCONN_HANDLE conn, nuint dtime, nuint date, nuint32 id) {
++	if (dtime || date) {
++		dodate(date);
++		printf(" ");
++		dotime(dtime);
++	} else {
++		printf("%-17s", _("never"));
++	}
++	if (id) {
++		printf("%10s","");
++		doID(conn, id);
++	}
++	printf("\n");
++}
++
++static void usage(void) {
++	printf(_(
++"usage: nwlistsalvage [options] [directory]\n"
++"\n"
++"-h              Print this help text\n"
++"-n <namespace>  Namespace for file access.\n"
++"                  DOS\n"
++"                  LONG - Default\n"
++"                  MAC\n"
++"                  NFS\n"
++"                  FTAM\n"
++"-v              Verbose\n"
++"\n"
++"directory  Directory to examine for salvageable files.  Default is ./\n"
++"\n"
++));
++}
++
++static int g_verbose = 0;
++static int g_files = 0;
++static int g_nwns = NW_NS_LONG;
++
++static void print_file_info(NWCONN_HANDLE conn, const struct ncp_deleted_file info, const struct NSI_Change deleted, const struct nw_info_struct3* vinfo) {
++	NWCCODE err;
++	struct NSI_Attributes attr;
++	struct NSI_Name name;
++	struct NSI_Modify modify;
++	struct NSI_Change created;
++	const char* type;
++		
++	//Get attributes
++	err = ncp_ns_extract_info_field(vinfo,NSIF_ATTRIBUTES,&attr,sizeof(attr));
++	if (err) {
++		printf("Cannot retrieve file attributes: %s\n",strnwerror(err));
++		return;
++	}
++	if (attr.Attributes & A_DIRECTORY) {
++		type = "D";
++	} else {
++		type = "F";
++	}
++	
++	//Get name	
++	err = ncp_ns_extract_info_field(vinfo,NSIF_NAME,&name,sizeof(name));
++	if (err) {
++		printf(_("Cannot retrieve file name: %s\n"),strnwerror(err));
++		return;
++	}
++	
++	// Show standard set of info
++	printf("%2s%s %d %s\n", "", type, info.seq, name.Name);
++	
++	// Show verbose info	
++	if(g_verbose) {
++		printf("%5sDeleted:\t\t","");
++		dodatesTimesID(conn,deleted.Time,deleted.Date,deleted.ID);
++		
++		printf("%5sCreated:\t\t","");
++		err = ncp_ns_extract_info_field(vinfo,NSIF_CREATION,&created,sizeof(created));
++		if (err) {
++			printf(_("Cannot retrieve creation info: %s\n"),strnwerror(err));
++			return;
++		} else {
++			dodatesTimesID(conn,created.Time,created.Date,created.ID);
++		}
++	
++		printf("%5sLast Modified:\t","");
++		err = ncp_ns_extract_info_field(vinfo,NSIF_MODIFY,&modify,sizeof(modify));
++		if (err) {
++			printf(_("Cannot retrieve modified info: %s\n"),strnwerror(err));
++			return;
++		} else {
++			dodatesTimesID(conn,modify.Modify.Time,modify.Modify.Date,modify.Modify.ID);
++		}
++	}
++}
++
++static void list_salvageable_files(struct ncp_conn* conn, int volume, u_int32_t directory_id) {
++	struct ncp_deleted_file info;//file info
++	struct nw_info_struct3 vinfo;//verbose file info
++	struct NSI_Change deleted;
++
++	vinfo.len =0;
++	vinfo.data = NULL;
++	
++	info.seq = -1;//Initialize the file id to start with first file
++	while (!ncp_ns_scan_salvageable_file2(conn, g_nwns, 
++			1, volume, directory_id, NULL, 0, 
++			&info, &deleted,
++			IM_ALL, &vinfo, sizeof(vinfo)
++			)) {
++
++		print_file_info(conn,info,deleted,&vinfo);
++		
++		vinfo.len = 0;
++		free(vinfo.data);
++		vinfo.data = NULL;
++
++		g_files++;
++	}
++	printf("\n");
++}
++
++int main(int argc, char* argv[]) {
++	struct NWCCRootEntry root;
++	const char* mount_path;
++	const char* opt_n;
++	struct ncp_conn* conn;
++	int err;
++	int c;
++
++	setlocale(LC_ALL, "");
++	bindtextdomain(NCPFS_PACKAGE, LOCALEDIR);
++	textdomain(NCPFS_PACKAGE);
++	
++	while ((c = getopt(argc, argv, "hnv")) != -1) {
++		switch (c) {
++			case '?':
++			case ':':
++			case 'h':usage(); exit(2);
++			case 'n':
++				opt_n = argv[optind++];
++				if (strcasecmp(opt_n, "DOS") == 0) {
++					g_nwns = NW_NS_DOS;
++				} else if (strcasecmp(opt_n, "MAC") == 0) {
++					g_nwns = NW_NS_MAC;
++				} else if (strcasecmp(opt_n, "NFS") == 0) {
++					g_nwns = NW_NS_NFS;
++				} else if (strcasecmp(opt_n, "FTAM") == 0) {
++					g_nwns = NW_NS_FTAM;
++				} else if (strcasecmp(opt_n, "LONG") == 0) {
++					g_nwns = NW_NS_LONG;
++				} else {
++					fprintf(stderr, _("Unrecognized namespace for option '-%c'\n"), c);
++					exit(1);
++				}
++				break;	
++			case 'v':g_verbose = 1;
++				 break;
++			default: fprintf(stderr, _("Unexpected option `-%c'\n"), c);
++				 break;
++		}
++	}
++	if (optind < argc) {
++		mount_path = argv[optind++];
++	} else {
++		mount_path = ".";
++	}
++	err = ncp_open_mount(mount_path, &conn);
++	if (err) {
++		com_err("nwlistsalvage", err, _("in ncp_open_mount"));
++		exit(1);
++	}
++	err = NWCCGetConnInfo(conn, NWCC_INFO_ROOT_ENTRY, sizeof(root), &root);
++	if (err) {
++		com_err("nwlistsalvage", err, _("when retrieving root entry"));
++		ncp_close(conn);
++		return 0;
++	}
++	
++	list_salvageable_files(conn, root.volume, root.dirEnt);
++
++	if (!g_files) {
++		printf(_("No salvageable files were found.\n"));
++	} else if (g_files == 1) {
++		printf(_("1 salvageable file was found.\n"));
++	} else {
++		printf(_("%d salvageable files were found.\n"), g_files);
++	}
++
++	ncp_close(conn);
++	return 0;
++}
++
+diff -r 08f41478a208 -r fc77f4249198 util/nwsalvage.c
+--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
++++ b/util/nwsalvage.c	Wed May 11 20:46:55 2005 +0000
+@@ -0,0 +1,171 @@
++/*
++    nwsalvage.c - Utility for salvaging deleted files from NetWare volumes
++    Copyright (c) 2005		Scott Bentley
++
++    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
++
++    Revision history:
++
++	0.00  2005			Scott Bentley
++		Initial revision.
++ */
++
++#include <stdlib.h>
++#include <string.h>
++#include <ncp/nwcalls.h>
++#include <unistd.h>
++
++#include "private/libintl.h"
++#define _(X) gettext(X)
++
++static void usage(void) {
++	printf(_(
++"usage: nwsalvage [options] directory file_id\n"
++"\n"
++"-h              Print this help text.\n"
++"-s              Silent mode.\n"
++"-n <namespace>  Namespace for accessing files\n"
++"                  DOS\n"
++"                  LONG - Default\n"
++"                  MAC\n"
++"                  FTAM\n"
++"                  NFS\n"
++"\n"
<<Diff was trimmed, longer than 597 lines>>


More information about the pld-cvs-commit mailing list