Lines Matching +full:slice +full:- +full:per +full:- +full:line

1 /*-
2 * SPDX-License-Identifier: BSD-3-Clause
32 /* Many bug fixes are from Jim Guyton <guyton@rand-unix> */
35 * TFTP User Program -- Command Interface.
60 #include "tftp-utils.h"
61 #include "tftp-io.h"
62 #include "tftp-options.h"
109 static void makeargv(char *line);
135 "set per-packet retransmission timeout[-]" },
138 { "trace", setdebug, "enable 'debug packet'[-]" },
173 peer = -1; in main()
234 char line[MAXLINE]; in urihandling() local
272 sprintf(line, "get %s", path); in urihandling()
273 makeargv(line); in urihandling()
288 peer = -1; in setpeer0()
305 for (res = res0; res; res = res->ai_next) { in setpeer0()
306 if (res->ai_addrlen > sizeof(peeraddr)) in setpeer0()
308 peer = socket(res->ai_family, res->ai_socktype, in setpeer0()
309 res->ai_protocol); in setpeer0()
316 peer_sock.ss_family = res->ai_family; in setpeer0()
317 peer_sock.ss_len = res->ai_addrlen; in setpeer0()
321 peer = -1; in setpeer0()
331 /* res->ai_addr <= sizeof(peeraddr) is guaranteed */ in setpeer0()
332 memcpy(&peer_sock, res->ai_addr, res->ai_addrlen); in setpeer0()
333 if (res->ai_canonname) { in setpeer0()
334 (void) strlcpy(hostname, res->ai_canonname, in setpeer0()
347 char line[MAXLINE]; in setpeer() local
350 strcpy(line, "Connect "); in setpeer()
352 fgets(&line[strlen(line)], sizeof line - strlen(line), stdin); in setpeer()
353 makeargv(line); in setpeer()
379 for (p = modes; p->m_name; p++) in modecmd()
380 if (strcmp(argv[1], p->m_name) == 0) in modecmd()
382 if (p->m_name) { in modecmd()
383 settftpmode(p->m_mode); in modecmd()
392 for (p = modes; p->m_name != NULL; p++) { in modecmd()
393 printf("%s%s", sep, p->m_name); in modecmd()
434 char line[MAXLINE]; in put() local
438 strcpy(line, "send "); in put()
440 fgets(&line[strlen(line)], sizeof line - strlen(line), stdin); in put()
441 makeargv(line); in put()
449 targ = argv[argc - 1]; in put()
450 if (strrchr(argv[argc - 1], ':')) { in put()
453 for (n = 1; n < argc - 1; n++) in put()
458 lcp = argv[argc - 1]; in put()
461 if (lcp[0] == '[' && lcp[strlen(lcp) - 1] == ']') { in put()
462 lcp[strlen(lcp) - 1] = '\0'; in put()
496 for (n = 1; n < argc - 1; n++) { in put()
532 printf(" %s file1 file2 ... fileN [[host:]remote-directory]\n", s); in putusage()
545 char line[MAXLINE]; in get() local
548 strcpy(line, "get "); in get()
550 fgets(&line[strlen(line)], sizeof line - strlen(line), stdin); in get()
551 makeargv(line); in get()
577 if (lcp[0] == '[' && lcp[strlen(lcp) - 1] == ']') { in get()
578 lcp[strlen(lcp) - 1] = '\0'; in get()
626 char line[MAXLINE]; in settimeoutpacket() local
629 strcpy(line, "Packet timeout "); in settimeoutpacket()
631 fgets(&line[strlen(line)], sizeof line - strlen(line), stdin); in settimeoutpacket()
632 makeargv(line); in settimeoutpacket()
653 char line[MAXLINE]; in settimeoutnetwork() local
656 strcpy(line, "Network timeout "); in settimeoutnetwork()
658 fgets(&line[strlen(line)], sizeof line - strlen(line), stdin); in settimeoutnetwork()
659 makeargv(line); in settimeoutnetwork()
684 printf("Non-RFC defined options support: %s\n", in showstatus()
703 longjmp(toplevel, -1); in intr()
739 char line[MAXLINE]; in command() local
746 memcpy(line, bp, len); in command()
747 line[len - 1] = '\0'; in command()
750 line[0] = 0; in command()
751 if (fgets(line, sizeof line , stdin) == NULL) { in command()
759 if ((cp = strchr(line, '\n'))) in command()
761 if (line[0] == 0) in command()
763 makeargv(line); in command()
767 if (c == (struct cmd *)-1) { in command()
775 (*c->handler)(margc, margv); in command()
790 for (c = cmdtab; (p = c->name) != NULL; c++) { in getcmd()
795 if (q - name > longest) { in getcmd()
796 longest = q - name; in getcmd()
799 } else if (q - name == longest) in getcmd()
804 return ((struct cmd *)-1); in getcmd()
809 * Slice a string up into argc/argv.
812 makeargv(char *line) in makeargv() argument
818 if ((cp = strchr(line, '\n')) != NULL) in makeargv()
820 for (cp = line; margc < MAX_MARGV - 1 && *cp != '\0';) { in makeargv()
853 for (c = cmdtab; c->name; c++) in help()
854 printf("%-*s\t%s\n", (int)HELPINDENT, c->name, c->help); in help()
856 printf("\n[-] : You shouldn't use these ones anymore.\n"); in help()
858 printf("[**] : Non-standard RFC2347 option.\n"); in help()
861 while (--argc > 0) { in help()
865 if (c == (struct cmd *)-1) in help()
870 printf("%s\n", c->help); in help()
902 printf("Support for non-RFC defined options are now %s.\n", in setoptions()
908 "\toptions extra : toggle support for non-RFC defined options\n" in setoptions()
987 } else if (size > (int)maxdgram - 4) { in setblocksize()
990 maxdgram - 4); in setblocksize()
991 options_set_request(OPT_BLKSIZE, "%ld", maxdgram - 4); in setblocksize()
1005 "RFC2347 style or non-RFC defined options are not enabled " in setblocksize2()
1039 } else if (size > (int)maxdgram - 4) { in setblocksize2()
1042 maxdgram - 4); in setblocksize2()