common.c (251044) | common.c (297795) |
---|---|
1/* 2 * Copyright (c) 1983, 1993 3 * The Regents of the University of California. All rights reserved. 4 * (c) UNIX System Laboratories, Inc. 5 * All or some portions of this file are derived from material licensed 6 * to the University of California by American Telephone and Telegraph 7 * Co. or Unix System Laboratories, Inc. and are reproduced herein with 8 * the permission of UNIX System Laboratories, Inc. --- 29 unchanged lines hidden (view full) --- 38 39#if 0 40#ifndef lint 41static char sccsid[] = "@(#)common.c 8.5 (Berkeley) 4/28/95"; 42#endif /* not lint */ 43#endif 44 45#include "lp.cdefs.h" /* A cross-platform version of <sys/cdefs.h> */ | 1/* 2 * Copyright (c) 1983, 1993 3 * The Regents of the University of California. All rights reserved. 4 * (c) UNIX System Laboratories, Inc. 5 * All or some portions of this file are derived from material licensed 6 * to the University of California by American Telephone and Telegraph 7 * Co. or Unix System Laboratories, Inc. and are reproduced herein with 8 * the permission of UNIX System Laboratories, Inc. --- 29 unchanged lines hidden (view full) --- 38 39#if 0 40#ifndef lint 41static char sccsid[] = "@(#)common.c 8.5 (Berkeley) 4/28/95"; 42#endif /* not lint */ 43#endif 44 45#include "lp.cdefs.h" /* A cross-platform version of <sys/cdefs.h> */ |
46__FBSDID("$FreeBSD: head/usr.sbin/lpr/common_source/common.c 251044 2013-05-27 22:19:01Z gad $"); | 46__FBSDID("$FreeBSD: head/usr.sbin/lpr/common_source/common.c 297795 2016-04-10 23:47:40Z pfg $"); |
47 48#include <sys/param.h> 49#include <sys/stat.h> 50#include <sys/time.h> 51#include <sys/types.h> 52 53#include <ctype.h> 54#include <dirent.h> --- 222 unchanged lines hidden (view full) --- 277 (void) select(0, (fd_set *)0, (fd_set *)0, (fd_set *)0, &tdelay); 278} 279 280char * 281lock_file_name(const struct printer *pp, char *buf, size_t len) 282{ 283 static char staticbuf[MAXPATHLEN]; 284 | 47 48#include <sys/param.h> 49#include <sys/stat.h> 50#include <sys/time.h> 51#include <sys/types.h> 52 53#include <ctype.h> 54#include <dirent.h> --- 222 unchanged lines hidden (view full) --- 277 (void) select(0, (fd_set *)0, (fd_set *)0, (fd_set *)0, &tdelay); 278} 279 280char * 281lock_file_name(const struct printer *pp, char *buf, size_t len) 282{ 283 static char staticbuf[MAXPATHLEN]; 284 |
285 if (buf == 0) | 285 if (buf == NULL) |
286 buf = staticbuf; 287 if (len == 0) 288 len = MAXPATHLEN; 289 290 if (pp->lock_file[0] == '/') 291 strlcpy(buf, pp->lock_file, len); 292 else 293 snprintf(buf, len, "%s/%s", pp->spool_dir, pp->lock_file); 294 295 return buf; 296} 297 298char * 299status_file_name(const struct printer *pp, char *buf, size_t len) 300{ 301 static char staticbuf[MAXPATHLEN]; 302 | 286 buf = staticbuf; 287 if (len == 0) 288 len = MAXPATHLEN; 289 290 if (pp->lock_file[0] == '/') 291 strlcpy(buf, pp->lock_file, len); 292 else 293 snprintf(buf, len, "%s/%s", pp->spool_dir, pp->lock_file); 294 295 return buf; 296} 297 298char * 299status_file_name(const struct printer *pp, char *buf, size_t len) 300{ 301 static char staticbuf[MAXPATHLEN]; 302 |
303 if (buf == 0) | 303 if (buf == NULL) |
304 buf = staticbuf; 305 if (len == 0) 306 len = MAXPATHLEN; 307 308 if (pp->status_file[0] == '/') 309 strlcpy(buf, pp->status_file, len); 310 else 311 snprintf(buf, len, "%s/%s", pp->spool_dir, pp->status_file); --- 467 unchanged lines hidden --- | 304 buf = staticbuf; 305 if (len == 0) 306 len = MAXPATHLEN; 307 308 if (pp->status_file[0] == '/') 309 strlcpy(buf, pp->status_file, len); 310 else 311 snprintf(buf, len, "%s/%s", pp->spool_dir, pp->status_file); --- 467 unchanged lines hidden --- |