prout

smaller "lp" command
git clone git://git.2f30.org/prout
Log | Files | Refs | README | LICENSE

commit 083714912368dbbeb7eb493b85c5b4f596636209
parent 874146bf5a8339bb100fcb11466364993689936a
Author: Klemens Nanni <kl3@posteo.org>
Date:   Sun, 14 Feb 2016 01:12:35 +0100

Change wording, typofixes (comments)

Diffstat:
Mprout.c | 32++++++++++++++++----------------
1 file changed, 16 insertions(+), 16 deletions(-)

diff --git a/prout.c b/prout.c @@ -25,12 +25,12 @@ static void usage() printf("usage: prout [-h] <file>\n"); } -/* Return the file name if the file is opennable. exit instead */ +/* Return the file name if the file is opennable otherwise exit */ static char* check_file(char *file) { FILE *f; - /* Try to open the given file */ + /* Try to open given file */ f = fopen(file, "r"); if (!f) { @@ -38,28 +38,28 @@ static char* check_file(char *file) exit(1); } - /* Don't let the file close longer */ + /* Close file again */ fclose(f); return file; } -/* Return a pointer to the destion if reachable. exit instead */ +/* Return a pointer to the destination if reachable otherwise exit */ static cups_dest_t* check_dest() { int num_dests; cups_dest_t *dests, *dest; - /* Get the number of destionation configured */ + /* Get the number of destination configured */ num_dests = cupsGetDests(&dests); - /* Leave if there is no default printer configured */ + /* Exit if there is no default printer configured */ if (num_dests < 1) { fprintf(stderr, "No default printer configured\n"); exit(1); } - /* Get the default destination from all dests */ + /* Get the default destination from all destinations */ dest = cupsGetDest(NULL, NULL, 1, dests); /* No need to go on if we can't reach the printer */ @@ -71,7 +71,7 @@ static cups_dest_t* check_dest() return (dest); } -/* Return the job id of the printed file */ +/* Return the printed file's job ID */ static int print(const char* file, cups_dest_t *dest) { int job_id = -1; @@ -84,7 +84,7 @@ static int print(const char* file, cups_dest_t *dest) return job_id; } -/* Blocking function. Wait util the job is completed, or an error is thrown */ +/* Blocking function: Wait util the job is completed, or an error is thrown */ static void check_job (cups_dest_t *dest, int job_id) { int i, num_jobs; @@ -93,10 +93,10 @@ static void check_job (cups_dest_t *dest, int job_id) ipp_jstate_t state = IPP_JOB_PENDING; - /* GET ALL THE JOBS "\_(°D°)/ */ + /* get total number of jobs */ num_jobs = cupsGetJobs(&jobs, dest->name, 1, CUPS_WHICHJOBS_ALL); - /* Find MY job id */ + /* Find my job ID */ for (i = 0; i < num_jobs; i++) { if (jobs[i].id == job_id) { state = jobs[i].state; @@ -141,7 +141,7 @@ int main(int argc, char **argv) cups_dest_t *dest; - /* check the given arguments */ + /* check given arguments */ if (argc < 2) { usage(); exit(1); @@ -154,16 +154,16 @@ int main(int argc, char **argv) } } - /* check if the file is correct */ + /* check whether the file is correct */ file = check_file(argv[1]); - /* Is the default printer set up ? Can we use it ? */ + /* is the default printer set up? Can we use it? */ dest = check_dest(); - /* Well, let's print the file then */ + /* print the file */ job_id = print(file, dest); - /* How is the printing going ? */ + /* did it print successfully? */ check_job(dest, job_id); return 0;