aboutsummaryrefslogtreecommitdiff
path: root/usr.sbin/lpr/common_source/displayq.c
Commit message (Collapse)AuthorAgeFilesLines
* usr.sbin: Automated cleanup of cdefs and other formattingWarner Losh2023-11-271-3/+0
| | | | | | | | | | | | | | | | Apply the following automated changes to try to eliminate no-longer-needed sys/cdefs.h includes as well as now-empty blank lines in a row. Remove /^#if.*\n#endif.*\n#include\s+<sys/cdefs.h>.*\n/ Remove /\n+#include\s+<sys/cdefs.h>.*\n+#if.*\n#endif.*\n+/ Remove /\n+#if.*\n#endif.*\n+/ Remove /^#if.*\n#endif.*\n/ Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/types.h>/ Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/param.h>/ Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/capsicum.h>/ Sponsored by: Netflix
* usr.sbin: Remove ancient SCCS tags.Warner Losh2023-11-271-3/+0
| | | | | | | | Remove ancient SCCS tags from the tree, automated scripting, with two minor fixup to keep things compiling. All the common forms in the tree were removed with a perl script. Sponsored by: Netflix
* Remove $FreeBSD$: one-line .c patternWarner Losh2023-08-161-2/+0
| | | | Remove /^[\s*]*__FBSDID\("\$FreeBSD\$"\);?\s*\n/
* General further adoption of SPDX licensing ID tags.Pedro F. Giffuni2017-11-201-1/+3
| | | | | | | | | | | | | | | | | Mainly focus on files that use BSD 3-Clause license. The Software Package Data Exchange (SPDX) group provides a specification to make it easier for automated tools to detect and summarize well known opensource licenses. We are gradually adopting the specification, noting that the tags are considered only advisory and do not, in any way, superceed or replace the license texts. Special thanks to Wind River for providing access to "The Duke of Highlander" tool: an older (2014) run over FreeBSD tree was useful as a starting point. Notes: svn path=/head/; revision=326025
* Renumber copyright clause 4Warner Losh2017-02-281-1/+1
| | | | | | | | | | | | Renumber cluase 4 to 3, per what everybody else did when BSD granted them permission to remove clause 3. My insistance on keeping the same numbering for legal reasons is too pedantic, so give up on that point. Submitted by: Jan Schaumann <jschauma@stevens.edu> Pull Request: https://github.com/freebsd/freebsd/pull/96 Notes: svn path=/head/; revision=314436
* Rename getline with get_line to avoid collision with getline(3)Baptiste Daroussin2016-05-101-2/+2
| | | | | | | | When getline(3) in 2009 was added a _WITH_GETLINE guard has also been added. This rename is made in preparation for the removal of this guard Notes: svn path=/head/; revision=299357
* Let lpr build with -Wmissing-variable-declarations.Ed Schouten2012-10-251-2/+0
| | | | | | | | | Mark variables static where possible and place the uid/euid variables in lp.h, so that we can compile-time enforce that these variables have the same type. Notes: svn path=/head/; revision=242091
* Check the return error of set[ug]id. While this can never fail in theEitan Adler2012-10-221-20/+21
| | | | | | | | | | | | | | | | | current version of FreeBSD, this isn't guarenteed by the API. Custom security modules, or future implementations of the setuid and setgid may fail. PR: bin/172289 PR: bin/172290 PR: bin/172291 Submittud by: Erik Cederstrand <erik@cederstrand.dk> Discussed by: freebsd-security Approved by: cperciva MFC after: 1 week Notes: svn path=/head/; revision=241852
* Remove the advertising clause from UCB copyrighted files in usr.sbin. ThisJoel Dahl2010-12-111-4/+0
| | | | | | | | is in accordance with the information provided at ftp://ftp.cs.berkeley.edu/pub/4bsd/README.Impt.License.Change Notes: svn path=/head/; revision=216372
* Fix end-of-line issues that can come up when `lpq' reads informationGarance A Drosehn2009-06-241-1/+102
| | | | | | | | | | | | | | | | | about a queue from a remote host. That remote host may use \r, \r\n, or \n\r as the line-ending character. In some cases the remote host will write a single line of information without *any* EOL sequence. Translate all the non-unix EOL's to the standard newline, and make sure the final line includes a terminating newline. Logic is also added to translate all unprintable characters to '?', but that is #if-ed out for now. PR: bin/104731 MFC after: 3 weeks Notes: svn path=/head/; revision=194859
* Fix so all parts of lpd, lpc, lpq, and lprm will use the same algorithmGarance A Drosehn2004-12-311-7/+8
| | | | | | | | | | | | | | | | | | | | for calculating the job number for a job based on the control-file name. We might receive cf-files named by other implementations of lpr, where the job number shown by lpq would not match the job number that other commands expected for the same name. This also uses a newer algorithm for determining a job number, to avoid problems caused when a control-file is named using an IP address, instead of the hostname. This also moved the declaration if isowner() from lp.h to rmjob.c. When I went to change the parameters, I noticed that rmjob.c was the only source file which uses it. MFC after: 2 weeks Notes: svn path=/head/; revision=139464
* Get the 'sccsid' lines even closer to correct style(9) form. TheGarance A Drosehn2003-07-141-0/+3
| | | | | | | | | | | '#ifdef lint/#endif' around the lines should not have been removed. Also add blank lines where one (per file) was missing. Reviewed by: First part noticed by bde, blank lines noticed by me MFC after: 15 days Notes: svn path=/head/; revision=117592
* Take advantage of the common_source/lp.cdefs.h file to change lprGarance A Drosehn2003-07-141-6/+4
| | | | | | | | | | | source to use __FBSDID() for setting rcsids. Also fix the format of 'sccsid' lines to consistently match style(9) guidelines. Reviewed by: discussed with bde and obrien MFC after: 15 days Notes: svn path=/head/; revision=117541
* Fix buffer overflow in queue file handling.Kris Kennaway2001-08-301-7/+13
| | | | | | | | Submitted by: millert@openbsd.org, gad Reported by: X-Force <xforce@iss.net> Notes: svn path=/head/; revision=82557
* Replace calls to strncpy with calls to strlcpy, and remove the extra stepGarance A Drosehn2001-07-221-6/+3
| | | | | | | | | needed to ensure that the result is null-terminated when using strncpy(). MFC after: 8 days Notes: svn path=/head/; revision=80133
* Fix most of the warnings generated by compiling lpr with -Wnon-const-format,Garance A Drosehn2001-07-151-3/+3
| | | | | | | | | | | | often by just telling gcc that some internal routine is "__printflike" (work done by Kris Kennaway <kris@FreeBSD.org>). Also fix the new warnings which show up once gcc starts checking the "printf-like parameters" passed to those routines. MFC after: 1 week Notes: svn path=/head/; revision=79739
* Rename a few global variables which hold hostname-related values to beGarance A Drosehn2001-06-151-7/+7
| | | | | | | | | | | | | | | | | | more sensible/understandable. 'from'->'from_host' 'host'->'local_host' 'fromb'->'frombuf' 'fromhost'->'origin_host' and a local-variable named 'host'->'hostbuf'. This fixes some compile-time warnings about local variables shadowing global variables. Other than renaming variables, the only actual code changes are to call strlcpy() instead of strncpy() when setting those (renamed) variables, and that 'from_ip' is now a strdup()-created buffer instead of being a static buffer compiled in as 1025 bytes. Reviewed by: freebsd-print@bostonradio.org (an earlier version) MFC after: 1 week Notes: svn path=/head/; revision=78300
* Fix about 90-100 warnings one gets when trying to compile lpr&friendsGarance A Drosehn2001-06-121-39/+25
| | | | | | | | | | | | | | | with BDECFLAGS on, mainly by adding 'const' to parameters in a number of routine declarations. While I'm at it, ANSI-fy all of the routine declarations. The resulting object code is exactly the same after this update as before it, with the exception of one unavoidable change to lpd.o on freebsd/alpha. Also added $FreeBSD$ line to lpc/extern.h lpc/lpc.h lptest/lptest.c Reviewed by: /sbin/md5, and no feedback from freebsd-audit Notes: svn path=/head/; revision=78146
* Cosmetic change of a structure name.Garance A Drosehn2000-11-061-3/+3
| | | | | | | | | | Turn 'struct queue { q_time, q_name }' (loosely-speaking) into 'struct jobqueue { job_time, job_cfname }' Reviewed by: GAWollman Notes: svn path=/head/; revision=68401
* Make the standard 'lpq' output a little more informative when listing jobsGarance A Drosehn2000-10-311-12/+39
| | | | | | | | | | which have long names. Instead of just listing '...', try to list some reasonable subset of the name (with a "..." to indicate something missing). Reviewed by: freebsd-print@bostonradio.org (only a little review) Notes: svn path=/head/; revision=68101
* Fix 'lpq' so it can correctly display jobs which come from hosts usingGarance A Drosehn2000-10-311-9/+44
| | | | | | | | | 'lprNG' (which writes control-lines in a different order than our lpr). Reviewed by: freebsd-print@bostonradio.org Notes: svn path=/head/; revision=68100
* $Id$ -> $FreeBSD$Peter Wemm1999-08-281-1/+1
| | | | Notes: svn path=/head/; revision=50479
* The printf type checking in gcc wants %qd to be a long long, so addJohn Birrell1998-05-131-2/+2
| | | | | | | a cast in case off_t is not a long long (as on alpha). Notes: svn path=/head/; revision=35998
* Mega lpd/lpd upgrade, part I:Garrett Wollman1997-12-021-61/+58
| | | | | | | | | | | | | | | | | | - Get rid of a lot of the static variables which were shared by many routines and programs in the suite. - Create an abstract interface to the printcap database, so that other retrieval and iteration mechanisms could be developed (e.g., YP, Hesiod, or automatic retrieval from a trusted server). - Give each capability a human-readable name in addition to the historic two-character one. - Otherwise generally clean up a lot of dark corners. Many still remain. - When submitting jobs, use the official login name record (from getlogin()) if there is one, rather than reverse-mapping the uid. More to come... Notes: svn path=/head/; revision=31492
* Argl! Who's got the pointy hat these days? Hand it over to me, ASAP!Joerg Wunsch1997-11-071-0/+1
| | | | | | | | When setting an alarm that didn't trigger, i gotta clear it again before going on. Hmpf! Notes: svn path=/head/; revision=31020
* One could be surprised how much bugs can still be found here...Joerg Wunsch1997-10-151-2/+3
| | | | | | | | | | | | | | | Properlay clean the global RM variable if cgetstr() failed for it. Otherwise, a connection attempt to a remote machine was made (and a bogus result code printed) if a local printer followed a remote one in printcap, and you did a `lpq -a', since checkremote() falsely assumed the printer to be a remote one. While i was at it, removed a gratuituous newline printed in front of the remote machine's name, thus making the output more consistent (and better machine-parseable) now. Notes: svn path=/head/; revision=30437
* Improve my hack from rev 1.6 of displayq.c, and make the TCPJoerg Wunsch1997-10-141-1/+3
| | | | | | | | | | | connection timeout controllable by a new printcap(5) capability named `ct' (connectiom timeout), defaulting to 120 seconds (which is the default TCP connection timeout). Would anybody see a problem with merging all this into RELENG_2_2? Notes: svn path=/head/; revision=30407
* common_source: staticize private version of warn() so to not conflictJoerg Wunsch1997-08-231-1/+2
| | | | | | | | | | | | with libc's version. lpd: use getopt(3), err(3), add usage(), allow specification of a port # on the command line as the documentation suggested for more than 10 years. PR: docs/3290 Notes: svn path=/head/; revision=28621
* Two minor, pedantic fixes from bde for my last pedantic fixes, plusWarner Losh1997-07-291-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | the following from recent OpenBSD changes. These changes (and all I've made) should be merged back into 2.2 when they are vetted in -current. common.c: OpenBSD 1.7: mickey: #if __STDC__ --> #ifdef __STDC__ displayq.c: OpenBSD 1.8: deraadt: 1 byte oflows; millert rmjob.c: OpenBSD 1.8: deraadt: 1 byte oflows; millert cmds.c: OpenBSD 1.9: grr: restore traditional "all" keyword option - see lpc(8) [[ This makes lpc status all work again -- imp ]] printjob.c: OpenBSD 1.17: deraadt: use sendmail -t OpenBSD 1.16: mickey: #if __STDC__ --> #ifdef __STDC__ OpenBSD 1.15: deraadt: 1 byte oflow; Don.Lewis@tsc.tdk.com recvjob.c: OpenBSD 1.11: mickey: #if __STDC__ --> #ifdef __STDC__ lpr.c: OpenBSD 1.19: mickey: #if __STDC__ --> #ifdef __STDC__ Obtained from: OpenBSD Notes: svn path=/head/; revision=27757
* Use setuid/seteuid around dangerous operations. Also a few bufferWarner Losh1997-07-231-5/+29
| | | | | | | | | | | | | | | overflow patches that were "near" to where these operations are taking place. The buffer overflows are from OpenBSD. The setuid/seteuid patches are from NetBSD by way of OpenBSD (they changed them a little), at least from my read of the tree. This is the first of a series of OpenBSD lpr/et al merges. It (and them) should be merged back into 2.2 and/or 2.1 (if requested) branches when they have been shaken out in -current. Obtained from: OpenBSD Notes: svn path=/head/; revision=27618
* Imply a 10-second connection timeout when querying remote queues, toJoerg Wunsch1997-06-231-0/+13
| | | | | | | | prevent lpq from hanging indefinately (well, 10 minutes are for sure counting as `indefinately' in this case). Notes: svn path=/head/; revision=26844
* Buffer overflow from OpenBSD:Warner Losh1997-02-091-5/+8
| | | | | | | | | | | | | Rev 1.4 deraadt: (partial from full commit, other files not done yet) proactive bounds checking; help from millert Rev 1.5 millert: Possible buf oflow. Plus minor style nits to keep the style police happy (I hope) Obtained from: OpenBSD Notes: svn path=/head/; revision=22466
* Cleanup.Joerg Wunsch1996-05-091-5/+0
| | | | | | | | | | | | The removed files are no longer needed, they are actually labelled as ``Use only if you are not 4.4BSD''. (Yeah, the ol' crufty printcap.c is really gone!) Properly declare all external objects in files ending in .h, as opposed to embed them into files ending in .c. Notes: svn path=/head/; revision=15703
* Pull a bunch of fixes from the 4.4BSD-Lite2 branch. It's reallyJoerg Wunsch1996-05-051-12/+13
| | | | | | | | | | | | | | | surprising how many trivial errors there have been... :-) Some more cleanup is needed, but i'd like to separate the Lite2 changes from other work, that's why this goes into a different commit. People with serial printers should see whether i have broken the stty- style printcap options (i hope not). Inspired by: Sergey Shkonda <serg@bcs1.bcs.zaporizhzhe.ua> Notes: svn path=/head/; revision=15648
* Fix my botched 4.4Lite2 import, and revert these files to their HEADJoerg Wunsch1996-05-051-14/+13
| | | | | | | versions. Notes: svn path=/head/; revision=15646
* Vendor-branch import of the 4.4BSD-Lite2 code for lpr. There areJoerg Wunsch1996-05-051-0/+450
several bugfixes in it that are worth considering. Don't be alarmed about the import conflicts... Obtained from: 4.4BSD-Lite2 Notes: svn path=/vendor/CSRG/dist/; revision=15637