Import ncpfs 0.15

This commit is contained in:
ncpfs archive import
2026-04-28 20:39:57 +02:00
parent 7bef99df0f
commit b8ce93c8bd
9 changed files with 221 additions and 16 deletions

View File

@@ -6,7 +6,7 @@ UTIL_EXECS = ncpmount ncpumount nprint slist pqlist fsinfo pserver
UTILS = $(addprefix $(INTERM_BINDIR)/,$(UTIL_EXECS))
UIDUTILS = ncpmount ncpumount
# CFLAGS = -Wall $(INCLUDES) -O2 $(KERNELD)
#CFLAGS = -Wall $(INCLUDES) $(KERNELD) -g
CFLAGS = -Wall $(INCLUDES) $(KERNELD) -O2
CC = gcc

View File

@@ -1201,6 +1201,7 @@ ncp_find_conn_spec(const char *server, const char *user, const char *password,
str_upper(spec.server);
str_upper(spec.user);
spec.login_type = NCP_BINDERY_USER;
if (ncp_open_permanent(&conn, &spec) == 0)
{

View File

@@ -330,7 +330,7 @@ main(int argc, char *argv[])
exit(1);
}
#ifndef HAVE_KERNEL
#ifndef HAVE_KERNELD
/* Check if the ncpfs filesystem is in the kernel. If not, attempt
* to load the ncpfs module */
if (load_ncpfs() != 0)

View File

@@ -316,7 +316,7 @@ static void
help(void)
{
printf("\n");
printf("usage: %s [options] mount-point\n", progname);
printf("usage: %s [options] file\n", progname);
printf("\n"
"-S server Server name to be used\n"
"-U username Username sent to server\n"

View File

@@ -29,6 +29,7 @@ struct nw_queue {
static struct nw_queue q;
static int term_request;
static char *progname;
static int
init_queue(struct ncp_conn *conn, char *queue_name,
@@ -37,11 +38,31 @@ init_queue(struct ncp_conn *conn, char *queue_name,
static int
poll_queue(struct nw_queue *q);
void
static void
usage(void)
{
/* Obviously, there's more to do */
return;
fprintf(stderr, "usage: %s [options] file\n", progname);
exit(1);
}
static void
help(void)
{
printf("\n");
printf("usage: %s [options]\n", progname);
printf("\n"
"-S server Server name to be used\n"
"-U username Print Server name sent to server\n"
"-P password Use this password\n"
"-n Do not use any password\n"
"-C Don't convert password to uppercase\n"
"-q queue name Name of the printing queue to use\n"
"-c command Name of print command, default: 'lpr'\n"
"-j job type Type of job (Form number) to service\n"
"-t timeout Polling interval, default: 30 sec\n"
"-d Debug: don't daemonize\n"
"-h print this help text\n"
"\n");
}
#ifndef NCP_BINDERY_PSERVER
@@ -52,10 +73,10 @@ static void
terminate_handler()
{
signal(SIGTERM,terminate_handler);
signal(SIGINT, terminate_handler);
term_request=1;
}
#if 0
static void
daemonize()
{
@@ -77,7 +98,6 @@ daemonize()
close(fd);
}
}
#endif
int
main(int argc, char *argv[])
@@ -87,19 +107,46 @@ main(int argc, char *argv[])
int opt;
int job_type = 0xffff;
int debug = 0;
int i;
char *queue_name = NULL;
char default_command[] = "lpr";
char *command = default_command;
progname = argv[0];
for (i = 1; i < argc; i += 1)
{
if ( (strcmp(argv[i], "-h") == 0)
|| (strcmp(argv[i], "-?") == 0))
{
help();
exit(0);
}
}
for (i = 1; i < argc; i += 1)
{
if (strcmp(argv[i], "-d") == 0)
{
debug = 1;
break;
}
}
if (debug == 0)
{
daemonize();
}
if (ncp_initialize_as(&conn, &argc, argv, 1, NCP_BINDERY_PSERVER) != 0)
{
perror("Could not open connection");
return 1;
}
while ((opt = getopt(argc, argv, "q:c:j:t:d")) != EOF)
while ((opt = getopt(argc, argv, "q:c:j:t:dh")) != EOF)
{
switch (opt)
{
@@ -118,18 +165,26 @@ main(int argc, char *argv[])
case 'd':
debug = 1;
break;
case 'h':
break;
default:
usage();
return -1;
}
}
if (argc != optind)
{
usage();
return -1;
}
memzero(q);
if (debug == 0)
if (queue_name == NULL)
{
/* We can not daemonize after ncp_initialize, sorry */
/* daemonize(); */
fprintf(stderr, "You must specify a queue\n");
return 1;
}
if (init_queue(&conn, queue_name, command, &q) != 0)
@@ -143,6 +198,7 @@ main(int argc, char *argv[])
term_request = 0;
signal(SIGTERM,terminate_handler);
signal(SIGINT, terminate_handler);
while (1)
{